function delete_teams() { global $days, $test; $query = "nusers < 2 and seti_id=0 and total_credit=0"; if ($days) { $x = time() - $days * 86400; $query .= " and create_time > {$x}"; } $teams = BoincTeam::enum($query); foreach ($teams as $team) { $n = team_count_members($team->id); if ($n > 1) { continue; } if (!has_link($team->description)) { continue; } $user = BoincUser::lookup_id($team->userid); if ($user) { $n = BoincPost::count("user={$user->id}"); if ($n) { continue; } $n = BoincHost::count("userid={$user->id}"); if ($n) { continue; } } if ($test) { echo "would delete team:\n"; echo " ID: {$team->id}\n"; echo " name: {$team->name}\n"; echo " description: {$team->description}\n"; } else { $team->delete(); echo "deleted team ID {$team->id} name {$team->name}\n"; if ($user) { do_delete_user($user); } } } }
$tokens = url_tokens($user->authenticator); if ($team->ping_user > 0) { $user2 = BoincUser::lookup_id($team->ping_user); $deadline = date_str(transfer_ok_time($team)); echo "<li>\n <a href=team_change_founder_form.php?teamid={$team->id}><font color=red><strong>" . tra("Respond to foundership request.") . "</strong></font></a> " . tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name); } echo "\n <li><a href=team_remove_inactive_form.php?teamid={$team->id}>" . tra("Remove members") . "</a>\n <br><p class=\"text-muted\">" . tra("Remove inactive or unwanted members from this team") . "</p>\n <li><a href=team_change_founder_form.php?teamid={$team->id}>" . tra("Change founder") . "</a>\n <br><p class=\"text-muted\">" . tra("Transfer foundership to another member") . "</p>\n <li><a href=team_admins.php?teamid={$team->id}>" . tra("Add/remove Team Admins") . "</a>\n <br><p class=\"text-muted\">" . tra("Give selected team members Team Admin privileges") . "</p>\n\n <li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>" . tra("Remove team") . "</a>\n <br><p class=\"text-muted\">" . tra("Allowed only if team has no members") . "</p>\n <li><a href=team_forum.php?teamid={$team->id}&cmd=manage>" . tra("Message board") . "</a>\n <br><p class=\"text-muted\">" . tra("Create or manage a team message board") . "</p>\n "; } echo "\n\n <p>\n <li>\n " . tra("To have this team created on all BOINC projects (current and future) you can make it into a %1BOINC-wide team%2.", "<a href=http://boinc.berkeley.edu/teams/>", "</a>") . "\n <li>\n " . tra("Team admins are encouraged to join and participate in the Google %1boinc-team-founders%2 group.", "<a href=http://groups.google.com/group/boinc-team-founders>", "</a>") . "\n </ul>\n "; page_tail(); } $user = get_logged_in_user(true); $teamid = get_int('teamid'); $team = BoincTeam::lookup_id($teamid); if (!$team) { error_page(tra("No such team")); } $action = get_str('action', true); if ($action == 'delete') { require_founder_login($user, $team); if (team_count_members($team->id) > 0) { error_page(tra("Can't delete non-empty team")); } check_tokens($user->authenticator); $team->delete(); page_head(tra("Team %1 deleted", $team->name)); page_tail(); } else { require_admin($user, $team); show_admin_page($user, $team); }
if ($offset % $teams_per_page) { $offset = 0; } if ($offset < ITEM_LIMIT) { $cache_args = "sort_by={$sort_by}&offset={$offset}{$type_url}"; $cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args); //If we have got the data in cache if ($cacheddata) { $data = store_to_teams($cacheddata); // use the cached data } else { //if not do queries etc to generate new data $data = get_top_teams($offset, $sort_by, $type); // Calculate nusers before storing into the cache foreach ($data as $team) { $team->nusers = team_count_members($team->id); } //save data in cache set_cached_data(TOP_PAGES_TTL, teams_to_store($data), $cache_args); } } else { error_page(tra("Limit exceeded - Sorry, first %1 items only", ITEM_LIMIT)); } // Now display what we've got (either gotten from cache or from DB) page_head(tra("Top %1 teams", $type_name)); if (count($data) == 0) { echo tra("There are no %1 teams", $type_name); } else { start_table(); team_table_start($sort_by, $type_url); $i = 1 + $offset;