[ALPHA] CoolnessChat (integrated AJAX chat) v0.4.1

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

[ALPHA] CoolnessChat (integrated AJAX chat) v0.4.1

Post by thetruecoolness »

MOD Title: CoolnessChat
MOD Description: A Chat add-on for phpBB2.0.x boards using AJAX. Fully integrated.
MOD Version: 0.4.1
Demo Forum http://thetruecoolness.com/forum/index.php
NOTE: You will have to register an account to try it out, and will not have access to the Mod or Admin panel. Not updated to latest yet has V0.4.0.
User Manual http://thetruecoolness.com/forum/viewtopic.php?t=4

REQUIRES
PHP >= 4.3
phpBB 2.0.22 (should work with older versions, but untested, and unsupported)

MOD Download:
Latest Version (before asking questions make sure you have the latest version installed)
Now includes empty logs folder, for those who can't use mkdir on their hosting.
CoolnessChat V0.4.1
MOD to upgrade from previous
Upgrade V0.4.0 to V0.4.1

IMPORTANT:

There is a syntax error in the MOD file for 0.4.1 (not sure if it's in the upgrade or not at the moment)

In the page_header.php edit make sure to put a semicolon (;) at the end of this excerpt.
$sql = 'SELECT u.user_allow_viewonline, c.*
FROM ' . CHAT_USERS_TABLE . ' c, ' . USERS_TABLE . ' u
WHERE logged_in
AND u.user_id = c.user_id'
Change Log

Code: Select all

##   2007-06-10 - Version 0.4.1 
##      - Fixes small bug in page_header
##      - Fixes PHP 5.0 only usage of parse_url in chat_admin_entry.
##      - Makes smilies hidden at first
##      - Hopefully fixes IE duplicate message bug.
##      - Fixes Multi-Byte string function support to ignore if not supported
##   2007-03-20 - Version 0.4.0
##      - Merged chatJS.php into chat.php, and created chat_js.tpl, chat_message_box.tpl
##        and chat_window_js.tpl
##      - Renamed chatSS.php to chat_css.php and created chat_css.tpl
##        also renamed auth_chat_ug_body.tpl to chat_auth_ug_body.tpl
##      - Updated stats to include both chat.php and AJAX, and includes average SQL
##        queries for both.
##      - Restructured many files to better reflect grouping of functions and commands.
##      - Moved autologout users and prune_pm functions to chat.php from page_header.php.
##      - Added many user options for setting chat style.
##      - Added ability for admins or users to turn off logout/login/join/leave 
##        messages.
##      - Added save log option to chat so users can save all messages since they
##        logged in (plus the max messages before that)
##      - Added in flood contol for updates and messages.
##      - Added new chat template to display chat over any page.  Also added both
##        admin and user option to choose which type to use for chat.
##      - Added in phpBB3's bbCode insertion JS code, so cursor will be in middle
##        of inserted bbCode.
##      - Added config option validation, and the ability for Admins to clear logs.
##      - Made Version a constant so user will know what version they are using.
##      - Small updates to IRC commands.
##      - Removed SQL query in get_messages in favor of keeping ignore list in SESSION
##      - Fixed bug in chat_logout.js by checking for error on getting opener.location.
##      - Fixed bug of users randomly getting logged out on initial load of chat. 
##        Hopefully, still not exactly sure what is causing this.
##      - Fixed bug of the same update being recieved more than once.
##   2007-03-06 - Version 0.3.3
##      - Fixed bug in chatJS.php in which turning off IRC Commands would cause 
##        messages to not send.
##      - Changed use of fprintf to PHP 4 functions sprintf and fwrite.
##   2007-03-06 - Version 0.3.2
##      - Bug that would truncate log clearing.  Fixed by always checking that the log
##        size retrieved is > 0
##      - Buggy support for international characters fixed, by using correct decoding on 
##        read. (messages are stored in binary)
##      - Fixed all SQL queries that use TRUE and FALSE to use 1 and 0 respectively
##        because TRUE and FALSE are not always guaranteed to be those values.
##      - Further validation of room_id in chat_response.
##   2007-03-04 - Version 0.3.1
##      - Fixed potential errors in response by sanitizing response taking out all
##        instances of CHAT_RESPONSE_SEPARATOR_x.
##   2007-03-03 - Version 0.3.0
##      - Added In private messaging support
##      - Fixed code errors reported by mEAL tool
##      - Cleaned up the code a bit and abstracted a few new functions
##      - Added in smiley display on chat room
##      - Hide BBcode and smilies based on forum setting
##      - Made all timestamps relative to users timezone, and formetted with their 
##        chosen formatting.
##      - Added in login/logout, and join/leave room messages
##      - Changed room bitfield to room bitstring to fix potential bug with rooms 
##        above 31.
##      - In javascript when user leaves room, data is kept eleminating the need
##        to retrieve it again.
##      - Changed user menu from ul and li tags, to div and input button tags to
##        make them show up in IE.
##      - Removed access log generation from chat_response.php
##   2007-02-18 - Version 0.2.1
##      - Fixed bug in ChatJS.php where parse_url used a PHP 5.1 only parameter.
##   2007-02-17 - Version 0.2.0
##      - Initial Alpha Testing release
This is an integrated chat for your phpBB board. It uses only AJAX so you users won't need any plugins to run it, just a modern browser (IE6+, FF1.5+, or Opera 9+) to run it. It features one click access to the chat for users already logged into your forum.

Screenshots from V0.4.0
Normal Chat ('Coolwave theme')
User Options ('Coolwave theme')
Windowed Chat Display ('Coolwave theme')
Chat Options ('Fiyah theme')
Style Options ('Fiyah theme')

Feature List:
Feel free to suggest new features, but realize it may take a while to integrate them
  • Multiple Chat rooms
    • Can only be created by admins.
    • Mods can be configured to be able to change room names.
  • Ability to be in multiple rooms at once with tabbed interface for switching
  • Per room permissions (like the forums)
    • So set a room to ADMIN only post and REG view for an announcement room.
  • Per group/user room permissions (again like the forums ACLs)
  • Only accessible by registered members
  • Full bbCode support
  • IRC like commands (use /help in chat to view)
  • User ignore feature
  • Ability to gag users as Mod or Admin
  • Promote or demote users to Room Mod with the user menu
  • Message history to remember your last 10 messages entered (refreshing the page empties this)
  • Auto Away feature to set users away after a certain time (set in Admin Panel)
  • Admin Panel for editing chat configuration (accessible in chat or ACP)
  • Board Admins are automatically chat Admins
    • Other users can be made Chat Admins
    • Chat admins who are not board admin can access Chat Admin panel in chat page.
    • Mod status does not carry over
  • Mod Panel in chat for unbanning and unkicking users and renaming rooms (if allowed)
  • Users can set their name color, and default text style, and display name
  • Highly responsive interface
  • Standards compliant css layout and HTML which uses theme colors (from DB)
  • Chat data automatically created on first entrance in Chat
  • Log files automatically created on first user entry to room
  • Log files never grow bigger than you want them to
  • Most actions can either be done in a user menu or through IRC commands
  • View user forum profile in user menu
  • Auto logout on window/tab close, or leaving the page (popups must be enabled)
  • Auto logout of users who haven't been in the chat for 5 minutes (for those unable to logout for some reason)
  • Auto set to away after inactivity (set in Admin Panel or User Options)
  • Temporary disabling of chat (similar to disable board)
  • Set number of previous messages scene on entry to chat to keep users up on conversation.
  • Keeps bandwidth, page load, and sql queries statistics on AJAX and main page of chat.
  • Keeps access log of user and room to diagnose problems.
  • Installs with EasyMOD on a new board
  • Passed mEAL
  • Private messaging support (like IM)
  • Smiley display
  • Supports most foreign characters
  • Users can make their own styles and save their color choices
  • Many user options
  • Three different display styles (Full page header, simple header, or a resizeable div Window over an Iframe browser.
Style Integration
The chat uses the DB entry of the users theme to draw the default colors for all parts.
tr_color2 is the background for the chat area and user lists
tr_color3 is the background for unselected buttons and the user options panel
body_link is the background for selected items and the room list
fontcolor3 is the foreground for selected items
th_color2 is the border color for various items
body_text is used as the default for the text box though it's overwriten by the user selected text_color

So if your style has not set these it will look like subSilver.
All the rest of the styling is done in chat_css.php and the colors are set up in chat.php. Users can define their own colors.

KNOWN BUGS/ISSUES
Newly made Mods must refresh their browser in order to get their powers as these are not transferred over AJAX, same with Admins.
Some style and general options require refresh to take effect.
-- Chat Height, Display Style, and some style colors.

IE6
  • Resizing the Windowed chat is somewhat buggy. Not recommended. Minimize, maximize and move work fine though.
  • No hovers
  • Add room will sometimes not include name.
Opera
  • Ctrl + enter will not put newline in.
Javascript
  • /join IRC command is buggy. Not sure why, since it should be the same as selecting a room. So it has been disabled.
  • Autoaway sometimes stops working, or will set people away too soon. This can be turned off by the user.
I've been testing this on a small board for a couple of weeks and most features are working. So let me know what you think of it and if you encounter any bugs. Sending me the error_log.txt file in chat/logs/ will help me diagnose problems.

Road Map
version - anticipated release date (subject to change)
0.3.0 - 03/03/07 - RELEASED |||||||||| 100%
  • Add Private Messaging Support |||||||||| 100%
  • Add smiley popup similar to forum one |||||||||| 100%
  • Display Login/Logoff messages in room |||||||||| 100%
0.4.0 - 03/24/07 - RELEASED |||||||||| 100%
  • Make chat able to be displayed on any phpBB page not just it's own. ||||||||| 100%
  • Make user able to style the chat colors and save their style settings. |||||||||| 100%
  • Allow users to save log since entering room plus 5 minutes before that (admin configurable). Include option to turn off as well. |||||||||| 100%
  • Add admin options for message style in chat (bbCode, HTML, and smilies) |||||||||| 100%
  • Add in flood control for all updates by queuing them in SESSION vars |||||||||| 100%
  • Updates statistics including both AJAX page and chat.php, and average SQL queries for both |||||||||| 100%
  • Code and SQL cleanup and restructuring |||||||||| 100%
0.5.0 - Sometime soon |||||||||| 40%
  • Make guest able to view the chat |||||||||| 0%
    • Kick guests out if a member wants to join and max concurrent users has been past
    • Update room permissions to include ALL
  • MultiBBCode optional integration. |||||||||| 0%
  • Admin Theme panel for creating chat themes |||||||||| 80%
  • Sound support and sound packs (hopefully, will require user to have QuickTime plugin installed) |||||||||| 20%
0.6.0 [BETA]
  • Documentation release.
  • Export/Import of Chat themes, images and sound packs.
  • Simplified chat template for insertion on any page.
  • Simplification of chat theme creation, with possible addition of background images for each element.
I will be working on documentation throughout, but will plan to make
  • User documentation pointing out how to use all features and keyboard shortcuts
  • Admin Panel documentation including explaining what all config options do
  • Mod Panel documenatation
  • Developer documentation including how to customize, full explanation of DB tables, files, and how to edit the chat.tpl file and JS file
1.0.0 [RC]
  • Nothing new in this version, just code and bug fixes from previous
Edit History:
07/15/07 - Important error found. Also removed release dates until I get back on track with this.
06/10/07 - Put up version 0.4.1 and update, and updated release dates, Sorry about all the delays, but I got really sidetracked with some other things and am slowly getting back into updating this.
05/08/07 - Updated progress on 0.5.0, and some release dates.
04/25/07 - Updated release dates, as some things are taking longer than planned, and I have been moving recently, and job hunting
04/01/07 - Updated some release dates and put up date for initial release version.
03/24/07 - Released V0.4.0 and update and updated page to reflect that.
03/18/07 - Updated release dates, put some new features in V0.5.0
Last edited by thetruecoolness on Sun Jul 15, 2007 10:08 pm, edited 53 times in total.
enderandrew
Registered User
Posts: 71
Joined: Thu Nov 30, 2006 7:55 am
Location: Omaha, NE
Contact:

Post by enderandrew »

Looks promising, but I'll probably wait a release or two before I give it a try.
Nihilism makes me smile.
User avatar
MasterHand
Registered User
Posts: 170
Joined: Sat Jun 17, 2006 6:34 pm
Location: includes/functions_user.php

Post by MasterHand »

Great mod, i'll wait a release or two...
But, i might as well try it out :) .
One more thing....No support via PM!
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

Post by thetruecoolness »

Well over the next couple of days I'll be setting up a test forum, just have to make sure people can see the Admin and mod panel without being able to change things. But all the features are working besides the mentioned bugs. If you have EasyMOD should be an easy install, and uninstall as all chat data is kept in separate DB tables. This way to uninstall you just delete the chat php, tpl and js files and the logs, drop the phpbb_chat_ tables, and undo the changes to the files. So this doesn't mess with any forum DB tables, and mainly just adds things to the existing phpBB files (only a couple of replace with instructions and half of those are optional bbCode parsing fixes).

But by mid next week expect a demo forum to try out the chat.

Oh and also as an added security measure forum admins can always administer the chat, so if you ever get kicked somehow by a malicious chat admin you can still configure the chat and get back in. Also Chat admins do not have access to the forum Admin panel, only the chat admin panel through the chat.

So you should have no trouble getting it up and running, and it's fairly easy to uninstall.
Infamy
Registered User
Posts: 21
Joined: Mon Jan 16, 2006 11:24 pm
Location: Illinois
Contact:

Post by Infamy »

Just installed this on my forum, really was looking forward to it. But im using Firefox 2.0.0.1 and ie7 and when i go to the chat.php page and i go down and try clicking on admin panel nothing happends.

EDIT - Well now i found out that i cant send messages in chat room, i cant switch rooms well basically i cant do anything that involves javascript lol

really like the idea though, hopefully problem can be fixed cause i really want to use this :D
~One Love.
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

Post by thetruecoolness »

Well that's wierd as I have Firefox 2.0.0.1, and it always works for me, and on the forum I have it installed on others have been able to use it. Do you get any errors in your Javascript console? Also are you sure you have Javascript enabled? Since this is AJAX javascript must be enabled and running.

Also look in the chat/logs folder and see if there is an error_log.txt file. If there is could you post the contents.

I'm really not sure what would cause it to not work, unless maybe you missed something on the install.

Well if you can give me any errors you get that would be helpful.

Like I said I'll try to setup a demo forum for it over the next couple of days, but it really should work right out of the box. Are you sure the chat folder is in the root of your forum directory (ie forum/chat) and chat.php is in the root folder (/forum).
Last edited by thetruecoolness on Sun Feb 18, 2007 9:01 am, edited 3 times in total.
Peter77sx
Registered User
Posts: 3260
Joined: Wed Nov 09, 2005 2:51 pm

Post by Peter77sx »

Very nice here. Will be watching this. :D
Infamy
Registered User
Posts: 21
Joined: Mon Jan 16, 2006 11:24 pm
Location: Illinois
Contact:

Post by Infamy »

thetruecoolness wrote: Well that's wierd as I have Firefox 2.0.0.1, and it always works for me, and on the forum I have it installed on others have been able to use it. Do you get any errors in your Javascript console? Also are you sure you have Javascript enabled? Since this is AJAX javascript must be enabled and running.

Also look in the chat/logs folder and see if there is an error_log.txt file. If there is could you post the contents.

I'm really not sure what would cause it to not work, unless maybe you missed something on the install.

Well if you can give me any errors you get that would be helpful.

Like I said I'll try to setup a demo forum for it over the next couple of days, but it really should work right out of the box. Are you sure the chat folder is in the root of your forum directory (ie forum/chat) and chat.php is in the root folder (/forum).


Javascript is enabled in firefox and ie7. Im not getting any errors, only thing i have found was in ie7 which is the following.

Line : 265
Char : 1
Error : Object Expected
Code : 0
URL : http://urbanblock.net/chat.php

i also looked for a error_log.txt in chat/logs but its not there. only there is chat1-0 and chat 1-1

i went over install file and re did the steps and everything is done and yeah the files are in its place.

Forum index -> http://urbanblock.net/forum.php
Chat Folder - http://urbanblock.net/chat/
Chat File - > http://urbanblock.net/chat.php
~One Love.
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

Post by thetruecoolness »

Well I tried to signup at your site but getting an error saying

The confirmation code you entered was incorrect

I imagine because the register image with the code is missing.

I honestly can't think of a reason it's not working at the moment though check the /chat/chatJS.php file and see what it outputs. It might not be outputting the Javascript correctly (though this should lead to errors showing up in the Javascript console). Also I would be curious to see the source of the chat.php page when it's output. I know on my local install of it on a new and empty version of phpBB 2.0.22 I get no errors in IE6, FF2.0.0.1 or Opera9. I was able to look at your chatJS.php file and it looks like it's being generated correctly, and the chat_response.php file gave the correct feedback. So the only think I can think of is that something isn't getting included right on the chat.php page (might not be including the chatSS.php either).

From the sounds of it, it did install correctly, but even if the AJAX page (chat_response.php) wasn't working, you should still be able to see the Admin panel (it pops up in an iframe in the current window).
Last edited by thetruecoolness on Sun Feb 18, 2007 10:07 am, edited 1 time in total.
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

Wow, looks great! :)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
Infamy
Registered User
Posts: 21
Joined: Mon Jan 16, 2006 11:24 pm
Location: Illinois
Contact:

