Always group by directory no matter what type of sorting.
1 files changed, 7 insertions(+), 9 deletions(-)

M index.php
M index.php +7 -9
@@ 62,8 62,8 @@ 
     return sprintf($return_format, $size, $return_unit);
   }
 
-  function hidden_data($data) {
-    return "<i> " . $data . " </i>";
+  function hidden_data($data = "", $is_dir = false) {
+    return "<i> " . ($is_dir === true ? 0 : 1) . " " . $data . " </i>";
   }
   // END UTILITY
 

          
@@ 96,13 96,10 @@ 
 
     $file_rows = "";
     $file_suffix = "";
-    $list_file_prefix = "";
+    $list_file_prefix = hidden_data("", $is_dir);
 
     if ($is_dir) {
       $file_suffix = "/";
-      $list_file_prefix = hidden_data(0);
-    } else {
-      $list_file_prefix = hidden_data(1);
     }
 
     foreach($files as $file) {

          
@@ 112,11 109,12 @@ 
       $file_rows .= "<td>". $list_file_prefix . link_to($file . $file_suffix, $file . $file_suffix)."</td>";
 
       $file_rows .= "<td>";
-      if ($is_dir) { $file_rows .= hidden_data(0) . "[dir]"; }
-      else { $file_rows .= hidden_data($file_stat["size"]) . human_size($file_stat['size']); }
+      $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 .= "</td>";
 
-      $file_rows .= "<td>".h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime']))."</td>";
+      $file_rows .= "<td>" . hidden_data("", $is_dir) . h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime'])) . "</td>";
 
       $file_rows .= "</tr>";
     }