diff --git a/web/ajax/monitor.php b/web/ajax/monitor.php index 92402e0ad..5e9030053 100644 --- a/web/ajax/monitor.php +++ b/web/ajax/monitor.php @@ -2,8 +2,8 @@ ini_set('display_errors', '0'); if ( canView('Monitors') ) { - $mid = (isset($_REQUEST['mid']) && !empty($_REQUEST['mid'])) ? $_REQUEST['mid'] : null; - if (!$mid) { + $mid = isset($_REQUEST['mid']) ? $_REQUEST['mid'] : null; + if ($mid === null || $mid === '') { ajaxError(translate('RequestMissing') . ' "mid".'); } @@ -18,9 +18,10 @@ if ( canView('Monitors') ) { if (isset($_REQUEST['monitorName']) && !empty($_REQUEST['monitorName'])) { $monitorName = $_REQUEST['monitorName']; - $cleanedMonitorName = preg_replace($filterRegexp, '', trim($monitorName)); - if ($monitorName != $cleanedMonitorName){ - preg_match_all($filterRegexp, trim($monitorName), $badChars); + $trimmedMonitorName = trim($monitorName); + $cleanedMonitorName = preg_replace($filterRegexp, '', $trimmedMonitorName); + if ($trimmedMonitorName != $cleanedMonitorName){ + preg_match_all($filterRegexp, $trimmedMonitorName, $badChars); $result = false; $message = translate('BadNameCharsList') . ' "' . implode('","', array_unique($badChars[0])) . '".~~' . translate('BadNameChars'); } diff --git a/web/includes/actions/monitor.php b/web/includes/actions/monitor.php index 5f951401a..ddbde6bd9 100644 --- a/web/includes/actions/monitor.php +++ b/web/includes/actions/monitor.php @@ -186,7 +186,7 @@ if ($action == 'save') { $storagePath = $Storage->Path() .'/'; $dirStoragePath = opendir($storagePath); if($dirStoragePath === false) { - ZM\Warning("Unable to check and delete old symlinks to monitor with ID=".$monitor->Id()." in the '".$monitor->Id()."' storage because the path to the storage is missing or unreadable."); + ZM\Warning("Unable to check and delete old symlinks to monitor with ID=".$monitor->Id()." in the '".$Storage->Name()."' storage because the path to the storage is missing or unreadable."); } else { while (($file = readdir($dirStoragePath)) !== false) { $linkPath = $storagePath . $file;