From 7dfb1fba5001299300736e6b5d95d9400575e3e7 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 18 Sep 2008 14:59:02 -0400
Subject: [PATCH] Set the right number of arguments for setcookie()

---
 program/steps/addressbook/list.inc |   37 ++++++++-----------------------------
 1 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index 0aa4873..71b9379 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -5,7 +5,7 @@
  | program/steps/addressbook/list.inc                                    |
  |                                                                       |
  | This file is part of the RoundCube Webmail client                     |
- | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
+ | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -19,38 +19,17 @@
 
 */
 
-$REMOTE_REQUEST = TRUE;
-
-// count contacts for this user
-$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
-                          FROM ".get_table_name('contacts')."
-                          WHERE  del<>1
-                          AND    user_id=?",
-                          $_SESSION['user_id']);
-                                   
-$sql_arr = $DB->fetch_assoc($sql_result);
-$rowcount = $sql_arr['rows'];    
+// get contacts for this user
+$result = $CONTACTS->list_records();
 
 // update message count display
-$pages = ceil($rowcount/$CONFIG['pagesize']);
-$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount));
-$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
+$OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
+$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($rowcount));
 
-$start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize'];
-
-// get contacts from DB
-$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
-                               WHERE  del<>1
-                               AND    user_id=?
-                               ORDER BY name",
-                               $start_row,
-                               $CONFIG['pagesize'],
-                               $_SESSION['user_id']);
-                                 
-$commands .= rcmail_js_contacts_list($sql_result);
+// create javascript list
+rcmail_js_contacts_list($result);
   
 // send response
-rcube_remote_response($commands);
+$OUTPUT->send();
 
-exit;
 ?>
\ No newline at end of file

--
Gitblit v1.9.1