Post by Infamy »

Ill go and install it on a fresh phpBB and see if it works there but until then heres my chat.php output

http://urbanblock.net/chat.txt

BTW on firefox error im getting

unterminated string literal
[Break on this error] document.getElementById('profile_window_frame').src = '<br />\n

chatJS.php Line 1139

PSS - also started to get these with firebug


show_user_options is not defined
onclick(click clientX=0, clientY=0)

toggle_timestamp is not defined
onclick(click clientX=0, clientY=0)

mostly on everything i click on is not defined
Last edited by Infamy on Sun Feb 18, 2007 10:34 am, edited 2 times in total.
~One Love.
Infamy
Registered User
Posts: 21
Joined: Mon Jan 16, 2006 11:24 pm
Location: Illinois
Contact:

Post by Infamy »

delete
~One Love.
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

Post by thetruecoolness »

Well that looks correct too. I guess the next question is are their statfiles in the chat/log folder. Called stat_date.dat. If not this means that something is likely wrong in the chat_response.php.

From what I've seen I really don't see what the problem would be. Well if you get registration working on your site I would like to sign up and take a look at the chat, see if maybe it won't give me a Javascript error or something. One thing you might want to do is in the Javascript find the line

Code: Select all

			//debug.innerHTML += readRequest.responseText;
