pupupu

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

commit
934a5b9e8ff74eb7f58aec3131843e651b06fa4d
parent
b7ebd94956cd3bf69f0b4282750ef098318aa67f
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-10-21 08:56
use leading / for special paths

Diffstat

M index.php 6 +++---
M templates/base.html 4 ++--
M templates/files.html 2 +-

3 files changed, 6 insertions, 6 deletions


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

@@ -307,7 +307,7 @@ function pagesView($pupupu, $twig)
  307   307 
  308   308 function filesView($pupupu, $twig)
  309   309 {
  310    -1     $path = validatePath(substr($_GET['path'], 6));
   -1   310     $path = validatePath(substr($_GET['path'], 7));
  311   311 
  312   312     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  313   313         echo $twig->render('files.html', array(
@@ -396,9 +396,9 @@ if (isset($_SERVER['REQUEST_METHOD'])) {
  396   396         }
  397   397         if (empty($_GET['path']) && $_GET['path'] !== '') {
  398   398             pagesView($pupupu, $twig);
  399    -1         } elseif ($_GET['path'] === '_site') {
   -1   399         } elseif ($_GET['path'] === '/_site') {
  400   400             siteView($pupupu, $twig);
  401    -1         } elseif (substr($_GET['path'], 0, 6) === '_files') {
   -1   401         } elseif (substr($_GET['path'], 0, 7) === '/_files') {
  402   402             filesView($pupupu, $twig);
  403   403         } else {
  404   404             pageView($pupupu, $twig);

diff --git a/templates/base.html b/templates/base.html

@@ -12,8 +12,8 @@
   12    12     <header>
   13    13         <nav>
   14    14             <a href="?">{{ 'pages'|trans }}</a>
   15    -1             <a href="?path=_files">{{ 'files'|trans }}</a>
   16    -1             <a href="?path=_site">{{ 'site'|trans }}</a>
   -1    15             <a href="?path=%2F_files">{{ 'files'|trans }}</a>
   -1    16             <a href="?path=%2F_site">{{ 'site'|trans }}</a>
   17    17         </nav>
   18    18     </header>
   19    19 

diff --git a/templates/files.html b/templates/files.html

@@ -22,7 +22,7 @@
   22    22                     <a href="{{ file.url }}" target="_blank" class="file-list__main">{{ file.name }}</a>
   23    23                 {% else %}
   24    24                     <img src="static/folder.png" class="file-list__icon" alt="{{ 'folder'|trans }}">
   25    -1                     <a href="?path=_files{{ file.path|e('url') }}" class="file-list__main">{{ file.name }}/</a>
   -1    25                     <a href="?path=%2F_files{{ file.path|e('url') }}" class="file-list__main">{{ file.name }}/</a>
   26    26                 {% endif %}
   27    27 
   28    28                 {% if file.name != '..' %}