. // Show a page with download links and instructions. // There's a logged-in user. // // If no project ID, redirect to BOINC web site // otherwise... // // - get platform from user agent string // - find latest version for that platform (regular and vbox) // - Create a login token. // - Show download button(s) // The download will be via concierge, using the login token. // // By default both regular and vbox buttons will be shown, if available. // You can suppress one or the other by setting // or . // // Notes: // 1) You need to have the client versions file // run html/ops/get_versions.php // 2) Put your project ID in a constant PROJECT_ID // (this all works only for listed projects) require_once("../inc/util.inc"); require_once("../inc/account.inc"); // take the client info string reported by web browser, // and return best guess for platform // function client_info_to_platform($client_info) { if (strstr($client_info, 'Windows')) { if (strstr($client_info, 'Win64')||strstr($client_info, 'WOW64')) { return 'windows_x86_64'; } else { return 'windows_intelx86'; } } else if (strstr($client_info, 'Mac')) { if (strstr($client_info, 'PPC Mac OS X')) { return 'powerpc-apple-darwin'; } else { return 'x86_64-apple-darwin'; } } else if (strstr($client_info, 'Android')) { // Check for Android before Linux, // since Android contains the Linux kernel and the // web browser user agent string lists Linux too. // return 'arm-android-linux-gnu'; } else if (strstr($client_info, 'Linux')) { if (strstr($client_info, 'x86_64')) { return 'x86_64-pc-linux-gnu'; } else { return 'i686-pc-linux-gnu'; } } else { return null; } } // find release version for user's platform // function get_version($dev) { $v = simplexml_load_file("versions.xml"); $client_info = $_SERVER['HTTP_USER_AGENT']; $p = client_info_to_platform($client_info); foreach ($v->version as $i=>$v) { if ((string)$v->dbplatform != $p) { continue; } if (strstr((string)$v->description, "Recommended")) { return $v; } if ($dev) { if (strstr((string)$v->description, "Development")) { return $v; } } } return null; } function download_button($v, $project_id, $token, $user) { return sprintf( '
', $project_id, $token, $user->id, (string)$v->filename, (string)$v->platform, (string)$v->size_mb, (string)$v->version_num ); } function download_button_vbox($v, $project_id, $token, $user) { // if no vbox version exists for platform, don't show vbox button if(!$v->vbox_filename) { return; } return sprintf( '