diff --git a/html/user/account_created.php b/html/user/account_created.php index b2682cc34f..098631dc22 100644 --- a/html/user/account_created.php +++ b/html/user/account_created.php @@ -2,7 +2,7 @@ include_once("util.inc"); - parse_str(getenv("QUERY_STRING")); + $email_addr = $_GET["email_addr"]; page_head("Account created"); echo "

Congratulations - your ".PROJECT." account has been created

@@ -20,7 +20,7 @@ - "; + "; page_tail(); diff --git a/html/user/bug_report_action.php b/html/user/bug_report_action.php index 9b0f9511a8..fe52b78320 100644 --- a/html/user/bug_report_action.php +++ b/html/user/bug_report_action.php @@ -12,8 +12,6 @@ if ($user == NULL) { exit(); } -parse_str(getenv("QUERY_STRING")); - $f = fopen("bug_reports.xml", "a"); $x = sprintf(" $user->id @@ -23,8 +21,8 @@ $x = sprintf(" ", - $HTTP_POST_VARS["platform"], - $HTTP_POST_VARS["problem"] + $_POST["platform"], + $_POST["problem"] ); fputs($f, $x); fclose($f); diff --git a/html/user/confirm_email_change.php b/html/user/confirm_email_change.php index ba5f700210..b20bb93bf5 100644 --- a/html/user/confirm_email_change.php +++ b/html/user/confirm_email_change.php @@ -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"); diff --git a/html/user/login_action.php b/html/user/login_action.php index eaed88dcea..e86ea69f76 100644 --- a/html/user/login_action.php +++ b/html/user/login_action.php @@ -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"); } diff --git a/html/user/login_form.php b/html/user/login_form.php index c608bb108a..e77363fd33 100644 --- a/html/user/login_form.php +++ b/html/user/login_form.php @@ -1,13 +1,13 @@ // -// 1.3 +// 1.3 // ... // // @@ -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: -
If you participate in multiple BOINC projects, this is the proportion of your resources used by ".PROJECT."", + "Resource share
+ If you participate in multiple BOINC projects, this is the proportion of your resources used by ".PROJECT."", $prefs->resource_share ); } @@ -251,9 +253,9 @@ function prefs_form_global($user, $prefs) { Keep enough to work on disk to last between - + and - days + days 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 "Venue$user->venue\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."\n"; } $xml = $xml - ."$prefs->low_water_days\n" - ."$prefs->high_water_days\n"; + ."$prefs->work_buf_min_days\n" + ."$prefs->work_buf_max_days\n"; $xml = $xml ."$prefs->disk_max_used_gb\n" ."$prefs->disk_max_used_pct\n" diff --git a/html/user/prefs_edit_global_action.php b/html/user/prefs_edit_global_action.php index b817230fd2..38d49f44b0 100644 --- a/html/user/prefs_edit_global_action.php +++ b/html/user/prefs_edit_global_action.php @@ -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); diff --git a/html/user/prefs_edit_project_action.php b/html/user/prefs_edit_project_action.php index d064e7e939..050ccc56cc 100644 --- a/html/user/prefs_edit_project_action.php +++ b/html/user/prefs_edit_project_action.php @@ -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(); diff --git a/html/user/prefs_edit_project_form.php b/html/user/prefs_edit_project_form.php index ae1c8babb1..b3932d6a33 100644 --- a/html/user/prefs_edit_project_form.php +++ b/html/user/prefs_edit_project_form.php @@ -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 "
diff --git a/html/user/project_specific_prefs.inc b/html/user/project_specific_prefs.inc index e7c99e8e80..a79c10a42e 100644 --- a/html/user/project_specific_prefs.inc +++ b/html/user/project_specific_prefs.inc @@ -33,11 +33,10 @@ function project_specific_prefs_edit($prefs) { "; } -// 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"; } diff --git a/html/user/project_specific_prefs_ap.inc b/html/user/project_specific_prefs_ap.inc index b96151bdd3..e09c287797 100755 --- a/html/user/project_specific_prefs_ap.inc +++ b/html/user/project_specific_prefs_ap.inc @@ -36,7 +36,9 @@ function option($name, $val) { function project_specific_prefs_edit($prefs) { $x = $prefs->color_scheme; echo " - Color scheme: + Graphics preferences: +
Select Custom to edit individual parameters + Graph dimension - 2-D - 3-D + 2-D + 3-D Graph transparency "; @@ -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 @@ -117,27 +126,15 @@ function project_specific_prefs_parse_form() { // show non-editable version of prefs // function project_specific_prefs_show($prefs) { - echo " - Color scheme: - $prefs->color_scheme - - "; + row2("Color scheme", $prefs->color_scheme); if ($prefs->color_scheme == "Custom") { $dim = $prefs->two_dim?"2":"3"; - echo " - Start hue - $prefs->start_hue - Hue change - $prefs->hue_change - Grow time - $prefs->grow_time - Hold time - $prefs->hold_time - Graph alpha - $prefs->graph_alpha - Graph dimension - $dim - "; + 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); } } diff --git a/html/user/show_host_detail.php b/html/user/show_host_detail.php index f6acfea879..c10539fdda 100644 --- a/html/user/show_host_detail.php +++ b/html/user/show_host_detail.php @@ -8,57 +8,59 @@ function show_host($host) { echo TABLE2."\n"; echo "".TD2.LG_FONT."Host Information:\n"; - row("IP address: ", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); - row("Domain name: ", $host->domain_name); + row2("IP address", "$host->last_ip_addr
(same the last $host->nsame_ip_addr times)"); + row2("Domain name", $host->domain_name); $x = $host->timezone/3600; - row("Time zone: ", "UTC - $x hours"); - row("Created: ", time_str($host->create_time)); - row("Total Credit:", $host->total_credit); - row("Recent average credit:", $host->expavg_credit); - row("CPU: ", "$host->p_vendor $host->p_model"); - row("Number of CPUs: ", $host->p_ncpus); - row("Operating System: ", "$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("Memory: ", "$y MB"); + row2("Memory", "$y MB"); $x = $host->m_cache/1024; $y = round($x, 2); - row("Cache: ", "$y KB"); + row2("Cache", "$y KB"); $x = $host->m_swap/(1024*1024); $y = round($x, 2); - row("Swap Space: ", "$y MB"); + row2("Swap space", "$y MB"); $x = $host->d_total/(1024*1024*1024); $y = round($x, 2); - row("Total Disk Space: ", "$y GB"); + row2("Total disk space", "$y GB"); $x = $host->d_free/(1024*1024*1024); $y = round($x, 2); - row("Free Disk Space: ", "$y GB"); + row2("Free Disk Space", "$y GB"); $x = $host->p_fpops/(1000*1000); $y = round($x, 2); - row("Measured floating point speed: ", "$y million ops/sec"); + row2("Measured floating point speed", "$y million ops/sec"); $x = $host->p_iops/(1000*1000); $y = round($x, 2); - row("Measured integer speed: ", "$y million ops/sec"); + row2("Measured integer speed", "$y million ops/sec"); $x = $host->p_membw/(1024*1024); $y = round($x, 2); - row("Measured memory bandwidth: ", "$y MB/sec"); + row2("Measured memory bandwidth", "$y MB/sec"); $x = $host->n_bwup/(1024); $y = round($x, 2); - if ($y > 0) - row("Avg upload speed:", "$y KB/sec"); - else - row("Avg upload speed:
", "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("Avg download speed:
", "$y KB/sec"); - else - row("Avg download speed:
", "Unknown"); - row("Number of times client has contacted server: ", $host->rpc_seqno); - row("Last time contacted server: ", time_str($host->rpc_time)); - row("% of time client on: ", 100*$host->on_frac." %"); - row("% of time host connected: ", 100*$host->connected_frac." %"); - row("% of time user active: ", 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 "\n"; } diff --git a/html/user/team.inc b/html/user/team.inc index ad3187b9b9..3378e08616 100644 --- a/html/user/team.inc +++ b/html/user/team.inc @@ -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 "Team Info:"; echo ""; if (strlen($team->description)) { - row("Description: ", sanitize_html($team->description)); + row2("Description", sanitize_html($team->description)); } if (strlen($team->url)) {; - row("Web site: ", "url>http://$team->url"); + row2("Web site", "url>http://$team->url"); } - row("Members: ", $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("Total Credit: ", $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("Founder: ", $user->name); + row2("Founder", $user->name); echo "
"; echo "

"; echo ""; diff --git a/html/user/user.inc b/html/user/user.inc index fe8dbd1630..dab0e04175 100644 --- a/html/user/user.inc +++ b/html/user/user.inc @@ -3,16 +3,16 @@ function show_user_stats($user) { echo TABLE2."\n"; echo "".TD2.LG_FONT."User stats\n"; - $row = sprintf("%s user since", $project); - row($row, time_str($user->create_time)); - row("Total credit", $user->total_credit); - row("Recent average credit", $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("Team", "id>$team->name"); + row2("Team", "id>$team->name"); } else { - row("Team: ", "None"); + row2("Team", "None"); } echo "
\n"; } @@ -32,10 +32,10 @@ function show_user_profile($user) { } echo TABLE2."\n"; echo "".TD2.LG_FONT."User information\n"; - row("name", $user->name.edit_link()); - row("email address", $email_text.edit_email_link()); - row("country", $user->country.edit_link()); - row("postal (ZIP) code", $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 "\n"; } diff --git a/html/user/util.inc b/html/user/util.inc index fc90a47baa..c994b42682 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -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 ""; } -function row($x, $y) { - echo "\n"; -} - function row2($x, $y) { - echo "\n"; -} - -function row2a($x, $y) { - echo "\n"; + echo "\n"; } function row3($x, $y, $z) {
$x$y
$x$y
$x$y
$x$y