commit | author | age
|
f11541
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/search.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
|
9 |
| Licensed under the GNU GPL | |
|
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Search step for address book contacts | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id: search.inc 456 2007-01-10 12:34:33Z thomasb $ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
$CONTACTS->set_page(1); |
|
23 |
$_SESSION['page'] = 1; |
|
24 |
|
|
25 |
$search = trim(get_input_value('_q', RCUBE_INPUT_GET)); |
|
26 |
$search_request = md5('addr'.$search); |
|
27 |
|
|
28 |
// get contacts for this user |
|
29 |
$result = $CONTACTS->search(array('name','email'), $search); |
|
30 |
|
|
31 |
if ($result->count > 0) |
|
32 |
{ |
|
33 |
// save search settings in session |
|
34 |
$_SESSION['search'][$search_request] = $CONTACTS->get_search_set(); |
|
35 |
|
|
36 |
// create javascript list |
|
37 |
rcmail_js_contacts_list($result); |
|
38 |
} |
|
39 |
else |
|
40 |
{ |
|
41 |
$OUTPUT->show_message('nocontactsfound', 'warning'); |
|
42 |
$search_request = -1; |
|
43 |
} |
|
44 |
|
|
45 |
// update message count display |
|
46 |
$OUTPUT->set_env('search_request', $search_request); |
|
47 |
$OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size)); |
|
48 |
$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text()); |
|
49 |
|
|
50 |
// send response |
|
51 |
$OUTPUT->send(); |
|
52 |
|
|
53 |
?> |