Add Revison ISO interface
authorCasper Hornstrup <chorns@users.sourceforge.net>
Wed, 27 Jul 2005 20:09:19 +0000 (20:09 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Wed, 27 Jul 2005 20:09:19 +0000 (20:09 +0000)
svn path=/trunk/; revision=16814

cis/ReactOS.RevisionISO/config.template.php [new file with mode: 0644]
cis/ReactOS.RevisionISO/index.php [new file with mode: 0644]

diff --git a/cis/ReactOS.RevisionISO/config.template.php b/cis/ReactOS.RevisionISO/config.template.php
new file mode 100644 (file)
index 0000000..59b942e
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+/* Rename to config.php */
+
+define(ISO_BASE_URL, "http://www.server.com/iso/");
+define(ISO_PATH, "C:\\iso\\");
+
+?>
diff --git a/cis/ReactOS.RevisionISO/index.php b/cis/ReactOS.RevisionISO/index.php
new file mode 100644 (file)
index 0000000..7efa46d
--- /dev/null
@@ -0,0 +1,158 @@
+<?php
+
+include ('config.php');
+
+function dm_usort_cmp ($a, $b) {
+  if ($a == $b) return 0;
+  return ($a > $b) ? -1 : 1;
+}
+
+function printHeader()
+{
+?>
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>ReactOS Revison ISOs</title>
+<meta name="generator" content="Editpad">
+<meta name="keywords" content="OS, ReactOS, operating system">
+<meta name="author" content="ReactOS Project (ros-dev@reactos.com)">
+<style>
+.box
+{
+       padding: 0px;
+       background-color: #88aadd;
+       border-left: 1px solid #f0f0f0;
+       border-right: 1px solid #000000;
+       border-top: 1px solid #f0f0f0;
+       border-bottom: 1px solid #000000;
+}
+</style>
+</head>
+<body bgcolor="#88aadd">
+<form method="post" action="">
+<?php
+}
+
+function printMenu()
+{
+?>
+<table border="0" class="box" cellpadding="5">
+<tr>
+<td height="2px">
+</td>
+</tr>
+<tr>
+<td>
+
+<table border="0" cellpadding="0" cellspacing="0">
+<tr>
+       <td>
+               <b>Branch:</b>
+       </td>
+       <td>
+               <select name="branch" tabindex="1">
+<?php
+
+    $d = dir(ISO_PATH);
+    $i = 0;
+    $dirlist = array();
+    while (false !== ($entry = $d->read())) {
+      if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry)=="dir") {
+        $dirlist[$i++] = $entry;
+      }
+    }
+    $d->close();
+
+    if (is_array($dirlist)) {
+      usort($dirlist, "dm_usort_cmp");
+      reset($dirlist);
+      while (list($key, $val) = each($dirlist)) {
+        $branch = $val;
+       if ($branch == $_POST["branch"] || (!isset($_POST["branch"]) && $branch == "trunk"))
+               $selected = " selected";
+       else
+               $selected = "";
+       echo "<option$selected>$branch</option>";
+      }
+    }
+       
+?>
+               </select>
+       </td>
+       <td>
+               &nbsp;
+       </td>
+       <td>
+               <b>Revision:</b>
+       </td>
+       <td>
+<?php
+       $revision = $_POST["revision"];
+       echo "<input type=\"text\" name=\"revision\" size=\"10\" maxlength=\"10\" tabindex=\"2\" value=\"" . $revision . "\"></input>";
+?>
+       </td>
+       <td>
+               &nbsp;
+       </td>
+       <td>
+               <input type="submit" name="getiso" value="Download" tabindex="3" style="border: 1px solid #000000"></input>
+       </td>
+</tr>
+</table>
+
+</td>
+</tr>
+<tr>
+<td height="2px">
+</td>
+</tr>
+</table>
+<?php
+}
+
+function printFooter()
+{
+?>
+</form>
+
+<script>
+var revision = document.getElementById('revision');
+if (revision) revision.focus();
+</script>
+</body>
+</html>
+<?php
+}
+
+function main()
+{
+       $branch = $_POST["branch"];
+       $revision = $_POST["revision"];
+
+       $filename = "ReactOS-" . $branch . "-r" . $revision . ".iso";
+       if (file_exists(ISO_PATH . $branch . "\\" . $filename))
+       {
+               $location = ISO_BASE_URL . $branch . "/" . $filename;
+               header("Location: $location");
+               return;
+       }
+       else
+       {
+               printHeader();
+               printMenu();
+               echo "<br><b>No ISO exist for branch '" . $branch . "' and revision " . $revision . ".</b><br><br>";
+               printFooter();
+       }
+}
+
+if (!empty($_POST["getiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
+       main();
+else
+{
+       printHeader();
+       printMenu();
+       printFooter();
+}
+
+?>