" . gettext("detail") . ")";
$savemsg .= empty($savemsg) ? "" : "
";
$savemsg .= patch_test_revert($a_patches[$_GET['id']]) ? gettext("Patch can be reverted cleanly") : gettext("Patch can NOT be reverted cleanly");
$savemsg .= " (" . gettext("detail") . ")";
}
if (($_GET['fulltest']) && ($a_patches[$_GET['id']])) {
if ($_GET['fulltest'] == "apply") {
$fulldetail = patch_test_apply($a_patches[$_GET['id']], true);
} elseif ($_GET['fulltest'] == "revert") {
$fulldetail = patch_test_revert($a_patches[$_GET['id']], true);
}
}
if (($_GET['act'] == "apply") && ($a_patches[$_GET['id']])) {
$savemsg = patch_apply($a_patches[$_GET['id']]) ? gettext("Patch applied successfully") : gettext("Patch could NOT be applied!");
}
if (($_GET['act'] == "revert") && ($a_patches[$_GET['id']])) {
$savemsg = patch_revert($a_patches[$_GET['id']]) ? gettext("Patch reverted successfully") : gettext("Patch could NOT be reverted!");
}
if (isset($_POST['del_x'])) {
/* delete selected patches */
if (is_array($_POST['patch']) && count($_POST['patch'])) {
foreach ($_POST['patch'] as $patchi) {
unset($a_patches[$patchi]);
}
write_config();
header("Location: system_patches.php");
exit;
}
} else {
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
unset($movebtn);
foreach ($_POST as $pn => $pd) {
if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
$movebtn = $matches[1];
break;
}
}
/* move selected patches before this patch */
if (isset($movebtn) && is_array($_POST['patch']) && count($_POST['patch'])) {
$a_patches_new = array();
/* copy all patches < $movebtn and not selected */
for ($i = 0; $i < $movebtn; $i++) {
if (!in_array($i, $_POST['patch']))
$a_patches_new[] = $a_patches[$i];
}
/* copy all selected patches */
for ($i = 0; $i < count($a_patches); $i++) {
if ($i == $movebtn)
continue;
if (in_array($i, $_POST['patch']))
$a_patches_new[] = $a_patches[$i];
}
/* copy $movebtn patch */
if ($movebtn < count($a_patches))
$a_patches_new[] = $a_patches[$movebtn];
/* copy all patches > $movebtn and not selected */
for ($i = $movebtn+1; $i < count($a_patches); $i++) {
if (!in_array($i, $_POST['patch']))
$a_patches_new[] = $a_patches[$i];
}
$a_patches = $a_patches_new;
write_config();
header("Location: system_patches.php");
return;
}
}
$closehead = false;
$pgtitle = array(gettext("System"),gettext("Patches"));
include("head.inc");
?>