From f98c7f0644cb9256a9b08e2d84fc84e9d4753150 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 Mar 2003 21:01:32 +0000 Subject: [PATCH] user web svn path=/trunk/boinc/; revision=1081 --- checkin_notes | 7 ++ db/db.h | 6 +- html/user/account_setup.php | 4 +- html/user/account_setup_first_action.php | 7 +- html/user/account_setup_first_download.php | 7 +- html/user/account_setup_nonfirst.php | 7 +- html/user/account_setup_nonfirst_action.php | 7 +- html/user/account_setup_nonfirst_done.php | 7 +- html/user/add_venue_action.php | 4 +- html/user/add_venue_form.php | 4 +- html/user/bug_report_action.php | 49 ++++---- html/user/bug_report_form.php | 46 ++++---- html/user/create_account_action.php | 2 +- html/user/download.php | 2 +- html/user/edit_email_action.php | 4 +- html/user/edit_email_form.php | 5 +- html/user/edit_user_info_action.php | 4 +- html/user/edit_user_info_form.php | 7 +- html/user/get_passwd.php | 22 ++-- html/user/home.php | 14 +-- html/user/host.inc | 23 +++- html/user/host_venue_action.php | 4 +- html/user/hosts_user.php | 29 +++-- html/user/index.php | 2 +- html/user/login_action.php | 2 +- html/user/prefs.php | 4 +- html/user/prefs_edit_action.php | 7 +- html/user/prefs_edit_form.php | 7 +- html/user/prefs_remove.php | 7 +- html/user/show_host_detail.php | 27 ++--- html/user/show_hosts.php | 15 --- html/user/show_user.php | 2 +- html/user/team.inc | 1 - html/user/team.php | 2 +- html/user/team_create_action.php | 122 ++++++++++---------- html/user/team_create_form.php | 12 +- html/user/team_disband_action.php | 37 +++--- html/user/team_disband_form.php | 8 +- html/user/team_display.php | 2 +- html/user/team_edit_action.php | 3 +- html/user/team_edit_form.php | 55 ++++----- html/user/team_email_list.php | 25 ++-- html/user/team_join_action.php | 4 +- html/user/team_join_form.php | 2 +- html/user/team_lookup.php | 2 +- html/user/team_quit_action.php | 5 +- html/user/team_quit_form.php | 3 +- html/user/team_remove_inactive_action.php | 5 +- html/user/team_remove_inactive_form.php | 12 +- html/user/top_hosts.php | 6 +- html/user/user.inc | 58 ++++------ html/user/util.inc | 7 ++ todo | 6 + 53 files changed, 319 insertions(+), 402 deletions(-) delete mode 100644 html/user/show_hosts.php diff --git a/checkin_notes b/checkin_notes index ddae5bb1c1..d0fa8501cf 100755 --- a/checkin_notes +++ b/checkin_notes @@ -3870,3 +3870,10 @@ Eric March 19, 2003 win/ wingui_mainwindow.cpp +David Mar 19 2003 + - general cleanup of user web + + html_user/ + * + show_hosts.php (removed) + diff --git a/db/db.h b/db/db.h index d7521772ca..6c8d8bd9bf 100644 --- a/db/db.h +++ b/db/db.h @@ -114,10 +114,10 @@ struct USER { double total_credit; double expavg_credit; // credit per second, recent average double expavg_time; // when the above was computed - char global_prefs[MAX_BLOB_SIZE]; // global preferences - // within tag + char global_prefs[MAX_BLOB_SIZE]; + // global preferences, within tag char project_prefs[MAX_BLOB_SIZE]; - // within tag + // project preferences, within tag int teamid; // if user is part of a team char venue[256]; // home/work/school (default) }; diff --git a/html/user/account_setup.php b/html/user/account_setup.php index 8c5a20817c..75be35484a 100644 --- a/html/user/account_setup.php +++ b/html/user/account_setup.php @@ -2,11 +2,9 @@ require_once("db.inc"); require_once("util.inc"); - $authenticator = init_session(); db_init(); - $user = get_user_from_auth($authenticator); - require_login($user); + $user = get_logged_in_user(); page_head("Account setup", $user); echo " diff --git a/html/user/account_setup_first_action.php b/html/user/account_setup_first_action.php index 9be333de4f..4646818949 100644 --- a/html/user/account_setup_first_action.php +++ b/html/user/account_setup_first_action.php @@ -4,14 +4,9 @@ include_once("db.inc"); include_once("util.inc"); include_once("prefs.inc"); -$authenticator = init_session(); db_init(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} +$user = get_logged_in_user(); // TODO: consolidate the three DB updates into one diff --git a/html/user/account_setup_first_download.php b/html/user/account_setup_first_download.php index daf7c6e0d0..e6053e8155 100644 --- a/html/user/account_setup_first_download.php +++ b/html/user/account_setup_first_download.php @@ -5,12 +5,7 @@ require_once("util.inc"); require_once("download.inc"); db_init(); -$authenticator = init_session(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} +$user = get_logged_in_user(); page_head("Download BOINC software", $user); diff --git a/html/user/account_setup_nonfirst.php b/html/user/account_setup_nonfirst.php index 7ceb964670..cc4e274f4c 100644 --- a/html/user/account_setup_nonfirst.php +++ b/html/user/account_setup_nonfirst.php @@ -4,14 +4,9 @@ include_once("db.inc"); include_once("util.inc"); include_once("prefs.inc"); -$authenticator = init_session(); db_init(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} +$user = get_logged_in_user(); page_head("Account setup: resource share", $user); echo "

Account setup

diff --git a/html/user/account_setup_nonfirst_action.php b/html/user/account_setup_nonfirst_action.php index 87513f3342..cd50485056 100644 --- a/html/user/account_setup_nonfirst_action.php +++ b/html/user/account_setup_nonfirst_action.php @@ -4,14 +4,9 @@ include_once("db.inc"); include_once("util.inc"); include_once("prefs.inc"); -$authenticator = init_session(); db_init(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} +$user = get_logged_in_user(); $prefs = prefs_parse_global($user->global_prefs); prefs_resource_parse_form($prefs); diff --git a/html/user/account_setup_nonfirst_done.php b/html/user/account_setup_nonfirst_done.php index 11e1e2e2ef..2e8b5a9c6a 100644 --- a/html/user/account_setup_nonfirst_done.php +++ b/html/user/account_setup_nonfirst_done.php @@ -4,14 +4,9 @@ include_once("db.inc"); include_once("util.inc"); include_once("prefs.inc"); -$authenticator = init_session(); db_init(); +$user = get_logged_in_user(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} page_head("Account setup: done", $user); echo "

Account setup: done

diff --git a/html/user/add_venue_action.php b/html/user/add_venue_action.php index 2da4b739c5..34976856e7 100644 --- a/html/user/add_venue_action.php +++ b/html/user/add_venue_action.php @@ -3,11 +3,9 @@ require_once("util.inc"); require_once("prefs.inc"); - $authenticator = init_session(); db_init(); - $user = get_user_from_auth($authenticator); - require_login($user); + $user = get_logged_in_user(); $venue = $_GET["venue"]; $subset = $_GET["subset"]; diff --git a/html/user/add_venue_form.php b/html/user/add_venue_form.php index d8c5f5c747..511f93b2a2 100644 --- a/html/user/add_venue_form.php +++ b/html/user/add_venue_form.php @@ -3,11 +3,9 @@ require_once("util.inc"); require_once("prefs.inc"); - $authenticator = init_session(); db_init(); - $user = get_user_from_auth($authenticator); - require_login($user); + $user = get_logged_in_user(); $venue = $_GET["venue"]; $subset = $_GET["subset"]; diff --git a/html/user/bug_report_action.php b/html/user/bug_report_action.php index fe52b78320..6902bb081d 100644 --- a/html/user/bug_report_action.php +++ b/html/user/bug_report_action.php @@ -3,34 +3,29 @@ include_once("db.inc"); include_once("util.inc"); -$authenticator = init_session(); -db_init(); + db_init(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} + $user = get_logged_in_user(); -$f = fopen("bug_reports.xml", "a"); -$x = sprintf(" - $user->id - %s - -%s - - -", - $_POST["platform"], - $_POST["problem"] -); -fputs($f, $x); -fclose($f); + $f = fopen("bug_reports.xml", "a"); + $x = sprintf(" + $user->id + %s + + %s + + + ", + $_POST["platform"], + $_POST["problem"] + ); + fputs($f, $x); + fclose($f); -page_head("Problem report recorded", $user); -echo " - Your problem report has been recorded. - We apologize for any inconvience you may have experienced. -"; -page_tail(); + page_head("Problem report recorded", $user); + echo " + Your problem report has been recorded. + We apologize for any inconvience you may have experienced. + "; + page_tail(); ?> diff --git a/html/user/bug_report_form.php b/html/user/bug_report_form.php index 1bc6b165c4..644e926675 100644 --- a/html/user/bug_report_form.php +++ b/html/user/bug_report_form.php @@ -18,32 +18,28 @@ function print_platform_select() { echo "\n"; } -$authenticator = init_session(); -db_init(); + db_init(); -$user = get_user_from_auth($authenticator); -if ($user == NULL) { - print_login_form(); - exit(); -} -page_head("Problem Report Form", $user); + $user = get_logged_in_user(); -echo " -

Problem Report Form

-
-"; -start_table(); -row2_init("Computer type", ""); -print_platform_select(); -echo" \n"; -row2("Problem description", - "" -); -row2("", - "" -); -end_table(); -echo"
"; -page_tail(); + page_head("Problem Report Form", $user); + + echo " +

Problem Report Form

+
+ "; + start_table(); + row2_init("Computer type", ""); + print_platform_select(); + echo" \n"; + row2("Problem description", + "" + ); + row2("", + "" + ); + end_table(); + echo"
"; + page_tail(); ?> diff --git a/html/user/create_account_action.php b/html/user/create_account_action.php index da9dbdca8a..f3350ba1ab 100644 --- a/html/user/create_account_action.php +++ b/html/user/create_account_action.php @@ -11,7 +11,7 @@ function show_error($str) { exit(); } - $authenticator = init_session(); + init_session(); db_init(); $new_name = $HTTP_POST_VARS["new_name"]; diff --git a/html/user/download.php b/html/user/download.php index ed4d56c66f..0862257c0d 100644 --- a/html/user/download.php +++ b/html/user/download.php @@ -4,7 +4,7 @@ require_once("db.inc"); require_once("util.inc"); require_once("download.inc"); - $authenticator = init_session(); + init_session(); db_init(); page_head("Download BOINC software"); diff --git a/html/user/edit_email_action.php b/html/user/edit_email_action.php index a848205837..6e3d35fb6c 100644 --- a/html/user/edit_email_action.php +++ b/html/user/edit_email_action.php @@ -15,10 +15,8 @@ To confirm this change, please visit the following URL: ); } - $authenticator = init_session(); db_init(); - $user = get_user_from_auth($authenticator); - require_login($user); + $user = get_logged_in_user(); $email_addr = $HTTP_POST_VARS["email_addr"]; diff --git a/html/user/edit_email_form.php b/html/user/edit_email_form.php index 2e627a05ce..bd3cb3f7a7 100644 --- a/html/user/edit_email_form.php +++ b/html/user/edit_email_form.php @@ -1,12 +1,9 @@ "; start_table(); diff --git a/html/user/get_passwd.php b/html/user/get_passwd.php index f0656c2a51..69a31f1f6b 100644 --- a/html/user/get_passwd.php +++ b/html/user/get_passwd.php @@ -4,19 +4,17 @@ require_once("util.inc"); require_once("user.inc"); page_head("Account key"); -echo "

Get your ".PROJECT." account key

-

-
-
-
- Email address: - -
-
-

- Your account key will be emailed to this address. - You should receive it in a few minutes.

"; + + echo "

\n"; + start_table(); + row1("Get your ".PROJECT." account key"); + row2("Email address",""); + echo "
+ Your account key will be emailed to you. + You should receive it in a few minutes.

+ "; page_tail(); diff --git a/html/user/home.php b/html/user/home.php index 91bdcdc30b..488f5655b8 100644 --- a/html/user/home.php +++ b/html/user/home.php @@ -5,15 +5,9 @@ // show the home page of whoever's logged in - $authenticator = init_session(); - db_init(); - $user = get_user_from_auth($authenticator); - if ($user) { - page_head("User page", $user); - show_user_page_private($user); - page_tail(); - } else { - print_login_form(); - } + $user = get_logged_in_user(); + page_head("User page", $user); + show_user_page_private($user); + page_tail(); ?> diff --git a/html/user/host.inc b/html/user/host.inc index c41f7f1a0d..9cb1fcbe87 100644 --- a/html/user/host.inc +++ b/html/user/host.inc @@ -26,6 +26,9 @@ function show_host($host, $private) { $x = $host->timezone/3600; row2("Time zone", "UTC - $x hours"); } + if ($private) { + row2("Name", $host->domain_name); + } row2("Created", time_str($host->create_time)); row2("Total Credit", $host->total_credit); row2("Recent average credit", $host->expavg_credit); @@ -85,12 +88,18 @@ function show_host($host, $private) { } -function host_table_start($title) { +function host_table_start($title, $private) { start_table(); row1($title, 6); echo " Rank
Click for more info - Owner + "; + if ($private) { + echo "Name\n"; + } else { + echo "Owner\n"; + } + echo " Total credit Recent average credit CPU type @@ -99,13 +108,19 @@ function host_table_start($title) { "; } -function show_host_row($host, $i) { +function show_host_row($host, $i, $private) { $result = mysql_query("select * from user where id = $host->userid"); $user = mysql_fetch_object($result); mysql_free_result($result); echo " id>$i - id>$user->name + "; + if ($private) { + echo"$host->domain_name"; + } else { + echo"id>$user->name"; + } + echo" $host->total_credit $host->expavg_credit $host->p_vendor $host->p_model diff --git a/html/user/host_venue_action.php b/html/user/host_venue_action.php index e1651ebe64..be81ac3821 100644 --- a/html/user/host_venue_action.php +++ b/html/user/host_venue_action.php @@ -2,11 +2,9 @@ require_once("db.inc"); require_once("util.inc"); - $authenticator = init_session(); db_init(); - $user = get_user_from_auth($authenticator); - require_login($user); + $user = get_logged_in_user(); $venue = $_GET["venue"]; $hostid = $_GET["hostid"]; diff --git a/html/user/hosts_user.php b/html/user/hosts_user.php index 2900fa3072..2c46a34e28 100644 --- a/html/user/hosts_user.php +++ b/html/user/hosts_user.php @@ -1,19 +1,30 @@ name"); + if ($userid) { + $result = mysql_query("select * from user where id=$userid"); + $user = mysql_fetch_object($result); + mysql_free_result($result); + page_head("Computers belonging to $user->name"); + host_table_start("Computers belonging to $user->name", false); + $private = false; + } else { + $user = get_logged_in_user(); + $userid = $user->id; + page_head("Your computers"); + host_table_start("Your computers", true); + $private = true; + } $i = 1; - $result = mysql_query("select * from host where userid=$userid order by expavg_credit desc limit $max_hosts_display"); - while (($host = mysql_fetch_object($result)) && $max_hosts_display > 0) { - show_host_row($host, $i); - $max_hosts_display--; + $result = mysql_query("select * from host where userid=$userid order by expavg_credit desc"); + while ($host = mysql_fetch_object($result)) { + show_host_row($host, $i, $private); $i++; } mysql_free_result($result); diff --git a/html/user/index.php b/html/user/index.php index 1b3283bece..45acf5f23e 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -26,7 +26,7 @@

Leader boards