# HG changeset patch # User nanaya # Date 1440419698 -32400 # Node ID f48a4fbb9cf94f51609f48eca0e9873e4156062a # Parent 29543401ef18f733dfe60428b58c3f94dd6bbde4 Rewrite file rows generator. diff -r 29543401ef18 -r f48a4fbb9cf9 index.php --- a/index.php Mon Aug 24 21:20:27 2015 +0900 +++ b/index.php Mon Aug 24 21:34:58 2015 +0900 @@ -90,32 +90,31 @@ } function file_rows($dir, $files, $is_dir) { - $file_rows = ""; $file_suffix = ""; - $list_file_prefix = hidden_data("", $is_dir); + if ($is_dir) { $file_suffix = "/"; } - if ($is_dir) { - $file_suffix = "/"; - } - + $file_rows = ""; foreach($files as $file) { $file_path = $dir."/".$file; if (!file_exists($file_path)) { continue; } $file_stat = stat($file_path); - $file_rows .= ""; - $file_rows .= "". $list_file_prefix . link_to($file . $file_suffix, $file . $file_suffix).""; - - $file_rows .= ""; - $file_rows .= hidden_data($file_stat["size"], $is_dir); - if ($is_dir) { $file_rows .= "[dir]"; } - else { $file_rows .= human_size($file_stat['size']); } - $file_rows .= ""; - - $file_rows .= "" . hidden_data("", $is_dir) . h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime'])) . ""; - - $file_rows .= ""; + $file_rows .= + "". + "". + hidden_data("", $is_dir). + link_to($file.$file_suffix, $file.$file_suffix). + "". + "". + hidden_data($file_stat["size"], $is_dir). + ($is_dir ? "[dir]" : human_size($file_stat["size"])). + "". + "". + hidden_data("", $is_dir).$columns["date"]. + h(strftime("%Y-%m-%d %H:%M %Z", $file_stat["mtime"])). + "". + ""; } return $file_rows; }