diff --git a/includes/html/functions.inc.php b/includes/html/functions.inc.php index ecc26f7069..44aeb1ce80 100644 --- a/includes/html/functions.inc.php +++ b/includes/html/functions.inc.php @@ -16,40 +16,6 @@ use LibreNMS\Enum\ImageFormat; use LibreNMS\Util\Number; use LibreNMS\Util\Rewrite; -/** - * Compare $t with the value of $vars[$v], if that exists - * - * @param string $v Name of the var to test - * @param string $t Value to compare $vars[$v] to - * @return bool true, if values are the same, false if $vars[$v] - * is unset or values differ - */ -function var_eq($v, $t) -{ - global $vars; - if (isset($vars[$v]) && $vars[$v] == $t) { - return true; - } - - return false; -} - -/** - * Get the value of $vars[$v], if it exists - * - * @param string $v Name of the var to get - * @return string|bool The value of $vars[$v] if it exists, false if it does not exist - */ -function var_get($v) -{ - global $vars; - if (isset($vars[$v])) { - return $vars[$v]; - } - - return false; -} - function toner2colour($descr, $percent) { $colour = \LibreNMS\Util\Color::percentage(100 - $percent, null); diff --git a/includes/html/pages/apps/proxmox.inc.php b/includes/html/pages/apps/proxmox.inc.php index eea1e3b0de..54479beee3 100644 --- a/includes/html/pages/apps/proxmox.inc.php +++ b/includes/html/pages/apps/proxmox.inc.php @@ -6,25 +6,25 @@ $graphs['proxmox'] = [ ]; $pmxcl = dbFetchRows('SELECT DISTINCT(`app_instance`) FROM `applications` WHERE `app_type` = ?', ['proxmox']); +$instance = Request::get('instance', $pmxcl[0]['app_instance'] ?? null); print_optionbar_start(); echo "Proxmox Clusters » "; -unset($sep); +$sep = ''; foreach ($pmxcl as $pmxc) { - if (isset($sep)) { - echo $sep; - } + echo $sep; - if (var_eq('instance', $pmxc['app_instance']) || (! isset($vars['instance']) && ! isset($sep))) { + $selected = $pmxc['app_instance'] == $instance || (empty($instance) && empty($sep)); + if ($selected) { echo " '; } @@ -36,12 +36,6 @@ print_optionbar_end(); $pagetitle[] = 'Proxmox'; $pagetitle[] = $instance; -if (! isset($vars['instance'])) { - $instance = $pmxcl[0]['app_instance']; -} else { - $instance = var_get('instance'); -} - if (isset($vars['vmid'])) { include 'includes/html/pages/apps/proxmox/vm.inc.php'; $pagetitle[] = $vars['vmid']; diff --git a/includes/html/pages/apps/proxmox/vm.inc.php b/includes/html/pages/apps/proxmox/vm.inc.php index 2e5d665c04..d2479437a1 100644 --- a/includes/html/pages/apps/proxmox/vm.inc.php +++ b/includes/html/pages/apps/proxmox/vm.inc.php @@ -1,6 +1,6 @@ 'Traffic', @@ -23,7 +23,7 @@ foreach ($vm['ports'] as $port) { echo '