diff --git a/index.php b/index.php
index 550c42a..9867cb9 100644
--- a/index.php
+++ b/index.php
@@ -46,6 +46,8 @@ $IGNORE = [
];
// Actual path of the wwwroot
$ROOTPATH = "/var/www/html";
+// Show file sizes
+$SHOWFILESIZE = true;
// Fill in to add mirror download links to files
$MIRRORBASE = [];
@@ -1193,9 +1195,18 @@ $EXT2MIME = [
$path = explode('?', $_SERVER['REQUEST_URI'], 2)[0];
$dir = realpath(__DIR__ . $path);
+if ($dir == "") {
+ $dir = __DIR__;
+}
if (strpos($dir, $ROOTPATH) !== 0) {
die("Access denied.");
}
+
+function human_filesize($bytes, $decimals = 2) {
+ $sz = 'BKMGTP';
+ $factor = floor((strlen($bytes) - 1) / 3);
+ return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
+}
?>
@@ -1329,22 +1340,25 @@ word-break: break-all;
echo " ";
}
echo $f . "\n";
- if (count($MIRRORBASE) > 0 && !is_dir($dir . "/" . $f)) {
- echo "\n";
- echo "\t"
+ if ($SHOWFILESIZE&& !is_dir($dir . "/" . $f)) {
+ echo "\t\t" . human_filesize(filesize($dir . "/" . $f)) . "\n";
+ }
+ if (count($MIRRORBASE) > 0 && !is_dir($dir . "/" . $f)) {
+ echo "\t\t"
. ""
. " Main\n";
foreach ($MIRRORBASE as $mirror) {
$name = $mirror["name"];
$base = $mirror["base"];
- echo "\t"
. ""
. " $name\n";
}
- echo "";
}
+ echo "\t\n";
echo "\n\n";
}
}