summaryrefslogtreecommitdiffstats
path: root/usr/local/www/shortcuts.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2012-08-14 13:44:35 -0400
committerjim-p <jimp@pfsense.org>2012-08-14 13:44:35 -0400
commit0f5d612aef080905a7bcb97dffa93eb757c28b3b (patch)
tree91c74148f5e4338c6957532fec41715ef205d118 /usr/local/www/shortcuts.inc
parent6c6f9253b85e4c1d1876cb4b3411d992a1290e84 (diff)
downloadpfsense-0f5d612aef080905a7bcb97dffa93eb757c28b3b.zip
pfsense-0f5d612aef080905a7bcb97dffa93eb757c28b3b.tar.gz
Add (c) header, also add ability to glob in shortcuts so packages can use it too.
Diffstat (limited to 'usr/local/www/shortcuts.inc')
-rw-r--r--usr/local/www/shortcuts.inc74
1 files changed, 69 insertions, 5 deletions
diff --git a/usr/local/www/shortcuts.inc b/usr/local/www/shortcuts.inc
index 9b7b44c..f19e390 100644
--- a/usr/local/www/shortcuts.inc
+++ b/usr/local/www/shortcuts.inc
@@ -1,7 +1,76 @@
<?php
+/* $Id$ */
+/*
+ Copyright (C) 2012 Jim Pingle
+ All rights reserved.
+
+ Copyright (C) 2007, 2008 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
+ 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: system
+*/
+
// On the page, add in like so:
// $shortcut_section = "relayd";
+/* Load and process custom shortcuts. */
+function get_shortcut_files($directory) {
+ $dir_array = array();
+ if(!is_dir($directory))
+ return;
+ if ($dh = opendir($directory)) {
+ while (($file = readdir($dh)) !== false) {
+ $canadd = 0;
+ if($file == ".")
+ $canadd = 1;
+ if($file == "..")
+ $canadd = 1;
+ if($canadd == 0)
+ array_push($dir_array, $file);
+ }
+ closedir($dh);
+ }
+ if(!is_array($dir_array))
+ return;
+ return $dir_array;
+}
+
+// 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"))
+ include("/usr/local/www/shortcuts/{$file}");
+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"))
+ include("/usr/local/pkg/shortcuts/{$file}");
+}
+
$shortcuts['relayd'] = array();
$shortcuts['relayd']['main'] = "load_balancer_pool.php";
$shortcuts['relayd']['log'] = "diag_logs_relayd.php";
@@ -93,11 +162,6 @@ $shortcuts['ntp']['log'] = "diag_logs_ntpd.php";
$shortcuts['ntp']['status'] = "status_ntpd.php";
$shortcuts['ntp']['service'] = "ntpd";
-$shortcuts['upnp'] = array();
-$shortcuts['upnp']['main'] = "pkg_edit.php?xml=miniupnpd.xml&id=0";
-$shortcuts['upnp']['status'] = "status_upnp.php";
-$shortcuts['upnp']['service'] = "miniupnpd";
-
$shortcuts['pptps'] = array();
$shortcuts['pptps']['main'] = "vpn_pptp.php";
$shortcuts['pptps']['log'] = "diag_logs_vpn.php";
OpenPOWER on IntegriCloud