www/nightly.adium.im 4:11bd7aa2f451: Multi-Nightly Support

commits at adium.im commits at adium.im
Wed Jul 27 09:29:21 UTC 2011


details:	http://hg.adium.im/www/nightly.adium.im/rev/11bd7aa2f451
revision:	4:11bd7aa2f451
branch:		(none)
author:		Adrian Godoroja <robotive at me.com>
date:		Wed Jul 27 11:52:26 2011 +0300

Multi-Nightly Support

diffs (66 lines):

diff -r 6bb1652eda11 -r 11bd7aa2f451 index.php
--- a/index.php	Sun May 31 13:00:18 2009 -0400
+++ b/index.php	Wed Jul 27 11:52:26 2011 +0300
@@ -6,6 +6,29 @@
         $e = (int)(log($b,1024)); 
         return number_format($b/pow(1024,$e),1,'.','').$s[$e];
 }
+
+function sane_path($path, $default) {
+    if (!isset($path) || preg_match("/\.\.|\/|<|>/", $path)) {
+        return $default;
+    } else {
+        return $path;
+    }
+}
+
+function existing_branch($repo, $branch) {
+    if (!file_exists("$repo-$branch")) {
+        $branch = "default";
+        if (!file_exists("$repo-$branch")) {
+            $repo = "adium";
+        }
+    }
+    return array($repo, $branch);
+}
+
+$repo = sane_path($_GET['repo'], 'adium');
+$branch = sane_path($_GET['branch'], 'default');
+list($repo, $branch) = existing_branch($repo, $branch);
+$repo_branch =  "$repo-$branch";
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
 	"http://www.w3.org/TR/html4/strict.dtd">
@@ -37,7 +60,7 @@
 			<a class="navtab" href="http://adium.im/">Download</a> <a class="navtab" href="http://adium.im/screenshots/">Screenshots</a> <a class="navtab" href="http://adium.im/screencasts/">Videos</a> <a class="navtab" href="http://adium.im/blog/">Blog</a> <a class="navtabcurrent" href="http://trac.adium.im">Support & Development</a> <a class="navtab" href="http://www.adiumxtras.com/">Xtras</a>
 		</div>
 		<div id="content">
-			<h2>Nightly</h2>
+			<h2>Nightly for <?= $repo_branch ?></h2>
 			<p id="download" style="line-height: 1.3em;">
 				<img src="http://adium.im/images/logo_small.png" />
 		These are <strong>NOT A BETA</strong>; do not expect support. Betas can be found on the <a href="http://beta.adium.im">beta page</a>.<br />
@@ -53,11 +76,12 @@
 			<th>MD5</th>
             <th>Uploaded</th>
         </tr>
-<?  $filelist = array_reverse(scandir("/var/www/html/"));
-	
+<?  $filelist = array_reverse(scandir($repo_branch));
+
 	$alternating = 0;
 
-    foreach ($filelist as $filename) {  
+    foreach ($filelist as $filename) {
+        $filename = $repo_branch . "/" . $filename;
         if (preg_match("/^\./",$filename) || preg_match("/(latest.*|\.php|\.png|\.gif|\.md5)$/",$filename)) { continue; }
 
 		if ($alternating) {
@@ -96,5 +120,4 @@
 		pageTracker._trackPageview();
 	</script>
 </body>
-</html>
-
+</html>
\ No newline at end of file




More information about the commits mailing list