diff options
Diffstat (limited to 'ajax')
-rw-r--r-- | ajax/chat.ajax.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index 3ca15c6..239cc1c 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -4,23 +4,44 @@ session_write_close(); //Just doing this as evidence that $_SESSION as read-only is still available.
$userID = $_SESSION['userID'];
+$chatLockDown = false;
+// STOP CHAT?
+//$chatLockDown = true;
+
require('../includes/chats.php');
$sent = false;
if ($_REQUEST['messages']) {
+ $date = isMuted($userID);
+ if ($date !== false) {
+ $r[0]['error'] = 'Muted';
+ $r[0]['serverMessage'] = 'true';
+ $r[0]['message'] = 'You have been muted; You are muted until '.$date." (The current time is: ".date("Y-m-d H:i:s").")";
+ $r[0]['secondsSince'] = 0;
+ $r[0]['displayName'] = 'SERVER';
+ echo json_encode($r);
+ exit;
+ }
+ if ($chatLockDown == true AND $_SESSION['isAdmin'] !== true) {
+ $r[0]['error'] = 'Lockdown';
+ $r[0]['serverMessage'] = 'true';
+ $r[0]['message'] = 'Chat Lockdown has been activated. Messages are not being accepted';
+ $r[0]['secondsSince'] = 0;
+ $r[0]['displayName'] = 'SERVER';
+ echo json_encode($r);
+ exit;
+ }
+
$messages = $_REQUEST['messages'];
$messages = explode("|:|", $messages);
foreach ($messages as $message) {
$message = chatFilter(stripslashes($message));
$insertID = addchat($userID, $message);
}
-
$sent = true;
- //echo "IID:$insertID:";
}
-
if ($_REQUEST['getChatFromID']) {
$getChatID = $_REQUEST['getChatFromID'];
if ($sent) {
@@ -40,11 +61,11 @@ if ($_REQUEST['getChatFromID']) { usleep(100000);
}
}
- //echo "reachedEnd";
$json = prepareChatData(getChat($getChatID));
echo $json;
- exit;
}
+exit;
+
function prepareChatData($data) {
if ($data) {
@@ -58,7 +79,6 @@ function prepareChatData($data) { }
-
function chatFilter($chat) {
//cuss words
$chat = str_replace("fuck you", "i am moron", $chat);
|