*** empty log message ***

svn path=/trunk/boinc/; revision=11175
This commit is contained in:
David Anderson 2006-09-19 12:57:57 +00:00
parent c56cb7e9bf
commit efa7b7a3ad
7 changed files with 46 additions and 404 deletions

View File

@ -10304,6 +10304,12 @@ Walt 18 Sept 2006
clientgui/
BOINCDialupManager.cpp
David 18 Sept 2006
- core client: bug in config file error message printfs
client/
log_flags.C
Eric K 18 Sept 2006
- Fixed stack corruption that occurs if stderr contains a c format
code. Bug reported by Nicolas Alvarez.
@ -10325,3 +10331,19 @@ Charlie 19 Sept 2006
mac_build/
boinc.xcodeproj/
project.pbxproj
David 19 Sept 2006
- update account-created email
- user web: use $_POST instead of $_HTTP_POST_VARS.
The latter doesn't work in PHP 5
(from Christian Beer)
html/
inc/
email.inc
ops/
make_fake_tables.php (removed)
migrate_tables.php (removed)
mungetest.php (removed)
user/
edit_forum_preferences_action.php

View File

@ -19,7 +19,8 @@ An icon for BOINC-related Podcasts, from Christian Beer:
<img align=top src=images/Logo_blau.jpg>
</ul>
<p>
The 'B in a circle' icon was designed by Tim Lan.
The 'B in a circle' icon
<img src=logo/setup.PNG>was designed by Tim Lan.
The Mac variant was contributed by Juho Viitasalo.
<h2>New BOINC logo?</h2>

View File

@ -79,25 +79,27 @@ function send_auth_email($user, $is_new) {
This email confirms your account with ".PROJECT.":
Project URL: $master_url
Account Key: $user->authenticator
User name: $user->name
E-mail: $user->email_addr
Account Key: $user->authenticator
(use this to log in if you forget your password)
";
} else {
$subject = PROJECT." information for $user->name";
$body = "Your ".PROJECT." account information is:
Project URL: $master_url
Account Key: $user->authenticator
Project URL: $master_url
User name: $user->name
E-mail: $user->email_addr
Account Key: $user->authenticator
(use this to log in if you forget your password)
";
}
$body .= "
For further information and assistance with ".PROJECT." go to $master_url
For further information and assistance with ".PROJECT." go to
$master_url
";
return send_email($user, $subject, $body);
}

View File

@ -1,41 +0,0 @@
#!/usr/local/bin/php
<?php
define('NUM_USERS', 200);
define('NUM_TEAMS', 24);
define('BASE_UID', 1000001);
define('BASE_TID', 300);
// Users
$fd = fopen("test_user_flat", "w");
for ($i = 0; $i < NUM_USERS; $i++) {
$line = "" . (BASE_UID + $i)."|"."1234"."|"."user$i@$i.com|Johhny #$i|0|".(2451405.039016203+$i)."|2|3|4|5|6|7|1|United States|".(94704 + $i)."|1|2|3|".(BASE_TID + ($i%NUM_TEAMS))."|password|www.jb.org|0|0|\n";
fwrite($fd, $line);
shell_exec("cp 1000001.jpg ".(BASE_UID+$i).".jpg");
shell_exec("cp 1000001.jpg sm_".(BASE_UID+$i).".jpg");
}
fclose($fd);
// Every other user will have a profile.
$fd = fopen("test_feedback_flat", "w");
for ($i = 0; $i < (NUM_USERS / 2); $i++) {
$line = "".$i."|".(BASE_UID + ($i*2))."|0|0.00|0.00|JBK||||||||".(BASE_UID + $i*2).".jpg|Hello, I'm user ID# ".(BASE_UID + $i*2)."|I have no opinions|1|1|1|1|something|\n";
fwrite($fd, $line);
}
fclose($fd);
// Teams
$fd = fopen("test_teams_flat", "w");
for ($i = 0; $i < NUM_TEAMS ; $i++) {
$line = "".(BASE_TID + ($i%NUM_TEAMS))."|".(BASE_UID + $i)."|Team #$i|Name LC|A test team.|jb$i.teams.org|12|23|12345.11|".($i*10)."|1|<h1> Team $i! </h1>|\n";
fwrite($fd, $line);
}
fclose($fd);
?>

View File

