diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-15 10:38:12 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-15 10:38:12 +0545 |
commit | abe98adb911f9ff76af12034646a4c64e26d6390 (patch) | |
tree | 49c09b6bdf22f6afb54eb99e6d2287a8c65283d7 /src/usr/local/www/status_rrd_graph.php | |
parent | 7895a8802317a8477929bea6428bf8dfe214306f (diff) | |
download | pfsense-abe98adb911f9ff76af12034646a4c64e26d6390.zip pfsense-abe98adb911f9ff76af12034646a4c64e26d6390.tar.gz |
Code style status*
Diffstat (limited to 'src/usr/local/www/status_rrd_graph.php')
-rw-r--r-- | src/usr/local/www/status_rrd_graph.php | 117 |
1 files changed, 64 insertions, 53 deletions
diff --git a/src/usr/local/www/status_rrd_graph.php b/src/usr/local/www/status_rrd_graph.php index 666c70b..ae4fccc 100644 --- a/src/usr/local/www/status_rrd_graph.php +++ b/src/usr/local/www/status_rrd_graph.php @@ -96,10 +96,11 @@ if ($_POST['cat']) { $curcat = htmlspecialchars($_POST['cat']); } -if ($_GET['zone']) +if ($_GET['zone']) { $curzone = $_GET['zone']; -else +} else { $curzone = ''; +} if ($_POST['period']) { $curperiod = $_POST['period']; @@ -114,7 +115,7 @@ if ($_POST['period']) { if ($_POST['style']) { $curstyle = $_POST['style']; } else { - if(! empty($config['rrd']['style'])) { + if (!empty($config['rrd']['style'])) { $curstyle = $config['rrd']['style']; } else { $curstyle = "absolute"; @@ -124,7 +125,7 @@ if ($_POST['style']) { if ($_POST['option']) { $curoption = $_POST['option']; } else { - switch($curcat) { + switch ($curcat) { case "system": $curoption = "processor"; break; @@ -425,7 +426,7 @@ function get_dates($curperiod, $graph) { } function make_tabs() { - global $curcat, $queues,$wireless,$cellular,$vpnusers, $captiveportal,$dhcpd, $ntpd; + global $curcat, $queues, $wireless, $cellular, $vpnusers, $captiveportal, $dhcpd, $ntpd; $tab_array = array(); $tab_array[] = array(gettext("System"), ($curcat == "system"), "status_rrd_graph.php?cat=system"); @@ -434,32 +435,32 @@ function make_tabs() { $tab_array[] = array(gettext("Quality"), ($curcat == "quality"), "status_rrd_graph.php?cat=quality"); - if($queues) { + if ($queues) { $tab_array[] = array(gettext("Queues"), ($curcat == "queues"), "status_rrd_graph.php?cat=queues"); $tab_array[] = array(gettext("QueueDrops"), ($curcat == "queuedrops"), "status_rrd_graph.php?cat=queuedrops"); } - if($wireless) { + if ($wireless) { $tab_array[] = array(gettext("Wireless"), ($curcat == "wireless"), "status_rrd_graph.php?cat=wireless"); } - if($cellular) { + if ($cellular) { $tab_array[] = array(gettext("Cellular"), ($curcat == "cellular"), "status_rrd_graph.php?cat=cellular"); } - if($vpnusers) { + if ($vpnusers) { $tab_array[] = array(gettext("VPN"), ($curcat == "vpnusers"), "status_rrd_graph.php?cat=vpnusers"); } - if($captiveportal) { + if ($captiveportal) { $tab_array[] = array(gettext("Captive Portal"), ($curcat == "captiveportal"), "status_rrd_graph.php?cat=captiveportal"); } - if($ntpd) { + if ($ntpd) { $tab_array[] = array("NTPD", ($curcat == "ntpd"), "status_rrd_graph.php?cat=ntpd"); } - if($dhcpd) { + if ($dhcpd) { $tab_array[] = array(gettext("DHCP Server"), ($curcat == "dhcpd"), "status_rrd_graph.php?cat=dhcpd"); } @@ -475,7 +476,7 @@ function build_options() { $optionslist = array(); - if($curcat == "custom") { + if ($curcat == "custom") { foreach ($custom_databases as $db => $database) { $optionc = explode("-", $database); $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc[0])); @@ -491,17 +492,19 @@ function build_options() { } foreach ($ui_databases as $db => $database) { - if(! preg_match("/($curcat)/i", $database)) + if (!preg_match("/($curcat)/i", $database)) { continue; + } - if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database)) + if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database)) { continue; + } $optionc = explode("-", $database); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); - switch($curcat) { + switch ($curcat) { case "captiveportal": $optionc = str_replace($search, $replace, $optionc[2]); $prettyprint = ucwords(str_replace($search, $replace, $optionc)); @@ -516,7 +519,7 @@ function build_options() { /* Deduce an interface if possible and use the description */ $optionc = "$optionc[0]"; $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc)); - if(empty($friendly)) { + if (empty($friendly)) { $friendly = $optionc; } $search = array("-", ".rrd", $optionc); @@ -533,8 +536,9 @@ include("head.inc"); display_top_tabs(make_tabs()); -if ($input_errors && count($input_errors)) +if ($input_errors && count($input_errors)) { print_input_errors($input_errors); +} $form = new Form(false); @@ -563,12 +567,13 @@ $group->add(new Form_Select( $periods ))->setHelp('Period'); -if($curcat == 'custom') +if ($curcat == 'custom') { $group->setHelp('Any changes to these option may not take affect until the next auto-refresh.'); +} $section->add($group); -if($curcat == 'custom') { +if ($curcat == 'custom') { $section->addInput(new Form_Input( 'cat', null, @@ -597,8 +602,9 @@ if($curcat == 'custom') { $end_fmt ))->setHelp('End'); - if($curcat != 'custom') + if ($curcat != 'custom') { $group->setHelp('Any changes to these option may not take affect until the next auto-refresh'); + } $section->add($group); @@ -607,7 +613,7 @@ if($curcat == 'custom') { $curdatabase = $curoption; $graph = "custom-$curdatabase"; - if(in_array($curdatabase, $custom_databases)) { + if (in_array($curdatabase, $custom_databases)) { $id = "{$graph}-{$curoption}-{$curdatabase}"; $id = preg_replace('/\./', '_', $id); ?> @@ -621,33 +627,36 @@ if($curcat == 'custom') { $form->add($section); print($form); - foreach($graphs as $graph) { + foreach ($graphs as $graph) { /* check which databases are valid for our category */ - foreach($ui_databases as $curdatabase) { - if(! preg_match("/($curcat)/i", $curdatabase)) + foreach ($ui_databases as $curdatabase) { + if (!preg_match("/($curcat)/i", $curdatabase)) { continue; + } - if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase)) + if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase)) { continue; + } $optionc = explode("-", $curdatabase); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); - switch($curoption) { + switch ($curoption) { case "outbound": /* make sure we do not show the placeholder databases in the outbound view */ - if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { + if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { continue 2; } /* only show interfaces with a gateway */ $optionc = "$optionc[0]"; - if(!interface_has_gateway($optionc)) { - if(!isset($gateways_arr)) { - if(preg_match("/quality/i", $curdatabase)) + if (!interface_has_gateway($optionc)) { + if (!isset($gateways_arr)) { + if (preg_match("/quality/i", $curdatabase)) { $gateways_arr = return_gateways_array(); - else + } else { $gateways_arr = array(); + } } $found_gateway = false; foreach ($gateways_arr as $gw) { @@ -656,29 +665,29 @@ if($curcat == 'custom') { break; } } - if(!$found_gateway) { + if (!$found_gateway) { continue 2; } } - if(! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) { + if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) { continue 2; } break; case "allgraphs": /* make sure we do not show the placeholder databases in the all view */ - if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { + if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { continue 2; } break; default: /* just use the name here */ - if(! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) { + if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) { continue 2; } } - if(in_array($curdatabase, $ui_databases)) { + if (in_array($curdatabase, $ui_databases)) { $id = "{$graph}-{$curoption}-{$curdatabase}"; $id = preg_replace('/\./', '_', $id); @@ -703,29 +712,31 @@ if($curcat == 'custom') { //alert('updating'); var randomid = Math.floor(Math.random()*11); <?php - foreach($graphs as $graph) { + foreach ($graphs as $graph) { /* check which databases are valid for our category */ - foreach($ui_databases as $curdatabase) { - if(! stristr($curdatabase, $curcat)) { + foreach ($ui_databases as $curdatabase) { + if (!stristr($curdatabase, $curcat)) { continue; } $optionc = explode("-", $curdatabase); $search = array("-", ".rrd", $optionc); $replace = array(" :: ", "", $friendly); - switch($curoption) { + switch ($curoption) { case "outbound": /* make sure we do not show the placeholder databases in the outbound view */ - if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { + if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { continue 2; } /* only show interfaces with a gateway */ $optionc = "$optionc[0]"; - if(!interface_has_gateway($optionc)) { - if(!isset($gateways_arr)) - if(preg_match("/quality/i", $curdatabase)) + if (!interface_has_gateway($optionc)) { + if (!isset($gateways_arr)) { + if (preg_match("/quality/i", $curdatabase)) { $gateways_arr = return_gateways_array(); - else + } else { $gateways_arr = array(); + } + } $found_gateway = false; foreach ($gateways_arr as $gw) { if ($gw['name'] == $optionc) { @@ -733,29 +744,29 @@ if($curcat == 'custom') { break; } } - if(!$found_gateway) { + if (!$found_gateway) { continue 2; } } - if(! preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) { + if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) { continue 2; } break; case "allgraphs": /* make sure we do not show the placeholder databases in the all view */ - if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { + if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) { continue 2; } break; default: /* just use the name here */ - if(! preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) { + if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) { continue 2; } } $dates = get_dates($curperiod, $graph); $start = $dates['start']; - if($curperiod == "current") { + if ($curperiod == "current") { $end = $dates['end']; } /* generate update events utilizing jQuery('') feature */ @@ -775,8 +786,8 @@ if($curcat == 'custom') { <script> //<![CDATA[ -events.push(function(){ - $('#option, #style, #period').on('change', function(){ +events.push(function() { + $('#option, #style, #period').on('change', function() { $(this).parents('form').submit(); }); }); |