minutes
diff --git a/pmc-minutes.php b/pmc-minutes.php
index 97d1a29..0741b5c 100644
--- a/pmc-minutes.php
+++ b/pmc-minutes.php
@@ -52,20 +52,30 @@
);
if ($dh = opendir($dir)) {
+ $keys = Array();
while (($file = readdir($dh)) !== false) {
if( preg_match( "/(\d\d\d\d)\.(\d\d)\.(\d\d)\.html/", $file, $matches ) > 0 ) {
$y = $matches[1];
$m = $matches[2];
$d = $matches[3];
$key = $y . "." . $m . "." . $d;
- $m = $months[$m];
- $contents = file_get_contents( "minutes/" . $key . ".html" );
- preg_match( "/<h1>(.*)<\/h1>/", $contents, $matches );
- $subject = $matches[1];
- echo "<li><a href=\"pmc-minutes.php?key=$key\">$m, $d $y - $subject</a></li>\n";
- }
- }
- closedir($dh);
+ $keys[] = $key;
+ }
+ }
+ closedir($dh);
+ sort( $keys );
+ $keys = array_reverse( $keys );
+ foreach( $keys as $key ) {
+ preg_match( "/(\d+)\.(\d+)\.(\d+)/", $key, $matches );
+ $y = $matches[1];
+ $m = $matches[2];
+ $d = $matches[3];
+ $m = $months[$m];
+ $contents = file_get_contents( "minutes/" . $key . ".html" );
+ preg_match( "/<h1>(.*)<\/h1>/", $contents, $matches );
+ $subject = $matches[1];
+ echo "<li><a href=\"pmc-minutes.php?key=$key\">$m, $d $y - $subject</a></li>\n";
+ }
} else {
echo "<li>" . $dir . " does not exist\n";
}