Router fixes for SVG images

This commit is contained in:
Thomas Gelf 2014-03-27 19:39:38 +00:00
parent fa903e10b6
commit fcde513c24
1 changed files with 6 additions and 5 deletions

View File

@ -31,15 +31,16 @@ if (strpos($ruri, '?') === false) {
} else { } else {
list($path, $params) = preg_split('/\?/', $ruri, 2); list($path, $params) = preg_split('/\?/', $ruri, 2);
} }
$ruriParts = preg_split('~/~', ltrim($ruri, '/'));
if (count($ruriParts) === 2 && $pathParts = preg_split('~/~', $path);
($ruriParts[0] === 'css' || $ruriParts[0] === 'js') if (count($pathParts) === 2 &&
($pathParts[0] === 'css' || $pathParts[0] === 'js')
) { ) {
require_once __DIR__ . '/EmbeddedWeb.php'; require_once __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start($configDir); EmbeddedWeb::start($configDir);
switch($ruriParts[1]) { switch($pathParts[1]) {
case 'icinga.css': case 'icinga.css':
Stylesheet::send(); Stylesheet::send();
@ -60,7 +61,7 @@ if (count($ruriParts) === 2 &&
return false; return false;
} }
} elseif ($path === '/svg/chart.php') { } elseif ($path === 'svg/chart.php') {
if (!array_key_exists('data', $_GET)) { if (!array_key_exists('data', $_GET)) {
return false; return false;
} }