Example #1
0
function download_link($pname, $button = false)
{
    global $platforms;
    global $url_base;
    global $client_info;
    $p = $platforms[$pname];
    $v = latest_version($p);
    $file = $v['file'];
    if (array_key_exists('vbox_file', $v)) {
        $vbox_file = $v['vbox_file'];
        $vbox_version = $v['vbox_version'];
        $vbox_url = $url_base . $vbox_file;
        $vbox_path = "dl/{$vbox_file}";
        $vbox_size = number_format(filesize($vbox_path) / 1000000, 2);
    } else {
        $vbox_file = null;
    }
    if (strstr($client_info, 'Windows NT 4') || strstr($client_info, 'Windows NT 5')) {
        $vbox_file = null;
    }
    $long_name = $p['name'];
    $num = $v['num'];
    $path = "dl/{$file}";
    $url = $url_base . $file;
    $dlink = "<a href=\"{$url}\">{$file}</a>";
    $s = number_format(filesize($path) / 1000000, 2);
    if ($button) {
        if ($vbox_file) {
            echo tra("We recommend that you also install VirtualBox, so your computer can work on science projects that require it.");
            echo " <a href=wiki/VirtualBox>";
            echo tra("Learn more about VirtualBox.");
            echo "</a>";
            echo "<table><tr valign=top><td>\n";
            echo "\n                <table cellpadding=10><tr valign=top><td class=button>\n                <a href=\"{$vbox_url}\"><font size=4><u>" . tra("Download BOINC + VirtualBox") . "</u></font></a>\n                <br>" . sprintf(tra("for %s"), $long_name) . " ({$vbox_size} MB)" . "<br><span class=note>" . sprintf(tra("BOINC %s"), $num) . ", " . sprintf(tra("VirtualBox %s"), $vbox_version) . "</span></td></tr>\n                </table>\n            ";
            echo "</td><td>\n";
        }
        echo "\n            <table cellpadding=10><tr valign=top><td class=button>\n            <a href=\"{$url}\"><font size=4><u>" . tra("Download BOINC") . "</u></font></a>\n            <br>" . sprintf(tra("for %s"), $long_name) . " ({$s} MB)" . "<br><span class=note>" . sprintf(tra("BOINC %s"), $num) . "</span></td></tr>\n            </table>\n        ";
        if ($vbox_file) {
            echo "</td></tr></table>\n";
        }
        if ($pname == 'linux' || $pname == 'linuxx64') {
            echo "<p>", linux_info();
        }
    } else {
        if ($vbox_file) {
            echo "<tr>\n                <td class=rowlineleft>{$long_name}</td>\n                <td class=rowline> {$num} (with Virtualbox {$vbox_version})</td>\n                <td class=rowlineright><a href={$vbox_url}>Download</a> ({$vbox_size} MB)</td>\n                </tr>\n            ";
        }
        echo "<tr>\n            <td class=rowlineleft>{$long_name}</td>\n            <td class=rowline> {$num}</td>\n            <td class=rowlineright><a href={$url}>Download</a> ({$s} MB)</td>\n            </tr>\n        ";
    }
}
Example #2
0
function download_link($pname, $button = false)
{
    global $platforms;
    global $url_base;
    $p = $platforms[$pname];
    $v = latest_version($p);
    $file = $v['file'];
    $long_name = $p['name'];
    $num = $v['num'];
    $path = "dl/{$file}";
    $url = $url_base . $file;
    $dlink = "<a href=\"{$url}\">{$file}</a>";
    $s = number_format(filesize($path) / 1000000, 2);
    if ($button) {
        echo "\n            <table cellpadding=10><tr><td class=heading>\n            <a href=\"{$url}\"><font size=4><u>" . tra("Download BOINC") . "</u></font></a>\n            <br>" . sprintf(tra("%s for %s (%s MB)"), $num, $long_name, $s) . "\n            </td></tr> </table>\n        ";
        if ($pname == 'linux' || $pname == 'linuxx64') {
            echo "<p>", linux_info();
        }
    } else {
        echo "<tr>\n            <td class=rowlineleft>{$long_name}</td>\n            <td class=rowline> {$num}</td>\n            <td class=rowlineright><a href={$url}>Download</a> ({$s} MB)</td>\n            </tr>\n        ";
    }
}