From 53560c521e594d6047f58a25ccbc266c56bbcf05 Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Thu, 20 Oct 2005 12:58:34 -0400
Subject: [PATCH] 

---
 program/steps/addressbook/list.inc   |    7 +++----
 program/include/rcube_db.inc         |   11 ++++++++---
 program/steps/addressbook/func.inc   |    7 +++----
 program/steps/addressbook/delete.inc |    7 +++----
 program/include/rcube_mdb2.inc       |    5 ++++-
 program/localization/es/labels.inc   |    1 +
 6 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc
index 2b0c01a..f732da2 100755
--- a/program/include/rcube_db.inc
+++ b/program/include/rcube_db.inc
@@ -103,7 +103,7 @@
 
     // Query database (read operations)
     
-    function query($query)
+    function query($query, $offset=0, $numrows=0)
     {
         // Read or write ?
         if (strtolower(trim(substr($query,0,6)))=='select')
@@ -115,8 +115,13 @@
 
         if ($this->db_provider == 'sqlite')
             $query = $this->_sqlite_prepare_query($query);
-            
-        $result = $this->db_handle->query($query);
+        
+        if ($numrows || $offset)
+			{
+			$result = $this->db_handle->limitQuery($query,$offset,$numrows);
+			}
+        else    
+			$result = $this->db_handle->query($query);
         
         if (DB::isError($result))
             raise_error(array('code' => 500,
diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc
index 77518e7..cd394a8 100755
--- a/program/include/rcube_mdb2.inc
+++ b/program/include/rcube_mdb2.inc
@@ -103,7 +103,7 @@
 
     // Query database (read operations)
     
-    function query($query)
+    function query($query, $offset=0, $numrows=0)
     {
         // Read or write ?
         if (strtolower(trim(substr($query,0,6)))=='select')
@@ -116,6 +116,9 @@
         if ($this->db_provider == 'sqlite')
             $query = $this->_sqlite_prepare_query($query);
             
+        $this->db_handle->row_offset = $offset;
+		$this->db_handle->row_limit = $numrows;
+		
         $result = $this->db_handle->query($query);
         
         if (PEAR::isError($result))
diff --git a/program/localization/es/labels.inc b/program/localization/es/labels.inc
index f0fdca5..0f627eb 100644
--- a/program/localization/es/labels.inc
+++ b/program/localization/es/labels.inc
@@ -63,6 +63,7 @@
 
 $labels['preferhtml'] = 'Prefiero HTML';
 $labels['htmlmessage'] = 'Mensaje HTML';
+//$labels['prettydate'] = '';
 
 $labels['addtoaddressbook'] = 'A�adir a contactos';
 
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
index 789d841..e988f55 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -65,12 +65,11 @@
     $sql_result = $DB->query(sprintf("SELECT * FROM %s
                                       WHERE  del!='1'
                                       AND    user_id=%d
-                                      ORDER BY name
-                                      LIMIT %d, %d",
+                                      ORDER BY name",
                                      get_table_name('contacts'),
-                                     $_SESSION['user_id'],
+                                     $_SESSION['user_id']),
                                      $start_row,
-                                     $count));
+                                     $count);
                                      
     $commands .= rcmail_js_contacts_list($sql_result);
 
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 7858a4e..5362816 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -59,12 +59,11 @@
     $sql_result = $DB->query(sprintf("SELECT * FROM %s
                                       WHERE  del!='1'
                                       AND    user_id=%d
-                                      ORDER BY name
-                                      LIMIT %d, %d",
+                                      ORDER BY name",
                                      get_table_name('contacts'),
-                                     $_SESSION['user_id'],
+                                     $_SESSION['user_id']),
                                      $start_row,
-                                     $CONFIG['pagesize']));
+                                     $CONFIG['pagesize']);
     }
   else
     $sql_result = NULL;
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index 2c5148a..4ed0925 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -43,12 +43,11 @@
 $sql_result = $DB->query(sprintf("SELECT * FROM %s
                                   WHERE  del!='1'
                                   AND    user_id=%d
-                                  ORDER BY name
-                                  LIMIT %d, %d",
+                                  ORDER BY name",
                                  get_table_name('contacts'),
-                                 $_SESSION['user_id'],
+                                 $_SESSION['user_id']),
                                  $start_row,
-                                 $CONFIG['pagesize']));
+                                 $CONFIG['pagesize']);
                                  
 $commands .= rcmail_js_contacts_list($sql_result);
   

--
Gitblit v1.9.1