Ticket #144: download.php

File download.php, 5.3 KB (added by Simek, 17 years ago)

boinc/doc/download.php -> test version in XHTML 1.1

Line 
1<?php
2
3// NOTE: the core client fetches download.php?xml=1 every so often;
4// don't break this!!!
5//
6// WARNING: it's na test version write i XHTML 1.1!!!
7// This code could have some errors and bugs!!!
8
9require_once("docutil.php");
10require_once("versions.inc");
11require_once("../html/inc/translation.inc");
12
13$client_info = $_SERVER['HTTP_USER_AGENT'];
14
15function latest_version($p) {
16    foreach ($p['versions'] as $i=>$v) {
17        if (!$dev && is_dev($v)) continue;
18        return $v;
19    }
20    foreach ($p['versions'] as $i=>$v) {
21        return $v;
22    }
23}
24
25function download_link($pname) {
26    global $platforms;
27    global $url_base;
28    $p = $platforms[$pname];
29    $v = latest_version($p);
30    $file = $v['file'];
31    $long_name = $p['name'];
32    $num = $v['num'];
33    $path = "dl/$file";
34    $url = $url_base.$file;
35    $dlink = "<a href=\"$url\">$file</a>";
36    $s = number_format(filesize($path)/1000000, 2);
37
38    echo "
39        <table style=\"border: 4px; padding: 10px\"><tr><td style=\"background-color: #ccccff\">
40        <a href=\"$url\" style=\"font-size: 18px; text-decoration: underline\">".tr(DL_DOWNLOAD)."</a>
41        <br />".
42        sprintf(tr(DL_VERSION_LNAME_SIZE), $num, $long_name, $s )."
43        </td></tr></table>
44    ";
45    if ($pname == 'linux') {
46        echo "
47            <p>Note: BOINC may be available as a package for for your particular Linux distribution
48                (Gentoo, Fedora, Debian, Ubuntu); check this first before downloading from this page.</p>
49            <p>Note: 5.9.1+ requires GLIBC 2.4 or better to run. This
50                change was required for the benchmarks to be similar
51                to the other platforms.</p>
52        ";
53    }
54}
55
56function link_row($pname) {
57    echo "<tr><td>";
58    if ($pname=='win') {
59        echo "<img src=\"images/ico-win.png\" alt=\"Windows\"> <span style=\"font-weight: bold;\">Windows</span>";
60    } else if ($pname=='mac') {
61        echo "<img src=\"images/ico-osx-uni.png\" alt=\"Mac OS X\"> <span style=\"font-weight: bold;\">Mac OS X</span>";
62    } else if ($pname=='linux') {
63        echo "<img src=\"images/ico-tux.png\" alt=\"Linux\"> <span style=\"font-weight: bold;\">Linux/x86</span>";
64    }
65    echo "</td><td>";
66    download_link($pname);
67    echo "</td></tr>
68    ";
69}
70
71$apps = array(
72    array('classic.jpg', 180, 143),
73    array('cpdn_200.jpg', 200, 147),
74    array('eah_200.png', 200, 150),
75    array('rosetta_at_home.jpg', 200, 150),
76    array('qah.200x150.png', 200, 150),
77);
78
79function show_pictures() {
80    global $apps;
81    shuffle($apps);
82    $a0 = $apps[0];
83    $a1 = $apps[1];
84    $f0 = $a0[0];
85    $f1 = $a1[0];
86    echo "
87        <div style=\"max-height: 300px\">
88        <img src=\"images/mgrwork.png\"><br />
89        <div style=\"position:relative; top:-80px; left:30px\">
90            <img src=\"images/$f0\"><br />
91        </div>
92        <div style=\"position:relative; top:-160px; left:70px\">
93            <img src=\"images/$f1\"><br />
94        </div>
95        </div>
96    ";
97}
98
99function show_download($pname) {
100    echo "
101        <table style=\"padding: 10px\"><tr><td style=\"vertical-align: top;\">
102        ".tr(DL_WHATS_BOINC)
103    ;
104    if ($pname) {
105        download_link($pname);
106    } else {
107        echo "<table style=\"padding: 8px\">
108        ";
109        link_row('win');
110        link_row('winx64');
111        link_row('mac');
112        link_row('linux');
113        echo "</table>
114        ";
115    }
116    echo "
117        <p>
118        <a href=\"system_requirements.php\"><span style=\"white-space: nowrap\">".tr(DL_SYSTEMREQ)."</span></a>
119        | <a href=\"release_notes.php\"><span style=\"white-space: nowrap\">".tr(DL_RELNOTES)."</span></a>
120        | <a href=\"troubleshoot.php\"><span style=\"white-space: nowrap\">".tr(DL_TROUBLE)."</span></a>
121    ";
122    if ($pname) {
123        //echo " | <a href=\"download.php?all_platforms=1\"><span style=\"white-space: nowrap\">".tr(DL_OTHERSYS)."</span></a>
124        echo " | <a href=\"download_all.php\"><span style=\"white-space: nowrap\">".tr(DL_ALLVERSIONS)."</span></a>
125        ";
126    } else {
127        echo " | <a href=\"download_all.php\"><span style=\"white-space: nowrap\">".tr(DL_ALLVERSIONS)."</span></a></p>
128        <p>".tr(DL_IF_OTHERTYPES)."</p>
129        <ul>
130        <li> ".sprintf(tr(DL_MAKEYOUROWN),"<a href=anonymous_platform.php>","</a>")."</li>
131        <li> ".sprintf(tr(DL_DL_FROM3RDP),"<a href=download_other.php>","</a>")."</li>
132        </ul>
133        ";
134    }
135    echo "
136        <p>
137        </td><td style=\"vertical-align: top;\">
138    ";
139    show_pictures();
140    echo "
141        </td>
142        </tr></table>
143        <hr />
144        <span style=\"font-size: 10px\">
145        ".tr(DL_MIRRORS)."
146        </span>
147    ";
148}
149
150if ($_GET['xml']) {
151    $args = strstr($_SERVER['REQUEST_URI'], '?');
152    Header("Location: download_all.php$args");
153    exit();
154}
155
156page_head(tr(DL_DOWNLOAD_TITLE));
157
158if ($_GET['all_platforms']) {
159    show_download(null);
160} else if (strstr($client_info, 'Windows')) {
161    if (strstr($client_info, 'Win64')||strstr($client_info, 'WOW64')) {
162        show_download('winx64');
163    } else {
164        show_download('win');
165    }
166} else if (strstr($client_info, 'Mac')) {
167    show_download('mac');
168} else if (strstr($client_info, 'Linux')) {
169    show_download('linux');
170} else {
171    show_download(null);
172}
173page_tail(true);
174
175?>