summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-05-17 19:59:56 +0000
committerthomascube <thomas@roundcube.net>2007-05-17 19:59:56 +0000
commit4a4751f5e504ae457ca99ca19a1531190c527e71 (patch)
tree66899d0a0b3fb89b175c64ff81dddda58b548d9e
parent8f36bef66e7fc65b272e752e8d0ee60e35e7ce65 (diff)
Better SQL query for contact listing/search (closes #1484369)
-rw-r--r--program/include/rcube_contacts.inc14
1 files changed, 7 insertions, 7 deletions
diff --git a/program/include/rcube_contacts.inc b/program/include/rcube_contacts.inc
index cc801c6db..3902e2a3b 100644
--- a/program/include/rcube_contacts.inc
+++ b/program/include/rcube_contacts.inc
@@ -24,7 +24,7 @@ class rcube_contacts
var $db = null;
var $db_name = '';
var $user_id = 0;
- var $filter = '1';
+ var $filter = null;
var $result = null;
var $search_fields;
var $search_string;
@@ -115,7 +115,7 @@ class rcube_contacts
function reset()
{
$this->result = null;
- $this->filter = '1';
+ $this->filter = null;
$this->search_fields = null;
$this->search_string = null;
}
@@ -142,9 +142,9 @@ class rcube_contacts
$sql_result = $this->db->limitquery(
"SELECT * FROM ".$this->db_name."
WHERE del<>1
- AND user_id=?
- AND (".$this->filter.")
- ORDER BY name",
+ AND user_id=?" .
+ ($this->filter ? " AND (".$this->filter.")" : "") .
+ " ORDER BY name",
$start_row,
$length,
$this->user_id);
@@ -213,8 +213,8 @@ class rcube_contacts
"SELECT COUNT(contact_id) AS rows
FROM ".$this->db_name."
WHERE del<>1
- AND user_id=?
- AND (".$this->filter.")",
+ AND user_id=?".
+ ($this->filter ? " AND (".$this->filter.")" : ""),
$this->user_id);
$sql_arr = $this->db->fetch_assoc($sql_result);