#!/usr/bin/env php . // This script for use ONLY by the BOINC-teams project. // It generates an XML file with team and user info $cli_only = true; require_once("../inc/util_ops.inc"); function handle_team($team, $f) { $user = BoincUser::lookup_id($team->userid); if (!$user) { echo "no user for team $team->id\n"; return; } if ($user->teamid != $team->id) { echo "Founder is not member of $team->name\n"; return; } 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, " ".htmlspecialchars($team->name)." ".htmlspecialchars($team->url)." $team->type ".htmlspecialchars($team->name_html)." ".htmlspecialchars($team->description)." $team->country $team->id $user_email_munged ".htmlspecialchars($user->name)." ".htmlspecialchars($user->country)." ".htmlspecialchars($user->postal_code)." ".htmlspecialchars($user->url)." " ); } function main() { $f = fopen("temp.xml", "w"); $teams = BoincTeam::enum(); fwrite($f, "\n"); foreach($teams as $team) { handle_team($team, $f); } fwrite($f, "\n"); fclose($f); if (!rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml")) { echo "Rename failed\n"; } } main(); ?>