and uncomment it making it

Code: Select all

			debug.innerHTML += readRequest.responseText;
This way when you send a message or something you can see what the AJAX page sends back.

Beyond that I'll just have to see what happens when I make the demo board. This is a most unexpected error, and unfortunately nothing seems to be wrong with the install.

EDIT

Hmm I think I found the error

Code: Select all

	document.getElementById('profile_window_frame').src = '<br />
<b>Warning</b>:  parse_url() expects exactly 1 parameter, 2 given in <b>/homepages/4/d156293099/htdocs/chat/chatJS.php</b> on line <b>1434</b><br />
profile.php?mode=viewprofile&simple_header=1&u=' + id;
Did not realize the second parameter of parse_url was php 5.1 or greater only. I'll get on fixing that tomorrow. Though I went through all the PHP functions I used, I did not check all the parameters thoroughly. So I'll get this fixed by tomorrow and reupload the file, and post the fix here.

The fix is

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
chat/chatJS.php

#
#-----[ FIND ]------------------------------------------
#
	 if (strlen(parse_url($profile_url, PHP_URL_QUERY)) <= 0)

#
#-----[ REPLACE WITH ]------------------------------------------
#
	 $url_parts = parse_url($profile_url);
	 if (strlen($url_parts['query']) <= 0)
