Cosmetic web router changes

This commit is contained in:
Thomas Gelf 2014-04-17 16:47:01 +00:00
parent a1d8647c96
commit 3b20833495
1 changed files with 5 additions and 8 deletions

View File

@ -10,9 +10,7 @@ use Icinga\Chart\Inline\PieChart;
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL | E_STRICT);
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_ENV)) { if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
$configDir = $_ENV['ICINGAWEB_CONFIGDIR'];
} elseif (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR']; $configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
} else { } else {
$configDir = '/etc/icingaweb'; $configDir = '/etc/icingaweb';
@ -40,9 +38,8 @@ $baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
// Fix aliases // Fix aliases
$remove = dirname($_SERVER['PHP_SELF']); $remove = dirname($_SERVER['PHP_SELF']);
if (substr($ruri, 0, strlen($remove)) !== $remove) { if (substr($ruri, 0, strlen($remove)) !== $remove) {
return false; return false;
} }
$ruri = ltrim(substr($ruri, strlen($remove)), '/'); $ruri = ltrim(substr($ruri, strlen($remove)), '/');
if (strpos($ruri, '?') === false) { if (strpos($ruri, '?') === false) {
@ -61,7 +58,7 @@ $special = array(
if (in_array($path, $special)) { if (in_array($path, $special)) {
require_once __DIR__ . '/EmbeddedWeb.php'; include_once __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start($configDir); EmbeddedWeb::start($configDir);
switch($path) { switch($path) {
@ -89,7 +86,7 @@ if (in_array($path, $special)) {
if (!array_key_exists('data', $_GET)) { if (!array_key_exists('data', $_GET)) {
return false; return false;
} }
require_once __DIR__ . '/EmbeddedWeb.php'; include __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start($configDir); EmbeddedWeb::start($configDir);
header('Content-Type: image/svg+xml'); header('Content-Type: image/svg+xml');
$pie = new PieChart(); $pie = new PieChart();
@ -99,7 +96,7 @@ if (in_array($path, $special)) {
} elseif (file_exists($baseDir . $ruri) && is_file($baseDir . $ruri)) { } elseif (file_exists($baseDir . $ruri) && is_file($baseDir . $ruri)) {
return false; return false;
} else { } else {
require_once __DIR__ . '/Web.php'; include __DIR__ . '/Web.php';
Web::start($configDir)->dispatch(); Web::start($configDir)->dispatch();
} }