source: github/program/steps/addressbook/list.inc @ d7cb774

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since d7cb774 was d7cb774, checked in by svncommit <devs@…>, 8 years ago

more pear/mdb2 integration

  • Property mode set to 100644
File size: 2.2 KB
Line 
1<?php
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                      |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
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
25$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
26                          FROM ".get_table_name('contacts')."
27                          WHERE  del<>'1'
28                          AND    user_id=?",
29                          $_SESSION['user_id']);
30                                   
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
42$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
43                               WHERE  del<>'1'
44                               AND    user_id=?
45                               ORDER BY name",
46                               $start_row,
47                               $CONFIG['pagesize'],
48                               $_SESSION['user_id']);
49                                 
50$commands .= rcmail_js_contacts_list($sql_result);
51 
52// send response
53rcube_remote_response($commands);
54
55exit;
56?>
Note: See TracBrowser for help on using the repository browser.