Last edited by thetruecoolness on Sun Feb 18, 2007 10:49 am, edited 1 time in total.
Infamy
Registered User
Posts: 21
Joined: Mon Jan 16, 2006 11:24 pm
Location: Illinois
Contact:

Post by Infamy »

thetruecoolness wrote: Well that looks correct too. I guess the next question is are their statfiles in the chat/log folder. Called stat_date.dat. If not this means that something is likely wrong in the chat_response.php.

From what I've seen I really don't see what the problem would be. Well if you get registration working on your site I would like to sign up and take a look at the chat, see if maybe it won't give me a Javascript error or something. One thing you might want to do is in the Javascript find the line

Code: Select all

			//debug.innerHTML += readRequest.responseText;
and uncomment it making it

Code: Select all

			debug.innerHTML += readRequest.responseText;
This way when you send a message or something you can see what the AJAX page sends back.

Beyond that I'll just have to see what happens when I make the demo board. This is a most unexpected error, and unfortunately nothing seems to be wrong with the install.

EDIT

Hmm I think I found the error

Code: Select all

	document.getElementById('profile_window_frame').src = '<br />
<b>Warning</b>:  parse_url() expects exactly 1 parameter, 2 given in <b>/homepages/4/d156293099/htdocs/chat/chatJS.php</b> on line <b>1434</b><br />
profile.php?mode=viewprofile&simple_header=1&u=' + id;
Did not realize the second parameter of parse_url was php 5.1 or greater only. I'll get on fixing that tomorrow. Though I went through all the PHP functions I used, I did not check all the parameters thoroughly. So I'll get this fixed by tomorrow and reupload the file, and post the fix here.


yep thats it :) i temporarily made

$profile_url .= '&mode=viewprofile&simple_header=1&u=';

and everything works, and btw......wow on the mod cant wait to start customizing it :P
~One Love.
thetruecoolness
Registered User
Posts: 94
Joined: Sat Feb 17, 2007 6:32 am
Location: GA
Contact:

Post by thetruecoolness »

Well I'm glad you finally got it to work. A word of warning on customizing is that any changes you make to the chat.tpl, may require changes to the chatJS.php to work. This is because some of the same HTML structures are duplicated in the JS when it receives data from the server (to reduce data sent messages and userlist updates are sent as delimited text and not HTML).

So if you change the room tabs, user list container, chat room container or anything in it, make sure to edit the appropriate Javascript to create the same structure on the JS using DOM methods and not innerHTML property. Using innerHTML tends to cause the page to flash sometimes, and can steal focus from textbox. Of course this is mainly on an element that is already in the DOM, not for one you are creating before you add it to the DOM.

I'll write up some documentation on this eventually. Basically I would stick to editing the chatSS.php for right now, unless you really need to edit the chat.tpl.

Well for everyone else the new version is available, along with a small MOD file for if you downloaded the initial version for how to upgrade.
Post Reply

Return to “[2.0.x] MODs in Development”