svn path=/trunk/boinc/; revision=984
This commit is contained in:
David Anderson 2003-02-27 22:30:31 +00:00
parent 5a7d561171
commit 873e28d7c0
15 changed files with 139 additions and 147 deletions

View File

@ -2,7 +2,7 @@
include_once("util.inc");
parse_str(getenv("QUERY_STRING"));
$email_addr = $_GET["email_addr"];
page_head("Account created");
echo "
<h3>Congratulations - your ".PROJECT." account has been created</h3>
@ -20,7 +20,7 @@
<td><input type=submit value='OK'></td>
</tr></table>
</form>
";
";
page_tail();

View File

@ -12,8 +12,6 @@ if ($user == NULL) {
exit();
}
parse_str(getenv("QUERY_STRING"));
$f = fopen("bug_reports.xml", "a");
$x = sprintf("<bug>
<userid>$user->id</userid>
@ -23,8 +21,8 @@ $x = sprintf("<bug>
</problem>
</bug>
",
$HTTP_POST_VARS["platform"],
$HTTP_POST_VARS["problem"]
$_POST["platform"],
$_POST["problem"]
);
fputs($f, $x);
fclose($f);

View File

@ -4,7 +4,8 @@
db_init();
parse_str(getenv("QUERY_STRING"));
$id = $_GET["id"];
$str = $_GET["str"];
$user = null;
$result = mysql_query("select * from user where id=$id");

View File

@ -5,9 +5,9 @@
$authenticator = init_session();
db_init();
$authenticator = $HTTP_POST_VARS["authenticator"];
//$email_addr = $HTTP_POST_VARS["email_addr"];
//$password = $HTTP_POST_VARS["password"];
$authenticator = trim($_POST["authenticator"]);
//$email_addr = $_POST["email_addr"];
//$password = $_POST["password"];
if (strlen($authenticator)) {
$query = "select * from user where authenticator='$authenticator'";
//} else if (strlen($email_addr)) {
@ -29,7 +29,7 @@
page_tail();
//} else if (strlen($password)) {
// page_head("Log in");
// if ($user->web_password != $HTTP_POST_VARS["existing_password"]) {
// if ($user->web_password != $_POST["existing_password"]) {
// echo "Bad password.";
// }
} else {
@ -37,7 +37,7 @@
mysql_query("update user set email_addr='$email' where id=$user->id");
}
$_SESSION["authenticator"] = $user->authenticator;
$next_url = $HTTP_POST_VARS["next_url"];
$next_url = $_POST["next_url"];
if (strlen($next_url) == 0) $next_url = "home.php";
Header("Location: $next_url");
}

View File

