AjaxChat Integration (latest version 3.2.1)

Started by .HuNTeR., August 27, 2008, 12:59:06 AM

Previous topic - Next topic

Enders

Is there a way to put this shoutbox in a block? I've tried searching, but failed :(

HoTmetal

#1661
Quote from: mrtrc266 on May 02, 2009, 11:12:57 PM
Quote from: primetime on May 02, 2009, 11:10:15 PM
I had a friend come by and we upgraded to 2.0 RC1 and the chat installed with no problems!!! I love this MOD.

LOL...Glad you got it sorted  ;D

Heheh... Yeah, now that I've been away from SMF I have time for hobbies. woot.. ;D

I've recently setup a 115G reef tank. I came across Primetime's site, and he's been helping me with my tank, I thought I could return the favor.... (& help him with SMF)

@ OntarioAquariaClub
I've signed up for your site, and I see the problem you talked about.
Can you provide more information? Is there anything is the error log?
Did it (fully) install ok, without errors?
Have you gone into the Admin>Configuration>Modifications>Chatand enabled your settings?

Also, please re-read through this post,
I think mrtrc266 post on pretty url's may solve your issue.
Quote from: mrtrc266 on March 19, 2009, 12:03:37 AM

If you have problems and you also have Pretty URL's installed please READ THIS

 

Hope that helps, if not post here and give up and update :D


***ADDED... also, real quick, has anyone added Lightbox into the chat?
I think it would be a nice add, as it really really sux to see a HUGE img break up the chat room...

I haven't looked too far into the, other than to install into a non-default theme.
If nobody has tried, I guess I can dig in... thought I'd check 1st

robone

Hi..just tried to install AjaxChat on my forum and when running the test it came up with an error in the Boardindex.php file.

I checked what the parse should be replacing and mine does not look anything like that.

my code is:

$context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

   // Load the users online today.

And the code that it is looking for is:

$context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

   // Track most online statistics?

Anyway, obviously I never continued. Any help.

Using 1.1.8, but the boardindex file says the Software Version is          SMF 1.1 


mrtrc266

@ robone proceed with the install then via FTP download yourforum/Sources/BoardIndex.php file, edit it and upoad it back to your server. Of course make backup first.

Find
  $context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

Replace with
   $context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden'];

   //users in chat
   if (!WIRELESS){
      $userIDs = chatOnlineUsers();
      $context['chat_links'] = array();
      if (count($userIDs) > 0){
         $query = "SELECT mem.ID_MEMBER, mem.realName, mem.ID_GROUP, mg.onlineColor, mg.ID_GROUP
          FROM   {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}membergroups AS mg ON
          (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))WHERE ";
         foreach ($userIDs as $ID)
            $query .= 'ID_MEMBER = '. $ID . ' OR ';
         //remove the last OR
         $query = substr($query, 0, strlen($query)-3);

         $result = db_query($query, __FILE__, __LINE__);
         while ($row = mysql_fetch_assoc($result))
            {
            $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'];
            if($row['onlineColor'] != ""){
               $link.= '" style="color: ' . $row['onlineColor'];
            }
            $link.= '">' . $row['realName'] . '</a>';
            array_push($context['chat_links'], $link);
            }
         mysql_free_result($result);
         }
      //set the flag true for home page
      $context['chat_isHome'] = true;
      }

robone

Okay...thanks. I was going to do that, but just to make sure...thought I would come here.

primetime

Thanks RickC!! You are DA MAN!!!!!!
Yes, that Lightbox feature would be great in the chat. It works well on our other board.

Also, I need to figure out why regular members are able to delete  shouts.  ::)

mrtrc266

@ rickC

Ontario and Sunking as well as a cpl others have the same problem where the install goes fine but they can't type anything in the chat or shoutbox. I just posted on Sourceforge which has a better desrciption and a few links to this problem. I'm not good at coding and don't even really understand how all this works. If you have any ideas or suggestions to get this going for these users that would be greatly appreciated.

https://sourceforge.net/forum/message.php?msg_id=7352186

Thanks in advance for you help.

mrtrc266

Quote from: primetime on May 03, 2009, 12:54:07 PM
Also, I need to figure out why regular members are able to delete  shouts.  ::)

This happens when you allow users to Post Events in you Calendar, the fix for it is HERE

primetime

Quote from: mrtrc266 on May 03, 2009, 01:21:25 PM
Quote from: primetime on May 03, 2009, 12:54:07 PM
Also, I need to figure out why regular members are able to delete  shouts.  ::)

This happens when you allow users to Post Events in you Calendar, the fix for it is HERE