@ -1,327 +0,0 @@
#!/usr/local/bin/php
<?php
// TODO: Find out what to insert for team create_times, since that value
// isn't stored in the SETI@Home database. Should we just set them all to
// the date of migration?
//define('SETI_IMAGE_PATH', '/disks/kosh/a/inet_services/www/share/htdocs/SetiAtHome/images/user_profile/');
//define('BOINC_IMAGE_PATH','/disks/koloth/a/inet_services/www/share/projects/AstroPulse_Beta/html_user/user_profile/images/');
// NOTE: These are only test values! The commented values above are closer
// to the real thing.
define('SETI_IMAGE_PATH', '/disks/kodos/a/inet_services/boinc_www/share/projects/tah/html_ops/');
define('BOINC_IMAGE_PATH', '/disks/kodos/a/inet_services/boinc_www/share/projects/tah/html_user/user_profile/images/');
define('USER_FILE', 'test_user_flat');
define('TEAM_FILE', 'test_teams_flat');
define('FEEDBACK_FILE', 'test_feedback_flat');
mysql_connect();
mysql_select_db('boincadm_tah');
$user_field_map = array('seti_id', NULL, 'email_addr', 'name', NULL, 'create_time', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'country', 'postal_code', NULL, NULL, NULL, 'teamid', NULL, 'url', NULL, NULL);
$team_field_map = array('seti_id', 'userid', 'name', 'name_lc', 'description', 'url', NULL, NULL, NULL, 'nusers', 'type', 'name_html');
$feedback_field_map = array(NULL, 'userid', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'has_picture', 'response1', 'response2', NULL, NULL, NULL, NULL, NULL);
migrate_tables();
function migrate_tables() {
global $user_field_map;
global $team_field_map;
global $feedback_field_map;
$num = 1;
print "Migrating user table...\n";
// User table
$fd = fopen(USER_FILE, 'r');
if (!$fd) {
echo "Error opening '", USER_FILE, "' - exiting.\n";
exit();
}
while ($user_data = get_row($fd, $user_field_map, '|')) {
$authenticator = random_string();
print "\nUser Record #$num\n----------\n";
$query = "INSERT INTO user SET authenticator = '" . $authenticator . "', ";
$first_field = true;
for ($i = 0; $i < count($user_field_map); $i++) {
if (!is_null($user_field_map[$i]) && !is_null($user_data) && !empty($user_data[$i])) {
if ($user_field_map[$i] == 'email_addr') {
$user_data[$i] = munge_email_addr($user_data[$i], $authenticator);
} else if ($user_field_map[$i] == 'create_time') {
$user_data[$i] = jd_to_unix($user_data[$i]);
}
print $user_field_map[$i] . ": " . addslashes(trim($user_data[$i])) . "\n";
if (!$first_field) {
$query = $query . ", ";
} else {
$first_field = false;
}
$query = $query . $user_field_map[$i] . " = '" . addslashes(trim($user_data[$i])) . "'";
}
}
echo "QUERY: $query\n";
mysql_query($query);
$num++;
}
fclose($fd);
$num = 1;
// Feedback table.
// TODO: Make sure we can assume that there will be a user corresponding
// to every feeback entry. (Can't see why this wouldn't be the case.)
$fd = fopen(FEEDBACK_FILE, 'r');
if (!$fd) {
echo "Error opening '", FEEDBACK_FILE,"' - exiting.\n";
exit();
}
while ($feedback_data = get_row($fd, $feedback_field_map, '|')) {
print "\nFeedback Record #$num\n----------\n";
$query = "INSERT INTO profile SET ";
$first_field = true;
$new_userid = NULL;
for ($i = 0; $i < count($feedback_field_map); $i++) {
if (!is_null($feedback_field_map[$i]) && !is_null($feedback_data) && !empty($feedback_data[$i])) {
// We know by the above test that the has_picture field is
// not empty in this case.
if ($feedback_field_map[$i] == 'userid') {
$result = mysql_query("SELECT * FROM user WHERE seti_id = " . $feedback_data[$i]);
if ($result) {
$row = mysql_fetch_object($result);
} else {
print "DB error.\n";
exit();
}
$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
// field in the feedback file, we know that $new_userid
// will have been set by the time we get here.
move_user_pic($feedback_data[$i], $new_userid);
$feedback_data[$i] = '1';
}
print $feedback_field_map[$i] . ": " . addslashes(clean_newlines(trim($feedback_data[$i]))) . "\n";
if (!$first_field) {
$query = $query . ", ";
} else {
$first_field = false;
}
$query = $query . $feedback_field_map[$i] . " = '" . addslashes(clean_newlines(trim($feedback_data[$i]))) . "'";
}
}
echo "QUERY: $query\n";
mysql_query($query);
$num++;
}
fclose($fd);
$num = 1;
print "Migrating team table...\n";
// Team table
$fd = fopen(TEAM_FILE, 'r');
if (!$fd) {
echo "Error opening '", TEAM_FILE, "' - exiting.\n";
exit();
}
while ($team_data = get_row($fd, $team_field_map, '|')) {
print "\nTeam Record #$num\n----------\n";
$query = "INSERT INTO team SET ";
$first_field = true;
for ($i = 0; $i < count($team_field_map); $i++) {
if (!is_null($team_field_map[$i]) && !is_null($team_data) && !empty($team_data[$i])) {
// Translate old userID -> new userID
if ($team_field_map[$i] == 'userid') {
$result = mysql_query("SELECT * FROM user WHERE seti_id = " . $team_data[$i]);
if ($result) {
$row = mysql_fetch_object($result);
} else {
print "DB error.\n";
exit();
}
$team_data[$i] = $row->id;
}
print $team_field_map[$i] . ": " . addslashes(clean_newlines(trim($team_data[$i]))) . "\n";
if (!$first_field) {
$query = $query . ", ";
} else {
$first_field = false;
}
$query = $query . $team_field_map[$i] . " = '" . addslashes(clean_newlines(trim($team_data[$i]))) . "'";
}
}
echo "QUERY: $query\n";
mysql_query($query);
$num++;
}
fclose($fd);
// Wrapping up.
print "Re-linking team IDs and sending notification emails...\n";
$result = mysql_query("SELECT * FROM user WHERE seti_id IS NOT NULL");
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_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);
$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);
}
print "Migration Complete.\n";
}
function clean_newlines($string) {
return ereg_replace('\\\0d\\\0a', "\n", $string);
}
/** Flat file traversal functions
*/
function get_row($descriptor, $keys, $delim) {
$data = NULL;
$empty = true;
for ($i=0; $i < count($keys); $i++) {
$field = get_next_field($descriptor, $delim);
if (!is_null($keys[$i])) {
$data[$i] = $field;
if (!empty($field)) $empty = false;
}
}
if ($empty) {
return NULL;
}
return $data;
}
function get_next_field($descriptor, $delim) {
$data = NULL;
$pos = 0;
while (($char = fgetc($descriptor)) !== FALSE) {
if ($char == $delim) {
if (!($pos > 0 && $data[($pos-1)] == '\\')) {
return $data;
}
}
$data = $data . $char;
$pos++;
}
return NULL;
}
/** Functions copied over from util.inc
*/
function random_string() {
return md5(uniqid(rand()));
}
function munge_email_addr($email, $string) {
return "@".$email."_".$string;
}
// if email_addr is of the form @X_Y, split out the X and return true.
// otherwise return false
//
function split_munged_email_addr($addr, $string, &$email) {
if (substr($addr, 0, 1) != "@") return false;
$x = strrchr($addr, "_");
if (!$x) return false;
$y = substr($x, 1);
if ($y != $string) return false;
$email = substr($addr, 1, strlen($addr)-strlen($x)-1);
return true;
}
function jd_to_unix($raw_jd) {
$jd = floor($raw_jd);
$jtime = $raw_jd - $jd;
$total_secs = 86400 * ($raw_jd - $jd);
$hours = floor($total_secs / 3600);
$minutes = floor(($total_secs - (3600 * $hours)) / 60);
$seconds = floor(($total_secs - (3600 * $hours) - (60 * $minutes)));
// Calculate Gregorian date
$l = $jd + 68569;
$n = floor(( 4 * $l ) / 146097);
$l = $l - floor((146097 * $n + 3 ) / 4);
$i = floor(( 4000 * ( $l + 1 ) ) / 1461001);
$l = floor($l - ( 1461 * $i ) / 4 + 31);
$j = floor(( 80 * $l ) / 2447);
$d = floor($l - ( 2447 * $j ) / 80);
$l = floor($j / 11);
$m = $j + 2 - ( 12 * $l );
$y = 100 * ( $n - 49 ) + $i + $l;
return mktime($hours, $minutes, $seconds, $m, $d, $y);
}
function move_user_pic($img_name, $userid) {
$img_name = trim($img_name);
$filename = SETI_IMAGE_PATH . $img_name;
$filename_sm = SETI_IMAGE_PATH . 'sm_' . $img_name;
if (file_exists($filename)) {
$dotpos = strrpos($img_name, ".");
$name = substr($img_name, 0, $dotpos);
$ext = strrchr($img_name, ".");
if ($ext == '.jpg' || $ext == '.jpeg') {
shell_exec("cp $filename " . BOINC_IMAGE_PATH . $userid . ".jpg");
shell_exec("cp $filename_sm " . BOINC_IMAGE_PATH . $userid . "_sm.jpg");
return true;
} else if ($ext == '.png' || $ext == '.gif') {
shell_exec("convert $filename jpg:" . BOINC_IMAGE_PATH . $userid . ".jpg");
shell_exec("convert $filename_sm jpg:" . BOINC_IMAGE_PATH . $userid . "_sm.jpg");
return true;
} else {
print "Failed to move image $filename";
return false;
}
}
print "Image $filename does not exist!\n";
return false;
}

