summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps/addressbook/delete.inc
diff options
context:
space:
mode:
authorsparc <sparc@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-10-25 15:04:17 +0000
committersparc <sparc@208e9e7b-5314-0410-a742-e7e81cd9613c>2005-10-25 15:04:17 +0000
commit245939ed7116e018fb877fcd4f4a129eade9423c (patch)
tree79ad707eacc1cf82f7fe0b2a5992ca1e39f447af /roundcubemail/program/steps/addressbook/delete.inc
parent5816625cc300075c43c6ef43a200dd35e1b8257d (diff)
more pear/mdb2 integration
git-svn-id: https://svn.roundcube.net/trunk@58 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps/addressbook/delete.inc')
-rw-r--r--roundcubemail/program/steps/addressbook/delete.inc38
1 files changed, 17 insertions, 21 deletions
diff --git a/roundcubemail/program/steps/addressbook/delete.inc b/roundcubemail/program/steps/addressbook/delete.inc
index e988f5569..a3fcefbf7 100644
--- a/roundcubemail/program/steps/addressbook/delete.inc
+++ b/roundcubemail/program/steps/addressbook/delete.inc
@@ -23,13 +23,11 @@ $REMOTE_REQUEST = TRUE;
if ($_GET['_cid'])
{
- $DB->query(sprintf("UPDATE %s
- SET del='1'
- WHERE user_id=%d
- AND contact_id IN (%s)",
- get_table_name('contacts'),
- $_SESSION['user_id'],
- $_GET['_cid']));
+ $DB->query("UPDATE ".get_table_name('contacts')."
+ SET del='1'
+ WHERE user_id=?
+ AND contact_id IN (".$_GET['_cid'].")",
+ $_SESSION['user_id']);
$count = $DB->affected_rows();
if (!$count)
@@ -40,12 +38,11 @@ if ($_GET['_cid'])
// count contacts for this user
- $sql_result = $DB->query(sprintf("SELECT COUNT(contact_id) AS rows
- FROM %s
- WHERE del!='1'
- AND user_id=%d",
- get_table_name('contacts'),
- $_SESSION['user_id']));
+ $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'];
@@ -62,14 +59,13 @@ if ($_GET['_cid'])
$start_row = ($_SESSION['page'] * $CONFIG['pagesize']) - $count;
// get contacts from DB
- $sql_result = $DB->query(sprintf("SELECT * FROM %s
- WHERE del!='1'
- AND user_id=%d
- ORDER BY name",
- get_table_name('contacts'),
- $_SESSION['user_id']),
- $start_row,
- $count);
+ $sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
+ WHERE del<>'1'
+ AND user_id=?
+ ORDER BY name",
+ $start_row,
+ $count,
+ $_SESSION['user_id']);
$commands .= rcmail_js_contacts_list($sql_result);