Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions html/inc/forum.inc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ function show_forum_header($user) {
<input type="text" class="" name="search_keywords">
';
echo sprintf(
'<input class="%s" %s title="%s" type="submit" value="%s"><br>',
'btn btn-sm',
'<input class="btn" %s title="%s" type="submit" value="%s"><br>',
button_style(),
tra("Search for words in forum messages"),
tra("Search forums")
Expand Down
4 changes: 3 additions & 1 deletion html/inc/web_rpc_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ function create_account(
// Get info needed to show Download buttons
// that auto-attach to a particular project or account manager.
//
// I DON'T THINK THIS IS USED - OK TO DELETE
//
// args:
// $project_url: the URL of the project or account manager
// $rpc_key: a security token supplied by the above
Expand All @@ -127,7 +129,7 @@ function download_software($project_url, $rpc_key, $auth, $user_agent) {
return array($r, 0, null);
}

if (1) {
if (0) {
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Remove the unused example if (0) block entirely to clean up dead code and reduce confusion.

Copilot uses AI. Check for mistakes.
// Example usage of download_software().

// Show a download button, which when clicked will download a
Expand Down
143 changes: 14 additions & 129 deletions html/user/download_software.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,25 @@
// Page for downloading the BOINC client, with support for autoattach:
// https://github.com/BOINC/boinc/wiki/SimpleAttach
// Note: to use autoattach:
// 1) You need to have the client versions file
// 1) You need to have the latest client versions file
// run html/ops/get_versions.php
// 2) Put your project ID (ask DPA if you don't have one)
// in config.xml as <project_id>x</project_id>
//
// There's a logged-in user.
//
// Autoattach case: if project has an ID and client is Win or Mac:
// - find latest version for that platform (regular and vbox)
// - find latest version for that platform
// - Create a login token.
// - Show download button(s)
// The download will be via concierge, using the login token.
// Otherwise:
// - show link to download page on BOINC web site,
// and instructions for what to do after that.
//
// VirtualBox:
// config.xml entries:
// <need_vbox/> This project requires VBox
// <recommend_vbox> This project can use VBox
//
// Windows has combined BOINC/VBox installers.
// For other platforms, direct user to VBox download page
// before installing BOINC
//

// Can also be called as a web RPC;
// see https://github.com/BOINC/boinc/wiki/WebRpc#download
// NOT USED - OK TO REMOVE
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider deleting the unused RPC parameter comments and definitions below as noted, since they’re no longer referenced.

Copilot uses AI. Check for mistakes.
// rpc this says it's an RPC
// user_agent web browser info
// authenticator the account to link to
Expand All @@ -58,8 +49,6 @@
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
//
Expand Down Expand Up @@ -129,93 +118,30 @@ function get_version($user_agent, $dev) {
return null;
}

function download_button($v, $project_id, $token, $user, $green) {
function download_button($v, $project_id, $token, $user) {
return sprintf(
'<form action="https://boinc.berkeley.edu/concierge.php" method="post">
<input type=hidden name=project_id value="%d">
<input type=hidden name=token value="%s">
<input type=hidden name=user_id value="%d">
<input type=hidden name=filename value="%s">
<button class="btn %s">
<font size=2><u>Download BOINC</u></font>
<button class="btn" %s>
<font size=+1><u>Download BOINC</u></font>
<br>for %s (%s MB)
<br><small>BOINC %s</small></button>
<br>BOINC %s</button>
</form>
',
$project_id,
$token,
$user->id,
(string)$v->filename,
$green?"btn-success":"btn-info",
button_style('green', 14),
(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(
'<form action="https://boinc.berkeley.edu/concierge.php" method="post">
<input type=hidden name=project_id value="%d">
<input type=hidden name=token value="%s">
<input type=hidden name=user_id value="%d">
<input type=hidden name=filename value="%s">
<button class="btn btn-success">
<font size=+1><u>Download BOINC + VirtualBox</u></font>
<br>for %s (%s MB)
<br><small>BOINC %s, VirtualBox %s</small></a>
</form>
',
$project_id,
$token,
$user->id,
(string)$v->vbox_filename,
(string)$v->platform,
(string)$v->vbox_size_mb,
(string)$v->version_num,
(string)$v->vbox_version
);
}

function show_vbox_info($where) {
global $need_vbox, $recommend_vbox;

if ($need_vbox || $recommend_vbox) {
echo "<p>";
if ($need_vbox) {
echo tra("This project requires VirtualBox.");
} else 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.",
"<a href=".VBOX_DOWNLOAD_URL.">",
"</a>"
);
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.",
"<a href=".VBOX_DOWNLOAD_URL.">",
"</a>"
);
}
}
echo "<p>";
}
}

// We can't use auto-attach; direct user to the BOINC download page
//
function direct_to_boinc() {
Expand All @@ -231,7 +157,6 @@ function direct_to_boinc() {
tra("Go to the BOINC download page."),
null, null, 'target=_new'
);
show_vbox_info("direct");

if (parse_bool(get_config(), 'account_manager')) {
echo sprintf(
Expand Down Expand Up @@ -261,7 +186,7 @@ function direct_to_boinc() {
}

function show_download_page($user, $user_agent, $dev) {
global $need_vbox, $project_id;
global $project_id;

// If no project ID, we can't use simplified install
//
Expand All @@ -282,15 +207,9 @@ function show_download_page($user, $user_agent, $dev) {
page_head("Download software");

$phrase = "";
if ($need_vbox) {
$dlv = tra("the current versions of BOINC and VirtualBox");
$phrase = tra("these versions are");
$dl = tra("BOINC and VirtualBox");
} else {
$dlv = tra("the current version of BOINC");
$phrase = tra("this version is");
$dl = "BOINC";
}
$dlv = tra("the current version of BOINC");
$phrase = tra("this version is");
$dl = "BOINC";
echo tra("To participate in %1, %2 must be installed on your computer.", PROJECT, $dlv);
echo"
<p>
Expand All @@ -304,21 +223,9 @@ function show_download_page($user, $user_agent, $dev) {
<p>
";

show_vbox_info("main");

$token = make_login_token($user);
echo "<table border=0 cellpadding=20>\n";
if ($v->vbox_filename) {
table_row(
"",
download_button_vbox($v, $project_id, $token, $user),
"&nbsp;&nbsp;",
download_button($v, $project_id, $token, $user, false),
""
);
} else {
table_row("", download_button($v, $project_id, $token, $user, true), "");
}
table_row("", download_button($v, $project_id, $token, $user), "");
echo "</table>\n";
echo "<p><p>";
echo tra("When the download is finished, open the downloaded file to install %1.", $dl);
Expand All @@ -330,7 +237,6 @@ function show_download_page($user, $user_agent, $dev) {
// if user already has BOINC installed, tell them how to attach.
//
function installed() {
global $need_vbox, $recommend_vbox;
$config = get_config();
$am = parse_bool($config, "account_manager");
if ($am) {
Expand All @@ -351,7 +257,6 @@ function installed() {
);
} else {
page_head(tra("Add %1", PROJECT));
show_vbox_info("installed");
echo sprintf("%s
<ul>
<li> %s
Expand All @@ -376,6 +281,7 @@ function installed() {
}

// RPC handler
// NOT USED - OK TO REMOVE
//
function handle_get_info() {
require_once("../inc/xml.inc");
Expand All @@ -400,10 +306,6 @@ function handle_get_info() {
xml_error(-1, "no version for platform");
}

$want_vbox = parse_bool($config, 'need_vbox')
|| parse_bool($config, 'recommend_vbox')
;

$token = make_login_token($user);
echo sprintf(
'<download_info>
Expand All @@ -425,30 +327,13 @@ function handle_get_info() {
(string)$v->size_mb,
(string)$v->version_num
);
if ($v->vbox_filename && $want_vbox) {
echo sprintf(
' <boinc_vbox>
<filename>%s</filename>
<size_mb>%s</size_mb>
<boinc_version>%s</boinc_version>
<vbox_version>%s</vbox_version>
</boinc_vbox>
',
(string)$v->vbox_filename,
(string)$v->vbox_size_mb,
(string)$v->version_num,
(string)$v->vbox_version
);
}
echo '</download_info>
';
}

// get config.xml items
//
$config = get_config();
$need_vbox = parse_bool($config, "need_vbox");
$recommend_vbox = parse_bool($config, "recommend_vbox");
$project_id = parse_config($config, "<project_id>");

$action = get_str("action", true);
Expand Down
Loading