Mercurial > dirlist-php
diff index.php @ 50:5a4c9efd99fc
No more globals.
author | nanaya <me@myconan.net> |
---|---|
date | Mon, 24 Aug 2015 21:13:56 +0900 |
parents | 4e85d97e41b6 |
children | 29543401ef18 |
line wrap: on
line diff
--- a/index.php Fri Aug 07 21:01:49 2015 +0900 +++ b/index.php Mon Aug 24 21:13:56 2015 +0900 @@ -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>