5 . PATH_SEPARATOR . get_include_path()
9 $file = str_replace(array('\\', '_'), '/', $class) . '.php';
10 $hdl = @fopen($file, 'r', true);
17 set_exception_handler(
19 if ($e instanceof Exception) {
20 header('HTTP/1.0 ' . $e->httpStatusCode);
22 header('HTTP/1.0 500 Internal server error');
25 if (!isset($GLOBALS['twig'])) {
26 echo '<h1>Exception</h1>';
27 echo '<p>' . $e->getMessage() . '</p>';
35 'debug' => $GLOBALS['phorkie']['cfg']['debug']
42 require_once __DIR__ . '/../data/config.default.php';
43 if (file_exists(__DIR__ . '/../data/config.php')) {
44 require_once __DIR__ . '/../data/config.php';
46 if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
49 \Twig_Autoloader::register();
51 $loader = new \Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']);
52 $twig = new \Twig_Environment(
55 //'cache' => '/path/to/compilation_cache',
60 function render($tplname, $vars)
62 $vars['css'] = $GLOBALS['phorkie']['cfg']['css'];
63 $vars['title'] = $GLOBALS['phorkie']['cfg']['title'];
64 $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];
66 $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
67 echo $template->render($vars);
69 function redirect($target)
71 header('Location: ' . $target);