ElkArte Ajax ChatIntegrates the
Blueimp´s AJAX-Chat 0.8.8 (https://github.com/Frug/AJAX-Chat) into your ElkArte Forum
Addon: ElkArte Ajax Chat
Version: 1.0.1
Author: wintstar
Language: german informell, english
Themes: Elkarte, Light and Be Social!
ElkArte version: 1.0.6
Download: click here (http://scaricare.de/index.php/downloads)
Plugin: BlueFeeling Theme Plugin (http://scaricare.de/index.php/13-elkarte/4-bluefeeling-theme-plugin)
Description:
This this is a port of my mod SMF Ajax Chat. The AJAX Chat is latest version and was further adapted to ElArte. Many Thanks an Emanuel and Spuds for help. It is no longer possible, if a user does not have the necessary permissions to access with a direct link to the Ajax Chat on this. Also, it is not possible, if the Board in maintenance mode to access the AJAX Chat. Permissions can be now individually configured for the Member groups. Chat moderation can also individually be configured.
AJAX Chat Features:
- Usable as shoutbox
- Multiple channels
- Private messaging
- Private channels
- Invitation system
- Kick/Ban or Ignore offending Users
- Online users list with user menu
- Emoticons/Smilies
- Easy way to add custom emoticons
- BBCode support
- Optional Flash based sound support
- Optional visual update information (changing window title)
- Clickable Hyperlinks
- Splitting of long words to preserve chat layout
- Flood control
- Possibility to delete messages inside the chat
- IRC style commands
- Easy interface to add custom commands
- Possibility to define opening hours for the chat
- Possibility to enable/disable guest users
- Persistent client-side settings
- Multiple languages (auto-detection of ACCEPT_LANGUAGE browser setting)
- Multiple styles with easy layout customization through stylesheets (CSS) and templates
- Automatic adjustment of displayed time to local client timezone
- Standards compliance (XHTML 1.0 strict)
- Accepts any text input, including code and special characters
- Multiline input field with the possibility to enter line breaks
- Message length counter
- Realtime monitoring and logs viewer
- Support for unicode (UTF-8) and non-unicode content types
- Bandwidth saving update calls (only updated data is sent)
- Optional support to push updates over a Flash based socket connection (increased performance and responsiveness)
- Survives connection timeouts
- Easy integration into existing authentication systems
- Separation of layout and code
- Well commented Source Code
- Developed with Security as integral part - built to prevent Code injections, SQL injections, Cross-site scripting (XSS), Session stealing and other attacks
- Tested successfully with Microsoft Internet Explorer, Mozilla Firefox, Opera and Safari - built to work with all modern browsers :)
ElkArte Addon Functions
- AJAX Chat Tips in Administrator-Center for further configuration options Blueimp AJAX Chat
Shoutbox
- Enable shoutbox above at the Board Categories*
- Enable shoutbox below at Board Categories*
Chat
- Enable chat functions*
- New Style "ElkLight, ElkBeSocial!" for Blueimp Ajax Chat
Users in chat
- Display in the menu next to the chat button, the number of users there are in the chat online?*
- Display "Who members are in the chat online?"*
* Can be in the Administrator-Center enables / disables.
Permissions, individually for each group
- Can administer the Chat
- Can moderate the Chat
- Can see the Chat
- Can submit messages in the shoutbox
- Can "Who is on chat online?" look at
Changelog 1.0.1
Bug fixed
- "datetime", appears in MySQL databases versions 5.5.32-5.5.42
- Activation Button the chat page is missing from the configuration of the Ajax Chat
- Shoutbox text input field runs in mobile view from the "div"
Planned Functions for ElkArte Addon
- Configuration of Blueimp AJAX chat in Administrator-Center
- Template valid
(http://validator.w3.org/images/valid_icons/valid-xhtml10)
Planned debugging in the future
- Solution for the bug 'AJAX_CHAT_BANNED' of the AJAX chat
- Solution for the bug 'Login/Logout' of the AJAX chat
If not implemented
- Activate shoutbox above the Board categories on all sides
- Call Chat as a popup
This modification is subject to the licenses
Screenshots:
Looks AWESOME !
Great job! :D
I have a probleme with the adminarea. The Configuration section of the chat is not displayed. Hook
integrate_admin_areas and
integrate_sa_modify_modifications are installed.
What have I overlooked?Chat.integrate.php
public static function integrate_admin_areas(&$admin_areas)
{
global $txt;
loadlanguage('Chat');
$admin_areas['config']['areas']['addonsettings']['subsections']['chat'] = array($txt['chat']);
}
public static function integrate_sa_modify_modifications($sub_actions)
{
$sub_actions['chat'] = array(
'dir' => SUBSDIR,
'file' => 'Chat.subs.php',
'function' => 'ModifyChatSettings'
);
}
Chat.subs.php
<?php
/**
* ElkArte Ajax Chat
*
* @author wintstar
* @license BSD http://opensource.org/licenses/BSD-3-Clause
* @license Bluimp's AJAX Chat is released under a Modified MIT License (MIT) https://raw.githubusercontent.com/Frug/AJAX-Chat/master/chat/license.txt
*
* @version 0.0.1beta
*/
if (!defined('ELK'))
die('No access...');
/**
* ModifyChatSettings()
*
* - Defines our settings array and uses our settings class to manage the data
*/
function ModifyChatSettings()
{
global $txt, $scripturl, $context;
loadlanguage('Chat');
$context[$context['admin_menu_name']]['tab_data']['tabs']['chat']['description'] = $txt['chat_desc'];
// Lets build a settings form
require_once(SUBSDIR . '/SettingsForm.class.php');
// Instantiate the form
$chatSettings = new Settings_Form();
$config_vars = array(
array('check', 'shoutabove_enabled'),
array('check', 'anypageshout_enabled'),
array('check', 'shoutbelow_enabled'),
array('check', 'chatpage_enabled'),
array('check', 'chatpopup_enabled'),
array('check', 'chatbutton_enabled'),
array('check', 'chatheader_enabled'),
array('check', 'chatuser_enabled'),
);
// Load the settings to the form class
$chatSettings->settings($config_vars);
// Saving?
if (isset($_GET['save']))
{
checkSession();
Settings_Form::save_db($config_vars);
redirectexit('action=admin;area=addonsettings;sa=chat');
}
// Continue on to the settings template
$context['post_url'] = $scripturl . '?action=admin;area=addonsettings;save;sa=chat';
$context['settings_title'] = $txt['chat'];
Settings_Form::prepare_db($config_vars);
return;
}
You are not using a class, so it's useless to use "public static function", use just "function" (even though I would suggest you to wrap these functions into a class because in the future it will become handy).
Actually, if this is exactly what you have in the file, it should generate a syntax error, so most likely you have a:
class Something
{
public static function integrate_admin_areas(
[...]etc.
In that case, the "hook" should be:
Something::integrate_admin_areas
I have this change. But, not work. Hooks are all in green display. All active.
sources/ChatIntegrate.php
<?php
/**
* ElkArte Ajax Chat
*
* @author wintstar
* @license BSD http://opensource.org/licenses/BSD-3-Clause
* @license Bluimp's AJAX Chat is released under a Modified MIT License (MIT) https://raw.githubusercontent.com/Frug/AJAX-Chat/master/chat/license.txt
*
* @version 0.0.1beta
*/
if (!defined('ELK'))
die('No access...');
function ias_chat(&$actions)
{
$actions['chat'] = array('Chat.controller.php', 'Chat_Controller', 'action_chat');
}
function ica_chat(&$current_action)
{
if ($current_action === 'chat')
{
if (empty($_REQUEST['action']))
$current_action = 'chat';
}
}
function imp_chat(&$buttons, &$menu_count)
{
global $context, $txt, $boardurl, $scripturl;
loadLanguage('Chat');
function chatOnlineUsers(){
global $scripturl, $txt, $user_info, $modSettings;
$db = database();
$userIDs = array();
$request = $db->query('', '
SELECT userID
FROM {db_prefix}chat_online WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)' ,
array()
);
while ($row = $db->fetch_assoc($request)) {
array_push($userIDs, $row['userID']);
}
$db->free_result($request);
return array_unique($userIDs);
}
$num = !empty($modSettings['enableChatButtonNo']) ? 0 : count(chatOnlineUsers());
$chatButton = $txt['chat_index'];
$chatButton .= ($num > 0) ? ('('.$num.')') : '';
$buttons = elk_array_insert($buttons, 'unread', array(
'chat' => array(
'title' => $chatButton,
'href' => $scripturl . '?action=chat',
'data-icon' => '',
'show' => $context['allow_admin'],
),
));
}
function ihp_chat()
{
// Load the Chat Help file.
loadLanguage('Chat');
}
function iaa_chat(&$admin_areas)
{
global $txt;
loadlanguage('Chat');
isAllowedTo('admin_forum');
$admin_areas['config']['areas']['addonsettings']['subsections']['chat'] = array($txt['chat']);
}
function imm_chat($sub_actions)
{
$sub_actions['chat'] = array(
'dir' => SOURCEDIR,
'file' => 'ChatIntegration.php',
'function' => 'ModifyChatSettings'
);
}
/**
* ModifyChatSettings()
*
* - Defines our settings array and uses our settings class to manage the data
*/
function ModifyChatSettings()
{
global $txt, $scripturl, $context;
loadlanguage('Chat');
$context[$context['admin_menu_name']]['tab_data']['tabs']['chat']['description'] = $txt['chat_desc'];
// Lets build a settings form
require_once(SUBSDIR . '/SettingsForm.class.php');
// Instantiate the form
$chatSettings = new Settings_Form();
$config_vars = array(
array('title', 'chat_Settings'),
array('check', 'chat_above_enabled'),
array('check', 'chat_anypage_enabled'),
array('check', 'chat_below_enabled'),
array('check', 'chat_page_enabled'),
array('check', 'chat_popup_enabled'),
array('check', 'chat_button_enabled'),
array('check', 'chat_header_enabled'),
array('check', 'chat_user_enabled'),
);
// Load the settings to the form class
$chatSettings->settings($config_vars);
// Saving?
if (isset($_GET['save']))
{
checkSession();
Settings_Form::save_db($config_vars);
redirectexit('action=admin;area=addonsettings;sa=chat');
}
// Continue on to the settings template
$context['post_url'] = $scripturl . '?action=admin;area=addonsettings;save;sa=chat';
$context['settings_title'] = $txt['chat'];
Settings_Form::prepare_db($config_vars);
return;
}
function ilp_chat(&$permissionGroups, &$permissionList, &$leftPermissionGroups, &$hiddenPermissions, &$relabelPermissions)
{
global $context, $txt, $helptxt, $modSettings;
loadLanguage('Chat');
$permissionList['membergroup']['chat_admin'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_moderator'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_chatpage'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_talkbox'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_chatuser'] = array(false, 'chat', 'chat');
$permissionGroups['membergroup'][] = 'chat';
$leftPermissionGroups[] = 'chat';
}
function ips_chat()
{
global $context, $txt, $helptxt, $modSettings;
loadLanguage('Chat');
// Guests shouldn't be able to have any portal specific permissions.
$context['non_guest_permissions'] = array_merge($context['non_guest_permissions'], array(
'chat_admin',
'chat_moderator',
));
}
sources/controllers/Chat.controller.php
<?php
/**
* ElkArte Ajax Chat
*
* @author wintstar
* @license BSD http://opensource.org/licenses/BSD-3-Clause
* @license Bluimp's AJAX Chat is released under a Modified MIT License (MIT) https://raw.githubusercontent.com/Frug/AJAX-Chat/master/chat/license.txt
*
* @version 0.0.1beta
*/
if (!defined('ELK'))
die('No access...');
class Chat_Controller extends Action_Controller
{
public function pre_dispatch()
{
global $modSettings;
// Some things we will need
loadLanguage('Chat');
// Are we allowed to view the map?
isAllowedTo('chat_view_chatpage');
}
public function action_index()
{
return $this->action_chat();
}
public function action_chat()
{
global $txt, $context, $scripturl;
loadLanguage('Chat');
loadCSSFile('chat.css');
loadTemplate('Chat');
$context['sub_template'] = 'chat';
$context['page_title'] = $context['forum_name'] . ' - ' . $txt['chat_index'];
// Build the link tree.
$context['linktree'][] = array(
'url' => $scripturl . '?action=chat',
'name' => $txt['chat'],
);
}
}
Sorry, but I have some difficulties reading the files one at a time. :-[ Without the whole package I'm out of the games. :-[
Have a look at:
https://github.com/emanuele45/WordReplacer
it should give some hints.
Thanks, that helps me continue. :)
Have solved the problem. The hook integrate_sa_modify_modifications was too much.
:) Little by little I understand the hook system.
Short update :)
Admin area, Permission settings area and Shoutbox above an below the Board Categories creates.
New Screenshots, looking up in the first post. :)
Addon is released! :)
Download, see first post.
Great job winstar! :D
Fabulous! Thank you! :)
:thumbsup:
@wintstar I tried to install your addon but an error occured. Any idea to fix it? thanks
This is a known bug of Blueimp Ajax Chat. Sometime there has it a change with "datetime" in MySQL and did not resolve until today by the developers of the Ajax Chat. I had corrected this. Which MySQL version you have?
For the weekend I am going to post a solution.
@wintstar yes its version 5.5.32-5.5.42
Here's the fix:
Unpack the original package ElkAjaxChat_1.0.0.zip. Delete the install.php. Download the install.zip and unpack this. And add this install.php in the package. Pack the package in a Zip package, and you can install the addon in your board.
I would suggest you to update your database. Because this fix is for an outdated database, I will not update the addon to a new version. The fix has been tested with on your database versions and worked on my Test Area.
Fix for Bug with Database error "Invalid default value for 'dateTime'":
@wintstar Ive isntall the addon but I recieved this error inside that chat window. What does it mean?
If you get a 500 Connection error you might have to set your file permissions as well.
There are 1 folder (talk) for ElkArte Ajax Chat.
For ElkArte Ajax Chat be sure to change the file permissions (CHMOD) /talk/ and subdirectories to 755.
HTTP Error 500 Internal server error (http://www.checkupdown.com/status/E500.html)
If it still this does not work, update MySQL and PHP on your server to the current version.
@wintstar verything was set to 755 and still the error persist. But I change index.php to 755 and the error was gone. Btw, when I enable the chat, the chat shows up as shoutbox. is it the same as chat or there is a setting to change? also I cant find the setting to enable the menu. can you help?
@wintstar also when you refresh the page, the chat in the textbox dissappears. but when I typed something, it shows up. is this a glitch?
Yes it is true the activation to chat page is missing. Since I have inserted an incorrect file the in the package . There will be give a new version. The other error you are reporting, I can not fix. Since, in my view an error of your server configuration. Some Hoster block chat system on their servers.
Requirements for Blueimp Ajax Chat (https://github.com/Frug/AJAX-Chat)
Server-Side Client-Side
PHP >= 5 Enabled JavaScript
MySQL >= 4 Enabled Cookies
Ruby >= 1.8 (optional) Flash Plugin >= 9 (optional)
ok thanks for the update
@wintstar how do I enable the chat instead of the shoutbox?
@wintstar btw the text area where you type the text is not responsive. maybe you could also fix that in your next version.
I'm just going to rebuild the package. Will then still test the package. Download sources.zip, unzip the package. Include the Sources folder in the root of your board. Overwrite the existing file ManageTalk.controller.php.
I will provide an update on Version 1.0.1 issue at the latest next week. @ anagnam many thanks for error Message :)
I'll look into it, but am assuming that the error is caused by your Server Configuration.
EDIT@anagnam
What stands in the error log? Admin button => Error Log
Create a screenshot please from an admin center Main => Support & Credits = Support Information
Example
@wintstar I have overwriten the file ManageTalk.controller.php and I got this error.
@wintstar here is the file you requested.
@wintstar just as a quick hack, I put an inline style in the text area so it respond to its parent like so:
<textarea id="ajaxChatInputField" style="width: 100%;"
The chat is created on the original contained Theme. In other Theme used, the design adjustments themselves must be made.
Hi
@wintstar do you know where can I adjust the shoutbox? currently its default to 10 shouts only and I want to increase it.
Look in the
Ajax Chat Tips, and this:
Do you mean?
root*/chat/lib/config.php // Max number of messages to display on each request:
$config['requestMessagesLimit'] = 10;
@wintstar yes thats it. thanks! btw, im curious to know if the messages are deleted after say 10 (which is the default) or is it saved somewhere? where I can archive it on a daily basis just for archive purposes.
To my knowledge, there is no archiving system for Blueimp Ajax Chat. You can issue to the support for Blueimp Ajax Chat, click
here. (https://groups.google.com/forum/#!forum/ajax-chat)
@wintstar thanks but do you know where in the folder it saves the messages?
@wintstar is it possible to set that members can view the shoutbox even if they are inside a forum? currently if members are in the homepage only they can see the shoutbox, but if they are inside a forum, its not visible.
Judging by the database structure (and the fact there is a database) I'd guess messages are saved.
Messages are stored in the database "*_chat_messages".
View the shoutbox
Look under Permissions:
@wintstar yes, I already set the permission thats why only logged in members can view the chat in the homepage. but even logged in members if they are inside one of the forum, the chat is not visible. there is not settings that I can set in the permission that will allow logged in members to view the chat inside a forum. only in the homepage.
You can read it clearly in the description
Board Categories is the main forum page (Homepage). Within the forums, the shoutbox is not visible. This function does not exist. And the chat can be seen only on the chat page. Provided that the corresponding thereto permissions are set correctly.
Update is in progress. The progress can follow her here =>
My Projects (http://scaricare.de/index.php/projekte)
Addon updated to version 1.0.1Changelog 1.0.1Bug fixed- "datetime", appears in MySQL databases versions 5.5.32-5.5.42
- Activation Button the chat page is missing from the configuration of the Ajax Chat
- Shoutbox text input field runs in mobile view from the "div"
Download, see first post.
Update to new version 1.0.6 ElkArte not necessary.
Hi guys.I am sorry for this question,but I am very new at this matter.I like Elkarte forum and want to insert a chat.Downloaded this Ajax file,but I have NO idea how to instal it at my Elkarte forum.Please wrote some begginers guide or something.PLEASE.
/me feels there is no guide on how to install the addons... something new to add to the todo list. xD
Anyway, welcome to elkarte.net. :)
To answer your question, you have to go to admin > package manager > upload package
then you can upload the package you have just downloaded, when the upload is finished you should be presented with the option to install the addon, alternatively you can (again) go to admin > package manager browse packages, locate the "ElkArte Ajax Chat" line and click on "install" that you'll find on the right.
The package you are trying to download or install is either corrupt or not compatible with this version of the software.!!! :(
Is there any solution of this?Some other way to insert a chat?
Are you trying to run it on 1.1? It seemed to install fine on 1.0.9 when I tried.
SMF-AjaxChat_1.0.1
Can you upload 1.0.9 somewhere,or send me to the email tan3v88@gmail.com
No I mean are you using ElkArte 1.0.9 (current release) or ElkArte 1.1 (Beta) ?
You need to use the ElkAjaxChat_1.0.1.zip not the SMF one. It is the one at this link http://scaricare.de/index.php/downloads/download/10-elkarte-einsnull/7-elkarte-ajax-chat
My version was 1.0.7 and I have followed this instructions http://www.elkarte.net/community/index.php?topic=3940.0 to update it.
But when I press "Install"the same text shows up.Do I need to unrar the files before upload them ?
No. You did not have to unrar them (at least for 1.0.9 patch).
If you really have 1.0.7 version installed, then I don't think you got an incompatible package (but may be I am wrong, so do check). You can emulate it too.
But I rather think you didn't get the package downloaded properly, so it states that your package is corrupted.
Note: Should we separate the version and corrupted package warning
@emanuele,
@Spuds?
Edited: Ok, I noticed that there is a to do on that part of the code already. :)
I have this: Files in archive ElkArte_v1-0-9_patch.zip:
modifications.xml (6309 bytes)
package-info.xml (847 bytes)
serialize.php (6530 bytes)
update.php (449 bytes)
I think it is downloaded properly.
What mean to emulate it :D
Emulate means the package may be installed emulating a different version number of Elk. This is useful when the mod package was written for a different version. When this is the case you should see the Install link in the package manager saying something like Install Emulating X.x or something like that.
Let's stop here for a second.
You said you were on 1.0.7, did you move to 1.0.8 before installing 1.0.9? (Just to be sure.)
And second question: are we now talking about installing the Ajax chat or the update? :)
Note to
@Spuds now that we have "auto-emulation" (actually since a while), it may be worth having also a flag to stop it from "kicking in"?
For example, we want patches to be installed only on a certain version of the software (i.e. 1.0.9 should be installed only on Elk 1.0.8 and not 1.0.7), but if the auto-emulation gives the option to install on 1.0.7 it may screw up the forum.
Worth open an issue at github?
I did't move to 1.0.8.I am trying to move directly on 1.0.9 from 1.0.7 :D
Guys I am an idiot.Now from 1.0.7 update to 1.0.8 and there was no problem after that to update to 1.0.9 and the chat was successful installed without any problems.Thank you so much for the help and I am sorry for taking your time.
It's just a learning opportunity. Doesn't make you an idiot. It certainly isn't a waste of time. ;)
How I can adjust this error (https://scontent-vie1-1.xx.fbcdn.net/v/t1.0-9/15380624_1055728474556503_6724611702715378395_n.jpg?oh=606623f43b182ad2dd6bb5472b7a8aed&oe=58F65804)
404 seems a "file not found", but a translation in English would help quite a bit... :)
You don't happen to be running nginx by chance?
:D Chatbot: Error : Connection status : 404
No nginx
Any other addon?
No.This was my first experience with addon installation :D
Not sure why it gives that answer.
I guess I have to install it...
Guys,pls if someone have time to check what's wrong with this shoutbox ( Connection status : 404 ) . Do I need to make some settings after installation?May be this is the problem?
What elk version are you running? To make it work on 1.1, the action must be changed from chat to talk. The button can still work as well with a subs edit.
Ajax chat is version 1.0.1
Elkarte is 1.0.9 patch. version 1.0.0
Perhaps check file and directory permissions? It should install and work out of the box with your version.
Also, by chance are you running nginx?
Do I need to create chat page,if I want to run the shoutbox ? Also at my browse packages is signed "talk" instead "chat",should it be like that? (https://scontent-otp1-1.xx.fbcdn.net/v/t31.0-8/16715991_1113584258770924_2534968137315449810_o.jpg?oh=0fc50c55444b52c72f5b9b563b7d883e&oe=594516D6)
You should be able to do either/or independently. Yes, the package will create a directory named "talk". Looks fine from here. ;)
Hi,
i'm looking for a shoutbox and maybe this addon will be what i need.
Does it work with ElkArte1.1.3 ?
Philippe
Is this file still available, or is it just me who can't find it? The download link redirects to a broken German domain.
Looks like they never released it to the addon site ...
I checked my archive and found this, don't know if it works on 1.1 or even if it was the latest.
Thank you for sharing!
When installing the latest version of the chat on the forum version 1.1.9, it gives an error - vsprintf(): Argument #2 ($values) must be of type array, string given
Which one did you install?
@Spuds shared 1.1 just a few post before yours, though I am not sure that gonna work either as I have never installed it and it seems pretty old too.
That seems like a PHP 8 error.
Doing a quick look at the addon, it utilizes AJAX-Chat (by Blueimp) which I did find on GitHub. However it has not been updated in 7 years, so its unlikely to work with PHP 8.
This addon is really a wrapper around that program, so until the AJAX-Chat author decides to update that code, this addon is not going to work. Perhaps there is a fork of that project that has been updated that could be used here, I did not look into that.