Fix errors in vars.inc.php (#8913)

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
This commit is contained in:
Tony Murray
2018-07-17 03:19:29 -05:00
committed by Neil Lathwood
parent 25dc44a574
commit 7cde27338b

View File

@ -1,5 +1,7 @@
<?php
use LibreNMS\Config;
foreach ($_GET as $key => $get_var) {
if (strstr($key, 'opt')) {
list($name, $value) = explode('|', $get_var);
@ -11,9 +13,9 @@ foreach ($_GET as $key => $get_var) {
}
}
$base_url = parse_url($config["base_url"]);
$base_url = parse_url(Config::get('base_url'));
// don't parse the subdirectory, if there is one in the path
if (strlen($base_url["path"]) > 1) {
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'], '/'));