From 79d3c716e38084beab01d34a5f49a5aee7e72526 Mon Sep 17 00:00:00 2001 From: Snap Date: Sat, 25 Apr 2015 22:30:21 -0700 Subject: Some work on the Chat. Fixed bug where user could chat as "SERVER" --- pages/chat.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'pages/chat.php') diff --git a/pages/chat.php b/pages/chat.php index a1870a6..4f10a1c 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -22,6 +22,7 @@ if (!$accepted) { var lastID = 1; //Internet Explorer doesn't support "const" //CONSTANTS: ... +var channelTimerDelay = 30000; var chatTimerDelayUpper = 9000; var chatTimerDelayLower = 2000; var chatTimerDelayDefault = 5000; @@ -45,6 +46,13 @@ function getChatTimer() { //addChatMessage("Debug", "Chat timer called!"); } +pollChannelListTimer(); +function pollChannelListTimer() { + setTimeout("pollChannelListTimer()", channelTimerDelay); + + pollChannelList(); +} + var firstGetChat = true; function getChatDone(data) { var newChats = false; @@ -288,7 +296,7 @@ function pollChannelListDone(data) { function channelListShow(JO) { console.log("Formating channelList"); - var p = ""; + var p = "
"; console.log('beginloop'); @@ -303,9 +311,11 @@ function channelListShow(JO) { styleClass = 'border-top: 6px solid #777799;'; } } - + + // u.secFromLastActive could be used in here someplace.. + if (u.wallEmblem == undefined) u.wallEmblem = 'blank.png'; - p = p+ ""; + p = p+ ""; p = p+ ""; + p = p+ ""; p = p+ "
"; p = p+ "
"; @@ -408,7 +418,7 @@ $(function() { function onChatWindowShown() { chatTimerDelay = chatTimerDelayDefault; - getChatTimer(); + getChat(); } function onChatWindowHidden() -- cgit v1.2.3 From e90a8d192446fce277dc3efe4f2913d5fecca0dc Mon Sep 17 00:00:00 2001 From: Snap Date: Tue, 28 Apr 2015 15:53:05 -0700 Subject: Chat improvements. Fixed "&P" or ";P" bug. Reduced size of chat-request size considerably with use of header_remove(); --- ajax/chat.ajax.php | 1 + includes/chats.php | 1 + pages/chat.php | 18 +++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'pages/chat.php') diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index 576ab39..2ffa878 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -6,6 +6,7 @@ session_start(); // exit; // } +header_remove(); //ini_set('display_errors',1); //ini_set('display_startup_errors',1); diff --git a/includes/chats.php b/includes/chats.php index 5bfd61f..d9616fd 100644 --- a/includes/chats.php +++ b/includes/chats.php @@ -160,6 +160,7 @@ function getChannelList($channel = 1) { chatUsers.dateEntered, TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateLastActive)) as secFromLastActive, + TIME_TO_SEC(TIMEDIFF(NOW(), chatUsers.dateEntered)) as secFromEntered, TIME_TO_SEC(TIMEDIFF(NOW(), users.dateChatGaggedUntil)) as secSinceGagged, chatUsers.isAdmin, diff --git a/pages/chat.php b/pages/chat.php index 4f10a1c..cc8d0eb 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -46,12 +46,13 @@ function getChatTimer() { //addChatMessage("Debug", "Chat timer called!"); } -pollChannelListTimer(); -function pollChannelListTimer() { - setTimeout("pollChannelListTimer()", channelTimerDelay); - pollChannelList(); -} +var pollChannelListTimer = setInterval(function () {pollChannelList()}, channelTimerDelay); +// pollChannelListTimer(); +// function pollChannelListTimer() { + // setTimeout("pollChannelListTimer()", channelTimerDelay); + // pollChannelList(); +// } var firstGetChat = true; function getChatDone(data) { @@ -212,7 +213,7 @@ function replaceSmileys(chat) { chat = chat.replace(/\:d/gi, ''); chat = chat.replace(/\:o/gi, ''); chat = chat.replace(/\:p/gi, ''); - chat = chat.replace(/;p/gi, ''); + chat = chat.replace(/;p/gi, ''); chat = chat.replace(/\:c/gi, ''); chat = chat.replace(/\:s/gi, ''); chat = chat.replace(/\>_\</g, ''); @@ -314,8 +315,11 @@ function channelListShow(JO) { // u.secFromLastActive could be used in here someplace.. + var dateEntered = new Date(); + dateEntered.setTime(dateEntered.getTime() + u.secFromEntered * 1000); + if (u.wallEmblem == undefined) u.wallEmblem = 'blank.png'; - p = p+ "
"; p = p+ "
"; -- cgit v1.2.3 From e6b60448bc08df316daf220db8ecfddc58aefe84 Mon Sep 17 00:00:00 2001 From: Snap Date: Fri, 1 May 2015 16:25:28 -0700 Subject: Minor fixes and adjustments. Moved Javascript in chat to: js/chat.js re-ordered script loading so Jquery loads first. Fixed cookie login issue. --- ajax/chat.ajax.php | 4 +- globe.php | 3 +- includes/header.php | 11 +- index.php | 42 +++-- js/chat.js | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++ js/globe.js | 30 ++++ js/mapspecs.js | 28 ---- pages/chat.php | 441 +--------------------------------------------------- 8 files changed, 501 insertions(+), 488 deletions(-) create mode 100644 js/chat.js (limited to 'pages/chat.php') diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index 2ffa878..036efad 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -72,10 +72,8 @@ $use_psuedo_longpoll = true; // } require_once('../includes/chats.php'); - -//exit; - enterChannel($userID); + $sent = false; //User is sending a message diff --git a/globe.php b/globe.php index fe7123b..5abff5f 100644 --- a/globe.php +++ b/globe.php @@ -98,7 +98,8 @@ function CookieLogin() { $_SESSION['displayName'] = $display; $_SESSION['dateJoined'] = $dateJoined; if ($isAdmin == 1) $_SESSION['isAdmin'] = true; - header("Location: $mydomain"); + // There should be no reason to re-load the page. + //header("Location: $mydomain"); } else { setcookie("doLogin", "lastAttemptFailed"); setcookie("userID", ""); diff --git a/includes/header.php b/includes/header.php index cb34fac..427a57d 100644 --- a/includes/header.php +++ b/includes/header.php @@ -22,18 +22,21 @@ function htmlHeader($css = array(), $title = 'Pathery', $desc = '', $scripts = a -\n"; } - if ($desc !== '') echo " "; - - foreach ($scripts as $s) echo ""; ?> +"; + + foreach ($scripts as $s) echo ""; +?> + - -

Pathery Chat - BETA

-- cgit v1.2.3