os-specific.php 6.28 KB
Newer Older
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1
<?php
Felix Paul Kühne's avatar
Felix Paul Kühne committed
2
$win32version = '2.0.2';
Felix Paul Kühne's avatar
Felix Paul Kühne committed
3
$macosxversion = '2.0.3';
Felix Paul Kühne's avatar
Felix Paul Kühne committed
4
$version = '2.0.2';
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
5 6 7 8 9 10 11 12 13 14 15 16 17

$dlUrl = "http://sourceforge.net/projects/vlc/files/$win32version/win32/vlc-$win32version-win32.exe/download";

function replaceDLinfos( )
{
    global $version;
    global $win32version;
    global $macosxversion;
    ?><script type='text/javascript'>
    //Editable details for the client side OS appropriate download detection.
    var latestVersion  = '<?php echo "$version"; ?>';
    <?php
    echo "
Felix Paul Kühne's avatar
Felix Paul Kühne committed
18 19 20 21
    var windowsDetails = {'name': 'Windows', 'size': '22&nbsp;MB', 'location': 'http://sourceforge.net/projects/vlc/files/$win32version/win32/vlc-$win32version-win32.exe/download'};
    var osxDetails     = {'name': 'Mac OS X', 'size': '41&nbsp;MB', 'location': 'http://sourceforge.net/projects/vlc/files/$macosxversion/macosx/vlc-$macosxversion.dmg/download' };
    var osx32Details   = {'name': 'Mac OS X (32bit)', 'size': '25&nbsp;MB', 'location': 'http://sourceforge.net/projects/vlc/files/$macosxversion/macosx/vlc-$macosxversion-intel.dmg/download' };
    var osx64Details   = {'name': 'Mac OS X (64bit)', 'size': '26&nbsp;MB', 'location': 'http://sourceforge.net/projects/vlc/files/$macosxversion/macosx/vlc-$macosxversion-intel64.dmg/download' };
Felix Paul Kühne's avatar
Felix Paul Kühne committed
22
    var osxPPCDetails  = {'name': 'Mac OS X (PPC)', 'size': '24&nbsp;MB', 'location': 'http://sourceforge.net/projects/vlc/files/$macosxversion/macosx/vlc-$macosxversion-powerpc.dmg/download' };"; ?>
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
23 24
    var linuxDetails   = {'name': 'Linux', 'size': '', 'location': '/vlc/#download'};
    var debianDetails  = {'name': 'Debian GNU/Linux', 'size': '', 'location': '/vlc/download-debian.html'};
25
    var ubuntuDetails  = {'name': 'Ubuntu Linux', 'size': '', 'location': 'apt://vlc'};
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
26 27 28 29 30 31 32
    var fedoraDetails  = {'name': 'Fedora Linux', 'size': '', 'location': '/vlc/download-fedora.html'};
    var redhatDetails  = {'name': 'RedHat Linux', 'size': '', 'location': '/vlc/download-redhat.html'};
    var gentooDetails  = {'name': 'Gentoo Linux', 'size': '', 'location': '/vlc/download-gentoo.html'};
    var suseDetails    = {'name': 'Suse Linux', 'size': '', 'location': '/vlc/download-suse.html'};
    var mandrivaDetails  = {'name': 'Mandriva Linux', 'size': '', 'location': '/vlc/download-mandriva.html'};
    var beosDetails  = {'name': 'BeOS', 'size': '', 'location': '/vlc/download-beos.html'};
    var freebsdetails  = {'name': 'FreeBSD', 'size': '', 'location': '/vlc/download-freebsd.html'};
Rémi Denis-Courmont's avatar
Typo  
Rémi Denis-Courmont committed
33
    var iosdetails  = {'name': 'iOS 3.2+', 'size': '9&nbsp;MB', 'location': '/vlc/download-ios.html'};
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
34 35 36 37 38 39 40 41 42 43 44

    //Attempt to load the bright button gradient into cache for faster switching on mouse over (may not work on all browsers.)
    var cache = new Image();
    cache.src = '/style/images/downloadButtonGradientOrangeBright.png';

    $(document).ready(function () {
       var OS="windows"; //Default

       if (navigator.appVersion.indexOf("Win")!=-1){
         OS="windows";
         latestVersion = '<?php echo "$win32version"; ?>';
45
         $("#downloadButton").addClass('sourceforge_accelerator_link');
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
46 47 48 49 50 51 52 53
       }
       if (navigator.appVersion.indexOf("Mac")!=-1) {
          latestVersion = '<?php echo "$macosxversion"; ?>';
          if (navigator.platform.indexOf("MacPPC")!= -1 || navigator.platform.indexOf("PowerPC") != -1 ) OS="osxPPC";
          else if (navigator.userAgent.indexOf("OS X 10.5")!=-1) OS="osx32";
          else if (navigator.userAgent.indexOf("OS X 10.6")!=-1) OS="osx64";
          else if (navigator.userAgent.indexOf("OS X 10.7")!=-1) OS="osx64";
          else OS="osx";
54 55

         $("#downloadButton").addClass('sourceforge_accelerator_link');
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
       }
       if (navigator.platform.indexOf("BeOS") !=-1) OS="beos";
       if (navigator.platform.indexOf("Linux")!=-1) {
            if((navigator.userAgent.indexOf("Ubuntu") != -1) ||
                (navigator.userAgent.indexOf("ubuntu") != -1)) OS="ubuntu";
            else if(navigator.userAgent.indexOf("Debian") != -1) OS="debian";
            else if(navigator.userAgent.indexOf("Mandriva") != -1) OS="mandriva";
            else if(navigator.userAgent.indexOf("Red Hat") != -1) OS="redhat";
            else if(navigator.userAgent.indexOf("Fedora") != -1) OS="fedora";
            else if(navigator.userAgent.indexOf("SUSE") != -1) OS="suse";
            else if(navigator.userAgent.indexOf("Gentoo") != -1) OS="gentoo";
            else OS="linux";
       }
       if (navigator.platform.indexOf("freebsd") != -1) OS="freebsd";
       if (navigator.platform.indexOf("FreeBSD") != -1) OS="freebsd";
       if (navigator.userAgent.indexOf("iPad") != -1  || navigator.userAgent.indexOf("iPhone") != -1 || navigator.userAgent.indexOf("iPod") != -1) OS ="ios";

       $('#downloadDetails').html("Version " + latestVersion + " &nbsp;&#8226;&nbsp; " + eval(OS+"Details.name") + " &nbsp;&#8226;&nbsp; " + eval(OS+"Details.size"));
       $('#downloadButton').attr('href',eval(OS+"Details.location"))
    });
    </script>
<?php
}

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
80 81 82
function downloadButton()
{
?>
83
     <a id='downloadButton' href='<?php echo $dlUrl; ?>'>
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
84 85 86 87 88 89 90 91 92 93 94
         <img style='position: absolute; top: -10px; left: -10px;' src='/images/downloadVLC.png' alt='Download VLC icon' />
         <span class='downloadText'><?php echo _("Download VLC"); ?></span>
         <span id='downloadDetails' style='font-size: 12px; color: white;'>
         Version <span id='downloadVersion'><?php echo $win32version ?>
         </span>&nbsp;&#8226;&nbsp;<span id='downloadOS'>Windows</span>&nbsp;&#8226;&nbsp;<span id='downloadSize'>20MB</span>
         </span>
    </a>
    <a class='extraInfoLink' href='/vlc/#download' style="padding-left: 100px;"><?php echo _("Other Systems and Versions");?></a>
<?php replaceDLinfos();
}

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
function Screenshot( $os )
{
    $scr = array();
    $scr["Win32"] = array( "http://images.videolan.org/images/screenshots/windows.jpg" ,
            "VLC on Windows", 300, 245 );
    $scr["Linux"] = array( "http://images.videolan.org/images/screenshots/vlc-linux.jpg" ,
            "VLC on Linux", 300, 233 );
    $scr["iOS"] = array( "http://images.videolan.org/images/screenshots/vlc-ios.jpg" ,
            "VLC on iOS", 300, 119 );
    $scr["OSX"] = array( "http://images.videolan.org/images/screenshots/vlc-osx.jpg" ,
            "VLC on Mac OS X", 300, 200 );
    echo "document.writeln('<img width=\"".$scr[$os][2]."\" height=\"".$scr[$os][3]."\" src=\"".$scr[$os][0]."\" alt=\"";
    echo $scr[$os][1]."\" />');";
}

?>