www: 6117aba6: Switching browser based OS detection to ...
caseyho at pidgin.im
caseyho at pidgin.im
Sun Dec 7 22:46:16 EST 2008
-----------------------------------------------------------------
Revision: 6117aba6ccf7c12fc7e79c6fa97cd3248d68732c
Ancestor: ac4fcdb97ec2bd1056f48fdcf3bd670559265f2e
Author: caseyho at pidgin.im
Date: 2008-12-08T03:39:38
Branch: im.pidgin.www
URL: http://d.pidgin.im/viewmtn/revision/info/6117aba6ccf7c12fc7e79c6fa97cd3248d68732c
Modified files:
inc/blurb.download.inc
ChangeLog:
Switching browser based OS detection to server side OS detection. This solves an IE7 bug where IE7 doesn't like scripts in the body of the page.
-------------- next part --------------
============================================================
--- inc/blurb.download.inc eb428ffb65a6a5d966b5410738c720a6185d20ff
+++ inc/blurb.download.inc 05efec4e57d83b8d022adeb7093f9dd4f19ea8b4
@@ -1,43 +1,44 @@
+<?
+ // Figure out what browser we're working with
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
+
+ // Default vals
+ $download_link = "/download/";
+ $download_os = "";
+
+ if (strstr($useragent, 'Win')) {
+ $download_os = "for Windows";
+ $download_link = "/download/windows/";
+ } else if (strstr($useragent, "Ubuntu")) {
+ // Once the PPA is ready to go public, we'll have a separate Ubuntu page.
+ $download_os = "for Ubuntu";
+ $download_link = "/download/source/";
+ } else if (strstr($useragent, 'CentOS') ||
+ strstr($useragent, 'RHEL')) {
+ $download_os = "for CentOS / RHEL";
+ $download_link = "/download/centos_rhel/";
+ } else if (strstr($useragent, "Fedora")) {
+ $download_os = "for Fedora Core";
+ $download_link = "/download/fedora_core/";
+ } else if (strstr($useragent, "Mac")) {
+ $download_os = "for Mac OS X";
+ $download_link = "/download/mac/";
+ } else if (strstr($useragent, 'X11') ||
+ strstr($useragent, 'Linux')) {
+ $download_os = "Source";
+ $download_link = "/download/source/";
+ }
+?>
+
<div id="download">
<?php if ($page['section'] == "Home") { ?>
<img src="/shared/img/logo.pidgin.png" alt="[Pidgin Logo]" id="logo" width="107" height="185" />
<?php } ?>
-<a id="download_link" href="/download/">
+<a id="download_link" href="<? echo $download_link; ?>">
<img src="/shared/img/button.download.png" alt="[Down Arrow]" id="downbutton" width="48" height="48"
/>
Download Pidgin<br />
<span class="number"><? echo $pidgin_version; ?></span>
-<span class="number" id="os_name" style="display: none;"></span></a>
-
-<script type="text/javascript"><!--
-if (navigator.platform.indexOf("Win") != -1) {
- document.getElementById("download_link").href = "/download/windows";
- document.getElementById("os_name").innerHTML = "for Windows";
- document.getElementById("os_name").style.display = "inline";
-} else if (navigator.userAgent.indexOf("Ubuntu") != -1) {
-// Once the PPA is ready to go public, we'll have a separate Ubuntu page.
- document.getElementById("download_link").href = "/download/source";
- document.getElementById("os_name").innerHTML = "for Ubuntu";
- document.getElementById("os_name").style.display = "inline";
-} else if (navigator.userAgent.indexOf("CentOS") != -1 ||
- navigator.userAgent.indexOf("RHEL") != -1) {
- document.getElementById("download_link").href = "/download/centos_rhel/";
- document.getElementById("os_name").innerHTML = "for CentOS / RHEL";
- document.getElementById("os_name").style.display = "inline";
-} else if (navigator.userAgent.indexOf("Fedora") != -1) {
- document.getElementById("download_link").href = "/download/fedora_core/";
- document.getElementById("os_name").innerHTML = "for Fedora Core";
- document.getElementById("os_name").style.display = "inline";
-} else if (navigator.platform.indexOf("Mac") != -1) {
- document.getElementById("download_link").href = "/download/mac/";
- document.getElementById("os_name").innerHTML = "for Mac OS X";
- document.getElementById("os_name").style.display = "inline";
-} else if (navigator.platform.indexOf("X11") != -1 ||
- navigator.platform.indexOf("Linux")) {
- document.getElementById("download_link").href = "/download/source";
- document.getElementById("os_name").innerHTML = "Source";
- document.getElementById("os_name").style.display = "inline";
-}
-// --></script>
+<span class="number" id="os_name"> <? echo $download_os; ?></span></a>
</div>
More information about the Commits
mailing list