From 6bbdf29d6cc28d4080f1c29352ff38539549c856 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 21 May 2016 15:05:01 -0400 Subject: tidy path handling --- index.php | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/index.php b/index.php index 30813cd..633944c 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ +# Copyright © 2014, 2016 Luke Shumaker # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the ./COPYING file for more details. @@ -33,16 +33,20 @@ function show_404() { "; - if (is_link($root.'/'.$dirname.'/'.$filename)) { - echo "".htmlentities($filename)." -> ".htmlentities(readlink($root.'/'.$dirname.'/'.$filename)).""; + if (is_link($filepath)) { + echo "".htmlentities($filename)." -> ".htmlentities(readlink($filepath)).""; } else { echo "".htmlentities($filename).""; } @@ -156,11 +162,11 @@ if (!is_dir($root.'/'.$dirname)) { if ($filename == '..') { echo ''; } else { - echo "".date("Y-m-d H:i", filemtime($root.'/'.$dirname.'/'.$filename)).""; - if (is_dir($root.'/'.$dirname.'/'.$filename)) { + echo "".date("Y-m-d H:i", filemtime($filepath)).""; + if (is_dir($filepath)) { echo "-"; } else { - echo "".filesize($root.'/'.$dirname.'/'.$filename).""; + echo "".filesize($filepath).""; } echo "\n"; } -- cgit v1.2.3