diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-04-27 08:55:48 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-04-27 08:55:48 -0300 |
commit | 701833bb9306089fa28bcc03b443cb9a5e3c3e11 (patch) | |
tree | b6eba40f1472978f56c16e3e2372b118bc7da88a /usr/local | |
parent | daac712a3cab2c67c09baed3fa3b518ea2aad263 (diff) | |
parent | 962f215d1fa05724f782e25490210fc0d1527155 (diff) | |
download | pfsense-701833bb9306089fa28bcc03b443cb9a5e3c3e11.zip pfsense-701833bb9306089fa28bcc03b443cb9a5e3c3e11.tar.gz |
Merge pull request #1622 from phil-davis/usr-local-www
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/bandwidth_by_ip.php | 39 | ||||
-rw-r--r-- | usr/local/www/carp_status.php | 139 | ||||
-rw-r--r-- | usr/local/www/crash_reporter.php | 19 | ||||
-rw-r--r-- | usr/local/www/easyrule.php | 5 | ||||
-rwxr-xr-x | usr/local/www/fbegin.inc | 123 | ||||
-rwxr-xr-x | usr/local/www/fend.inc | 6 | ||||
-rw-r--r-- | usr/local/www/getserviceproviders.php | 91 | ||||
-rw-r--r-- | usr/local/www/getstats.php | 50 | ||||
-rwxr-xr-x | usr/local/www/gui.css | 16 | ||||
-rw-r--r-- | usr/local/www/guiconfig.inc | 507 | ||||
-rwxr-xr-x | usr/local/www/head.inc | 148 | ||||
-rw-r--r-- | usr/local/www/headjs.php | 319 | ||||
-rw-r--r-- | usr/local/www/ifstats.php | 3 | ||||
-rw-r--r-- | usr/local/www/license.php | 222 | ||||
-rw-r--r-- | usr/local/www/shortcuts.inc | 66 | ||||
-rw-r--r-- | usr/local/www/stats.php | 8 | ||||
-rwxr-xr-x | usr/local/www/status.php | 15 | ||||
-rwxr-xr-x | usr/local/www/xmlrpc.php | 154 |
18 files changed, 1028 insertions, 902 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php index 74697e6..c9e8e93 100755 --- a/usr/local/www/bandwidth_by_ip.php +++ b/usr/local/www/bandwidth_by_ip.php @@ -1,5 +1,5 @@ <?php -/* +/* * To change this template, choose Tools | Templates * and open the template in the editor. * @@ -33,8 +33,9 @@ $intsubnet = gen_subnet($intip, $netmask) . "/$netmask"; // see if they want local, remote or all IPs returned $filter = $_GET['filter']; -if ($filter == "") +if ($filter == "") { $filter = "local"; +} if ($filter == "local") { $ratesubnet = "-c " . $intsubnet; @@ -47,18 +48,19 @@ if ($filter == "local") { //get the sort method $sort = $_GET['sort']; -if ($sort == "out") - {$sort_method = "-T";} -else - {$sort_method = "-R";} +if ($sort == "out") { + $sort_method = "-T"; +} else { + $sort_method = "-R"; +} // get the desired format for displaying the host name or IP $hostipformat = $_GET['hostipformat']; $iplookup = array(); // If hostname display is requested and the DNS forwarder does not already have DHCP static names registered, // then load the DHCP static mappings into an array keyed by IP address. -if (($hostipformat != "") && ((!isset($config['dnsmasq']['enable']) || !isset($config['dnsmasq']['regdhcpstatic'])) - || (!isset($config['unbound']['enable']) || !isset($config['unbound']['regdhcpstatic'])))) { +if (($hostipformat != "") && ((!isset($config['dnsmasq']['enable']) || !isset($config['dnsmasq']['regdhcpstatic'])) || + (!isset($config['unbound']['enable']) || !isset($config['unbound']['regdhcpstatic'])))) { if (is_array($config['dhcpd'])) { foreach ($config['dhcpd'] as $ifdata) { if (is_array($ifdata['staticmap'])) { @@ -75,14 +77,14 @@ if (($hostipformat != "") && ((!isset($config['dnsmasq']['enable']) || !isset($c $_grb = exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 {$sort_method} {$ratesubnet} | tr \"|\" \" \" | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $4, $6, $8 }'", $listedIPs); $someinfo = false; -for ($x=2; $x<12; $x++){ +for ($x=2; $x<12; $x++) { - $bandwidthinfo = $listedIPs[$x]; + $bandwidthinfo = $listedIPs[$x]; - // echo $bandwidthinfo; - $emptyinfocounter = 1; - if ($bandwidthinfo != "") { - $infoarray = explode (":",$bandwidthinfo); + // echo $bandwidthinfo; + $emptyinfocounter = 1; + if ($bandwidthinfo != "") { + $infoarray = explode (":",$bandwidthinfo); if (($filter == "all") || (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { @@ -93,8 +95,9 @@ for ($x=2; $x<12; $x++){ $addrdata = gethostbyaddr($infoarray[0]); if ($addrdata == $infoarray[0]) { // gethostbyaddr() gave us back the IP address, so try the static mapping array - if ($iplookup[$infoarray[0]] != "") + if ($iplookup[$infoarray[0]] != "") { $addrdata = $iplookup[$infoarray[0]]; + } } else { if ($hostipformat == "hostname") { // Only pass back the first part of the name, not the FQDN. @@ -115,7 +118,7 @@ unset($bandwidthinfo, $_grb); unset($listedIPs); //no bandwidth usage found -if ($someinfo == false) - echo gettext("no info"); - +if ($someinfo == false) { + echo gettext("no info"); +} ?> diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php index 9524aef..a00d781 100644 --- a/usr/local/www/carp_status.php +++ b/usr/local/www/carp_status.php @@ -1,30 +1,30 @@ <?php /* - carp_status.php - Copyright (C) 2004 Scott Ullrich - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + carp_status.php + Copyright (C) 2004 Scott Ullrich + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ ##|+PRIV @@ -52,38 +52,39 @@ unset($interface_ip_arr_cache); $status = get_carp_status(); $status = intval($status); -if($_POST['carp_maintenancemode'] <> "") { +if ($_POST['carp_maintenancemode'] <> "") { interfaces_carp_set_maintenancemode(!isset($config["virtualip_carp_maintenancemode"])); } -if($_POST['disablecarp'] <> "") { - if($status > 0) { +if ($_POST['disablecarp'] <> "") { + if ($status > 0) { set_single_sysctl('net.inet.carp.allow', '0'); - if(is_array($config['virtualip']['vip'])) { + if (is_array($config['virtualip']['vip'])) { $viparr = &$config['virtualip']['vip']; $found_dhcpdv6 = false; foreach ($viparr as $vip) { $carp_iface = "{$vip['interface']}_vip{$vip['vhid']}"; switch ($vip['mode']) { - case "carp": - interface_vip_bring_down($vip); - interface_ipalias_cleanup($carp_iface); - - /* - * Reconfigure radvd when necessary - * XXX: Is it the best way to do it? - */ - if (isset($config['dhcpdv6']) && is_array($config['dhcpdv6'])) { - foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { - if ($dhcpv6ifconf['rainterface'] != $carp_iface) - continue; - - services_radvd_configure(); - break; + case "carp": + interface_vip_bring_down($vip); + interface_ipalias_cleanup($carp_iface); + + /* + * Reconfigure radvd when necessary + * XXX: Is it the best way to do it? + */ + if (isset($config['dhcpdv6']) && is_array($config['dhcpdv6'])) { + foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { + if ($dhcpv6ifconf['rainterface'] != $carp_iface) { + continue; + } + + services_radvd_configure(); + break; + } } - } - sleep(1); - break; + sleep(1); + break; } } } @@ -91,18 +92,19 @@ if($_POST['disablecarp'] <> "") { $status = 0; } else { $savemsg = gettext("CARP has been enabled."); - if(is_array($config['virtualip']['vip'])) { + if (is_array($config['virtualip']['vip'])) { $viparr = &$config['virtualip']['vip']; foreach ($viparr as $vip) { switch ($vip['mode']) { - case "carp": - interface_carp_configure($vip); - sleep(1); - break; - case 'ipalias': - if (strpos($vip['interface'], '_vip')) - interface_ipalias_configure($vip); - break; + case "carp": + interface_carp_configure($vip); + sleep(1); + break; + case 'ipalias': + if (strpos($vip['interface'], '_vip')) { + interface_ipalias_configure($vip); + } + break; } } } @@ -153,23 +155,23 @@ include("head.inc"); <td> <?php $carpcount = 0; - if(is_array($config['virtualip']['vip'])) { - foreach($config['virtualip']['vip'] as $carp) { + if (is_array($config['virtualip']['vip'])) { + foreach ($config['virtualip']['vip'] as $carp) { if ($carp['mode'] == "carp") { $carpcount++; break; } } } - if($carpcount > 0) { - if($status > 0) { + if ($carpcount > 0) { + if ($status > 0) { $carp_enabled = true; echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Temporarily Disable CARP") . "\" />"; } else { $carp_enabled = false; echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />"; } - if(isset($config["virtualip_carp_maintenancemode"])) { + if (isset($config["virtualip_carp_maintenancemode"])) { echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Leave Persistent CARP Maintenance Mode") . "\" />"; } else { echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Enter Persistent CARP Maintenance Mode") . "\" />"; @@ -193,24 +195,25 @@ include("head.inc"); echo "</body></html>"; return; } - if(is_array($config['virtualip']['vip'])) { - foreach($config['virtualip']['vip'] as $carp) { - if ($carp['mode'] != "carp") + if (is_array($config['virtualip']['vip'])) { + foreach ($config['virtualip']['vip'] as $carp) { + if ($carp['mode'] != "carp") { continue; + } $ipaddress = $carp['subnet']; $vhid = $carp['vhid']; $status = get_carp_interface_status("_vip{$carp['uniqid']}"); echo "<tr>"; $align = "style=\"vertical-align:middle\""; - if($carp_enabled == false) { + if ($carp_enabled == false) { $icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_block.gif\" alt=\"disabled\" />"; $status = "DISABLED"; } else { - if($status == "MASTER") { + if ($status == "MASTER") { $icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_pass.gif\" alt=\"master\" />"; - } else if($status == "BACKUP") { + } else if ($status == "BACKUP") { $icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_pass_d.gif\" alt=\"backup\" />"; - } else if($status == "INIT") { + } else if ($status == "INIT") { $icon = "<img {$align} src=\"/themes/".$g['theme']."/images/icons/icon_log.gif\" alt=\"init\" />"; } else { $icon = ""; diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index fa18621..fe4c7ca 100644 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -49,7 +49,7 @@ function upload_crash_report($files) { global $g; $post = array(); $counter = 0; - foreach($files as $file) { + foreach ($files as $file) { $post["file{$counter}"] = "@{$file}"; $counter++; } @@ -98,10 +98,11 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); <?php if (gettext($_POST['Submit']) == "Yes") { echo gettext("Processing..."); - if (!is_dir("/var/crash")) + if (!is_dir("/var/crash")) { mkdir("/var/crash", 0750, true); + } @file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header); - if(file_exists("/tmp/PHP_errors.log")) { + if (file_exists("/tmp/PHP_errors.log")) { copy("/tmp/PHP_errors.log", "/var/crash/PHP_errors.log"); } exec("find /var/crash -type l -exec rm {} +"); @@ -111,7 +112,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); echo gettext("Uploading..."); ob_flush(); flush(); - if(is_array($files_to_upload)) { + if (is_array($files_to_upload)) { $resp = upload_crash_report($files_to_upload); array_map('unlink', glob("/var/crash/*")); // Erase the contents of the PHP error log @@ -122,7 +123,7 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); } else { echo "Could not find any crash files."; } - } else if(gettext($_POST['Submit']) == "No") { + } else if (gettext($_POST['Submit']) == "No") { array_map('unlink', glob("/var/crash/*")); // Erase the contents of the PHP error log fclose(fopen("/tmp/PHP_errors.log", 'w')); @@ -135,14 +136,14 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); $crash_reports .= "\nPHP Errors:\n"; $crash_reports .= implode("\n", $php_errors) . "\n\n"; } - if(is_array($crash_files)) { - foreach($crash_files as $cf) { - if(filesize($cf) < FILE_SIZE) { + if (is_array($crash_files)) { + foreach ($crash_files as $cf) { + if (filesize($cf) < FILE_SIZE) { $crash_reports .= "\nFilename: {$cf}\n"; $crash_reports .= file_get_contents($cf); } } - } else { + } else { echo "Could not locate any crash data."; } output_crash_reporter_html($crash_reports); diff --git a/usr/local/www/easyrule.php b/usr/local/www/easyrule.php index 8b70b42..74b1051 100644 --- a/usr/local/www/easyrule.php +++ b/usr/local/www/easyrule.php @@ -61,8 +61,9 @@ if ($_GET && isset($_GET['action'])) { } } -if(stristr($retval, "error") == true) - $message = $retval; +if (stristr($retval, "error") == true) { + $message = $retval; +} include("head.inc"); ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 6416394..47be7e0 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -28,8 +28,7 @@ if (empty($pagename)) { $pagename = "index.php"; } -/* If the filename is pkg_edit.php or wizard.php, reparse looking - for the .xml filename */ +/* If the filename is pkg_edit.php or wizard.php, reparse looking for the .xml filename */ if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) { $param_split = explode('&', $uri_split[2]); foreach ($param_split as $param) { @@ -47,14 +46,16 @@ function return_ext_menu($section) { global $config; $htmltext = ""; $extarray = array(); - if($config['installedpackages']['menu'] <> "") { - foreach($config['installedpackages']['menu'] as $menuitem) { - if($menuitem['section'] != $section) continue; - if($menuitem['url'] <> "") { + if ($config['installedpackages']['menu'] <> "") { + foreach ($config['installedpackages']['menu'] as $menuitem) { + if ($menuitem['section'] != $section) { + continue; + } + if ($menuitem['url'] <> "") { $test_url=$menuitem['url']; $addresswithport = getenv("HTTP_HOST"); $colonpos = strpos($addresswithport, ":"); - if ($colonpos !== False){ + if ($colonpos !== False) { //my url is actually just the IP address of the pfsense box $myurl = substr($addresswithport, 0, $colonpos); } else { @@ -65,9 +66,9 @@ function return_ext_menu($section) { $description = '/pkg.php?xml=' . $menuitem['configfile']; $test_url=$description; } - if(isAllowedPage($test_url)){ + if (isAllowedPage($test_url)) { $extarray[] = array($menuitem['name'], $description); - } + } } } return $extarray; @@ -75,7 +76,7 @@ function return_ext_menu($section) { function output_menu($arrayitem, $target = null) { foreach ($arrayitem as $item) { - if (isAllowedPage($item[1]) || $item[1]=="/index.php?logout"){ + if (isAllowedPage($item[1]) || $item[1]=="/index.php?logout") { $attr = sprintf("href=\"%s\"", htmlentities($item[1])); if ($target) { $attr .= sprintf(" target=\"%s\"", htmlentities($target)); @@ -102,25 +103,30 @@ $system_menu[] = array(gettext("Firmware"), "/system_firmware.php"); $system_menu[] = array(gettext("General Setup"), "/system.php"); $system_menu[] = array(gettext("High Avail. Sync"), "/system_hasync.php"); $system_menu[] = array(gettext("Logout"), "/index.php?logout"); -if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") +if ($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { $system_menu[] = array(gettext("Packages"), "/pkg_mgr_installed.php"); +} $system_menu[] = array(gettext("Setup Wizard"), "/wizard.php?xml=setup_wizard.xml"); $system_menu[] = array(gettext("Routing"), "/system_gateways.php"); $system_menu[] = array(gettext("Cert Manager"), "/system_camanager.php"); -if (!isAllowedPage("system_usermanager.php*")) +if (!isAllowedPage("system_usermanager.php*")) { $system_menu[] = array(gettext("User Manager"), "/system_usermanager_passwordmg.php"); -else +} else { $system_menu[] = array(gettext("User Manager"), "/system_usermanager.php"); +} $system_menu = msort(array_merge($system_menu, return_ext_menu("System")),0); // Interfaces $interfaces_menu = array(); -if (!isset($config['system']['webgui']['noassigninterfaces'])) +if (!isset($config['system']['webgui']['noassigninterfaces'])) { $interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php"); +} $opts = get_configured_interface_with_descr(false, true); -foreach ($opts as $oif => $odescr) - if (!isset($config['interfaces'][$oif]['ovpn'])) +foreach ($opts as $oif => $odescr) { + if (!isset($config['interfaces'][$oif]['ovpn'])) { $interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}"); + } +} $interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")),0); // Firewall @@ -140,7 +146,7 @@ $services_menu[] = array(gettext("DNS Forwarder"), "/services_dnsmasq.php"); $services_menu[] = array(gettext("DNS Resolver"), "/services_unbound.php"); $services_menu[] = array(gettext("DHCP Relay"), "/services_dhcp_relay.php"); $services_menu[] = array(gettext("DHCPv6 Relay"), "/services_dhcpv6_relay.php"); -if($g['services_dhcp_server_enable']) { +if ($g['services_dhcp_server_enable']) { $services_menu[] = array(gettext("DHCP Server"), "/services_dhcp.php"); $services_menu[] = array(gettext("DHCPv6 Server/RA"), "/services_dhcpv6.php"); } @@ -150,7 +156,7 @@ $services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php"); $services_menu[] = array(gettext("NTP"), "/services_ntpd.php"); $services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php"); $services_menu[] = array(gettext("SNMP"), "/services_snmp.php"); -if(count($config['interfaces']) > 1) { +if (count($config['interfaces']) > 1) { /* no use for UPnP in single-interface deployments remove to reduce user confusion */ @@ -169,8 +175,9 @@ $vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")),0); // Status $status_menu = array(); -if (count($config['captiveportal']) > 0) +if (count($config['captiveportal']) > 0) { $status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php"); +} $status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php"); $status_menu[] = array(gettext("Dashboard"), "/index.php"); $status_menu[] = array(gettext("Gateways"), "/status_gateways.php"); @@ -182,23 +189,27 @@ $status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php"); $status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php"); $status_menu[] = array(gettext("NTP"), "/status_ntpd.php"); $status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php"); -if ($g['platform'] == "pfSense") +if ($g['platform'] == "pfSense") { $status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php"); +} $status_menu[] = array(gettext("Queues"), "/status_queues.php"); $status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php"); $status_menu[] = array(gettext("Services"), "/status_services.php"); $status_menu[] = array(gettext("System Logs"), "/diag_logs.php"); $status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan"); -if(count($config['interfaces']) > 1) +if (count($config['interfaces']) > 1) { $status_menu[] = array(gettext("UPnP & NAT-PMP"), "/status_upnp.php"); +} $ifentries = get_configured_interface_with_descr(); foreach ($ifentries as $ent => $entdesc) { if (is_array($config['interfaces'][$ent]['wireless']) && - preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) + preg_match($g['wireless_regex'], $config['interfaces'][$ent]['if'])) { $wifdescrs[$ent] = $entdesc; + } } -if (count($wifdescrs) > 0) +if (count($wifdescrs) > 0) { $status_menu[] = array(gettext("Wireless"), "/status_wireless.php"); +} $status_menu = msort(array_merge($status_menu, return_ext_menu("Status")),0); // Diagnostics @@ -211,9 +222,9 @@ $diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php"); $diagnostics_menu[] = array(gettext("Edit File"), "/edit.php"); $diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php"); -if(file_exists("/var/run/gmirror_active")) +if (file_exists("/var/run/gmirror_active")) { $diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php" ); - +} $diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" ); $diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" ); $diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" ); @@ -232,12 +243,12 @@ $diagnostics_menu[] = array(gettext("States Summary"), "/diag_states_summary.php $diagnostics_menu[] = array(gettext("System Activity"), "/diag_system_activity.php"); $diagnostics_menu[] = array(gettext("Traceroute"), "/diag_traceroute.php"); $diagnostics_menu[] = array(gettext("Packet Capture"), "/diag_packet_capture.php"); -if($g['platform'] == "nanobsd") +if ($g['platform'] == "nanobsd") { $diagnostics_menu[] = array(gettext("NanoBSD"), "/diag_nanobsd.php"); +} if (isset($config['system']['developer'])) { $diagnostics_menu[] = array(gettext("Restart HTTPD"), "/restart_httpd.php", "style" => "font-weight: bold; color: yellow;"); - } $diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagnostics")),0); @@ -245,11 +256,12 @@ $gold_menu = array(); $gold_menu[] = array(gettext("pfSense Gold"), "https://www.pfsense.org/gold"); $gold_menu = msort(array_merge($gold_menu, return_ext_menu("Gold")),0); -if(! $g['disablehelpmenu']) { +if (!$g['disablehelpmenu']) { $help_menu = array(); $help_menu[] = array(gettext("About this Page"), $helpurl); - if($g['product_name'] == "pfSense") - $help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine"); + if ($g['product_name'] == "pfSense") { + $help_menu[] = array(gettext("Bug Database"), "https://www.pfsense.org/j.php?jumpto=redmine"); + } $help_menu[] = array(gettext("User Forum"), "https://www.pfsense.org/j.php?jumpto=forum"); $help_menu[] = array(gettext("Documentation"), "https://www.pfsense.org/j.php?jumpto=doc"); $help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki"); @@ -272,7 +284,7 @@ if(! $g['disablehelpmenu']) { <?php echo get_menu_messages(); ?> - </div> + </div> </div> </div> </div> <!-- Header DIV --> @@ -344,7 +356,7 @@ if(! $g['disablehelpmenu']) { ?> </ul> </li> - <?php if(! $g['disablehelpmenu']): ?> + <?php if (!$g['disablehelpmenu']): ?> <li class="lastdrop"> <div><?php echo gettext("Help"); ?></div> <ul id="help" class="subdrop"> @@ -366,31 +378,32 @@ echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/domLib.js\"></s echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/domTT.js\"></script>\n"; echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/behaviour.js\"></script>\n"; echo "\t<script type=\"text/javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>\n"; - /* display a top alert bar if need be */ - $need_alert_display = false; - $found_notices = are_notices_pending(); - if($found_notices == true) { - $notices = get_notices(); - if(!$notices) { - $need_alert_display = true; - $display_text = print_notices($notices) . "<br />"; - } - } - if($need_alert_display == true) { - echo "<div style=\"background-color:#000000\" id=\"roundalert\">"; - echo "<table summary=\"round alert\">"; - echo "<tr><td><font color=\"#ffffff\">"; - echo " <img align=\"middle\" src=\"/top_notification.gif\" alt=\"notification\" /> "; - echo $display_text; - echo "</font></td>"; - echo "</tr>"; - echo "</table>"; - echo "</div>"; +/* display a top alert bar if need be */ +$need_alert_display = false; +$found_notices = are_notices_pending(); +if ($found_notices == true) { + $notices = get_notices(); + if (!$notices) { + $need_alert_display = true; + $display_text = print_notices($notices) . "<br />"; } +} +if ($need_alert_display == true) { + echo "<div style=\"background-color:#000000\" id=\"roundalert\">"; + echo "<table summary=\"round alert\">"; + echo "<tr><td><font color=\"#ffffff\">"; + echo " <img align=\"middle\" src=\"/top_notification.gif\" alt=\"notification\" /> "; + echo $display_text; + echo "</font></td>"; + echo "</tr>"; + echo "</table>"; + echo "</div>"; +} function add_to_menu($url, $name) { - if (isAllowedPage($url)) + if (isAllowedPage($url)) { echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n"; + } } ?> @@ -423,7 +436,7 @@ echo get_shortcut_status_link($shortcut_section, true); echo get_shortcut_log_link($shortcut_section, true); ?> -<?php if(! $g['disablehelpicon']): ?> +<?php if (!$g['disablehelpicon']): ?> <a href="<?php echo $helpurl; ?>" title="<?php echo gettext("Help for items on this page"); ?>"><img style="vertical-align:middle" src="/themes/<?php echo $g['theme']; ?>/images/icons/icon_help.gif" border="0" alt="help" /></a> <?php endif; ?> @@ -442,5 +455,5 @@ if (is_subsystem_dirty('packagelock') || (file_exists('/conf/needs_package_sync' } print_info_box($info_text . "<p><img src='/themes/{$g['theme']}/images/icons/icon_fw-update.gif' alt='firmware update' />"); } - $pgtitle_output = true; +$pgtitle_output = true; ?> diff --git a/usr/local/www/fend.inc b/usr/local/www/fend.inc index 6ee1028..f1cbdb9 100755 --- a/usr/local/www/fend.inc +++ b/usr/local/www/fend.inc @@ -3,13 +3,13 @@ --> </div> <!-- Right DIV --> - + </div> <!-- Content DIV --> - + <div id="footer"> <a target="_blank" href="<?=$g['product_website_footer']?>" class="redlnk"><?=$g['product_name']?></a> is © <?=$g['product_copyright_years']?> by <a href="<?=$g['product_copyright_url']?>" class="tblnk"><?=$g['product_copyright']?></a>. All Rights Reserved. - [<a href="/license.php" class="tblnk">view license</a>] + [<a href="/license.php" class="tblnk">view license</a>] </div> <!-- Footer DIV --> </div> <!-- Wrapper Div --> diff --git a/usr/local/www/getserviceproviders.php b/usr/local/www/getserviceproviders.php index b34e046..40365e6 100644 --- a/usr/local/www/getserviceproviders.php +++ b/usr/local/www/getserviceproviders.php @@ -1,30 +1,30 @@ <?php /* - getserviceproviders.php - Copyright (C) 2010 Vinicius Coque <vinicius.coque@bluepex.com> - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - All rights reserved. + getserviceproviders.php + Copyright (C) 2010 Vinicius Coque <vinicius.coque@bluepex.com> + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: ajax @@ -47,8 +47,8 @@ $serviceproviders = &$serviceproviders_attr['serviceproviders']['country']; function get_country_providers($country) { global $serviceproviders; - foreach($serviceproviders as $sp) { - if($sp['attr']['code'] == strtolower($country)) { + foreach ($serviceproviders as $sp) { + if ($sp['attr']['code'] == strtolower($country)) { return is_array($sp['provider'][0]) ? $sp['provider'] : array($sp['provider']); } } @@ -58,9 +58,9 @@ function get_country_providers($country) { function country_list() { global $serviceproviders; $country_list = get_country_name("ALL"); - foreach($serviceproviders as $sp) { - foreach($country_list as $country) { - if(strtoupper($sp['attr']['code']) == $country['code']) { + foreach ($serviceproviders as $sp) { + foreach ($country_list as $country) { + if (strtoupper($sp['attr']['code']) == $country['code']) { echo $country['name'] . ":" . $country['code'] . "\n"; } } @@ -69,7 +69,7 @@ function country_list() { function providers_list($country) { $serviceproviders = get_country_providers($country); - foreach($serviceproviders as $sp) { + foreach ($serviceproviders as $sp) { echo $sp['name']['value'] . "\n"; } } @@ -79,29 +79,29 @@ function provider_plan_data($country,$provider,$connection) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<connection>\n"; $serviceproviders = get_country_providers($country); - foreach($serviceproviders as $sp) { - if(strtolower($sp['name']['value']) == strtolower($provider)) { - if(strtoupper($connection) == "CDMA") { + foreach ($serviceproviders as $sp) { + if (strtolower($sp['name']['value']) == strtolower($provider)) { + if (strtoupper($connection) == "CDMA") { $conndata = $sp['cdma']; } else { - if(!is_array($sp['gsm']['apn'][0])) { + if (!is_array($sp['gsm']['apn'][0])) { $conndata = $sp['gsm']['apn']; } else { - foreach($sp['gsm']['apn'] as $apn) { - if($apn['attr']['value'] == $connection) { + foreach ($sp['gsm']['apn'] as $apn) { + if ($apn['attr']['value'] == $connection) { $conndata = $apn; break; } } } } - if(is_array($conndata)) { + if (is_array($conndata)) { echo "<apn>" . $connection . "</apn>\n"; echo "<username>" . $conndata['username']['value'] . "</username>\n"; echo "<password>" . $conndata['password']['value'] . "</password>\n"; $dns_arr = is_array($conndata['dns'][0]) ? $conndata['dns'] : array( $conndata['dns'] ); - foreach($dns_arr as $dns) { + foreach ($dns_arr as $dns) { echo '<dns>' . $dns['value'] . "</dns>\n"; } } @@ -113,20 +113,20 @@ function provider_plan_data($country,$provider,$connection) { function provider_plans_list($country,$provider) { $serviceproviders = get_country_providers($country); - foreach($serviceproviders as $sp) { - if(strtolower($sp['name']['value']) == strtolower($provider)) { - if(array_key_exists('gsm',$sp)) { - if(array_key_exists('attr',$sp['gsm']['apn'])) { + foreach ($serviceproviders as $sp) { + if (strtolower($sp['name']['value']) == strtolower($provider)) { + if (array_key_exists('gsm',$sp)) { + if (array_key_exists('attr',$sp['gsm']['apn'])) { $name = ($sp['gsm']['apn']['name'] ? $sp['gsm']['apn']['name'] : $sp['name']['value']); echo $name . ":" . $sp['gsm']['apn']['attr']['value']; } else { - foreach($sp['gsm']['apn'] as $apn_info) { + foreach ($sp['gsm']['apn'] as $apn_info) { $name = ($apn_info['name']['value'] ? $apn_info['name']['value'] : $apn_info['gsm']['apn']['name']); echo $name . ":" . $apn_info['attr']['value'] . "\n"; } } } - if(array_key_exists('cdma',$sp)) { + if (array_key_exists('cdma',$sp)) { $name = $sp['cdma']['name']['value'] ? $sp['cdma']['name']['value']:$sp['name']['value']; echo $name . ":" . "CDMA"; } @@ -136,13 +136,14 @@ function provider_plans_list($country,$provider) { $_GET_OR_POST = ($_SERVER['REQUEST_METHOD'] === 'POST') ? $_POST : $_GET; -if(isset($_GET_OR_POST['country']) && !isset($_GET_OR_POST['provider'])) { +if (isset($_GET_OR_POST['country']) && !isset($_GET_OR_POST['provider'])) { providers_list($_GET_OR_POST['country']); -} elseif(isset($_GET_OR_POST['country']) && isset($_GET_OR_POST['provider'])) { - if(isset($_GET_OR_POST['plan'])) +} elseif (isset($_GET_OR_POST['country']) && isset($_GET_OR_POST['provider'])) { + if (isset($_GET_OR_POST['plan'])) { provider_plan_data($_GET_OR_POST['country'],$_GET_OR_POST['provider'],$_GET_OR_POST['plan']); - else + } else { provider_plans_list($_GET_OR_POST['country'],$_GET_OR_POST['provider']); + } } else { country_list(); } diff --git a/usr/local/www/getstats.php b/usr/local/www/getstats.php index dcbb8d3..bca6557 100644 --- a/usr/local/www/getstats.php +++ b/usr/local/www/getstats.php @@ -1,30 +1,30 @@ <?php /* - getstats.php - Copyright (C) 2009 Bill Marquette - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + getstats.php + Copyright (C) 2009 Bill Marquette + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: ajax diff --git a/usr/local/www/gui.css b/usr/local/www/gui.css index a4d6453..d93c4d9 100755 --- a/usr/local/www/gui.css +++ b/usr/local/www/gui.css @@ -131,7 +131,7 @@ a { background-color: #FFFFFF; border-right: 1px solid #999999; border-bottom: 1px solid #999999; - border-left: 1px solid #999999; + border-left: 1px solid #999999; font-size: 11px; padding-right: 6px; padding-left: 6px; @@ -176,13 +176,13 @@ a { } .listbggrey { border-right: 1px solid #999999; - border-bottom: 1px solid #999999; - font-size: 11px; - background-color: #999999; - padding-right: 16px; - padding-left: 6px; - padding-top: 4px; - padding-bottom: 4px; + border-bottom: 1px solid #999999; + font-size: 11px; + background-color: #999999; + padding-right: 16px; + padding-left: 6px; + padding-top: 4px; + padding-bottom: 4px; } .listhdr { background-color: #BBBBBB; diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 22ca7ba..804869c 100644 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -34,7 +34,7 @@ /* Include authentication routines */ /* THIS MUST BE ABOVE ALL OTHER CODE */ -if(!$nocsrf) { +if (!$nocsrf) { function csrf_startup() { csrf_conf('rewrite-js', '/csrf/csrf-magic.js'); $timeout_minutes = isset($config['system']['webgui']['session_timeout']) ? $config['system']['webgui']['session_timeout'] : 240; @@ -67,7 +67,7 @@ foreach (scandir("/usr/local/www/classes/") as $file) { $g['theme'] = get_current_theme(); /* Set the default interface language */ -if($config['system']['language'] <> "") { +if ($config['system']['language'] <> "") { $g['language'] = $config['system']['language']; } elseif ($g['language'] == "") { $g['language'] = 'en_US'; @@ -83,7 +83,7 @@ $mandfldhtml = ""; /* display this before mandatory input fields */ $mandfldhtmlspc = ""; /* same as above, but with spacing */ /* Some ajax scripts still need access to GUI */ -if(!$ignorefirmwarelock) { +if (!$ignorefirmwarelock) { if (is_subsystem_dirty('firmwarelock')) { if (!$d_isfwfile) { header("Location: system_firmware.php"); @@ -94,43 +94,44 @@ if(!$ignorefirmwarelock) { } } -/* Reserved table names to avoid colision */ +/* Reserved table names to avoid collision */ $reserved_table_names = array( - "bogons", - "bogonsv6", - "negate_networks", - "snort2c", - "sshlockout", - "tonatsubnets", - "virusprot", - "vpn_networks", - "webConfiguratorlockout" + "bogons", + "bogonsv6", + "negate_networks", + "snort2c", + "sshlockout", + "tonatsubnets", + "virusprot", + "vpn_networks", + "webConfiguratorlockout" ); -$firewall_rules_dscp_types = array("af11", - "af12", - "af13", - "af21", - "af22", - "af23", - "af31", - "af32", - "af33", - "af41", - "af42", - "af43", - "VA", - "EF", - "cs1", - "cs2", - "cs3", - "cs4", - "cs5", - "cs6", - "cs7", - "0x01", - "0x02", - "0x04"); +$firewall_rules_dscp_types = array( + "af11", + "af12", + "af13", + "af21", + "af22", + "af23", + "af31", + "af32", + "af33", + "af41", + "af42", + "af43", + "VA", + "EF", + "cs1", + "cs2", + "cs3", + "cs4", + "cs5", + "cs6", + "cs7", + "0x01", + "0x02", + "0x04"); $auth_server_types = array( 'ldap' => "LDAP", @@ -180,7 +181,7 @@ $netbios_nodetypes = array( '4' => "m-node", '8' => "h-node"); -/* some well knows ports */ +/* some well known ports */ $wkports = array( 5999 => "CVSup", 53 => "DNS", @@ -238,11 +239,16 @@ foreach ($spiflist as $ifgui => $ifdesc) { $specialnets[$ifgui . 'ip'] = $ifdesc . " address"; } -$medias = array("auto" => "autoselect", "100full" => "100BASE-TX full-duplex", - "100half" => "100BASE-TX half-duplex", "10full" => "10BASE-T full-duplex", +$medias = array( + "auto" => "autoselect", + "100full" => "100BASE-TX full-duplex", + "100half" => "100BASE-TX half-duplex", + "10full" => "10BASE-T full-duplex", "10half" => "10BASE-T half-duplex"); -$wlan_modes = array("bss" => "Infrastructure (BSS)", "adhoc" => "Ad-hoc (IBSS)", +$wlan_modes = array( + "bss" => "Infrastructure (BSS)", + "adhoc" => "Ad-hoc (IBSS)", "hostap" => "Access Point"); /* platforms that support firmware updating */ @@ -274,16 +280,17 @@ function print_input_errors($input_errors) { <td class="inputerrorsleft"> <img src="/themes/{$g['theme']}/images/icons/icon_error.gif" alt="errors" /> </td> - <td class="inputerrorsright errmsg"> + <td class="inputerrorsright errmsg"> EOF; - echo "<p>" . gettext("The following input errors were detected:") . "</p>\n<ul>"; + echo "<p>" . gettext("The following input errors were detected:") . "</p>\n<ul>"; foreach ($input_errors as $ierr) { echo "<li>" . htmlspecialchars($ierr) . "</li>"; } print <<<EOF2 </ul> - </td></tr> + </td> + </tr> </table> </div> <br /> @@ -293,28 +300,31 @@ EOF2; function verify_gzip_file($fname) { $returnvar = mwexec("/usr/bin/gzip -t " . escapeshellarg($fname)); - if ($returnvar != 0) + if ($returnvar != 0) { return 0; - else + } else { return 1; + } } function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { global $g, $nifty_redbox, $nifty_blackbox, $nifty_background; - if(empty($value)) { + if (empty($value)) { $value = gettext("Apply changes"); } // Set the Nifty background color if one is not set already (defaults to white) - if($nifty_background == "") + if ($nifty_background == "") { $nifty_background = "#FFF"; + } - if(stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false || $showapply) { + if (stristr($msg, gettext("apply")) != false || stristr($msg, gettext("save")) != false || stristr($msg, gettext("create")) != false || $showapply) { $savebutton = "<td class=\"infoboxsave\">"; $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />"; - if($_POST['if']) + if ($_POST['if']) { $savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />"; + } $savebutton.="</td>"; } $nifty_redbox = "#990000"; @@ -322,17 +332,17 @@ function print_info_box_np($msg, $name="apply",$value="", $showapply=false) { $themename = $g['theme']; - if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { + if (file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php"); eval($toeval); } - if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { + if (file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php"); eval($toeval); } - if(!$savebutton) { + if (!$savebutton) { $savebutton = "<td class=\"infoboxsave\"><input value=\"" . gettext("Close") . "\" type=\"button\" onclick=\"jQuery(this).parents('table[id=redboxtable]').hide();\" /></td>"; } @@ -373,31 +383,32 @@ EOFnp; function print_info_box_np_undo($msg, $name="apply",$value="Apply changes", $undo) { global $g; - if(stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { + if (stristr($msg, "apply") != false || stristr($msg, "save") != false || stristr($msg, "create") != false) { $savebutton = "<td class=\"infoboxsave nowrap\">"; $savebutton .= "<input type=\"button\" value=\"". gettext("Undo") . "\" onclick=\"document.location='{$undo}'\" />"; $savebutton .= "<input name=\"{$name}\" type=\"submit\" class=\"formbtn\" id=\"${name}\" value=\"{$value}\" />"; $savebutton .= "</td>"; - if($_POST['if']) + if ($_POST['if']) { $savebutton .= "<input type=\"hidden\" name=\"if\" value=\"" . htmlspecialchars($_POST['if']) . "\" />"; + } } $nifty_redbox = "#990000"; $nifty_blackbox = "#000000"; $themename = $g['theme']; - if(file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { + if (file_exists("/usr/local/www/themes/{$themename}/tabcontrols.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/tabcontrols.php"); eval($toeval); } - if(file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { + if (file_exists("/usr/local/www/themes/{$themename}/infobox.php")) { $toeval = file_get_contents("/usr/local/www/themes/{$themename}/infobox.php"); eval($toeval); } - if(!$savebutton) { + if (!$savebutton) { $savebutton = "<td class=\"infoboxsave\"><input value=\"" . gettext("Close") . "\" type=\"button\" onclick=\"jQuery(this).parents('table[id=redboxtable]').hide();\" /></td>"; } @@ -445,11 +456,14 @@ function get_std_save_message($ok) { $filter_related = false; $filter_pages = array("nat", "filter"); $to_return = gettext("The changes have been applied successfully."); - foreach($filter_pages as $fp) - if(stristr($_SERVER['SCRIPT_FILENAME'], $fp)) + foreach ($filter_pages as $fp) { + if (stristr($_SERVER['SCRIPT_FILENAME'], $fp)) { $filter_related = true; - if($filter_related) + } + } + if ($filter_related) { $to_return .= "<br />" . gettext("You can also <a href=\"status_filter_reload.php\">monitor</a> the filter reload progress."); + } return $to_return; } @@ -464,8 +478,9 @@ function pprint_address($adr) { $padr = $adr['address']; } - if (isset($adr['not'])) + if (isset($adr['not'])) { $padr = "! " . $padr; + } return $padr; } @@ -475,17 +490,18 @@ function pprint_port($port) { $pport = ""; - if (!$port) + if (!$port) { return "*"; - else { + } else { $srcport = explode("-", $port); if ((!$srcport[1]) || ($srcport[0] == $srcport[1])) { $pport = $srcport[0]; if ($wkports[$srcport[0]]) { $pport .= " (" . $wkports[$srcport[0]] . ")"; } - } else + } else { $pport .= $srcport[0] . " - " . $srcport[1]; + } } return $pport; @@ -493,66 +509,92 @@ function pprint_port($port) { function firewall_check_for_advanced_options(&$item) { $item_set = ""; - if($item['os']) - $item_set .= "os {$item['os']} "; - if($item['dscp']) + if ($item['os']) { + $item_set .= "os {$item['os']} "; + } + if ($item['dscp']) { $item_set .= "dscp {$item['dscp']} "; - if($item['max']) + } + if ($item['max']) { $item_set .= "max {$item['max']} "; - if($item['max-src-nodes']) + } + if ($item['max-src-nodes']) { $item_set .= "max-src-nodes {$item['max-src-nodes']} "; - if($item['max-src-conn']) + } + if ($item['max-src-conn']) { $item_set .= "max-src-conn {$item['max-src-conn']} "; - if($item['max-src-states']) + } + if ($item['max-src-states']) { $item_set .= "max-src-states {$item['max-src-states']} "; - if(isset($item['nopfsync'])) + } + if (isset($item['nopfsync'])) { $item_set .= "nopfsync "; - if($item['statetype'] != "keep state" && $item['statetype'] != "") + } + if ($item['statetype'] != "keep state" && $item['statetype'] != "") { $item_set .= "statetype {$item['statetype']} "; - if($item['statetimeout']) + } + if ($item['statetimeout']) { $item_set .= "statetimeout {$item['statetimeout']} "; - if(isset($item['nosync'])) + } + if (isset($item['nosync'])) { $item_set .= "no XMLRPC Sync "; - if($item['max-src-conn-rate']) + } + if ($item['max-src-conn-rate']) { $item_set .= "max-src-conn-rate {$item['max-src-conn-rate']} "; - if($item['max-src-conn-rates']) + } + if ($item['max-src-conn-rates']) { $item_set .= "max-src-conn-rates {$item['max-src-conn-rates']} "; - if($item['vlanprio']) + } + if ($item['vlanprio']) { $item_set .= "vlanprio {$item['vlanprio']} "; - if($item['vlanprioset']) + } + if ($item['vlanprioset']) { $item_set .= "vlanprioset {$item['vlanprioset']} "; - if($item['gateway']) + } + if ($item['gateway']) { $item_set .= "gateway {$item['gateway']} "; - if($item['dnpipe']) + } + if ($item['dnpipe']) { $item_set .= "limiter {$item['dnpipe']} "; - if($item['pdnpipe']) + } + if ($item['pdnpipe']) { $item_set .= "limiter {$item['pdnpipe']} "; - if($item['ackqueue']) + } + if ($item['ackqueue']) { $item_set .= "ackqueue {$item['ackqueue']} "; - if($item['defaultqueue']) + } + if ($item['defaultqueue']) { $item_set .= "defaultqueue {$item['defaultqueue']} "; - if($item['l7container']) + } + if ($item['l7container']) { $item_set .= "layer7 {$item['l7container']} "; - if($item['tag']) + } + if ($item['tag']) { $item_set .= "tag {$item['tag']} "; - if($item['tagged']) + } + if ($item['tagged']) { $item_set .= "tagged {$item['tagged']} "; - if(isset($item['allowopts'])) + } + if (isset($item['allowopts'])) { $item_set .= "allowopts "; - if(isset($item['disablereplyto'])) + } + if (isset($item['disablereplyto'])) { $item_set .= "disable reply-to "; - if($item['tcpflags_any'] || $item['tcpflags1'] || $item['tcpflags2']) + } + if ($item['tcpflags_any'] || $item['tcpflags1'] || $item['tcpflags2']) { $item_set .= "tcpflags set"; + } return $item_set; } function gentitle($title) { global $navlevelsep; - if(!is_array($title)) + if (!is_array($title)) { return $title; - else + } else { return join($navlevelsep, $title); + } } function genhtmltitle($title) { @@ -571,20 +613,23 @@ function update_changedesc($update) { function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = true) { global $config, $g; - if ($restart_syslogd) + if ($restart_syslogd) { exec("/usr/bin/killall syslogd"); - if(isset($config['system']['disablesyslogclog'])) { + } + if (isset($config['system']['disablesyslogclog'])) { unlink($logfile); touch($logfile); } else { $log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488"; - if(isset($config['system']['usefifolog'])) + if (isset($config['system']['usefifolog'])) { exec("/usr/sbin/fifolog_create -s {$log_size} " . escapeshellarg($logfile)); - else + } else { exec("/usr/local/sbin/clog -i -s {$log_size} " . escapeshellarg($logfile)); + } } - if ($restart_syslogd) + if ($restart_syslogd) { system_syslogd_start(); + } } function clear_all_log_files() { @@ -607,43 +652,45 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert $sor = isset($config['syslog']['reverse']) ? "-r" : ""; $logarr = ""; $grepline = " "; - if(is_array($grepfor)) + if (is_array($grepfor)) { $grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor)); - if(is_array($grepinvert)) + } + if (is_array($grepinvert)) { $grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert)); + } if (is_dir($logfile)) { $logarr = array("File $logfile is a directory."); } elseif (file_exists($logfile) && filesize($logfile) == 0) { $logarr = array("Log file started."); } else { - if($config['system']['disablesyslogclog']) { + if ($config['system']['disablesyslogclog']) { exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } else { - if(isset($config['system']['usefifolog'])) + if (isset($config['system']['usefifolog'])) { exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); - else + } else { exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); + } } } foreach ($logarr as $logent) { - $logent = preg_split("/\s+/", $logent, 6); - echo "<tr valign=\"top\">\n"; - if ($withorig) { - if(isset($config['system']['usefifolog'])) { - $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . "")); - $entry_text = htmlspecialchars($logent[5]); - } else { - $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3))); - $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " "; - $entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]); - } - echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n"; - echo "<td class=\"listr\">{$entry_text}</td>\n"; - + $logent = preg_split("/\s+/", $logent, 6); + echo "<tr valign=\"top\">\n"; + if ($withorig) { + if (isset($config['system']['usefifolog'])) { + $entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . "")); + $entry_text = htmlspecialchars($logent[5]); } else { - echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n"; + $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3))); + $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " "; + $entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]); } - echo "</tr>\n"; + echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n"; + echo "<td class=\"listr\">{$entry_text}</td>\n"; + } else { + echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n"; + } + echo "</tr>\n"; } } @@ -652,14 +699,16 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve $sor = (isset($config['syslog']['reverse']) || $grepreverse) ? "-r" : ""; $logarr = ""; $grepline = " "; - if(is_array($grepfor)) + if (is_array($grepfor)) { $grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor)); - if(is_array($grepinvert)) + } + if (is_array($grepinvert)) { $grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert)); - if($config['system']['disablesyslogclog']) { + } + if ($config['system']['disablesyslogclog']) { exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } else { - if(isset($config['system']['usefifolog'])) { + if (isset($config['system']['usefifolog'])) { exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); } else { exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); @@ -698,29 +747,32 @@ function update_if_changed($varname, & $orig, $new) { } function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) { - if (isset($adr['any'])) + if (isset($adr['any'])) { $padr = "any"; - else if ($adr['network']) + } else if ($adr['network']) { $padr = $adr['network']; - else if ($adr['address']) { + } else if ($adr['address']) { list($padr, $pmask) = explode("/", $adr['address']); if (!$pmask) { - if (is_ipaddrv6($padr)) + if (is_ipaddrv6($padr)) { $pmask = 128; - else + } else { $pmask = 32; + } } } - if (isset($adr['not'])) + if (isset($adr['not'])) { $pnot = 1; - else + } else { $pnot = 0; + } if ($adr['port']) { list($pbeginport, $pendport) = explode("-", $adr['port']); - if (!$pendport) + if (!$pendport) { $pendport = $pbeginport; + } } else if (!is_alias($pbeginport) && !is_alias($pendport)) { $pbeginport = "any"; $pendport = "any"; @@ -730,34 +782,38 @@ function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendp function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $pendport=0) { $adr = array(); - if ($padr == "any") + if ($padr == "any") { $adr['any'] = true; - else if (is_specialnet($padr)) + } else if (is_specialnet($padr)) { $adr['network'] = $padr; - else { + } else { $adr['address'] = $padr; if (is_ipaddrv6($padr)) { - if ($pmask != 128) + if ($pmask != 128) { $adr['address'] .= "/" . $pmask; + } } else { - if ($pmask != 32) + if ($pmask != 32) { $adr['address'] .= "/" . $pmask; + } } } - if ($pnot) + if ($pnot) { $adr['not'] = true; - else + } else { unset($adr['not']); + } if (($pbeginport != 0) && ($pbeginport != "any")) { - if ($pbeginport != $pendport) + if ($pbeginport != $pendport) { $adr['port'] = $pbeginport . "-" . $pendport; - else + } else { $adr['port'] = $pbeginport; + } } - if(is_alias($pbeginport)) { + if (is_alias($pbeginport)) { $adr['port'] = $pbeginport; } } @@ -765,12 +821,14 @@ function pconfig_to_address(&$adr, $padr, $pmask, $pnot=false, $pbeginport=0, $p function is_specialnet($net) { global $specialsrcdst; - if(!$net) + if (!$net) { return false; - if (in_array($net, $specialsrcdst)) + } + if (in_array($net, $specialsrcdst)) { return true; - else + } else { return false; + } } //function to create widget tabs when called @@ -778,15 +836,14 @@ function display_widget_tabs(& $tab_array) { echo "<div id=\"tabs\">"; $tabscounter = 0; foreach ($tab_array as $ta) { - $dashpos = strpos($ta[2],'-'); - $tabname = $ta[2] . "-tab"; - $tabclass = substr($ta[2],0,$dashpos); - $tabclass = $tabclass . "-class"; + $dashpos = strpos($ta[2],'-'); + $tabname = $ta[2] . "-tab"; + $tabclass = substr($ta[2],0,$dashpos); + $tabclass = $tabclass . "-class"; if ($ta[1] == true) { $tabActive = "table-cell"; $tabNonActive = "none"; - } - else { + } else { $tabActive = "none"; $tabNonActive = "table-cell"; } @@ -812,38 +869,38 @@ function display_widget_tabs(& $tab_array) { } -// Return inline javascript file or CSS to minimizie +// Return inline javascript file or CSS to minimize // request count going back to server. function outputJavaScriptFileInline($javascript) { - if(file_exists($javascript)) { + if (file_exists($javascript)) { echo "\n<script type=\"text/javascript\">\n"; include($javascript); echo "\n</script>\n"; } else { - echo "\n\n<!-- Could not location file: {$javascript} -->\n\n"; + echo "\n\n<!-- Could not locate file: {$javascript} -->\n\n"; } } function outputCSSPrintFileInline($css) { - if(file_exists($css)) { + if (file_exists($css)) { echo "\n<style media=\"print\" type=\"text/css\">\n"; include($css); echo "\n</style>\n"; } else { - echo "\n\n<!-- Could not location file: {$css} -->\n\n"; + echo "\n\n<!-- Could not locate file: {$css} -->\n\n"; } } function outputCSSFileInline($css) { - if(file_exists($css)) { + if (file_exists($css)) { echo "\n<style type=\"text/css\">\n"; include($css); echo "\n</style>\n"; } else { - echo "\n\n<!-- Could not location file: {$css} -->\n\n"; + echo "\n\n<!-- Could not locate file: {$css} -->\n\n"; } } @@ -893,21 +950,23 @@ $rfc2616 = array( function is_rfc2616_code($code) { global $rfc2616; - if (isset($rfc2616[$code])) + if (isset($rfc2616[$code])) { return true; - else + } else { return false; + } } -function print_rfc2616_select($tag, $current){ +function print_rfc2616_select($tag, $current) { global $rfc2616; /* Default to 200 OK if not set */ - if ($current == "") + if ($current == "") { $current = 200; + } echo "<select id=\"{$tag}\" name=\"{$tag}\">\n"; - foreach($rfc2616 as $code => $message) { + foreach ($rfc2616 as $code => $message) { if ($code == $current) { $sel = " selected=\"selected\""; } else { @@ -919,28 +978,28 @@ function print_rfc2616_select($tag, $current){ } // Useful debugging function, much cleaner than print_r -function echo_array($array,$return_me=false){ - if(is_array($array) == false){ +function echo_array($array,$return_me=false) { + if (is_array($array) == false) { $return = "The provided variable is not an array."; - }else{ - foreach($array as $name=>$value){ - if(is_array($value)){ + } else { + foreach ($array as $name=>$value) { + if (is_array($value)) { $return .= ""; $return .= "['<b>$name</b>'] {<div style=\"margin-left:10px;\">\n"; $return .= echo_array($value,true); $return .= "</div>}"; $return .= "\n\n"; - }else{ - if(is_string($value)){ + } else { + if (is_string($value)) { $value = "\"$value\""; } $return .= "['<b>$name</b>'] = $value\n\n"; } } } - if($return_me == true){ + if ($return_me == true) { return $return; - }else{ + } else { echo "<pre>".$return."</pre>"; } } @@ -979,9 +1038,10 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { $tab_array_char_limit = 92; } - foreach ($tab_array as $tab_id => $ta){ - if(!isAllowedPage($ta[2])) + foreach ($tab_array as $tab_id => $ta) { + if (!isAllowedPage($ta[2])) { unset ($tab_array[$tab_id]); + } } $tab_active_bg = "#EEEEEE"; @@ -989,33 +1049,35 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { $nifty_tabs_corners = "#FFF"; $font_color = "white"; - /* if tabcontrols.php exist for a theme, allow it to be overriden */ + /* if tabcontrols.php exist for a theme, allow it to be overridden */ $themename = $config['theme']; $filename = "/usr/local/www/themes/{$themename}/tabcontrols.php"; - if(file_exists($filename)) { + if (file_exists($filename)) { $eval_code = file_get_contents($filename); eval($eval_code); } $tabcharcount = 0; - foreach ($tab_array as $ta) + foreach ($tab_array as $ta) { $tabcharcount = $tabcharcount + strlen($ta[0]); + } - if($no_drop_down == true) { + if ($no_drop_down == true) { $tabcharcount = 0; unset($tab_array_char_limit); } // If the character count of the tab names is > 670 // then show a select item dropdown menubox. - if($tabcharcount > $tab_array_char_limit) { + if ($tabcharcount > $tab_array_char_limit) { echo gettext("Currently viewing: "); echo "<select name=\"TabSelect\" onchange=\"tabs_will_go(this)\">\n"; foreach ($tab_array as $ta) { - if($ta[1]=="true") + if ($ta[1]=="true") { $selected = " selected=\"selected\""; - else + } else { $selected = ""; + } // Onclick in option will not work in some browser // echo "<option onclick=\"document.location='{$ta[2]}';\"{$selected}>{$ta['0']}</option>\n"; echo "<option value=\"{$ta[2]}\"{$selected}>{$ta['0']}</option>\n"; @@ -1023,10 +1085,10 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { echo "</select>\n<p> </p>"; echo "<script type=\"text/javascript\">"; echo "\n//<![CDATA[\n"; - echo " function tabs_will_go(obj){ document.location = obj.value; }\n"; + echo " function tabs_will_go(obj) { document.location = obj.value; }\n"; echo "//]]>\n"; echo "</script>"; - } else { + } else { echo "<div class=\"newtabmenu\" style=\"margin:{$tab_array_space}px {$tab_array_indent}px; width:775px;\">\n"; echo "<!-- Tabbed bar code-->\n"; echo "<ul class=\"newtabmenu\">\n"; @@ -1046,16 +1108,19 @@ function display_top_tabs(& $tab_array, $no_drop_down = false) { function add_package_tabs($tabgroup, & $tab_array) { global $config, $g; - if(!is_array($config['installedpackages'])) + if (!is_array($config['installedpackages'])) { return; - if(!is_array($config['installedpackages']['tab'])) + } + if (!is_array($config['installedpackages']['tab'])) { return; + } - foreach($config['installedpackages']['tab'] as $tab) { - if ($tab['group'] !== $group) + foreach ($config['installedpackages']['tab'] as $tab) { + if ($tab['group'] !== $group) { continue; + } $tab_entry = array(); - if($tab['name']) { + if ($tab['name']) { $tab_entry[] = $tab['name']; $tab_entry[] = false; $tab_entry[] = $tab['url']; @@ -1064,11 +1129,11 @@ function add_package_tabs($tabgroup, & $tab_array) { } } -function alias_info_popup($alias_id){ +function alias_info_popup($alias_id) { global $config; $maxlength = 60; - $close_title="title='".gettext('move mouse out this alias to hide')."'"; - if (is_array($config['aliases']['alias'][$alias_id])){ + $close_title="title='".gettext('move mouse out of this alias to hide')."'"; + if (is_array($config['aliases']['alias'][$alias_id])) { $alias_name=$config['aliases']['alias'][$alias_id]; $alias_objects_with_details = "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" summary=\"alias info popup\">"; if ($alias_name['url']) { @@ -1086,18 +1151,18 @@ function alias_info_popup($alias_id){ $x=0; foreach ($alias_addresses as $alias_ports_address ) { switch ($x) { - case 0: - $x++; - $alias_objects_with_details .= "<tr><td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; - break; - case 1: - $x++; - $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; - break; - default: - $x=0; - $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td><tr>"; - break; + case 0: + $x++; + $alias_objects_with_details .= "<tr><td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; + break; + case 1: + $x++; + $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td>"; + break; + default: + $x=0; + $alias_objects_with_details .= "<td $close_title class=\"vncell\" width=\"33%\" style=\"background: #FFFFFF;color: #000000;\">{$alias_ports_address}</td><tr>"; + break; } } for ($y = $x; $y <= $x; $y++) { @@ -1109,18 +1174,18 @@ function alias_info_popup($alias_id){ if ($counter > 10002) { $alias_objects_with_details .= "<tr><td colspan=\"3\"> ". gettext("listing only first 10k items") . "</td><tr>"; } - } - else{ + } else { $alias_addresses = explode (" ", $alias_name['address']); $alias_details = explode ("||", $alias_name['detail']); $counter = 0; foreach ($alias_addresses as $alias_ports_address) { $alias_objects_with_details .= "<tr><td $close_title width=\"5%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_addresses[$counter]}</td>"; $alias_detail_default = strpos ($alias_details[$counter],"Entry added"); - if ($alias_details[$counter] != "" && $alias_detail_default === False) + if ($alias_details[$counter] != "" && $alias_detail_default === False) { $alias_objects_with_details .="<td $close_title width=\"95%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\">{$alias_details[$counter]}</td>"; - else + } else { $alias_objects_with_details .="<td $close_title width=\"95%\" class=\"vncell\" style=\"background: #FFFFFF;color: #000000;\"> </td>"; + } $alias_objects_with_details .= "</tr>"; $counter++; } @@ -1128,31 +1193,32 @@ function alias_info_popup($alias_id){ $alias_objects_with_details .= "</table>"; } $alias_descr_substr = $alias_name['descr']; - if ($strlength >= $maxlength) + if ($strlength >= $maxlength) { $alias_descr_substr = substr($alias_descr_substr, 0, $maxlength) . "..."; + } $item_text = ($counter > 1 ? "items" : "item"); $alias_caption = "{$alias_descr_substr} - {$counter} {$item_text}<a href=\"/firewall_aliases_edit.php?id={$alias_id}\" title=\"".gettext('edit this alias')."\"> edit </a>"; $strlength = strlen ($alias_caption); print "<h1>{$alias_caption}</h1>" . $alias_objects_with_details; } -function rule_popup($src,$srcport,$dst,$dstport){ +function rule_popup($src,$srcport,$dst,$dstport) { global $config,$g; $aliases_array = array(); if ($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias'])) { $descriptions = array (); - foreach ($config['aliases']['alias'] as $alias_id=>$alias_name){ + foreach ($config['aliases']['alias'] as $alias_id=>$alias_name) { $loading_image="<a><img src=\'/themes/{$g['theme']}/images/misc/loader.gif\' alt=\'loader\' /> " .gettext("loading...")."</a>"; - switch ($alias_name['type']){ - case "port": - $width="250"; - break; - case "urltable": - $width="500"; - break; - default: - $width="350"; - break; + switch ($alias_name['type']) { + case "port": + $width="250"; + break; + case "urltable": + $width="500"; + break; + default: + $width="350"; + break; } $span_begin = "<span style=\"cursor: help;\" onmouseover=\"var response_html=domTT_activate(this, event, 'id','ttalias_{$alias_id}','content','{$loading_image}', 'trail', true, 'delay', 300, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle','type','velcro','width',{$width});alias_popup('{$alias_id}','{$g['theme']}','".gettext('loading...')."');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><u>"; $span_end = "</u></span>"; @@ -1178,8 +1244,9 @@ function rule_popup($src,$srcport,$dst,$dstport){ } $timezone = $config['system']['timezone']; -if (!$timezone) +if (!$timezone) { $timezone = "Etc/UTC"; +} date_default_timezone_set($timezone); diff --git a/usr/local/www/head.inc b/usr/local/www/head.inc index 9535de3..ba02b40 100755 --- a/usr/local/www/head.inc +++ b/usr/local/www/head.inc @@ -5,12 +5,13 @@ $g['theme'] = get_current_theme(); -$pagetitle = gentitle( $pgtitle ); +$pagetitle = gentitle($pgtitle); -if (isset($config['system']['webgui']['pagenamefirst'])) +if (isset($config['system']['webgui']['pagenamefirst'])) { $tabtitle = $pagetitle . " - " . $config['system']['hostname'] . "." . $config['system']['domain']; -else +} else { $tabtitle = $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle; +} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -20,97 +21,100 @@ else <meta http-equiv="Content-Type" content="text/html; charset=<?=system_get_language_codeset();?>" /> <link rel="apple-touch-icon" href="/themes/<?php echo $g['theme']; ?>/apple-touch-icon.png"/> <link rel="shortcut icon" href="/themes/<?php echo $g['theme']; ?>/images/icons/favicon.ico"/> - <?php - if (file_exists("{$g['www_path']}/themes/{$g['theme']}/table.css")): - echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/table.css\" />"; - else: - echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/css/table.css\" media=\"all\" />"; - endif; - ?> + <?php + if (file_exists("{$g['www_path']}/themes/{$g['theme']}/table.css")): + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/table.css\" />"; + else: + echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/css/table.css\" media=\"all\" />"; + endif; + ?> + + <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false && + file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?> + <?php echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" />"; ?> + <?php else: ?> + <link type="text/css" rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" /> + <?php endif; ?> + <link rel="stylesheet" type="text/css" href="/niftycssCode.css" /> + <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" /> + <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all" /> + <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/styles/jquery-ui-1.11.1.css" /> + <script type="text/javascript" src="/javascript/niftyjsCode.js"></script> + <script type="text/javascript" src="/javascript/jquery-1.11.1.min.js"></script> + <script type="text/javascript" src="/javascript/jquery-migrate-1.2.1.min.js"></script> + <script type="text/javascript" src="/javascript/jquery/jquery-ui-1.11.1.min.js"></script> + <script type="text/javascript"> + //<![CDATA[ + var theme = "<?php echo $g['theme']; ?>"; - <?php if (strpos($_SERVER["SCRIPT_FILENAME"], "wizard.php") !== false && - file_exists("{$g['www_path']}/themes/{$g['theme']}/wizard.css")): ?> - <?php echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" />"; ?> - <?php else: ?> - <link type="text/css" rel="stylesheet" href="/themes/<?php echo $g['theme']; ?>/all.css" media="all" /> - <?php endif; ?> - <link rel="stylesheet" type="text/css" href="/niftycssCode.css" /> - <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" /> - <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/new_tab_menu.css" media="all" /> - <link rel="stylesheet" type="text/css" href="/themes/<?=$g['theme']?>/styles/jquery-ui-1.11.1.css" /> - <script type="text/javascript" src="/javascript/niftyjsCode.js"></script> - <script type="text/javascript" src="/javascript/jquery-1.11.1.min.js"></script> - <script type="text/javascript" src="/javascript/jquery-migrate-1.2.1.min.js"></script> - <script type="text/javascript" src="/javascript/jquery/jquery-ui-1.11.1.min.js"></script> - <script type="text/javascript"> - //<![CDATA[ - var theme = "<?php echo $g['theme']; ?>"; + jQuery.noConflict(); + //]]> + </script> - jQuery.noConflict(); - //]]> - </script> - - <script type="text/javascript" src="/javascript/sorttable.js"></script> - <script type="text/javascript" src="/javascript/ticker.js"></script> - <style type="text/css" id="antiClickjack"> - /*<![CDATA[*/ + <script type="text/javascript" src="/javascript/sorttable.js"></script> + <script type="text/javascript" src="/javascript/ticker.js"></script> + <style type="text/css" id="antiClickjack"> + /*<![CDATA[*/ body{display:none} - /*]]>*/ - </style> - <script type="text/javascript"> - //<![CDATA[ + /*]]>*/ + </style> + <script type="text/javascript"> + //<![CDATA[ if (self === top) { var antiClickjack = document.getElementById("antiClickjack"); antiClickjack.parentNode.removeChild(antiClickjack); } else { top.location = self.location; } - //]]> - </script> - - <?php echo "\t<script type=\"text/javascript\" src=\"/themes/{$g['theme']}/loader.js\"></script>\n"; ?> + //]]> + </script> + <?php - if($_GET['enablefirebuglite']) { - echo "\t<script type=\"text/javascript\" src=\"/javascript/pi.js\"></script>\n"; - echo "\t<script type=\"text/javascript\" src=\"/javascript/firebug-lite.js\"></script>\n"; - } - echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/prototype.js\"></script>\n"; - echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/scriptaculous.js\"></script>\n"; - echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/effects.js\"></script>\n"; - echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/dragdrop.js\"></script>\n"; - if(file_exists("{$g['www_path']}/javascript/global.js")) - echo "\t<script type=\"text/javascript\" src=\"/javascript/global.js\"></script>\n"; - /* - * Find all javascript files that need to be included - * for this page ... from the arrays ... :) - * Coded by: Erik Kristensen - */ +echo "\t<script type=\"text/javascript\" src=\"/themes/{$g['theme']}/loader.js\"></script>\n"; +if ($_GET['enablefirebuglite']) { + echo "\t<script type=\"text/javascript\" src=\"/javascript/pi.js\"></script>\n"; + echo "\t<script type=\"text/javascript\" src=\"/javascript/firebug-lite.js\"></script>\n"; +} +echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/prototype.js\"></script>\n"; +echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/scriptaculous.js\"></script>\n"; +echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/effects.js\"></script>\n"; +echo "\t<script type=\"text/javascript\" src=\"/javascript/scriptaculous/dragdrop.js\"></script>\n"; +if (file_exists("{$g['www_path']}/javascript/global.js")) { + echo "\t<script type=\"text/javascript\" src=\"/javascript/global.js\"></script>\n"; +} +/* + * Find all javascript files that need to be included + * for this page ... from the arrays ... :) + * Coded by: Erik Kristensen + */ - $dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php')); - $path = "{$g['www_path']}/javascript/" . $dir . "/"; - if (is_dir($path)) { - if ($dh = opendir($path)) { - while (($file = readdir($dh)) !== false) { - if (is_dir($file)) - continue; - echo "\t<script type=\"text/javascript\" src=\"/javascript/{$dir}/{$file}?rev=1\"></script>\n"; +$dir = trim(basename($_SERVER["SCRIPT_FILENAME"], '.php')); +$path = "{$g['www_path']}/javascript/" . $dir . "/"; +if (is_dir($path)) { + if ($dh = opendir($path)) { + while (($file = readdir($dh)) !== false) { + if (is_dir($file)) { + continue; } - closedir($dh); + echo "\t<script type=\"text/javascript\" src=\"/javascript/{$dir}/{$file}?rev=1\"></script>\n"; } + closedir($dh); } +} -if (!isset($closehead)) +if (!isset($closehead)) { echo "</head>"; +} /* If this page is being remotely managed then do not allow the loading of the contents. */ -if($config['remote_managed_pages']['item']) { - foreach($config['remote_managed_pages']['item'] as $rmp) { - if($rmp == $_SERVER['SCRIPT_NAME']) { +if ($config['remote_managed_pages']['item']) { + foreach ($config['remote_managed_pages']['item'] as $rmp) { + if ($rmp == $_SERVER['SCRIPT_NAME']) { include("fbegin.inc"); print_info_box_np("This page is currently being managed by a remote machine."); include("fend.inc"); exit; } - } + } } ?> diff --git a/usr/local/www/headjs.php b/usr/local/www/headjs.php index dfe0a5c..4b54ec2 100644 --- a/usr/local/www/headjs.php +++ b/usr/local/www/headjs.php @@ -1,29 +1,29 @@ <?php /* - headjs.php - - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + headjs.php + + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: header @@ -39,135 +39,148 @@ require_once("guiconfig.inc"); function getHeadJS() { - global $g, $use_loader_tab_gif; - - if(!$use_loader_tab_gif) - $loader_gif = "/themes/{$g['theme']}/images/misc/loader.gif"; - else - $loader_gif = "/themes/{$g['theme']}/images/misc/loader_tab.gif"; - - $headjs = " - var input_errors = ''; - jQuery(document).ready(init); - "; - if (!session_id()) - session_start(); - $_SESSION['NO_AJAX'] == "True" ? $noajax = "var noAjaxOnSubmit = true;" : $noajax = "var noAjaxOnSubmit = false;"; - session_commit(); - - $headjs .= " - {$noajax} - - function init() { - if(jQuery('#submit') && ! noAjaxOnSubmit) { - // debugging helper - //alert('adding observe event for submit button'); - - jQuery(\"#submit\").click(submit_form); - jQuery('#submit').click(function() {return false;}); - var to_insert = \"<div style='visibility:hidden' id='loading' name='loading'><img src='{$loader_gif}' alt='loader' \/><\/div>\"; - jQuery('#submit').before(to_insert); - } - } - - function submit_form(e){ - // debugging helper - //alert(Form.serialize($('iform'))); - - if(jQuery('#inputerrors')) - jQuery('#inputerrors').html('<center><b><i>Loading...<\/i><\/b><\/center>'); - - /* dsh: Introduced because pkg_edit tries to set some hidden fields - * if executing submit's onclick event. The click gets deleted - * by Ajax. Hence using onkeydown instead. - */ - if(jQuery('#submit').prop('keydown')) { - jQuery('#submit').keydown(); - jQuery('#submit').css('visibility','hidden'); - } - if(jQuery('#cancelbutton')) - jQuery('#cancelbutton').css('visibility','hidden'); - jQuery('#loading').css('visibility','visible'); - // submit the form using Ajax - } - - function formSubmitted(resp) { - var responseText = resp.responseText; - - // debugging helper - // alert(responseText); - - if(responseText.indexOf('html') > 0) { - /* somehow we have been fed an html page! */ - //alert('Somehow we have been fed an html page! Forwarding to /.'); - document.location.href = '/'; - } - - eval(responseText); - } - - /* this function will be called if an HTTP error will be triggered */ - function formFailure(resp) { - showajaxmessage(resp.responseText); - if(jQuery('#submit')) - jQuery('#submit').css('visibility','visible'); - if(jQuery('#cancelbutton')) - jQuery('#cancelbutton').css('visibility','visible'); - if(jQuery('#loading')) - jQuery('#loading').css('visibility','hidden'); - - } - - function showajaxmessage(message) { - var message_html; - - if (message == '') { - NiftyCheck(); - Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); - Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); - - if(jQuery('#submit')) - jQuery('#submit').css('visibility','visible'); - if(jQuery('#cancelbutton')) - jQuery('#cancelbutton').css('visibility','visible'); - if(jQuery('#loading')) - jQuery('#loading').css('visibility','hidden'); - - return; - } - - message_html = '<table height=\"32\" width=\"100%\" summary=\"redbox\"><tr><td>'; - message_html += '<div style=\"background-color:#990000\" id=\"redbox\">'; - message_html += '<table width=\"100%\" summary=\"message\"><tr><td width=\"8%\">'; - message_html += '<img style=\"vertical-align:center\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\" width=\"28\" height=\"32\" alt=\"exclamation\" \/>'; - message_html += '<\/td><td width=\"70%\"><font color=\"white\">'; - message_html += '<b>' + message + '<\/b><\/font><\/td>'; - - if(message.indexOf('apply') > 0) { - message_html += '<td>'; - message_html += '<input name=\"apply\" type=\"submit\" class=\"formbtn\" id=\"apply\" value=\"" . gettext("Apply changes") . "\" \/>'; - message_html += '<\/td>'; - } - - message_html += '<\/tr><\/table><\/div><\/td><\/table><br \/>'; - jQuery('#inputerrors').html(message_html); - - NiftyCheck(); - Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); - Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); - - if(jQuery('#submit')) - jQuery('#submit').css('visibility','visible'); - if(jQuery('#cancelbutton')) - jQuery('#cancelbutton').css('visibility','visible'); - if(jQuery('#loading')) - jQuery('#loading').css('visibility','hidden'); - if(jQuery('#inputerrors')) - window.scrollTo(0, 0); - } - "; - - return $headjs; + global $g, $use_loader_tab_gif; + + if (!$use_loader_tab_gif) { + $loader_gif = "/themes/{$g['theme']}/images/misc/loader.gif"; + } else { + $loader_gif = "/themes/{$g['theme']}/images/misc/loader_tab.gif"; + } + + $headjs = " + var input_errors = ''; + jQuery(document).ready(init); + "; + if (!session_id()) { + session_start(); + } + $_SESSION['NO_AJAX'] == "True" ? $noajax = "var noAjaxOnSubmit = true;" : $noajax = "var noAjaxOnSubmit = false;"; + session_commit(); + + $headjs .= " + {$noajax} + + function init() { + if (jQuery('#submit') && ! noAjaxOnSubmit) { + // debugging helper + //alert('adding observe event for submit button'); + + jQuery(\"#submit\").click(submit_form); + jQuery('#submit').click(function() {return false;}); + var to_insert = \"<div style='visibility:hidden' id='loading' name='loading'><img src='{$loader_gif}' alt='loader' \/><\/div>\"; + jQuery('#submit').before(to_insert); + } + } + + function submit_form(e){ + // debugging helper + //alert(Form.serialize($('iform'))); + + if (jQuery('#inputerrors')) { + jQuery('#inputerrors').html('<center><b><i>Loading...<\/i><\/b><\/center>'); + } + + /* dsh: Introduced because pkg_edit tries to set some hidden fields + * if executing submit's onclick event. The click gets deleted + * by Ajax. Hence using onkeydown instead. + */ + if (jQuery('#submit').prop('keydown')) { + jQuery('#submit').keydown(); + jQuery('#submit').css('visibility','hidden'); + } + if(jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','hidden'); + } + jQuery('#loading').css('visibility','visible'); + // submit the form using Ajax + } + + function formSubmitted(resp) { + var responseText = resp.responseText; + + // debugging helper + // alert(responseText); + + if (responseText.indexOf('html') > 0) { + /* somehow we have been fed an html page! */ + //alert('Somehow we have been fed an html page! Forwarding to /.'); + document.location.href = '/'; + } + + eval(responseText); + } + + /* this function will be called if an HTTP error will be triggered */ + function formFailure(resp) { + showajaxmessage(resp.responseText); + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + } + + function showajaxmessage(message) { + var message_html; + + if (message == '') { + NiftyCheck(); + Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); + Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); + + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + + return; + } + + message_html = '<table height=\"32\" width=\"100%\" summary=\"redbox\"><tr><td>'; + message_html += '<div style=\"background-color:#990000\" id=\"redbox\">'; + message_html += '<table width=\"100%\" summary=\"message\"><tr><td width=\"8%\">'; + message_html += '<img style=\"vertical-align:center\" src=\"/themes/{$g['theme']}/images/icons/icon_exclam.gif\" width=\"28\" height=\"32\" alt=\"exclamation\" \/>'; + message_html += '<\/td><td width=\"70%\"><font color=\"white\">'; + message_html += '<b>' + message + '<\/b><\/font><\/td>'; + + if (message.indexOf('apply') > 0) { + message_html += '<td>'; + message_html += '<input name=\"apply\" type=\"submit\" class=\"formbtn\" id=\"apply\" value=\"" . gettext("Apply changes") . "\" \/>'; + message_html += '<\/td>'; + } + + message_html += '<\/tr><\/table><\/div><\/td><\/table><br \/>'; + jQuery('#inputerrors').html(message_html); + + NiftyCheck(); + Rounded(\"div#redbox\",\"all\",\"#FFF\",\"#990000\",\"smooth\"); + Rounded(\"td#blackbox\",\"all\",\"#FFF\",\"#000000\",\"smooth\"); + + if (jQuery('#submit')) { + jQuery('#submit').css('visibility','visible'); + } + if (jQuery('#cancelbutton')) { + jQuery('#cancelbutton').css('visibility','visible'); + } + if (jQuery('#loading')) { + jQuery('#loading').css('visibility','hidden'); + } + if (jQuery('#inputerrors')) { + window.scrollTo(0, 0); + } + } + "; + + return $headjs; } ?> diff --git a/usr/local/www/ifstats.php b/usr/local/www/ifstats.php index 56c46b4..4f07752 100644 --- a/usr/local/www/ifstats.php +++ b/usr/local/www/ifstats.php @@ -47,8 +47,9 @@ $if = $_GET['if']; $realif = get_real_interface($if); - if(!$realif) + if (!$realif) { $realif = $if; // Need for IPsec case interface. + } $ifinfo = pfSense_get_interface_stats($realif); diff --git a/usr/local/www/license.php b/usr/local/www/license.php index 94a1a65..a93901d 100644 --- a/usr/local/www/license.php +++ b/usr/local/www/license.php @@ -1,30 +1,30 @@ <?php /* $Id$ */ /* - license.php - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - All rights reserved + license.php + Copyright (C) 2013-2015 Electric Sheep Fencing, LP + All rights reserved - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ /* pfSense_MODULE: routing @@ -43,105 +43,91 @@ include("head.inc"); ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> -<p class="pgtitle"><?=gettext("License");?></p> + <?php include("fbegin.inc"); ?> + <p class="pgtitle"><?=gettext("License");?></p> - <p><strong><?=$g['product_name'];?> <?=gettext("is Copyright");?> © <?=$g['product_copyright_years'];?> <?=gettext("by");?> <?=$g['product_copyright'];?><br /> - <?=gettext("All rights reserved");?>.</strong></p> + <p><strong><?=$g['product_name'];?> <?=gettext("is Copyright");?> © <?=$g['product_copyright_years'];?> <?=gettext("by");?> <?=$g['product_copyright'];?><br /> + <?=gettext("All rights reserved");?>.</strong></p> - <p><strong><?=gettext("m0n0wall is Copyright ");?>© <?=gettext("2002-2015 by Manuel Kasper");?> - (<a href="mailto:mk@neon1.net">mk@neon1.net</a>).<br /> - <?=gettext("All rights reserved");?>.</strong></p> - <p> <?=gettext("Redistribution and use in source and binary forms, with or without");?><br /> - <?=gettext("modification, are permitted provided that the following conditions ". - "are met");?>:<br /> - <br /> - <?=gettext("1. Redistributions of source code must retain the above copyright ". - "notice,");?><br /> - <?=gettext("this list of conditions and the following disclaimer");?>.<br /> - <br /> - <?=gettext("2. Redistributions in binary form must reproduce the above copyright");?><br /> - <?=gettext("notice, this list of conditions and the following disclaimer in ". - "the");?><br /> - <?=gettext("documentation and/or other materials provided with the distribution.");?><br /> - <br /> - <strong><?=gettext("THIS SOFTWARE IS PROVIDED ");?>"<?=gettext("AS IS'' AND ANY EXPRESS ". - "OR IMPLIED WARRANTIES,");?><br /> - <?=gettext("INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY");?><br /> - <?=gettext("AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT ". - "SHALL THE");?><br /> - <?=gettext("AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ". - "EXEMPLARY,");?><br /> - <?=gettext("OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ". - "OF");?><br /> - <?=gettext("SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ". - "BUSINESS");?><br /> - <?=gettext("INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER ". - "IN");?><br /> - <?=gettext("CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");?><br /> - <?=gettext("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ". - "OF THE");?><br /> - <?=gettext("POSSIBILITY OF SUCH DAMAGE");?></strong>.</p> - <hr size="1"> - <p><?= "{$g['product_name']} " . gettext("is based upon/includes various free software packages, ". - "listed below.");?><br /> - <?php printf(gettext("The authors of %s would like to thank the authors of these " . - "software packages for their efforts"),$g['product_name']);?>.</p> - <p>FreeBSD (<a href="http://www.freebsd.org" target="_blank">http://www.freebsd.org</a>)<br /> - <?=gettext("Copyright");?> ©<?=gettext("1992-2015 The FreeBSD Project. All rights reserved");?>.<br /> - <br /> - <?=gettext("This product includes PHP, freely available from");?> <a href="http://www.php.net/" target="_blank">http://www.php.net</a>.<br /> - <?=gettext("Copyright"); ?> © <?=gettext("1999-2015 The PHP Group. All rights reserved.");?>.<br /> - <br /> - <?=gettext("LightTPD"); ?> (<a href="http://www.lighttpd.net" target="_blank">http://www.lighttpd.net)</a><br /> - <?=gettext("Copyright"); ?> ©<?=gettext("2004, Jan Knescke, incremental");?><jan@kneschke.de> - <?=gettext("All rights reserved.");?><br /> - <br /> - <?=gettext("ISC DHCP server ");?>(<a href="http://www.isc.org/products/DHCP/" target="_blank">http://www.isc.org/products/DHCP</a>)<br /> - <?=gettext("Copyright"); ?> © <?=gettext("2004-2012 Internet Software Consortium, Inc.");?><br /> - <?=gettext("Copyright"); ?> © <?=gettext("1995-2003 Internet Software Consortium");?><br /> - <br /> - <?=gettext("PF"); ?> (<a href="http://www.openbsd.org/faq/pf" target="_blank">http://www.openbsd.org</a>)<br /> - <br /> - <?=gettext("MPD - Multi-link PPP daemon for FreeBSD");?> (<a href="http://www.dellroad.org/mpd" target="_blank">http://www.dellroad.org/mpd</a>)<br /> - <?=gettext("Copyright"); ?> © 2003-2004, Archie L. Cobbs, Michael Bretterklieber, Alexander Motin<br /> - <?=gettext("All rights reserved.");?><br /> - <br /> - <?=gettext("Circular log support for FreeBSD syslogd ");?>(<a href="http://software.wheelhouse.org/syslogd/" target="_blank">http://software.wheelhouse.org/syslogd/</a>)<br /> - <?=gettext("Copyright"); ?> © 2001 Jeff Wheelhouse (jdw@wwwi.com)<br /> - <br /> - <?=gettext("Dnsmasq - a DNS forwarder for NAT firewalls");?> (<a href="http://www.thekelleys.org.uk" target="_blank">http://www.thekelleys.org.uk</a>)<br /> - <?=gettext("Copyright"); ?> © 2000-2012 Simon Kelley.<br /> - <br /> - <?=gettext("IPsec-Tools"); ?> (<a href="http://ipsec-tools.sourceforge.net/" target="_blank">http://ipsec-tools.sourceforge.net/</a>)<br /> - <?=gettext("Copyright"); ?> © <?=gettext("1995-2002 WIDE Project. All rights reserved.");?><br /> - <br /> - <?=gettext("msntp"); ?> (<a href="http://www.hpcf.cam.ac.uk/export" target="_blank">http://www.hpcf.cam.ac.uk/export</a>)<br /> - <?=gettext("Copyright"); ?> ©<?=gettext(" 1996, 1997, 2000 N.M. Maclaren, University of Cambridge. ". - "All rights reserved.");?><br /> - <br /> - <?=gettext("UCD-SNMP"); ?> (<a href="http://www.ece.ucdavis.edu/ucd-snmp" target="_blank">http://www.ece.ucdavis.edu/ucd-snmp</a>)<br /> - <?=gettext("Copyright"); ?> © <?=gettext("1989, 1991, 1992 by Carnegie Mellon University.");?><br /> - <?=gettext("Copyright"); ?> © <?=gettext("1996, 1998-2000 The Regents of the University of ". - "California. All rights reserved");?>.<br /> - <?=gettext("Copyright"); ?> © <?=gettext("2001-2002, Network Associates Technology, Inc. ". - "All rights reserved.");?><br /> - <?=gettext("Portions of this code are copyright");?> © <?=gettext("2001-2002, Cambridge ". - "Broadband Ltd. All rights reserved.");?><br /> - <br /> - <?=gettext("choparp"); ?> (<a href="http://choparp.sourceforge.net/" target="_blank">http://choparp.sourceforge.net</a>)<br /> - <?=gettext("Copyright"); ?> © 1997 Takamichi Tateoka (tree@mma.club.uec.ac.jp)<br /> - <?=gettext("Copyright"); ?> © 2002 Thomas Quinot (thomas@cuivre.fr.eu.org)<br /> - <br /> - <?=gettext("php-radius"); ?> (<a href="http://www.mavetju.org/programming/php.php" target="_blank">http://www.mavetju.org/programming/php.php</a>)<br /> - <?=gettext("Copyright 2000, 2001, 2002 by Edwin Groothuis. All rights reserved.");?><br /> - <?=gettext("This product includes software developed by Edwin Groothuis.");?><br /> - <br /> - <?=gettext("wol"); ?> (<a href="http://ahh.sourceforge.net/wol" target="_blank">http://ahh.sourceforge.net/wol</a>)<br /> - <?=gettext("Copyright"); ?> © 2000,2001,2002,2003,2004 Thomas Krennwallner <krennwallner@aon.at> - <br /> - <?=gettext("OpenVPN"); ?> (<a href="http://openvpn.net/" target="_blank">http://openvpn.net/</a>) - <?=gettext("Copyright (C) 2002-2005 OpenVPN Solutions LLC ");?> - <?php include("fend.inc"); ?> + <p><strong><?=gettext("m0n0wall is Copyright ");?>© <?=gettext("2002-2015 by Manuel Kasper");?> + (<a href="mailto:mk@neon1.net">mk@neon1.net</a>).<br /> + <?=gettext("All rights reserved");?>.</strong></p> + <p> <?=gettext("Redistribution and use in source and binary forms, with or without");?><br /> + <?=gettext("modification, are permitted provided that the following conditions are met");?>:<br /> + <br /> + <?=gettext("1. Redistributions of source code must retain the above copyright notice,");?><br /> + <?=gettext("this list of conditions and the following disclaimer");?>.<br /> + <br /> + <?=gettext("2. Redistributions in binary form must reproduce the above copyright");?><br /> + <?=gettext("notice, this list of conditions and the following disclaimer in the");?><br /> + <?=gettext("documentation and/or other materials provided with the distribution.");?><br /> + <br /> + <strong><?=gettext("THIS SOFTWARE IS PROVIDED ");?>"<?=gettext("AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,");?><br /> + <?=gettext("INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY");?><br /> + <?=gettext("AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE");?><br /> + <?=gettext("AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,");?><br /> + <?=gettext("OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF");?><br /> + <?=gettext("SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS");?><br /> + <?=gettext("INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN");?><br /> + <?=gettext("CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)");?><br /> + <?=gettext("ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE");?><br /> + <?=gettext("POSSIBILITY OF SUCH DAMAGE");?></strong>.</p> + <hr size="1"> + <p><?= "{$g['product_name']} " . gettext("is based upon/includes various free software packages, listed below.");?><br /> + <?php printf(gettext("The authors of %s would like to thank the authors of these software packages for their efforts"),$g['product_name']);?>.</p> + <p>FreeBSD (<a href="http://www.freebsd.org" target="_blank">http://www.freebsd.org</a>)<br /> + <?=gettext("Copyright");?> ©<?=gettext("1992-2015 The FreeBSD Project. All rights reserved");?>.<br /> + <br /> + <?=gettext("This product includes PHP, freely available from");?> <a href="http://www.php.net/" target="_blank">http://www.php.net</a>.<br /> + <?=gettext("Copyright"); ?> © <?=gettext("1999-2015 The PHP Group. All rights reserved.");?>.<br /> + <br /> + <?=gettext("LightTPD"); ?> (<a href="http://www.lighttpd.net" target="_blank">http://www.lighttpd.net)</a><br /> + <?=gettext("Copyright"); ?> ©<?=gettext("2004, Jan Knescke, incremental");?><jan@kneschke.de> + <?=gettext("All rights reserved.");?><br /> + <br /> + <?=gettext("ISC DHCP server ");?>(<a href="http://www.isc.org/products/DHCP/" target="_blank">http://www.isc.org/products/DHCP</a>)<br /> + <?=gettext("Copyright"); ?> © <?=gettext("2004-2012 Internet Software Consortium, Inc.");?><br /> + <?=gettext("Copyright"); ?> © <?=gettext("1995-2003 Internet Software Consortium");?><br /> + <br /> + <?=gettext("PF"); ?> (<a href="http://www.openbsd.org/faq/pf" target="_blank">http://www.openbsd.org</a>)<br /> + <br /> + <?=gettext("MPD - Multi-link PPP daemon for FreeBSD");?> (<a href="http://www.dellroad.org/mpd" target="_blank">http://www.dellroad.org/mpd</a>)<br /> + <?=gettext("Copyright"); ?> © 2003-2004, Archie L. Cobbs, Michael Bretterklieber, Alexander Motin<br /> + <?=gettext("All rights reserved.");?><br /> + <br /> + <?=gettext("Circular log support for FreeBSD syslogd ");?>(<a href="http://software.wheelhouse.org/syslogd/" target="_blank">http://software.wheelhouse.org/syslogd/</a>)<br /> + <?=gettext("Copyright"); ?> © 2001 Jeff Wheelhouse (jdw@wwwi.com)<br /> + <br /> + <?=gettext("Dnsmasq - a DNS forwarder for NAT firewalls");?> (<a href="http://www.thekelleys.org.uk" target="_blank">http://www.thekelleys.org.uk</a>)<br /> + <?=gettext("Copyright"); ?> © 2000-2012 Simon Kelley.<br /> + <br /> + <?=gettext("IPsec-Tools"); ?> (<a href="http://ipsec-tools.sourceforge.net/" target="_blank">http://ipsec-tools.sourceforge.net/</a>)<br /> + <?=gettext("Copyright"); ?> © <?=gettext("1995-2002 WIDE Project. All rights reserved.");?><br /> + <br /> + <?=gettext("msntp"); ?> (<a href="http://www.hpcf.cam.ac.uk/export" target="_blank">http://www.hpcf.cam.ac.uk/export</a>)<br /> + <?=gettext("Copyright"); ?> ©<?=gettext(" 1996, 1997, 2000 N.M. Maclaren, University of Cambridge. ". + "All rights reserved.");?><br /> + <br /> + <?=gettext("UCD-SNMP"); ?> (<a href="http://www.ece.ucdavis.edu/ucd-snmp" target="_blank">http://www.ece.ucdavis.edu/ucd-snmp</a>)<br /> + <?=gettext("Copyright"); ?> © <?=gettext("1989, 1991, 1992 by Carnegie Mellon University.");?><br /> + <?=gettext("Copyright"); ?> © <?=gettext("1996, 1998-2000 The Regents of the University of California. All rights reserved");?>.<br /> + <?=gettext("Copyright"); ?> © <?=gettext("2001-2002, Network Associates Technology, Inc. All rights reserved.");?><br /> + <?=gettext("Portions of this code are copyright");?> © <?=gettext("2001-2002, Cambridge Broadband Ltd. All rights reserved.");?><br /> + <br /> + <?=gettext("choparp"); ?> (<a href="http://choparp.sourceforge.net/" target="_blank">http://choparp.sourceforge.net</a>)<br /> + <?=gettext("Copyright"); ?> © 1997 Takamichi Tateoka (tree@mma.club.uec.ac.jp)<br /> + <?=gettext("Copyright"); ?> © 2002 Thomas Quinot (thomas@cuivre.fr.eu.org)<br /> + <br /> + <?=gettext("php-radius"); ?> (<a href="http://www.mavetju.org/programming/php.php" target="_blank">http://www.mavetju.org/programming/php.php</a>)<br /> + <?=gettext("Copyright 2000, 2001, 2002 by Edwin Groothuis. All rights reserved.");?><br /> + <?=gettext("This product includes software developed by Edwin Groothuis.");?><br /> + <br /> + <?=gettext("wol"); ?> (<a href="http://ahh.sourceforge.net/wol" target="_blank">http://ahh.sourceforge.net/wol</a>)<br /> + <?=gettext("Copyright"); ?> © 2000,2001,2002,2003,2004 Thomas Krennwallner <krennwallner@aon.at> + <br /> + <?=gettext("OpenVPN"); ?> (<a href="http://openvpn.net/" target="_blank">http://openvpn.net/</a>) + <?=gettext("Copyright (C) 2002-2005 OpenVPN Solutions LLC ");?> + </p> + <?php include("fend.inc"); ?> </body> </html> diff --git a/usr/local/www/shortcuts.inc b/usr/local/www/shortcuts.inc index 1b141cf..d1b1d2b 100644 --- a/usr/local/www/shortcuts.inc +++ b/usr/local/www/shortcuts.inc @@ -42,102 +42,120 @@ $shortcuts = array(); /* Load and process custom shortcuts. */ function get_shortcut_files($directory) { $dir_array = array(); - if(!is_dir($directory)) + if (!is_dir($directory)) { return; + } if ($dh = opendir($directory)) { while (($file = readdir($dh)) !== false) { $canadd = 0; - if($file == ".") + if ($file == ".") { $canadd = 1; - if($file == "..") + } + if ($file == "..") { $canadd = 1; - if($canadd == 0) + } + if ($canadd == 0) { array_push($dir_array, $file); + } } closedir($dh); } - if(!is_array($dir_array)) + if (!is_array($dir_array)) { return; + } return $dir_array; } function get_shortcut_by_service_name($servicename) { global $shortcuts; foreach ($shortcuts as $name => $shortcut) { - if (!empty($shortcut['service']) && ($shortcut['service'] == $servicename)) + if (!empty($shortcut['service']) && ($shortcut['service'] == $servicename)) { return $name; + } } return null; } function get_shortcut_main_link($shortcut_section, $addspace = true, $service = array()) { global $g, $shortcuts; - if(empty($shortcut_section)) + if (empty($shortcut_section)) { return ""; + } $space = ($addspace) ? " " : "" ; switch ($shortcut_section) { case "openvpn": - if (!empty($service['mode']) && is_numeric($service['id'])) + if (!empty($service['mode']) && is_numeric($service['id'])) { $link = "vpn_openvpn_{$service['mode']}.php?act=edit&id={$service['id']}"; - else + } else { $link = $shortcuts[$shortcut_section]['main']; + } break; case "captiveportal": - if (!empty($service['zone'])) + if (!empty($service['zone'])) { $link = "services_captiveportal.php?zone={$service['zone']}"; - else + } else { $link = $shortcuts[$shortcut_section]['main']; + } break; default: $link = $shortcuts[$shortcut_section]['main']; break; } - if(!empty($link) && ($_SERVER['REQUEST_URI'] != "/{$link}")) + if (!empty($link) && ($_SERVER['REQUEST_URI'] != "/{$link}")) { return "{$space}<a href=\"{$link}\" title=\"" . gettext("Main page for this section") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\" border=\"0\" alt=\"plus\" /></a>"; + } } function get_shortcut_status_link($shortcut_section, $addspace = true, $service = array()) { global $g, $shortcuts, $cpzone; - if(empty($shortcut_section)) + if (empty($shortcut_section)) { return ""; + } $space = ($addspace) ? " " : "" ; - if (!empty($cpzone)) + if (!empty($cpzone)) { $zone = $cpzone; - elseif (!empty($service['zone'])) + } elseif (!empty($service['zone'])) { $zone = $service['zone']; + } switch ($shortcut_section) { case "captiveportal": - if (!empty($zone)) + if (!empty($zone)) { $link = "status_captiveportal.php?zone={$zone}"; - else + } else { $link = $shortcuts[$shortcut_section]['status']; + } break; default: $link = $shortcuts[$shortcut_section]['status']; break; } - if(!empty($link)) + if (!empty($link)) { return "{$space}<a href=\"{$link}\" title=\"" . gettext("Status of items on this page") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_service_status.gif\" border=\"0\" alt=\"status\" /></a>"; + } } function get_shortcut_log_link($shortcut_section, $addspace = true) { global $g, $shortcuts; $space = ($addspace) ? " " : "" ; - if(!empty($shortcut_section) && !empty($shortcuts[$shortcut_section]['log'])) { + if (!empty($shortcut_section) && !empty($shortcuts[$shortcut_section]['log'])) { return "{$space}<a href=\"{$shortcuts[$shortcut_section]['log']}\" title=\"" . gettext("Log entries for items on this page") . "\"><img style=\"vertical-align:middle\" src=\"/themes/{$g['theme']}/images/icons/icon_logs.gif\" border=\"0\" alt=\"logs\" /></a>"; } } // Load shortcuts $dir_array = get_shortcut_files("/usr/local/www/shortcuts"); -foreach ($dir_array as $file) - if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file,".inc")) +foreach ($dir_array as $file) { + if (!is_dir("/usr/local/www/shortcuts/{$file}") && stristr($file,".inc")) { include("/usr/local/www/shortcuts/{$file}"); -if(is_dir("/usr/local/pkg/shortcuts")) { + } +} +if (is_dir("/usr/local/pkg/shortcuts")) { $dir_array = get_shortcut_files("/usr/local/pkg/shortcuts"); - foreach ($dir_array as $file) - if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file,".inc")) + foreach ($dir_array as $file) { + if (!is_dir("/usr/local/pkg/shortcuts/{$file}") && stristr($file,".inc")) { include("/usr/local/pkg/shortcuts/{$file}"); + } + } } $shortcuts['relayd'] = array(); diff --git a/usr/local/www/stats.php b/usr/local/www/stats.php index e263983..6f34673 100644 --- a/usr/local/www/stats.php +++ b/usr/local/www/stats.php @@ -5,17 +5,17 @@ Copyright (C) 2013-2015 Electric Sheep Fencing, LP Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com> All rights reserved. - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE diff --git a/usr/local/www/status.php b/usr/local/www/status.php index e26f8a6..8cdc87a 100755 --- a/usr/local/www/status.php +++ b/usr/local/www/status.php @@ -8,7 +8,7 @@ * */ /* - Copyright (C) 2013-2015 Electric Sheep Fencing, LP + Copyright (C) 2013-2015 Electric Sheep Fencing, LP All rights reserved. Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. */ /* - pfSense_BUILDER_BINARIES: /usr/bin/vmstat /usr/bin/netstat /sbin/dmesg /sbin/mount /sbin/setkey /usr/local/sbin/pftop + pfSense_BUILDER_BINARIES: /usr/bin/vmstat /usr/bin/netstat /sbin/dmesg /sbin/mount /sbin/setkey /usr/local/sbin/pftop pfSense_BUILDER_BINARIES: /sbin/pfctl /sbin/sysctl /usr/bin/top /usr/bin/netstat /sbin/pfctl /sbin/ifconfig pfSense_MODULE: support */ @@ -95,8 +95,8 @@ function doCmdT($title, $command) { echo htmlspecialchars($execOutput[$i],ENT_NOQUOTES); } } - echo "\n\t\t\t</pre>\n\t\t</td>\n\t</tr>\n"; - echo "</table>\n"; + echo "\n\t\t\t</pre>\n\t\t</td>\n\t</tr>\n"; + echo "</table>\n"; } /* Execute a command, giving it a title which is the same as the command. */ @@ -154,8 +154,9 @@ defCmdT("sysctl hw.physmem","/sbin/sysctl hw.physmem"); if (isset($config['captiveportal']) && is_array($config['captiveportal'])) { foreach ($config['captiveportal'] as $cpZone => $cpdata) { - if (isset($cpdata['enable'])) + if (isset($cpdata['enable'])) { defCmdT("ipfw -x {$cpdata['zoneid']} show", "/sbin/ipfw -x {$cpdata['zoneid']} show"); + } } } @@ -197,14 +198,14 @@ defCmdT("ipsec.conf","cat /var/etc/ipsec/ipsec.conf"); defCmdT("SPD","/sbin/setkey -DP"); defCmdT("SAD","/sbin/setkey -D"); -if(isset($config['system']['usefifolog'])) { +if (isset($config['system']['usefifolog'])) { defCmdT("last 200 system log entries","/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 200"); defCmdT("last 50 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50"); } else { defCmdT("last 200 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200"); defCmdT("last 50 filter log entries","/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50"); } - + defCmd("ls /conf"); defCmd("ls /var/run"); diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index 01f1279..a0fb72a 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -48,11 +48,13 @@ function xmlrpc_loop_detect() { global $config; /* grab sync to ip if enabled */ - if ($config['hasync']) + if ($config['hasync']) { $synchronizetoip = $config['hasync']['synchronizetoip']; - if($synchronizetoip) { - if($synchronizetoip == $_SERVER['REMOTE_ADDR']) - return true; + } + if ($synchronizetoip) { + if ($synchronizetoip == $_SERVER['REMOTE_ADDR']) { + return true; + } } return false; @@ -90,17 +92,18 @@ function exec_php_xmlrpc($raw_params) { global $config, $xmlrpc_g; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } $exec_php = $params[0]; eval($exec_php); - if($toreturn) { + if ($toreturn) { $response = XML_RPC_encode($toreturn); return new XML_RPC_Response($response); - } else + } else { return $xmlrpc_g['return']['true']; + } } /*****************************/ @@ -117,7 +120,7 @@ function exec_shell_xmlrpc($raw_params) { global $config, $xmlrpc_g; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -146,7 +149,7 @@ function backup_config_section_xmlrpc($raw_params) { } $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -176,7 +179,7 @@ function restore_config_section_xmlrpc($raw_params) { } $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -225,24 +228,27 @@ function restore_config_section_xmlrpc($raw_params) { } } - // For vip section, first keep items sent from the master + // For vip section, first keep items sent from the master $config = array_merge_recursive_unique($config, $params[0]); - /* Then add ipalias and proxyarp types already defined on the backup */ + /* Then add ipalias and proxyarp types already defined on the backup */ if (is_array($vipbackup) && !empty($vipbackup)) { - if (!is_array($config['virtualip'])) + if (!is_array($config['virtualip'])) { $config['virtualip'] = array(); - if (!is_array($config['virtualip']['vip'])) + } + if (!is_array($config['virtualip']['vip'])) { $config['virtualip']['vip'] = array(); - foreach ($vipbackup as $vip) + } + foreach ($vipbackup as $vip) { array_unshift($config['virtualip']['vip'], $vip); + } } /* Log what happened */ $mergedkeys = implode(",", array_merge(array_keys($params[0]), $sync_full_done)); write_config(sprintf(gettext("Merged in config (%s sections) from XMLRPC client."),$mergedkeys)); - /* + /* * The real work on handling the vips specially * This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps */ @@ -268,37 +274,42 @@ function restore_config_section_xmlrpc($raw_params) { } switch ($vip['mode']) { - case "proxyarp": - $anyproxyarp = true; - break; - case "ipalias": - interface_ipalias_configure($vip); - break; - case "carp": - if ($carp_setuped == false) - $carp_setuped = true; - interface_carp_configure($vip); - break; + case "proxyarp": + $anyproxyarp = true; + break; + case "ipalias": + interface_ipalias_configure($vip); + break; + case "carp": + if ($carp_setuped == false) { + $carp_setuped = true; + } + interface_carp_configure($vip); + break; } } /* Cleanup remaining old carps */ foreach ($oldvips as $oldvipar) { $oldvipif = get_real_interface($oldvipar['interface']); if (!empty($oldvipif)) { - if (is_ipaddrv6($oldvipar['subnet'])) + if (is_ipaddrv6($oldvipar['subnet'])) { mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete"); - else + } else { pfSense_interface_deladdress($oldvipif, $oldvipar['subnet']); + } } } - if ($carp_setuped == true) + if ($carp_setuped == true) { interfaces_sync_setup(); - if ($anyproxyarp == true) + } + if ($anyproxyarp == true) { interface_proxyarp_configure(); + } } - if (isset($old_config['ipsec']['enable']) !== isset($config['ipsec']['enable'])) + if (isset($old_config['ipsec']['enable']) !== isset($config['ipsec']['enable'])) { vpn_ipsec_configure(); + } unset($old_config); @@ -324,7 +335,7 @@ function merge_installedpackages_section_xmlrpc($raw_params) { } $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -354,7 +365,7 @@ function merge_config_section_xmlrpc($raw_params) { } $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -366,7 +377,7 @@ function merge_config_section_xmlrpc($raw_params) { } /*****************************/ -$filter_configure_doc = gettext("Basic XMLRPC wrapper for filter_configure. This method must be called with one paramater: a string containing the local system\'s password. This function returns true upon completion."); +$filter_configure_doc = gettext("Basic XMLRPC wrapper for filter_configure. This method must be called with one parameter: a string containing the local system\'s password. This function returns true upon completion."); $filter_configure_sig = array( array( $XML_RPC_Boolean, @@ -378,7 +389,7 @@ function filter_configure_xmlrpc($raw_params) { global $xmlrpc_g, $config; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -388,15 +399,16 @@ function filter_configure_xmlrpc($raw_params) { relayd_configure(); require_once("openvpn.inc"); openvpn_resync_all(); - if (isset($config['dnsmasq']['enable'])) + if (isset($config['dnsmasq']['enable'])) { services_dnsmasq_configure(); - elseif (isset($config['unbound']['enable'])) + } elseif (isset($config['unbound']['enable'])) { services_unbound_configure(); - else + } else { # Both calls above run services_dhcpd_configure(), then we just - # need to call it when them are not called to avoid restart dhcpd + # need to call it when they are not called to avoid restarting dhcpd # twice, as described on ticket #3797 services_dhcpd_configure(); + } local_sync_accounts(); return $xmlrpc_g['return']['true']; @@ -420,7 +432,7 @@ function interfaces_carp_configure_xmlrpc($raw_params) { } $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -443,7 +455,7 @@ function check_firmware_version_xmlrpc($raw_params) { global $xmlrpc_g, $XML_RPC_String; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -454,21 +466,21 @@ function check_firmware_version_xmlrpc($raw_params) { $pfsense_firmware_version_doc = gettext("Basic XMLRPC wrapper for check_firmware_version. This function will return the output of check_firmware_version upon completion."); $pfsense_firmware_version_sig = array ( - array ( - $XML_RPC_Struct, - $XML_RPC_String - ) + array ( + $XML_RPC_Struct, + $XML_RPC_String + ) ); function pfsense_firmware_version_xmlrpc($raw_params) { - global $xmlrpc_g; + global $xmlrpc_g; - $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + $params = xmlrpc_params_to_php($raw_params); + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } - return new XML_RPC_Response(XML_RPC_encode(host_firmware_version())); + return new XML_RPC_Response(XML_RPC_encode(host_firmware_version())); } /*****************************/ @@ -478,7 +490,7 @@ function reboot_xmlrpc($raw_params) { global $xmlrpc_g; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } @@ -502,13 +514,14 @@ function get_notices_xmlrpc($raw_params) { global $g, $xmlrpc_g; $params = xmlrpc_params_to_php($raw_params); - if(!xmlrpc_auth($params)) { + if (!xmlrpc_auth($params)) { xmlrpc_authfail(); return $xmlrpc_g['return']['authfail']; } - if(!function_exists("get_notices")) + if (!function_exists("get_notices")) { require("notices.inc"); - if(!$params) { + } + if (!$params) { $toreturn = get_notices(); } else { $toreturn = get_notices($params); @@ -522,13 +535,13 @@ $xmlrpclockkey = lock('xmlrpc', LOCK_EX); /*****************************/ $server = new XML_RPC_Server( - array( + array( 'pfsense.exec_shell' => array('function' => 'exec_shell_xmlrpc', 'signature' => $exec_shell_sig, 'docstring' => $exec_shell_doc), 'pfsense.exec_php' => array('function' => 'exec_php_xmlrpc', 'signature' => $exec_php_sig, - 'docstring' => $exec_php_doc), + 'docstring' => $exec_php_doc), 'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc', 'signature' => $filter_configure_sig, 'docstring' => $filter_configure_doc), @@ -545,7 +558,7 @@ $server = new XML_RPC_Server( 'docstring' => $merge_config_section_doc), 'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc', 'signature' => $merge_config_section_sig, - 'docstring' => $merge_config_section_doc), + 'docstring' => $merge_config_section_doc), 'pfsense.check_firmware_version' => array('function' => 'check_firmware_version_xmlrpc', 'signature' => $check_firmware_version_sig, 'docstring' => $check_firmware_version_doc), @@ -557,22 +570,23 @@ $server = new XML_RPC_Server( 'docstring' => $reboot_doc), 'pfsense.get_notices' => array('function' => 'get_notices_xmlrpc', 'signature' => $get_notices_sig) - ) + ) ); unlock($xmlrpclockkey); - function array_overlay($a1,$a2) - { - foreach($a1 as $k => $v) { - if(!array_key_exists($k,$a2)) continue; - if(is_array($v) && is_array($a2[$k])){ - $a1[$k] = array_overlay($v,$a2[$k]); - }else{ - $a1[$k] = $a2[$k]; - } - } - return $a1; - } +function array_overlay($a1,$a2) { + foreach ($a1 as $k => $v) { + if (!array_key_exists($k,$a2)) { + continue; + } + if (is_array($v) && is_array($a2[$k])) { + $a1[$k] = array_overlay($v,$a2[$k]); + } else { + $a1[$k] = $a2[$k]; + } + } + return $a1; +} ?> |