Simplify spec index script and include RECs
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Fri, 10 Jan 2014 13:44:53 +0100
changeset 2067 08125303bb03
parent 2066 5d67441f1346
child 2068 85fa70be5f91
Simplify spec index script and include RECs
spec/index.php
--- a/spec/index.php	Thu Jan 09 18:56:55 2014 +0100
+++ b/spec/index.php	Fri Jan 10 13:44:53 2014 +0100
@@ -40,65 +40,22 @@
 
 function getDrafts($spec)
 {
-    $spec .= '/';
-
-    // Find all drafts
-    $ed = @scandir('ED/' . $spec);
-    $fcgs = @scandir('FCGS/' . $spec);
-    $wd = @scandir('WD/' . $spec);
-    $cr = @scandir('CR/' . $spec);
-    $pr = @scandir('PR/' . $spec);
-
-    $all = array();
-
-    // Transform the arrays to date -> directory form
-    if ($ed) {
-        foreach ($ed as $date) {
-            if ('.' === $date[0]) {
-                continue;
-            }
-
-            $all[$date] = 'ED/' . $spec . $date;
-        }
-    }
-
-    if ($fcgs) {
-        foreach ($fcgs as $date) {
-            if ('.' === $date[0]) {
-                continue;
-            }
+    $specStatuses = array('ED', 'FCGS', 'WD', 'CR', 'PR', 'REC');
+    $spec .= DIRECTORY_SEPARATOR;
 
-            $all[$date] = 'FCGS/' . $spec . $date;
-        }
-    }
-
-    if ($wd) {
-        foreach ($wd as $date) {
-            if ('.' === $date[0]) {
-                continue;
-            }
-
-            $all[$date] = 'WD/' . $spec . $date;
-        }
-    }
+    // Find all drafts and store them in date -> directory form
+    $all = array();
+    foreach ($specStatuses as $status) {
+        $dates = @scandir($status . DIRECTORY_SEPARATOR . $spec);
 
-    if ($cr) {
-        foreach ($cr as $date) {
-            if ('.' === $date[0]) {
-                continue;
-            }
+        if ($dates) {
+            foreach ($dates as $date) {
+                if ('.' === $date[0]) {
+                    continue;
+                }
 
-            $all[$date] = 'CR/' . $spec . $date;
-        }
-    }
-
-    if ($pr) {
-        foreach ($pr as $date) {
-            if ('.' === $date[0]) {
-                continue;
+                $all[$date] = $status . DIRECTORY_SEPARATOR . $spec . $date;
             }
-
-            $all[$date] = 'PR/' . $spec . $date;
         }
     }