FIx arrap_map to array_map. Don't assume _REQUEST[mids] exists. Fixes #3859

pull/3862/head
Isaac Connor 2024-03-10 10:59:56 -04:00
parent f0088e49d7
commit b647280766
1 changed files with 9 additions and 8 deletions

View File

@ -21,12 +21,11 @@ require_once('includes/Zone.php');
global $error_message; global $error_message;
global $redirect; global $redirect;
if ($action == 'delete') { if ($action == 'delete') {
if (isset($_REQUEST['markZids'])) { if (isset($_REQUEST['markZids'])) {
$monitors_to_restart = array(); $monitors_to_restart = array();
foreach ($_REQUEST['markZids'] as $markZid) { foreach ($_REQUEST['markZids'] as $markZid) {
$zone = new ZM\Zone($markZid); $zone = new ZM\Zone(validCardinal($markZid));
if (!$zone->Id()) { if (!$zone->Id()) {
$error_message .= 'Zone not found for id ' . $markZid.'<br/>'; $error_message .= 'Zone not found for id ' . $markZid.'<br/>';
continue; continue;
@ -41,14 +40,16 @@ if ($action == 'delete') {
$error_message .= $zone->delete(); $error_message .= $zone->delete();
} # end foreach Zone } # end foreach Zone
if (daemonCheck()) {
foreach ($monitors_to_restart as $monitor) { foreach ($monitors_to_restart as $monitor) {
if ( daemonCheck() and ($monitor->Type() != 'WebSite') ) { if ($monitor->Type() != 'WebSite') {
$monitor->zmcControl('restart'); $monitor->zmcControl('restart');
} // end if daemonCheck() }
}
} }
$refreshParent = true; $refreshParent = true;
if (!$error_message) if (!$error_message)
$redirect = '?view=zones&'.implode('&', array_map(function($mid){ return 'mids[]='.$mid; }, $_REQUEST['mids'])); $redirect = '?view=zones'.(isset($_REQUEST['mids']) ? '&'.implode('&', array_map(function($mid){ return 'mids[]='.$mid; }, $_REQUEST['mids'])): '');
} else { } else {
$error_message .= 'No Zones marked for deletion.<br/>'; $error_message .= 'No Zones marked for deletion.<br/>';
} // end if isset($_REQUEST['markZids']) } // end if isset($_REQUEST['markZids'])