summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorSnap <snapwilliam@gmail.com>2015-04-25 22:30:21 -0700
committerSnap <snapwilliam@gmail.com>2015-04-25 22:30:21 -0700
commit79d3c716e38084beab01d34a5f49a5aee7e72526 (patch)
treef71ed377e66fa2f4447e331eb5dd44bc701626b1 /includes
parente0979d05a26ee14ac20f3e8bc3a4f358a25041f4 (diff)
downloadpathery-79d3c716e38084beab01d34a5f49a5aee7e72526.tar.xz
Some work on the Chat.
Fixed bug where user could chat as "SERVER"
Diffstat (limited to 'includes')
-rw-r--r--includes/chats.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/chats.php b/includes/chats.php
index 47ecd39..5bfd61f 100644
--- a/includes/chats.php
+++ b/includes/chats.php
@@ -108,6 +108,7 @@ function enterChannel($userID, $channel = 1) {
$stmt->bind_param('ii', $userID, $channel);
$stmt->execute();
$stmt->close();
+ cleanupChannel();
return;
}
@@ -122,6 +123,14 @@ function exitChannel($userID, $channel = 1) {
return;
}
+//User leaves the channel
+function cleanupChannel($channel = 1) {
+ global $mysqli;
+
+ $mysqli->query("DELETE FROM `chatUsers` WHERE TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateLastActive)) > 800");
+ return;
+}
+
function channelListUpdated($timeStamp) {
global $mysqli;
@@ -150,7 +159,8 @@ function getChannelList($channel = 1) {
chatUsers.userID as 'ID',
chatUsers.dateEntered,
- TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateLastActive)) as dateLastActive,
+ TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateLastActive)) as secFromLastActive,
+ TIME_TO_SEC(TIMEDIFF(NOW(), users.dateChatGaggedUntil)) as secSinceGagged,
chatUsers.isAdmin,
chatUsers.isMod,
@@ -160,9 +170,11 @@ function getChannelList($channel = 1) {
users.wallColor,
users.wallEmblem,
users.wallOrientation
+
FROM `chatUsers`
LEFT JOIN `users`
ON chatUsers.userID = users.ID
+ WHERE TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateLastActive)) < 300
ORDER BY chatUsers.isMod DESC, chatUsers.dateEntered ASC
");