X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/6d0777840e50ce98f3d96629b4e92bbdccd3001c..907069eb20e289851641b0383e9e13a91008bc33:/www/www-header.php diff --git a/www/www-header.php b/www/www-header.php index 28607da..5b2fa56 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -1,11 +1,41 @@ httpStatusCode); + } else { + header('HTTP/1.0 500 Internal server error'); + } + render('exception', array('exception' => $e)); + exit(); + } +); + require_once __DIR__ . '/../data/config.default.php'; +if (file_exists(__DIR__ . '/../data/config.php')) { + require_once __DIR__ . '/../data/config.php'; +} require_once 'VersionControl/Git.php'; require_once 'Twig/Autoloader.php'; -Twig_Autoloader::register(); +\Twig_Autoloader::register(); -$loader = new Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']); -$twig = new Twig_Environment( +$loader = new \Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']); +$twig = new \Twig_Environment( $loader, array( //'cache' => '/path/to/compilation_cache', @@ -20,17 +50,7 @@ function render($tplname, $vars) } function redirect($target) { - header('Location: /' . $target); + header('Location: ' . $target); exit(); } -function errout($statusCode, $message) -{ - header('HTTP/1.0 ' . $statusCode); - echo $message; - exit(); -} -function get_type_from_file($file) -{ - return substr($file, strrpos($file, '.') + 1); -} ?> \ No newline at end of file