From 385f605cb024186394067f1af64a82e654c45651 Mon Sep 17 00:00:00 2001 From: Daniel Hsu Date: Mon, 14 Jun 2004 20:20:06 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3570 --- checkin_notes | 13 +++++++++++++ html/inc/subscribe.inc | 8 ++++---- html/inc/util.inc | 10 ---------- html/ops/migrate_tables.php | 26 +++++++++++++------------- html/ops/profile_ops.php | 16 ++++++++-------- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/checkin_notes b/checkin_notes index 07f4369070..7b4cafa289 100755 --- a/checkin_notes +++ b/checkin_notes @@ -13508,3 +13508,16 @@ David 14 June 2004 edit_email_action.php login_action.php mail_passwd.php + +Daniel 14 June 2004 + - changed uses of mysql_fetch_assoc() to mysql_fetch_object() + - removed utility function get_profile_from_userid() (not used + anywhere) + + html/inc/ + subscribe.inc + util.inc + html/ops/ + migrate_tables.php + profile_ops.php + diff --git a/html/inc/subscribe.inc b/html/inc/subscribe.inc index dc71b4c668..d84f4ba145 100644 --- a/html/inc/subscribe.inc +++ b/html/inc/subscribe.inc @@ -71,8 +71,8 @@ function notify_subscribers($threadID) { $sql = "SELECT DISTINCT * FROM subscriptions WHERE threadid = " . $threadID; $result = mysql_query($sql); - while ($row = mysql_fetch_assoc($result)) { - send_notice_email($row['userid'], $threadID); + while ($row = mysql_fetch_object($result)) { + send_notice_email($row->userid, $threadID); } } @@ -81,14 +81,14 @@ function send_notice_email($userId, $threadID) { $thread = getThread($threadID); $result = mysql_query("SELECT * FROM user WHERE id = $userId"); - $row = mysql_fetch_assoc($result); + $row = mysql_fetch_object($result); $title = PROJECT . ": A user has posted to your subscribed thread."; $link = URL_BASE . "forum_thread.php?id=" . $threadID; $body = "Another " . PROJECT . " user has posted to the thread \"" . stripslashes($thread->title) . "\".\n" ."To view the updated thread, visit the following URL:\n\n$link"; - mail($row['email_addr'], $title, $body); + mail($row->email_addr, $title, $body); } ?> diff --git a/html/inc/util.inc b/html/inc/util.inc index dfc4660eab..5ab0c9f4ad 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -55,16 +55,6 @@ function get_user_from_id($id) { return NULL; } -function get_profile_from_userid($userid) { - if ($userid) { - $result = mysql_query("SELECT * FROM profile WHERE userid = $userid"); - if ($result) { - return mysql_fetch_assoc($result); - } - } - return null; -} - function get_logged_in_user($must_be_logged_in=true) { $authenticator = init_session(); if (!$authenticator) { diff --git a/html/ops/migrate_tables.php b/html/ops/migrate_tables.php index 0ecf49eb08..695afa438b 100755 --- a/html/ops/migrate_tables.php +++ b/html/ops/migrate_tables.php @@ -102,13 +102,13 @@ function migrate_tables() { if ($feedback_field_map[$i] == 'userid') { $result = mysql_query("SELECT * FROM user WHERE seti_id = " . $feedback_data[$i]); if ($result) { - $row = mysql_fetch_assoc($result); + $row = mysql_fetch_object($result); } else { print "DB error.\n"; exit(); } - $feedback_data[$i] = $row['id']; - $new_userid = $row['id']; + $feedback_data[$i] = $row->id; + $new_userid = $row->id; } else if ($feedback_field_map[$i] == 'has_picture') { // Because the userid field comes before the picture @@ -158,13 +158,13 @@ function migrate_tables() { $result = mysql_query("SELECT * FROM user WHERE seti_id = " . $team_data[$i]); if ($result) { - $row = mysql_fetch_assoc($result); + $row = mysql_fetch_object($result); } else { print "DB error.\n"; exit(); } - $team_data[$i] = $row['id']; + $team_data[$i] = $row->id; } print $team_field_map[$i] . ": " . addslashes(clean_newlines(trim($team_data[$i]))) . "\n"; @@ -188,18 +188,18 @@ function migrate_tables() { $result = mysql_query("SELECT * FROM user WHERE seti_id IS NOT NULL"); - while ($user = mysql_fetch_assoc($result)) { + while ($user = mysql_fetch_object($result)) { // Relink team ID. - if (!is_null($user['teamid'])) { - $result2 = mysql_query("SELECT * FROM team WHERE seti_id = " . $user['teamid']); - $team = mysql_fetch_assoc($result2); - $result2 = mysql_query("UPDATE user SET teamid = " . $team['id'] . " WHERE id = " . $user['id']); + if (!is_null($user->teamid)) { + $result2 = mysql_query("SELECT * FROM team WHERE seti_id = " . $user->teamid); + $team = mysql_fetch_object($result2); + $result2 = mysql_query("UPDATE user SET teamid = " . $team->id . " WHERE id = " . $user->id); } // Send out email. - split_munged_email_addr($user['email_addr'], $user['authenticator'], $address); + split_munged_email_addr($user->email_addr, $user->authenticator, $address); - $body = "Your SETI@Home account has been transferred to BOINC. Your authenticator is\n\n" . $user['authenticator']; + $body = "Your SETI@Home account has been transferred to BOINC. Your authenticator is\n\n" . $user->authenticator; //mail($address, "Your SETI@Home BOINC account is ready!", $body); } @@ -324,4 +324,4 @@ function move_user_pic($img_name, $userid) { } print "Image $filename does not exist!\n"; return false; -} \ No newline at end of file +} diff --git a/html/ops/profile_ops.php b/html/ops/profile_ops.php index 415a9e3a59..f0d33a07ab 100644 --- a/html/ops/profile_ops.php +++ b/html/ops/profile_ops.php @@ -38,7 +38,7 @@ if (array_key_exists('num', $_GET) && array_key_exists('set', $_GET)) { if (!$result) { // TODO: DB error page; } else { - $profile = mysql_fetch_assoc($result); + $profile = mysql_fetch_object($result); if (!$profile) { echo $sql; echo "
No more profiles in this category.

Return to ", PROJECT, " Project Management"; @@ -57,7 +57,7 @@ if (array_key_exists('num', $_GET) && array_key_exists('set', $_GET)) { } if ($vote == -1 || $vote == 1) { - $sql = "UPDATE profile SET verification = $vote WHERE userid = " . $profile['userid']; + $sql = "UPDATE profile SET verification = $vote WHERE userid = " . $profile->userid; mysql_query($sql); } $header = "Location: profile_ops.php?set=" . $set . "&num=" . ($num+1); @@ -70,7 +70,7 @@ if (array_key_exists('num', $_GET) && array_key_exists('set', $_GET)) { // Put the profile itself into a table to separate it visually from the controls. echo "

"; - show_profile($profile['userid'], true); + show_profile($profile->userid, true); echo "
"; echo "

Return to ", PROJECT, " Project Management

"; @@ -104,18 +104,18 @@ function show_verify_tools($num, $profile) { echo " - \n\n\n
User ID: ", $profile['userid'], "
+
User ID: ", $profile->userid, "
Last selected UOTD: "; - if ($profile['uotd_time']) { - echo date("F jS, Y", $profile['uotd_time']); + if ($profile->uotd_time) { + echo date("F jS, Y", $profile->uotd_time); } else { echo "Never"; } - echo "
", $profile['recommend'], " recommendation(s), ", $profile['reject'], " rejection(s).
"; + echo "
", $profile->recommend, " recommendation(s), ", $profile->reject, " rejection(s).
"; - echo "Current status: ", $verification[$profile['verification']]; + echo "Current status: ", $verification[$profile->verification]; echo"