Thank you for the answer sir. I cant find the file "customajaxchat.php" file. Would you be so kind to point me in the right direction?

nm.. I found it. :)

Thank you,
Prime

primetime

 I tried the fix and no luck yet. Here is my customajaxchat.php.

<?php
/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license GNU Affero General Public License
 * @link https://blueimp.net/ajax/
 * 
 * SMF integration:
 * http://www.simplemachines.org/
 */

class CustomAJAXChat extends AJAXChat {

// Initialize custom configuration settings
function initCustomConfig() {
global $db_name,$db_connection;

// Use the existing SMF database connection:
$this->setConfig('dbConnection''link'$db_connection);
}

// Override the database connection method to make sure the SMF database is selected:
function initDataBaseConnection() {
global $db_name;

// Call the parent method to initialize the database connection:
parent::initDataBaseConnection();

// Select the SMF database:
$this->db->select($db_name);
if($this->db->error()) {
echo $this->db->getError();
die();
}
}

// Initialize custom request variables:
function initCustomRequestVars() {
global $context;

// Auto-login phpBB users:
if(!$this->getRequestVar('logout') && !$context['user']['is_guest']) {
$this->setRequestVar('login'true);
}
}

// Replace custom template tags:
function replaceCustomTemplateTags($tag$tagContent) {
global $context,$boardurl;

switch($tag) {

case 'FORUM_LOGIN_URL':
if(!$context['user']['is_guest']) {
return ($this->getRequestVar('view') == 'logs') ? './?view=logs' './';
} else {
return $this->htmlEncode($boardurl).'/index.php?action=login2';
}


case 'REDIRECT_URL':
if(!$context['user']['is_guest']) {
return '';
} else {
$redirectURL $this->getRequestVar('view') == 'logs' $this->getChatURL().'?view=logs' $this->getChatURL();
if(!$this->getRequestVar('logout')) {
// Set the redirect URL after login to the chat:
ssi_login($redirectURLfalse);
} else {
// Reset the redirect URL on logout:
ssi_login($boardurl.'/index.php'false);
}
return $redirectURL;
}

default:
return null;
}
}

// Returns true if the userID of the logged in user is identical to the userID of the authentication system
// or the user is authenticated as guest in the chat and the authentication system
function revalidateUserID() {
global $context;

if($this->getUserRole() === AJAX_CHAT_GUEST && $context['user']['is_guest'] || ($this->getUserID() === $context['user']['id'])) {
return true;
}
return false;
}

// Returns an associative array containing userName, userID and userRole
// Returns null if login is invalid
function getValidLoginUserData() {
global $context,$user_info;

// Check if we have a valid registered user:
if(allowedTo('chat_access')){
if(!$context['user']['is_guest']) {
$userData = array();
$userData['userID'] = $context['user']['id'];

$userData['userName'] = $this->trimUserName($context['user']['name']);

                         if(
$context['user']['is_admin'])
            
$userData['userRole'] = AJAX_CHAT_ADMIN;
         else
            
$userData['userRole'] = AJAX_CHAT_USER;

return $userData;

} else {
// Guest users:
return $this->getGuestUser();
}
}else{
return null;
}
}

// Store the channels the current user has access to
// Make sure channel names don't contain any whitespace
function &getChannels() {
if($this->_channels === null) {
global $db_prefix,$user_info;

$this->_channels = array();

$sql 'SELECT
ID_BOARD,
name
FROM
'
.$db_prefix.'boards AS b
WHERE
'
.$user_info['query_see_board'].';';

// Create a new SQL query:
$result $this->db->sqlQuery($sql);

// Stop if an error occurs:
if($result->error()) {
    echo $result->getError();
    die();
}

$defaultChannelFound false;

while($row $result->fetch()) {
// Check if we have to limit the available channels:
if($this->getConfig('limitChannelList') && !in_array($row['ID_BOARD'], $this->getConfig('limitChannelList'))) {
continue;
}

$forumName $this->trimChannelName($row['name']);

$this->_channels[$forumName] = $row['ID_BOARD'];

if(!$defaultChannelFound && $row['ID_BOARD'] == $this->getConfig('defaultChannelID')) {
$defaultChannelFound true;
}
}
$result->free();

if(!$defaultChannelFound) {
// Add the default channel as first array element to the channel list:
$this->_channels array_merge(
array(
$this->trimChannelName($this->getConfig('defaultChannelName'))=>$this->getConfig('defaultChannelID')
),
$this->_channels
);
}
}
return $this->_channels;
}

// Store all existing channels
// Make sure channel names don't contain any whitespace
function &getAllChannels() {
if($this->_allChannels === null) {
global $db_prefix,$user_info;

$this->_allChannels = array();

$sql 'SELECT
ID_BOARD,
name
FROM
'
.$db_prefix.'boards;';

// Create a new SQL query:
$result $this->db->sqlQuery($sql);

// Stop if an error occurs:
if($result->error()) {
    echo $result->getError();
    die();
}

$defaultChannelFound false;

while($row $result->fetch()) {
$forumName $this->trimChannelName($row['name']);

$this->_allChannels[$forumName] = $row['ID_BOARD'];

if(!$defaultChannelFound && $row['ID_BOARD'] == $this->getConfig('defaultChannelID')) {
$defaultChannelFound true;
}
}
$result->free();

if(!$defaultChannelFound) {
// Add the default channel as first array element to the channel list:
$this->_allChannels array_merge(
array(
$this->trimChannelName($this->getConfig('defaultChannelName'))=>$this->getConfig('defaultChannelID')
),
$this->_allChannels
);
}
}
return $this->_allChannels;
}

// Method to set the style cookie depending on the SMF user style:
function setStyle() {
global $db_prefix,$settings;

if(isset($_COOKIE[$this->getConfig('sessionName').'_style']) && in_array($_COOKIE[$this->getConfig('sessionName').'_style'], $this->getConfig('styleAvailable')))
return;

$sql 'SELECT
value
FROM
'
.$db_prefix.'themes
WHERE
ID_THEME = '
.$this->db->makeSafe($settings['theme_id']).'
AND
variable = \'name\';'
;

// Create a new SQL query:
$result $this->db->sqlQuery($sql);

// Stop if an error occurs:
if($result->error()) {
    echo $result->getError();
    die();
}

$row $result->fetch();
$styleName $row['value'];

$result->free();

if(!in_array($styleName$this->getConfig('styleAvailable'))) {
$styleName $this->getConfig('styleDefault');
}

setcookie(
$this->getConfig('sessionName').'_style',
$styleName,
time()+60*60*24*$this->getConfig('sessionCookieLifeTime'),
$this->getConfig('sessionCookiePath'),
$this->getConfig('sessionCookieDomain'),
$this->getConfig('sessionCookieSecure')
);
return;
}

}
?>


