Commit 15214186 authored by Franco Fichtner's avatar Franco Fichtner

interfaces: url_safe() redirects for #1168

parent 6d8de705
...@@ -336,7 +336,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -336,7 +336,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$if = $_GET['if']; $if = $_GET['if'];
} else { } else {
// no interface provided, redirect to interface assignments // no interface provided, redirect to interface assignments
header("Location: interfaces_assign.php"); header(url_safe('Location: /interfaces_assign.php'));
exit; exit;
} }
...@@ -535,7 +535,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -535,7 +535,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} }
@unlink('/tmp/.interfaces.apply'); @unlink('/tmp/.interfaces.apply');
header("Location: interfaces.php?if={$if}"); header(url_safe('Location: /interfaces.php?if=%s', array($if)));
exit; exit;
} elseif (empty($pconfig['enable'])) { } elseif (empty($pconfig['enable'])) {
if (isset($a_interfaces[$if]['enable'])) { if (isset($a_interfaces[$if]['enable'])) {
...@@ -556,7 +556,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -556,7 +556,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$toapplylist[$if]['ppps'] = $a_ppps; $toapplylist[$if]['ppps'] = $a_ppps;
/* we need to be able remove IP aliases for IPv6 */ /* we need to be able remove IP aliases for IPv6 */
file_put_contents('/tmp/.interfaces.apply', serialize($toapplylist)); file_put_contents('/tmp/.interfaces.apply', serialize($toapplylist));
header("Location: interfaces.php?if={$if}"); header(url_safe('Location: /interfaces.php?if=%s', array($if)));
exit; exit;
} else { } else {
// locate sequence in ppp list // locate sequence in ppp list
...@@ -1271,7 +1271,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -1271,7 +1271,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
mark_subsystem_dirty('interfaces'); mark_subsystem_dirty('interfaces');
header("Location: interfaces.php?if={$if}"); header(url_safe('Location: /interfaces.php?if=%s', array($if)));
exit; exit;
} }
} }
......
...@@ -134,7 +134,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -134,7 +134,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// if interface is already used, redirect. // if interface is already used, redirect.
foreach (legacy_config_get_interfaces() as $ifname => $ifdata) { foreach (legacy_config_get_interfaces() as $ifname => $ifdata) {
if ($ifdata['if'] == $_POST['if_add']) { if ($ifdata['if'] == $_POST['if_add']) {
header("Location: interfaces_assign.php"); header(url_safe('Location: /interfaces_assign.php'));
exit; exit;
} }
} }
...@@ -166,7 +166,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -166,7 +166,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
write_config(); write_config();
header("Location: interfaces_assign.php"); header(url_safe('Location: /interfaces_assign.php'));
exit; exit;
} elseif (!empty($_POST['id']) && !empty($_POST['action']) && $_POST['action'] == 'del' & !empty($config['interfaces'][$_POST['id']]) ) { } elseif (!empty($_POST['id']) && !empty($_POST['action']) && $_POST['action'] == 'del' & !empty($config['interfaces'][$_POST['id']]) ) {
// ** Delete interface ** // ** Delete interface **
...@@ -216,8 +216,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -216,8 +216,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
unset($config['dhcpd']['wan']); unset($config['dhcpd']['wan']);
} }
link_interface_to_vlans($realid, "update"); link_interface_to_vlans($realid, "update");
// redirect header(url_safe('Location: /interfaces_assign.php'));
header("Location: interfaces_assign.php");
exit; exit;
} }
} elseif (isset($_POST['Submit'])) { } elseif (isset($_POST['Submit'])) {
...@@ -326,8 +325,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -326,8 +325,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
filter_configure(); filter_configure();
enable_rrd_graphing(); enable_rrd_graphing();
} }
// redirect header(url_safe('Location: /interfaces_assign.php'));
header("Location: interfaces_assign.php");
exit; exit;
} }
} }
......
...@@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
unset($a_bridges[$id]); unset($a_bridges[$id]);
write_config(); write_config();
header("Location: interfaces_bridge.php"); header(url_safe('Location: /interfaces_bridge.php'));
exit; exit;
} }
} }
......
...@@ -205,7 +205,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -205,7 +205,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($confif <> "") { if ($confif <> "") {
interface_configure($confif); interface_configure($confif);
} }
header("Location: interfaces_bridge.php"); header(url_safe('Location: /interfaces_bridge.php'));
exit; exit;
} }
} }
......
...@@ -57,7 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -57,7 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
mwexec("/sbin/ifconfig " . escapeshellarg($a_gifs[$id]['gifif']) . " destroy"); mwexec("/sbin/ifconfig " . escapeshellarg($a_gifs[$id]['gifif']) . " destroy");
unset($a_gifs[$id]); unset($a_gifs[$id]);
write_config(); write_config();
header("Location: interfaces_gif.php"); header(url_safe('Location: /interfaces_gif.php'));
exit; exit;
} }
} }
......
...@@ -137,7 +137,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -137,7 +137,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($confif <> "") { if ($confif <> "") {
interface_configure($confif); interface_configure($confif);
} }
header("Location: interfaces_gif.php"); header(url_safe('Location: /interfaces_gif.php'));
exit; exit;
} }
} }
......
...@@ -58,7 +58,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -58,7 +58,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
mwexec("/sbin/ifconfig " . escapeshellarg($a_gres[$id]['greif']) . " destroy"); mwexec("/sbin/ifconfig " . escapeshellarg($a_gres[$id]['greif']) . " destroy");
unset($a_gres[$id]); unset($a_gres[$id]);
write_config(); write_config();
header("Location: interfaces_gre.php"); header(url_safe('Location: /interfaces_gre.php'));
exit; exit;
} }
} }
......
...@@ -111,7 +111,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -111,7 +111,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($confif <> "") { if ($confif <> "") {
interface_configure($confif); interface_configure($confif);
} }
header("Location: interfaces_gre.php"); header(url_safe('Location: /interfaces_gre.php'));
exit; exit;
} }
} }
......
...@@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
unset($a_ifgroups[$id]); unset($a_ifgroups[$id]);
write_config(); write_config();
header("Location: interfaces_groups.php"); header(url_safe('Location: /interfaces_groups.php'));
exit; exit;
} }
} }
......
...@@ -126,7 +126,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -126,7 +126,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
write_config(); write_config();
interface_group_setup($ifgroupentry); interface_group_setup($ifgroupentry);
header("Location: interfaces_groups.php"); header(url_safe('Location: /interfaces_groups.php'));
exit; exit;
} }
} }
......
...@@ -68,7 +68,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -68,7 +68,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
mwexec_bg("/sbin/ifconfig " . escapeshellarg($a_laggs[$id]['laggif']) . " destroy"); mwexec_bg("/sbin/ifconfig " . escapeshellarg($a_laggs[$id]['laggif']) . " destroy");
unset($a_laggs[$id]); unset($a_laggs[$id]);
write_config(); write_config();
header("Location: interfaces_lagg.php"); header(url_safe('Location: /interfaces_lagg.php'));
exit; exit;
} }
} }
......
...@@ -147,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -147,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($confif <> "") { if ($confif <> "") {
interface_configure($confif); interface_configure($confif);
} }
header("Location: interfaces_lagg.php"); header(url_safe('Location: /interfaces_lagg.php'));
exit; exit;
} }
} }
......
...@@ -59,7 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -59,7 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} else { } else {
unset($a_ppps[$id]); unset($a_ppps[$id]);
write_config(); write_config();
header("Location: interfaces_ppps.php"); header(url_safe('Location: /interfaces_ppps.php'));
exit; exit;
} }
} }
......
...@@ -251,7 +251,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -251,7 +251,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($config['interfaces'][$pppif]['if'] == $ppp['if']) if ($config['interfaces'][$pppif]['if'] == $ppp['if'])
interface_ppps_configure($pppif); interface_ppps_configure($pppif);
} }
header("Location: interfaces_ppps.php"); header(url_safe('Location: /interfaces_ppps.php'));
exit; exit;
} }
} }
......
...@@ -73,7 +73,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -73,7 +73,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
write_config(); write_config();
header("Location: interfaces_qinq.php"); header(url_safe('Location: /interfaces_qinq.php'));
exit; exit;
} }
} }
......
...@@ -119,7 +119,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -119,7 +119,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
write_config(); write_config();
header("Location: interfaces_qinq.php"); header(url_safe('Location: /interfaces_qinq.php'));
exit; exit;
} }
} }
......
...@@ -61,7 +61,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -61,7 +61,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
unset($a_vlans[$id]); unset($a_vlans[$id]);
write_config(); write_config();
header("Location: interfaces_vlan.php"); header(url_safe('Location: /interfaces_vlan.php'));
exit; exit;
} }
} }
......
...@@ -132,7 +132,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -132,7 +132,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($confif <> "") { if ($confif <> "") {
interface_configure($confif); interface_configure($confif);
} }
header("Location: interfaces_vlan.php"); header(url_safe('Location: /interfaces_vlan.php'));
exit; exit;
} }
} }
......
...@@ -58,7 +58,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { ...@@ -58,7 +58,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
unset($a_clones[$_POST['id']]); unset($a_clones[$_POST['id']]);
write_config(); write_config();
header("Location: interfaces_wireless.php"); header(url_safe('Location: /interfaces_wireless.php'));
exit; exit;
} }
} }
......
...@@ -121,7 +121,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -121,7 +121,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}); });
write_config(); write_config();
header("Location: interfaces_wireless.php"); header(url_safe('Location: /interfaces_wireless.php'));
exit; exit;
} }
} }
......
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