diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-16 22:19:45 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-16 22:19:45 +0545 |
commit | 8e048cc13a6eae2ab72f08f4c5d6fdc94ddf7a8a (patch) | |
tree | f63965a3be0f6c551cc973fe327d0b2fe58bf7e7 /src/usr/local | |
parent | 2eb5a0bf9d69fbedc6d4e9c1b5665ce9e6396c2a (diff) | |
download | pfsense-8e048cc13a6eae2ab72f08f4c5d6fdc94ddf7a8a.zip pfsense-8e048cc13a6eae2ab72f08f4c5d6fdc94ddf7a8a.tar.gz |
Code style services captive portal
Diffstat (limited to 'src/usr/local')
12 files changed, 76 insertions, 52 deletions
diff --git a/src/usr/local/www/services_captiveportal.php b/src/usr/local/www/services_captiveportal.php index ab5cddf..fb7a16c 100644 --- a/src/usr/local/www/services_captiveportal.php +++ b/src/usr/local/www/services_captiveportal.php @@ -526,8 +526,9 @@ function build_radiusnas_list() { $snip = long2ip32($start+$i); $list[$snip] = $sn['descr'] . ' - ' . $snip; } - } else + } else { $list[$sn['subnet']] = $sn['descr'] . ' - ' . $sn['subnet']; + } } } @@ -539,8 +540,9 @@ function build_cert_list() { $list = array(); - foreach($a_cert as $cert) + foreach ($a_cert as $cert) { $list[$cert['refid']] = $cert['descr']; + } return($list); } @@ -548,11 +550,13 @@ function build_cert_list() { $closehead = false; 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("Configuration"), true, "services_captiveportal.php?zone={$cpzone}"); @@ -1167,7 +1171,7 @@ print_info_box(gettext('Warning:' . '<br />' . 'Don\'t forget to enable the DHCP <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // ------- Show/hide sections based on checkbox settings -------------------------------------- function hideSections(hide) { diff --git a/src/usr/local/www/services_captiveportal_filemanager.php b/src/usr/local/www/services_captiveportal_filemanager.php index 4b5ab8d..9ef63c8 100644 --- a/src/usr/local/www/services_captiveportal_filemanager.php +++ b/src/usr/local/www/services_captiveportal_filemanager.php @@ -164,8 +164,9 @@ if ($_POST) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $tab_array = array(); $tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}"); @@ -237,7 +238,7 @@ if (is_array($a_cp[$cpzone]['element'])): $i++; endforeach; - if($total_size > 0) : + if ($total_size > 0) : ?> <tr> <th> diff --git a/src/usr/local/www/services_captiveportal_hostname.php b/src/usr/local/www/services_captiveportal_hostname.php index ca2d884..c40694a 100644 --- a/src/usr/local/www/services_captiveportal_hostname.php +++ b/src/usr/local/www/services_captiveportal_hostname.php @@ -130,8 +130,9 @@ if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) { include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); +} $tab_array = array(); $tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}"); @@ -175,11 +176,11 @@ $i++; endforeach; ?> <tbody> </table> - <?=$directionicons['to'] . ' = ' . sprintf(gettext('All connections %sto%s the hostname are allowed'), '<u>','</u>') . ', '?> - <?=$directionicons['from'] . ' = ' . sprintf(gettext('All connections %sfrom%s the hostname are allowed'), '<u>','</u>') . ', '?> - <?=$directionicons['both'] . ' = ' . sprintf(gettext('All connections %sto or from%s are allowed'), '<u>','</u>')?> + <?=$directionicons['to'] . ' = ' . sprintf(gettext('All connections %sto%s the hostname are allowed'), '<u>', '</u>') . ', '?> + <?=$directionicons['from'] . ' = ' . sprintf(gettext('All connections %sfrom%s the hostname are allowed'), '<u>', '</u>') . ', '?> + <?=$directionicons['both'] . ' = ' . sprintf(gettext('All connections %sto or from%s are allowed'), '<u>', '</u>')?> <?php -else : +else: ?> </tbody> </table> diff --git a/src/usr/local/www/services_captiveportal_hostname_edit.php b/src/usr/local/www/services_captiveportal_hostname_edit.php index fe2adac..5d828d1 100644 --- a/src/usr/local/www/services_captiveportal_hostname_edit.php +++ b/src/usr/local/www/services_captiveportal_hostname_edit.php @@ -183,7 +183,7 @@ if ($_POST) { } function build_dir_list() { - $dirs = array(gettext("Both"),gettext("From"),gettext("To")); + $dirs = array(gettext("Both"), gettext("From"), gettext("To")); $dirlist = array(); foreach ($dirs as $dir) { @@ -195,8 +195,9 @@ function build_dir_list() { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(new Form_Button( 'Submit', diff --git a/src/usr/local/www/services_captiveportal_ip.php b/src/usr/local/www/services_captiveportal_ip.php index 5e95cde..6d8c40b 100644 --- a/src/usr/local/www/services_captiveportal_ip.php +++ b/src/usr/local/www/services_captiveportal_ip.php @@ -123,8 +123,9 @@ if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) { include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); +} $tab_array = array(); $tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}"); @@ -171,11 +172,11 @@ if (is_array($a_cp[$cpzone]['allowedip'])): ?> <tbody> </table> - <?=$directionicons['to'] . ' = ' . sprintf(gettext('All connections %sto%s the address are allowed'), '<u>','</u>') . ', '?> - <?=$directionicons['from'] . ' = ' . sprintf(gettext('All connections %sfrom%s the address are allowed'), '<u>','</u>') . ', '?> - <?=$directionicons['both'] . ' = ' . sprintf(gettext('All connections %sto or from%s are allowed'), '<u>','</u>')?> + <?=$directionicons['to'] . ' = ' . sprintf(gettext('All connections %sto%s the address are allowed'), '<u>', '</u>') . ', '?> + <?=$directionicons['from'] . ' = ' . sprintf(gettext('All connections %sfrom%s the address are allowed'), '<u>', '</u>') . ', '?> + <?=$directionicons['both'] . ' = ' . sprintf(gettext('All connections %sto or from%s are allowed'), '<u>', '</u>')?> <?php -else : +else: ?> </tbody> </table> diff --git a/src/usr/local/www/services_captiveportal_ip_edit.php b/src/usr/local/www/services_captiveportal_ip_edit.php index 2417212..b479f3c 100644 --- a/src/usr/local/www/services_captiveportal_ip_edit.php +++ b/src/usr/local/www/services_captiveportal_ip_edit.php @@ -218,7 +218,7 @@ if ($_POST) { } function build_dir_list() { - $dirs = array(gettext("Both"),gettext("From"),gettext("To")); + $dirs = array(gettext("Both"), gettext("From"), gettext("To")); $dirlist = array(); foreach ($dirs as $dir) { @@ -230,8 +230,9 @@ function build_dir_list() { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_mac.php b/src/usr/local/www/services_captiveportal_mac.php index 4aa98bc..d9eb4be 100644 --- a/src/usr/local/www/services_captiveportal_mac.php +++ b/src/usr/local/www/services_captiveportal_mac.php @@ -184,11 +184,13 @@ if ($_GET['act'] == "del") { include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} -if (is_subsystem_dirty('passthrumac')) +if (is_subsystem_dirty('passthrumac')) { print_info_box_np(gettext("The captive portal MAC address configuration has been changed.<br />You must apply the changes in order for them to take effect.")); +} $tab_array = array(); $tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}"); @@ -237,7 +239,7 @@ endforeach; ?> <tbody> </table> <?php -else : +else: ?> </tbody> </table> diff --git a/src/usr/local/www/services_captiveportal_mac_edit.php b/src/usr/local/www/services_captiveportal_mac_edit.php index ab19697..23f3c8f 100644 --- a/src/usr/local/www/services_captiveportal_mac_edit.php +++ b/src/usr/local/www/services_captiveportal_mac_edit.php @@ -211,12 +211,13 @@ if ($_POST) { // Get the MAC address $ip = $_SERVER['REMOTE_ADDR']; $mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`; -$mymac = str_replace("\n","",$mymac); +$mymac = str_replace("\n", "", $mymac); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); @@ -295,7 +296,7 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Make the ‘Copy My MAC’ button a plain button, not a submit button $("#btnmymac").prop('type','button'); diff --git a/src/usr/local/www/services_captiveportal_vouchers.php b/src/usr/local/www/services_captiveportal_vouchers.php index 603f40d..a270b17 100644 --- a/src/usr/local/www/services_captiveportal_vouchers.php +++ b/src/usr/local/www/services_captiveportal_vouchers.php @@ -74,8 +74,9 @@ require_once("voucher.inc"); $cpzone = $_GET['zone']; -if (isset($_POST['zone'])) - $cpzone = $_POST['zone']; +if (isset($_POST['zone'])) { + $cpzone = $_POST['zone']; +} if (empty($cpzone)) { header("Location: services_captiveportal_zones.php"); @@ -314,13 +315,13 @@ if ($_POST) { $newvoucher['vouchersyncusername'] = $_POST['vouchersyncusername']; $newvoucher['vouchersyncpass'] = $_POST['vouchersyncpass']; if ($newvoucher['vouchersyncpass'] && $newvoucher['vouchersyncusername'] && - $newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) { + $newvoucher['vouchersyncport'] && $newvoucher['vouchersyncdbip']) { // Synchronize the voucher DB from the master node require_once("xmlrpc.inc"); $protocol = "http"; if (is_array($config['system']) && is_array($config['system']['webgui']) && !empty($config['system']['webgui']['protocol']) && - $config['system']['webgui']['protocol'] == "https") { + $config['system']['webgui']['protocol'] == "https") { $protocol = "https"; } if ($protocol == "https" || $newvoucher['vouchersyncport'] == "443") { @@ -419,11 +420,13 @@ EOF; $closehead = false; 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("Configuration"), false, "services_captiveportal.php?zone={$cpzone}"); @@ -453,7 +456,7 @@ display_top_tabs($tab_array, true); <tbody> <?php $i = 0; -foreach($a_roll as $rollent): +foreach ($a_roll as $rollent): ?> <tr> <td> @@ -636,23 +639,25 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Hides all elements of the specified class. This will usually be a section or group function hideClass(s_class, hide) { - if(hide) + if (hide) { $('.' + s_class).hide(); - else + } else { $('.' + s_class).show(); + } } function setShowHide (show) { hideClass('rolledit', !show); - if(show) + if (show) { $('td:nth-child(5),th:nth-child(5)').show(); - else + } else { $('td:nth-child(5),th:nth-child(5)').hide(); + } } // Show/hide on checkbox change @@ -664,12 +669,12 @@ events.push(function(){ setShowHide($('#enable').is(":checked")); var generateButton = $('<a class="btn btn-xs btn-default">Generate new keys</a>'); - generateButton.on('click', function(){ + generateButton.on('click', function() { $.ajax({ type: 'get', url: 'services_captiveportal_vouchers.php?generatekey=true', dataType: 'json', - success: function(data){ + success: function(data) { $('#publickey').val(data.public.replace(/\\n/g, '\n')); $('#privatekey').val(data.private.replace(/\\n/g, '\n')); } diff --git a/src/usr/local/www/services_captiveportal_vouchers_edit.php b/src/usr/local/www/services_captiveportal_vouchers_edit.php index c3565c5..1508b5d 100644 --- a/src/usr/local/www/services_captiveportal_vouchers_edit.php +++ b/src/usr/local/www/services_captiveportal_vouchers_edit.php @@ -127,8 +127,9 @@ if ($_POST) { // Look for duplicate roll # foreach ($a_roll as $re) { - if (isset($id) && $a_roll[$id] && $a_roll[$id] === $re) + if (isset($id) && $a_roll[$id] && $a_roll[$id] === $re) { continue; + } if ($re['number'] == $_POST['number']) { $input_errors[] = sprintf(gettext("Roll number %s already exists."), $_POST['number']); break; @@ -164,11 +165,11 @@ if ($_POST) { if ($_POST['count'] != $rollent['count']) { $rollent['count'] = $_POST['count']; $len = ($rollent['count']>>3) + 1; // count / 8 +1 - $rollent['used'] = base64_encode(str_repeat("\000",$len)); // 4 bitmask + $rollent['used'] = base64_encode(str_repeat("\000", $len)); // 4 bitmask $rollent['active'] = array(); voucher_write_used_db($rollent['number'], $rollent['used']); voucher_write_active_db($rollent['number'], array()); // create empty DB - voucher_log(LOG_INFO,sprintf(gettext('All %1$s vouchers from Roll %2$s marked unused'), $rollent['count'], $rollent['number'])); + voucher_log(LOG_INFO, sprintf(gettext('All %1$s vouchers from Roll %2$s marked unused'), $rollent['count'], $rollent['number'])); } else { // existing roll has been modified but without changing the count // read active and used DB from ramdisk and store it in XML config @@ -176,7 +177,7 @@ if ($_POST) { $activent = array(); $db = array(); $active_vouchers = voucher_read_active_db($rollent['number'], $rollent['minutes']); - foreach($active_vouchers as $voucher => $line) { + foreach ($active_vouchers as $voucher => $line) { list($timestamp, $minutes) = explode(",", $line); $activent['voucher'] = $voucher; $activent['timestamp'] = $timestamp; @@ -188,10 +189,11 @@ if ($_POST) { unlock($voucherlck); - if (isset($id) && $a_roll[$id]) + if (isset($id) && $a_roll[$id]) { $a_roll[$id] = $rollent; - else + } else { $a_roll[] = $rollent; + } write_config(); @@ -202,11 +204,13 @@ if ($_POST) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $form = new Form(); diff --git a/src/usr/local/www/services_captiveportal_zones.php b/src/usr/local/www/services_captiveportal_zones.php index f5b1202..bcf15fc 100644 --- a/src/usr/local/www/services_captiveportal_zones.php +++ b/src/usr/local/www/services_captiveportal_zones.php @@ -94,11 +94,13 @@ $pgtitle = array(gettext("Services"), gettext("Captive Portal"), gettext("Zones" $shortcut_section = "captiveportal"; include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, success); +} -if (is_subsystem_dirty('captiveportal')) +if (is_subsystem_dirty('captiveportal')) { print_info_box_np(gettext("The Captive Portal entry list has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect.")); +} ?> <form action="services_captiveportal_zones.php" method="post"> <div class="panel panel-default"> diff --git a/src/usr/local/www/services_captiveportal_zones_edit.php b/src/usr/local/www/services_captiveportal_zones_edit.php index 1eda681..fb278bb 100644 --- a/src/usr/local/www/services_captiveportal_zones_edit.php +++ b/src/usr/local/www/services_captiveportal_zones_edit.php @@ -110,8 +110,9 @@ if ($_POST) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(new Form_Button( 'submit', |