24828e3a85dd726275088f8965256ccdf8836e38
3 include ('config.php');
5 function dm_usort_cmp ($a, $b) {
6 if ($a == $b) return 0;
7 return ($a > $b) ?
-1 : 1;
10 function dm_usort_cmp_desc ($a, $b) {
11 if ($a == $b) return 0;
12 return ($a > $b) ?
1 : -1;
15 function printHeader()
18 <!doctype html
public "-//W3C//DTD HTML 4.0 Transitional//EN">
21 <title
>ReactOS Revison ISOs
</title
>
22 <meta name
="generator" content
="Editpad">
23 <meta name
="keywords" content
="OS, ReactOS, operating system">
24 <meta name
="author" content
="ReactOS Project (ros-dev@reactos.com)">
29 background
-color
: #88aadd;
30 border
-left
: 1px solid
#f0f0f0;
31 border
-right
: 1px solid
#000000;
32 border
-top
: 1px solid
#f0f0f0;
33 border
-bottom
: 1px solid
#000000;
37 <body bgcolor
="#88aadd">
38 <form method
="post" action
="">
42 function printMenu($revision)
45 <table border
="0" class="box" cellpadding
="5">
53 <table border
="0" cellpadding
="0" cellspacing
="0">
59 <select name
="branch" tabindex
="1">
65 while (false !== ($entry = $d->read())) {
66 if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH
. "\\" . $entry) == "dir") {
67 $dirlist[$i++
] = $entry;
72 if (is_array($dirlist)) {
73 usort($dirlist, "dm_usort_cmp");
75 while (list($key, $val) = each($dirlist)) {
77 if ($branch == $_POST["branch"] ||
(!isset($_POST["branch"]) && $branch == "trunk"))
78 $selected = " selected";
81 echo "<option$selected>$branch</option>";
96 echo "<input type=\"text\" name=\"revision\" size=\"10\" maxlength=\"10\" tabindex=\"2\" value=\"" . $revision . "\"></input>";
103 <input type
="submit" name
="getiso" value
="Download" tabindex
="3" style
="border: 1px solid #000000"></input
>
108 <hr size
="2" width
="100%" />
113 <input type
="submit" name
="getnextiso" value
="Next ISO" tabindex
="4" style
="border: 1px solid #000000"></input
>
115 <td colspan
="3" align
="right">
116 <input type
="submit" name
="getlatestiso" value
="Latest ISO" tabindex
="5" style
="border: 1px solid #000000"></input
>
131 function printFooter()
137 var revision
= document
.getElementById('revision');
138 if (revision
) revision
.focus();
145 function locateRevisionISO($branch, $revision, $latest)
147 $revision = intval($revision);
148 $path = ISO_PATH
. "\\" . $branch;
152 while (false !== ($entry = $d->read())) {
153 if (is_dir($path . "\\" . $entry) != "dir")
154 $filelist[$i++
] = $entry;
158 if (is_array($filelist)) {
159 $sortFunction = $latest ?
"dm_usort_cmp" : "dm_usort_cmp_desc";
160 usort($filelist, $sortFunction);
162 while (list($key, $filename) = each($filelist)) {
163 if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs))
165 $thisRevision = intval($regs[1]);
166 if (($latest) && ($thisRevision < $revision))
168 else if ($thisRevision > $revision)
170 $lastRevision = $thisRevision;
178 function getNextRevisionISO($branch, $revision)
180 return locateRevisionISO($branch, $revision, false);
183 function getLatestRevisionISO($branch)
185 return locateRevisionISO($branch, 999999, true);
190 $branch = $_POST["branch"];
191 $revision = $_POST["revision"];
193 $filename = "ReactOS-" . $branch . "-r" . $revision . ".iso";
194 if (file_exists(ISO_PATH
. $branch . "\\" . $filename))
196 $location = ISO_BASE_URL
. $branch . "/" . $filename;
197 header("Location: $location");
203 printMenu($_POST["revision"]);
204 echo "<br><b>No ISO exist for branch '" . $branch . "' and revision " . $revision . ".</b><br><br>";
209 if (!empty($_POST["getiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
211 else if (!empty($_POST["getnextiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
214 printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"]));
217 else if (!empty($_POST["getlatestiso"]) && !empty($_POST["branch"]))
220 printMenu(getLatestRevisionISO($_POST["branch"]));
226 printMenu($_POST["revision"]);