No more globals.
1 files changed, 7 insertions(+), 12 deletions(-)

M index.php
M index.php +7 -12
@@ 67,9 67,7 @@ 
   }
   // END UTILITY
 
-  function tree_link() {
-    global $uri;
-
+  function tree_link($uri) {
     $uri_array = explode("/", trim($uri, "/"));
 
     $tree_path = "/";

          
@@ 85,16 83,13 @@ 
     return $tree_link;
   }
 
-  function up_link() {
-    global $uri;
+  function up_link($uri) {
     if ($uri !== "/") {
       return "<tr><td colspan=3>" . link_to(dirname($uri) . "/", "[up]") . "</td></tr>";
     }
   }
 
-  function file_rows($files, $is_dir) {
-    global $dir, $uri;
-
+  function file_rows($dir, $files, $is_dir) {
     $file_rows = "";
     $file_suffix = "";
     $list_file_prefix = hidden_data("", $is_dir);

          
@@ 207,7 202,7 @@ 
   </style>
 </head>
 <body id="files">
-  <h1>Index of <?php echo tree_link(); ?></h1>
+  <h1>Index of <?php echo tree_link($uri); ?></h1>
 
   <input placeholder="search (non-recursive)" class="search" />
 

          
@@ 218,11 213,11 @@ 
         <th><span class="sort" data-sort="size">Size</span></th>
         <th><span class="sort" data-sort="date">Date</span></th>
       </tr>
-      <?php echo up_link(); ?>
+      <?php echo up_link($uri); ?>
     </thead>
     <tbody class="list">
-      <?php echo file_rows($dirs, true); ?>
-      <?php echo file_rows($files, false); ?>
+      <?php echo file_rows($dir, $dirs, true); ?>
+      <?php echo file_rows($dir, $files, false); ?>
     </tbody>
   </table>