$pd) { if (preg_match("/move_(\d+)_x/", $pn, $matches)) { $movebtn = $matches[1]; break; } } /* move selected services before this service */ if (isset($movebtn) && is_array($_POST['pwservices']) && count($_POST['pwservices'])) { $a_pwservices_new = array(); /* copy all services < $movebtn and not selected */ for ($i = 0; $i < $movebtn; $i++) { if (!in_array($i, $_POST['pwservices'])) $a_pwservices_new[] = $a_pwservices[$i]; } /* copy all selected services */ for ($i = 0; $i < count($a_pwservices); $i++) { if ($i == $movebtn) continue; if (in_array($i, $_POST['pwservices'])) $a_pwservices_new[] = $a_pwservices[$i]; } /* copy $movebtn service */ if ($movebtn < count($a_pwservices)) $a_pwservices_new[] = $a_pwservices[$movebtn]; /* copy all services > $movebtn and not selected */ for ($i = $movebtn+1; $i < count($a_pwservices); $i++) { if (!in_array($i, $_POST['pwservices'])) $a_pwservices_new[] = $a_pwservices[$i]; } $a_pwservices = $a_pwservices_new; procwatch_cron_job(); write_config(); header("Location: services_procwatch.php"); return; } } $closehead = false; $pgtitle = array(gettext("Services"),gettext("ProcWatch")); include("head.inc"); ?>