- web: fix bug in user search when enter empty name prefix

svn path=/trunk/boinc/; revision=24392
This commit is contained in:
David Anderson 2011-10-13 19:21:25 +00:00
parent 921b5c50df
commit 37c71fd18c
2 changed files with 11 additions and 3 deletions

View File

@ -7196,3 +7196,9 @@ David 13 Oct 2011
cs_files.cpp cs_files.cpp
sched/ sched/
file_upload_handler.cpp file_upload_handler.cpp
David 13 Oct 2011
- web: fix bug in user search when enter empty name prefix
html/user/
user_search.php

View File

@ -63,7 +63,7 @@ function filter_user($user, $filter) {
function show_user($user) { function show_user($user) {
echo " echo "
<tr class=row1> <tr class=row1>
<td>", $user->id, user_links($user), "</td> <td>", user_links($user), " (ID $user->id)</td>
"; ";
if ($user->teamid) { if ($user->teamid) {
$team = BoincTeam::lookup_id($user->teamid); $team = BoincTeam::lookup_id($user->teamid);
@ -100,12 +100,14 @@ function do_search($order, $filter) {
} }
} }
} }
page_head(tra("User search results"));
start_table(); start_table();
table_header(tra("Name"), tra("Team"), tra("Average credit"), tra("Total credit"), tra("Country"), tra("Joined")); table_header(tra("Name"), tra("Team"), tra("Average credit"), tra("Total credit"), tra("Country"), tra("Joined"));
foreach ($filtered_list as $user) { foreach ($filtered_list as $user) {
show_user($user); show_user($user);
} }
end_table(); end_table();
page_tail();
} }
function search_form() { function search_form() {
@ -147,6 +149,7 @@ function name_search($filter) {
if (strlen($search_string)<3) { if (strlen($search_string)<3) {
error_page(tra("search string must be at least 3 characters")); error_page(tra("search string must be at least 3 characters"));
} }
page_head(tra("User search results"));
$s = BoincDb::escape_string($search_string); $s = BoincDb::escape_string($search_string);
$s = escape_pattern($s); $s = escape_pattern($s);
$fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated"; $fields = "id, create_time, name, country, total_credit, expavg_credit, teamid, url, has_profile, donated";
@ -167,6 +170,7 @@ function name_search($filter) {
if (!$n) { if (!$n) {
echo tra("No users match your search criteria."); echo tra("No users match your search criteria.");
} }
page_tail();
} }
function main() { function main() {
@ -223,13 +227,11 @@ function main() {
$filter->do_team = false; $filter->do_team = false;
break; break;
} }
page_head(tra("User search results"));
if ($search_type == 'name_prefix') { if ($search_type == 'name_prefix') {
name_search($filter); name_search($filter);
} else { } else {
do_search($order, $filter); do_search($order, $filter);
} }
page_tail();
} else { } else {
search_form(); search_form();
} }