From 767a716ecd96105621e239633c04651a02bd8fb8 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 15 Jan 2006 03:33:18 +0000 Subject: Correct warnings and errors found eclipse --- usr/local/captiveportal/radius_accounting.inc | 5 ++++- usr/local/captiveportal/radius_authentication.inc | 1 + usr/local/www/diag_logs_filter.php | 2 +- usr/local/www/diag_ping.php | 2 ++ usr/local/www/guiconfig.inc | 9 ++++++--- usr/local/www/includes/functions.inc.php | 23 ++++++++++++++--------- usr/local/www/interfaces_wlan.inc | 2 +- usr/local/www/pkg_edit.php | 5 ++++- usr/local/www/services_dhcp_relay.php | 3 +++ usr/local/www/status.php | 2 ++ usr/local/www/status_interfaces.php | 6 ++++-- 11 files changed, 42 insertions(+), 18 deletions(-) (limited to 'usr') diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index 14264f6..9744809 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -35,6 +35,7 @@ */ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip) { + global $debug, $nasHostname, $errstr; $sharedsecret=$radiuskey ; # $debug = 1 ; @@ -42,6 +43,7 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad if(!$nasHostname[0]) $nasHostname[0] = "m0n0wall" ; + $errno = ""; $fd = @fsockopen("udp://$radiusip",$radiusport,$errno,$errstr,3) ; if(!$fd) return 1 ; /* error return */ @@ -137,8 +139,9 @@ function RADIUS_ACCOUNTING_START($username,$sessionid,$radiusip,$radiusport,$rad function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$interimupdate=false) { $sharedsecret=$radiuskey ; + global $debug, $errno, $ipfw, $errstr,$nasHostname; + $matches = ""; # $debug = 1 ; - exec("/bin/hostname", $nasHostname) ; if(!$nasHostname[0]) $nasHostname[0] = "quewall" ; diff --git a/usr/local/captiveportal/radius_authentication.inc b/usr/local/captiveportal/radius_authentication.inc index c106da3..86e5bfe 100644 --- a/usr/local/captiveportal/radius_authentication.inc +++ b/usr/local/captiveportal/radius_authentication.inc @@ -30,6 +30,7 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusip,$radiusport,$radiuskey) { $sharedsecret=$radiuskey ; + global $debug, $errno, $nasHostname, $errstr; # $debug = 1 ; exec("/bin/hostname", $nasHostname) ; diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index ae766b4..19b2f45 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -56,7 +56,7 @@ function conv_clog($logfile, $tail = 50) { $iftable[$config['interfaces']['opt' . $i]['if']] = $config['interfaces']['opt' . $i]['descr']; $sor = isset($config['syslog']['reverse']) ? "-r" : ""; - + $logarr = ""; exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n 500", $logarr); $filterlog = array(); diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index 81d2f7a..5dee4d6 100755 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -71,6 +71,8 @@ function get_interface_addr($ifdescr) { $if = $config['interfaces'][$ifdescr]['if']; /* try to determine IP address and netmask with ifconfig */ + $ifconfiginfo = ""; + $matches = ""; unset($ifconfiginfo); exec("/sbin/ifconfig " . $if, $ifconfiginfo); diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 81dcb7d..9f581d1 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -172,7 +172,8 @@ function exec_rc_script($scriptname) { if (file_exists($d_sysrebootreqd_path)) return 0; - + $execoutput = ""; + $retval = ""; exec($scriptname . " >/dev/null 2>&1", $execoutput, $retval); return $retval; } @@ -180,7 +181,8 @@ function exec_rc_script($scriptname) { function exec_rc_script_async($scriptname) { global $d_sysrebootreqd_path; - + $execoutput = ""; + $retval = ""; if (file_exists($d_sysrebootreqd_path)) return 0; @@ -548,7 +550,8 @@ function update_changedesc($update) { function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") { global $g, $config; - $sor = isset($config['syslog']['reverse']) ? "-r" : ""; + $sor = isset($config['syslog']['reverse']) ? "-r" : ""; + $logarr = ""; exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr); if(is_array($grepfor)) { $i = 0; diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index d87adcc..6abbf75 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -20,6 +20,8 @@ function get_stats() { function get_uptime() { + $boottime = ""; + $matches = ""; exec("/sbin/sysctl -n kern.boottime", $boottime); preg_match("/sec = (\d+)/", $boottime[0], $matches); $boottime = $matches[1]; @@ -67,15 +69,16 @@ function cpu_usage() { function get_pfstate() { global $config; - if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) - $maxstates="/{$config['system']['maximumstates']}"; - else - $maxstates="/10000"; - $curentries = `/sbin/pfctl -si |grep current`; - if (preg_match("/([0-9]+)/", $curentries, $matches)) { - $curentries = $matches[1]; - } - return $curentries . $maxstates; + $matches = ""; + if (isset($config['system']['maximumstates']) and $config['system']['maximumstates'] > 0) + $maxstates="/{$config['system']['maximumstates']}"; + else + $maxstates="/10000"; + $curentries = `/sbin/pfctl -si |grep current`; + if (preg_match("/([0-9]+)/", $curentries, $matches)) { + $curentries = $matches[1]; + } + return $curentries . $maxstates; } function has_temp() { @@ -111,6 +114,7 @@ function get_temp() { function disk_usage() { + $dfout = ""; exec("/bin/df -h | /usr/bin/grep -w '/' | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d '%' -f 1", $dfout); $diskusage = trim($dfout[0]); @@ -129,6 +133,7 @@ function swap_usage() function mem_usage() { + $memory = ""; exec("/sbin/sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_inactive_count " . "vm.stats.vm.v_cache_count vm.stats.vm.v_free_count", $memory); diff --git a/usr/local/www/interfaces_wlan.inc b/usr/local/www/interfaces_wlan.inc index 56ca5cf..955b818 100755 --- a/usr/local/www/interfaces_wlan.inc +++ b/usr/local/www/interfaces_wlan.inc @@ -79,7 +79,7 @@ function wireless_config_init() { } function wireless_config_post() { - global $optcfg, $pconfig; + global $optcfg, $pconfig, $input_errors; unset($input_errors); diff --git a/usr/local/www/pkg_edit.php b/usr/local/www/pkg_edit.php index 244df30..90e938e 100755 --- a/usr/local/www/pkg_edit.php +++ b/usr/local/www/pkg_edit.php @@ -600,11 +600,12 @@ function fixup_string($string) { */ function parse_package_templates() { global $pkg, $config; + $rows = 0; if($pkg['templates']['template'] <> "") foreach($pkg['templates']['template'] as $pkg_template_row) { $filename = $pkg_template_row['filename']; $template_text = $pkg_template_row['templatecontents']; - + $firstfield = ""; /* calculate total row helpers count */ foreach ($pkg['fields']['field'] as $fields) { if($fields['type'] == "rowhelper") { @@ -618,6 +619,7 @@ function parse_package_templates() { if($firstfield == $rowhelperfield['fieldname']) $rows++; } $comd = "\$value = \$_POST['" . $rowhelperfield['fieldname'] . $x . "'];"; + $value = ""; eval($comd); if($value <> "") { //$template_text = str_replace($fieldname . "_fieldvalue", $fieldvalue, $template_text); @@ -653,6 +655,7 @@ function parse_package_templates() { $row_helper_data .= $value; $isfirst = 1; } + $sep = ""; ereg($rowhelperfield['fieldname'] . "_fieldvalue\[(.*)\]", $template_text, $sep); foreach ($sep as $se) $seperator = $se; if($seperator <> "") { diff --git a/usr/local/www/services_dhcp_relay.php b/usr/local/www/services_dhcp_relay.php index cb2497a..01daadc 100755 --- a/usr/local/www/services_dhcp_relay.php +++ b/usr/local/www/services_dhcp_relay.php @@ -34,6 +34,9 @@ function get_wan_dhcp_server() { $dhclientfn = $g['vardb_path'] . "/dhclient.leases"; $leases = file($dhclientfn); /* Start at the end, work backwards finding the latest lease for the WAN */ + $dhcpserver = ""; + $iface = ""; + $iface = ""; for ($i = (count($leases)-1); $i >= 0; $i--) { if ($leases[$i] == "}") { unset($iface); diff --git a/usr/local/www/status.php b/usr/local/www/status.php index 287c1a3..f33e171 100755 --- a/usr/local/www/status.php +++ b/usr/local/www/status.php @@ -37,6 +37,8 @@ function doCmdT($title, $command) { } fclose($fd); } else { + $execOutput = ""; + $execStatus = ""; exec ($command . " 2>&1", $execOutput, $execStatus); for ($i = 0; isset($execOutput[$i]); $i++) { if ($i > 0) { diff --git a/usr/local/www/status_interfaces.php b/usr/local/www/status_interfaces.php index cf37e26..5dcd57b 100755 --- a/usr/local/www/status_interfaces.php +++ b/usr/local/www/status_interfaces.php @@ -62,7 +62,7 @@ if ($_POST) { function get_interface_info($ifdescr) { - global $config; + global $config, $linkinfo, $netstatrninfo; $ifinfo = array(); @@ -74,6 +74,7 @@ function get_interface_info($ifdescr) { $ifinfo['if'] = $ifinfo['hwif']; /* run netstat to determine link info */ + unset($linkinfo); exec("/usr/bin/netstat -I " . $ifinfo['hwif'] . " -nWb -f link", $linkinfo); $linkinfo = preg_split("/\s+/", $linkinfo[1]); @@ -128,6 +129,7 @@ function get_interface_info($ifdescr) { $ifinfo['pppoelink'] = "down"; } else { /* get PPPoE link status for dial on demand */ + $ifconfiginfo = ""; unset($ifconfiginfo); exec("/sbin/ifconfig " . $ifinfo['if'], $ifconfiginfo); @@ -165,7 +167,7 @@ function get_interface_info($ifdescr) { /* try to determine media with ifconfig */ unset($ifconfiginfo); exec("/sbin/ifconfig " . $ifinfo['hwif'], $ifconfiginfo); - + $matches = ""; foreach ($ifconfiginfo as $ici) { if (!isset($config['interfaces'][$ifdescr]['wireless'])) { /* don't list media/speed for wireless cards, as it always -- cgit v1.1