From c9a2c8aab8b3905f28411e4082450716315fbbba Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Tue, 2 Aug 2005 15:58:41 +0000 Subject: [PATCH] Locate next revision ISO svn path=/trunk/; revision=16971 --- cis/ReactOS.RevisionISO/index.php | 61 ++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/cis/ReactOS.RevisionISO/index.php b/cis/ReactOS.RevisionISO/index.php index 7efa46d929f..6dbd8717621 100644 --- a/cis/ReactOS.RevisionISO/index.php +++ b/cis/ReactOS.RevisionISO/index.php @@ -7,6 +7,11 @@ function dm_usort_cmp ($a, $b) { return ($a > $b) ? -1 : 1; } +function dm_usort_cmp_desc ($a, $b) { + if ($a == $b) return 0; + return ($a > $b) ? 1 : -1; +} + function printHeader() { ?> @@ -34,7 +39,7 @@ function printHeader() @@ -58,7 +63,7 @@ function printMenu() $i = 0; $dirlist = array(); while (false !== ($entry = $d->read())) { - if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry)=="dir") { + if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry) == "dir") { $dirlist[$i++] = $entry; } } @@ -88,7 +93,6 @@ function printMenu() @@ -99,6 +103,16 @@ function printMenu() + + + + + +
"; ?>
+
+
+ +
@@ -125,6 +139,37 @@ if (revision) revision.focus(); read())) { + if (is_dir($path . "\\" . $entry) != "dir") + $filelist[$i++] = $entry; + } + $d->close(); + + if (is_array($filelist)) { + usort($filelist, "dm_usort_cmp_desc"); + reset($filelist); + while (list($key, $filename) = each($filelist)) { + if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs)) + { + $thisRevision = intval($regs[1]); + if ($thisRevision > $revision) + return $regs[1]; + $lastRevision = $thisRevision; + } + } + } + + return ""; +} + + function main() { $branch = $_POST["branch"]; @@ -140,7 +185,7 @@ function main() else { printHeader(); - printMenu(); + printMenu($_POST["revision"]); echo "
No ISO exist for branch '" . $branch . "' and revision " . $revision . ".

"; printFooter(); } @@ -148,10 +193,16 @@ function main() if (!empty($_POST["getiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"])) main(); +else if (!empty($_POST["getnextiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"])) +{ + printHeader(); + printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"])); + printFooter(); +} else { printHeader(); - printMenu(); + printMenu($_POST["revision"]); printFooter(); }