From 3990e817e342076b299fd16d5d4fa1b2f7338758 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 25 Jul 2007 20:58:36 +0000 Subject: [PATCH] - add support for "BOINC teams" (to be explained later) svn path=/trunk/boinc/; revision=13218 --- checkin_notes | 10 ++ doc/boinc_news.php | 7 ++ doc/docutil.php | 2 +- doc/index.php | 2 +- doc/logo.php | 40 +++----- html/inc/team.inc | 3 - html/ops/team_export.php | 56 +++++++++++ html/ops/team_import.php | 203 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 289 insertions(+), 34 deletions(-) create mode 100644 html/ops/team_export.php create mode 100644 html/ops/team_import.php diff --git a/checkin_notes b/checkin_notes index 0b2ebff3fe..426276d9f9 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7499,3 +7499,13 @@ David 25 July 2007 user/ create_account.php create_account_action.php + +David 25 July 2007 + - add support for "BOINC teams" (to be explained later) + + html/ + inc/ + team.inc + ops/ + team_export.php + team_import.php diff --git a/doc/boinc_news.php b/doc/boinc_news.php index 6eda3ac9eb..77d13b3931 100644 --- a/doc/boinc_news.php +++ b/doc/boinc_news.php @@ -1,6 +1,13 @@ The Africa@home workshop on volunteer computing with BOINC, diff --git a/doc/docutil.php b/doc/docutil.php index 059fe406eb..e86b2ccad3 100644 --- a/doc/docutil.php +++ b/doc/docutil.php @@ -51,7 +51,7 @@ function page_head($title) {

$title

-
+
"; search_form(); diff --git a/doc/index.php b/doc/index.php index 315be0f0f6..9cd6e6c0a7 100644 --- a/doc/index.php +++ b/doc/index.php @@ -179,7 +179,7 @@ echo " - +

".tr(HOME_BOINC)."

diff --git a/doc/logo.php b/doc/logo.php index ff2aa8409d..f7141b2ea6 100644 --- a/doc/logo.php +++ b/doc/logo.php @@ -5,11 +5,18 @@ page_head("Logos and graphics"); echo " -

The current BOINC logo and icons

+

The current logo

+ +The current logo and associated icons was designed by Michal Krakowiak. +Its arms represent the convergence of separated things +(such as computers) into a unified whole. +The colors are based on U.C. Berkeley's blue-and-gold colors. + +

The old BOINC logo and icons

  • -The logo in its native form as a Word document. -The BOINC logo uses the Planet Benson font from +The old logo in its native form as a Word document. +The logo uses the Planet Benson font from Larabie Fonts.
  • Hi-res versions of the logo: @@ -23,32 +30,7 @@ The 'B in a circle' icon was designed by Tim Lan. The Mac variant was contributed by Juho Viitasalo. -

    New BOINC logo?

    -

    -We are looking for a new graphical identity for BOINC. -Our criteria: -

      -
    • It should work on light-colored backgrounds -(both the web) and also on black (for the screensaver). -
    • It should include graphics of various sizes, -including icons (16x16 up to 128x128), -a web-site logo (roughly 200x100), -and an installer splash screen (roughly 400x300). -These should all be recognizable and visually consistent. -
    • -It should appeal to people of all interests and demographics. -In particular, it should NOT have a futuristic, -high-tech, aggressive, or sci-fi look. -
    • -It would be good (though not vital) for the logo -to suggest global distributed computing, -or scientific research, or both. - -
    -Here are some candidates. -If you have an opinion, or think you can do better, - please contact us. -

    +

    Logo proposals

    "; diff --git a/html/inc/team.inc b/html/inc/team.inc index 51ca23eef2..dec0b69b50 100644 --- a/html/inc/team.inc +++ b/html/inc/team.inc @@ -319,9 +319,7 @@ function transfer_ok($team, $now) { function make_team( $userid, $name, $url, $type, $name_html, $description, $country ) { - echo $name; $name = boinc_htmlentities(process_user_text(strip_tags($name))); - echo $name; if (strlen($name) == 0) return null; $name_lc = strtolower($name); $url = process_user_text(strip_tags($url)); @@ -349,7 +347,6 @@ function make_team( $country, 0 ); - echo $query; $result = mysql_query($query); if ($result) { $teamid = mysql_insert_id(); diff --git a/html/ops/team_export.php b/html/ops/team_export.php new file mode 100644 index 0000000000..36977f0a93 --- /dev/null +++ b/html/ops/team_export.php @@ -0,0 +1,56 @@ +userid); + if (!$user) { + echo "no user for team $team->id\n"; + exit(1); + } + if (!$user->email_validated) { + echo "the founder of $team->name, $user->email_addr, is not validated\n"; + return; + } + $user_email_munged = str_rot13($user->email_addr); + fwrite($f, +" + $team->name + $team->url + $team->type + $team->name_html + +$team->description + + $team->country + $team->id + $user_email_munged + $user->name + $user->country + $user->postal_code + $user->url + +" + ); +} + +function main() { + $f = fopen("temp.xml", "w"); + $result = mysql_query("select * from team"); + fwrite($f, "\n"); + while ($team=mysql_fetch_object($result)) { + handle_team($team, $f); + } + fwrite($f, "\n"); + fclose($f); + rename("temp.xml", "boinc_teams.xml"); +} + +main(); + +?> diff --git a/html/ops/team_import.php b/html/ops/team_import.php new file mode 100644 index 0000000000..c311ba85a9 --- /dev/null +++ b/html/ops/team_import.php @@ -0,0 +1,203 @@ +')) { + return $t; + } + else if (strstr($s, '')) $t->name = parse_element($s, ''); + else if (strstr($s, '')) $t->url = parse_element($s, ''); + else if (strstr($s, '')) $t->name_html = parse_element($s, ''); + else if (strstr($s, '')) { + while ($s = fgets($f)) { + if (strstr($s, '')) break; + $t->description .= $s; + } + } + else if (strstr($s, '')) $t->country = parse_element($s, ''); + else if (strstr($s, '')) $t->id = parse_element($s, ''); + else if (strstr($s, '')) { + $user_email_munged = parse_element($s, ''); + $t->user_email = str_rot13($user_email_munged); + } + else if (strstr($s, '')) $t->user_name = parse_element($s, ''); + else if (strstr($s, '')) $t->user_country = parse_element($s, ''); + else if (strstr($s, '')) $t->user_postal_code = parse_element($s, ''); + else if (strstr($s, '')) $t->user_url = parse_element($s, ''); + } + return null; +} + +function valid_team($t) { + if (!$t->id) return false; + if (!$t->name) return false; + if (!$t->user_email) return false; + if (!$t->user_name) return false; + return true; +} + +// if team belongs to given user, update it +// +function update_team($t, $team, $user) { + if (!$user) { + echo " No user\n"; + return; + } + if ($user.id != $team.id) { + echo " owned by a different user\n"; + return; + } + if ( + $t->url == $team->url + && $t->type == $team->type + && $t->name_html == $team->name_html + && $t->description == $team->description + && $t->country == $team->country + && $t->id == $team->seti_id + ) { + echo " no changes\n"; + return; + } + echo " updating\n"; + $query = "update team set url='$t->url', type=$t->type, name_html='$t->name_html', description='$t->description', country='$t->country', seti_id=$t->id"; + $retval = mysql_query($query); + if (!$retval) { + echo " update failed: $query\n"; + exit; + } +} + +function insert_case($t, $user) { + if (!$user) { + echo " making user\n"; + $user = make_user($t->user_email, $t->user_name, random_string()); + if (!$user) { + echo " Can't make user $t->user_email\n"; + echo mysql_error(); + exit; + } + } + echo " making team\n"; + $team = make_team( + $user->id, $t->name, $t->url, $t->type, $t->name_html, + $t->description, $t->country + ); + if (!$team) { + echo " Can't make team $t->id\n"; + echo mysql_error(); + exit; + } +} + +// There are several cases for a given record: +// (note: "ID" means the ID coming from BOINC, stored locally in seti_id) +// insert case: +// There's no team with given name; create one, +// and create the user if needed +// update1 case: +// There's a team with the given name and the given ID +// and its founder has the right email address. +// Update its parameters if any are different. +// update2 case: +// There's a team with the given name and seti_id=0, +// and its founder has the right email address. +// Update its parameters if any are different, +// and set its seti_id. +// This handles the case where the team founder created the team +// before this new system was run. +// conflict case: +// There's a team with the given name, +// and either it has the wrong ID +// or its founder has a different email address. +// Don't change anything. + +// These semantics mean that: +// - A BOINC team can't change its name via this mechanism. +// This avoids pathological cases, e.g. if two teams swapped names, +// the updates would always fail. +// If a BOINC team wants to change its name, +// it must do it manually everywhere. +// - If a BOINC team changes its founder (or the founder changes email) +// they'll have to make this change manually on all projects. +// (this is better than a security vulnerability) +// - This mechanism can't be used to update the founder's +// account parameters on all projects + +function handle_team($f) { + $t = parse_team($f); + if (!$t) { + echo "Failed to parse team\n"; + return; + } + //print_r($t); + //return; + if (!valid_team($t)) { + echo "Invalid team\n"; + return; + } + $user = lookup_user_email_addr($t->user_email); + + echo "Processing $t->name\n"; + $team = lookup_team_name($t->name); + if ($team) { + if ($team->seti_id) { + if ($team->seti_id == $t->id) { + update_team($t, $team, $user); // update1 case + } + } else { + $team2 = lookup_team_seti_id($t->id); + if ($team2) { + // update1 case + update_team($t, $team2, $user); + } else { + // update2 case + update_team($t, $team, $user); + } + } + } else { + $team = lookup_team_seti_id($t->id); + if ($team) { + echo " A team with same ID but different name exists;\n"; + echo " Please report this to $t->user_email;\n"; + } else { + echo " Inserting team\n"; + insert_case($t, $user); + } + } +} + +function main() { + $f = fopen("http://boinc.berkeley.edu/boinc_teams.xml", "r"); + if (!$f) { + echo "Can't get times file\n"; + exit; + } + while ($s = fgets($f)) { + if (strstr($s, '')) { + handle_team($f); + } + } +} + +db_init(); +main(); + +?>
    ArtistImages (click for hi-res version)