commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/list.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2005, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Send contacts list to client (as remote response) | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
$REMOTE_REQUEST = TRUE; |
|
23 |
|
|
24 |
// count contacts for this user |
d7cb77
|
25 |
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows |
S |
26 |
FROM ".get_table_name('contacts')." |
1cded8
|
27 |
WHERE del<>1 |
d7cb77
|
28 |
AND user_id=?", |
S |
29 |
$_SESSION['user_id']); |
4e17e6
|
30 |
|
T |
31 |
$sql_arr = $DB->fetch_assoc($sql_result); |
|
32 |
$rowcount = $sql_arr['rows']; |
|
33 |
|
|
34 |
// update message count display |
|
35 |
$pages = ceil($rowcount/$CONFIG['pagesize']); |
|
36 |
$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount)); |
|
37 |
$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages); |
|
38 |
|
|
39 |
$start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize']; |
|
40 |
|
|
41 |
// get contacts from DB |
d7cb77
|
42 |
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')." |
1cded8
|
43 |
WHERE del<>1 |
d7cb77
|
44 |
AND user_id=? |
S |
45 |
ORDER BY name", |
|
46 |
$start_row, |
|
47 |
$CONFIG['pagesize'], |
|
48 |
$_SESSION['user_id']); |
4e17e6
|
49 |
|
T |
50 |
$commands .= rcmail_js_contacts_list($sql_result); |
|
51 |
|
|
52 |
// send response |
|
53 |
rcube_remote_response($commands); |
|
54 |
|
|
55 |
exit; |
|
56 |
?> |