diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-03-25 21:08:29 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-03-25 21:08:29 +0200 |
| commit | 6d0777840e50ce98f3d96629b4e92bbdccd3001c (patch) | |
| tree | 161a753bf54b4fec0c4357b16dc68ff838e20383 /www/www-header.php | |
| parent | 568bf6f9a487a3dc33ce52e45cd31cfbea2cb79e (diff) | |
| download | phorkie-6d0777840e50ce98f3d96629b4e92bbdccd3001c.tar.gz phorkie-6d0777840e50ce98f3d96629b4e92bbdccd3001c.zip | |
first code that allows you to create pastes and view them
Diffstat (limited to 'www/www-header.php')
| -rw-r--r-- | www/www-header.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/www/www-header.php b/www/www-header.php new file mode 100644 index 0000000..28607da --- /dev/null +++ b/www/www-header.php @@ -0,0 +1,36 @@ +<?php +require_once __DIR__ . '/../data/config.default.php'; +require_once 'VersionControl/Git.php'; +require_once 'Twig/Autoloader.php'; +Twig_Autoloader::register(); + +$loader = new Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']); +$twig = new Twig_Environment( + $loader, + array( + //'cache' => '/path/to/compilation_cache', + 'debug' => true + ) +); + +function render($tplname, $vars) +{ + $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm'); + echo $template->render($vars); +} +function redirect($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 |
