Commit 21abc362 authored by Franco Fichtner's avatar Franco Fichtner

shortcuts: fix warning and revive miniupnpd file

While there, don't expose the main include file to the web server.
parent f958a962
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2012 Jim Pingle
......@@ -34,11 +35,11 @@
$shortcuts = array();
/* Load and process custom shortcuts. */
function get_shortcut_files($directory) {
function get_shortcut_files($directory)
{
$dir_array = array();
if(!is_dir($directory))
return;
if ($dh = opendir($directory)) {
if ($dh = @opendir($directory)) {
while (($file = readdir($dh)) !== false) {
$canadd = 0;
if($file == ".")
......@@ -50,8 +51,7 @@ function get_shortcut_files($directory) {
}
closedir($dh);
}
if(!is_array($dir_array))
return;
return $dir_array;
}
......@@ -132,15 +132,11 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) {
}
// 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"))
$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();
......@@ -271,4 +267,3 @@ $shortcuts['authentication']['status'] = "diag_authentication.php";
$shortcuts['aliases'] = array();
$shortcuts['aliases']['main'] = "firewall_aliases.php";
$shortcuts['aliases']['status'] = "diag_tables.php";
?>
<?php
global $shortcuts;
$shortcuts['upnp'] = array();
$shortcuts['upnp']['main'] = "pkg_edit.php?xml=miniupnpd.xml";
$shortcuts['upnp']['log'] = "diag_logs_routing.php";
$shortcuts['upnp']['status'] = "status_upnp.php";
$shortcuts['upnp']['service'] = "miniupnpd";
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment