aboutsummaryrefslogtreecommitdiffstats
path: root/include/chat.php
diff options
context:
space:
mode:
authorhabeascodice <habeascodice@federated.social>2014-11-17 08:30:26 -0800
committerhabeascodice <habeascodice@federated.social>2014-11-17 08:30:26 -0800
commit540b7af2c12666047710dd8f5e0c54d23ae8872c (patch)
treeea90f72d9d308f6cb061a528c1f8494106e70087 /include/chat.php
parent80eb84e843cdca51bbf4ebda180f4de41351b9c4 (diff)
parentee38bebbd6a641eb953eacf493c085053442d972 (diff)
downloadvolse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.tar.gz
volse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.tar.bz2
volse-hubzilla-540b7af2c12666047710dd8f5e0c54d23ae8872c.zip
Merge branch 'master' of https://github.com/habeascodice/red
Diffstat (limited to 'include/chat.php')
-rw-r--r--include/chat.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/chat.php b/include/chat.php
index 5c3d0c9d9..533c03dde 100644
--- a/include/chat.php
+++ b/include/chat.php
@@ -77,7 +77,7 @@ function chatroom_destroy($channel,$arr) {
return $ret;
}
- q("delete from chatroom where cr_id = %d limit 1",
+ q("delete from chatroom where cr_id = %d",
intval($r[0]['cr_id'])
);
if($r[0]['cr_id']) {
@@ -129,8 +129,11 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
}
if(intval($x[0]['cr_expire'])) {
- $sql = "delete from chat where created < UTC_TIMESTAMP() - INTERVAL " . intval($x[0]['cr_expire']) . " MINUTE and chat_room = " . intval($x[0]['cr_id']);
- $r = q($sql);
+ $r = q("delete from chat where created < %s - INTERVAL %s and chat_room = %d",
+ db_utcnow(),
+ db_quoteinterval( intval($x[0]['cr_expire']) . ' MINUTE' ),
+ intval($x[0]['cr_id'])
+ );
}
$r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
@@ -138,7 +141,7 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
intval($room_id)
);
if($r) {
- q("update chatpresence set cp_last = '%s' where cp_id = %d and cp_client = '%s' limit 1",
+ q("update chatpresence set cp_last = '%s' where cp_id = %d and cp_client = '%s'",
dbesc(datetime_convert()),
intval($r[0]['cp_id']),
dbesc($client)
@@ -169,7 +172,7 @@ function chatroom_leave($observer_xchan,$room_id,$client) {
dbesc($client)
);
if($r) {
- q("delete from chatpresence where cp_id = %d limit 1",
+ q("delete from chatpresence where cp_id = %d",
intval($r[0]['cp_id'])
);
}