function dir_get_files($dir, $recursive = true) { $dir = ensure_trailing_slash($dir); $files = array(); $handle = opendir($dir); if ($handle) { while ($file = readdir($handle)) { if ($file != '.' && $file != '..') { $file = $dir . $file; if (is_dir($file)) { if ($recursive) { $files = array_merge($files, dir_get_files($file . '/')); } } else { $files[] = $file; } } } closedir($handle); } return $files; }
<?php require 'inc/util.php'; # Get Directory $path = isset($_GET['d']) ? clean_path(stripslashes($_GET['d'])) : ''; if (strlen($path) == 0 || !(file_exists($path) && is_dir($path))) { $path = $root_dir; } $path = ensure_trailing_slash($path); $root_dir = ensure_trailing_slash($root_dir); $dirs = array_filter(glob(quotemeta($path) . '*'), 'is_dir'); $files = array_filter(glob(quotemeta($path) . '*'), 'is_file'); # Sort Dirs by Date if ($path != $root_dir) { $abs_dirs = array_filter(glob(quotemeta(realpath($path) . '/') . '*'), 'is_dir'); sort_by_mdate($abs_dirs, $dirs); } $zip_enabled = $allow_zips && is_zippable_dir(dirname($path) . '/'); $zip_children_enabled = $allow_zips && is_zippable_dir($path); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Gloomi</title> <style type="text/css"> body{ font: 14px Helvetica, Arial, sans-serif; letter-spacing: -0.1em; margin: 40px 30px 40px 30px; color: #fff;