Commit c975897d authored by Ad Schellevis's avatar Ad Schellevis

(legacy) remove redirectHeader, closes https://github.com/opnsense/core/issues/470

parent 58ab1e61
......@@ -136,7 +136,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (write_config()) {
mark_subsystem_dirty('aliases');
}
redirectHeader("firewall_aliases.php");
header("Location: firewall_aliases.php");
exit;
}
}
......
......@@ -656,12 +656,6 @@ function get_crash_report($pedantic = false)
return $savemsg;
}
function redirectHeader($text)
{
header("Location: $text");
}
function get_menu_messages()
{
global $config;
......
......@@ -71,7 +71,7 @@ if (isset($_POST['act']))
if ($act == "del") {
if (!$a_acls[$id]) {
redirectHeader("services_unbound_acls.php");
header("Location: services_unbound_acls.php");
exit;
}
......@@ -148,7 +148,7 @@ if ($_POST) {
mark_subsystem_dirty("unbound");
write_config();
redirectHeader("/services_unbound_acls.php");
header("Location: /services_unbound_acls.php");
exit;
}
......
......@@ -263,11 +263,11 @@ if ($_POST) {
exec($pkg['restart_command'] . ">/dev/null 2&>1");
if(!empty($pkg['aftersaveredirect'])) {
redirectHeader($pkg['aftersaveredirect']);
header("Location: ".$pkg['aftersaveredirect']);
} elseif(empty($pkg['adddeleteeditpagefields'])) {
redirectHeader("services_upnp.php?id=0");
header("Location: services_upnp.php?id=0");
} elseif(empty($pkg['preoutput'])) {
redirectHeader("services_upnp.php");
header("Location: services_upnp.php");
}
exit;
} else {
......
......@@ -138,7 +138,7 @@ if ($_POST) {
}
write_config();
redirectHeader("system_advanced_notifications.php");
header("Location: system_advanced_notifications.php");
return;
}
......
......@@ -66,7 +66,7 @@ if ($act == "del") {
unset($a_tunable[$id]);
write_config();
mark_subsystem_dirty('sysctl');
redirectHeader("system_advanced_sysctl.php");
header("Location: system_advanced_sysctl.php");
exit;
}
}
......@@ -100,7 +100,7 @@ if ($_POST) {
write_config();
redirectHeader("system_advanced_sysctl.php");
header("Location: system_advanced_sysctl.php");
exit;
}
}
......
......@@ -244,7 +244,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config();
redirectHeader("system_authservers.php");
header("Location: system_authservers.php");
} else {
$act = "edit";
}
......@@ -259,7 +259,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg = gettext("Authentication Server")." {$serverdeleted} ".
gettext("deleted")."<br />";
write_config($savemsg);
redirectHeader("system_authservers.php");
header("Location: system_authservers.php");
}
}
......
......@@ -166,7 +166,7 @@ if (isset($_GET['act'])) {
if ($act == "del") {
if (!isset($a_ca[$id])) {
redirectHeader("system_camanager.php");
header("Location: system_camanager.php");
exit;
}
......@@ -188,13 +188,13 @@ if ($act == "del") {
unset($a_ca[$id]);
write_config();
$savemsg = sprintf(gettext("Certificate Authority %s and its CRLs (if any) successfully deleted"), $name) . "<br />";
redirectHeader("system_camanager.php");
header("Location: system_camanager.php");
exit;
}
if ($act == "edit") {
if (!isset($a_ca[$id])) {
redirectHeader("system_camanager.php");
header("Location: system_camanager.php");
exit;
}
$pconfig['descr'] = $a_ca[$id]['descr'];
......@@ -220,7 +220,7 @@ if ($act == "new") {
if ($act == "exp") {
if (!$a_ca[$id]) {
redirectHeader("system_camanager.php");
header("Location: system_camanager.php");
exit;
}
......@@ -237,7 +237,7 @@ if ($act == "exp") {
if ($act == "expkey") {
if (!$a_ca[$id]) {
redirectHeader("system_camanager.php");
header("Location: system_camanager.php");
exit;
}
......@@ -404,7 +404,7 @@ if ($_POST) {
unset($input_errors);
}
// redirectHeader("system_camanager.php");
// header("Location: system_camanager.php");
}
}
include("head.inc");
......
......@@ -143,7 +143,7 @@ if (isset($_GET['act'])) {
if ($act == "del") {
if (!isset($a_cert[$id])) {
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -151,7 +151,7 @@ if ($act == "del") {
unset($a_cert[$id]);
write_config();
$savemsg = sprintf(gettext("Certificate %s successfully deleted"), $name) . "<br />";
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -170,7 +170,7 @@ if ($act == "new") {
if ($act == "exp") {
if (!$a_cert[$id]) {
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -187,7 +187,7 @@ if ($act == "exp") {
if ($act == "key") {
if (!$a_cert[$id]) {
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -204,7 +204,7 @@ if ($act == "key") {
if ($act == "p12") {
if (!$a_cert[$id]) {
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -233,7 +233,7 @@ if ($act == "p12") {
if ($act == "csr") {
if (!$a_cert[$id]) {
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
exit;
}
......@@ -476,7 +476,7 @@ if ($_POST) {
}
if (isset($userid)) {
redirectHeader("system_usermanager.php?act=edit&userid=".$userid);
header("Location: system_usermanager.php?act=edit&userid=".$userid);
exit;
}
}
......@@ -526,7 +526,7 @@ if ($_POST) {
write_config();
redirectHeader("system_certmanager.php");
header("Location: system_certmanager.php");
}
}
}
......
......@@ -139,7 +139,7 @@ if (!empty($id)) {
// If we were given an invalid crlref in the id, no sense in continuing as it would only cause errors.
if (!isset($thiscrl) && (($act != "") && ($act != "new"))) {
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
$act="";
$savemsg = gettext("Invalid CRL reference.");
}
......@@ -193,7 +193,7 @@ if ($act == "addcert") {
$pconfig = $_POST;
if (!$pconfig['crlref'] || !$pconfig['certref']) {
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
exit;
}
......@@ -217,7 +217,7 @@ if ($act == "addcert") {
cert_revoke($cert, $crl, $reason);
openvpn_refresh_crls();
write_config("Revoked cert {$cert['descr']} in CRL {$crl['descr']}.");
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
exit;
}
}
......@@ -225,7 +225,7 @@ if ($act == "addcert") {
if ($act == "delcert") {
if (!is_array($thiscrl['cert'])) {
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
exit;
}
$found = false;
......@@ -236,7 +236,7 @@ if ($act == "delcert") {
}
}
if (!$found) {
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
exit;
}
$name = $thiscert['descr'];
......@@ -306,7 +306,7 @@ if ($_POST) {
write_config("Saved CRL {$crl['descr']}");
openvpn_refresh_crls();
redirectHeader("system_crlmanager.php");
header("Location: system_crlmanager.php");
}
}
......
......@@ -76,7 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($a_group[$id]);
write_config();
// reload page
redirectHeader("system_groupmanager.php");
header("Location: system_groupmanager.php");
exit;
} elseif (isset($id) && $act == "delpriv" && isset($a_group[$id]['priv']) && is_array($a_group[$id]['priv'])) {
// remove by privid
......@@ -95,7 +95,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config();
// reload page
redirectHeader("system_groupmanager.php?act=edit&groupid={$id}");
header("Location: system_groupmanager.php?act=edit&groupid={$id}");
exit;
} elseif (isset($pconfig['save'])) {
$input_errors = array();
......@@ -171,7 +171,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
} else {
// POST without a valid action, redirect to overview
redirectHeader("system_groupmanager.php");
header("Location: system_groupmanager.php");
exit;
}
}
......
......@@ -40,7 +40,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$groupid = $_GET['groupid'];
$a_group = & $config['system']['group'][$groupid];
} else {
redirectHeader("system_groupmanager.php");
header("Location: system_groupmanager.php");
exit;
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
......@@ -82,11 +82,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
write_config();
redirectHeader("system_groupmanager.php?act=edit&groupid={$groupid}");
header("Location: system_groupmanager.php?act=edit&groupid={$groupid}");
exit;
}
} else {
redirectHeader("system_groupmanager.php");
header("Location: system_groupmanager.php");
exit;
}
}
......
......@@ -169,7 +169,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($a_user[$id]);
write_config();
$savemsg = gettext("User")." {$userdeleted} ". gettext("successfully deleted");
redirectHeader("system_usermanager.php?savemsg=".$savemsg);
header("Location: system_usermanager.php?savemsg=".$savemsg);
exit;
} elseif ($act == "delpriv" && !empty($pconfig['priv_delete']) && isset($id)) {
// drop privilege from user
......@@ -190,9 +190,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config();
$savemsg = gettext("Privilege")." {$privdeleted} ".
gettext("successfully deleted");
redirectHeader("system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
header("Location: system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
} else {
redirectHeader("system_usermanager.php?act=edit&userid=".$id);
header("Location: system_usermanager.php?act=edit&userid=".$id);
}
exit;
} elseif ($act == "delcert" && isset($id)) {
......@@ -203,7 +203,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
write_config();
$savemsg = gettext("Certificate")." {$certdeleted} ".
gettext("association removed.");
redirectHeader("system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
header("Location: system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
exit;
} elseif ($act == "newApiKey" && isset($id)) {
// every action is using the sequence of the user, to keep it understandable, we will use
......@@ -230,7 +230,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg = gettext('No API key found');
}
// redirect
redirectHeader("system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
header("Location: system_usermanager.php?savemsg=".$savemsg."&act=edit&userid=".$id);
exit;
} elseif (isset($pconfig['save'])) {
// save user
......@@ -404,14 +404,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
local_user_set_groups($userent, $pconfig['groups']);
write_config();
redirectHeader("system_usermanager.php");
header("Location: system_usermanager.php");
exit;
}
} elseif (isset($id)) {
redirectHeader("system_usermanager.php?userid=".$id);
header("Location: system_usermanager.php?userid=".$id);
exit;
} else {
redirectHeader("system_usermanager.php");
header("Location: system_usermanager.php");
exit;
}
}
......
......@@ -47,7 +47,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($_GET['userid']) && isset($config['system']['user'][$_GET['userid']]['name'])) {
$userid = $_GET['userid'];
} else {
redirectHeader("system_usermanager.php");
header("Location: system_usermanager.php");
exit;
}
$a_user = & $config['system']['user'][$userid];
......@@ -83,11 +83,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$retval = write_config();
$savemsg = get_std_save_message();
redirectHeader("system_usermanager.php?act=edit&userid=".$userid."&savemsg=".$savemsg);
header("Location: system_usermanager.php?act=edit&userid=".$userid."&savemsg=".$savemsg);
exit;
}
} else {
redirectHeader("system_usermanager.php");
header("Location: system_usermanager.php");
exit;
}
}
......
......@@ -59,7 +59,7 @@ if ($_GET['act'] == "del") {
unset($a_secret[$_GET['id']]);
write_config();
mark_subsystem_dirty('l2tpusers');
redirectHeader("vpn_l2tp_users.php");
header("Location: vpn_l2tp_users.php");
exit;
}
}
......
......@@ -130,7 +130,7 @@ if ($_POST) {
$retval = vpn_l2tp_configure();
redirectHeader("vpn_l2tp_users.php");
header("Location: vpn_l2tp_users.php");
exit;
}
......
......@@ -129,7 +129,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($act == "del") {
// remove client
if (!isset($id) || !isset($a_client[$id])) {
redirectHeader("vpn_openvpn_client.php");
header("Location: vpn_openvpn_client.php");
exit;
}
if (!empty($a_client[$id])) {
......
......@@ -92,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($act == "del") {
if (!isset($a_csc[$id])) {
redirectHeader("vpn_openvpn_csc.php");
header("Location: vpn_openvpn_csc.php");
exit;
}
......
......@@ -115,11 +115,11 @@ if (isset($config['openvpn']['openvpn-server'])) {
$usrid = isset($_GET['usrid']) ? $_GET['usrid'] : false;
$crtid = isset($_GET['crtid']) ? $_GET['crtid'] : false;
if ($srvid === false) {
redirectHeader("vpn_openvpn_export.php");
header("Location: vpn_openvpn_export.php");
exit;
} elseif (($config['openvpn']['openvpn-server'][$srvid]['mode'] != "server_user") &&
(($usrid === false) || ($crtid === false))) {
redirectHeader("vpn_openvpn_export.php");
header("Location: vpn_openvpn_export.php");
exit;
}
......
......@@ -71,7 +71,7 @@ if (isset($_GET['act'])) {
$srvid = isset($_GET['srvid']) ? $_GET['srvid'] : false;
if ($srvid === false || !isset($config['openvpn']['openvpn-server'][$srvid]['mode']) ||
$config['openvpn']['openvpn-server'][$srvid]['mode'] != "p2p_shared_key") {
redirectHeader("vpn_openvpn_export.php");
header("Location: vpn_openvpn_export.php");
exit;
}
......
......@@ -136,7 +136,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($act == "del") {
// action delete
if (!isset($a_server[$id])) {
redirectHeader("vpn_openvpn_server.php");
header("Location: vpn_openvpn_server.php");
exit;
}
if (!empty($a_server[$id])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment