From 67473d80ef16ae9010136686bdf447bae599af8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Thu, 14 Aug 2008 16:06:48 +0000 Subject: [PATCH] * Move the interface detection of which interface is configured to the top so the pppoe reset function work correctly. * Check is the array isset before referenceing it. --- usr/local/www/interfaces.php | 21 +++++++++++---------- usr/local/www/interfaces_wan.php | 21 +++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 59c73ba9ed..af9666580c 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -38,6 +38,15 @@ ##|*MATCH=interfaces_wan.php* ##|-PRIV +unset($if); +if ($_GET['if']) + $if = $_GET['if']; +else if ($_POST['if']) + $if = $_POST['if']; + +if (!$if) + $if = "wan"; + define("CRON_MONTHLY_PATTERN", "0 0 1 * *"); define("CRON_WEEKLY_PATTERN", "0 0 * * 0"); @@ -80,15 +89,6 @@ function remove_bad_chars($string) { require("guiconfig.inc"); -unset($if); -if ($_GET['if']) - $if = $_GET['if']; -else if ($_POST['if']) - $if = $_POST['if']; - -if (!$if) - $if = "wan"; - if (!is_array($config['gateways']['gateway_item'])) $config['gateways']['gateway_item'] = array(); $a_gateways = &$config['gateways']['gateway_item']; @@ -363,7 +363,8 @@ n already exists."; unset($wancfg['provider']); unset($wancfg['ondemand']); unset($wancfg['timeout']); - unset($wancfg['pppoe']['pppoe-reset-type']); + if ($wancfg['pppoe']['pppoe-reset-type']) + unset($wancfg['pppoe']['pppoe-reset-type']); unset($wancfg['local']); unset($wancfg['subnet']); unset($wancfg['remote']); diff --git a/usr/local/www/interfaces_wan.php b/usr/local/www/interfaces_wan.php index 59c73ba9ed..af9666580c 100755 --- a/usr/local/www/interfaces_wan.php +++ b/usr/local/www/interfaces_wan.php @@ -38,6 +38,15 @@ ##|*MATCH=interfaces_wan.php* ##|-PRIV +unset($if); +if ($_GET['if']) + $if = $_GET['if']; +else if ($_POST['if']) + $if = $_POST['if']; + +if (!$if) + $if = "wan"; + define("CRON_MONTHLY_PATTERN", "0 0 1 * *"); define("CRON_WEEKLY_PATTERN", "0 0 * * 0"); @@ -80,15 +89,6 @@ function remove_bad_chars($string) { require("guiconfig.inc"); -unset($if); -if ($_GET['if']) - $if = $_GET['if']; -else if ($_POST['if']) - $if = $_POST['if']; - -if (!$if) - $if = "wan"; - if (!is_array($config['gateways']['gateway_item'])) $config['gateways']['gateway_item'] = array(); $a_gateways = &$config['gateways']['gateway_item']; @@ -363,7 +363,8 @@ n already exists."; unset($wancfg['provider']); unset($wancfg['ondemand']); unset($wancfg['timeout']); - unset($wancfg['pppoe']['pppoe-reset-type']); + if ($wancfg['pppoe']['pppoe-reset-type']) + unset($wancfg['pppoe']['pppoe-reset-type']); unset($wancfg['local']); unset($wancfg['subnet']); unset($wancfg['remote']);