pupupu

simple static CMS for crappy servers
git clone https://git.ce9e.org/pupupu.git

commit
559bb43e85b7342ecc6d109147920dc7509eafb9
parent
a50f2526acc2374f49f8a20d47c9f25049748f92
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-12-02 16:38
fix twig class usage

Diffstat

M api.php 8 ++++----
M index.php 8 ++++----

2 files changed, 8 insertions, 8 deletions


diff --git a/api.php b/api.php

@@ -22,12 +22,12 @@ class Pupupu
   22    22         $this->targetDir = $targetDir;
   23    23         $this->targetUrl = $targetUrl;
   24    24 
   25    -1         $loader = new Twig_Loader_Filesystem($srcDir . '/_templates');
   26    -1         $this->twig = new Twig_Environment($loader);
   27    -1         $this->twig->addFilter(new Twig_Filter('md', function ($string) {
   -1    25         $loader = new \Twig\Loader\FilesystemLoader($srcDir . '/_templates');
   -1    26         $this->twig = new \Twig\Environment($loader);
   -1    27         $this->twig->addFilter(new \Twig\TwigFilter('md', function ($string) {
   28    28             return MarkdownExtra::defaultTransform($string);
   29    29         }));
   30    -1         $this->twig->addFilter(new Twig_Filter('shift_headings', 'shiftHeadings'));
   -1    30         $this->twig->addFilter(new \Twig\TwigFilter('shift_headings', 'shiftHeadings'));
   31    31 
   32    32         $this->cache = array();
   33    33     }

diff --git a/index.php b/index.php

@@ -21,9 +21,9 @@ function getAuth()
   21    21 $pupupu = new Pupupu('..', '..', '..');
   22    22 
   23    23 if (isset($_SERVER['REQUEST_METHOD'])) {
   24    -1     $loader = new Twig_Loader_Filesystem('templates');
   25    -1     $twig = new Twig_Environment($loader);
   26    -1     $twig->addFilter(new Twig_Filter('trans', 'trans'));
   -1    24     $loader = new \Twig\Loader\FilesystemLoader('templates');
   -1    25     $twig = new \Twig\Environment($loader);
   -1    26     $twig->addFilter(new \Twig\TwigFilter('trans', 'trans'));
   27    27     $twig->addGlobal('site_title', $_SERVER['HTTP_HOST']);
   28    28 
   29    29     try {
@@ -46,7 +46,7 @@ if (isset($_SERVER['REQUEST_METHOD'])) {
   46    46         }
   47    47     } catch (WriteException $e) {
   48    48         errorView($pupupu, $twig, new HttpException('unable to write: ' . $e->getMessage(), 500));
   49    -1     } catch (Twig_Error_Loader $e) {
   -1    49     } catch (\Twig\Error\LoaderError $e) {
   50    50         errorView($pupupu, $twig, new HttpException($e->getMessage(), 500));
   51    51     } catch (HttpException $e) {
   52    52         errorView($pupupu, $twig, $e);