summaryrefslogtreecommitdiffstats
path: root/ajax_chat.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-01-27 03:24:41 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-01-27 03:24:41 -0800
commit4cee17dab4a1d4902c3fad250575db363ec6f478 (patch)
tree5ef17f0ae1f2dea8e811fbbd872b511899253ae1 /ajax_chat.php
parentfefa99bd448312e13e840f47ef8ce4dfd1645211 (diff)
downloadpathery-4cee17dab4a1d4902c3fad250575db363ec6f478.tar.xz
ajax chat moved. loading.gif added - not sure if we'll use it.
Diffstat (limited to 'ajax_chat.php')
-rw-r--r--ajax_chat.php84
1 files changed, 0 insertions, 84 deletions
diff --git a/ajax_chat.php b/ajax_chat.php
deleted file mode 100644
index 2b6d909..0000000
--- a/ajax_chat.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?
-session_start();
-session_write_close();
-//Just doing this as evidence that $_SESSION as read-only is still available.
-$userID = $_SESSION['userID'];
-
-include('includes/chats.php');
-
-$sent = false;
-
-if ($_REQUEST['messages']) {
- $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) {
- //Wait .2 seconds
- usleep(200000);
- //echo "yesSent";
- for( $i = 1; $i < 3; $i++) {
- //echo "loop";
- $data = getChat($getChatID);
- if ($data !== false) {
- //$data['debug'][] = "Count times: $i";
- //$data['debug'][] = "Count value:".count($data);
- echo prepareChatData($data);
- exit;
- }
- //Wait .1 seconds
- usleep(100000);
- }
- }
- //echo "reachedEnd";
- $json = prepareChatData(getChat($getChatID));
- echo $json;
- exit;
-}
-
-function prepareChatData($data) {
- if ($data) {
- foreach($data as &$user) {
- //$user['message'] = $user['message'].'write-append';
- $user['secondsSince'] = strtotime($user['dateSent']) - strtotime("now");
- }
- return json_encode($data);
- }
- return $data;
-}
-
-
-
-function chatFilter($chat) {
- //cuss words
- $chat = str_replace("fuck you", "i am moron", $chat);
- $chat = str_replace("fuck", "dumb", $chat);
-
- $chat = str_replace("asshole", "dumb", $chat);
- $chat = str_replace("damnit", "dumb", $chat);
- $chat = str_replace("damn", "dumb", $chat);
- $chat = str_replace("cunt", "dumb", $chat);
- $chat = str_replace("shit", "dumb", $chat);
- $chat = str_replace("bitch", "dumb", $chat);
- $chat = str_replace("sucks ass", "is dumb", $chat);
- $chat = str_replace("suck ass", "is dumb", $chat);
- $chat = str_replace("stfu", "shutup", $chat);
- $chat = str_replace("omfg", "omg", $chat);
- $chat = str_replace("fuk", "dumb", $chat);
- return $chat;
-}
-
-
-
-
-?> \ No newline at end of file