Replace fixed path with docroot variable

This commit is contained in:
bergware
2016-10-24 09:44:19 +02:00
parent 594db1b286
commit d76573653a
6 changed files with 18 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ Cond="glob('/boot/config/plugins-error/*.plg')"
?>
<?
require_once('plugins/dynamix.plugin.manager/include/PluginHelpers.php');
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
echo "<table class='tablesorter' id='plugin_table'><thead>";
echo "<tr><th>Plugin File</th><th>Status</th></tr>";

View File

@@ -16,7 +16,7 @@ Cond="glob('/boot/config/plugins-stale/*.plg')"
?>
<?
require_once('plugins/dynamix.plugin.manager/include/PluginHelpers.php');
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
echo "<table class='tablesorter plugins shift' id='plugin_table'><thead>";
echo "<tr><th></th><th>Plugin</th><th>Author</th><th>Version</th><th>Status</th><th></th></tr>";

View File

@@ -11,9 +11,12 @@
*/
?>
<?
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// Invoke the plugin command with indicated method
function plugin($method, $arg = '') {
exec("/usr/local/emhttp/plugins/dynamix.plugin.manager/scripts/plugin $method $arg", $output, $retval);
global $docroot;
exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin $method $arg", $output, $retval);
if ($retval != 0) return false;
return implode("\n", $output);
}

View File

@@ -18,11 +18,13 @@
</head>
<body style="margin:14px 10px">
<?
require_once 'webGui/include/Markdown.php';
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Markdown.php";
$file = $_GET['file'];
if (file_exists($file)) echo Markdown(file_get_contents($file)); else echo Markdown("*No release notes available!*");
?>
<br><center><input type="button" value="Done" onclick="top.Shadowbox.close()"></center>
<br><div style="text-align:center"><input type="button" value="Done" onclick="top.Shadowbox.close()"></div>
</body>
</html>

View File

@@ -11,8 +11,9 @@
*/
?>
<?
require_once 'webGui/include/Markdown.php';
require_once 'plugins/dynamix.plugin.manager/include/PluginHelpers.php';
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Markdown.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$current = parse_ini_file('/etc/unraid-version');
foreach (glob("/var/log/plugins/*.plg", GLOB_NOSORT) as $plugin_link) {
@@ -73,7 +74,7 @@ foreach (glob("/var/log/plugins/*.plg", GLOB_NOSORT) as $plugin_link) {
$version_info .= "&nbsp;<a href='#' title='View Release Notes' onclick=\"openBox('/plugins/dynamix.plugin.manager/include/ShowChanges.php?file=".urlencode($txtfile)."','Release Notes',600,900); return false\"><img src='/webGui/images/information.png' class='icon'></a>";
}
// action
$action = strpos($plugin_file, "/usr/local/emhttp/plugins") !== 0 ? make_link("remove", basename($plugin_file)) : "built-in";
$action = strpos($plugin_file, "$docroot/plugins") !== 0 ? make_link("remove", basename($plugin_file)) : "built-in";
// write plugin information
echo "<tr>";
echo "<td style='vertical-align:top;width:64px'><p style='text-align:center'>{$link}</p></td>";

View File

@@ -12,15 +12,16 @@
*/
?>
<?
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
require_once '/usr/local/emhttp/plugins/dynamix.plugin.manager/include/PluginHelpers.php';
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
exec("wget -qO /dev/null 127.0.0.1:$(lsof -i -P -sTCP:LISTEN|grep -Pom1 '^emhttp.*:\K\d+')/update.htm?cmdStatus=apply");
$current = parse_ini_file('/etc/unraid-version');
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
$notify = '/usr/local/emhttp/webGui/scripts/notify';
$notify = "$docroot/webGui/scripts/notify";
$server = strtoupper($var['NAME']);
$output = $unraid['notify']['plugin'];