From 63637de9323161beccf84ed60f69696ce11a5c24 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Mon, 4 Jul 2005 19:52:23 +0000 Subject: Code cleanup --- usr/local/www/diag_backup.php | 2 +- usr/local/www/diag_logs_vpn.php | 2 +- usr/local/www/guiconfig.inc | 6 +++--- usr/local/www/index.php | 2 +- usr/local/www/pkg_edit.php | 10 ++++++---- usr/local/www/status_interfaces.php | 2 +- usr/local/www/status_wireless.php | 2 +- usr/local/www/wizard.php | 13 +++++++------ 8 files changed, 21 insertions(+), 18 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index d1ad327..f63cc9d 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -258,4 +258,4 @@ include("head.inc"); - + \ No newline at end of file diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php index 21d806c..630f540 100755 --- a/usr/local/www/diag_logs_vpn.php +++ b/usr/local/www/diag_logs_vpn.php @@ -45,7 +45,7 @@ if ($_POST['clear']) { } function dump_clog_vpn($logfile, $tail) { - global $g, $config; + global $config; $sor = isset($config['syslog']['reverse']) ? "-r" : ""; diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index de3659d..431d967 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -275,7 +275,7 @@ function pprint_port($port) { /* sort by interface only, retain the original order of rules that apply to the same interface */ function filter_rules_sort() { - global $g, $config; + global $config; /* mark each rule with the sequence number (to retain the order while sorting) */ for ($i = 0; isset($config['filter']['rule'][$i]); $i++) @@ -296,7 +296,7 @@ function filter_rules_sort() { } function nat_rules_sort() { - global $g, $config; + global $config; function natcmp($a, $b) { if ($a['external-address'] == $b['external-address']) { @@ -571,7 +571,7 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p if ($pnot) $adr['not'] = true; else - unset($addr['not']); + unset($adr['not']); if (($pbeginport != 0) && ($pbeginport != "any")) { if ($pbeginport != $pendport) diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 03093f6..2b2acf1 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -131,7 +131,7 @@ return $cpuUsage; } function get_pfstate() { - global $config, $g; + global $config; if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) $maxstates="/{$config['system']['maximumstates']}"; else diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index 7b71bcf..8c350df 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -611,12 +611,14 @@ function fixup_string($string) { global $config; // fixup #1: $myurl -> http[s]://ip_address:port/ $https = ""; - $port = ""; - $urlport = ""; $port = $config['system']['webguiport']; - if($port <> "443" and $port <> "80") $urlport = ":" . $port; + if($port <> "443" and $port <> "80") + $urlport = ":" . $port; + else + $urlport = ""; + if($config['system']['webguiproto'] == "https") $https = "s"; - $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlportport; + $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlport; $newstring = str_replace("\$myurl", $myurl, $string); $string = $newstring; // fixup #2: $wanip diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php index 197eefe..f5a1e86 100755 --- a/usr/local/www/status_interfaces.php +++ b/usr/local/www/status_interfaces.php @@ -56,7 +56,7 @@ if ($_POST) { function get_interface_info($ifdescr) { - global $config, $g; + global $config; $ifinfo = array(); diff --git a/usr/local/www/status_wireless.php b/usr/local/www/status_wireless.php index aa47ab6..82ff93c 100755 --- a/usr/local/www/status_wireless.php +++ b/usr/local/www/status_wireless.php @@ -34,7 +34,7 @@ require("guiconfig.inc"); function get_wireless_info($ifdescr) { - global $config, $g; + global $config; $ifinfo = array(); $ifinfo['if'] = $config['interfaces'][$ifdescr]['if']; diff --git a/usr/local/www/wizard.php b/usr/local/www/wizard.php index 02afa97..16991a1 100755 --- a/usr/local/www/wizard.php +++ b/usr/local/www/wizard.php @@ -435,18 +435,19 @@ function fixup_string($string) { $newstring = $string; // fixup #1: $myurl -> http[s]://ip_address:port/ $https = ""; - $port = ""; - $urlport = ""; $port = $config['system']['webguiport']; - if($port <> "443" and $port <> "80") $urlport = ":" . $port; - if($config['system']['webguiproto'] == "https") $https = "s"; - $myurl = "http" . $https . "://" . $config['interfaces']['lan']['ipaddr']; + if($port <> "443" and $port <> "80") + $urlport = ":" . $port; + else + $urlport = ""; + if($config['system']['webguiproto'] == "https") + $https = "s"; + $myurl = "http" . $https . "://" . $config['interfaces']['lan']['ipaddr'] . $urlport; $newstring = str_replace("\$myurl", $myurl, $newstring); // fixup #2: $wanip $curwanip = get_current_wan_address(); $newstring = str_replace("\$wanip", $curwanip, $newstring); // fixup #3: $lanip - $lancfg = $config['interfaces']['lan']; $lanip = $config['interfaces']['lan']['ipaddr']; $newstring = str_replace("\$lanip", $lanip, $newstring); // fixup #4: fix'r'up here. -- cgit v1.1