diff options
author | Phil Davis <phil.davis@inf.org> | 2016-08-16 14:15:56 +0930 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-08-16 09:21:54 -0400 |
commit | 9488f42b8190c92b6328697cbe84faad71647675 (patch) | |
tree | d67ed8fa47eb873cf9c9adcb766c4a8a81013afe /src/usr/local/www | |
parent | c9cd556bdc4ef615778aa0c28c1030db23abf107 (diff) | |
download | pfsense-9488f42b8190c92b6328697cbe84faad71647675.zip pfsense-9488f42b8190c92b6328697cbe84faad71647675.tar.gz |
Code style and comments
No functional change - just making style consistent
(cherry picked from commit 9d3e8723171c727cf43338bd8e95ab2bb7e6a66c)
Diffstat (limited to 'src/usr/local/www')
34 files changed, 127 insertions, 126 deletions
diff --git a/src/usr/local/www/classes/Form/Button.class.php b/src/usr/local/www/classes/Form/Button.class.php index bc13e7a..3460588 100644 --- a/src/usr/local/www/classes/Form/Button.class.php +++ b/src/usr/local/www/classes/Form/Button.class.php @@ -71,11 +71,11 @@ class Form_Button extends Form_Input $this->_tagName = 'a'; $this->addClass('btn-default'); unset($this->_attributes['type']); - if(isset($icon)) { + if (isset($icon)) { $this->_attributes['icon'] = $icon; } } - else if(isset($icon)) + else if (isset($icon)) { $this->_tagSelfClosing = false; $this->_tagName = 'button'; diff --git a/src/usr/local/www/classes/Form/Group.class.php b/src/usr/local/www/classes/Form/Group.class.php index 1b3aa40..361ceac 100644 --- a/src/usr/local/www/classes/Form/Group.class.php +++ b/src/usr/local/www/classes/Form/Group.class.php @@ -96,7 +96,7 @@ class Form_Group extends Form_Element public function enableDuplication($max = null, $horiz = false) { - if($horiz) + if ($horiz) $this->addClass('user-duplication-horiz'); // added buttons are 2 cols wide with no offset else $this->addClass('user-duplication'); // added buttons 10 cols wide with 2 col offset diff --git a/src/usr/local/www/classes/Form/Input.class.php b/src/usr/local/www/classes/Form/Input.class.php index 48188b3..5b2385a 100644 --- a/src/usr/local/www/classes/Form/Input.class.php +++ b/src/usr/local/www/classes/Form/Input.class.php @@ -241,7 +241,7 @@ class Form_Input extends Form_Element // These methods required by pkg_edit and the wizards that map xml element definitions to Form elements public function setOnclick($text) { - if($text) + if ($text) $this->_attributes['onclick'] = $text; return $this; @@ -249,7 +249,7 @@ class Form_Input extends Form_Element public function setOnchange($text) { - if($text) + if ($text) $this->_attributes['onchange'] = $text; return $this; diff --git a/src/usr/local/www/classes/Form/Section.class.php b/src/usr/local/www/classes/Form/Section.class.php index 133c7ba..2ccfe41 100644 --- a/src/usr/local/www/classes/Form/Section.class.php +++ b/src/usr/local/www/classes/Form/Section.class.php @@ -94,12 +94,12 @@ class Form_Section extends Form_Element } // Shortcut, adds a group with a password and a confirm password field. - // The confirm password element is created by apprnding "_confirm" to the name supplied + // The confirm password element is created by appending "_confirm" to the name supplied // The value is overwritten with a default pattern (So the user cannot see it) public function addPassword(Form_Input $input) { $group = new Form_Group($input->getTitle()); - if($input->getValue() != "") { + if ($input->getValue() != "") { $input->setValue(DMYPWD); } diff --git a/src/usr/local/www/classes/Form/Select.class.php b/src/usr/local/www/classes/Form/Select.class.php index e64203c..b156793 100644 --- a/src/usr/local/www/classes/Form/Select.class.php +++ b/src/usr/local/www/classes/Form/Select.class.php @@ -79,15 +79,15 @@ class Form_Select extends Form_Input $options = ''; foreach ($this->_values as $value => $name) { - // Things can get wierd if we have mixed types + // Things can get weird if we have mixed types $sval = $this->_value; - if( (gettype($value) == "integer") && (gettype($sval) == "string") ) + if ((gettype($value) == "integer") && (gettype($sval) == "string")) $value = strval($value); - if (isset($this->_attributes['multiple'])) + if (isset($this->_attributes['multiple'])) { $selected = in_array($value, (array)$sval); - else { + } else { $selected = ($sval == $value); } diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php index 23a0525..17064d7 100644 --- a/src/usr/local/www/diag_dns.php +++ b/src/usr/local/www/diag_dns.php @@ -87,7 +87,7 @@ function resolve_host_addresses($host) { $resolved = array(); $errreporting = error_reporting(); error_reporting($errreporting & ~E_WARNING);// dns_get_record throws a warning if nothing is resolved.. - foreach($recordtypes as $recordtype) { + foreach ($recordtypes as $recordtype) { $tmp = dns_get_record($host, $recordtype); if (is_array($tmp)) { $dnsresult = array_merge($dnsresult, $tmp); @@ -95,7 +95,7 @@ function resolve_host_addresses($host) { } error_reporting($errreporting);// restore original php warning/error settings. - foreach($dnsresult as $item) { + foreach ($dnsresult as $item) { $newitem = array(); $newitem['type'] = $item['type']; switch ($item['type']) { diff --git a/src/usr/local/www/diag_edit.php b/src/usr/local/www/diag_edit.php index 98dfb94..2cdb458 100644 --- a/src/usr/local/www/diag_edit.php +++ b/src/usr/local/www/diag_edit.php @@ -188,8 +188,8 @@ print_callout(gettext("The capabilities offered here can be dangerous. No suppor // calculate start/end var startPos = 0, endPos = tarea.value.length; - for(var x = 0; x < lines.length; x++) { - if(x == lineNum) { + for (var x = 0; x < lines.length; x++) { + if (x == lineNum) { break; } startPos += (lines[x].length+1); @@ -201,7 +201,7 @@ print_callout(gettext("The capabilities offered here can be dangerous. No suppor // do selection // Chrome / Firefox - if(typeof(tarea.selectionStart) != "undefined") { + if (typeof(tarea.selectionStart) != "undefined") { tarea.focus(); tarea.selectionStart = startPos; tarea.selectionEnd = endPos; diff --git a/src/usr/local/www/firewall_virtual_ip_edit.php b/src/usr/local/www/firewall_virtual_ip_edit.php index b506eb7..1a0eb19 100644 --- a/src/usr/local/www/firewall_virtual_ip_edit.php +++ b/src/usr/local/www/firewall_virtual_ip_edit.php @@ -465,7 +465,7 @@ $section->addInput(new Form_Input( $pconfig['descr'] ))->setHelp('A description may be entered here for administrative reference (not parsed).'); -if (isset($id) && $a_vip[$id]){ +if (isset($id) && $a_vip[$id]) { $section->addInput(new Form_Input( 'id', null, diff --git a/src/usr/local/www/js/pfSense.js b/src/usr/local/www/js/pfSense.js index 2f6aad0..2f9811e 100644 --- a/src/usr/local/www/js/pfSense.js +++ b/src/usr/local/www/js/pfSense.js @@ -175,10 +175,10 @@ $(function() { // Use element title in the confirmation message, or if not available // the element value $('.btn-danger, .fa-trash').on('click', function(e){ - if(!($(this).hasClass('no-confirm'))) { + if (!($(this).hasClass('no-confirm'))) { var msg = $.trim(this.textContent); - if(!msg) + if (!msg) var msg = $.trim(this.value).toLowerCase(); var q = 'Are you sure you wish to '+ msg +'?'; @@ -233,7 +233,7 @@ $(function() { originalLeave.call(this, obj); - if(self.$tip && self.$tip.length) { + if (self.$tip && self.$tip.length) { container = self.$tip; timeout = self.timeout; container.one('mouseenter', function(){ diff --git a/src/usr/local/www/js/pfSenseHelpers.js b/src/usr/local/www/js/pfSenseHelpers.js index 9ddabcf..56d659e 100644 --- a/src/usr/local/www/js/pfSenseHelpers.js +++ b/src/usr/local/www/js/pfSenseHelpers.js @@ -141,7 +141,7 @@ function hideLabel(text, hide) { // Hides the '/' and the subnet mask of an Ip_Address/subnet_mask group function hideMask(name, hide) { - if(hide) { + if (hide) { $('[id^=' + name + ']').hide(); $('[id^=' + name + ']').prev('span').hide(); $('[id^=' + name + ']').parent('div').removeClass('input-group'); diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php index 0126028..e5c1335 100644 --- a/src/usr/local/www/pkg_mgr_install.php +++ b/src/usr/local/www/pkg_mgr_install.php @@ -600,7 +600,7 @@ function get_firmware_versions() json = jQuery.parseJSON(response); - if(json) { + if (json) { $('#installed_version').text(json.installed_version); $('#version').text(json.version); diff --git a/src/usr/local/www/services_dhcpv6_edit.php b/src/usr/local/www/services_dhcpv6_edit.php index 2e15225..f17b420 100644 --- a/src/usr/local/www/services_dhcpv6_edit.php +++ b/src/usr/local/www/services_dhcpv6_edit.php @@ -275,7 +275,7 @@ $section->addInput(new Form_Input( $pconfig['descr'] ))->setHelp('A description may be entered here for administrative reference (not parsed).'); -if($netboot_enabled) { +if ($netboot_enabled) { $section->addInput(new Form_Input( 'filename', 'Netboot filename', diff --git a/src/usr/local/www/services_router_advertisements.php b/src/usr/local/www/services_router_advertisements.php index eea6d89..5cd5c7c 100644 --- a/src/usr/local/www/services_router_advertisements.php +++ b/src/usr/local/www/services_router_advertisements.php @@ -348,8 +348,8 @@ $carplist = get_configured_vip_list("inet6", VIP_CARP); $carplistif = array(); -if(count($carplist) > 0) { - foreach($carplist as $ifname => $vip) { +if (count($carplist) > 0) { + foreach ($carplist as $ifname => $vip) { if (get_configured_vip_interface($ifname) == $if) { $carplistif[$ifname] = $vip; } @@ -360,7 +360,7 @@ if (count($carplistif) > 0) { $iflist = array(); $iflist['interface'] = strtoupper($if); - foreach($carplistif as $ifname => $vip) { + foreach ($carplistif as $ifname => $vip) { $iflist[$ifname] = get_vip_descr($vip) . " - " . $vip; } diff --git a/src/usr/local/www/status_logs_filter_dynamic.php b/src/usr/local/www/status_logs_filter_dynamic.php index c5b4992..bab7097 100644 --- a/src/usr/local/www/status_logs_filter_dynamic.php +++ b/src/usr/local/www/status_logs_filter_dynamic.php @@ -326,7 +326,7 @@ function update_table_rows(data) { move = 0; } - if (($("#count").text() == 0) && (data.length < nentries)){ + if (($("#count").text() == 0) && (data.length < nentries)) { move += rows.length; } @@ -477,7 +477,7 @@ function toggleListDescriptions() { <td><?=htmlspecialchars($filterent['proto'])?></td> </tr> <?php - } // e-o-foreach() + } // e-o-foreach () if (count($filterlog) == 0) { print '<tr class="text-nowrap"><td colspan=6>'; diff --git a/src/usr/local/www/system_advanced_misc.php b/src/usr/local/www/system_advanced_misc.php index 8aeaed8..018c452 100644 --- a/src/usr/local/www/system_advanced_misc.php +++ b/src/usr/local/www/system_advanced_misc.php @@ -147,7 +147,7 @@ if ($_POST) { $input_errors[] = gettext("The proxy username contains invalid characters."); } - if($_POST['proxypass'] != $_POST['proxypass_confirm']) { + if ($_POST['proxypass'] != $_POST['proxypass_confirm']) { $input_errors[] = gettext("Proxy password and confirmation must match."); } diff --git a/src/usr/local/www/system_authservers.php b/src/usr/local/www/system_authservers.php index 6a30785..891a4a9 100644 --- a/src/usr/local/www/system_authservers.php +++ b/src/usr/local/www/system_authservers.php @@ -426,7 +426,7 @@ if ($_POST) { } // On error, restore the form contents so the user doesn't have to re-enter too much -if($_POST && $input_errors) { +if ($_POST && $input_errors) { $pconfig = $_POST; $pconfig['ldap_authcn'] = $_POST['ldapauthcontainers']; $pconfig['ldap_template'] = $_POST['ldap_tmpltype']; @@ -471,7 +471,7 @@ if (!($act == "new" || $act == "edit" || $input_errors)) { </tr> </thead> <tbody> - <?php foreach($a_server as $i => $server): ?> + <?php foreach ($a_server as $i => $server): ?> <tr> <td><?=htmlspecialchars($server['name'])?></td> <td><?=htmlspecialchars($auth_server_types[$server['type']])?></td> @@ -683,7 +683,7 @@ $section->add($group); if (!isset($id)) { $template_list = array(); - foreach($ldap_templates as $option => $template) { + foreach ($ldap_templates as $option => $template) { $template_list[$option] = $template['desc']; } @@ -912,7 +912,7 @@ events.push(function() { } function set_ldap_port() { - if($('#ldap_urltype').find(":selected").index() == 0) + if ($('#ldap_urltype').find(":selected").index() == 0) $('#ldap_port').val('389'); else $('#ldap_port').val('636'); @@ -920,7 +920,7 @@ events.push(function() { // Hides all elements of the specified class. This will usually be a section function hideClass(s_class, hide) { - if(hide) + if (hide) $('.' + s_class).hide(); else $('.' + s_class).show(); @@ -953,18 +953,18 @@ events.push(function() { hideClass('ldapanon', $('#ldap_anon').prop('checked')); hideClass('extended', !$('#ldap_extended_enabled').prop('checked')); - if($('#ldap_port').val() == "") + if ($('#ldap_port').val() == "") set_ldap_port(); <?php - if($act == 'edit') { + if ($act == 'edit') { ?> $('#type option:not(:selected)').each(function(){ $(this).attr('disabled', 'disabled'); }); <?php - if(!$input_errors) { + if (!$input_errors) { ?> $('#name').prop("readonly", true); <?php diff --git a/src/usr/local/www/system_crlmanager.php b/src/usr/local/www/system_crlmanager.php index 8510d15..e71846f 100644 --- a/src/usr/local/www/system_crlmanager.php +++ b/src/usr/local/www/system_crlmanager.php @@ -347,7 +347,7 @@ function build_cacert_list() { $list = array(); - foreach($ca_certs as $cert) { + foreach ($ca_certs as $cert) { $list[$cert['refid']] = $cert['descr']; } diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php index 075d07f..204cc29 100644 --- a/src/usr/local/www/system_gateway_groups_edit.php +++ b/src/usr/local/www/system_gateway_groups_edit.php @@ -371,7 +371,7 @@ $section->addInput(new Form_Input( $pconfig['descr'] ))->setHelp('A description may be entered here for administrative reference (not parsed).'); -if (isset($id) && $a_gateway_groups[$id]){ +if (isset($id) && $a_gateway_groups[$id]) { $section->addInput(new Form_Input( 'id', null, diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php index 09a5201..9e8248e 100644 --- a/src/usr/local/www/system_groupmanager.php +++ b/src/usr/local/www/system_groupmanager.php @@ -192,7 +192,7 @@ if (isset($_POST['save'])) { } /* Check the POSTed members to ensure they are valid and exist */ - if(is_array($_POST['members'])) { + if (is_array($_POST['members'])) { foreach ($_POST['members'] as $newmember) { if (!is_numeric($newmember) || empty(getUserEntryByUID($newmember))) { $input_errors[] = gettext("One or more invalid group members was submitted."); @@ -385,7 +385,7 @@ $form->addGlobal(new Form_Input( $id )); -if (isset($id) && $a_group[$id]){ +if (isset($id) && $a_group[$id]) { $form->addGlobal(new Form_Input( 'id', null, diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php index d7da0e6..309b72f 100644 --- a/src/usr/local/www/system_groupmanager_addprivs.php +++ b/src/usr/local/www/system_groupmanager_addprivs.php @@ -300,7 +300,7 @@ events.push(function() { }); $('#filtertxt').keypress(function(e) { - if(e.which == 13) { + if (e.which == 13) { e.preventDefault(); $('#btnfilter').trigger('click'); } diff --git a/src/usr/local/www/system_update_settings.php b/src/usr/local/www/system_update_settings.php index e335ff9..9496ecf 100644 --- a/src/usr/local/www/system_update_settings.php +++ b/src/usr/local/www/system_update_settings.php @@ -186,6 +186,7 @@ if (file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { 'synconupgrade', 'Auto sync on update', 'Enable repository/branch sync before reboot', + 'Enable repository/branch sync before reboot', isset($gitcfg['synconupgrade']) ))->setHelp('After updating, sync with the following repository/branch before reboot.'); @@ -227,7 +228,7 @@ if (file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { '<br />Note: Sync will not be performed if a branch is not specified.', [$lastbranch]); $form->add($section); -} // e-o-if(file_exista() +} // e-o-if (file_exists()) print($form); diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php index 4b46efc..a1f7e0a 100644 --- a/src/usr/local/www/system_usermanager.php +++ b/src/usr/local/www/system_usermanager.php @@ -247,7 +247,7 @@ if ($_POST['save']) { } /* Check the POSTed groups to ensure they are valid and exist */ - if(is_array($_POST['groups'])) { + if (is_array($_POST['groups'])) { foreach ($_POST['groups'] as $newgroup) { if (empty(getGroupEntry($newgroup))) { $input_errors[] = gettext("One or more invalid groups was submitted."); @@ -884,7 +884,7 @@ if ($act == "new" || $act == "edit" || $input_errors): $section->addClass('cert-options'); $nonPrvCas = array(); - foreach($config['ca'] as $ca) { + foreach ($config['ca'] as $ca) { if (!$ca['prv']) { continue; } diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php index 3dfc341..3bf910d 100644 --- a/src/usr/local/www/system_usermanager_addprivs.php +++ b/src/usr/local/www/system_usermanager_addprivs.php @@ -304,7 +304,7 @@ events.push(function() { }); $('#filtertxt').keypress(function(e) { - if(e.which == 13) { + if (e.which == 13) { e.preventDefault(); $('#btnfilter').trigger('click'); } diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php index 57b1040..e7b2af3 100644 --- a/src/usr/local/www/vpn_openvpn_server.php +++ b/src/usr/local/www/vpn_openvpn_server.php @@ -1259,7 +1259,7 @@ endif; events.push(function() { function advanced_change(hide, mode) { - if(!hide) { + if (!hide) { hideClass('advanced', false); hideClass("clientadv", false); } else if (mode == "p2p_tls") { diff --git a/src/usr/local/www/widgets/javascript/thermal_sensors.js b/src/usr/local/www/widgets/javascript/thermal_sensors.js index 70de0e9..448c05e 100644 --- a/src/usr/local/www/widgets/javascript/thermal_sensors.js +++ b/src/usr/local/www/widgets/javascript/thermal_sensors.js @@ -56,7 +56,7 @@ ajaxBusy = false; //should be called from "thermal_sensors.widget.php" function showThermalSensorsData() { - if(!ajaxBusy) { + if (!ajaxBusy) { ajaxBusy = true; //get data from thermal_sensors.widget.php url = "/widgets/widgets/thermal_sensors.widget.php?getThermalSensorsData=1" @@ -86,7 +86,7 @@ function buildThermalSensorsData(thermalSensorsData) { if (thermal_sensors_widget_showRawOutput) { buildThermalSensorsDataRaw(thermalSensorsData); } else { - if(warningTemp == 9999) { + if (warningTemp == 9999) { buildThermalSensorsDataGraph(thermalSensorsData); } @@ -224,11 +224,11 @@ function getThermalSensorValue(stringValue) { function setTempProgress(bar, percent) { var barTempL, barTempM, barTempH; - if(percent <= warningTemp) { + if (percent <= warningTemp) { barTempL = percent; barTempM = 0; barTempH = 0; - } else if(percent <= criticalTemp) { + } else if (percent <= criticalTemp) { barTempL = warningTemp; barTempM = percent - warningTemp; barTempH = 0; diff --git a/src/usr/local/www/widgets/widgets/gmirror_status.widget.php b/src/usr/local/www/widgets/widgets/gmirror_status.widget.php index 532f731..cf89cda 100644 --- a/src/usr/local/www/widgets/widgets/gmirror_status.widget.php +++ b/src/usr/local/www/widgets/widgets/gmirror_status.widget.php @@ -67,7 +67,7 @@ require_once("gmirror.inc"); <script type="text/javascript"> //<![CDATA[ -function gmirrorStatusUpdateFromServer(){ +function gmirrorStatusUpdateFromServer() { $.ajax({ type: 'get', url: '/widgets/widgets/gmirror_status.widget.php', diff --git a/src/usr/local/www/widgets/widgets/log.widget.php b/src/usr/local/www/widgets/widgets/log.widget.php index 102522d..2405e93 100644 --- a/src/usr/local/www/widgets/widgets/log.widget.php +++ b/src/usr/local/www/widgets/widgets/log.widget.php @@ -207,7 +207,7 @@ if (isset($_GET['lastsawtime'])) { <script type="text/javascript"> //<![CDATA[ -function logWidgetUpdateFromServer(){ +function logWidgetUpdateFromServer() { $.ajax({ type: 'get', url: '/widgets/widgets/log.widget.php', diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php index 30a126a..99d6342 100644 --- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php +++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php @@ -223,7 +223,7 @@ if ($_REQUEST['updateme']) { ?> <script type="text/javascript"> //<![CDATA[ -function ntpWidgetUpdateFromServer(){ +function ntpWidgetUpdateFromServer() { $.ajax({ type: 'get', url: '/widgets/widgets/ntp_status.widget.php', @@ -239,7 +239,7 @@ function ntpWidgetUpdateFromServer(){ }); } -function ntpWidgetUpdateDisplay(){ +function ntpWidgetUpdateDisplay() { // Javascript handles overflowing ntpServerTime.setSeconds(ntpServerTime.getSeconds()+1); diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php index 3b509b1..290a4a5 100644 --- a/src/usr/local/www/widgets/widgets/system_information.widget.php +++ b/src/usr/local/www/widgets/widgets/system_information.widget.php @@ -198,7 +198,7 @@ $filesystems = get_mounted_filesystems(); <ul style="margin-bottom:0px"> <?php $dns_servers = get_dns_servers(); - foreach($dns_servers as $dns) { + foreach ($dns_servers as $dns) { echo "<li>{$dns}</li>"; } ?> @@ -370,7 +370,7 @@ function setTimer() { function stats(x) { var values = x.split("|"); - if ($.each(values,function(key,value){ + if ($.each(values,function(key,value) { if (value == 'undefined' || value == null) return true; else @@ -502,7 +502,7 @@ function updateInterfaces(x) { } else { ipv4_details = details[2] + '<br />'; } - switch(details[1]) { + switch (details[1]) { case "up": $('#' + details[0] + '-up').css("display","inline"); $('#' + details[0] + '-down').css("display","none"); diff --git a/src/usr/local/www/wizard.php b/src/usr/local/www/wizard.php index a1c99dd..a61ed0d 100644 --- a/src/usr/local/www/wizard.php +++ b/src/usr/local/www/wizard.php @@ -883,8 +883,8 @@ if ($pkg['step'][$stepid]['fields']['field'] != "") { break; } // e-o-switch - } // e-o-foreach(package) -} // e-o- if(we have fields) + } // e-o-foreach (package) +} // e-o-if (we have fields) $form->add($section); print($form); diff --git a/src/usr/local/www/wizards/openvpn_wizard.inc b/src/usr/local/www/wizards/openvpn_wizard.inc index 8d34af6..2ccf528 100644 --- a/src/usr/local/www/wizards/openvpn_wizard.inc +++ b/src/usr/local/www/wizards/openvpn_wizard.inc @@ -216,7 +216,7 @@ function step7_submitphpaction() { $canames = array(); $cacns = array(); if (is_array($config['ca'])) { - foreach($config['ca'] as $ca) { + foreach ($config['ca'] as $ca) { $canames[] = $ca['descr']; $cainfo = cert_get_subject_hash($ca['crt']); $cacns[] = $cainfo["CN"]; @@ -319,7 +319,7 @@ function step9_submitphpaction() { $certnames = array(); $certcns = array(); if (is_array($config['cert'])) { - foreach($config['cert'] as $cert) { + foreach ($config['cert'] as $cert) { $certnames[] = $cert['descr']; $certinfo = cert_get_subject_hash($cert['crt']); $certcns[] = $certinfo["CN"]; diff --git a/src/usr/local/www/wizards/setup_wizard.xml b/src/usr/local/www/wizards/setup_wizard.xml index 0e32ae0..a9d2637 100644 --- a/src/usr/local/www/wizards/setup_wizard.xml +++ b/src/usr/local/www/wizards/setup_wizard.xml @@ -148,28 +148,28 @@ </stepbeforeformdisplay> <stepsubmitphpaction> <![CDATA[ - if(empty($_POST['hostname']) || !is_unqualified_hostname($_POST['hostname'])) { + if (empty($_POST['hostname']) || !is_unqualified_hostname($_POST['hostname'])) { include("head.inc"); $input_errors[] = "Hostname is invalid. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(empty($_POST['domain']) || !is_domain($_POST['domain'])) { + if (empty($_POST['domain']) || !is_domain($_POST['domain'])) { include("head.inc"); $input_errors[] = "Domain is invalid. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) { + if (!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) { include("head.inc"); $input_errors[] = "Primary DNS server is invalid. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) { + if (!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) { include("head.inc"); $input_errors[] = "Second DNS server is invalid. Please press back in the browser window and correct."; print_input_errors($input_errors); @@ -220,16 +220,16 @@ <description>On this screen the Wide Area Network information will be configured.</description> <javascriptafterformdisplay> var selectedItem = 0; - if(document.forms[0].ipaddress.value == 'dhcp') { + if (document.forms[0].ipaddress.value == 'dhcp') { selectedItem = 1; document.forms[0].ipaddress.value = ''; - } else if(document.forms[0].ipaddress.value == 'pppoe') { + } else if (document.forms[0].ipaddress.value == 'pppoe') { selectedItem = 2; document.forms[0].ipaddress.value = ''; - } else if(document.forms[0].ipaddress.value == 'pptp') { + } else if (document.forms[0].ipaddress.value == 'pptp') { selectedItem = 3; document.forms[0].ipaddress.value = ''; - } else if(document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') { + } else if (document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') { document.forms[0].ipaddress.value = ''; } else { selectedItem = 0; @@ -239,7 +239,7 @@ events.push(function(){ $('#showpppoepassword').click(function(event) { - if(this.checked) { + if (this.checked) { $('#pppoepassword').attr('type', 'text'); } else { $('#pppoepassword').attr('type', 'password'); @@ -247,7 +247,7 @@ }); $('#showpptppassword').click(function(event) { - if(this.checked) { + if (this.checked) { $('#pptppassword').attr('type', 'text'); } else { $('#pptppassword').attr('type', 'password'); @@ -488,21 +488,21 @@ </stepbeforeformdisplay> <stepsubmitphpaction> <![CDATA[ - if(!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) { + if (!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) { include("head.inc"); $input_errors[] = "MTU Must be at least 576 (Per RFC 791). Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) { + if (!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) { include("head.inc"); $input_errors[] = "Invalid MAC Address. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) { + if (!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) { if (!is_ipaddr($_POST['ipaddress'])) { include("head.inc"); $input_errors[] = "Invalid WAN IP Address. Please press back in the browser window and correct."; @@ -520,21 +520,21 @@ die; } } - if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) { + if (!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) { include("head.inc"); $input_errors[] = "Invalid DHCP Hostname. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) { + if (!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) { include("head.inc"); $input_errors[] = "Invalid PPTP Local IP Address. Please press back in the browser window and correct."; print_input_errors($input_errors); include("foot.inc"); die; } - if(!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) { + if (!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) { include("head.inc"); $input_errors[] = "Invalid PPTP Remote IP Address. Please press back in the browser window and correct."; print_input_errors($input_errors); @@ -584,14 +584,14 @@ </stepsubmitphpaction> <stepsubmitbeforesave> <![CDATA[ - if($_POST['selectedtype'] == "Static") { + if ($_POST['selectedtype'] == "Static") { } else { $_POST['ipaddress'] = $_POST['selectedtype']; $config['interfaces']['wan']['ipaddr'] = $_POST['selectedtype']; write_config(); } - if(!$config['interfaces']['lan']) { + if (!$config['interfaces']['lan']) { header("Location: /wizard.php?xml=setup_wizard.xml&stepid=6&next=Next"); } ]]> @@ -622,7 +622,7 @@ </fields> <stepsubmitphpaction> <![CDATA[ - if(empty($_POST['lanipaddress']) || !is_ipaddr($_POST['lanipaddress'])) { + if (empty($_POST['lanipaddress']) || !is_ipaddr($_POST['lanipaddress'])) { print_info_box("Invalid LAN IP address. Please press back in the browser window and correct."); die; } @@ -704,8 +704,8 @@ </fields> <stepsubmitphpaction> <![CDATA[ - if($_POST['adminpassword'] != "") { - if($_POST['adminpassword'] == $_POST['adminpasswordagain']) { + if ($_POST['adminpassword'] != "") { + if ($_POST['adminpassword'] == $_POST['adminpasswordagain']) { $admin_user =& getUserEntryByUID(0); local_user_set_password($admin_user, $_POST['adminpassword']); local_user_set($admin_user); @@ -783,7 +783,7 @@ <title>Wizard completed.</title> <stepbeforeformdisplay> <![CDATA[ - if($g['product_name'] <> 'pfSense') { + if ($g['product_name'] <> 'pfSense') { header("Location: " . fixup_string("\$myurl")); exit; } diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index 256efeb..5d87b7e 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -507,8 +507,8 @@ function step3_stepsubmitphpaction() { if (!$_POST['enable']) return; - if($_POST['upstream_sip_server']) { - if(!is_ipaddroralias($_POST['upstream_sip_server'])) { + if ($_POST['upstream_sip_server']) { + if (!is_ipaddroralias($_POST['upstream_sip_server'])) { /* item is not an ip or alias. error out */ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); $stepid--; @@ -590,12 +590,12 @@ function step4_stepsubmitphpaction() { global $stepid, $savemsg; if ( $_POST['enable'] ) { - if(!$_POST['bandwidth']) { + if (!$_POST['bandwidth']) { $savemsg="A value for bandwidth must be specified."; $stepid--; return; } - if(!is_numeric($_POST['bandwidth'])) { + if (!is_numeric($_POST['bandwidth'])) { $savemsg="The posted value is not a valid bandwidth."; $stepid--; return; @@ -607,12 +607,12 @@ function step4_stepsubmitphpaction() { return; } $bw = $_POST['bandwidth']; - if($bw > 15 || $bw < 2) { + if ($bw > 15 || $bw < 2) { $savemsg="Values should be between 2% and 15%!"; $stepid--; return; } - if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) { + if ($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) { /* item is not an ip or alias. error out */ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); $stepid--; @@ -625,7 +625,7 @@ function step5_stepsubmitphpaction() { if ( $_POST['enable'] ) { if ($_POST['p2pcatchall']) { - if(!is_numeric($_POST['bandwidth'])) { + if (!is_numeric($_POST['bandwidth'])) { $savemsg="Posted value is not a valid bandwidth."; $stepid--; return; @@ -636,7 +636,7 @@ function step5_stepsubmitphpaction() { return; } $bw = $_POST['bandwidth']; - if($bw > 15 || $bw < 2) { + if ($bw > 15 || $bw < 2) { $savemsg="Values should be between 2% and 15%!"; $stepid--; return; @@ -677,10 +677,10 @@ function apply_all_chosen_items() { * Doing it here makes sense since we can wipe the previous config only after * the user decides to do so, finishing the wizard. */ - if(isset($config['shaper']['queue'])) + if (isset($config['shaper']['queue'])) unset($config['shaper']['queue']); /* XXX: This is redundant, because this should be handled by converter at startup. */ - if(isset($config['shaper']['rule'])) + if (isset($config['shaper']['rule'])) unset($config['shaper']['rule']); foreach ($config['filter']['rule'] as $key => $rule) if ($rule['wizard'] == "yes") @@ -1470,7 +1470,7 @@ function apply_all_chosen_items() { /* Rules */ if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { + if ( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { $rule = array(); $rule['type'] = "match"; $rule['interface'] = $interfacelist; @@ -1488,7 +1488,7 @@ function apply_all_chosen_items() { /* If user specifies an IP, we don't bother with providers */ if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { + if (is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; @@ -1518,7 +1518,7 @@ function apply_all_chosen_items() { $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { + } elseif ( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; @@ -1549,7 +1549,7 @@ function apply_all_chosen_items() { $rule['wizard'] = "yes"; $rule['enabled'] = "on"; $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') + if ($voip[1] != '') $rule['protocol'] = $voip[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; @@ -1559,7 +1559,7 @@ function apply_all_chosen_items() { /* loop through p2plist[] */ if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { + foreach ($config['ezshaper']['step5'] as $key => $val) { if (!is_array($p2plist[$key])) continue; foreach ($p2plist[$key] as $p2pclient) { @@ -1573,7 +1573,7 @@ function apply_all_chosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') + if ($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; @@ -1583,7 +1583,7 @@ function apply_all_chosen_items() { /* loop through gamesplist[] */ if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { + foreach ($config['ezshaper']['step6'] as $key => $val) { if (!is_array($gamesplist[$key])) continue; foreach ($gamesplist[$key] as $Gameclient) { @@ -1600,7 +1600,7 @@ function apply_all_chosen_items() { $rule['enabled'] = "on"; $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') + if ($Gameclient[1] != '') $rule['protocol'] = $Gameclient[1]; $config['filter']['rule'][] = $rule; } @@ -1609,7 +1609,7 @@ function apply_all_chosen_items() { /* loop through othersplist[] */ if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { + foreach ($config['ezshaper']['step7'] as $key => $val) { if (!is_array($othersplist[$key])) continue; foreach ($othersplist[$key] as $otherclient) { @@ -1649,10 +1649,10 @@ function apply_all_chosen_items() { $rule['enabled'] = "on"; $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - if($otherclient[2] or $otherclient[3]) { + if ($otherclient[2] or $otherclient[3]) { $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } - if($otherclient[1] != '') + if ($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 1f33344..0e83047 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -561,8 +561,8 @@ function step3_stepsubmitphpaction() { if (!$_POST['enable']) return; - if($_POST['upstream_sip_server']) { - if(!is_ipaddroralias($_POST['upstream_sip_server'])) { + if ($_POST['upstream_sip_server']) { + if (!is_ipaddroralias($_POST['upstream_sip_server'])) { /* item is not an ip or alias. error out */ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); $stepid--; @@ -658,13 +658,13 @@ function step4_stepsubmitphpaction() { global $stepid, $savemsg; if ( $_POST['enable'] ) { - if(!$_POST['bandwidth']) { + if (!$_POST['bandwidth']) { $savemsg="A value for bandwidth must be specified."; $stepid--; return; } - if(!is_numeric($_POST['bandwidth'])) { + if (!is_numeric($_POST['bandwidth'])) { $savemsg="The posted value is not a valid bandwidth."; $stepid--; return; @@ -675,12 +675,12 @@ function step4_stepsubmitphpaction() { return; } $bw = $_POST['bandwidth']; - if($bw > 15 || $bw < 2) { + if ($bw > 15 || $bw < 2) { $savemsg="Values should be between 2% and 15%!"; $stepid--; return; } - if($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) { + if ($_POST['address'] <> "" && !is_ipaddroralias($_POST['address'])) { /* item is not an ip or alias. error out */ $savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue."); $stepid--; @@ -692,7 +692,7 @@ function step5_stepsubmitphpaction() { global $stepid, $savemsg; if ( $_POST['enable'] ) { if ($_POST['p2pcatchall']) { - if(!is_numeric($_POST['bandwidth'])) { + if (!is_numeric($_POST['bandwidth'])) { $savemsg="Posted value is not a valid bandwidth."; $stepid--; } @@ -702,7 +702,7 @@ function step5_stepsubmitphpaction() { return; } $bw = $_POST['bandwidth']; - if($bw > 15 || $bw < 2) { + if ($bw > 15 || $bw < 2) { $savemsg="Values should be between 2% and 15%!"; $stepid--; return; @@ -743,10 +743,10 @@ function apply_all_chosen_items() { * Doing it here makes sense since we can wipe the previous config only after * the user decides to do so, finishing the wizard. */ - if(isset($config['shaper']['queue'])) + if (isset($config['shaper']['queue'])) unset($config['shaper']['queue']); /* XXX: This is redundant, because this should be handled by converter at startup. */ - if(isset($config['shaper']['rule'])) + if (isset($config['shaper']['rule'])) unset($config['shaper']['rule']); foreach ($config['filter']['rule'] as $key => $rule) if ($rule['wizard'] == "yes") @@ -1558,7 +1558,7 @@ function apply_all_chosen_items() { /* Rules */ if ($penalty) { - if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { + if (is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) { $rule = array(); $rule['type'] = "match"; $rule['interface'] = $interfacelist; @@ -1577,7 +1577,7 @@ function apply_all_chosen_items() { /* If user specifies an IP, we don't bother with providers */ if ($voip) { - if( is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { + if (is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; @@ -1607,7 +1607,7 @@ function apply_all_chosen_items() { $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; - } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { + } elseif ($config['ezshaper']['step3']['provider'] == "Generic") { /* create VOIP rules */ $rule = array(); $rule['type'] = "match"; @@ -1638,7 +1638,7 @@ function apply_all_chosen_items() { $rule['wizard'] = "yes"; $rule['enabled'] = "on"; $rule['destination']['port'] = $voip[2]."-".$voip[3]; - if($voip[1] != '') + if ($voip[1] != '') $rule['protocol'] = $voip[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; @@ -1648,7 +1648,7 @@ function apply_all_chosen_items() { /* loop through p2plist[] */ if ($p2p) { - foreach($config['ezshaper']['step5'] as $key => $val) { + foreach ($config['ezshaper']['step5'] as $key => $val) { if (!is_array($p2plist[$key])) continue; foreach ($p2plist[$key] as $p2pclient) { @@ -1662,7 +1662,7 @@ function apply_all_chosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; - if($p2pclient[1] != '') + if ($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; @@ -1672,7 +1672,7 @@ function apply_all_chosen_items() { /* loop through gamesplist[] */ if ($games) { - foreach($config['ezshaper']['step6'] as $key => $val) { + foreach ($config['ezshaper']['step6'] as $key => $val) { if (!is_array($gamesplist[$key])) continue; foreach ($gamesplist[$key] as $Gameclient) { @@ -1689,7 +1689,7 @@ function apply_all_chosen_items() { $rule['enabled'] = "on"; $rule['descr'] = "m_Game {$Gameclient[0]} outbound"; $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; - if($Gameclient[1] != '') + if ($Gameclient[1] != '') $rule['protocol'] = $Gameclient[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; @@ -1699,7 +1699,7 @@ function apply_all_chosen_items() { /* loop through othersplist[] */ if ($otherpriority) { - foreach($config['ezshaper']['step7'] as $key => $val) { + foreach ($config['ezshaper']['step7'] as $key => $val) { if (!is_array($othersplist[$key])) continue; foreach ($othersplist[$key] as $otherclient) { @@ -1739,10 +1739,10 @@ function apply_all_chosen_items() { $rule['enabled'] = "on"; $rule['descr'] = "m_Other {$otherclient[0]} outbound"; - if($otherclient[2] or $otherclient[3]) { + if ($otherclient[2] or $otherclient[3]) { $rule['destination']['port'] = $otherclient[2]."-".$otherclient[3]; } - if($otherclient[1] != '') + if ($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; |