SMF Support > SMF 2.0.x Support

phpFreeChat

(1/2) > >>

PureLoneWolf:
Hi all

I have been searching everywhere for a way to integrate phpFreeChat into my 2.0.2 installation.

The closest I have found is http://www.simplemachines.org/community/index.php?topic=279540.0 which is described as working for 2.0b4

Would anyone know if this will work for 2.0.2?

Many thanks

Antes:
Yes it has to be. Because (the closest) you find not editing core files, it just adds custom page.

PureLoneWolf:
Ok - So I have gotten pretty close...when I goto index.php?action=chat now, I just get the "Chat Loading" message.

That said, I think it is loading...it just doesn't display (the cache folder gets an entry...suggesting chat is up).  Also, when I View Source on the page from my browser..the username etc seems to have been passed successfully as a pfc nick.

I would be grateful for any help someone could provide.

Chat.php (in Sources folder)

--- Code: ---<?php
// If not called by SMF, it's bad!
if (!defined('SMF'))
   die('Hacking attempt...');

function Chat()
{
   global $context, $user_info, $boarddir, $chat;
   
   // They're a guest? Don't let them in!
   is_not_guest('Sorry, you can not enter the chat room!');
   
   require_once($boarddir . '/chat/src/phpfreechat.class.php');

   $params = array();
   $params['serverid'] = md5(__FILE__);
   $params['title'] = 'Resurrection Remix Chat';
   $params['nick'] = $user_info['name'];
   $params['admins'] = array('USERNAME' => 'PASSWORD');
   $params['frozen_nick'] = true;
   $params['height'] = '300';
   $params['clock'] = false;
   $params['btn_sh_whosonline'] = false;
   $params['nickname_colorlist'] = array('#f00','#0f0','#00f','#909','#099');
   $params['channels'] = array('Chat','Support');
   $params["data_private_path"] = ($boarddir . '/chat/data/private');
   $params["data_public_path"] = ($boarddir . '/chat/data/public');
   $params["data_public_url"] = ($boarddir . '/chat/data/public');
   $params["prototypejs_url"] = ($boarddir . '/chat/data/js/prototype.js');
   $params["server_script_path"] = ($boarddir . '/Sources/Chat.php');
   $params["server_script_url"] = ($boarddir . '/Sources/Chat.php');
   
   $chat = new phpFreeChat($params);

   $context['html_headers'] .= $chat->printJavascript(true);
   $context['html_headers'] .= $chat->printStyle(true);

   $context['sub_template'] = 'chat';
   $context['page_title'] = 'Chat - '.$context['forum_name'];
   
   loadTemplate('Chat');
}

?>
--- End code ---

Chat.template.php (in Themes/default folder):

--- Code: ---<?php

function template_chat()
{
   global $user_info, $context, $boarddir, $chat;

   $chat->printChat();
}
?>
--- End code ---

index.php (edit)

--- Code: ---Search for:  'calendar' => array('Calendar.php', 'CalendarMain'),
add after:  'chat' => array('Chat.php', 'Chat'),
--- End code ---

URL is www.resurrectionremix.com/index.php?action=chat [nofollow]



It would be great if someone could point me in the right direction.

Many thanks

PureLoneWolf:
Apologies for the bump...but would anyone be able to help?

Thanks

PureLoneWolf:
I had this information from someone over on the phpFreeChat forum..but I don't really know what to do with the information  :(


--- Quote ---I suspect the trouble is that you're using a GET query to point to the chat.  The chat does not maintain GET/POST data when it queries it's data, so it's pointing to a different URL and not getting what it needs.  If you put it at a static URL, even just using a .htaccess redirect, it should work for you.
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version