From 8f65151c5beaee62d661af81bf96a93edaae22d9 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Tue, 15 Dec 2015 23:00:44 +0545 Subject: Code style System Advanced --- src/usr/local/www/system.php | 28 +++++++++-------- src/usr/local/www/system_advanced_admin.php | 36 ++++++++++++---------- src/usr/local/www/system_advanced_misc.php | 8 +++-- src/usr/local/www/system_advanced_network.php | 11 ++++--- .../local/www/system_advanced_notifications.php | 8 +++-- src/usr/local/www/system_advanced_sysctl.php | 29 +++++++++++------ 6 files changed, 69 insertions(+), 51 deletions(-) (limited to 'src/usr/local') diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index 051dcae..f51f5f5 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -80,7 +80,7 @@ list($pconfig['dns1'], $pconfig['dns2'], $pconfig['dns3'], $pconfig['dns4']) = $ $arr_gateways = return_gateways_array(); // set default colmns to two if unset -if(!isset($config['system']['webgui']['dashboardcolumns'])) { +if (!isset($config['system']['webgui']['dashboardcolumns'])) { $config['system']['webgui']['dashboardcolumns'] = 2; } @@ -149,7 +149,7 @@ if ($_POST) { } else { unset($config['system']['webgui']['webguicss']); } - + if ($_POST['webguifixedmenu']) { $config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu']; } else { @@ -160,8 +160,8 @@ if ($_POST) { $config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns']; } else { unset($config['system']['webgui']['dashboardcolumns']); - } - + } + if ($_POST['hostname']) { if (!is_hostname($_POST['hostname'])) { $input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'."); @@ -340,11 +340,13 @@ if ($_POST) { $pgtitle = array(gettext("System"), gettext("General Setup")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, success); +} ?>
add($section); $section = new Form_Section('DNS server settings'); -for ($i=1; $i<5; $i++) -{ +for ($i=1; $i<5; $i++) { // if (!isset($pconfig['dns'.$i])) // continue; @@ -391,12 +392,12 @@ for ($i=1; $i<5; $i++) if ($multiwan) { $options = array('none' => 'none'); - foreach($arr_gateways as $gwname => $gwitem) { - if((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) { + foreach ($arr_gateways as $gwname => $gwitem) { + if ((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) { continue; } - if((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) { + if ((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) { continue; } @@ -414,8 +415,9 @@ for ($i=1; $i<5; $i++) "When using multiple WAN connections there should be at least one unique DNS server per gateway."; } - if($i == 4) + if ($i == 4) { $group->setHelp($help); + } $section->add($group); } @@ -469,7 +471,7 @@ $csslist = array(); $css = glob("/usr/local/www/bootstrap/css/*.css"); foreach ($css as $file) { $file = basename($file); - if(substr($file, 0, 9) !== 'bootstrap') { + if (substr($file, 0, 9) !== 'bootstrap') { $csslist[$file] = pathinfo($file, PATHINFO_FILENAME); } } diff --git a/src/usr/local/www/system_advanced_admin.php b/src/usr/local/www/system_advanced_admin.php index 28edf97..5752515 100644 --- a/src/usr/local/www/system_advanced_admin.php +++ b/src/usr/local/www/system_advanced_admin.php @@ -266,8 +266,8 @@ if ($_POST) { } if (($sshd_enabled != $config['system']['enablesshd']) || - ($sshd_keyonly != $config['system']['sshdkeyonly']) || - ($sshd_port != $config['system']['ssh']['port'])) { + ($sshd_keyonly != $config['system']['sshdkeyonly']) || + ($sshd_port != $config['system']['ssh']['port'])) { $restart_sshd = true; } @@ -320,11 +320,13 @@ if ($_POST) { $pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Admin Access")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $tab_array = array(); $tab_array[] = array(gettext("Admin Access"), true, "system_advanced_admin.php"); @@ -345,7 +347,7 @@ $group->add(new Form_Checkbox( 'webguiproto', 'Protocol', 'HTTP', - ($pconfig['webguiproto']=='http'), + ($pconfig['webguiproto'] == 'http'), 'http' ))->displayAsRadio(); @@ -353,7 +355,7 @@ $group->add(new Form_Checkbox( 'webguiproto', 'Protocol', 'HTTPS', - ($pconfig['webguiproto']=='https'), + ($pconfig['webguiproto'] == 'https'), 'https' ))->displayAsRadio(); @@ -364,8 +366,9 @@ $group->setHelp($certs_available ? '':'No Certificates have been defined. You mu $section->add($group); $values = array(); -foreach($a_cert as $cert) +foreach ($a_cert as $cert) { $values[ $cert['refid'] ] = $cert['descr']; +} $section->addInput($input = new Form_Select( 'ssl-certref', @@ -421,10 +424,11 @@ $section->addInput(new Form_Checkbox( ))->setHelp('When this is checked, successful logins to the webConfigurator will '. 'not be logged.'); -if ($config['interfaces']['lan']) +if ($config['interfaces']['lan']) { $lockout_interface = "LAN"; -else +} else { $lockout_interface = "WAN"; +} $section->addInput(new Form_Checkbox( 'noantilockout', @@ -508,8 +512,7 @@ $section->addInput(new Form_Input( ))->setHelp('Note: Leave this blank for the default of 22.'); -if (!$g['enableserial_force'] && ($g['platform'] == $g['product_name'] || $g['platform'] == "cdrom")) -{ +if (!$g['enableserial_force'] && ($g['platform'] == $g['product_name'] || $g['platform'] == "cdrom")) { $form->add($section); $section = new Form_Section('Serial Communications'); @@ -559,7 +562,7 @@ print $form; ?>