mirror of https://github.com/BOINC/boinc.git
parent
f98c7f0644
commit
47d48d202a
|
@ -3877,3 +3877,37 @@ David Mar 19 2003
|
|||
*
|
||||
show_hosts.php (removed)
|
||||
|
||||
David Mar 19 2003
|
||||
- added global pref for max CPUs
|
||||
- added global pref for min interval between disk writes
|
||||
(applies to checkpoint writes only)
|
||||
- added URL field to user table
|
||||
- moved "send_email" field from XML to DB
|
||||
- added "show_hosts" field to user table
|
||||
|
||||
show_host_public.php (removed)
|
||||
client/
|
||||
app.C
|
||||
client_state.C,h
|
||||
cs_apps.C
|
||||
prefs.C,h
|
||||
db/
|
||||
db.h
|
||||
db_mysql.C
|
||||
schema.sql
|
||||
doc/
|
||||
index.html
|
||||
html_user/
|
||||
edit_user_info*
|
||||
host.inc
|
||||
prefs.inc
|
||||
prefs_edit_*
|
||||
show_host_detail.php
|
||||
user.inc
|
||||
util.inc
|
||||
sched/
|
||||
db_dump.C
|
||||
test/
|
||||
test.inc
|
||||
tools/
|
||||
add.C
|
||||
|
|
|
@ -151,7 +151,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
aid.user_expavg_credit = wup->project->user_expavg_credit;
|
||||
aid.host_total_credit = wup->project->host_total_credit;
|
||||
aid.host_expavg_credit = wup->project->host_expavg_credit;
|
||||
aid.checkpoint_period = DEFAULT_CHECKPOINT_PERIOD;
|
||||
aid.checkpoint_period = gstate.global_prefs.disk_interval;
|
||||
aid.fraction_done_update_period = DEFAULT_FRACTION_DONE_UPDATE_PERIOD;
|
||||
aid.shm_key = 0;
|
||||
aid.wu_cpu_time = checkpoint_cpu_time;
|
||||
|
|
|
@ -224,13 +224,14 @@ int CLIENT_STATE::init() {
|
|||
#endif
|
||||
}
|
||||
|
||||
// Set nslots to actual # of CPUs (or less, depending on prefs?)
|
||||
// Set nslots to actual # of CPUs (or less, depending on prefs)
|
||||
//
|
||||
if (gstate.host_info.p_ncpus > 0) {
|
||||
nslots = gstate.host_info.p_ncpus;
|
||||
} else {
|
||||
nslots = 1;
|
||||
}
|
||||
if (nslots > global_prefs.max_cpus) nslots = global_prefs.max_cpus;
|
||||
|
||||
// set up the project and slot directories
|
||||
//
|
||||
|
|
|
@ -110,7 +110,7 @@ private:
|
|||
int core_client_major_version;
|
||||
int core_client_minor_version;
|
||||
char* platform_name;
|
||||
unsigned int nslots;
|
||||
int nslots;
|
||||
bool run_time_test;
|
||||
bool activities_suspended;
|
||||
int exit_after_app_start_secs;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
// in the client state
|
||||
//
|
||||
int CLIENT_STATE::make_slot_dirs() {
|
||||
unsigned int i;
|
||||
int i;
|
||||
int retval;
|
||||
for (i=0; i<nslots; i++) {
|
||||
retval = make_slot_dir(i);
|
||||
|
|
|
@ -42,6 +42,8 @@ void GLOBAL_PREFS::init() {
|
|||
hangup_if_dialed = true;
|
||||
work_buf_max_days = 3;
|
||||
work_buf_min_days = 1;
|
||||
max_cpus = 2;
|
||||
disk_interval = 60;
|
||||
disk_max_used_gb = 1;
|
||||
disk_max_used_pct = 0.5;
|
||||
disk_min_free_gb = 0.1;
|
||||
|
@ -115,6 +117,12 @@ int GLOBAL_PREFS::parse(FILE* in, char* host_venue) {
|
|||
continue;
|
||||
} else if (parse_double(buf, "<work_buf_min_days>", work_buf_min_days)) {
|
||||
continue;
|
||||
} else if (parse_int(buf, "<max_cpus>", max_cpus)) {
|
||||
if (max_cpus < 1) max_cpus = 1;
|
||||
continue;
|
||||
} else if (parse_double(buf, "<disk_interval>", disk_interval)) {
|
||||
if (disk_interval<0) disk_interval = 0;
|
||||
continue;
|
||||
} else if (parse_double(buf, "<disk_max_used_gb>", disk_max_used_gb)) {
|
||||
continue;
|
||||
} else if (parse_double(buf, "<disk_max_used_pct>", disk_max_used_pct)) {
|
||||
|
|
|
@ -42,6 +42,8 @@ struct GLOBAL_PREFS {
|
|||
bool hangup_if_dialed;
|
||||
double work_buf_max_days;
|
||||
double work_buf_min_days;
|
||||
int max_cpus;
|
||||
double disk_interval;
|
||||
double disk_max_used_gb;
|
||||
double disk_max_used_pct;
|
||||
double disk_min_free_gb;
|
||||
|
|
6
db/db.h
6
db/db.h
|
@ -107,7 +107,6 @@ struct USER {
|
|||
unsigned int create_time;
|
||||
char email_addr[256];
|
||||
char name[256];
|
||||
char web_password[256]; // optional
|
||||
char authenticator[256];
|
||||
char country[256];
|
||||
char postal_code[256];
|
||||
|
@ -118,8 +117,11 @@ struct USER {
|
|||
// global preferences, within <global_preferences> tag
|
||||
char project_prefs[MAX_BLOB_SIZE];
|
||||
// project preferences, within <project_preferences> tag
|
||||
int teamid; // if user is part of a team
|
||||
int teamid; // team ID if any
|
||||
char venue[256]; // home/work/school (default)
|
||||
char url[256]; // user's web page if any
|
||||
bool send_email;
|
||||
bool show_hosts;
|
||||
};
|
||||
|
||||
#define TEAM_TYPE_CLUB 1
|
||||
|
|
|
@ -149,23 +149,22 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
up = (USER*)vp;
|
||||
escape_single_quotes(up->email_addr);
|
||||
escape_single_quotes(up->name);
|
||||
escape_single_quotes(up->web_password);
|
||||
escape_single_quotes(up->country);
|
||||
escape_single_quotes(up->postal_code);
|
||||
escape_single_quotes(up->global_prefs);
|
||||
escape_single_quotes(up->project_prefs);
|
||||
escape_single_quotes(up->url);
|
||||
sprintf(q,
|
||||
"id=%d, create_time=%d, email_addr='%s', name='%s', "
|
||||
"web_password='%s', authenticator='%s', "
|
||||
"authenticator='%s', "
|
||||
"country='%s', postal_code='%s', "
|
||||
"total_credit=%.12e, expavg_credit=%.12e, expavg_time=%f, "
|
||||
"global_prefs='%s', project_prefs='%s', "
|
||||
"teamid=%d, venue='%s'",
|
||||
"teamid=%d, venue='%s', url='%s', send_email=%d, show_hosts=%d",
|
||||
up->id,
|
||||
up->create_time,
|
||||
up->email_addr,
|
||||
up->name,
|
||||
up->web_password,
|
||||
up->authenticator,
|
||||
up->country,
|
||||
up->postal_code,
|
||||
|
@ -175,15 +174,18 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
up->global_prefs,
|
||||
up->project_prefs,
|
||||
up->teamid,
|
||||
up->venue
|
||||
up->venue,
|
||||
up->url,
|
||||
up->send_email,
|
||||
up->show_hosts
|
||||
);
|
||||
unescape_single_quotes(up->email_addr);
|
||||
unescape_single_quotes(up->name);
|
||||
unescape_single_quotes(up->web_password);
|
||||
unescape_single_quotes(up->country);
|
||||
unescape_single_quotes(up->postal_code);
|
||||
unescape_single_quotes(up->global_prefs);
|
||||
unescape_single_quotes(up->project_prefs);
|
||||
unescape_single_quotes(up->url);
|
||||
break;
|
||||
case TYPE_TEAM:
|
||||
tp = (TEAM*)vp;
|
||||
|
@ -387,7 +389,6 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
up->create_time = atoi(r[i++]);
|
||||
strcpy2(up->email_addr, r[i++]);
|
||||
strcpy2(up->name, r[i++]);
|
||||
strcpy2(up->web_password, r[i++]);
|
||||
strcpy2(up->authenticator, r[i++]);
|
||||
strcpy2(up->country, r[i++]);
|
||||
strcpy2(up->postal_code, r[i++]);
|
||||
|
@ -398,6 +399,9 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
strcpy2(up->project_prefs, r[i++]);
|
||||
up->teamid = atoi(r[i++]);
|
||||
strcpy2(up->venue, r[i++]);
|
||||
strcpy2(up->url, r[i++]);
|
||||
up->send_email = atoi(r[i++]);
|
||||
up->show_hosts = atoi(r[i++]);
|
||||
break;
|
||||
case TYPE_TEAM:
|
||||
tp = (TEAM*)vp;
|
||||
|
|
|
@ -42,7 +42,6 @@ create table user (
|
|||
create_time integer not null,
|
||||
email_addr varchar(254) not null,
|
||||
name varchar(254),
|
||||
web_password varchar(254),
|
||||
authenticator varchar(254),
|
||||
country varchar(254),
|
||||
postal_code varchar(254),
|
||||
|
@ -53,6 +52,9 @@ create table user (
|
|||
project_prefs blob,
|
||||
teamid integer not null,
|
||||
venue varchar(254) not null,
|
||||
url varchar(254),
|
||||
send_email smallint not null,
|
||||
show_hosts smallint not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
|
|
@ -73,6 +73,11 @@ width="210" height="62" border="0" alt="SourceForge Logo"></a>
|
|||
<center>
|
||||
<h3>Status and news</h3>
|
||||
</center>
|
||||
<b>March 19, 2003</b>
|
||||
<br><br>
|
||||
New account parameters and preferences: URL, limit number of processors,
|
||||
frequency of writes to disk, whether to show your computers on the web.
|
||||
<br>
|
||||
<b>March 5, 2003</b>
|
||||
<br>
|
||||
Version 0.15 of BOINC is available on SourceForge.net.
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
|
||||
page_head("User info update");
|
||||
$name = $HTTP_POST_VARS["user_name"];
|
||||
$url = $HTTP_POST_VARS["url"];
|
||||
$country = $HTTP_POST_VARS["country"];
|
||||
$postal_code = $HTTP_POST_VARS["postal_code"];
|
||||
|
||||
$result = mysql_query("update user set name='$name', country='$country', postal_code='$postal_code' where id=$user->id");
|
||||
$result = mysql_query("update user set name='$name', url='$url', country='$country', postal_code='$postal_code' where id=$user->id");
|
||||
if ($result) {
|
||||
echo "User info updated successfully.";
|
||||
Header("Location: home.php");
|
||||
} else {
|
||||
page_head("User info update");
|
||||
echo "Couldn't update user info.";
|
||||
page_tail();
|
||||
}
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -10,9 +10,12 @@ page_head("Edit user information", $user);
|
|||
echo "<form method=post action=edit_user_info_action.php>";
|
||||
start_table();
|
||||
row1("Edit account info");
|
||||
row2("User name",
|
||||
row2("Name",
|
||||
"<input name=user_name size=30 value='$user->name'>"
|
||||
);
|
||||
row2("URL",
|
||||
"http://<input name=url size=30 value='$user->url'>"
|
||||
);
|
||||
row2_init("Country",
|
||||
"<select name=country>"
|
||||
);
|
||||
|
|
|
@ -19,7 +19,7 @@ function location_form($host) {
|
|||
|
||||
function show_host($host, $private) {
|
||||
start_table();
|
||||
row1("Host Information");
|
||||
row1("Computer information");
|
||||
if ($private) {
|
||||
row2("IP address", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
|
||||
row2("Domain name", $host->domain_name);
|
||||
|
@ -91,12 +91,16 @@ function show_host($host, $private) {
|
|||
function host_table_start($title, $private) {
|
||||
start_table();
|
||||
row1($title, 6);
|
||||
echo "<tr>
|
||||
<th>Rank<br><font size=-2>Click for more info</font></th>
|
||||
";
|
||||
if ($private) {
|
||||
echo "<th>Name</th>\n";
|
||||
echo "<th>Name
|
||||
<br><font size=-2>Click for more info</font>
|
||||
</th>\n
|
||||
";
|
||||
} else {
|
||||
echo "<th>
|
||||
Rank<br><font size=-2>Click for more info</font>
|
||||
</th>
|
||||
";
|
||||
echo "<th>Owner</th>\n";
|
||||
}
|
||||
echo "
|
||||
|
@ -113,12 +117,15 @@ function show_host_row($host, $i, $private) {
|
|||
$user = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
echo "<tr>
|
||||
<td><a href=show_host_public.php?hostid=$host->id>$i</a></td>
|
||||
";
|
||||
if ($private) {
|
||||
echo"<td>$host->domain_name</td>";
|
||||
echo"<td>
|
||||
<a href=show_host_detail.php?hostid=$host->id>
|
||||
$host->domain_name</a></td>
|
||||
";
|
||||
} else {
|
||||
echo"<td><a href=show_user.php?userid=$user->id>$user->name</a></td>";
|
||||
echo "<td><a href=show_host_detail.php?hostid=$host->id>$i</a></td>\n";
|
||||
echo "<td><a href=show_user.php?userid=$user->id>$user->name</a></td>\n";
|
||||
}
|
||||
echo"
|
||||
<td>$host->total_credit</td>
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
// <project-specific>
|
||||
// ... (arbitrary project-specific XML)
|
||||
// </project-specific>
|
||||
// <send_email/>
|
||||
// <show_email/>
|
||||
// <home>
|
||||
// ...
|
||||
// </home>
|
||||
// </project_preferences>
|
||||
//
|
||||
// In addition there are some fields of the user table
|
||||
// (send_email and show_hosts) that are treated as project preferences
|
||||
|
||||
// Various functions are defined below for converting between these forms,
|
||||
// and also to/from HTML form elements
|
||||
|
@ -109,12 +110,6 @@ function element_end_project($parser, $name) {
|
|||
case "resource_share":
|
||||
$parse_result->resource_share = $text;
|
||||
break;
|
||||
case "show_email":
|
||||
$parse_result->show_email = true;
|
||||
break;
|
||||
case "send_email":
|
||||
$parse_result->send_email = true;
|
||||
break;
|
||||
case "project_preferences":
|
||||
break;
|
||||
default:
|
||||
|
@ -155,6 +150,12 @@ function element_end_global($parser, $name) {
|
|||
case "work_buf_max_days":
|
||||
$parse_result->work_buf_max_days = $text;
|
||||
break;
|
||||
case "max_cpus":
|
||||
$parse_result->max_cpus = $text;
|
||||
break;
|
||||
case "disk_interval":
|
||||
$parse_result->disk_interval = $text;
|
||||
break;
|
||||
case "disk_max_used_gb":
|
||||
$parse_result->disk_max_used_gb = $text;
|
||||
break;
|
||||
|
@ -195,6 +196,8 @@ function default_prefs_global() {
|
|||
$p->hangup_if_dialed = true;
|
||||
$p->work_buf_min_days = 1;
|
||||
$p->work_buf_max_days = 3;
|
||||
$p->max_cpus = 2;
|
||||
$p->disk_interval = 60;
|
||||
$p->disk_max_used_gb = 100;
|
||||
$p->disk_max_used_pct = 50;
|
||||
$p->disk_min_free_gb = 1;
|
||||
|
@ -206,8 +209,6 @@ function default_prefs_global() {
|
|||
function default_prefs_project() {
|
||||
$p = null;
|
||||
$p->resource_share = 100;
|
||||
$p->show_email = false;
|
||||
$p->send_email = true;
|
||||
$p->project_specific = project_specific_prefs_default();
|
||||
return $p;
|
||||
}
|
||||
|
@ -225,8 +226,6 @@ function initialize_prefs_before_parsing_global() {
|
|||
|
||||
function initialize_prefs_before_parsing_project() {
|
||||
$p = default_prefs_project();
|
||||
$p->show_email = false;
|
||||
$p->send_email = false;
|
||||
return $p;
|
||||
}
|
||||
|
||||
|
@ -264,6 +263,8 @@ function prefs_show_global($prefs) {
|
|||
row2("Confirm before connecting to network?", $prefs->confirm_before_connecting?"Yes":"No");
|
||||
row2("Disconnect when connection complete?", $prefs->hangup_if_dialed?"Yes":"No");
|
||||
row2("Amount of work to buffer:", "$prefs->work_buf_min_days to $prefs->work_buf_max_days days");
|
||||
row2("Use at most", "$prefs->max_cpus processors");
|
||||
row2("Write to disk at most every", "$prefs->disk_interval seconds");
|
||||
row2("Maximum disk space to use:", "$prefs->disk_max_used_gb GB");
|
||||
row2("Minimum disk space to leave free:", "$prefs->disk_min_free_gb GB");
|
||||
row2("Maximum % of disk allowed to used:", "$prefs->disk_max_used_pct %");
|
||||
|
@ -281,9 +282,9 @@ function prefs_show_resource($prefs) {
|
|||
);
|
||||
}
|
||||
|
||||
function prefs_show_email($prefs) {
|
||||
row2("Should ".PROJECT." send you email newsletters?", $prefs->send_email?"Yes":"No");
|
||||
row2("Should ".PROJECT." show your email address on its web site?", $prefs->show_email?"Yes":"No");
|
||||
function prefs_show_privacy($user) {
|
||||
row2("Should ".PROJECT." send you email newsletters?", $user->send_email?"Yes":"No");
|
||||
row2("Should ".PROJECT." show your computers on its web site?", $user->show_hosts?"Yes":"No");
|
||||
}
|
||||
|
||||
function prefs_show_project($prefs) {
|
||||
|
@ -320,7 +321,7 @@ function print_prefs_display_project($user) {
|
|||
row1(PROJECT." preferences");
|
||||
prefs_show_resource($project_prefs);
|
||||
prefs_show_project($project_prefs);
|
||||
prefs_show_email($project_prefs);
|
||||
prefs_show_privacy($user);
|
||||
venue_show($user);
|
||||
row2("", "<a href=prefs_edit_form.php?subset=project>Edit ".PROJECT." preferences</a>");
|
||||
prefs_display_venue($project_prefs, "home", "project");
|
||||
|
@ -407,6 +408,9 @@ function prefs_form_global($user, $prefs) {
|
|||
";
|
||||
row2($x, $y);
|
||||
|
||||
row2("Use at most", "<input size=4 name=max_cpus value=$prefs->max_cpus> processors");
|
||||
row2("Write to disk at most every", "<input size=6 name=disk_interval value=$prefs->disk_interval> seconds");
|
||||
|
||||
row1("Limit the disk space used by BOINC:");
|
||||
|
||||
row2("Use no more than",
|
||||
|
@ -433,22 +437,22 @@ function prefs_form_global($user, $prefs) {
|
|||
);
|
||||
}
|
||||
|
||||
function prefs_form_email($prefs) {
|
||||
function prefs_form_privacy($user) {
|
||||
$y = "Yes <input type=radio name=send_email value=yes "
|
||||
.($prefs->send_email?"checked":"")
|
||||
.($user->send_email?"checked":"")
|
||||
."> No <input type=radio name=send_email value=no "
|
||||
.($prefs->send_email?"":"checked")
|
||||
.($user->send_email?"":"checked")
|
||||
.">
|
||||
";
|
||||
row2("Should ".PROJECT." send you email newsletters?", $y);
|
||||
|
||||
$y = "Yes <input type=radio name=show_email value=yes "
|
||||
.($prefs->show_email?"checked":"")
|
||||
."> No <input type=radio name=show_email value=no "
|
||||
.($prefs->show_email?"":"checked")
|
||||
$y = "Yes <input type=radio name=show_hosts value=yes "
|
||||
.($user->show_hosts?"checked":"")
|
||||
."> No <input type=radio name=show_hosts value=no "
|
||||
.($user->show_hosts?"":"checked")
|
||||
.">
|
||||
";
|
||||
row2("Should ".PROJECT." show your email address on its web site?", $y);
|
||||
row2("Should ".PROJECT." show your computers on its web site?", $y);
|
||||
}
|
||||
|
||||
function prefs_form_resource($prefs) {
|
||||
|
@ -509,6 +513,8 @@ function prefs_global_parse_form(&$prefs) {
|
|||
$hangup_if_dialed = $_GET["hangup_if_dialed"];
|
||||
$work_buf_min_days = $_GET["work_buf_min_days"];
|
||||
$work_buf_max_days = $_GET["work_buf_max_days"];
|
||||
$max_cpus = $_GET["max_cpus"];
|
||||
$disk_interval = $_GET["disk_interval"];
|
||||
$disk_max_used_gb = $_GET["disk_max_used_gb"];
|
||||
$disk_max_used_pct = $_GET["disk_max_used_pct"];
|
||||
$disk_min_free_gb = $_GET["disk_min_free_gb"];
|
||||
|
@ -523,8 +529,12 @@ function prefs_global_parse_form(&$prefs) {
|
|||
if ($work_buf_min_days<0) $work_buf_min_days = 0;
|
||||
if ($work_buf_max_days<0) $work_buf_max_days = 0;
|
||||
if ($work_buf_min_days > $work_buf_max_days) $work_buf_min_days = $work_buf_max_days;
|
||||
if ($max_cpus<1) $max_cpus = 1;
|
||||
if ($disk_interval<0) $disk_interval = 0;
|
||||
$prefs->work_buf_min_days = $work_buf_min_days;
|
||||
$prefs->work_buf_max_days = $work_buf_max_days;
|
||||
$prefs->max_cpus = $max_cpus;
|
||||
$prefs->disk_interval = $disk_interval;
|
||||
|
||||
if ($disk_max_used_gb<0) $disk_max_used_gb = 0;
|
||||
if ($disk_max_used_pct<0) $disk_max_used_pct = 0;
|
||||
|
@ -541,9 +551,9 @@ function prefs_resource_parse_form(&$prefs) {
|
|||
$prefs->resource_share = $_GET['resource_share'];
|
||||
}
|
||||
|
||||
function prefs_email_parse_form(&$prefs) {
|
||||
$prefs->send_email = ($_GET['send_email'] == "yes");
|
||||
$prefs->show_email = ($_GET['show_email'] == "yes");
|
||||
function prefs_privacy_parse_form(&$user) {
|
||||
$user->send_email = ($_GET['send_email'] == "yes")?1:0;
|
||||
$user->show_hosts = ($_GET['show_hosts'] == "yes")?1:0;
|
||||
}
|
||||
|
||||
function prefs_project_parse_form(&$prefs) {
|
||||
|
@ -575,7 +585,9 @@ function global_prefs_make_xml($prefs, $primary=true) {
|
|||
}
|
||||
$xml = $xml
|
||||
."<work_buf_min_days>$prefs->work_buf_min_days</work_buf_min_days>\n"
|
||||
."<work_buf_max_days>$prefs->work_buf_max_days</work_buf_max_days>\n";
|
||||
."<work_buf_max_days>$prefs->work_buf_max_days</work_buf_max_days>\n"
|
||||
."<max_cpus>$prefs->max_cpus</max_cpus>\n"
|
||||
."<disk_interval>$prefs->disk_interval</disk_interval>\n";
|
||||
$xml = $xml
|
||||
."<disk_max_used_gb>$prefs->disk_max_used_gb</disk_max_used_gb>\n"
|
||||
."<disk_max_used_pct>$prefs->disk_max_used_pct</disk_max_used_pct>\n"
|
||||
|
@ -601,12 +613,6 @@ function project_prefs_make_xml($prefs, $primary=true) {
|
|||
$xml = "";
|
||||
if ($primary) {
|
||||
$xml = "<project_preferences>\n";
|
||||
if ($prefs->show_email == 1) {
|
||||
$xml = $xml."<show_email/>\n";
|
||||
}
|
||||
if ($prefs->send_email == 1) {
|
||||
$xml = $xml."<send_email/>\n";
|
||||
}
|
||||
}
|
||||
if ($prefs->resource_share) {
|
||||
$xml = $xml
|
||||
|
@ -638,14 +644,20 @@ function project_prefs_make_xml($prefs, $primary=true) {
|
|||
//
|
||||
function global_prefs_update(&$user, $prefs) {
|
||||
$prefs_xml = global_prefs_make_xml($prefs);
|
||||
$retval = mysql_query("update user set global_prefs='$prefs_xml' where id=$user->id");
|
||||
$query = "update user set global_prefs='$prefs_xml' where id=$user->id";
|
||||
$retval = mysql_query($query);
|
||||
if (!$retval) {
|
||||
echo "Update failed: ".htmlspecialchars($query)."\n";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
}
|
||||
$user->global_prefs = $prefs_xml;
|
||||
return $retval;
|
||||
}
|
||||
|
||||
function project_prefs_update(&$user, $prefs) {
|
||||
$prefs_xml = project_prefs_make_xml($prefs);
|
||||
$retval = mysql_query("update user set project_prefs='$prefs_xml' where id=$user->id");
|
||||
$retval = mysql_query("update user set project_prefs='$prefs_xml', send_email=$user->send_email, show_hosts=$user->show_hosts where id=$user->id");
|
||||
$user->project_prefs = $prefs_xml;
|
||||
return $retval;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,13 @@ if ($subset == "global") {
|
|||
prefs_project_parse_form($prefs);
|
||||
prefs_resource_parse_form($prefs);
|
||||
|
||||
if ($venue) $main_prefs->$venue = $prefs;
|
||||
else $main_prefs = $prefs;
|
||||
|
||||
if (!$venue) {
|
||||
prefs_email_parse_form($main_prefs);
|
||||
if ($venue) {
|
||||
$main_prefs->$venue = $prefs;
|
||||
} else {
|
||||
$main_prefs = $prefs;
|
||||
prefs_privacy_parse_form($user);
|
||||
}
|
||||
|
||||
project_prefs_update($user, $main_prefs);
|
||||
|
||||
if (!$venue) {
|
||||
|
|
|
@ -51,7 +51,7 @@ if ($subset == "global") {
|
|||
prefs_form_resource($prefs);
|
||||
prefs_form_project($prefs->project_specific);
|
||||
if (!$venue) {
|
||||
prefs_form_email($prefs);
|
||||
prefs_form_privacy($user);
|
||||
venue_form($user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,20 +7,19 @@
|
|||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
$hostid = $HTTP_GET_VARS["hostid"];
|
||||
page_head("Computer stats");
|
||||
|
||||
$result = mysql_query("select * from host where id = $hostid");
|
||||
$host = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
|
||||
if ($host) {
|
||||
if ($host->userid != $user->id) {
|
||||
echo "Not your computer\n";
|
||||
} else {
|
||||
show_host($host, true);
|
||||
}
|
||||
} else {
|
||||
echo "Couldn't find host or user.<p>";
|
||||
if (!$host) {
|
||||
echo "Couldn't find computer";
|
||||
exit();
|
||||
}
|
||||
|
||||
$private = false;
|
||||
if ($user && $user->id == $host->userid) {
|
||||
$private = true;
|
||||
}
|
||||
page_head("Computer summary", $user);
|
||||
show_host($host, $private);
|
||||
page_tail();
|
||||
?>
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
require_once("util.inc");
|
||||
require_once("db.inc");
|
||||
require_once("user.inc");
|
||||
require_once("host.inc");
|
||||
|
||||
db_init();
|
||||
$hostid = $HTTP_GET_VARS["hostid"];
|
||||
if ($hostid) {
|
||||
page_head("Host stats");
|
||||
|
||||
$result = mysql_query("select * from host where id = $hostid");
|
||||
$host = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
|
||||
if ($host) {
|
||||
show_host($host, false);
|
||||
} else {
|
||||
echo "Couldn't find host.<p>";
|
||||
}
|
||||
} else {
|
||||
echo "Couldn't find host.<p>";
|
||||
}
|
||||
page_tail();
|
||||
?>
|
|
@ -18,10 +18,17 @@ function show_user_stats($user, $private) {
|
|||
row2("Team", "None");
|
||||
}
|
||||
row2("Country", $user->country);
|
||||
if (strlen($user->url)) {
|
||||
row2("URL", "<a href=http://$user->url>http://$user->url</a>");
|
||||
}
|
||||
if ($private) {
|
||||
row2("Computers", "<a href=hosts_user.php>View</a>");
|
||||
} else {
|
||||
row2("Computers", "<a href=hosts_user.php?userid=$user->id>View</a>");
|
||||
if ($user->show_hosts) {
|
||||
row2("Computers", "<a href=hosts_user.php?userid=$user->id>View</a>");
|
||||
} else {
|
||||
row2("Computers", "hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +44,7 @@ function show_user_profile_private($user) {
|
|||
$email_text
|
||||
);
|
||||
row2("Name", $user->name);
|
||||
row2("URL", "http://$user->url");
|
||||
row2("Country", $user->country);
|
||||
row2("Postal code", $user->postal_code);
|
||||
row2("", "<a href=edit_user_info_form.php>Edit account info</a>");
|
||||
|
|
|
@ -106,6 +106,7 @@ function row1($x, $ncols=2) {
|
|||
|
||||
function row2($x, $y) {
|
||||
if ($x=="") $x="<br>";
|
||||
if ($y=="") $y="<br>";
|
||||
echo "<tr><td bgcolor=eeeeee width=50% align=right valign=top>$x</td><td valign=top><b>$y</b></td></tr>\n";
|
||||
}
|
||||
function row2_init($x, $y) {
|
||||
|
|
|
@ -81,10 +81,14 @@ void write_host(HOST& host, FILE* f, bool detail, bool show_user) {
|
|||
host.id
|
||||
);
|
||||
if (show_user) {
|
||||
fprintf(f,
|
||||
" <userid>%d</userid>\n",
|
||||
host.userid
|
||||
);
|
||||
USER user;
|
||||
db_user(host.userid, user);
|
||||
if (user.show_hosts) {
|
||||
fprintf(f,
|
||||
" <userid>%d</userid>\n",
|
||||
host.userid
|
||||
);
|
||||
}
|
||||
}
|
||||
fprintf(f,
|
||||
" <total_credit>%f</total_credit>\n"
|
||||
|
@ -141,10 +145,12 @@ void write_user(USER& user, FILE* f, bool detail, bool show_team) {
|
|||
"<user>\n"
|
||||
" <id>%d</id>\n"
|
||||
" <name>%s</name>\n"
|
||||
" <url>%s</url>\n"
|
||||
" <total_credit>%f</total_credit>\n"
|
||||
" <expavg_credit>%f</expavg_credit>\n",
|
||||
user.id,
|
||||
user.name,
|
||||
user.url,
|
||||
user.total_credit,
|
||||
user.expavg_credit
|
||||
);
|
||||
|
@ -154,7 +160,7 @@ void write_user(USER& user, FILE* f, bool detail, bool show_team) {
|
|||
user.teamid
|
||||
);
|
||||
}
|
||||
if (detail) {
|
||||
if (detail && user.show_hosts) {
|
||||
host.userid = user.id;
|
||||
while (!db_host_enum_userid(host)) {
|
||||
write_host(host, f, false, false);
|
||||
|
@ -423,6 +429,7 @@ void host_total_credit() {
|
|||
if (zip_files) system(cmd_line);
|
||||
}
|
||||
}
|
||||
|
||||
void host_expavg_credit() {
|
||||
HOST host;
|
||||
FILE* f = NULL;
|
||||
|
|
|
@ -247,7 +247,7 @@ class Project {
|
|||
if ($user->global_prefs) {
|
||||
$gp = "<global_preferences>\n$user->global_prefs</global_preferences>\n";
|
||||
}
|
||||
db_query("insert into user values (0, $now, '$user->email_addr', '$user->name', 'foobar', '$user->authenticator', 'Peru', '12345', 0, 0, 0, '$gp', '$pp', 0, 'home')");
|
||||
db_query("insert into user values (0, $now, '$user->email_addr', '$user->name', '$user->authenticator', 'Peru', '12345', 0, 0, 0, '$gp', '$pp', 0, 'home', '', 0, 1)");
|
||||
}
|
||||
|
||||
echo "adding apps\n";
|
||||
|
|
13
todo
13
todo
|
@ -28,18 +28,13 @@ THINGS TO TEST (preferably with test scripts)
|
|||
- credit is granted even if result arrives very late
|
||||
- multiple preference sets
|
||||
- shared memory and CPU time measurement, with and without the BOINC API
|
||||
- HD write frequency
|
||||
- timezone on all platforms
|
||||
|
||||
-----------------------
|
||||
MEDIUM-PRIORITY (should do before public release)
|
||||
-----------------------
|
||||
|
||||
add to user table:
|
||||
URL field (in XML)
|
||||
"show hosts to others" flag (in XML)
|
||||
move "send email" flag from XML to DB
|
||||
remove "show email" flag
|
||||
|
||||
add user control for HD write frequency
|
||||
|
||||
decide what to do with invalid result files in upload directory
|
||||
|
||||
make get_local_ip_addr() work in all cases
|
||||
|
@ -55,8 +50,6 @@ Devise system for porting applications
|
|||
|
||||
Add 2-D waterfall display to Astropulse
|
||||
|
||||
get timezone working on all platforms
|
||||
|
||||
Deadline mechanism for results
|
||||
- use in result dispatching
|
||||
- use in file uploading (decide what to upload next)
|
||||
|
|
53
tools/add.C
53
tools/add.C
|
@ -35,7 +35,7 @@
|
|||
// [ -signed_exec_files file1 sign1 file2 sign2 ... ]
|
||||
// create DB record
|
||||
// copy exec to data directory
|
||||
// add user -email_addr x -name y -web_password z -authenticator a
|
||||
// add user -email_addr x -name y -authenticator a
|
||||
// [ -global_prefs_file y ]
|
||||
|
||||
#include <string.h>
|
||||
|
@ -61,7 +61,7 @@ char *db_name=0, *db_passwd=0, *app_name=0, *platform_name=0;
|
|||
char *project_short_name=0, *project_long_name=0;
|
||||
char* user_friendly_name=0;
|
||||
char* exec_dir=0, *exec_files[10], *signature_files[10];
|
||||
char *email_addr=0, *user_name=0, *web_password=0, *authenticator=0;
|
||||
char *email_addr=0, *user_name=0, *authenticator=0;
|
||||
char *global_prefs_file=0, *download_dir, *download_url;
|
||||
char* code_sign_keyfile=0;
|
||||
char *message=0, *message_priority=0;
|
||||
|
@ -245,7 +245,6 @@ void add_user() {
|
|||
user.create_time = time(0);
|
||||
strcpy(user.email_addr, email_addr);
|
||||
strcpy(user.name, user_name);
|
||||
strcpy(user.web_password, web_password);
|
||||
strcpy(user.authenticator, authenticator);
|
||||
strcpy(user.country, "United States");
|
||||
strcpy(user.postal_code, "94703");
|
||||
|
@ -272,21 +271,17 @@ int main(int argc, char** argv) {
|
|||
} else if (!strcmp(argv[i], "-db_passwd")) {
|
||||
db_passwd = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-project_long_name")) {
|
||||
i++;
|
||||
project_long_name = argv[i];
|
||||
project_long_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-project_short_name")) {
|
||||
i++;
|
||||
project_short_name = argv[i];
|
||||
project_short_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-app_name")) {
|
||||
i++;
|
||||
app_name = argv[i];
|
||||
app_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-platform_name")) {
|
||||
platform_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-user_friendly_name")) {
|
||||
user_friendly_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-exec_dir")) {
|
||||
i++;
|
||||
exec_dir = argv[i];
|
||||
exec_dir = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-exec_files")) {
|
||||
signed_exec_files = false;
|
||||
i++;
|
||||
|
@ -306,41 +301,27 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
break;
|
||||
} else if (!strcmp(argv[i], "-exec_dir")) {
|
||||
i++;
|
||||
exec_dir = argv[i];
|
||||
exec_dir = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-email_addr")) {
|
||||
i++;
|
||||
email_addr = argv[i];
|
||||
email_addr = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-user_name")) {
|
||||
i++;
|
||||
user_name = argv[i];
|
||||
} else if (!strcmp(argv[i], "-web_password")) {
|
||||
i++;
|
||||
web_password = argv[i];
|
||||
user_name = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-authenticator")) {
|
||||
i++;
|
||||
authenticator = argv[i];
|
||||
authenticator = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-global_prefs_file")) {
|
||||
i++;
|
||||
global_prefs_file = argv[i];
|
||||
global_prefs_file = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-download_url")) {
|
||||
i++;
|
||||
download_url = argv[i];
|
||||
download_url = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-download_dir")) {
|
||||
i++;
|
||||
download_dir = argv[i];
|
||||
download_dir = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-version")) {
|
||||
i++;
|
||||
version = atoi(argv[i]);
|
||||
version = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-message")) {
|
||||
i++;
|
||||
message = argv[i];
|
||||
message = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-message_priority")) {
|
||||
i++;
|
||||
message_priority = argv[i];
|
||||
message_priority = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-code_sign_keyfile")) {
|
||||
i++;
|
||||
code_sign_keyfile = argv[i];
|
||||
code_sign_keyfile = argv[++i];
|
||||
}
|
||||
}
|
||||
retval = boinc_db_open(db_name, db_passwd);
|
||||
|
|
Loading…
Reference in New Issue