diff options
Diffstat (limited to 'usr/local/www/widgets')
18 files changed, 332 insertions, 208 deletions
diff --git a/usr/local/www/widgets/include/wake_on_lan.inc b/usr/local/www/widgets/include/wake_on_lan.inc new file mode 100644 index 0000000..af3229c --- /dev/null +++ b/usr/local/www/widgets/include/wake_on_lan.inc @@ -0,0 +1,7 @@ +<?php + +//set variable for custom title +$wake_on_lan_title = "Wake On Lan"; +$wake_on_lan_title_link = "services_wol.php"; + +?>
\ No newline at end of file diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 1ca7007..d240d69 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -32,10 +32,13 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("globals.inc"); require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); +require_once("captiveportal.inc"); ?> @@ -55,7 +58,7 @@ function clientcmp($a, $b) { $cpdb = array(); if (file_exists("{$g['vardb_path']}/captiveportal.db")) { - $captiveportallck = lock('captiveportal'); + $captiveportallck = lock('captiveportaldb'); $cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); unlock($captiveportallck); } else diff --git a/usr/local/www/widgets/widgets/carp_status.widget.php b/usr/local/www/widgets/widgets/carp_status.widget.php index 6399579..a671308 100644 --- a/usr/local/www/widgets/widgets/carp_status.widget.php +++ b/usr/local/www/widgets/widgets/carp_status.widget.php @@ -27,10 +27,13 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); require_once("/usr/local/www/widgets/include/carp_status.inc"); + ?> <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> <?php diff --git a/usr/local/www/widgets/widgets/gateways.widget.php b/usr/local/www/widgets/widgets/gateways.widget.php index db6a83a..4abe524 100644 --- a/usr/local/www/widgets/widgets/gateways.widget.php +++ b/usr/local/www/widgets/widgets/gateways.widget.php @@ -26,6 +26,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/gmirror_status.widget.php b/usr/local/www/widgets/widgets/gmirror_status.widget.php index cd73a0f..cbbead2 100644 --- a/usr/local/www/widgets/widgets/gmirror_status.widget.php +++ b/usr/local/www/widgets/widgets/gmirror_status.widget.php @@ -25,6 +25,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("/usr/local/www/widgets/include/gmirror_status.inc"); if ($_GET['textonly'] == "true") { diff --git a/usr/local/www/widgets/widgets/installed_packages.widget.php b/usr/local/www/widgets/widgets/installed_packages.widget.php index 6795d36..3ecb0ec 100644 --- a/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -1,36 +1,38 @@ <?php /* - $Id$ - Copyright 2007 Scott Dale - Part of pfSense widgets (www.pfsense.com) - originally based on m0n0wall (http://m0n0.ch/wall) + $Id$ + Copyright 2007 Scott Dale + Part of pfSense widgets (www.pfsense.com) + originally based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net> - and Jonathan Watt <jwatt@jwatt.org>. - All rights reserved. + Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net> + and Jonathan Watt <jwatt@jwatt.org>. + 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. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); @@ -48,76 +50,69 @@ $updateavailable = false; ?> <table width="100%" border="0" cellpadding="6" cellspacing="0"> - <tr> - <td width="15%" class="listhdrr">Package Name</td> - <td width="15%" class="listhdrr">Category</td> - <td width="30%" class="listhdrr">Package Version</td> - </tr> - <?php - if($config['installedpackages']['package'] != "") { - $instpkgs = array(); - foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name']; - asort($instpkgs); - $y=1; - foreach ($instpkgs as $index => $pkgname){ - + <tr> + <td width="15%" class="listhdrr">Package Name</td> + <td width="15%" class="listhdrr">Category</td> + <td width="30%" class="listhdrr">Package Version</td> + </tr> + <?php + if($config['installedpackages']['package'] != "") { + $instpkgs = array(); + foreach($config['installedpackages']['package'] as $instpkg) + $instpkgs[] = $instpkg['name']; + natcasesort($instpkgs); + $y=1; + foreach ($instpkgs as $index => $pkgname){ + $pkg = $config['installedpackages']['package'][$index]; - if($pkg['name'] <> "") { - ?> - <tr valign="top"> - <td class="listlr"> - <?= $pkg['name'] ?> - </td> - <td class="listlr"> - <?= $pkg['category'] ?> - </td> - <td class="listlr"> - <?php - $latest_package = $currentvers[$pkg['name']]['version']; - if($latest_package == false) - { - // We can't determine this package's version status. - echo "Current: Unknown.<br>Installed: " . $pkg['version']; - } - elseif(strcmp($pkg['version'], $latest_package) > 0) - { - /* we're running a newer version of the package */ - echo "Current: {$latest_package}"; - echo "<br>Installed: {$pkg['version']}"; - } - elseif(strcmp($pkg['version'], $latest_package) < 0) - { - /* our package is out of date */ - $updateavailable = true; - ?> - <div id="updatediv-<?php echo $y; ?>" style="color:red"> - <b>Update Available!</b></div><div style="float:left"> - Current: <?php echo $latest_package; ?><br/> - Installed: <?php echo $pkg['version']; ?></div><div style="float:right"> - <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Update this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0"</a> - </div> - <?php $y++; - } - else - { - echo $pkg['version']; - } - ?></td> - </tr> - <?php - } - } - } else { - echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>"; - } - ?> - </table> - + if($pkg['name'] <> "") { ?> + <tr valign="top"> + <td class="listlr"> + <?= $pkg['name'] ?> + </td> + <td class="listlr"> + <?= $pkg['category'] ?> + </td> + <td class="listlr"> + <?php + $latest_package = $currentvers[$pkg['name']]['version']; + if($latest_package == false) { + // We can't determine this package's version status. + echo "Current: Unknown.<br>Installed: " . $pkg['version']; + } elseif(strcmp($pkg['version'], $latest_package) > 0) { + /* we're running a newer version of the package */ + echo "Current: {$latest_package}"; + echo "<br>Installed: {$pkg['version']}"; + } elseif(strcmp($pkg['version'], $latest_package) < 0) { + /* our package is out of date */ + $updateavailable = true; + ?> + <div id="updatediv-<?php echo $y; ?>" style="color:red"> + <b>Update Available!</b></div><div style="float:left"> + Current: <?php echo $latest_package; ?><br/> + Installed: <?php echo $pkg['version']; ?></div><div style="float:right"> + <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Update this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" width="17" height="17" border="0"/></a> + </div> + <?php + $y++; + } else { + echo $pkg['version']; + } ?> + </td> + </tr> + <?php } + } + } else { + echo "<tr><td colspan=\"5\"><center>There are no packages currently installed.</td></tr>"; + } + ?> +</table> + <?php if ($updateavailable): ?> <script language="javascript" type="text/javascript"> window.onload = function(in_event) - { - for (y=1; y<=<?php echo $y;?>; y++){ + { + for (y=1; y<=<?php echo $y;?>; y++){ textID = "updatediv-" + y; Effect.Pulsate(textID,{from:0.1}); } diff --git a/usr/local/www/widgets/widgets/interface_statistics.widget.php b/usr/local/www/widgets/widgets/interface_statistics.widget.php index 3fcf8a6..7dca538 100644 --- a/usr/local/www/widgets/widgets/interface_statistics.widget.php +++ b/usr/local/www/widgets/widgets/interface_statistics.widget.php @@ -31,6 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/interfaces.widget.php b/usr/local/www/widgets/widgets/interfaces.widget.php index d74f690..626e067 100644 --- a/usr/local/www/widgets/widgets/interfaces.widget.php +++ b/usr/local/www/widgets/widgets/interfaces.widget.php @@ -30,6 +30,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php index 4966dd7..dd0c10e 100644 --- a/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -31,6 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("functions.inc"); require_once("ipsec.inc"); diff --git a/usr/local/www/widgets/widgets/load_balancer_status.widget.php b/usr/local/www/widgets/widgets/load_balancer_status.widget.php index c1cf979..63f8bc4 100644 --- a/usr/local/www/widgets/widgets/load_balancer_status.widget.php +++ b/usr/local/www/widgets/widgets/load_balancer_status.widget.php @@ -1,137 +1,144 @@ <?php /* - $Id$ - Copyright 2007 Scott Dale - Part of pfSense widgets (www.pfsense.com) - originally based on m0n0wall (http://m0n0.ch/wall) + Copyright 2010 Jim Pingle + Portions copied from status_lb_pool.php, status_lb_vs.php, and vslb.inc: + Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>. + Copyright (C) 2005-2008 Bill Marquette - Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net> - and Jonathan Watt <jwatt@jwatt.org>. - All rights reserved. + Part of pfSense widgets (www.pfsense.com) + originally based on m0n0wall (http://m0n0.ch/wall) - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net> + and Jonathan Watt <jwatt@jwatt.org>. + All rights reserved. - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 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. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 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. + 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. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); +require_once("vslb.inc"); + +$now = time(); +$year = date("Y"); - if (!is_array($config['load_balancer']['lbpool'])) { +if (!is_array($config['load_balancer']['lbpool'])) { $config['load_balancer']['lbpool'] = array(); - } - if (!is_array($config['load_balancer']['virtual_server'])) { - $config['load_balancer']['virtual_server'] = array(); - } - $a_vs = &$config['load_balancer']['virtual_server']; - $a_pool = &$config['load_balancer']['lbpool']; - - $slbd_logfile = "{$g['varlog_path']}/slbd.log"; - - $nentries = $config['syslog']['nentries']; - if (!$nentries) - $nentries = 50; - - $now = time(); - $year = date("Y"); - - +} +if (!is_array($config['load_balancer']['virtual_server'])) { + $config['load_balancer']['virtual_server'] = array(); +} +$a_vs = &$config['load_balancer']['virtual_server']; +$a_pool = &$config['load_balancer']['lbpool']; +$rdr_a = get_lb_redirects(); +$relay_hosts = get_lb_summary(); + +$lb_logfile = "{$g['varlog_path']}/relayd.log"; +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + ?> - <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="10%" class="listhdrr">Name</td> - <td width="10%" class="listhdrr">Port</td> - <td width="10%" class="listhdrr">Servers</td> - <td width="30%" class="listhdrr">Status</td> - <td width="30%" class="listhdr">Description</td> - </tr> - <?php $i = 0; foreach ($a_vs as $vsent): ?> - <tr> - <td class="listlr"> - <?=$vsent['name'];?> - </td> - <td class="listr" align="center" > - <?=$vsent['port'];?> - <br /> - </td> - <td class="listr" align="center" > - <table border="0" cellpadding="0" cellspacing="2"> - <?php - foreach ($a_pool as $vipent) { - if ($vipent['name'] == $vsent['pool']) { - foreach ((array) $vipent['servers'] as $server) { - PRINT "<tr><td> {$server} </td></tr>"; - } +<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td width="10%" class="listhdrr">Server</td> + <td width="10%" class="listhdrr">Pool</td> + <td width="30%" class="listhdr">Description</td> + </tr> + <?php $i = 0; foreach ($a_vs as $vsent): ?> + <tr> + <?php + switch (trim($rdr_a[$vsent['name']]['status'])) { + case 'active': + $bgcolor = "lightgreen"; + $rdr_a[$vsent['name']]['status'] = "Active"; + break; + case 'down': + $bgcolor = "lightcoral"; + $rdr_a[$vsent['name']]['status'] = "Down"; + break; + default: + $bgcolor = "lightgray"; + $rdr_a[$vsent['name']]['status'] = 'Unknown - relayd not running?'; + } + ?> + <td class="listlr"> + <?=$vsent['name'];?><br/> + <span style="background-color: <?=$bgcolor?>; display: block"><i><?=$rdr_a[$vsent['name']]['status']?></i></span> + <?=$vsent['ipaddr'].":".$vsent['port'];?><br/> + </td> + <td class="listr" align="center" > + <table border="0" cellpadding="0" cellspacing="2"> + <?php + foreach ($a_pool as $pool) { + if ($pool['name'] == $vsent['pool']) { + $pool_hosts=array(); + foreach ((array) $pool['servers'] as $server) { + $svr['ip']['addr']=$server; + $svr['ip']['state']=$relay_hosts[$pool['name'].":".$pool['port']][$server]['state']; + $svr['ip']['avail']=$relay_hosts[$pool['name'].":".$pool['port']][$server]['avail']; + $pool_hosts[]=$svr; } - } - ?> - </table> - </td> - <td class="listr" > - <table border="0" cellpadding="0" cellspacing="2"> - <?php - $poolfile = "{$g['tmp_path']}/{$vsent['name']}.pool"; - if(file_exists("$poolfile")) { - $poolstatus = file_get_contents("$poolfile"); + foreach ((array) $pool['serversdisabled'] as $server) { + $svr['ip']['addr']="$server"; + $svr['ip']['state']='disabled'; + $svr['ip']['avail']='disabled'; + $pool_hosts[]=$svr; } - foreach ($a_pool as $vipent) { - if ($vipent['name'] == $vsent['pool']) { - foreach ((array) $vipent['servers'] as $server) { - $lastchange = ""; - $monitorip = $server; - $logstates = return_clog($slbd_logfile, $nentries, array("$monitorip", "marking"), true); - $logstates = $logstates[0]; - - if(stristr($logstates, $monitorip)) { - $date = preg_split("/[ ]+/" , $logstates); - $lastchange = "$date[0] $date[1] $year $date[2]"; - } - if(stristr($poolstatus, $monitorip)) { - $online = "Online"; - $bgcolor = "lightgreen"; - $change = $now - strtotime("$lastchange"); - if($change < 300) { - $bgcolor = "khaki"; - } - } else { - $online = "Offline"; - $bgcolor = "lightcoral"; + asort($pool_hosts); + foreach ((array) $pool_hosts as $server) { + if($server['ip']['addr']!="") { + switch ($server['ip']['state']) { + case 'up': + $bgcolor = "lightgreen"; + $checked = "checked"; + break; + case 'disabled': + $bgcolor = "white"; + $checked = ""; + break; + default: + $bgcolor = "lightcoral"; + $checked = "checked"; } - PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>"; - if($lastchange <> "") { - PRINT "Last change $lastchange"; - } else { - PRINT "No changes found in logfile"; - } - PRINT "</td></tr>"; - } + echo "<tr>"; + echo "<td bgcolor={$bgcolor}> {$server['ip']['addr']}:{$pool['port']} </td><td bgcolor={$bgcolor}>"; + if($server['ip']['avail']) + echo " ({$server['ip']['avail']}) "; + echo "</td></tr>"; + } } } - ?> - </table> - </td> - <td class="listbg" > - <font color="#FFFFFF"><?=$vipent['descr'];?></font> - </td> - </tr> - <?php $i++; endforeach; ?> - </table> + } + ?> + </table> + </td> + <td class="listbg" > + <font color="#FFFFFF"><?=$vsent['descr'];?></font> + </td> + </tr> + <?php $i++; endforeach; ?> +</table> diff --git a/usr/local/www/widgets/widgets/log.widget.php b/usr/local/www/widgets/widgets/log.widget.php index c46a6ab..84f6585 100644 --- a/usr/local/www/widgets/widgets/log.widget.php +++ b/usr/local/www/widgets/widgets/log.widget.php @@ -30,6 +30,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/openvpn.widget.php b/usr/local/www/widgets/widgets/openvpn.widget.php index 25454c8..fdf2e3c 100644 --- a/usr/local/www/widgets/widgets/openvpn.widget.php +++ b/usr/local/www/widgets/widgets/openvpn.widget.php @@ -1,4 +1,7 @@ <?php + +$nocsrf = true; + require_once("openvpn.inc"); /* Handle AJAX */ diff --git a/usr/local/www/widgets/widgets/picture.widget.php b/usr/local/www/widgets/widgets/picture.widget.php index 7f25af4..90bf288 100644 --- a/usr/local/www/widgets/widgets/picture.widget.php +++ b/usr/local/www/widgets/widgets/picture.widget.php @@ -26,6 +26,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); diff --git a/usr/local/www/widgets/widgets/rss.widget.php b/usr/local/www/widgets/widgets/rss.widget.php index d81fa4d..0843684 100644 --- a/usr/local/www/widgets/widgets/rss.widget.php +++ b/usr/local/www/widgets/widgets/rss.widget.php @@ -26,6 +26,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index 862a069..f41e7f5 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -29,6 +29,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("captiveportal.inc"); require_once("service-utils.inc"); @@ -175,7 +177,14 @@ if(isset($_POST['servicestatusfilter'])) { <?php $skipservices = explode(",", str_replace(" ", "", $config['widgets']['servicestatusfilter'])); +function service_name_compare($a, $b) { + if (strtolower($a['name']) == strtolower($b['name'])) + return 0; + return (strtolower($a['name']) < strtolower($b['name'])) ? -1 : 1; +} + if (count($services) > 0) { + uasort($services, "service_name_compare"); foreach($services as $service) { if((!$service['name']) || (in_array($service['name'], $skipservices))) continue; diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 9604461..1b9683a 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -31,11 +31,12 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("functions.inc"); require_once("guiconfig.inc"); require_once('notices.inc'); - if($_REQUEST['getupdatestatus']) { if(isset($curcfg['alturl']['enable'])) $updater_url = "{$config['system']['firmware']['alturl']['firmwareurl']}"; diff --git a/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/usr/local/www/widgets/widgets/traffic_graphs.widget.php index 9d1e76c..4686d0b 100644 --- a/usr/local/www/widgets/widgets/traffic_graphs.widget.php +++ b/usr/local/www/widgets/widgets/traffic_graphs.widget.php @@ -31,6 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. */ +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); diff --git a/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/usr/local/www/widgets/widgets/wake_on_lan.widget.php new file mode 100644 index 0000000..598dc1f --- /dev/null +++ b/usr/local/www/widgets/widgets/wake_on_lan.widget.php @@ -0,0 +1,76 @@ +<?php +/* + wake_on_lan.widget.php + Copyright (C) 2010 Yehuda Katz + + 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. +*/ + +$nocsrf = true; + +require_once("/usr/local/www/widgets/include/wake_on_lan.inc"); + +if (is_array($config['wol']['wolentry'])) + $wolcomputers = $config['wol']['wolentry']; +else + $wolcomputers = array(); + +?> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <? + echo '<td class="widgetsubheader"><b><center>' . gettext("Computer / Device") . '</center></b></td>'; + echo '<td class="widgetsubheader"><b><center>' . gettext("Interface") . '</center></b></td>'; + echo '<td class="widgetsubheader"><b><center>' . gettext("Status") . '</center></b></td>'; + ?> + <td class="widgetsubheader"> </td> + </tr> +<?php + +if (count($wolcomputers) > 0) { + foreach($wolcomputers as $wolent) { + echo '<tr><td class="listlr">' . $wolent['descr'] . '<br />' . $wolent['mac'] . '</td>' . "\n"; + echo '<td class="listr">' . convert_friendly_interface_to_friendly_descr($wolent['interface']) . '</td>' . "\n"; + + $is_active = exec("/usr/sbin/arp -an |/usr/bin/grep {$wolent['mac']}| /usr/bin/wc -l|/usr/bin/awk '{print $1;}'"); + if($is_active == 1) { + echo '<td class="listr"><center>' . "\n"; + echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_pass.gif\"> " . gettext("Online") . "</td>\n"; + } else { + echo '<td class="listbg"><center>' . "\n"; + echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_block.gif\"> <font color=\"white\">" . gettext("Offline") . "</td>\n"; + } + echo '<td valign="middle" class="list" nowrap>'; + /*if($is_active) { */ + /* Will always show wake-up button even if pfsense thinks it is awake */ + /* } else { */ + echo "<a href='services_wol.php?mac={$wolent['mac']}&if={$wolent['interface']}'> "; + echo "<img title='" . gettext("Wake Up") . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_wol_all.gif'></a>\n"; + /* } */ + echo "</td></tr>\n"; + } +} else { + echo "<tr><td colspan=\"3\"><center>" . gettext("No saved WoL addresses") . ".</td></tr>\n"; +} +?> +</table> +<center><a href="status_dhcp_leases.php" class="navlink">DHCP Leases Status</a></center> |