";
// === Path Navigation
echo "
";
// === Table Header
echo "
";
$headers = ['name' => 'Name', 'size' => 'Size', 'perm' => 'Permissions'];
foreach ($headers as $key => $label) {
$new_order = ($sort === $key && $order === 'asc') ? 'desc' : 'asc';
echo "" . htmlspecialchars($label) . " | ";
}
echo "Actions |
";
// === File List
foreach ($items as $item) {
if ($item === '.') continue;
$path = $dir . DIRECTORY_SEPARATOR . $item;
$size = is_file($path) ? formatSize(filesize($path)) : '-';
$perm = substr(sprintf('%o', fileperms($path)), -3);
$permColor = is_writable($path) ? 'text-success' : 'text-muted';
$icon = is_dir($path) ? 'bi-folder' : 'bi-file-earmark';
$name = is_dir($path)
? " " . htmlspecialchars($item) . ""
: " " . htmlspecialchars($item) . "";
$actions = [];
if (is_file($path)) {
$actions[] = "";
}
// Inline Rename
if (isset($_GET['rename_from']) && $_GET['rename_from'] === $item) {
$actions[] = "";
} else {
$actions[] = "";
}
$actions[] = "";
if (is_dir($path)) {
$actions[] = "";
} elseif (strtolower(pathinfo($item, PATHINFO_EXTENSION)) === 'zip') {
$actions[] = "";
}
echo "
$name |
$size |
$perm |
" . implode('', $actions) . " |
";
}
echo "
";
// === Forms: Upload, Folder, Chmod
echo "
";
echo "