Put FindClose onto the correct position.
[reactos.git] / cis / ReactOS.RevisionISO / index.php
1 <?php
2
3 include ('config.php');
4
5 function dm_usort_cmp ($a, $b) {
6 if ($a == $b) return 0;
7 return ($a > $b) ? -1 : 1;
8 }
9
10 function printHeader()
11 {
12 ?>
13 <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
14 <html>
15 <head>
16 <title>ReactOS Revison ISOs</title>
17 <meta name="generator" content="Editpad">
18 <meta name="keywords" content="OS, ReactOS, operating system">
19 <meta name="author" content="ReactOS Project (ros-dev@reactos.com)">
20 <style>
21 .box
22 {
23 padding: 0px;
24 background-color: #88aadd;
25 border-left: 1px solid #f0f0f0;
26 border-right: 1px solid #000000;
27 border-top: 1px solid #f0f0f0;
28 border-bottom: 1px solid #000000;
29 }
30 </style>
31 </head>
32 <body bgcolor="#88aadd">
33 <form method="post" action="">
34 <?php
35 }
36
37 function printMenu()
38 {
39 ?>
40 <table border="0" class="box" cellpadding="5">
41 <tr>
42 <td height="2px">
43 </td>
44 </tr>
45 <tr>
46 <td>
47
48 <table border="0" cellpadding="0" cellspacing="0">
49 <tr>
50 <td>
51 <b>Branch:</b>
52 </td>
53 <td>
54 <select name="branch" tabindex="1">
55 <?php
56
57 $d = dir(ISO_PATH);
58 $i = 0;
59 $dirlist = array();
60 while (false !== ($entry = $d->read())) {
61 if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry)=="dir") {
62 $dirlist[$i++] = $entry;
63 }
64 }
65 $d->close();
66
67 if (is_array($dirlist)) {
68 usort($dirlist, "dm_usort_cmp");
69 reset($dirlist);
70 while (list($key, $val) = each($dirlist)) {
71 $branch = $val;
72 if ($branch == $_POST["branch"] || (!isset($_POST["branch"]) && $branch == "trunk"))
73 $selected = " selected";
74 else
75 $selected = "";
76 echo "<option$selected>$branch</option>";
77 }
78 }
79
80 ?>
81 </select>
82 </td>
83 <td>
84 &nbsp;
85 </td>
86 <td>
87 <b>Revision:</b>
88 </td>
89 <td>
90 <?php
91 $revision = $_POST["revision"];
92 echo "<input type=\"text\" name=\"revision\" size=\"10\" maxlength=\"10\" tabindex=\"2\" value=\"" . $revision . "\"></input>";
93 ?>
94 </td>
95 <td>
96 &nbsp;
97 </td>
98 <td>
99 <input type="submit" name="getiso" value="Download" tabindex="3" style="border: 1px solid #000000"></input>
100 </td>
101 </tr>
102 </table>
103
104 </td>
105 </tr>
106 <tr>
107 <td height="2px">
108 </td>
109 </tr>
110 </table>
111 <?php
112 }
113
114 function printFooter()
115 {
116 ?>
117 </form>
118
119 <script>
120 var revision = document.getElementById('revision');
121 if (revision) revision.focus();
122 </script>
123 </body>
124 </html>
125 <?php
126 }
127
128 function main()
129 {
130 $branch = $_POST["branch"];
131 $revision = $_POST["revision"];
132
133 $filename = "ReactOS-" . $branch . "-r" . $revision . ".iso";
134 if (file_exists(ISO_PATH . $branch . "\\" . $filename))
135 {
136 $location = ISO_BASE_URL . $branch . "/" . $filename;
137 header("Location: $location");
138 return;
139 }
140 else
141 {
142 printHeader();
143 printMenu();
144 echo "<br><b>No ISO exist for branch '" . $branch . "' and revision " . $revision . ".</b><br><br>";
145 printFooter();
146 }
147 }
148
149 if (!empty($_POST["getiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
150 main();
151 else
152 {
153 printHeader();
154 printMenu();
155 printFooter();
156 }
157
158 ?>