annotate index.php @ 5:b84ce3ef4c9d

Fix behaviour difference between version.
author edogawaconan <me@myconan.net>
date Tue, 21 Oct 2014 21:41:49 +0900
parents 7812af1c23ae
children 8df269a2efd8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8cba59d07798 Initial import.
edogawaconan <me@myconan.net>
parents:
diff changeset
1 <?php
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
2 // Required for strftime(). Set to UTC because :internet:.
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
3 date_default_timezone_set('UTC');
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
5 // $path: actual requested path, with $alias_prefix removed, relative to $root.
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
6 $path = $_SERVER["REQUEST_URI"];
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
7 $query_string_start = strpos($path, "?");
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
8 if ($query_string_start !== false) {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
9 $path = substr($path, 0, $query_string_start);
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
10 }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
11 $path = urldecode($path);
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
12
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
13 $prefix = $_SERVER["DL_PREFIX"];
5
b84ce3ef4c9d Fix behaviour difference between version.
edogawaconan <me@myconan.net>
parents: 4
diff changeset
14 if ($prefix === null) { $prefix = ""; }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
15
5
b84ce3ef4c9d Fix behaviour difference between version.
edogawaconan <me@myconan.net>
parents: 4
diff changeset
16 $path = substr($path, strlen($prefix));
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
17 if ($path === false) { $path = "/"; }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
18
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
19 // root of directory listing.
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
20 $root = $_SERVER["DL_ROOT"];
5
b84ce3ef4c9d Fix behaviour difference between version.
edogawaconan <me@myconan.net>
parents: 4
diff changeset
21 if ($root === null || $root === "") { $root = $_SERVER["DOCUMENT_ROOT"]; }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
22
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
23 // current directory being listed.
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
24 $current_dir = $root . $path;
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
25
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
26 if (realpath($root . $path) === false) {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
27 header("HTTP/1.0 404 Not Found");
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
28 } elseif (substr($current_dir, -1) !== "/") {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
29 header("Location: " . $path . "/", false, 301);
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
30 }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
31
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
32 if (http_response_code() !== 200) { exit; }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
33
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
34 // $link_prefix = "/";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
35 // $link_base = rtrim(preg_replace("#/+#", "/", urldecode($_ENV["REQUEST_URI"])),'/');
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
36 // $link_path = substr($link_base,strlen(utf8_decode($link_prefix)));
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
37 // $path = realpath("$wwwroot/".$link_path);
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
38 // if (!$path) { die("fail"); }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
39
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
40 $dir_handle = @opendir($root . $path);
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
41 $files = array();
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
42 $dirs = array();
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
43 while (($file = readdir($dir_handle)) !== false) {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
44 if ($file === "." or $file === "..") { continue; }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
45 elseif (is_dir($root . $path . $file)) { $dirs[] = $file; }
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
46 else { $files[] = $file; }
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
47 }
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
48 sort($files);
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
49 sort($dirs);
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
50
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
51 // BEGIN UTILITY
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
52 function h($string) { return htmlspecialchars($string, ENT_QUOTES, "UTF-8"); }
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
53 function a($string) { return preg_replace("#(%2F)+#", "/", rawurlencode($string)); }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
54 function link_to($target, $title) { return('<a href="' . a($target) . '">' . h($title) . "</a>"); }
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
55
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
56 function human_size($size) {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
57 $thousand_units = array("ko", "Mo", "Go", "To", "Po");
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
58
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
59 $return_format = "%d %s";
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
60
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
61 if ($size <= 1) {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
62 $return_unit = "octet";
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
63 } elseif ($size < 1000) {
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
64 $return_unit = "octets";
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
65 } else {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
66 $size /= 1000;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
67 for ($i = 0; $size >= 1000 && $i < count($thousand_units); $i++) { $size /= 1000; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
68 $return_format = "%.2f %s";
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
69 $return_unit = $thousand_units[$i];
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
70 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
71 return sprintf($return_format, $size, $return_unit);
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
72 }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
73 // END UTILITY
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
74
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
75 function tree_link() {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
76 global $path, $prefix;
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
77
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
78 $path_array = explode("/", trim($path, "/"));
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
79 array_unshift($path_array, trim($prefix, "/"));
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
80
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
81 $tree_path = "/";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
82 $tree_link = link_to($tree_path, "[root]") . "/";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
83
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
84 foreach ($path_array as $p) {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
85 if ($p === "") { continue; }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
86 $tree_path .= $p . "/";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
87 $tree_link .= link_to($tree_path, $p) . "/";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
88 }
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
89
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
90 return $tree_link;
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
91 }
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
92
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
93 function file_rows($files, $is_dir) {
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
94 global $path, $root, $prefix;
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
95
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
96 $file_rows = "";
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
97 $file_suffix = "";
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
98
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
99 if ($is_dir) {
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
100 $file_suffix = "/";
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
101
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
102 if ($path !== "/") {
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
103 $file_rows .= "<tr><td colspan=3>" . link_to(dirname($prefix . $path) . "/", "..") . "</td></tr>";
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
104 }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
105 }
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
106
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
107 foreach($files as $file) {
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
108 $file_stat = stat($root . $path . "/". $file);
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
109
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
110 $file_rows .= "<tr>";
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
111 $file_rows .= "<td>".link_to($file . $file_suffix, $file . $file_suffix)."</td>";
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
112
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
113 $file_rows .= "<td>";
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
114 if ($is_dir) { $file_rows .= "[dir]"; }
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
115 else { $file_rows .= human_size($file_stat['size']); }
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
116 $file_rows .= "</td>";
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
117
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
118 $file_rows .= "<td>".h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime']))."</td>";
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
119
2
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
120 $file_rows .= "</tr>";
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
121 }
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
122 return $file_rows;
9b5884ba214a Fix indentation.
edogawaconan <me@myconan.net>
parents: 0
diff changeset
123 }
0
8cba59d07798 Initial import.
edogawaconan <me@myconan.net>
parents:
diff changeset
124 ?>
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
125 <?php header('Content-Type: text/html; charset=utf-8'); ?>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
126 <!doctype html>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
127 <head>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
128 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
129 <title>Index of <?php echo h($prefix . $path); ?></title>
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
130 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
131 <style type="text/css">
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
132 * { box-sizing: border-box; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
133 body {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
134 font-family: Segoe UI, sans-serif;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
135 font-size: 14px;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
136 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
137 h1 { margin: 5px; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
138 table {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
139 width: 100%;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
140 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
141 th:first-child, td:first-child {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
142 width: 100%;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
143 white-space: pre-wrap;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
144 word-wrap: break-word;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
145 word-break: break-all;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
146 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
147 tr {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
148 position: relative;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
149 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
150 th, td {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
151 white-space: nowrap;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
152 padding: 2px 5px;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
153 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
154
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
155 @media (min-width: 768px) {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
156 th { background: #ccc; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
157 tr:nth-child(even) { background: #eee; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
158 tr:hover { background: #ddd; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
159 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
160
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
161 @media (max-width: 767px) {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
162 table {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
163 border-spacing: 0 10px;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
164 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
165 th { display: none; }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
166 tr {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
167 background: #eee;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
168 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
169 td {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
170 display: inline-block;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
171 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
172 td:first-child {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
173 background: #ddd;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
174 padding: 5px;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
175 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
176 table a {
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
177 font-size: 18px;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
178 display: block;
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
179 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
180 }
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
181 </style>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
182 </head>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
183 <body>
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
184 <h1>Index of <?php echo tree_link(); ?></h1>
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
185
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
186 <table>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
187 <thead><tr>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
188 <th>File</th>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
189 <th>Size</th>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
190 <th>Date</th>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
191 </tr></thead>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
192 <tbody>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
193 <?php echo file_rows($dirs, true); ?>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
194 <?php echo file_rows($files, false); ?>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
195 </tbody>
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
196 </table>
4
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
197
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
198 <footer>
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
199 <hr>
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
200 <em>
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
201 Running <a href="https://bitbucket.org/edogawaconan/dirlist-php">dirlist-php</a>.
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
202 Powered by PHP <?php echo phpversion(); ?>.
7812af1c23ae Actual refactor.
edogawaconan <me@myconan.net>
parents: 3
diff changeset
203 </em>
3
9ea8be5b28d1 "refactor".
edogawaconan <me@myconan.net>
parents: 2
diff changeset
204 </body>