@ -1,13 +1,13 @@
<?php
require_once("util.inc");
$next_url = $_GET["next_url"];
$authenticator = init_session();
db_init();
$user = get_user_from_auth($authenticator);
parse_str(getenv("QUERY_STRING"));
page_head("Log in", $user);
print_login_form_aux($next_url);
if ($user) {

View File

@ -11,7 +11,7 @@
// This XML has the general structure
// <global_preferences>
// <run_if_user_active/>
// <low_water_days>1.3</low_water_days>
// <work_buf_min_days>1.3</work_buf_min_days>
// ...
// </global_preferences>
//
@ -78,11 +78,11 @@ function element_end($parser, $name) {
case "confirm_before_connecting":
$parse_result->confirm_before_connecting = true;
break;
case "low_water_days":
$parse_result->low_water_days = $text;
case "work_buf_min_days":
$parse_result->work_buf_min_days = $text;
break;
case "high_water_days":
$parse_result->high_water_days = $text;
case "work_buf_max_days":
$parse_result->work_buf_max_days = $text;
break;
case "disk_max_used_gb":
$parse_result->disk_max_used_gb = $text;
@ -130,8 +130,8 @@ function default_prefs() {
$p->run_on_batteries = false;
$p->run_if_user_active = true;
$p->confirm_before_connecting = false;
$p->low_water_days = 1;
$p->high_water_days = 3;
$p->work_buf_min_days = 1;
$p->work_buf_max_days = 3;
$p->disk_max_used_gb = 100;
$p->disk_max_used_pct = 50;
$p->disk_min_free_gb = 1;
@ -144,12 +144,15 @@ function default_prefs() {
return $p;
}
// state of prefs before parsing
// state of prefs before parsing; initialize all booleans to false
//
function initial_prefs() {
$p = default_prefs();
$p->show_email = false;
$p->send_email = false;
$p->run_on_batteries = false;
$p->run_if_user_active = false;
$p->confirm_before_connecting = false;
return $p;
}
@ -173,20 +176,19 @@ function prefs_parse($prefs_xml) {
// display preference subsets, with Edit buttons
//
function prefs_show_global($prefs) {
row2a("Work if computer on batteries:", $prefs->run_on_batteries?"Yes":"No");
row2a("Work if computer in use:", $prefs->run_if_user_active?"Yes":"No");
row2a("Confirm before connecting to network:", $prefs->confirm_before_connecting?"Yes":"No");
row2a("Minimum amount of work to buffer:", "$prefs->low_water_days days");
row2a("Maximum amount of work to buffer:", "$prefs->high_water_days days");
row2a("Maximum disk space to use:", "$prefs->disk_max_used_gb GB");
row2a("Minimum disk space to leave free:", "$prefs->disk_min_free_gb GB");
row2a("Maximum % of disk allowed to used:", "$prefs->disk_max_used_pct %");
row2("Work if computer on batteries:", $prefs->run_on_batteries?"Yes":"No");
row2("Work if computer in use:", $prefs->run_if_user_active?"Yes":"No");
row2("Confirm before connecting to network:", $prefs->confirm_before_connecting?"Yes":"No");
row2("Amount of work to buffer:", "$prefs->work_buf_min_days to $prefs->work_buf_max_days days");
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 %");
}
function prefs_show_resource($prefs) {
row2(
"Resource share:
<br><font size=-1>If you participate in multiple BOINC projects, this is the proportion of your resources used by ".PROJECT."</font>",
"Resource share<br>
<font size=-1>If you participate in multiple BOINC projects, this is the proportion of your resources used by ".PROJECT."</font>",
$prefs->resource_share
);
}
@ -251,9 +253,9 @@ function prefs_form_global($user, $prefs) {
<tr>
<td align=right>Keep enough to work on disk to last between
</td><td>
<input size=5 name=low_water_days value='$prefs->low_water_days'>
<input size=5 name=work_buf_min_days value='$prefs->work_buf_min_days'>
and
<input size=5 name=high_water_days value='$prefs->high_water_days'> days
<input size=5 name=work_buf_max_days value='$prefs->work_buf_max_days'> days
</td></tr>
<tr><td colspan=2>
You can limit the disk space used by ".PROJECT." in three different ways:
@ -310,7 +312,7 @@ function prefs_form_project($prefs_xml) {
}
function venue_show($user) {
echo "<tr><td>Venue</td><td>$user->venue</td></tr>\n";
row2("Venue", $user->venue);
}
function venue_form($user) {
@ -328,8 +330,7 @@ function venue_form($user) {
}
function venue_parse(&$user) {
parse_str(getenv("QUERY_STRING"));
$user->venue = $venue;
$user->venue = $_GET['venue'];
}
function venue_update($user) {
@ -341,17 +342,24 @@ function venue_update($user) {
// Functions to parse form elements, modifying a preferences structure
//
function prefs_global_parse_form(&$prefs) {
parse_str(getenv("QUERY_STRING"));
$run_on_batteries = $_GET["run_on_batteries"];
$run_if_user_active = $_GET["run_if_user_active"];
$confirm_before_connecting = $_GET["confirm_before_connecting"];
$work_buf_min_days = $_GET["work_buf_min_days"];
$work_buf_max_days = $_GET["work_buf_max_days"];
$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"];
$prefs->run_on_batteries = ($run_on_batteries == "yes");
$prefs->run_if_user_active = ($run_if_user_active == "yes");
$prefs->confirm_before_connecting = ($confirm_before_connecting == "yes");
if ($low_water_days<0) $low_water_days = 0;
if ($high_water_days<0) $high_water_days = 0;
if ($low_water_days > $high_water_days) $low_water_days = $high_water_days;
$prefs->low_water_days = $low_water_days;
$prefs->high_water_days = $high_water_days;
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;
$prefs->work_buf_min_days = $work_buf_min_days;
$prefs->work_buf_max_days = $work_buf_max_days;
if ($disk_max_used_gb<0) $disk_max_used_gb = 0;
if ($disk_max_used_pct<0) $disk_max_used_pct = 0;
@ -363,14 +371,12 @@ function prefs_global_parse_form(&$prefs) {
}
function prefs_resource_parse_form(&$prefs) {
parse_str(getenv("QUERY_STRING"));
$prefs->resource_share = $resource_share;
$prefs->resource_share = $_GET['resource_share'];
}
function prefs_email_parse_form(&$prefs) {
parse_str(getenv("QUERY_STRING"));
$prefs->send_email = ($send_email == "yes");
$prefs->show_email = ($show_email == "yes");
$prefs->send_email = ($_GET['send_email'] == "yes");
$prefs->show_email = ($_GET['show_email'] == "yes");
}
function prefs_project_parse_form(&$prefs) {
@ -396,8 +402,8 @@ function global_prefs_make_xml($prefs) {
$xml = $xml."<confirm_before_connecting/>\n";
}
$xml = $xml
."<low_water_days>$prefs->low_water_days</low_water_days>\n"
."<high_water_days>$prefs->high_water_days</high_water_days>\n";
."<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";
$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"

View File

@ -12,7 +12,6 @@ if ($user == NULL) {
print_login_form();
exit();
}
parse_str(getenv("QUERY_STRING"));
$prefs = prefs_parse($user->prefs);
prefs_global_parse_form($prefs);

View File

@ -4,8 +4,6 @@ include_once("db.inc");
include_once("util.inc");
include_once("prefs.inc");
parse_str(getenv("QUERY_STRING"));
$authenticator = init_session();
db_init();

View File

@ -13,7 +13,6 @@ if ($user == NULL) {
exit();
}
page_head("Edit project preferences", $user);
parse_str(getenv("QUERY_STRING"));
$prefs = prefs_parse($user->project_prefs);
echo "<form action=prefs_edit_project_action.php>

View File

@ -33,11 +33,10 @@ function project_specific_prefs_edit($prefs) {
</tr>";
}
// QUERY_STRING has already been parsed into variables.
// Return XML version of project-specific prefs
//
function project_specific_prefs_parse_form() {
parse_str(getenv("QUERY_STRING"));
$color_scheme = $_GET["color_scheme"];
return "<color_scheme>$color_scheme</color_scheme>";
}

View File

@ -36,7 +36,9 @@ function option($name, $val) {
function project_specific_prefs_edit($prefs) {
$x = $prefs->color_scheme;
echo "<tr>
<td align=right>Color scheme:</td><td>
<td align=right>Graphics preferences:
<br><font size=-1>Select Custom to edit individual parameters</font>
</td><td>
<select name=color_scheme>
";
option("Tahiti Sunset", $x);
@ -57,8 +59,8 @@ function project_specific_prefs_edit($prefs) {
<tr><td align=right>Hold time</td>
<td><input name=hold_time value='$prefs->hold_time'></td></tr>
<tr><td align=right>Graph dimension</td>
<td><input type=radio name=two_dim value=yes $sel2>2-D
<input type=radio name=two_dim value=no $sel3>3-D</td></tr>
<td><input type=radio name=two_dim value=yes $sel2> 2-D
<input type=radio name=two_dim value=no $sel3> 3-D</td></tr>
<tr><td align=right>Graph transparency</td>
<td><input name=graph_alpha value='$prefs->graph_alpha'></td></tr>
";
@ -68,7 +70,14 @@ function project_specific_prefs_edit($prefs) {
// Return XML version of project-specific prefs from form vars
//
function project_specific_prefs_parse_form() {
parse_str(getenv("QUERY_STRING"));
$color_scheme = $_GET["color_scheme"];
$start_hue = $_GET["start_hue"];
$hue_change = $_GET["hue_change"];
$grow_time = $_GET["grow_time"];
$hold_time = $_GET["hold_time"];
$graph_alpha = $_GET["graph_alpa"];
$two_dim = $_GET["two_dim"];
switch( $color_scheme ) {
case "Tahiti Sunset":
$start_hue = 0.5;
@ -95,12 +104,12 @@ function project_specific_prefs_parse_form() {
$two_dim = "no";
break;
case "Custom":
if (!isset($start_hue)) $start_hue = 0;
if (!isset($hue_change)) $hue_change = 1;
if (!isset($grow_time)) $grow_time = 10;
if (!isset($hold_time)) $hold_time = 5;
if (!isset($graph_alpha)) $graph_alpha = 0.7;
if (!isset($two_dim)) $two_dim = "no";
if ($start_hue == null) $start_hue = 0;
if ($hue_change == null) $hue_change = 1;
if ($grow_time == null) $grow_time = 10;
if ($hold_time == null) $hold_time = 5;
if ($graph_alpha == null) $graph_alpha = 0.7;
if ($two_dim == null) $two_dim = "no";
break;
}
$x = "<color_scheme>$color_scheme</color_scheme>
@ -117,27 +126,15 @@ function project_specific_prefs_parse_form() {
// show non-editable version of prefs
//
function project_specific_prefs_show($prefs) {
echo "<tr>
<td>Color scheme:</td>
<td>$prefs->color_scheme</td>
</tr>
";
row2("Color scheme", $prefs->color_scheme);
if ($prefs->color_scheme == "Custom") {
$dim = $prefs->two_dim?"2":"3";
echo "
<tr><td align=right>Start hue</td>
<td>$prefs->start_hue</td></tr>
<tr><td align=right>Hue change</td>
<td>$prefs->hue_change</td></tr>
<tr><td align=right>Grow time</td>
<td>$prefs->grow_time</td></tr>
<tr><td align=right>Hold time</td>
<td>$prefs->hold_time</td></tr>
<tr><td align=right>Graph alpha</td>
<td>$prefs->graph_alpha</td></tr>
<tr><td align=right>Graph dimension</td>
<td>$dim</td></tr>
";
row2("Start hue", $prefs->start_hue);
row2("Hue change", $prefs->hue_change);
row2("Grow time", $prefs->grow_time);
row2("Hold time", $prefs->hold_time);
row2("Graph alpha", $prefs->graph_alpha);
row2("Graph dimension", $dim);
}
}

View File

@ -8,57 +8,59 @@ function show_host($host) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>Host Information:</b></font></td></tr>\n";
row("<b>IP address: </b>", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
row("<b>Domain name: <b>", $host->domain_name);
row2("IP address", "$host->last_ip_addr<br>(same the last $host->nsame_ip_addr times)");
row2("Domain name", $host->domain_name);
$x = $host->timezone/3600;
row("<b>Time zone: </b>", "UTC - $x hours");
row("<b>Created: </b>", time_str($host->create_time));
row("<b>Total Credit:</b>", $host->total_credit);
row("<b>Recent average credit:</b>", $host->expavg_credit);
row("<b>CPU: </b>", "$host->p_vendor $host->p_model");
row("<b>Number of CPUs: </b>", $host->p_ncpus);
row("<b>Operating System: </b>", "$host->os_name $host->os_version");
row2("Time zone", "UTC - $x hours");
row2("Created", time_str($host->create_time));
row2("Total Credit", $host->total_credit);
row2("Recent average credit", $host->expavg_credit);
row2("CPU type", "$host->p_vendor $host->p_model");
row2("Number of CPUs", $host->p_ncpus);
row2("Operating System", "$host->os_name $host->os_version");
$x = $host->m_nbytes/(1024*1024);
$y = round($x, 2);
row("<b>Memory: </b>", "$y MB");
row2("Memory", "$y MB");
$x = $host->m_cache/1024;
$y = round($x, 2);
row("<b>Cache: </b>", "$y KB");
row2("Cache", "$y KB");
$x = $host->m_swap/(1024*1024);
$y = round($x, 2);
row("<b>Swap Space: </b>", "$y MB");
row2("Swap space", "$y MB");
$x = $host->d_total/(1024*1024*1024);
$y = round($x, 2);
row("<b>Total Disk Space: </b>", "$y GB");
row2("Total disk space", "$y GB");
$x = $host->d_free/(1024*1024*1024);
$y = round($x, 2);
row("<b>Free Disk Space: </b>", "$y GB");
row2("Free Disk Space", "$y GB");
$x = $host->p_fpops/(1000*1000);
$y = round($x, 2);
row("<b>Measured floating point speed: </b>", "$y million ops/sec");
row2("Measured floating point speed", "$y million ops/sec");
$x = $host->p_iops/(1000*1000);
$y = round($x, 2);
row("<b>Measured integer speed: </b>", "$y million ops/sec");
row2("Measured integer speed", "$y million ops/sec");
$x = $host->p_membw/(1024*1024);
$y = round($x, 2);
row("<b>Measured memory bandwidth: </b>", "$y MB/sec");
row2("Measured memory bandwidth", "$y MB/sec");
$x = $host->n_bwup/(1024);
$y = round($x, 2);
if ($y > 0)
row("<b>Avg upload speed:</b>", "$y KB/sec");
else
row("<b>Avg upload speed:<br></b>", "Unknown");
if ($y > 0) {
row2("Average upload speed", "$y KB/sec");
} else {
row2("Average upload speed", "Unknown");
}
$x = $host->n_bwdown/(1024);
$y = round($x, 2);
if ($y > 0)
row("<b>Avg download speed:<br></b>", "$y KB/sec");
else
row("<b>Avg download speed:<br></b>", "Unknown");
row("<b>Number of times client has contacted server: </b>", $host->rpc_seqno);
row("<b>Last time contacted server: </b>", time_str($host->rpc_time));
row("<b>% of time client on: </b>", 100*$host->on_frac." %");
row("<b>% of time host connected: </b>", 100*$host->connected_frac." %");
row("<b>% of time user active: </b>", 100*$host->active_frac." %");
if ($y > 0) {
row2("Average download speed", "$y KB/sec");
} else {
row2("Average download speed", "Unknown");
}
row2("Number of times client has contacted server", $host->rpc_seqno);
row2("Last time contacted server", time_str($host->rpc_time));
row2("% of time client on", 100*$host->on_frac." %");
row2("% of time host connected", 100*$host->connected_frac." %");
row2("% of time user active", 100*$host->active_frac." %");
echo "</table>\n";
}

View File

@ -6,13 +6,13 @@ require_once("sanitize_html.inc");
function show_team($team) {
start_table();
row("ID", $team->id);
row("founder", $team->userid);
row("name", $team->name);
row("url", $team->url);
row("type", $team->type);
row("name_html", $team->name_html);
row("description", sanitize_html($team->description));
row2("ID", $team->id);
row2("founder", $team->userid);
row2("name", $team->name);
row2("url", $team->url);
row2("type", $team->type);
row2("name_html", $team->name_html);
row2("description", sanitize_html($team->description));
}
function display_team_page($team) {
@ -37,17 +37,17 @@ function display_team_page($team) {
echo "<b>Team Info:</b></font></td></tr></table>";
echo "<table>";
if (strlen($team->description)) {
row("<b>Description: </b>", sanitize_html($team->description));
row2("Description", sanitize_html($team->description));
}
if (strlen($team->url)) {;
row("<b>Web site: </b>", "<a href=http://$team->url>http://$team->url</a>");
row2("Web site", "<a href=http://$team->url>http://$team->url</a>");
}
row("<b>Members: </b>", $team->nusers);
row2("Members", $team->nusers);
$query = sprintf(
"select * from user where teamid = %d",
$team->id
);
);
$result = mysql_query($query);
$total_credit = 0;
for ($i = 0; $i < $team->nusers; $i++) {
@ -55,14 +55,14 @@ function display_team_page($team) {
$total_credit = $total_credit + $user->total_credit;
}
row("<b>Total Credit: </b>", $total_credit);
row2("Total Credit", $total_credit);
$query = sprintf(
"select * from user where id = %d",
$team->userid
);
$result = mysql_query($query);
$user = mysql_fetch_object($result);
row("<b>Founder: </b>", $user->name);
row2("Founder", $user->name);
echo "</table>";
echo "<p>";
echo "<table border=0 width=580>";

View File

@ -3,16 +3,16 @@
function show_user_stats($user) {
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User stats</b></font></td></tr>\n";
$row = sprintf("<b>%s user since</b>", $project);
row($row, time_str($user->create_time));
row("<b>Total credit</b>", $user->total_credit);
row("<b>Recent average credit</b>", $user->expavg_credit);
$row = sprintf("%s user since", $project);
row2($row, time_str($user->create_time));
row2("Total credit", $user->total_credit);
row2("Recent average credit", $user->expavg_credit);
if ($user->teamid) {
$result = mysql_query("select * from team where id = $user->teamid");
$team = mysql_fetch_object($result);
row("<b>Team</b>", "<a href=team_display.php?id=$team->id>$team->name</a>");
row2("Team", "<a href=team_display.php?id=$team->id>$team->name</a>");
} else {
row("<b>Team: </b>", "None");
row2("Team", "None");
}
echo "</table>\n";
}
@ -32,10 +32,10 @@ function show_user_profile($user) {
}
echo TABLE2."\n";
echo "<tr>".TD2.LG_FONT."<b>User information</b></font></td></tr>\n";
row("<b>name</b>", $user->name.edit_link());
row("<b>email address</b>", $email_text.edit_email_link());
row("<b>country</b>", $user->country.edit_link());
row("<b>postal (ZIP) code</b>", $user->postal_code.edit_link());
row2("name", $user->name.edit_link());
row2("email address", $email_text.edit_email_link());
row2("country", $user->country.edit_link());
row2("postal (ZIP) code", $user->postal_code.edit_link());
echo "</table>\n";
}

View File

@ -28,6 +28,7 @@ define("BODY_COLOR", " bgcolor=ffffff ");
function send_auth_email($email_addr, $auth) {
mail($email_addr, PROJECT." new account confirmation",
"This email confirms the creation of your ".PROJECT." account.
".PROJECT." URL: ".MASTER_URL."
Your account key: $auth\n
@ -100,16 +101,8 @@ function start_table() {
echo "<table width=600 border=2 cellpadding=4>";
}
function row($x, $y) {
echo "<tr><td width=30% valign=top align=right>$x</td><td>$y</td></tr>\n";
}
function row2($x, $y) {
echo "<tr><td>$x</td><td>$y</td></tr>\n";
}
function row2a($x, $y) {
echo "<tr><td>$x</td><td width=50%>$y</td></tr>\n";
echo "<tr><td width=50% align=right valign=top>$x</td><td valign=top><b>$y</b></td></tr>\n";
}
function row3($x, $y, $z) {