diff --git a/html/inc/bootstrap.inc b/html/inc/bootstrap.inc index 82338065cc2..97097e05417 100644 --- a/html/inc/bootstrap.inc +++ b/html/inc/bootstrap.inc @@ -89,7 +89,7 @@ function navbar_right($user) { ); } else { echo sprintf(' -
  • Sign Up
  • +
  • Join
  • Login
  • ', url_base(), url_base() ); diff --git a/html/user/download.php b/html/user/download_software.php similarity index 69% rename from html/user/download.php rename to html/user/download_software.php index cfeb7c67990..692705ea48d 100644 --- a/html/user/download.php +++ b/html/user/download_software.php @@ -19,7 +19,7 @@ // Show a page with download links and instructions. // There's a logged-in user. // -// If no project ID, redirect to BOINC web site +// If no project ID, direct user to BOINC web site // otherwise... // // - get platform from user agent string @@ -28,9 +28,15 @@ // - 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 . +// 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 @@ -41,30 +47,33 @@ require_once("../inc/util.inc"); require_once("../inc/account.inc"); -// take the client info string reported by web browser, +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 client_info_to_platform($client_info) { - if (strstr($client_info, 'Windows')) { - if (strstr($client_info, 'Win64')||strstr($client_info, 'WOW64')) { +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($client_info, 'Mac')) { - if (strstr($client_info, 'PPC Mac OS X')) { + } 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($client_info, 'Android')) { + } 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($client_info, 'Linux')) { - if (strstr($client_info, 'x86_64')) { + } else if (strstr($user_agent, 'Linux')) { + if (strstr($user_agent, 'x86_64')) { return 'x86_64-pc-linux-gnu'; } else { return 'i686-pc-linux-gnu'; @@ -74,12 +83,20 @@ function client_info_to_platform($client_info) { } } +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"); - $client_info = $_SERVER['HTTP_USER_AGENT']; - $p = client_info_to_platform($client_info); + $p = get_platform(); foreach ($v->version as $i=>$v) { if ((string)$v->dbplatform != $p) { continue; @@ -96,14 +113,14 @@ function get_version($dev) { return null; } -function download_button($v, $project_id, $token, $user) { +function download_button($v, $project_id, $token, $user, $green) { return sprintf( '
    - @@ -113,6 +130,7 @@ function download_button($v, $project_id, $token, $user) { $token, $user->id, (string)$v->filename, + $green?"btn-success":"btn-info", (string)$v->platform, (string)$v->size_mb, (string)$v->version_num @@ -147,18 +165,54 @@ function download_button_vbox($v, $project_id, $token, $user) { ); } -// We can't use auto-attach; direct them to the BOINC download page +function show_vbox_info($where) { + global $need_vbox, $recommend_vbox; + + if ($need_vbox || $recommend_vbox) { + echo "

    "; + if ($need_vbox) { + echo tra("This project requires VirtualBox."); + } + if ($recommend_vbox) { + echo tra("This project recommends VirtualBox."); + } + echo " "; + switch ($where) { + case "installed": + echo tra( + "If it is not installed on this computer, get it %1here%2, then restart BOINC.", + "", + "" + ); + break; + case "direct": + case "main": + if (is_windows()) { + echo tra("Use the BOINC+VirtualBox installer."); + } else { + echo tra( + "If it is not installed on this computer, get it %1here%2.", + "", + "" + ); + } + } + echo "

    "; + } +} + +// We can't use auto-attach; direct user to the BOINC download page // function direct_to_boinc() { global $master_url; page_head(tra("Download BOINC")); text_start(); + show_vbox_info("direct"); echo sprintf( '

    %s

    %s

    - %s ', tra("To download and install BOINC, click on the link below and follow the instructions. @@ -168,7 +222,10 @@ function direct_to_boinc() { or enter this project's URL: %2", PROJECT, $master_url - ), + ) + ); + show_button( + "https://boinc.berkeley.edu/download.php", tra("Go to the BOINC download page.") ); text_end(); @@ -176,9 +233,10 @@ function direct_to_boinc() { } function show_download_page($user, $dev) { - global $config; - $need_vbox = parse_bool($config, "need_vbox"); - $project_id = parse_config($config, ""); + global $need_vbox, $project_id; + + // If no project ID, we can't use simplified install + // if (!$project_id) { direct_to_boinc(); return; @@ -209,28 +267,31 @@ function show_download_page($user, $dev) { echo"

    "; - echo tra("If %1 already installed, %2click here%3; otherwise:", + echo tra("If %1 already installed, %2click here%3.", $phrase, - "", + "", "" ); echo "

    "; + + show_vbox_info("main"); + $token = make_login_token($user); - echo "

    \n"; + echo "
    \n"; if ($v->vbox_filename) { table_row( "", download_button_vbox($v, $project_id, $token, $user), "  ", - download_button($v, $project_id, $token, $user), + download_button($v, $project_id, $token, $user, false), "" ); } else { - table_row("", download_button($v, $project_id, $token, $user), ""); + table_row("", download_button($v, $project_id, $token, $user, true), ""); } - echo "
    \n"; + echo "\n"; echo "

    "; echo tra("When the download is finished, open the downloaded file to install %1.", $dl); echo "

    "; @@ -238,10 +299,10 @@ function show_download_page($user, $dev) { page_tail(); } -// if user already has BOINC installed, tell them how to attach +// if user already has BOINC installed, tell them how to attach. // function installed() { - global $config; + global $config, $need_vbox, $recommend_vbox; $am = parse_bool($config, "account_manager"); if ($am) { page_head(tra("Use %1", PROJECT)); @@ -261,6 +322,7 @@ function installed() { ); } else { page_head(tra("Add %1", PROJECT)); + show_vbox_info("installed"); echo sprintf("%s

    • %s @@ -284,9 +346,21 @@ function installed() { page_tail(); } +// get config.xml items +// +$need_vbox = parse_bool($config, "need_vbox"); +$recommend_vbox = parse_bool($config, "recommend_vbox"); +$project_id = parse_config($config, ""); + $user = get_logged_in_user(); $action = get_str("action", true); $dev = get_str("dev", true); + +$user_agent = get_str("user_agent", true); // for debugging +if (!$user_agent) { + $user_agent = $_SERVER['HTTP_USER_AGENT']; +} + if ($action == "installed") { installed(); } else { diff --git a/html/user/join.php b/html/user/join.php index 22e988a47ac..6833eb379c5 100644 --- a/html/user/join.php +++ b/html/user/join.php @@ -28,6 +28,8 @@ // This page routes people to the right place depending on whether // they already have BOINC installed on this device. +// DEPRECATED. Use signup.php instead + require_once("../inc/util.inc"); // "old" (misnomer) means BOINC is already installed on this device diff --git a/html/user/register.php b/html/user/register.php index 3a96d4c4b36..80ff1aa81ad 100644 --- a/html/user/register.php +++ b/html/user/register.php @@ -22,6 +22,8 @@ // // Link to this from a "Join" button on home page +// DEPRECATED; use signup.php instead + require_once("../inc/util.inc"); require_once("../inc/account.inc"); require_once("../inc/recaptchalib.php"); @@ -34,7 +36,7 @@ function reg_form() { page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); echo "

      Create an account

      "; form_start("create_account_action.php", "post"); - create_account_form(0, "download.php"); + create_account_form(0, "download_software.php"); if ($recaptcha_public_key) { form_general("", boinc_recaptcha_get_html($recaptcha_public_key)); } @@ -42,7 +44,7 @@ function reg_form() { form_end(); echo "

      If you already have an account, log in

      "; - login_form("download.php"); + login_form("download_software.php"); echo ""; page_tail(); } diff --git a/html/user/sample_index.php b/html/user/sample_index.php index da5cc7773cb..e38532bb2ab 100644 --- a/html/user/sample_index.php +++ b/html/user/sample_index.php @@ -98,7 +98,7 @@ function() use($user) { ', tra("Want to help more?"), tra("If BOINC is not installed on this computer, %1download it%2.", - "", "" + "", "" ), tra("Install BOINC on your other computers, tablets, and phones."), tra("Tell your friends about BOINC, and show them how to join %1.", PROJECT) diff --git a/html/user/signup.php b/html/user/signup.php index c51d04faa8d..77f1a6be288 100644 --- a/html/user/signup.php +++ b/html/user/signup.php @@ -111,7 +111,7 @@ function join_action() { $prefs = compute_prefs_xml($preset); $user->update("global_prefs='$prefs'"); } - Header("Location: download.php"); + Header("Location: download_software.php"); send_cookie('auth', $user->authenticator, false); }