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)) {
|
if (!empty($candidates)) {
|
||||||
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
||||||
$result = $this->rc->db->query(sprintf(
|
$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=?",
|
WHERE alarm_id IN (%s) AND user_id=?",
|
||||||
join(',', $alarm_ids),
|
join(',', $alarm_ids),
|
||||||
$this->rc->db->now()
|
$this->rc->db->now()
|
||||||
|
@ -1103,7 +1103,7 @@ class kolab_driver extends calendar_driver
|
||||||
{
|
{
|
||||||
// delete old alarm entry
|
// delete old alarm entry
|
||||||
$this->rc->db->query(
|
$this->rc->db->query(
|
||||||
"DELETE FROM kolab_alarms
|
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||||
WHERE alarm_id=? AND user_id=?",
|
WHERE alarm_id=? AND user_id=?",
|
||||||
$alarm_id,
|
$alarm_id,
|
||||||
$this->rc->user->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;
|
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||||
|
|
||||||
$query = $this->rc->db->query(
|
$query = $this->rc->db->query(
|
||||||
"INSERT INTO kolab_alarms
|
"INSERT INTO " . $this->rc->db->table_name('kolab_alarms') . "
|
||||||
(alarm_id, user_id, dismissed, notifyat)
|
(alarm_id, user_id, dismissed, notifyat)
|
||||||
VALUES(?, ?, ?, ?)",
|
VALUES(?, ?, ?, ?)",
|
||||||
$alarm_id,
|
$alarm_id,
|
||||||
|
@ -1776,7 +1776,7 @@ class kolab_driver extends calendar_driver
|
||||||
{
|
{
|
||||||
$db = $this->rc->get_dbh();
|
$db = $this->rc->get_dbh();
|
||||||
foreach (array('kolab_alarms', 'itipinvitations') as $table) {
|
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')
|
function __construct($plugin, $domain = 'calendar')
|
||||||
{
|
{
|
||||||
parent::__construct($plugin, $domain);
|
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)
|
public function get_invitation($token)
|
||||||
{
|
{
|
||||||
if ($parts = $this->decode_token($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))) {
|
if ($result && ($rec = $this->rc->db->fetch_assoc($result))) {
|
||||||
$rec['event'] = unserialize($rec['event']);
|
$rec['event'] = unserialize($rec['event']);
|
||||||
$rec['attendee'] = $parts['attendee'];
|
$rec['attendee'] = $parts['attendee'];
|
||||||
|
@ -110,7 +112,7 @@ class calendar_itip extends libcalendaring_itip
|
||||||
|
|
||||||
// update record in DB
|
// update record in DB
|
||||||
$query = $this->rc->db->query(
|
$query = $this->rc->db->query(
|
||||||
"UPDATE itipinvitations
|
"UPDATE $this->db_itipinvitations
|
||||||
SET event=?
|
SET event=?
|
||||||
WHERE token=?",
|
WHERE token=?",
|
||||||
self::serialize_event($invitation['event']),
|
self::serialize_event($invitation['event']),
|
||||||
|
@ -148,10 +150,10 @@ class calendar_itip extends libcalendaring_itip
|
||||||
return $token;
|
return $token;
|
||||||
|
|
||||||
// delete old entry
|
// 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(
|
$query = $this->rc->db->query(
|
||||||
"INSERT INTO itipinvitations
|
"INSERT INTO $this->db_itipinvitations
|
||||||
(token, event_uid, user_id, event, expires)
|
(token, event_uid, user_id, event, expires)
|
||||||
VALUES(?, ?, ?, ?, ?)",
|
VALUES(?, ?, ?, ?, ?)",
|
||||||
$base,
|
$base,
|
||||||
|
@ -178,7 +180,7 @@ class calendar_itip extends libcalendaring_itip
|
||||||
{
|
{
|
||||||
// flag invitation record as cancelled
|
// flag invitation record as cancelled
|
||||||
$this->rc->db->query(
|
$this->rc->db->query(
|
||||||
"UPDATE itipinvitations
|
"UPDATE $this->db_itipinvitations
|
||||||
SET cancelled=1
|
SET cancelled=1
|
||||||
WHERE event_uid=? AND user_id=?",
|
WHERE event_uid=? AND user_id=?",
|
||||||
$event['uid'],
|
$event['uid'],
|
||||||
|
|
|
@ -700,7 +700,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
if (!empty($candidates)) {
|
if (!empty($candidates)) {
|
||||||
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
$alarm_ids = array_map(array($this->rc->db, 'quote'), array_keys($candidates));
|
||||||
$result = $this->rc->db->query(sprintf(
|
$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=?",
|
WHERE alarm_id IN (%s) AND user_id=?",
|
||||||
join(',', $alarm_ids),
|
join(',', $alarm_ids),
|
||||||
$this->rc->db->now()
|
$this->rc->db->now()
|
||||||
|
@ -739,7 +739,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
{
|
{
|
||||||
// delete old alarm entry
|
// delete old alarm entry
|
||||||
$this->rc->db->query(
|
$this->rc->db->query(
|
||||||
"DELETE FROM kolab_alarms
|
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||||
WHERE alarm_id=? AND user_id=?",
|
WHERE alarm_id=? AND user_id=?",
|
||||||
$id,
|
$id,
|
||||||
$this->rc->user->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;
|
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||||
|
|
||||||
$query = $this->rc->db->query(
|
$query = $this->rc->db->query(
|
||||||
"INSERT INTO kolab_alarms
|
"INSERT INTO " . $this->rc->db->table_name('kolab_alarms') . "
|
||||||
(alarm_id, user_id, dismissed, notifyat)
|
(alarm_id, user_id, dismissed, notifyat)
|
||||||
VALUES(?, ?, ?, ?)",
|
VALUES(?, ?, ?, ?)",
|
||||||
$id,
|
$id,
|
||||||
|
@ -770,7 +770,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
{
|
{
|
||||||
// delete alarm entry
|
// delete alarm entry
|
||||||
$this->rc->db->query(
|
$this->rc->db->query(
|
||||||
"DELETE FROM kolab_alarms
|
"DELETE FROM " . $this->rc->db->table_name('kolab_alarms') . "
|
||||||
WHERE alarm_id=? AND user_id=?",
|
WHERE alarm_id=? AND user_id=?",
|
||||||
$id,
|
$id,
|
||||||
$this->rc->user->ID
|
$this->rc->user->ID
|
||||||
|
|
Loading…
Add table
Reference in a new issue