r672 - webspace/include

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Mar 24 23:34:25 EST 2006


Author: floam
Date: 2006-03-24 23:34:25 -0500 (Fri, 24 Mar 2006)
New Revision: 672

Modified:
   webspace/include/downloads.php
   webspace/include/home.php
   webspace/include/thebrain.php
Log:
Change something into a function, make it so the current OS appears at top of list on Get page.


Modified: webspace/include/downloads.php
===================================================================
--- webspace/include/downloads.php	2006-03-25 03:38:56 UTC (rev 671)
+++ webspace/include/downloads.php	2006-03-25 04:34:25 UTC (rev 672)
@@ -1,4 +1,9 @@
 <?php
+function oscompare($a, $b) {
+	$os = determineos();
+	return ($a == $os) ? -1 : 1;
+}
+
 $downloads = array(
  "windows"	=>	'<h3>Windows (x86)</h3>
  				<p>Provides latest patch <tt>pk3</tt> data from
@@ -53,4 +58,6 @@
 				<a href="http://svn.icculus.org/quake3/trunk/?rev=653">revision 653</a>.
 				</em></p><p>Thanks to <a href="mailto:vmorenas at free.fr">Vincent Morénas</a>.</p> '
 );
+
+uksort($downloads, "oscompare");
 ?>

Modified: webspace/include/home.php
===================================================================
--- webspace/include/home.php	2006-03-25 03:38:56 UTC (rev 671)
+++ webspace/include/home.php	2006-03-25 04:34:25 UTC (rev 672)
@@ -13,28 +13,8 @@
 <h2>Download Now</h2>
 <p>
 <?php
-	$ua = get_browser(null, true);
+	$os = determineos();
 	include("downloads.php");
-	switch ($ua['platform']) {
-		case "Win95":
-		case "Win98":
-		case "WinME":
-		case "WinNT":
-		case "Win2000":		
-		case "WinXP":
-			$os = "windows";
-			break;
-		case "Linux":
-		case "FreeBSD":
-			$os = "linux";
-			break;
-		case "MacOSX":
-			$os = "apple";
-			break;
-		default:
-			$os = false;
-			break;
-	}
 	if ($os) {
 		echo "We have detected that you are most likely using " . $ua['platform'] .
 			". We have an installer for this platform: <div class=\"indent $os\">$downloads[$os]</div>

Modified: webspace/include/thebrain.php
===================================================================
--- webspace/include/thebrain.php	2006-03-25 03:38:56 UTC (rev 671)
+++ webspace/include/thebrain.php	2006-03-25 04:34:25 UTC (rev 672)
@@ -41,6 +41,31 @@
 	}
 }
 
+function determineOs() {
+	$ua = get_browser(null, true);
+	switch ($ua['platform']) {
+		case "Win95":
+		case "Win98":
+		case "WinME":
+		case "WinNT":
+		case "Win2000":		
+		case "WinXP":
+			$os = "windows";
+			break;
+		case "Linux":
+		case "FreeBSD":
+			$os = "linux";
+			break;
+		case "MacOSX":
+			$os = "apple";
+			break;
+		default:
+			$os = false;
+			break;
+	}
+	return $os;
+}
+
 if (!$_GET['page']) {
 	$page = "home";
 }




More information about the quake3-commits mailing list