Raoden

I have my forum in a free server (www.zymic.com), and the .mp3 files are disallowed...

Gonna work without uploading the sounds?

Also, I cannot upload he file "./chat/socket/server.rb"

(sorry for bad english xD I'm Argentinian xP)

andy40

#1671
hi got this mod installed and works great but can someone tell me if i can allow members i want to use chat and disalow others please

primetime

Quote from: andy40 on May 03, 2009, 08:08:05 PM
hi got this mod installed and works great but can someone tell me if i can allow members i want to use chat and disalow others please

In your admin area, goto:

Members-->General Permissions-->Click "modify" of that group--> Then first section on left is allow access to chat option.

HTH,
Prime

Hiver101

Hello!

Thanks for a great mod,

What i want to modify is the format of the posted shout text, and i want it horizontally listed and not vertically. let me know if this can be done....

wiki

Hi I finally make the mod work and thx "mrtrc266" for helping me and others.

I have silly Q as follow: I got white box background i tried to figure out where i should change style color but no luck.

Can you help pls.



mrtrc266

You need to change the colors in yourforum/chat/css/shoutbox.css file

I have a Dark Theme so you can use mine if you like...it's attatched if you wanna try it.

wiki

Quote from: mrtrc266 on May 04, 2009, 01:30:37 AM
You need to change the colors in yourforum/chat/css/shoutbox.css file

I have a Dark Theme so you can use mine if you like...it's attatched if you wanna try it.


Thx yes i can see the css file but which part i should change i have tried most of them but the result still white.

mrtrc266

Quote from: resti on May 03, 2009, 11:14:42 PM
Hello!

Thanks for a great mod,

What i want to modify is the format of the posted shout text, and i want it horizontally listed and not vertically. let me know if this can be done....

Not sure exaclty what you mean by horizontally, that would be from side to side ???  Do you mean just changing the direction of the scroll?

wiki

Quote from: mrtrc266 on May 04, 2009, 01:30:37 AM
You need to change the colors in yourforum/chat/css/shoutbox.css file

I have a Dark Theme so you can use mine if you like...it's attatched if you wanna try it.

Ok i upload your css but still it's white background :(

mrtrc266

Wiki....Sorry, that one had a lot of edits....try this one also try uploading it to yourforum/shoutbox/css/ and yourforum/chat/css/

Be sure to refresh you screen when you're done.

Advertisement: