. // Show a page with download links and instructions. // There's a logged-in user. // // If no project ID, direct user 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. // // VirtualBox // // config.xml entries: // This project requires VBox // This project can use VBox // // Windows has combined BOINC/VBox installers. // For other platforms, direct user to VBox download page // before installing BOINC // // 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"); define("VBOX_DOWNLOAD_URL", "https://www.virtualbox.org/wiki/Downloads"); // take the user agent string reported by web browser, // and return best guess for platform // function get_platform() { global $user_agent; if (strstr($user_agent, 'Windows')) { if (strstr($user_agent, 'Win64')||strstr($user_agent, 'WOW64')) { return 'windows_x86_64'; } else { return 'windows_intelx86'; } } else if (strstr($user_agent, 'Mac')) { if (strstr($user_agent, 'PPC Mac OS X')) { return 'powerpc-apple-darwin'; } else { return 'x86_64-apple-darwin'; } } else if (strstr($user_agent, '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($user_agent, 'Linux')) { if (strstr($user_agent, 'x86_64')) { return 'x86_64-pc-linux-gnu'; } else { return 'i686-pc-linux-gnu'; } } else { return null; } } function is_windows() { global $user_agent; if (strstr($user_agent, 'Windows')) { return true; } return false; } // find release version for user's platform // function get_version($dev) { global $user_agent; $v = simplexml_load_file("versions.xml"); $p = get_platform(); 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, $green) { return sprintf( '
', $project_id, $token, $user->id, (string)$v->filename, $green?"btn-success":"btn-info", (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( '