- commit
- ff6f155d360460705b0511f7ee5ae57b450be18f
- parent
- 29aeb339007493385a79928dd93125e9658d0da7
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-10-20 12:45
uploads: allow to navigate to parent dir
Diffstat
| M | index.php | 15 | +++++++++++++-- |
1 files changed, 13 insertions, 2 deletions
diff --git a/index.php b/index.php
@@ -54,6 +54,11 @@ function pathIsFile($path) 54 54 return $path === '/_site' || strpos($path, '.') !== false; 55 55 } 56 56 -1 57 function pathDirname($path) -1 58 { -1 59 return implode('/', array_slice(explode('/', $path), 0, -1)); -1 60 } -1 61 57 62 function validatePath($path) 58 63 { 59 64 if ( @@ -185,7 +190,13 @@ class Pupupu 185 190 $p = $this->targetDir . '/files' . $path; 186 191 $u = $this->targetUrl . '/files' . $path; 187 192 foreach (scandir($p) as $name) {188 -1 if ($name !== '.' && $name !== '..') {-1 193 if ($name === '..' && $path !== '') { -1 194 $uploads[] = array( -1 195 'name' => $name, -1 196 'path' => pathDirname($path), -1 197 'is_file' => false, -1 198 ); -1 199 } elseif ($name !== '.' && $name !== '..') { 189 200 $uploads[] = array( 190 201 'name' => $name, 191 202 'path' => "$path/$name", @@ -313,7 +324,7 @@ function pageView($pupupu, $twig) 313 324 die(); 314 325 } 315 326 $pupupu->rm($path);316 -1 $target = implode('/', array_slice(explode('/', $path), 0, -1));-1 327 $target = pathDirname($path); 317 328 header("Location: ?path=$target", true, 302); 318 329 } else { 319 330 $pupupu->put($path, 'yml', $_POST['yml']);