summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--log_files.php66
-rw-r--r--style.css5
2 files changed, 44 insertions, 27 deletions
diff --git a/log_files.php b/log_files.php
index 7c365b9..4648a6f 100644
--- a/log_files.php
+++ b/log_files.php
@@ -34,44 +34,23 @@ if (!is_dir($path)) {
die('Sorry, not found');
}
-$glob = $path . '/*';
-$s = sprintf('<h4>%s</h4>', $job);
-$s .= '<ul>';
-
-foreach (glob_recursive($glob) as $f) {
- if (is_dir($f))
- continue;
-
- $link = 'uploads' . str_replace($upload_dir, '', $f);
- $show = str_replace(array($path . '/', '/'), array('', ' / '), $f);
- $s .= sprintf('<li><a href="%s" rel="nofollow" class="view-inline">%s</a> (%s)</li>',
- $link, $show,
- _format_bytes(filesize($f))
- );
-}
+$list = glob_recursive_tree($path . '/*');
$others = array(
'.youri',
'_i586.done',
'_x86_64.done'
);
+
foreach ($others as $suffix) {
$f = $path . $suffix;
if (file_exists($f)) {
- $link = 'uploads' . str_replace($upload_dir, '', $f);
- $show = explode($path, $f);
- $show = $job . $suffix;
- $s .= sprintf('<li><a href="%s" rel="nofollow" class="view-inline">%s</a> (%s)</li>',
- $link, $show,
- _format_bytes(filesize($f))
- );
+ $list[] = $f;
}
}
-$s .= '</ul>';
-
-echo $s;
-
+echo sprintf('<h4>%s</h4>', $job),
+ print_list($list);
// lib code below.
@@ -129,3 +108,38 @@ function glob_recursive($pattern, $flags = 0)
return $files;
}
+
+function glob_recursive_tree($pattern, $flags = 0)
+{
+ $files = glob($pattern, $flags);
+ foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
+ $dirtop = explode('/', $dir);
+ $files[end($dirtop)] = glob_recursive_tree($dir . '/' . basename($pattern), $flags);
+ }
+
+ return $files;
+}
+
+function print_list($list)
+{
+ global $upload_dir, $path;
+
+ $l = array();
+ foreach ($list as $f) {
+ if (!is_string($f)) {
+ continue;
+ }
+
+ if (is_dir($f)) {
+ $top = basename($f);
+ $l[] = sprintf('<li><span class="dir">%s</span>%s</li>', $top, print_list($list[$top]));
+ } elseif (file_exists($f)) {
+ $l[] = sprintf('<li><a href="%s" rel="nofollow" class="view-inline">%s</a> (%s)</li>',
+ 'uploads' . str_replace($upload_dir, '', $f),
+ basename($f),
+ _format_bytes(filesize($f))
+ );
+ }
+ }
+ return sprintf('<ul>%s</ul>', implode($l));
+}
diff --git a/style.css b/style.css
index 9c7fac6..b8a3f73 100644
--- a/style.css
+++ b/style.css
@@ -46,10 +46,13 @@ td span.timeinfo { display: block; font-size: 85%; text-align: left; }
.figure { font-size: 120%%; font-weight: bold; }
-tr.build-files-list td { font-size: 85%; padding: 1em 0 2em 1em; color: #555; }
+tr.build-files-list td { font-size: 85%; padding: 1em 0 2em 0.5em; color: #222; }
+ tr.build-files-list td ul { padding: 0 0 0 2em; }
tr.build-files-list td a { text-decoration: none; }
tr.build-files-list td h4 { margin: 0 0 0.6em 0; }
+span.dir { font-weight: bold; }
+
.file-view {
white-space: pre;
resize: both;