Files
librenms-librenms/includes/html/vars.inc.php
Tony Murray 055abcf443 Device page dropdown hero button, Performance -> Latency (#11328)
* Throw some shit together, rough outline.

* Reorganize tabs, use tab controllers

* Implement performance (into the latency tab)

* Update resources/views/device/header.blade.php

Co-Authored-By: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Add more tabs

* All controllers created

* Implement routes

* Implement smokeping

* routing and auth

* fix smokeping check

* Implement device dropdown menu

* Update deviceUrl to new style

* Use Gates

* Fix style

* use more appropriate gates

* add show-config gate
remove Laravel helper

* Only show vlan tab if VLANs exist for the device :D

* Fix rancid file check will return false

* revert over-zealous file name changes

* don't need to request the location parameter, just cast to string to avoid bugs when not found

* Move latency tab (ping/performance) to the position of performance instead of ping.

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2020-04-29 07:25:13 -05:00

53 lines
1.4 KiB
PHP

<?php
use LibreNMS\Config;
foreach ($_GET as $key => $get_var) {
if (strstr($key, 'opt')) {
list($name, $value) = explode('|', $get_var);
if (!isset($value)) {
$value = 'yes';
}
$vars[$name] = clean($value);
}
}
$base_url = parse_url(Config::get('base_url'));
// don't parse the subdirectory, if there is one in the path
if (isset($base_url['path']) && strlen($base_url['path']) > 1) {
$segments = explode('/', trim(str_replace($base_url["path"], "", $_SERVER['REQUEST_URI']), '/'));
} else {
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
}
foreach ($segments as $pos => $segment) {
$segment = urldecode($segment);
if ($pos === 0) {
$vars['page'] = $segment;
} else {
list($name, $value) = explode('=', $segment);
if ($value == '' || !isset($value)) {
if ($vars['page'] == 'device' && $pos < 3) {
// translate laravel device routes properly
$vars[$pos === 1 ? 'device' : 'tab'] = $name;
} else {
$vars[$name] = 'yes';
}
} else {
$vars[$name] = $value;
}
}
}
foreach ($_GET as $name => $value) {
$vars[$name] = clean($value);
}
foreach ($_POST as $name => $value) {
$vars[$name] = ($value);
}
// don't leak login data
unset($vars['username'], $vars['password']);