2005-07-27 20:09:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include ('config.php');
|
|
|
|
|
|
|
|
function dm_usort_cmp ($a, $b) {
|
|
|
|
if ($a == $b) return 0;
|
|
|
|
return ($a > $b) ? -1 : 1;
|
|
|
|
}
|
|
|
|
|
2005-08-02 15:58:41 +00:00
|
|
|
function dm_usort_cmp_desc ($a, $b) {
|
|
|
|
if ($a == $b) return 0;
|
|
|
|
return ($a > $b) ? 1 : -1;
|
|
|
|
}
|
|
|
|
|
2005-07-27 20:09:19 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2005-08-02 15:58:41 +00:00
|
|
|
function printMenu($revision)
|
2005-07-27 20:09:19 +00:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<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())) {
|
2005-08-02 15:58:41 +00:00
|
|
|
if ((strcasecmp($entry, ".") != 0) && (strcasecmp($entry, "..") != 0) && is_dir(ISO_PATH . "\\" . $entry) == "dir") {
|
2005-07-27 20:09:19 +00:00
|
|
|
$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>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<b>Revision:</b>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?php
|
|
|
|
echo "<input type=\"text\" name=\"revision\" size=\"10\" maxlength=\"10\" tabindex=\"2\" value=\"" . $revision . "\"></input>";
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type="submit" name="getiso" value="Download" tabindex="3" style="border: 1px solid #000000"></input>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2005-08-02 15:58:41 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan="7">
|
|
|
|
<hr size="2" width="100%" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2005-08-02 16:13:02 +00:00
|
|
|
<td colspan="4">
|
2005-08-02 15:58:41 +00:00
|
|
|
<input type="submit" name="getnextiso" value="Next ISO" tabindex="4" style="border: 1px solid #000000"></input>
|
|
|
|
</td>
|
2005-08-02 16:13:02 +00:00
|
|
|
<td colspan="3" align="right">
|
|
|
|
<input type="submit" name="getlatestiso" value="Latest ISO" tabindex="5" style="border: 1px solid #000000"></input>
|
|
|
|
</td>
|
2005-08-02 15:58:41 +00:00
|
|
|
</tr>
|
2005-07-27 20:09:19 +00:00
|
|
|
</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
|
|
|
|
}
|
|
|
|
|
2005-08-02 16:13:02 +00:00
|
|
|
function locateRevisionISO($branch, $revision, $latest)
|
2005-08-02 15:58:41 +00:00
|
|
|
{
|
|
|
|
$revision = intval($revision);
|
|
|
|
$path = ISO_PATH . "\\" . $branch;
|
|
|
|
$d = dir($path);
|
|
|
|
$i = 0;
|
|
|
|
$filelist = array();
|
|
|
|
while (false !== ($entry = $d->read())) {
|
|
|
|
if (is_dir($path . "\\" . $entry) != "dir")
|
|
|
|
$filelist[$i++] = $entry;
|
|
|
|
}
|
|
|
|
$d->close();
|
|
|
|
|
|
|
|
if (is_array($filelist)) {
|
2005-08-02 16:13:02 +00:00
|
|
|
$sortFunction = $latest ? "dm_usort_cmp" : "dm_usort_cmp_desc";
|
|
|
|
usort($filelist, $sortFunction);
|
2005-08-02 15:58:41 +00:00
|
|
|
reset($filelist);
|
|
|
|
while (list($key, $filename) = each($filelist)) {
|
|
|
|
if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs))
|
|
|
|
{
|
|
|
|
$thisRevision = intval($regs[1]);
|
2005-08-02 16:13:02 +00:00
|
|
|
if (($latest) && ($thisRevision < $revision))
|
|
|
|
return $regs[1];
|
|
|
|
else if ($thisRevision > $revision)
|
2005-08-02 15:58:41 +00:00
|
|
|
return $regs[1];
|
|
|
|
$lastRevision = $thisRevision;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2005-08-02 16:13:02 +00:00
|
|
|
function getNextRevisionISO($branch, $revision)
|
|
|
|
{
|
|
|
|
return locateRevisionISO($branch, $revision, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLatestRevisionISO($branch)
|
|
|
|
{
|
|
|
|
return locateRevisionISO($branch, 999999, true);
|
|
|
|
}
|
2005-08-02 15:58:41 +00:00
|
|
|
|
2005-07-27 20:09:19 +00:00
|
|
|
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();
|
2005-08-02 15:58:41 +00:00
|
|
|
printMenu($_POST["revision"]);
|
2005-07-27 20:09:19 +00:00
|
|
|
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();
|
2005-08-02 15:58:41 +00:00
|
|
|
else if (!empty($_POST["getnextiso"]) && !empty($_POST["branch"]) && !empty($_POST["revision"]) && is_numeric($_POST["revision"]))
|
|
|
|
{
|
|
|
|
printHeader();
|
|
|
|
printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"]));
|
|
|
|
printFooter();
|
|
|
|
}
|
2005-08-02 16:13:02 +00:00
|
|
|
else if (!empty($_POST["getlatestiso"]) && !empty($_POST["branch"]))
|
|
|
|
{
|
|
|
|
printHeader();
|
|
|
|
printMenu(getLatestRevisionISO($_POST["branch"]));
|
|
|
|
printFooter();
|
|
|
|
}
|
2005-07-27 20:09:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
printHeader();
|
2005-08-02 15:58:41 +00:00
|
|
|
printMenu($_POST["revision"]);
|
2005-07-27 20:09:19 +00:00
|
|
|
printFooter();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|