Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
IgorA100
2026-05-27 09:57:42 +03:00
committed by GitHub
parent 121bc31de6
commit d4bbf23c98
2 changed files with 7 additions and 6 deletions

View File

@@ -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');
}

View File

@@ -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;