mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-06-23 04:59:37 -04:00
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user