diff --git a/plugins/dynamix.apcupsd/UPSdetails.page b/plugins/dynamix.apcupsd/UPSdetails.page
index 92b9a3b6b..d15484997 100644
--- a/plugins/dynamix.apcupsd/UPSdetails.page
+++ b/plugins/dynamix.apcupsd/UPSdetails.page
@@ -22,7 +22,7 @@ function getUPSstatus() {
$('#ups_summary').html(data[0]);
$('#ups_status').html(data[1]);
}
-0 || ($display['refresh']<0 && $var['mdResync']==0))):?>
+
setTimeout(getUPSstatus,=max(abs($display['refresh']),15000)?>);
});
@@ -32,5 +32,5 @@ $(getUPSstatus);
| Key | Value | Key | Value |
-| Please wait, retrieving UPS information... |
+| Please wait, retrieving UPS information... |
diff --git a/plugins/dynamix.apcupsd/UPSsummary.page b/plugins/dynamix.apcupsd/UPSsummary.page
index e521122ba..b217cf6b2 100644
--- a/plugins/dynamix.apcupsd/UPSsummary.page
+++ b/plugins/dynamix.apcupsd/UPSsummary.page
@@ -23,7 +23,7 @@ table.ups tbody tr td{padding-left:10px;font-weight:bold;}
function getUPSstatus() {
$.get('/plugins/dynamix.apcupsd/include/UPSstatus.php',{all:'false'},function(data) {
if (data) $('#ups_summary').html(data);
-0 || ($display['refresh']<0 && $var['mdResync']==0))):?>
+
setTimeout(getUPSstatus, =max(abs($display['refresh']),15000)?>);
});
diff --git a/plugins/dynamix.apcupsd/include/UPSstatus.php b/plugins/dynamix.apcupsd/include/UPSstatus.php
index 1ed6c7b1e..b615a2bd3 100644
--- a/plugins/dynamix.apcupsd/include/UPSstatus.php
+++ b/plugins/dynamix.apcupsd/include/UPSstatus.php
@@ -26,7 +26,7 @@ $green = "class='green-text'";
$orange = "class='orange-text'";
$status = array_fill(0,6,"- | ");
$all = $_GET['all']=='true';
-$result = array();
+$result = [];
if (file_exists("/var/run/apcupsd.pid")) {
exec("/sbin/apcaccess 2>/dev/null", $rows);
@@ -62,7 +62,7 @@ if (file_exists("/var/run/apcupsd.pid")) {
if ($all && count($rows)%2==1) $result[] = " | | ";
if ($power && $load) $status[4] = ($load>=90 ? "" : " | ").intval($power*$load/100)." Watts | ";
}
-if ($all && !$rows) $result[] = "| No information available |
";
+if ($all && !$rows) $result[] = "| No information available |
";
echo "".implode('', $status)."
";
if ($all) echo "\n".implode('', $result);
diff --git a/plugins/dynamix.docker.manager/AddContainer.page b/plugins/dynamix.docker.manager/AddContainer.page
index 3b27af837..77b4040f3 100644
--- a/plugins/dynamix.docker.manager/AddContainer.page
+++ b/plugins/dynamix.docker.manager/AddContainer.page
@@ -18,5 +18,5 @@ Markdown="false"
Advanced View
\ No newline at end of file
diff --git a/plugins/dynamix.docker.manager/DockerContainers.page b/plugins/dynamix.docker.manager/DockerContainers.page
index 85ea6a07d..149e02419 100644
--- a/plugins/dynamix.docker.manager/DockerContainers.page
+++ b/plugins/dynamix.docker.manager/DockerContainers.page
@@ -17,14 +17,14 @@ Markdown="false"
?>
// Add the Docker JSON client
-require_once '/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php';
+require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
+
$DockerClient = new DockerClient();
$DockerUpdate = new DockerUpdate();
$DockerTemplates = new DockerTemplates();
?>
-
-
@@ -33,8 +31,8 @@ if ($var['fsState'] != "Started") {
return;
}
-require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php');
-require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php');
+require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
+require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
if (count($pages)==2) $tabbed = false;
?>
\ No newline at end of file
diff --git a/plugins/dynamix.vm.manager/classes/libvirt.php b/plugins/dynamix.vm.manager/classes/libvirt.php
index e6f6d51b0..11a51ed90 100644
--- a/plugins/dynamix.vm.manager/classes/libvirt.php
+++ b/plugins/dynamix.vm.manager/classes/libvirt.php
@@ -15,7 +15,7 @@
private $conn;
private $last_error;
private $allow_cached = true;
- private $dominfos = array();
+ private $dominfos = [];
private $enabled = false;
function Libvirt($uri = false, $login = false, $pwd = false, $debug=false) {
@@ -80,7 +80,7 @@
$arrReturn = [];
if (!empty($disk['size'])) {
- $disk['size'] = str_replace(array("KB","MB","GB","TB","PB"), array("K","M","G","T","P"), strtoupper($disk['size']));
+ $disk['size'] = str_replace(["KB","MB","GB","TB","PB"], ["K","M","G","T","P"], strtoupper($disk['size']));
}
if (empty($disk['driver'])) {
$disk['driver'] = 'raw';
@@ -845,7 +845,7 @@
function connect($uri = 'null', $login = false, $password = false) {
if ($login !== false && $password !== false) {
- $this->conn=libvirt_connect($uri, false, array(VIR_CRED_AUTHNAME => $login, VIR_CRED_PASSPHRASE => $password));
+ $this->conn=libvirt_connect($uri, false, [VIR_CRED_AUTHNAME => $login, VIR_CRED_PASSPHRASE => $password]);
} else {
$this->conn=libvirt_connect($uri, false);
}
@@ -960,7 +960,7 @@
$disks = $this->get_xpath($dom, '//domain/devices/disk[@device="cdrom"]/target/@dev', false);
$files = $this->get_xpath($dom, '//domain/devices/disk[@device="cdrom"]/source/@file', false);
- $ret = array();
+ $ret = [];
for ($i = 0; $i < $disks['num']; $i++) {
$tmp = libvirt_domain_get_block_info($dom, $disks[$i]);
if ($tmp) {
@@ -970,7 +970,7 @@
else {
$this->_set_last_error();
- $ret[] = array(
+ $ret[] = [
'device' => $disks[$i],
'file' => $files[$i],
'type' => '-',
@@ -978,7 +978,7 @@
'allocation' => '-',
'physical' => '-',
'bus' => $buses[$i]
- );
+ ];
}
}
@@ -1008,7 +1008,7 @@
$disks = $this->get_xpath($dom, '//domain/devices/disk[@device="disk"]/target/@dev', false);
$files = $this->get_xpath($dom, '//domain/devices/disk[@device="disk"]/source/@*', false);
- $ret = array();
+ $ret = [];
for ($i = 0; $i < $disks['num']; $i++) {
$tmp = libvirt_domain_get_block_info($dom, $disks[$i]);
if ($tmp) {
@@ -1031,7 +1031,7 @@
else {
$this->_set_last_error();
- $ret[] = array(
+ $ret[] = [
'device' => $disks[$i],
'file' => $files[$i],
'type' => '-',
@@ -1039,7 +1039,7 @@
'allocation' => '-',
'physical' => '-',
'bus' => $buses[$i]
- );
+ ];
}
}
@@ -1300,7 +1300,7 @@
function get_node_device_cap_options() {
$all = $this->get_node_devices();
- $ret = array();
+ $ret = [];
for ($i = 0; $i < sizeof($all); $i++) {
$tmp = $this->get_node_device_caps($all[$i]);
@@ -1331,7 +1331,7 @@
}
function domain_get_info_call($name = false, $name_override = false) {
- $ret = array();
+ $ret = [];
if ($name != false) {
$dom = $this->get_domain_object($name);
@@ -1522,7 +1522,7 @@
$seed = time();
srand($seed);
- $ret = array();
+ $ret = [];
for ($i = 0; $i < 16; $i++)
$ret[] = $this->macbyte(rand() % 256);
@@ -1764,7 +1764,7 @@
if (!$tmp)
return false;
- $devs = array();
+ $devs = [];
for ($i = 0; $i < $tmp['num']; $i++)
$devs[] = $tmp[$i];
@@ -1800,7 +1800,7 @@
if (!$tmp)
return false;
- $devs = array();
+ $devs = [];
for ($i = 0; $i < $tmp['num']; $i++)
$devs[] = $tmp[$i];
@@ -1813,13 +1813,13 @@
$sources = $this->get_xpath($domain, $xpath.'/source/@dir', false);
$targets = $this->get_xpath($domain, $xpath.'/target/@dir', false);
- $ret = array();
+ $ret = [];
if (!empty($sources)) {
for ($i = 0; $i < $sources['num']; $i++) {
- $ret[] = array(
+ $ret[] = [
'source' => $sources[$i],
'target' => $targets[$i]
- );
+ ];
}
}
@@ -1852,7 +1852,7 @@
if ($display)
return $type.' ('.$targetType.' on port '.$targetPort.')';
else
- return array('type' => $type, 'targetType' => $targetType, 'targetPort' => $targetPort);
+ return ['type' => $type, 'targetType' => $targetType, 'targetPort' => $targetPort];
}
else
if ($type == 'input') {
@@ -1862,7 +1862,7 @@
if ($display)
return $type.' on '.$bus;
else
- return array('type' => $type, 'bus' => $bus);
+ return ['type' => $type, 'bus' => $bus];
}
else
if ($type == 'graphics') {
@@ -1873,7 +1873,7 @@
if ($display)
return $type.' on port '.$port.' with'.($autoport ? '' : 'out').' autoport enabled';
else
- return array('type' => $type, 'port' => $port, 'autoport' => $autoport);
+ return ['type' => $type, 'port' => $port, 'autoport' => $autoport];
}
else
if ($type == 'video') {
@@ -1884,7 +1884,7 @@
if ($display)
return $type.' with '.($vram / 1024).' MB VRAM, '.$heads.' head(s)';
else
- return array('type' => $type, 'vram' => $vram, 'heads' => $heads);
+ return ['type' => $type, 'vram' => $vram, 'heads' => $heads];
}
else
return false;
@@ -1898,11 +1898,11 @@
$slot = $this->get_xpath($domain, $xpath.'slot', false);
$func = $this->get_xpath($domain, $xpath.'function', false);
- $devs = array();
+ $devs = [];
for ($i = 0; $i < $bus['num']; $i++) {
$devid = str_replace('0x', '', 'pci_'.$dom[$i].'_'.$bus[$i].'_'.$slot[$i].'_'.$func[$i]);
$tmp2 = $this->get_node_device_information($devid);
- $devs[] = array(
+ $devs[] = [
'domain' => $dom[$i],
'bus' => $bus[$i],
'slot' => $slot[$i],
@@ -1912,7 +1912,7 @@
'vendor_id' => $tmp2['vendor_id'],
'product' => $tmp2['product_name'],
'product_id' => $tmp2['product_id']
- );
+ ];
}
// Get any pci devices contained in the qemu args
@@ -1929,10 +1929,10 @@
$keypair = explode('=', $arg);
if ($keypair[0] == 'host' && !empty($keypair[1])) {
- $devid = 'pci_0000_' . str_replace(array(':', '.'), '_', $keypair[1]);
+ $devid = 'pci_0000_' . str_replace([':', '.'], '_', $keypair[1]);
$tmp2 = $this->get_node_device_information($devid);
list($bus, $slot, $func) = explode(":", str_replace('.', ':', $keypair[1]));
- $devs[] = array(
+ $devs[] = [
'domain' => '0x0000',
'bus' => '0x' . $bus,
'slot' => '0x' . $slot,
@@ -1942,7 +1942,7 @@
'vendor_id' => $tmp2['vendor_id'],
'product' => $tmp2['product_name'],
'product_id' => $tmp2['product_id']
- );
+ ];
break;
}
}
@@ -1971,16 +1971,16 @@
$vid = $this->get_xpath($domain, $xpath.'vendor/@id', false);
$pid = $this->get_xpath($domain, $xpath.'product/@id', false);
- $devs = array();
+ $devs = [];
for ($i = 0; $i < $vid['num']; $i++) {
$dev = $this->_lookup_device_usb($vid[$i], $pid[$i]);
- $devs[] = array(
+ $devs[] = [
'id' => str_replace('0x', '', $vid[$i] . ':' . $pid[$i]),
'vendor_id' => $vid[$i],
'product_id' => $pid[$i],
'product' => $dev['product_name'],
'vendor' => $dev['vendor_name']
- );
+ ];
}
return $devs;
@@ -1992,7 +1992,7 @@
$devs_pci = $this->domain_get_host_devices_pci($domain);
$devs_usb = $this->domain_get_host_devices_usb($domain);
- return array('pci' => $devs_pci, 'usb' => $devs_usb);
+ return ['pci' => $devs_pci, 'usb' => $devs_usb];
}
function get_nic_info($domain) {
@@ -2001,7 +2001,7 @@
$bridge = $this->get_xpath($domain, "//domain/devices/interface/source/@bridge", false);
if (!$macs)
return $this->_set_last_error();
- $ret = array();
+ $ret = [];
for ($i = 0; $i < $macs['num']; $i++) {
if ($net[$i] != 'bridge')
$tmp = libvirt_domain_get_network_info($domain, $macs[$i]);
@@ -2009,11 +2009,11 @@
$ret[] = $tmp;
else {
$this->_set_last_error();
- $ret[] = array(
+ $ret[] = [
'mac' => $macs[$i],
'network' => $bridge[$i],
'nic_type' => 'virtio'
- );
+ ];
}
}
diff --git a/plugins/dynamix.vm.manager/classes/libvirt_helpers.php b/plugins/dynamix.vm.manager/classes/libvirt_helpers.php
index 3900cf3d0..2ac532e5b 100644
--- a/plugins/dynamix.vm.manager/classes/libvirt_helpers.php
+++ b/plugins/dynamix.vm.manager/classes/libvirt_helpers.php
@@ -11,16 +11,17 @@
*/
?>
+ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
// Load emhttp variables if needed.
if (! isset($var)){
- if (! is_file("/usr/local/emhttp/state/var.ini")) shell_exec("wget -qO /dev/null localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')");
- $var = @parse_ini_file("/usr/local/emhttp/state/var.ini");
- $disks = @parse_ini_file("/usr/local/emhttp/state/disks.ini", true);
+ if (!is_file("$docroot/state/var.ini")) shell_exec("wget -qO /dev/null localhost:$(lsof -nPc emhttp | grep -Po 'TCP[^\d]*\K\d+')");
+ $var = @parse_ini_file("$docroot/state/var.ini");
+ $disks = @parse_ini_file("$docroot/state/disks.ini", true);
extract(parse_plugin_cfg("dynamix",true));
}
- if (!isset($eth0) && is_file("/usr/local/emhttp/state/network.ini")) {
- extract(parse_ini_file('/usr/local/emhttp/state/network.ini',true));
+ if (!isset($eth0) && is_file("$docroot/state/network.ini")) {
+ extract(parse_ini_file("$docroot/state/network.ini",true));
}
// Check if program is running and
@@ -494,7 +495,7 @@
}
function appendOrdinalSuffix($number) {
- $ends = array('th','st','nd','rd','th','th','th','th','th','th');
+ $ends = ['th','st','nd','rd','th','th','th','th','th','th'];
if (($number % 100) >= 11 && ($number % 100) <= 13) {
$abbreviation = $number . 'th';
@@ -606,7 +607,7 @@
$arrMatch['vendorname'] = sanitizeVendor($arrMatch['vendorname']);
$arrMatch['productname'] = sanitizeProduct($arrMatch['productname']);
- $arrValidPCIDevices[] = array(
+ $arrValidPCIDevices[] = [
'id' => $arrMatch['id'],
'type' => $arrMatch['type'],
'typeid' => $arrMatch['typeid'],
@@ -618,7 +619,7 @@
'driver' => $strDriver,
'name' => $arrMatch['vendorname'] . ' ' . $arrMatch['productname'],
'blacklisted' => $boolBlacklisted
- );
+ ];
}
}
@@ -680,7 +681,7 @@
return $cacheValidUSBDevices;
}
- $arrValidUSBDevices = array();
+ $arrValidUSBDevices = [];
// Get a list of all usb hubs so we can blacklist them
exec("cat /sys/bus/usb/drivers/hub/*/modalias | grep -Po 'usb:v\K\w{9}' | tr 'p' ':'", $arrAllUSBHubs);
@@ -715,10 +716,10 @@
// Clean up the name
$arrMatch['name'] = sanitizeVendor($arrMatch['name']);
- $arrValidUSBDevices[] = array(
+ $arrValidUSBDevices[] = [
'id' => $arrMatch['id'],
'name' => $arrMatch['name'],
- );
+ ];
}
}
@@ -868,7 +869,7 @@
function getHostCPUModel() {
$cpu = explode('#', exec("dmidecode -q -t 4|awk -F: '{if(/Version:/) v=$2; else if(/Current Speed:/) s=$2} END{print v\"#\"s}'"));
- list($strCPUModel) = explode('@', str_replace(array("Processor","CPU","(C)","(R)","(TM)"), array("","","©","®","™"), $cpu[0]) . '@');
+ list($strCPUModel) = explode('@', str_replace(["Processor","CPU","(C)","(R)","(TM)"], ["","","©","®","™"], $cpu[0]) . '@');
return trim($strCPUModel);
}
@@ -967,10 +968,10 @@
// Add claimed USB devices by this VM to the available USB devices
/*
foreach($arrUSBDevs as $arrUSB) {
- $arrValidUSBDevices[] = array(
+ $arrValidUSBDevices[] = [
'id' => $arrUSB['id'],
'name' => $arrUSB['product'],
- );
+ ];
}
*/
diff --git a/plugins/dynamix.vm.manager/include/Orbitron700.ttf b/plugins/dynamix.vm.manager/styles/Orbitron700.ttf
similarity index 100%
rename from plugins/dynamix.vm.manager/include/Orbitron700.ttf
rename to plugins/dynamix.vm.manager/styles/Orbitron700.ttf
diff --git a/plugins/dynamix.vm.manager/include/Orbitron700.woff b/plugins/dynamix.vm.manager/styles/Orbitron700.woff
similarity index 100%
rename from plugins/dynamix.vm.manager/include/Orbitron700.woff
rename to plugins/dynamix.vm.manager/styles/Orbitron700.woff
diff --git a/plugins/dynamix.vm.manager/include/base.css b/plugins/dynamix.vm.manager/styles/base.css
similarity index 100%
rename from plugins/dynamix.vm.manager/include/base.css
rename to plugins/dynamix.vm.manager/styles/base.css
diff --git a/plugins/dynamix.vm.manager/include/black.css b/plugins/dynamix.vm.manager/styles/black.css
similarity index 100%
rename from plugins/dynamix.vm.manager/include/black.css
rename to plugins/dynamix.vm.manager/styles/black.css
diff --git a/plugins/dynamix.vm.manager/include/blue.css b/plugins/dynamix.vm.manager/styles/blue.css
similarity index 100%
rename from plugins/dynamix.vm.manager/include/blue.css
rename to plugins/dynamix.vm.manager/styles/blue.css
diff --git a/plugins/dynamix.vm.manager/templates/Custom.form.php b/plugins/dynamix.vm.manager/templates/Custom.form.php
index 7c6ed7b13..4017a0f11 100644
--- a/plugins/dynamix.vm.manager/templates/Custom.form.php
+++ b/plugins/dynamix.vm.manager/templates/Custom.form.php
@@ -11,9 +11,10 @@
*/
?>
- require_once('/usr/local/emhttp/webGui/include/Helpers.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php');
+ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+ require_once "$docroot/webGui/include/Helpers.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
$arrValidMachineTypes = getValidMachineTypes();
$arrValidGPUDevices = getValidGPUDevices();
diff --git a/plugins/dynamix.vm.manager/templates/LibreELEC.form.php b/plugins/dynamix.vm.manager/templates/LibreELEC.form.php
index 6ee150ca1..f9df0128a 100644
--- a/plugins/dynamix.vm.manager/templates/LibreELEC.form.php
+++ b/plugins/dynamix.vm.manager/templates/LibreELEC.form.php
@@ -11,9 +11,10 @@
*/
?>
- require_once('/usr/local/emhttp/webGui/include/Helpers.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php');
+ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+ require_once "$docroot/webGui/include/Helpers.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
$arrValidMachineTypes = getValidMachineTypes();
$arrValidGPUDevices = getValidGPUDevices();
diff --git a/plugins/dynamix.vm.manager/templates/OpenELEC.form.php b/plugins/dynamix.vm.manager/templates/OpenELEC.form.php
index e43f57e4b..252bc2286 100644
--- a/plugins/dynamix.vm.manager/templates/OpenELEC.form.php
+++ b/plugins/dynamix.vm.manager/templates/OpenELEC.form.php
@@ -11,9 +11,10 @@
*/
?>
- require_once('/usr/local/emhttp/webGui/include/Helpers.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php');
+ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+ require_once "$docroot/webGui/include/Helpers.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
$arrValidMachineTypes = getValidMachineTypes();
$arrValidGPUDevices = getValidGPUDevices();
diff --git a/plugins/dynamix.vm.manager/templates/XML_Expert.form.php b/plugins/dynamix.vm.manager/templates/XML_Expert.form.php
index ce2e5d73e..e962000d1 100644
--- a/plugins/dynamix.vm.manager/templates/XML_Expert.form.php
+++ b/plugins/dynamix.vm.manager/templates/XML_Expert.form.php
@@ -11,9 +11,10 @@
*/
?>
- require_once('/usr/local/emhttp/webGui/include/Helpers.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt.php');
- require_once('/usr/local/emhttp/plugins/dynamix.vm.manager/classes/libvirt_helpers.php');
+ $docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+ require_once "$docroot/webGui/include/Helpers.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt.php";
+ require_once "$docroot/plugins/dynamix.vm.manager/classes/libvirt_helpers.php";
$strXML = '';
$strUUID = '';
diff --git a/plugins/dynamix.vm.manager/vnc.html b/plugins/dynamix.vm.manager/vnc.html
index fa7c2e986..a607b05f4 100644
--- a/plugins/dynamix.vm.manager/vnc.html
+++ b/plugins/dynamix.vm.manager/vnc.html
@@ -36,9 +36,9 @@
-
-
-
+
+
+