do_country && $user->country!=$filter->country) return false;
if ($filter->do_profile) {
if (!($user->has_profile!=0 xor $filter->has_profile)) return false;
}
if ($filter->do_team) {
if ($filter->team xor $user->teamid!=0) return false;
}
return true;
}
function show_user($user) {
echo "
", user_links($user), " |
";
if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid);
echo "
id>$team->name |
";
} else {
echo "
| ";
}
echo "
", format_credit($user->expavg_credit), " |
", format_credit_large($user->total_credit), " |
", $user->country, " |
", time_str($user->create_time)," |
";
}
function do_search($order, $filter) {
$filtered_list = array();
$nrows_scanned = 0;
$fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
while (1) {
if (count($filtered_list) > 500) break;
$limit_clause = " limit $nrows_scanned, 1000";
$users = BoincUser::enum_fields($fields, null, $order.$limit_clause);
$n = count($users);
$nrows_scanned += $n;
if ($nrows_scanned > 10000) break;
if ($n==0) break;
foreach($users as $user) {
if (filter_user($user, $filter)) {
$filtered_list[] = $user;
}
}
}
start_table();
table_header("Name", "Team", "Average credit", "Total credit", "Country", "Joined");
foreach ($filtered_list as $user) {
show_user($user);
}
end_table();
}
function search_form() {
page_head("User search");
echo "