diff --git a/checkin_notes b/checkin_notes index e65c83a655..51db3ca821 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12139,6 +12139,16 @@ Rom May 6 2004 index.php pass_percentage_by_platform.php +David May 9 2004 + html/ + inc/ + gallery.inc + uotd.inc (new) + user/ + index.php + team.php + team_lookup.php + David May 10 2004 - extend the set of signals that are treated as "external", i.e. if an app exits with one of these, put it in limbo @@ -12166,3 +12176,9 @@ David May 11 2004 zip/ * + +David May 11 2004 + - remove "user" argument from page_head() + + html/ + * diff --git a/html/forum/edit.php b/html/forum/edit.php index 652928ce73..8046afe074 100644 --- a/html/forum/edit.php +++ b/html/forum/edit.php @@ -30,7 +30,7 @@ if ($_POST['submit']) { } -page_head('Forum', $logged_in_user); +page_head('Forum'); if (!empty($_GET['id'])) { $post = getPost($_GET['id']); diff --git a/html/forum/index.php b/html/forum/index.php index c1cbac01a3..bbe71c4234 100644 --- a/html/forum/index.php +++ b/html/forum/index.php @@ -4,7 +4,7 @@ require_once('../inc/forum.inc'); require_once('../inc/util.inc'); require_once('../inc/time.inc'); -page_head('Message boards', NULL, NULL); +page_head('Message boards'); show_forum_title(NULL, NULL, false); diff --git a/html/forum/post.php b/html/forum/post.php index 58fa1bc3f8..206a6699b3 100644 --- a/html/forum/post.php +++ b/html/forum/post.php @@ -30,9 +30,9 @@ $logged_in_user = get_logged_in_user(true); // TODO: Write a function to do this. if ($category->is_helpdesk) { - page_head('Help Desk', $logged_in_user); + page_head('Help Desk'); } else { - page_head('Forum', $logged_in_user); + page_head('Forum'); } show_forum_title($forum, NULL, $category->is_helpdesk); @@ -66,39 +66,32 @@ if ($category->is_helpdesk) { } start_forum_table(array($cell), 2); -echo "Title"; +$x = "Title". + "
May contain HTML tags"; if ($category->is_helpdesk) { - echo "

+ $x .="
Describe your question in a few words. A brief, clear summary will help others with the same question (or an answer) find it. -

"; } -echo " - - - - - Message -"; +$y = ""; +row2($x, $y); +$x = "Message". + "
May contain HTML tags"; if ($category->is_helpdesk) { - echo "

- If you are having software problems, + $x .= " If you are having software problems, mention the version number of the software, your computer type and operating system. - "; } -echo " - - -"; +$y = ""; +row2($x, $y); row2("", "Add my signature to this post"); row2("", ""); diff --git a/html/forum/rate.php b/html/forum/rate.php index 599f7d5d0a..d5f05e3e35 100644 --- a/html/forum/rate.php +++ b/html/forum/rate.php @@ -56,17 +56,17 @@ function show_result_page($success, $post, $choice) { if ($success) { if ($choice) { - page_head('Input Recorded', $logged_in_user); + page_head('Input Recorded'); echo "Helpdesk Input Recorded"; echo "

Your input has been successfully recorded. Thank you for your help.

"; } else { - page_head('Vote Registered', $logged_in_user); + page_head('Vote Registered'); echo "Vote Registered"; echo "

Your rating has been successfully recorded. Thank you for your input.

"; } echo "thread, "#", $post->id, "\">Return to thread"; } else { - page_head('Vote Submission Problem', $logged_in_user); + page_head('Vote Submission Problem'); echo "Vote submission failed"; if ($post) { echo "

There was a problem recording your vote in our database. Please try again later.

"; diff --git a/html/forum/reply.php b/html/forum/reply.php index f1cca73c88..e80c520c2e 100644 --- a/html/forum/reply.php +++ b/html/forum/reply.php @@ -44,9 +44,9 @@ $helpdesk = $category->is_helpdesk; // TODO: Write a function for this. if ($helpdesk) { - page_head('Questions and problems', $logged_in_user); + page_head('Questions and problems'); } else { - page_head('Message boards', $logged_in_user); + page_head('Message boards'); } show_forum_title($forum, $thread, $helpdesk); diff --git a/html/forum/thread.php b/html/forum/thread.php index 9d23bc3ae3..b0994c1e38 100644 --- a/html/forum/thread.php +++ b/html/forum/thread.php @@ -34,9 +34,9 @@ if (!$sort_style) { } if ($category->is_helpdesk) { - page_head(PROJECT.': Questions and problems', $logged_in_user); + page_head(PROJECT.': Questions and problems'); } else { - page_head(PROJECT.': Message boards', $logged_in_user); + page_head(PROJECT.': Message boards'); } // TODO: Constant for default sort style and filter values. diff --git a/html/inc/gallery.inc b/html/inc/gallery.inc index b218afda3a..be52abdba4 100644 --- a/html/inc/gallery.inc +++ b/html/inc/gallery.inc @@ -3,6 +3,7 @@ require_once("../project/project.inc"); require_once("../inc/profile.inc"); require_once("../inc/util.inc"); +require_once("../inc/uotd.inc"); $alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9'); @@ -57,7 +58,7 @@ function build_picture_pages($width, $height) { $file = PROFILE_PATH . "user_gallery_" . $page . ".html"; $descriptor = fopen($file, "w"); - page_head("User Picture Gallery: Page $page of $numPages", null, $descriptor, false); + page_head("User Picture Gallery: Page $page of $numPages", $descriptor); fwrite($descriptor, "

User Profile Pictures

Last updated " @@ -229,7 +230,7 @@ function build_profile_pages($members, $pageHead, $pageTitle, $rowsPerPage, $col $descriptor = fopen($filename, "w"); $head = $pageHead . ": Page $page of $numPages"; - page_head($pageHead, null, $descriptor, false); + page_head($pageHead, $descriptor); fwrite($descriptor, "

$pageTitle

\n"); fwrite($descriptor, "Last updated " . pretty_time_str(time()) . "

\n"); @@ -252,7 +253,7 @@ function build_country_summary_page($countryMembers) { $filename = PROFILE_PATH . "profile_country.html"; $descriptor = fopen($filename, "w"); - page_head("User Profiles by Country", null, $descriptor, false); + page_head("User Profiles by Country", $descriptor); fwrite($descriptor, "

User Profiles by Country

Last updated " . pretty_time_str(time()) . "

"); fwrite($descriptor, "\n"); @@ -296,87 +297,4 @@ function build_alpha_summary_page($characters) { fclose($descriptor); } -function uotd_thumbnail($profile, $user) { - return "id>"; -} - -function generate_uotd_page($profile, $user) { - $filename = PROFILE_PATH."uotd.html"; - $descriptor = fopen($filename, "w"); - - if ($profile->has_picture) { - fwrite($descriptor, uotd_thumbnail($profile, $user)); - } - $x = user_links($user); - fwrite($descriptor, "The " . PROJECT . " User of the Day is $x"); - fclose($descriptor); -} - -// return the last UOTD profile, or null -// -function get_current_uotd() { - $result = mysql_query("SELECT * FROM profile ORDER BY uotd_time DESC LIMIT 1"); - if (mysql_num_rows($result) > 0) { - $p = mysql_fetch_object($result); - } else { - $p = null; - } - return mysql_free_result($result); - return $p; -} - -// see if it's time to pick a new UOTD. -// Either way, generate the UOTD page -// -function build_uotd_page() { - $current_utod = get_current_uotd(); - if ($current_utod) { - $assigned = getdate($current_uotd->uotd_time); - $now = getdate(time()); - if ($assigned['mday'] == $now['mday']) { - $user = lookup_user_id($current_uotd->userid); - generate_uotd_page($current_uotd, $user); - exit(); - } - } - // TODO: Verify that adding RAND() didn't screw this up. - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 AND uotd_time IS NULL ORDER BY RAND()"); - - // If the number of approved profiles dips below a threshold, - // email the sys admin every time we pick a new one. - // - if ($result && mysql_num_rows($result) < UOTD_THRESHOLD) { - mail(SYS_ADMIN_EMAIL, - PROJECT . ": User of the Day pool is running low!", - "The pool of approved candidates for User of the Day has - reached your assigned threshold: there are now only " . mysql_num_rows($result) . " approved users.\n\n - To approve more candidates for User of the Day, - direct your web browser to the " . PROJECT . " administration page and click \"Unrated profile\"" - ); - } - - if ($result && mysql_num_rows($result) == 0) { - // If all verified profiles have been selected as UOTD, reshow the one that was shown least recently. - $result = mysql_query("SELECT * FROM profile WHERE verification = 1 ORDER BY uotd_time ASC LIMIT 1"); - } - - if (!$result || mysql_num_rows($result) == 0) { - // No valid users of the day - do something. - exit(); - } - $profile = mysql_fetch_object($result); - $user = lookup_user_id($profile->userid); - generate_uotd_page($profile, $user); - - $sql = "UPDATE profile SET uotd_time = " . time() . " WHERE userid=$user->id"; - mysql_query($sql); - - mail($user->email_addr, - "You're the " . PROJECT . " user of the day!", - "Congratulations!\n\nYou've been chosen as the " - . PROJECT . " user of the day! - Your profile will be featured on the " . PROJECT . " website for the next 24 hours." - ); -} - ?> diff --git a/html/inc/uotd.inc b/html/inc/uotd.inc new file mode 100644 index 0000000000..dcdf89dc55 --- /dev/null +++ b/html/inc/uotd.inc @@ -0,0 +1,85 @@ +id>"; +} + +function generate_uotd_page($profile, $user) { + $filename = PROFILE_PATH."uotd.html"; + $descriptor = fopen($filename, "w"); + + if ($profile->has_picture) { + fwrite($descriptor, uotd_thumbnail($profile, $user)); + } + $x = user_links($user); + fwrite($descriptor, "The " . PROJECT . " User of the Day is $x"); + fclose($descriptor); +} + +// return the last UOTD profile, or null +// +function get_current_uotd() { + $result = mysql_query("SELECT * FROM profile ORDER BY uotd_time DESC LIMIT 1"); + $p = null; + if (mysql_num_rows($result) > 0) { + $p = mysql_fetch_object($result); + } + mysql_free_result($result); + return $p; +} + +// see if it's time to pick a new UOTD. +// Either way, generate the UOTD page +// +function build_uotd_page() { + $current_uotd = get_current_uotd(); + if ($current_uotd) { + $assigned = getdate($current_uotd->uotd_time); + $now = getdate(time()); + if ($assigned['mday'] == $now['mday']) { + $user = lookup_user_id($current_uotd->userid); + generate_uotd_page($current_uotd, $user); + exit(); + } + } + // TODO: Verify that adding RAND() didn't screw this up. + $result = mysql_query("SELECT * FROM profile WHERE verification = 1 AND uotd_time IS NULL ORDER BY RAND()"); + + // If the number of approved profiles dips below a threshold, + // email the sys admin every time we pick a new one. + // + if ($result && mysql_num_rows($result) < UOTD_THRESHOLD) { + mail(SYS_ADMIN_EMAIL, + PROJECT . ": User of the Day pool is running low!", + "The pool of approved candidates for User of the Day has". + "reached your assigned threshold: there are now only " . mysql_num_rows($result) . " approved users.\n\n". + "To approve more candidates for User of the Day,". + "go to the " . PROJECT . " administration page and click \"Unrated profile\"" + ); + } + + if ($result && mysql_num_rows($result) == 0) { + // If all verified profiles have been selected as UOTD, reshow the one that was shown least recently. + $result = mysql_query("SELECT * FROM profile WHERE verification = 1 ORDER BY uotd_time ASC LIMIT 1"); + } + + if (!$result || mysql_num_rows($result) == 0) { + // No valid users of the day - do something. + exit(); + } + $profile = mysql_fetch_object($result); + $user = lookup_user_id($profile->userid); + generate_uotd_page($profile, $user); + + $sql = "UPDATE profile SET uotd_time = " . time() . " WHERE userid=$user->id"; + mysql_query($sql); + + mail($user->email_addr, + "You're the " . PROJECT . " user of the day!", + "Congratulations!\n\nYou've been chosen as the " + . PROJECT . " user of the day! + Your profile will be featured on the " . PROJECT . " website for the next 24 hours." + ); +} + +?> diff --git a/html/inc/util.inc b/html/inc/util.inc index 3f815dc4ef..bd337413ca 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -122,7 +122,7 @@ function write_fd($fd, $str) { } } -function page_head($title, $user=null, $fd=null) { +function page_head($title, $fd=null) { $styleSheet = URL_BASE . STYLESHEET; write_fd($fd, @@ -132,7 +132,7 @@ function page_head($title, $user=null, $fd=null) { " ); - project_banner($user, $fd); + project_banner($fd); } function page_tail($is_main=false, $fd=null) { diff --git a/html/user/account_setup.php b/html/user/account_setup.php index def8fe5902..854dfd2662 100644 --- a/html/user/account_setup.php +++ b/html/user/account_setup.php @@ -6,7 +6,7 @@ $user = get_logged_in_user(); - page_head("Account setup", $user); + page_head("Account setup"); echo "

Account setup

".PROJECT." uses the BOINC software system. diff --git a/html/user/account_setup_first.php b/html/user/account_setup_first.php index 645b99662d..d6c6dd9fb0 100644 --- a/html/user/account_setup_first.php +++ b/html/user/account_setup_first.php @@ -13,7 +13,7 @@ if ($user == NULL) { exit(); } -page_head("Account setup", $user); +page_head("Account setup"); echo "

Account setup

Thank you for letting ".PROJECT." use part of your computer power. diff --git a/html/user/account_setup_first_download.php b/html/user/account_setup_first_download.php index 776c541397..89c9cc4f7f 100644 --- a/html/user/account_setup_first_download.php +++ b/html/user/account_setup_first_download.php @@ -7,7 +7,7 @@ require_once("../inc/download.inc"); db_init(); $user = get_logged_in_user(); -page_head("Download BOINC software", $user); +page_head("Download BOINC software"); echo " Your account setup is complete. diff --git a/html/user/account_setup_nonfirst.php b/html/user/account_setup_nonfirst.php index e9eada20cb..5e6d0578e5 100644 --- a/html/user/account_setup_nonfirst.php +++ b/html/user/account_setup_nonfirst.php @@ -7,7 +7,7 @@ include_once("../inc/prefs.inc"); db_init(); $user = get_logged_in_user(); -page_head("Account setup: resource share", $user); +page_head("Account setup: resource share"); echo "

Account setup

"; diff --git a/html/user/account_setup_nonfirst_done.php b/html/user/account_setup_nonfirst_done.php index 8b459e8251..bea6d5b059 100644 --- a/html/user/account_setup_nonfirst_done.php +++ b/html/user/account_setup_nonfirst_done.php @@ -7,7 +7,7 @@ include_once("../inc/prefs.inc"); db_init(); $user = get_logged_in_user(); -page_head("Account setup: done", $user); +page_head("Account setup: done"); echo "

Account setup: done

diff --git a/html/user/bug_report_action.php b/html/user/bug_report_action.php index e9c727ea63..f79e908694 100644 --- a/html/user/bug_report_action.php +++ b/html/user/bug_report_action.php @@ -22,7 +22,7 @@ include_once("../inc/util.inc"); fputs($f, $x); fclose($f); - page_head("Problem report recorded", $user); + page_head("Problem report recorded"); echo " Your problem report has been recorded. We apologize for any inconvience you may have experienced. diff --git a/html/user/bug_report_form.php b/html/user/bug_report_form.php index 326d7029de..fbe10cfa10 100644 --- a/html/user/bug_report_form.php +++ b/html/user/bug_report_form.php @@ -22,7 +22,7 @@ function print_platform_select() { $user = get_logged_in_user(); - page_head("Problem Report Form", $user); + page_head("Problem Report Form"); echo "

Problem Report Form

diff --git a/html/user/create_account_form.php b/html/user/create_account_form.php index 57a6719b65..eea4dc209e 100644 --- a/html/user/create_account_form.php +++ b/html/user/create_account_form.php @@ -19,7 +19,7 @@ if (parse_config("")) { } $userid = $_GET['userid']; echo " -

Create an Account with ".PROJECT."

+

Create an account with ".PROJECT."

Read the Rules and Policies before creating an account.

@@ -34,47 +34,31 @@ if ($userid) { "; } -echo " -
- - - - - - - - - - - - - - \n"; +row2( + "Postal or ZIP Code
Optional.", + "" +); +row2("", + "" +); +end_table(); echo " - - - - - - - -
Create Account
- Name -
Identifies you on our web site. Use your real name or a nickname. -
- Email Address -
Must be a valid address of the form 'name@domain'. -
- Country -
Select the country you want to represent, if any. -
- " +); +row2( + "Email Address
Must be a valid address of the form 'name@domain'.", + "" +); +row2_init( + "Country
Select the country you want to represent, if any.", + "
- Postal or ZIP Code -
Optional. -
-

"; diff --git a/html/user/edit_user_info_form.php b/html/user/edit_user_info_form.php index 0c687a093d..d5712bc06b 100644 --- a/html/user/edit_user_info_form.php +++ b/html/user/edit_user_info_form.php @@ -7,15 +7,15 @@ require_once("../inc/countries.inc"); db_init(); $user = get_logged_in_user(); -page_head("Edit user information", $user); +page_head("Edit user information"); echo "
"; start_table(); row1("Edit account info"); -row2("Name", +row2("Name
real name or nickname", "" ); -row2("URL", +row2("URL
of your web page; optional", "http://" ); row2_init("Country", @@ -23,12 +23,16 @@ row2_init("Country", ); print_country_select($user->country); echo "\n"; -row2("Postal (ZIP) code", +row2("Postal (ZIP) code
Optional", "" ); $x = ""; -row2("Signature for message boards", $x); +row2("Signature for message boards". + "
May contain HTML tags". + "
Optional", + $x +); row2("", ""); end_table(); echo "
\n"; diff --git a/html/user/home.php b/html/user/home.php index 0d88974ffd..8fdf55c0d3 100644 --- a/html/user/home.php +++ b/html/user/home.php @@ -7,7 +7,7 @@ db_init(); $user = get_logged_in_user(); - page_head("User page", $user); + page_head("User page"); show_user_page_private($user); page_tail(); ?> diff --git a/html/user/host_edit_form.php b/html/user/host_edit_form.php index 0bf16f9c91..e04f35be64 100644 --- a/html/user/host_edit_form.php +++ b/html/user/host_edit_form.php @@ -7,7 +7,7 @@ require_once("../inc/host.inc"); db_init(); $user = get_logged_in_user(); -page_head("Merge host", $user); +page_head("Merge host"); $hostid = $_GET["hostid"]; $result = mysql_query("select * from host where id=$hostid"); diff --git a/html/user/index.php b/html/user/index.php index 08c2d89d9e..f68f3a2677 100644 --- a/html/user/index.php +++ b/html/user/index.php @@ -5,10 +5,6 @@ // don't want to use DB here, because master page won't be visible // if DB is down - // - //db_init(); - //$user = get_logged_in_user(false); - //page_head("Home page", $user); page_head(PROJECT); @@ -37,7 +33,7 @@ if (project_is_stopped()) {

Returning participants

-

+ Search for a team whose name contains: diff --git a/html/user/team_lookup.php b/html/user/team_lookup.php index d21e7567cc..4d1ca69030 100644 --- a/html/user/team_lookup.php +++ b/html/user/team_lookup.php @@ -7,7 +7,7 @@ db_init(); init_session(); - $team_name = $_POST["team_name"]; + $team_name = $_GET["team_name"]; $words = preg_split("/[\s,]+/", $team_name); $length = count($words); $name_lc = strtolower($team_name); diff --git a/html/user/team_remove_inactive_action.php b/html/user/team_remove_inactive_action.php index 1ad0836c38..f0c28b8cdb 100644 --- a/html/user/team_remove_inactive_action.php +++ b/html/user/team_remove_inactive_action.php @@ -18,7 +18,7 @@ } require_founder_login($user, $team); - page_head("Removing users from $team->name", $user); + page_head("Removing users from $team->name"); $nmembers = 0; for ($i=0; $i<$_POST["ninactive_users"]; $i++) { if ($_POST["remove_$i"] != 0) { diff --git a/html/user/top_hosts.php b/html/user/top_hosts.php index 24db6195e6..a8432ce502 100644 --- a/html/user/top_hosts.php +++ b/html/user/top_hosts.php @@ -19,7 +19,7 @@ $n = 10; db_init(); - page_head("Top computers", null, null, false); + page_head("Top computers"); if ($sort_by == "total_credit") { $sort_clause = "total_credit desc, total_credit desc"; } else { diff --git a/html/user/top_users.php b/html/user/top_users.php index 4c37269a43..9415860abc 100644 --- a/html/user/top_users.php +++ b/html/user/top_users.php @@ -17,7 +17,7 @@ db_init(); $numusers = 100; - page_head("Top $numusers users", null, null, false); + page_head("Top $numusers users"); $result = mysql_query("select * from user order by $sort_order limit $numusers"); row1("Users", 6); user_table_start();