View File

@ -1,15 +0,0 @@
#!/usr/local/bin/php
<?php
require_once('../inc/util.inc');
$address = 'jbkirby@ssl.berkeley.edu';
$authenticator = random_string();
$munged = munge_email_addr($address, $authenticator);
print "Munged email address: $munged\n";
split_munged_email_addr($munged, $authenticator, $unmunged);
print "Un-munged email address: $unmunged\n";
?>

View File

@ -19,7 +19,7 @@ if (post_str("action", true)=="reset"){
$special_user = $user->getSpecialUser();
$dbhandler->deleteUserPrefs($user);
$user->resetPrefs();
$user->setPostcount($post_count); // Recreate postcount
$user->setPostcount($post_count); // Recreate postcount
$user->setSpecialUser($special_user); // And recreate special user bitfield
Header("Location: edit_forum_preferences_form.php");
exit;
@ -60,13 +60,13 @@ if ($avatar_type==0){
$user->setAvatar($avatar_url);
// Update some simple prefs that are either on or off
$images_as_links = ($HTTP_POST_VARS["forum_images_as_links"]!="");
$link_externally = ($HTTP_POST_VARS["forum_link_externally"]!="");
$hide_avatars = ($HTTP_POST_VARS["forum_hide_avatars"]!="");
$hide_signatures = ($HTTP_POST_VARS["forum_hide_signatures"]!="");
$jump_to_unread = ($HTTP_POST_VARS["forum_jump_to_unread"]!="");
$ignore_sticky_posts = ($HTTP_POST_VARS["forum_ignore_sticky_posts"]!="");
$signature_by_default = ($HTTP_POST_VARS["signature_enable"]!="");
$images_as_links = ($_POST["forum_images_as_links"]!="");
$link_externally = ($_POST["forum_link_externally"]!="");
$hide_avatars = ($_POST["forum_hide_avatars"]!="");
$hide_signatures = ($_POST["forum_hide_signatures"]!="");
$jump_to_unread = ($_POST["forum_jump_to_unread"]!="");
$ignore_sticky_posts = ($_POST["forum_ignore_sticky_posts"]!="");
$signature_by_default = ($_POST["signature_enable"]!="");
$user->setImagesAsLinks($images_as_links);
$user->setLinkPopup($link_externally);
$user->setHideAvatars($hide_avatars);
@ -82,7 +82,7 @@ $user->setLowRatingThreshold($low_rating_threshold);
$user->setHighRatingThreshold($high_rating_threshold);
// Update the signature for this user
$signature = sanitize_html(stripslashes($HTTP_POST_VARS["signature"]));
$signature = sanitize_html(stripslashes($_POST["signature"]));
if (strlen($signature)>250) {
error_page("Your signature was too long, please keep it less than 250 chars");
}
@ -95,20 +95,20 @@ $user->setForumSortStyle($forum_sort);
$user->setThreadSortStyle($thread_sort);
// Add users to the ignore list if any users are defined
$add_user_to_filter = ($HTTP_POST_VARS["add_user_to_filter"]!="");
$add_user_to_filter = ($_POST["add_user_to_filter"]!="");
if ($add_user_to_filter){
$user_to_add = trim($HTTP_POST_VARS["forum_filter_user"]);
$user_to_add = trim($_POST["forum_filter_user"]);
if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
$user->addIgnoredUser(newUser($user_to_add));
$user->addIgnoredUser(newUser($user_to_add));
}
}
// Or remove some from the ignore list
$ignored_users = $user->getIgnorelist();
for ($i=0;$i<sizeof($ignored_users);$i++){
if ($HTTP_POST_VARS["remove".trim($ignored_users[$i])]!=""){
//this user will be removed and no longer ignored
$user->removeIgnoredUser(newUser($ignored_users[$i]));
if ($_POST["remove".trim($ignored_users[$i])]!=""){
//this user will be removed and no longer ignored
$user->removeIgnoredUser(newUser($ignored_users[$i]));
}
}
// Update preferences for the "Display only the Y last posts if there are more than X posts in the thread" feature