Use rcube_db::table_name() for SQL database access
This commit is contained in:
parent
0e40a59ae2
commit
c7b422907e
3 changed files with 15 additions and 13 deletions
|
@ -1066,7 +1066,7 @@ class kolab_driver extends calendar_driver
|
|||
if (!empty($candidates)) {
|
||||
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
||||
$result = $this->rc->db->query(sprintf(
|
||||
"SELECT * FROM kolab_alarms
|
||||
"SELECT * FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
WHERE alarm_id IN (%s) AND user_id=?",
|
||||
join(',', $alarm_ids),
|
||||
$this->rc->db->now()
|
||||
|
@ -1103,7 +1103,7 @@ class kolab_driver extends calendar_driver
|
|||
{
|
||||
// delete old alarm entry
|
||||
$this->rc->db->query(
|
||||
"DELETE FROM kolab_alarms
|
||||
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
WHERE alarm_id=? AND user_id=?",
|
||||
$alarm_id,
|
||||
$this->rc->user->ID
|
||||
|
@ -1113,7 +1113,7 @@ class kolab_driver extends calendar_driver
|
|||
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||
|
||||
$query = $this->rc->db->query(
|
||||
"INSERT INTO kolab_alarms
|
||||
"INSERT INTO " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
(alarm_id, user_id, dismissed, notifyat)
|
||||
VALUES(?, ?, ?, ?)",
|
||||
$alarm_id,
|
||||
|
@ -1776,7 +1776,7 @@ class kolab_driver extends calendar_driver
|
|||
{
|
||||
$db = $this->rc->get_dbh();
|
||||
foreach (array('kolab_alarms', 'itipinvitations') as $table) {
|
||||
$db->query("DELETE FROM $table WHERE user_id=?", $args['user']->ID);
|
||||
$db->query("DELETE FROM " . $this->rc->db->table_name($table) . " WHERE user_id=?", $args['user']->ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ class calendar_itip extends libcalendaring_itip
|
|||
function __construct($plugin, $domain = 'calendar')
|
||||
{
|
||||
parent::__construct($plugin, $domain);
|
||||
|
||||
$this->db_itipinvitations = $this->rc->db->table_name('itipinvitations');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +61,7 @@ class calendar_itip extends libcalendaring_itip
|
|||
public function get_invitation($token)
|
||||
{
|
||||
if ($parts = $this->decode_token($token)) {
|
||||
$result = $this->rc->db->query("SELECT * FROM itipinvitations WHERE token=?", $parts['base']);
|
||||
$result = $this->rc->db->query("SELECT * FROM $this->db_itipinvitations WHERE token=?", $parts['base']);
|
||||
if ($result && ($rec = $this->rc->db->fetch_assoc($result))) {
|
||||
$rec['event'] = unserialize($rec['event']);
|
||||
$rec['attendee'] = $parts['attendee'];
|
||||
|
@ -110,7 +112,7 @@ class calendar_itip extends libcalendaring_itip
|
|||
|
||||
// update record in DB
|
||||
$query = $this->rc->db->query(
|
||||
"UPDATE itipinvitations
|
||||
"UPDATE $this->db_itipinvitations
|
||||
SET event=?
|
||||
WHERE token=?",
|
||||
self::serialize_event($invitation['event']),
|
||||
|
@ -148,10 +150,10 @@ class calendar_itip extends libcalendaring_itip
|
|||
return $token;
|
||||
|
||||
// delete old entry
|
||||
$this->rc->db->query("DELETE FROM itipinvitations WHERE token=?", $base);
|
||||
$this->rc->db->query("DELETE FROM $this->db_itipinvitations WHERE token=?", $base);
|
||||
|
||||
$query = $this->rc->db->query(
|
||||
"INSERT INTO itipinvitations
|
||||
"INSERT INTO $this->db_itipinvitations
|
||||
(token, event_uid, user_id, event, expires)
|
||||
VALUES(?, ?, ?, ?, ?)",
|
||||
$base,
|
||||
|
@ -178,7 +180,7 @@ class calendar_itip extends libcalendaring_itip
|
|||
{
|
||||
// flag invitation record as cancelled
|
||||
$this->rc->db->query(
|
||||
"UPDATE itipinvitations
|
||||
"UPDATE $this->db_itipinvitations
|
||||
SET cancelled=1
|
||||
WHERE event_uid=? AND user_id=?",
|
||||
$event['uid'],
|
||||
|
|
|
@ -700,7 +700,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
if (!empty($candidates)) {
|
||||
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
||||
$result = $this->rc->db->query(sprintf(
|
||||
"SELECT * FROM kolab_alarms
|
||||
"SELECT * FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
WHERE alarm_id IN (%s) AND user_id=?",
|
||||
join(',', $alarm_ids),
|
||||
$this->rc->db->now()
|
||||
|
@ -739,7 +739,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
{
|
||||
// delete old alarm entry
|
||||
$this->rc->db->query(
|
||||
"DELETE FROM kolab_alarms
|
||||
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
WHERE alarm_id=? AND user_id=?",
|
||||
$id,
|
||||
$this->rc->user->ID
|
||||
|
@ -749,7 +749,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||
|
||||
$query = $this->rc->db->query(
|
||||
"INSERT INTO kolab_alarms
|
||||
"INSERT INTO " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
(alarm_id, user_id, dismissed, notifyat)
|
||||
VALUES(?, ?, ?, ?)",
|
||||
$id,
|
||||
|
@ -770,7 +770,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
{
|
||||
// delete alarm entry
|
||||
$this->rc->db->query(
|
||||
"DELETE FROM kolab_alarms
|
||||
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||
WHERE alarm_id=? AND user_id=?",
|
||||
$id,
|
||||
$this->rc->user->ID
|
||||
|
|
Loading…
Add table
Reference in a new issue