diff options
Diffstat (limited to 'src/usr')
43 files changed, 400 insertions, 330 deletions
diff --git a/src/usr/local/www/classes/Form.class.php b/src/usr/local/www/classes/Form.class.php index 7964d12..6f30f69 100644 --- a/src/usr/local/www/classes/Form.class.php +++ b/src/usr/local/www/classes/Form.class.php @@ -35,8 +35,6 @@ class Form extends Form_Element protected $_attributes = array( 'class' => array('form-horizontal' => true), 'method' => 'post', - // Empty is interpreted by all browsers to submit to the current URI - 'action' => '', ); protected $_sections = array(); protected $_global = array(); @@ -54,6 +52,9 @@ class Form extends Form_Element if (false !== $submit) $this->addGlobal($submit); + + if (!isset($this->_attributes['action'])) + $this->_attributes['action'] = htmlspecialchars($_SERVER['REQUEST_URI']); } public function add(Form_Section $section) diff --git a/src/usr/local/www/classes/Form/Checkbox.class.php b/src/usr/local/www/classes/Form/Checkbox.class.php index e0734de..d94c210 100644 --- a/src/usr/local/www/classes/Form/Checkbox.class.php +++ b/src/usr/local/www/classes/Form/Checkbox.class.php @@ -46,10 +46,16 @@ class Form_Checkbox extends Form_Input $this->column->addClass('checkbox'); } - public function displayAsRadio() + public function displayAsRadio($id = null) { $this->_attributes['type'] = 'radio'; + if ($id != null) { + $this->_attributes['id'] = $id; + } else { + $this->_attributes['id'] = $this->_attributes['name'] . '_' . $this->_attributes['value'] . ':' .substr(uniqid(), 9); + } + return $this; } diff --git a/src/usr/local/www/diag_arp.php b/src/usr/local/www/diag_arp.php index 9f36fd0..ad58a70 100644 --- a/src/usr/local/www/diag_arp.php +++ b/src/usr/local/www/diag_arp.php @@ -349,7 +349,7 @@ $mac_man = load_mac_manufacturer_table(); </tr> </thead> <tbody> - + <?php foreach ($data as $entry): ?> <tr> @@ -376,7 +376,7 @@ $mac_man = load_mac_manufacturer_table(); <script type="text/javascript"> //<![CDATA[ // Clear the "loading" div once the page has loaded" -events.push(function(){ +events.push(function() { $('#loading').empty(); }); //]]> diff --git a/src/usr/local/www/diag_authentication.php b/src/usr/local/www/diag_authentication.php index 5dea23d..d665fc6 100644 --- a/src/usr/local/www/diag_authentication.php +++ b/src/usr/local/www/diag_authentication.php @@ -87,8 +87,9 @@ if ($_POST) { $groups = getUserGroups($_POST['username'], $authcfg, $attributes); $savemsg .= " " . gettext("This user is a member of groups") . ": <br />"; $savemsg .= "<ul>"; - foreach ($groups as $group) + foreach ($groups as $group) { $savemsg .= "<li>" . "{$group} " . "</li>"; + } $savemsg .= "</ul>"; } else { @@ -109,18 +110,21 @@ include("head.inc"); ?> <?php -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>'); +} $form = new Form('Test'); $section = new Form_Section('Authentication Test'); -foreach (auth_get_authserver_list() as $auth_server) +foreach (auth_get_authserver_list() as $auth_server) { $serverlist[$auth_server['name']] = $auth_server['name']; +} $section->addInput(new Form_Select( 'authmode', diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index 98d5ff8..4b5f453 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -608,11 +608,13 @@ function build_area_list($showall) { $pgtitle = array(gettext("Diagnostics"), gettext("Backup/Restore")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} if (is_subsystem_dirty('restore')): ?> @@ -772,7 +774,7 @@ print($form); ?> <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // ------- Show/hide sections based on checkbox settings -------------------------------------- @@ -801,7 +803,7 @@ events.push(function(){ hidePasswords(); }); - $('#conffile').change(function (){ + $('#conffile').change(function () { $('.restore').prop('disabled', false); }); // ---------- On initial page load ------------------------------------------------------------ diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php index 679370d..1ac0d17 100755 --- a/src/usr/local/www/diag_dns.php +++ b/src/usr/local/www/diag_dns.php @@ -99,8 +99,9 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) { $isfirst = true; foreach ($resolved as $re) { if ($re != "") { - if (!$isfirst) + if (!$isfirst) { $addresses .= " "; + } $addresses .= rtrim($re) . "/32"; $isfirst = false; } @@ -211,13 +212,15 @@ function display_host_results ($address, $hostname, $dns_speeds) { include("head.inc"); /* Display any error messages resulting from user input */ -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); -else if (!$resolved && $type) +} else if (!$resolved && $type) { print('<div class="alert alert-warning" role="alert">' . gettext("Host") .' "'. $host .'" '. gettext("could not be resolved") . '</div>'); +} -if ($createdalias) +if ($createdalias) { print('<div class="alert alert-success" role="alert">'.gettext("Alias was created/updated successfully").'</div>'); +} $form = new Form('Lookup'); $section = new Form_Section('DNS Lookup'); diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php index c4c93d6..f5cd437 100755 --- a/src/usr/local/www/diag_dump_states.php +++ b/src/usr/local/www/diag_dump_states.php @@ -100,8 +100,8 @@ include("head.inc"); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ - $('a[data-entry]').on('click', function(){ +events.push(function() { + $('a[data-entry]').on('click', function() { var el = $(this); var data = $(this).data('entry').split('|'); @@ -114,7 +114,7 @@ events.push(function(){ srcip: data[0], dstip: data[1] }, - success: function(){ + success: function() { el.parents('tr').remove(); }, }); @@ -126,8 +126,9 @@ events.push(function(){ <?php $tab_array = array(); $tab_array[] = array(gettext("States"), true, "diag_dump_states.php"); -if (isset($config['system']['lb_use_sticky'])) +if (isset($config['system']['lb_use_sticky'])) { $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php"); +} $tab_array[] = array(gettext("Reset States"), false, "diag_resetstate.php"); display_top_tabs($tab_array); @@ -182,8 +183,9 @@ print $form; $grepline = (isset($_POST['filter'])) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : ""; $fd = popen("/sbin/pfctl -s state {$grepline}", "r"); while ($line = chop(fgets($fd))) { - if ($row >= 10000) + if ($row >= 10000) { break; + } $line_split = preg_split("/\s+/", $line); @@ -213,17 +215,18 @@ print $form; title="<?=sprintf(gettext('Remove all state entries from %s to %s'), $srcip, $dstip);?>"></a> </td> </tr> -<?php $row++; } +<?php $row++; } ?> </tbody> </table> <?php if ($row == 0) { - if (isset($_POST['filter']) && !empty($_POST['filter'])) + if (isset($_POST['filter']) && !empty($_POST['filter'])) { $errmsg = gettext('No states were found that match the current filter'); - else + } else { $errmsg = gettext('No states were found'); + } print('<p class="alert alert-warning">' . $errmsg . '</p>'); } diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php index b0c216f..da8cb35 100644 --- a/src/usr/local/www/diag_dump_states_sources.php +++ b/src/usr/local/www/diag_dump_states_sources.php @@ -102,8 +102,8 @@ display_top_tabs($tab_array); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ - $('a[data-entry]').on('click', function(){ +events.push(function() { + $('a[data-entry]').on('click', function() { var el = $(this); var data = $(this).data('entry').split('|'); @@ -116,7 +116,7 @@ events.push(function(){ srcip: data[0], dstip: data[1] }, - success: function(){ + success: function() { el.parents('tr').remove(); }, }); diff --git a/src/usr/local/www/diag_halt.php b/src/usr/local/www/diag_halt.php index b2a0e21..20658e1 100755 --- a/src/usr/local/www/diag_halt.php +++ b/src/usr/local/www/diag_halt.php @@ -91,8 +91,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { <?php if (DEBUG) { print("Not actually halting (DEBUG is set true)<br>"); - } - else { + } else { print('<pre>'); system_halt(); print('</pre>'); diff --git a/src/usr/local/www/diag_limiter_info.php b/src/usr/local/www/diag_limiter_info.php index 5425e6c..0c703b6 100644 --- a/src/usr/local/www/diag_limiter_info.php +++ b/src/usr/local/www/diag_limiter_info.php @@ -87,8 +87,9 @@ if ($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} ?> <script type="text/javascript"> @@ -107,7 +108,7 @@ if ($input_errors) }); } - events.push(function(){ + events.push(function() { setInterval('getlimiteractivity()', 2500); getlimiteractivity(); }); diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php index b09258c..7a06ebd 100644 --- a/src/usr/local/www/diag_nanobsd.php +++ b/src/usr/local/www/diag_nanobsd.php @@ -90,10 +90,11 @@ $NANOBSD_SIZE = nanobsd_get_size(); $class='alert-warning'; if ($_POST['bootslice']) { - if (!DEBUG) + if (!DEBUG) { nanobsd_switch_boot_slice(); - else + } else { sleep(4); + } $savemsg = gettext("The boot slice has been set to") . " " . nanobsd_get_active_slice(); $class='alert-success'; @@ -126,15 +127,15 @@ if ($_POST['changero']) { if ($_POST['setrw']) { if (!DEBUG) { conf_mount_rw(); - if (isset($_POST['nanobsd_force_rw'])) + if (isset($_POST['nanobsd_force_rw'])) { $config['system']['nanobsd_force_rw'] = true; - else + } else { unset($config['system']['nanobsd_force_rw']); + } write_config("Changed Permanent Read/Write Setting"); conf_mount_ro(); - } - else { + } else { $savemsg = 'Saved r/w permanently'; $class = 'alert-success'; } @@ -142,8 +143,9 @@ if ($_POST['setrw']) { print_info_box("The options on this page are intended for use by advanced users only."); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, $class); +} $form = new Form(false); @@ -173,12 +175,14 @@ if (is_writable("/")) { $refdisplay = " (Reference count " . $refcount . ")"; } $lbl = gettext("Read/Write") . $refdisplay; - if (!isset($config['system']['nanobsd_force_rw'])) + if (!isset($config['system']['nanobsd_force_rw'])) { $btnlbl = gettext("Switch to Read-Only"); + } } else { $lbl = gettext("Read-Only"); - if (!isset($config['system']['nanobsd_force_rw'])) + if (!isset($config['system']['nanobsd_force_rw'])) { $btnlbl = gettext("Switch to Read/Write"); + } } $robtn = new Form_Button('changero', $btnlbl); diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php index 461d397..f87b43f 100644 --- a/src/usr/local/www/diag_ndp.php +++ b/src/usr/local/www/diag_ndp.php @@ -165,10 +165,11 @@ include("head.inc"); </td> <td> <?php - if (isset($hwif[$entry['interface']])) + if (isset($hwif[$entry['interface']])) { echo $hwif[$entry['interface']]; - else + } else { echo $entry['interface']; + } ?> </td> </tr> diff --git a/src/usr/local/www/diag_packet_capture.php b/src/usr/local/www/diag_packet_capture.php index 3bb8094..6016e90 100644 --- a/src/usr/local/www/diag_packet_capture.php +++ b/src/usr/local/www/diag_packet_capture.php @@ -137,8 +137,10 @@ $protos = array('icmp', 'icmp6', 'tcp', 'udp', 'arp', 'carp', 'esp', $input_errors = array(); $interfaces = get_configured_interface_with_descr(); -if (ipsec_enabled()) +if (ipsec_enabled()) { $interfaces['enc0'] = "IPsec"; +} + foreach (array('server', 'client') as $mode) { if (is_array($config['openvpn']["openvpn-{$mode}"])) { foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) { @@ -285,8 +287,9 @@ $protocollist = array( include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(false); // No button yet. We add those later depending on the required action @@ -391,8 +394,7 @@ if (($action == gettext("Stop") or $action == "") and $processisrunning != true) 'startbtn', 'Start' ))->removeClass('btn-primary')->addClass('btn-success'); -} -else { +} else { $form->addGlobal(new Form_Button( 'stopbtn', 'Stop' @@ -421,14 +423,17 @@ print($form); if ($do_tcpdump) : $matches = array(); - if (in_array($fam, $fams)) + if (in_array($fam, $fams)) { $matches[] = $fam; + } - if (in_array($proto, $protos)) + if (in_array($proto, $protos)) { $matches[] = fixup_not($proto); + } - if ($port != "") + if ($port != "") { $matches[] = "port ".fixup_not($port); + } if ($host != "") { $hostmatch = ""; @@ -437,15 +442,17 @@ if ($do_tcpdump) : foreach ($hosts as $h) { $h = fixup_host($h, $hostcount++); - if (!empty($h)) + if (!empty($h)) { $hostmatch .= " " . $h; + } } - if (!empty($hostmatch)) + if (!empty($hostmatch)) { $matches[] = "({$hostmatch})"; + } } - if ($count != "0" ) { + if ($count != "0") { $searchcount = "-c " . $count; } else { $searchcount = ""; diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php index c553b34..bd0d3f0 100644 --- a/src/usr/local/www/diag_pf_info.php +++ b/src/usr/local/www/diag_pf_info.php @@ -88,8 +88,9 @@ if ($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(false); $form->addGlobal(new Form_Input( @@ -114,8 +115,9 @@ print $form; <script type="text/javascript"> //<![CDATA[ function getpfinfo() { - if (!$('#refresh').is(':checked')) + if (!$('#refresh').is(':checked')) { return; + } $.ajax( '/diag_pf_info.php', @@ -128,7 +130,7 @@ print $form; }); } - events.push(function(){ + events.push(function() { setInterval('getpfinfo()', 2500); getpfinfo(); }); diff --git a/src/usr/local/www/diag_pftop.php b/src/usr/local/www/diag_pftop.php index 8537f91..dd57e9c 100644 --- a/src/usr/local/www/diag_pftop.php +++ b/src/usr/local/www/diag_pftop.php @@ -115,8 +115,9 @@ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) && $numstate = "100"; } -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(false); $form->addGlobal(new Form_Input( @@ -187,7 +188,7 @@ print $form; ); } - events.push(function(){ + events.push(function() { setInterval('getpftopactivity()', 2500); getpftopactivity(); }); @@ -204,12 +205,13 @@ print $form; <script type="text/javascript"> //<![CDATA[ -events.push(function(){ - $('#viewtype').on('change', function(){ - if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1) +events.push(function() { + $('#viewtype').on('change', function() { + if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1) { $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').hide(); - else + } else { $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').show(); + } }); }); //]]> diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php index 140513e..cc5c442 100644 --- a/src/usr/local/www/diag_ping.php +++ b/src/usr/local/www/diag_ping.php @@ -117,7 +117,7 @@ if ($_POST || $_REQUEST['host']) { if ($_POST) { $do_ping = true; } - if(isset($_REQUEST['sourceip'])) { + if (isset($_REQUEST['sourceip'])) { $sourceip = $_REQUEST['sourceip']; } $count = $_REQUEST['count']; @@ -131,7 +131,7 @@ if ($do_ping) { ?> <script type="text/javascript"> //<![CDATA[ - window.onload=function(){ + window.onload=function() { document.getElementById("pingCaptured").wrap='off'; } //]]> @@ -142,31 +142,35 @@ if ($do_ping) { if ($ipproto == "ipv6") { $command .= "6"; $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip); - if (is_linklocal($ifaddr)) + if (is_linklocal($ifaddr)) { $ifscope = get_ll_scope($ifaddr); + } } else { $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip); } if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) { $srcip = "-S" . escapeshellarg($ifaddr); - if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) + if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) { $host .= "%{$ifscope}"; + } } $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); //echo "Ping command: {$cmd}\n"; $result = shell_exec($cmd); - if (empty($result)) + if (empty($result)) { $input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved."; + } } include('head.inc'); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form('Ping'); diff --git a/src/usr/local/www/diag_reboot.php b/src/usr/local/www/diag_reboot.php index d011a56..f8f3a4e 100755 --- a/src/usr/local/www/diag_reboot.php +++ b/src/usr/local/www/diag_reboot.php @@ -73,15 +73,14 @@ require("captiveportal.inc"); $guitimeout = 90; // Seconds to wait before reloading the page after reboot $guiretry = 20; // Seconds to try again if $guitimeout was not long enough -$pgtitle = array(gettext("Diagnostics"),gettext("Reboot System")); +$pgtitle = array(gettext("Diagnostics"), gettext("Reboot System")); include("head.inc"); if ($_SERVER['REQUEST_METHOD'] == 'POST') { - if(DEBUG) { + if (DEBUG) { print_info_box("Not actually rebooting (DEBUG is set true)", success); - } - else { + } else { print('<div><pre>'); system_reboot(); print('</pre></div>'); @@ -93,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { var timeoutmsg = '<h4>Rebooting<br />Page will automatically reload in '; var time = 0; @@ -109,8 +108,8 @@ events.push(function(){ } function startCountdown() { - setInterval(function(){ - if(time > 0) { + setInterval(function() { + if (time > 0) { $('#countdown').html(timeoutmsg + time + ' seconds.</h4>'); time--; } else { diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php index 494e842..a5edd4d 100644 --- a/src/usr/local/www/diag_resetstate.php +++ b/src/usr/local/www/diag_resetstate.php @@ -93,11 +93,13 @@ if ($_POST) { $pgtitle = array(gettext("Diagnostics"), gettext("Reset state")); include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'alert-success'); +} $statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' . 'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' . @@ -117,8 +119,9 @@ $sourcetablehelp = 'Resetting the source tracking table will remove all source/d $tab_array = array(); $tab_array[] = array(gettext("States"), false, "diag_dump_states.php"); -if (isset($config['system']['lb_use_sticky'])) +if (isset($config['system']['lb_use_sticky'])) { $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php"); +} $tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php"); display_top_tabs($tab_array); diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php index 58c4924..e02bafa 100644 --- a/src/usr/local/www/diag_routes.php +++ b/src/usr/local/www/diag_routes.php @@ -161,29 +161,33 @@ function update_routes_callback(html) { for (var i = 0; i < responseTextArr.length; i++) { - if (responseTextArr[i] == "") + if (responseTextArr[i] == "") { continue; + } - if (i == 0) + if (i == 0) { var tmp = ''; - else + } else { var tmp = '<tr>'; + } var j = 0; var entry = responseTextArr[i].split(" "); for (var k = 0; k < entry.length; k++) { - if (entry[k] == "") + if (entry[k] == "") { continue; - if (i == 0) + } + if (i == 0) { tmp += '<th>' + entry[k] + '<\/th>'; - else + } else { tmp += '<td>' + entry[k] + '<\/td>'; + } j++; } - if (i == 0) + if (i == 0) { thead += tmp; - else { + } else { tmp += '<td><\/td>' tbody += tmp; } @@ -198,11 +202,11 @@ function update_all_routes() { update_routes("IPv6"); } -events.push(function(){ +events.push(function() { setInterval('update_all_routes()', 5000); update_all_routes(); - $(document.forms[0]).on('submit', function(e){ + $(document.forms[0]).on('submit', function(e) { update_all_routes(); e.preventDefault(); diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php index f4ca880..7793c35 100644 --- a/src/usr/local/www/diag_smart.php +++ b/src/usr/local/www/diag_smart.php @@ -76,8 +76,7 @@ $closehead = false; include("head.inc"); // Highlights the words "PASSED", "FAILED", and "WARNING". -function add_colors($string) -{ +function add_colors($string) { // To add words keep arrays matched by numbers $patterns[0] = '/PASSED/'; $patterns[1] = '/FAILED/'; @@ -230,9 +229,7 @@ switch ($action) { smartmonctl("stop"); smartmonctl("start"); $style = 'warning'; - } - else if (isset($_POST['save'])) - { + } else if (isset($_POST['save'])) { $config['system']['smartmonemail'] = $_POST['smartmonemail']; write_config(); @@ -242,8 +239,7 @@ switch ($action) { if (stristr($retval, "error") != true) { $savemsg = get_std_save_message($retval); $style = 'success'; - } - else { + } else { $savemsg = $retval; $style='danger'; } @@ -258,8 +254,9 @@ switch ($action) { } // Was the config changed? if so, print the message - if ($savemsg) + if ($savemsg) { print_info_box($savemsg, $style); + } // Get users email from the xml file $pconfig['smartmonemail'] = $config['system']['smartmonemail']; diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php index 3a7d6e1..5cad1ac 100644 --- a/src/usr/local/www/diag_sockets.php +++ b/src/usr/local/www/diag_sockets.php @@ -100,26 +100,27 @@ $showAllOption = $showAll ? "" : "?showAll"; <thead> <?php foreach (explode("\n", $table) as $i => $line) { - if (trim($line) == "") + if (trim($line) == "") { continue; + } $j = 0; print("<tr>\n"); foreach (explode(' ', $line) as $entry) { - if ($entry == '' || $entry == "ADDRESS") + if ($entry == '' || $entry == "ADDRESS") { continue; + } if ($i == 0) { print("<th class=\"$class\">$entry</th>\n"); - } - else { + } else { print("<td class=\"$class\">$entry</td>\n"); } $j++; } print("</tr>\n"); - if($i == 0) { + if ($i == 0) { print("</thead>\n"); print("<tbody>\n"); } diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php index 47142b5..ef6b612 100644 --- a/src/usr/local/www/diag_states_summary.php +++ b/src/usr/local/www/diag_states_summary.php @@ -167,10 +167,10 @@ function build_port_info($portarr, $proto) { return implode($ports, ', '); } -function print_summary_table($label, $iparr, $sort = TRUE) -{ - if ($sort) +function print_summary_table($label, $iparr, $sort = TRUE) { + if ($sort) { uksort($iparr, "sort_by_ip"); + } ?> <div class="panel panel-default"> @@ -196,8 +196,9 @@ function print_summary_table($label, $iparr, $sort = TRUE) $rowSpan = ''; $i = 0; - if ($protocolCount > 1) + if ($protocolCount > 1) { $rowSpan = ' rowspan="' . $protocolCount . '"'; + } ?> <tr> <td<?= $rowSpan ?>><?php echo $ip; ?></td> diff --git a/src/usr/local/www/diag_system_activity.php b/src/usr/local/www/diag_system_activity.php index 810c39a..76c5c17 100644 --- a/src/usr/local/www/diag_system_activity.php +++ b/src/usr/local/www/diag_system_activity.php @@ -77,8 +77,9 @@ if ($_REQUEST['getactivity']) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} ?> <script type="text/javascript"> @@ -99,7 +100,7 @@ function getcpuactivity() { ); } -events.push(function(){ +events.push(function() { setInterval('getcpuactivity()', 2500); getcpuactivity(); }); diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php index 5fb0eba..c351701 100644 --- a/src/usr/local/www/diag_tables.php +++ b/src/usr/local/www/diag_tables.php @@ -105,15 +105,18 @@ if (($tablename == "bogons") || ($tablename == "bogonsv6")) { $loading = true; while ($loading == true) { $isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`; - if ($isrunning == "") + if ($isrunning == "") { $loading = false; + } $maxtimetowait++; - if ($maxtimetowait > 89) + if ($maxtimetowait > 89) { $loading = false; + } sleep(1); } - if ($maxtimetowait < 90) + if ($maxtimetowait < 90) { $savemsg = gettext("The bogons database has been updated."); + } } } @@ -122,8 +125,9 @@ exec("/sbin/pfctl -sT", $tables); include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg); +} $form = new Form('Show'); @@ -142,8 +146,8 @@ print $form; <script type="text/javascript"> //<![CDATA[ -events.push(function(){ - $('a[data-entry]').on('click', function(){ +events.push(function() { + $('a[data-entry]').on('click', function() { var el = $(this); $.ajax( @@ -154,7 +158,7 @@ events.push(function(){ type: '<?=htmlspecialchars($tablename)?>', delete: $(this).data('entry') }, - success: function(){ + success: function() { el.parents('tr').remove(); }, }); diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php index c009929..3b495e3 100644 --- a/src/usr/local/www/diag_testport.php +++ b/src/usr/local/www/diag_testport.php @@ -124,7 +124,7 @@ if ($_POST || $_REQUEST['host']) { ?> <script type="text/javascript"> //<![CDATA[ - window.onload=function(){ + window.onload=function() { document.getElementById("testportCaptured").wrap='off'; } //]]> @@ -134,10 +134,12 @@ if ($_POST || $_REQUEST['host']) { $ncoutput = ""; $nc_base_cmd = '/usr/bin/nc'; $nc_args = "-w " . escapeshellarg($timeout); - if (!$showtext) + if (!$showtext) { $nc_args .= ' -z '; - if (!empty($srcport)) + } + if (!empty($srcport)) { $nc_args .= ' -p ' . escapeshellarg($srcport) . ' '; + } /* Attempt to determine the interface address, if possible. Else try both. */ if (is_ipaddrv4($host)) { @@ -152,12 +154,13 @@ if ($_POST || $_REQUEST['host']) { } $nc_args .= ' -4'; } elseif (is_ipaddrv6($host)) { - if ($sourceip == "any") + if ($sourceip == "any") { $ifaddr = ''; - else if (is_linklocal($sourceip)) + } else if (is_linklocal($sourceip)) { $ifaddr = $sourceip; - else + } else { $ifaddr = get_interface_ipv6($sourceip); + } $nc_args .= ' -6'; } else { switch ($ipprotocol) { @@ -197,8 +200,9 @@ if ($_POST || $_REQUEST['host']) { if (!empty($ifaddr)) { $nc_args .= ' -s ' . escapeshellarg($ifaddr) . ' '; $scope = get_ll_scope($ifaddr); - if (!empty($scope) && !strstr($host, "%")) + if (!empty($scope) && !strstr($host, "%")) { $host .= "%{$scope}"; + } } $nc_cmd = "{$nc_base_cmd} {$nc_args} " . escapeshellarg($host) . ' ' . escapeshellarg($port) . ' 2>&1'; @@ -220,9 +224,9 @@ if ($_POST || $_REQUEST['host']) { include("head.inc"); // Handle the display of all messages here where the user can readily see them -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); -else { +} else { // New page if (empty($result) && $retval != 0 && !$showtext) { print('<div class="alert alert-warning" role="alert">This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.' . @@ -231,18 +235,21 @@ else { // Good host & port if ($retval == 0 && $do_testport == 1) { - if (!$showtext) + if (!$showtext) { print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful").'</div>'); - else + } else { print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful") . '. Any text received from the host will be shown below the form.</div>'); + } } // netcat exit value != 0 - if ($retval != 0 && !empty($result)) - if ($showtext) + if ($retval != 0 && !empty($result)) { + if ($showtext) { print('<div class="alert alert-danger" role="alert">'.gettext('No output received, or connection failed. Try with "Show Remote Text" unchecked first.').'</div>'); - else + } else { print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>'); + } + } } $form = new Form('Test'); diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php index ad614a9..10a6a4b 100644 --- a/src/usr/local/www/diag_traceroute.php +++ b/src/usr/local/www/diag_traceroute.php @@ -90,8 +90,9 @@ function create_sourceaddresslist() { $sourceips = get_possible_traffic_source_addresses(true); - foreach ($sourceips as $sipvalue => $sipname) + foreach ($sourceips as $sipvalue => $sipname) { $list[$sipvalue] = $sipname; + } return($list); } @@ -135,8 +136,9 @@ if ($_POST || $_REQUEST['host']) { $useicmp = false; } -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form('Traceroute'); @@ -212,10 +214,11 @@ if (!$input_errors && $do_traceroute) { <div class="panel-heading"><h2 class="panel-title">Results</h2></div> <div class="panel-body"> <?php - if ($result = shell_exec($cmd)) + if ($result = shell_exec($cmd)) { print(nl2br($result)); - else + } else { print('Error: ' . $host . ' ' . gettext("could not be traced/resolved")); + } ?> </div> </div> diff --git a/src/usr/local/www/easyrule.php b/src/usr/local/www/easyrule.php index 7a73bab..575ddf8 100644 --- a/src/usr/local/www/easyrule.php +++ b/src/usr/local/www/easyrule.php @@ -92,14 +92,15 @@ if (stristr($retval, "error") == true) { include("head.inc"); ?> -include("fbegin.inc"); +include("fbegin.inc"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> -<?php -if ($input_errors) +<?php +if ($input_errors) { print_input_errors($input_errors); +} if ($message) { ?> <br /> diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php index f4ecde7..29e073b 100644 --- a/src/usr/local/www/edit.php +++ b/src/usr/local/www/edit.php @@ -138,7 +138,7 @@ require("head.inc"); <div style="background:#eeeeee;" id="fileOutput"> <script type="text/javascript"> //<![CDATA[ - window.onload=function(){ + window.onload=function() { document.getElementById("fileContent").wrap='off'; } //]]> @@ -173,8 +173,7 @@ require("head.inc"); var fileContent = window.atob(values.join("|")); jQuery("#fileContent").val(fileContent); - } - else { + } else { jQuery("#fileStatus").html(values[0]); jQuery("#fileContent").val(""); } @@ -296,12 +295,10 @@ var Base64 = { if (c < 128) { utftext += String.fromCharCode(c); - } - else if((c > 127) && (c < 2048)) { + } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); - } - else { + } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); @@ -318,20 +315,18 @@ var Base64 = { var i = 0; var c = c1 = c2 = 0; - while ( i < utftext.length ) { + while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; - } - else if((c > 191) && (c < 224)) { + } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; - } - else { + } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php index 3205da3..a36053c 100644 --- a/src/usr/local/www/exec.php +++ b/src/usr/local/www/exec.php @@ -221,8 +221,9 @@ if (isBlank($_POST['txtRecallBuffer'])) { </script> <?php -if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) +if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) { print('<div class="alert alert-warning" role="alert">'.gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!").'</div>'); +} if (!isBlank($_POST['txtCommand'])):?> <div class="panel panel-success responsive"> @@ -235,8 +236,9 @@ if (!isBlank($_POST['txtCommand'])):?> putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); $output = array(); exec($_POST['txtCommand'] . ' 2>&1', $output); - foreach($output as $line) + foreach ($output as $line) { print(htmlspecialchars($line) . "\r\n"); + } ?> </pre> </div> @@ -272,8 +274,9 @@ if (!isBlank($_POST['txtCommand'])):?> </div> <?php - if ($ulmsg) + if ($ulmsg) { print('<div class="alert alert-success" role="alert">' . $ulmsg .'</div>'); + } ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?=gettext('Upload file')?></h2></div> @@ -314,7 +317,7 @@ if (!isBlank($_POST['txtCommand'])):?> ?> <script type="text/javascript"> //<![CDATA[ - events.push(function(){ + events.push(function() { // Scroll to the bottom of the page to more easily see the results of a PHP exec command $("html, body").animate({ scrollTop: $(document).height() }, 1000); }); @@ -339,5 +342,6 @@ if (!isBlank($_POST['txtCommand'])):?> <?php include("foot.inc"); -if($_POST) +if ($_POST) { conf_mount_ro(); +} diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 4656541..be82985 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -627,13 +627,6 @@ $form->addGlobal(new Form_Input( )); $form->addGlobal(new Form_Input( - 'tab', - null, - 'hidden', - $tab -)); - -$form->addGlobal(new Form_Input( 'origname', null, 'hidden', diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index 8788280..5b4acfc 100644 --- a/src/usr/local/www/firewall_nat_1to1_edit.php +++ b/src/usr/local/www/firewall_nat_1to1_edit.php @@ -460,7 +460,7 @@ $group->add(new Form_Checkbox( 'dstnot', null, 'Not', - $pconfig['srcnot'] + $pconfig['dstnot'] ))->setHelp('Invert the sense of the match.'); $group->add(new Form_Select( diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc index d9d3def..7c9c7d8 100644 --- a/src/usr/local/www/guiconfig.inc +++ b/src/usr/local/www/guiconfig.inc @@ -87,15 +87,6 @@ require_once("functions.inc"); /* Include the autoloader for all the GUI display classes */ require_once("classes/autoload.inc.php"); -/* Set the default interface language */ -if ($config['system']['language'] <> "") { - $g['language'] = $config['system']['language']; -} elseif ($g['language'] == "") { - $g['language'] = 'en_US'; -} - -set_language($g['language']); - /* used by progress bar */ $lastseen = "-1"; diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index db7c26c..cf2bddc 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -138,7 +138,7 @@ function hideLabel(text, hide) { element.parent('div').removeClass('hidden'); } -// Toggle table row chackboxes and background colors on the pages that use sortable tables: +// Toggle table row checkboxes and background colors on the pages that use sortable tables: // /usr/local/www/firewall_nat.php // /usr/local/www/firewall_nat_1to1.php // /usr/local/www/firewall_nat_out.php @@ -214,13 +214,18 @@ function moveHelpText(id) { var helpSpan; if(!$(this).hasClass('pfIpMask') && !$(this).hasClass('btn')) { - - helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone(); + if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) { + helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone(); + } else { + helpSpan = $('#' + fromId).parent('div').find('span:last').clone(); + } if($(helpSpan).hasClass('help-block')) { - if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) + if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) { $('#' + decrStringInt(fromId)).parent('div').after(helpSpan); - else + } + else { $('#' + decrStringInt(fromId)).after(helpSpan); + } } } }); @@ -341,6 +346,21 @@ function add_row() { } }); } + + // Now that we are no longer cloning the event handlers, we need to remove and re-add after a new row + // has been added to the table + $('[id^=delete]').unbind(); + $('[id^=delete]').click(function(event) { + if($('.repeatable').length > 1) { + if((typeof retainhelp) == "undefined") + moveHelpText(event.target.id); + + delete_row(event.target.id); + } + else + alert('You may not delete the last row!'); + }); + } // These are action buttons, not submit buttons diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index 0ebf441..70cddb5 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -599,19 +599,19 @@ $group->add($f2); $section->add($group); $f1 = new Form_Input( - 'prefix_from', + 'prefixrange_from', null, 'text', - $pconfig['prefix_from'] + $pconfig['prefixrange_from'] ); $f1->setHelp('To'); $f2 = new Form_Input( - 'prefix_to', + 'prefixrange_to', null, 'text', - $pconfig['prefix_to'] + $pconfig['prefixrange_to'] ); $f2->setHelp('From'); diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php index dabeb7d..d6b7710 100644 --- a/src/usr/local/www/services_dnsmasq.php +++ b/src/usr/local/www/services_dnsmasq.php @@ -404,6 +404,7 @@ foreach ($a_hosts as $i => $hostent): Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?> </td> <td> + <i class="fa fa-angle-double-right text-info"></i> <?=htmlspecialchars($alias['description'])?> </td> <td> diff --git a/src/usr/local/www/services_dnsmasq_edit.php b/src/usr/local/www/services_dnsmasq_edit.php index 9c3c811..3eedebb 100644 --- a/src/usr/local/www/services_dnsmasq_edit.php +++ b/src/usr/local/www/services_dnsmasq_edit.php @@ -133,47 +133,49 @@ if ($_POST) { /* collect aliases */ $aliases = array(); - foreach ($_POST as $key => $value) { - $entry = ''; - if (!substr_compare('aliashost', $key, 0, 9)) { - $entry = substr($key, 9); - $field = 'host'; - } - elseif (!substr_compare('aliasdomain', $key, 0, 11)) { - $entry = substr($key, 11); - $field = 'domain'; - } - elseif (!substr_compare('aliasdescription', $key, 0, 16)) { - $entry = substr($key, 16); - $field = 'description'; - } - if (ctype_digit($entry)) { - $aliases[$entry][$field] = $value; + + if (!empty($_POST['aliashost0'])) { + foreach ($_POST as $key => $value) { + $entry = ''; + if (!substr_compare('aliashost', $key, 0, 9)) { + $entry = substr($key, 9); + $field = 'host'; + } + elseif (!substr_compare('aliasdomain', $key, 0, 11)) { + $entry = substr($key, 11); + $field = 'domain'; + } + elseif (!substr_compare('aliasdescription', $key, 0, 16)) { + $entry = substr($key, 16); + $field = 'description'; + } + if (ctype_digit($entry)) { + $aliases[$entry][$field] = $value; + } } - } - $pconfig['aliases']['item'] = $aliases; - - /* validate aliases */ - foreach ($aliases as $idx => $alias) { - $aliasreqdfields = array('aliasdomain' . $idx); - $aliasreqdfieldsn = array(gettext("Alias Domain")); - - do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); - if ($alias['host']) { - if (!is_hostname($alias['host'])) { - $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); - } else { - if (!is_unqualified_hostname($alias['host'])) { - $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + $pconfig['aliases']['item'] = $aliases; + + /* validate aliases */ + foreach ($aliases as $idx => $alias) { + $aliasreqdfields = array('aliasdomain' . $idx); + $aliasreqdfieldsn = array(gettext("Alias Domain")); + + do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); + if ($alias['host']) { + if (!is_hostname($alias['host'])) { + $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); + } else { + if (!is_unqualified_hostname($alias['host'])) { + $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + } } } - } - if (($alias['domain'] && !is_domain($alias['domain']))) { - $input_errors[] = gettext("A valid domain must be specified in alias list."); + if (($alias['domain'] && !is_domain($alias['domain']))) { + $input_errors[] = gettext("A valid domain must be specified in alias list."); + } } } - /* check for overlaps */ foreach ($a_hosts as $hostent) { if (isset($id) && ($a_hosts[$id]) && ($a_hosts[$id] === $hostent)) { @@ -284,12 +286,17 @@ $form->add($section); $section = new Form_Section('Additional names for this host'); +if(!$pconfig['aliases']['item']) { + $pconfig['aliases']['item'] = array('host' => ""); +} + if( $pconfig['aliases']['item']) { $counter = 0; $last = count($pconfig['aliases']['item']) - 1; foreach($pconfig['aliases']['item'] as $item) { $group = new Form_Group(null); + $group->addClass('repeatable'); $group->add(new Form_Input( 'aliashost' . $counter, @@ -312,28 +319,22 @@ if( $pconfig['aliases']['item']) { $item['description'] ))->setHelp($counter == $last ? 'Description':null); - $btn = new Form_Button( - 'btn' . $counter, - 'Delete', - 'services_dnsmasq_edit.php?act=delopt' . '&id=' . $counter - ); + $group->add(new Form_Button( + 'deleterow' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-warning'); - $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm'); - $group->add($btn); $section->add($group); $counter++; } } -$btnaddopt = new Form_Button( - 'btnaddopt', - 'Add Host name', - 'services_dnsmasq_edit.php?act=addopt' -); - -$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm'); - -$section->addInput($btnaddopt); +$form->addGlobal(new Form_Button( + 'addrow', + 'Add host name', + null, + 'fa-plus' +))->removeClass('btn-primary')->addClass('btn-success addbtn'); $form->add($section); print($form); diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php index 927600c..0eead55 100644 --- a/src/usr/local/www/services_unbound.php +++ b/src/usr/local/www/services_unbound.php @@ -472,6 +472,7 @@ foreach ($a_hosts as $hostent): Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?> </td> <td> + <i class="fa fa-angle-double-right text-info"></i> <?=htmlspecialchars($alias['description'])?> </td> <td> diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php index 29ebc3c..cab96ed 100644 --- a/src/usr/local/www/services_unbound_host_edit.php +++ b/src/usr/local/www/services_unbound_host_edit.php @@ -106,7 +106,6 @@ if (isset($id) && $a_hosts[$id]) { } if ($_POST) { - unset($input_errors); $pconfig = $_POST; @@ -136,43 +135,45 @@ if ($_POST) { /* collect aliases */ $aliases = array(); - foreach ($_POST as $key => $value) { - $entry = ''; - if (!substr_compare('aliashost', $key, 0, 9)) { - $entry = substr($key, 9); - $field = 'host'; - } elseif (!substr_compare('aliasdomain', $key, 0, 11)) { - $entry = substr($key, 11); - $field = 'domain'; - } elseif (!substr_compare('aliasdescription', $key, 0, 16)) { - $entry = substr($key, 16); - $field = 'description'; - } - if (ctype_digit($entry)) { - $aliases[$entry][$field] = $value; + if (!empty($_POST['aliashost0'])) { + foreach ($_POST as $key => $value) { + $entry = ''; + if (!substr_compare('aliashost', $key, 0, 9)) { + $entry = substr($key, 9); + $field = 'host'; + } elseif (!substr_compare('aliasdomain', $key, 0, 11)) { + $entry = substr($key, 11); + $field = 'domain'; + } elseif (!substr_compare('aliasdescription', $key, 0, 16)) { + $entry = substr($key, 16); + $field = 'description'; + } + if (ctype_digit($entry)) { + $aliases[$entry][$field] = $value; + } } - } - $pconfig['aliases']['item'] = $aliases; + $pconfig['aliases']['item'] = $aliases; - /* validate aliases */ - foreach ($aliases as $idx => $alias) { - $aliasreqdfields = array('aliasdomain' . $idx); - $aliasreqdfieldsn = array(gettext("Alias Domain")); + /* validate aliases */ + foreach ($aliases as $idx => $alias) { + $aliasreqdfields = array('aliasdomain' . $idx); + $aliasreqdfieldsn = array(gettext("Alias Domain")); - do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); + do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); - if ($alias['host']) { - if (!is_hostname($alias['host'])) { - $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); - } else { - if (!is_unqualified_hostname($alias['host'])) { - $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + if ($alias['host']) { + if (!is_hostname($alias['host'])) { + $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); + } else { + if (!is_unqualified_hostname($alias['host'])) { + $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + } } } - } - if (($alias['domain'] && !is_domain($alias['domain']))) { - $input_errors[] = gettext("A valid domain must be specified in alias list."); + if (($alias['domain'] && !is_domain($alias['domain']))) { + $input_errors[] = gettext("A valid domain must be specified in alias list."); + } } } @@ -235,6 +236,9 @@ $pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit Host $shortcut_section = "resolver"; include("head.inc"); +if ($input_errors) + print_input_errors($input_errors); + $form = new Form(); $section = new Form_Section('Host override options'); @@ -282,12 +286,17 @@ $form->add($section); $section = new Form_Section('Additional names for this host'); +if(!$pconfig['aliases']['item']) { + $pconfig['aliases']['item'] = array('host' => ""); +} + if( $pconfig['aliases']['item']) { $counter = 0; $last = count($pconfig['aliases']['item']) - 1; foreach($pconfig['aliases']['item'] as $item) { $group = new Form_Group(null); + $group->addClass('repeatable'); $group->add(new Form_Input( 'aliashost' . $counter, @@ -310,28 +319,22 @@ if( $pconfig['aliases']['item']) { $item['description'] ))->setHelp($counter == $last ? 'Description':null); - $btn = new Form_Button( - 'btn' . $counter, - 'Delete', - 'services_unbound_host_edit.php?act=delopt' . '&id=' . $counter - ); + $group->add(new Form_Button( + 'deleterow' . $counter, + 'Delete' + ))->removeClass('btn-primary')->addClass('btn-warning'); - $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm'); - $group->add($btn); $section->add($group); $counter++; } } -$btnaddopt = new Form_Button( - 'btnaddopt', - 'Add Host name', - 'services_unbound_host_edit.php?act=addopt' -); - -$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm'); - -$section->addInput($btnaddopt); +$form->addGlobal(new Form_Button( + 'addrow', + 'Add host name', + null, + 'fa-plus' +))->removeClass('btn-primary')->addClass('btn-success addbtn'); $form->add($section); print($form); diff --git a/src/usr/local/www/status_logs.php b/src/usr/local/www/status_logs.php index ffd1019..d033a00 100755 --- a/src/usr/local/www/status_logs.php +++ b/src/usr/local/www/status_logs.php @@ -436,33 +436,37 @@ if (!$rawfilter) { </div> <div class="panel-body"> <div class="table-responsive"> - <table class="table table-striped table-hover table-compact"> - <tr> - <th><?=gettext("Time")?></th> - <th><?=gettext("Process")?></th> - <th><?=gettext("PID")?></th> - <th style="width:100%"><?=gettext("Message")?></th> - </tr> + <table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable> + <thead> + <tr> + <th><?=gettext("Time")?></th> + <th><?=gettext("Process")?></th> + <th><?=gettext("PID")?></th> + <th style="width:100%"><?=gettext("Message")?></th> + </tr> + </thead> + <tbody> <?php foreach ($filterlog as $filterent) { ?> - <tr> - <td style="white-space:nowrap;"> - <?=htmlspecialchars($filterent['time'])?> - </td> - <td style="white-space:nowrap;"> - <?=htmlspecialchars($filterent['process'])?> - </td> - <td style="white-space:nowrap;"> - <?=htmlspecialchars($filterent['pid'])?> - </td> - <td style="word-wrap:break-word; word-break:break-all; white-space:normal"> - <?=htmlspecialchars($filterent['message'])?> - </td> - </tr> + <tr> + <td style="white-space:nowrap;"> + <?=htmlspecialchars($filterent['time'])?> + </td> + <td style="white-space:nowrap;"> + <?=htmlspecialchars($filterent['process'])?> + </td> + <td style="white-space:nowrap;"> + <?=htmlspecialchars($filterent['pid'])?> + </td> + <td style="word-wrap:break-word; word-break:break-all; white-space:normal"> + <?=htmlspecialchars($filterent['message'])?> + </td> + </tr> <?php } // e-o-foreach ?> + </tbody> </table> <?php if (count($filterlog) == 0) @@ -542,7 +546,7 @@ $group->add(new Form_Checkbox( 'Forward', ($pconfig['cronorder'] == 'forward') ? true : false, 'forward' -))->displayAsRadio(); +))->displayAsRadio()->setHelp('(newest at bottom)'); $group->add(new Form_Checkbox( 'cronorder', @@ -550,7 +554,7 @@ $group->add(new Form_Checkbox( 'Reverse', ($pconfig['cronorder'] == 'reverse') ? true : false, 'reverse' -))->displayAsRadio(); +))->displayAsRadio()->setHelp('(newest at top)'); $group->add(new Form_Checkbox( 'cronorder', @@ -560,7 +564,7 @@ $group->add(new Form_Checkbox( '' ))->displayAsRadio(); -$group->setHelp('Show log entries in forward (newest at bottom) or reverse (newest at top) order.'); +$group->setHelp('Show log entries in forward or reverse order.'); $section->add($group); $group = new Form_Group('GUI Log Entries'); diff --git a/src/usr/local/www/status_queues.php b/src/usr/local/www/status_queues.php index 57ddccd..d4e5477 100644 --- a/src/usr/local/www/status_queues.php +++ b/src/usr/local/www/status_queues.php @@ -150,7 +150,6 @@ $pgtitle = array(gettext("Status"), gettext("Traffic shaper"), gettext("Queues") $shortcut_section = "trafficshaper"; include("head.inc"); ?> -<body> <script src="/jquery/jquery-1.11.2.min.js"></script> <?php if (!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < 1) { @@ -222,7 +221,7 @@ else: ?> ?> </div> </div> -</br> +<br/> <?php @@ -266,38 +265,36 @@ function processQueues($altqstats, $level, $parent_name) { } } if ($prev_if != $q['interface']) { - echo "<tr><td><b>Interface ". htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>"; + echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n"; $prev_if = $q['interface']; } ?> <tr class="<?php echo $parent_name?>"> - <td bgcolor="#<?php echo $row_background?>" style="padding-left: <?php echo $level * 20?>px;"> - <font color="#000000"> - <? - if (is_array($q['queue'])) { - echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> "; - } - if (strstr($q['name'], "root_")) { - echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>"; - } else { - echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>"; - } - ?> - </font> + <td style="background-color:#<?php echo $row_background?>;padding-left:<?php echo $level * 20?>px;"> + <?php + if (is_array($q['queue'])) { + echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>"; + } + if (strstr($q['name'], "root_")) { + echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$if_name}&action=show\">Root queue</a>"; + } else { + echo "<a href=\"firewall_shaper.php?interface={$if_name}&queue={$q['name']}&action=show\">" . htmlspecialchars($q['name']) . "</a>"; + } + ?> </td> <?php $cpuUsage = 0; - echo "<td bgcolor=\"#{$row_background}\">"; - echo "<div class='progress' style='height: 7px;width: 170px;'> - <div class='progress-bar' role='progressbar' name='queue{$q['name']}{$q['interface']}width' id='queue{$q['name']}{$q['interface']}width' aria-valuenow='70' aria-valuemin='0' aria-valuemax='100' style='width: ". ($cpuUsage*100) ."%;'></div> + echo "<td style=\"background-color:#{$row_background}\" >"; + echo "<div class=\"progress\" style=\"height: 7px;width: 170px;\"> + <div class=\"progress-bar\" role=\"progressbar\" id=\"queue{$q['name']}{$q['interface']}width\" aria-valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: " . ($cpuUsage*100) . "%;\"></div> </div>"; - echo " </td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>"; - echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>"; + echo "</td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}pps\" id=\"queue{$q['name']}{$q['interface']}pps\" value=\"(" . gettext("Loading") . ")\" /></td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:80px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}bps\" id=\"queue{$q['name']}{$q['interface']}bps\" value=\"\" /></td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}borrows\" id=\"queue{$q['name']}{$q['interface']}borrows\" value=\"\" /></td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}suspends\" id=\"queue{$q['name']}{$q['interface']}suspends\" value=\"\" /></td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}drops\" id=\"queue{$q['name']}{$q['interface']}drops\" value=\"\" /></td>"; + echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}length\" id=\"queue{$q['name']}{$q['interface']}length\" value=\"\" /></td>"; ?> </tr> <?php diff --git a/src/usr/local/www/tree/tree.css b/src/usr/local/www/tree/tree.css index 31b7979..f3ed323 100755 --- a/src/usr/local/www/tree/tree.css +++ b/src/usr/local/www/tree/tree.css @@ -127,7 +127,7 @@ ul.tree div a { } ul.tree li A:link, ul.tree li A:hover, ul.tree li A:visited { - color : #111111; + color : #ffffff; } diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index 0836716..cd86719 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -188,7 +188,7 @@ if ($_POST) { ?> <table id="gwtbl" class="table table-striped table-hover"> - <tr><td><?=gettext("Retrieving gateway data")?></td></tr> + <tr><td><?=gettext("Retrieving gateways data")?> <i class="fa fa-cog fa-spin"></i></td></tr> </table> <!-- close the body we're wrapped in and add a configuration-panel --> diff --git a/src/usr/local/www/widgets/widgets/services_status.widget.php b/src/usr/local/www/widgets/widgets/services_status.widget.php index 8cd5dad..170ea24 100644 --- a/src/usr/local/www/widgets/widgets/services_status.widget.php +++ b/src/usr/local/www/widgets/widgets/services_status.widget.php @@ -108,7 +108,7 @@ if (count($services) > 0) { $service_desc = explode(".",$service['description']); ?> <tr> - <td><i class="fa fa-<?=get_service_status($service)? 'check' : 'times'?>-circle"></i></td> + <td><i class="fa fa-<?=get_service_status($service) ? 'check-circle text-success' : 'times-circle text-warning'?>"></i></td> <td><?=$service['name']?></td> <td><?=$service_desc[0]?></td> <td><?=get_service_control_GET_links($service)?></td> @@ -164,4 +164,4 @@ events.push(function(){ }); }); //]]> -</script>
\ No newline at end of file +</script> |