diff --git a/src/www/interfaces_qinq.php b/src/www/interfaces_qinq.php index e81d54346..adaae24da 100644 --- a/src/www/interfaces_qinq.php +++ b/src/www/interfaces_qinq.php @@ -1,162 +1,179 @@ $intf) { + if ($intf['if'] == $qinq_intf) { + return true; + } + } + return false; } -if ($_GET['act'] == "del") { - $id = $_GET['id']; - - /* check if still in use */ - if (qinq_inuse($id)) { - $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); - } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) { - $input_errors[] = gettext("QinQ interface does not exist"); - } else { - $qinq =& $a_qinqs[$id]; - - $delmembers = explode(" ", $qinq['members']); - if (count($delmembers) > 0) { - foreach ($delmembers as $tag) - mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:"); - } - mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:"); - mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:"); - mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy"); - unset($a_qinqs[$id]); - - write_config(); - - header("Location: interfaces_qinq.php"); - exit; - } +if (!isset($config['qinqs']['qinqentry']) || !is_array($config['qinqs']['qinqentry'])) { + $a_qinqs = array(); +} else { + $a_qinqs = &$config['qinqs']['qinqentry']; } +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + if (!empty($a_qinqs[$_POST['id']])) { + $id = $_POST['id']; + } + + if (!empty($_POST['action']) && $_POST['action'] == "del" && isset($id)) { + /* check if still in use */ + if (qinq_inuse($a_qinqs[$id]['qinqif'])) { + $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface."); + } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) { + $input_errors[] = gettext("QinQ interface does not exist"); + } else { + $qinq =& $a_qinqs[$id]; + + $delmembers = explode(" ", $qinq['members']); + if (count($delmembers) > 0) { + foreach ($delmembers as $tag) { + mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:"); + } + } + mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:"); + mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:"); + mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy"); + unset($a_qinqs[$id]); + + write_config(); + + header("Location: interfaces_qinq.php"); + exit; + } + } +} + + + include("head.inc"); - +legacy_html_escape_form_data($a_qinqs); $main_buttons = array( - array('href'=>'interfaces_qinq_edit.php', 'label'=>gettext('Add')), + array('href'=>'interfaces_qinq_edit.php', 'label'=>gettext('Add')), ); ?> + -
-
-
- - 0) print_input_errors($input_errors); ?> - -
- -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
 
- - - - - 20) - echo substr(htmlspecialchars($qinq['members']), 0, 20) . "..."; - else - echo htmlspecialchars($qinq['members']); - ?> - -   - - - "> - - " onclick="return confirm('')"> -
-
- -
-

-
-
-

-
- -
- -
-
-
-
-
+
+
+
+ 0) print_input_errors($input_errors); ?> +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
 
20 ? substr($qinq['members'], 0, 20) . "..." : $qinq['members'] ;?> + "> + + + +
+
+
+

+
+ +

+
+
+
+
+
+
+