diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-09-13 12:26:32 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-09-13 12:26:32 +0200 |
commit | 6f4f6b31435b771471a46a523161ca2bc9359919 (patch) | |
tree | 0f26d33dbf6e962ef4aec804d9e4167124366787 | |
parent | 16024da8be99cd90538228c04ad3a12e75ed88a0 (diff) | |
download | mlmmj-webarchiver-6f4f6b31435b771471a46a523161ca2bc9359919.tar.gz mlmmj-webarchiver-6f4f6b31435b771471a46a523161ca2bc9359919.tar.xz mlmmj-webarchiver-6f4f6b31435b771471a46a523161ca2bc9359919.zip |
Added year separation for mailing list index file.
-rw-r--r-- | mlmmj-webarchiver/index.php.newlist | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mlmmj-webarchiver/index.php.newlist b/mlmmj-webarchiver/index.php.newlist index c978936..9acd78d 100644 --- a/mlmmj-webarchiver/index.php.newlist +++ b/mlmmj-webarchiver/index.php.newlist @@ -1,12 +1,22 @@ <?php - $baselistdir = getcwd(); - $mlist = substr (strrchr ($baselistdir, "/"), 1); - $mlistdir = opendir($baselistdir); - while($file = readdir($mlistdir)) { - if(is_dir($baselistdir . "/" . $file) && $file != "." && $file != "..") { - $archived_months .= "<a href=\"$file\">$file</a><br />\n"; - } +$path = getcwd(); +$mlist = substr(strrchr($path, "/"), 1); +$handle = @opendir($path) or die("Unable to open $path"); +while($file = readdir($handle)) { + if(is_dir($path . "/" . $file) && $file != "." && $file != "..") { + $files[] = $file; } +} +closedir($handle); +rsort($files); +reset($files); +foreach($files as $k => $file) { + if (! isset($year) || $year != substr($file, 0, 4)) { + $year = substr($file, 0, 4); + $archived_months .= "<h1>$year</h1>"; + } + $archived_months .= "<a href=\"$file\">$file</a><br />\n"; +} ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> |