$item, 'path' => $full_path, 'is_dir' => is_dir($full_path), 'size' => is_file($full_path) ? filesize($full_path) : 0, 'modified' => date('Y-m-d H:i:s', filemtime($full_path)), 'perms' => substr(sprintf('%o', fileperms($full_path)), -4), 'owner' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner($full_path))['name'] : 'N/A', 'readable' => is_readable($full_path), 'writable' => is_writable($full_path) ]; } } // Sort: directories first usort($files, function($a, $b) { if ($a['is_dir'] && !$b['is_dir']) return -1; if (!$a['is_dir'] && $b['is_dir']) return 1; return strcmp($a['name'], $b['name']); }); $root_paths = get_root_paths(); ?>