News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Integration of CHAT in SMF

Started by DTG, April 10, 2004, 01:43:34 PM

Previous topic - Next topic

DTG

Hello,
I downloaded php/mysql chat which can be easily integrated in yabbse forum.
In top forum menu there will be a link to chat (like profile, calendar, logout) , mysql base of chat can be in forum db and so on...

There were readme, Integration of the PHPOpenChat (POC) into YabbSE
here it is:
_____________________________________________________________________
1) Upload the image file 'button_poc.gif' to -> /path_to_forum/YaBBImages/
2) Setup the following properties within the file 'poc.php'

$poc_doc_root  = '/phpopenchat'; // directory name of your POC installation
$poc_root_path = './../phpopenchat'; // the relative path from YaBBSE installation to POC installation

Example:
you have YaBBSE in the directory 'forum' and
your POC in the directory chatb7 already installed.
In this case, your setup must look like as follows:

$poc_doc_root  = '/chatb7';
$poc_root_path = '../chatb7/';

Upload the file 'contrib/yabbse/poc.php' into the yabbse install directory

3) Adaptation of YaBBSE's menu. Go on as follows:

edit the file 'path_to_forum/Sources/Subs.php'
search for:
$yymenu .= "$menusep<a href=\"$cgi;action=shownotify\">$img[notification]</a>";

Insert the following code below this line:
$yymenu .= "$menusep<a href=\"poc.php\"><img src=\"$imagesdir/chat.gif\" alt=\"Let's go into the chat!\" width=\"45\" height=\"22\" border=\"0\"></a>";

Now a chat-button is available for registered member. Guests doesn't get
access to the chat.

Some relevant properties of POC's 'config.inc.php':
Example 1: You want that only registered users of yabbse can access the chat.
Guests must register to be able to chat.

define('ALLOW_GUEST_LOGIN',false);
define('SEND_CONFIRMATION_MAIL', false);
define('AUTOLOGIN_DIRECTLY', true);

okay, users can login to the chat only if they are registered user of yabbse.

Beispiel 2: You want that
            - yabbse's registered users are able to chat,
            - users are able to register for the chat only
            - guests can access the chat without a yabbse membership.

define('ALLOW_GUEST_LOGIN',true);
define('SEND_CONFIRMATION_MAIL', true); //switch to false if you don't like registration mails.
define('AUTOLOGIN_DIRECTLY', false);

With this setup, the POC is successfully integrated into yabbse.
Users are able to use the chat without registring to the yabbse forum.
Also guest-access is anabled.
____________________________________________________________________

Can you help me. Correct these readme for SMF.
I'd like to use it with SMF, and may be a lot of others :)

fun4us

whish there would be someone to help to make it run with smf

Regards Stefan

Oldiesmann

I'm looking at the poc.php file now. Shouldn't be too difficult to integrate the two.

rainier6

Any luck getting phpopenchat integrated into RC1??

I have a java based chat thingy installed but phpopenchat is slick

mar

#4
I did it... well i think so.  Im running SMF RC1 and phpopenchat.
I will try to help.

1. Setup this in your poc.php

$poc_doc_root  = '/pocchat300';
$poc_root_path = '../pocchat300';

If your phpopenchat is installed in a directory named chat your setup must be like this...

$poc_doc_root  = '/chat';
$poc_root_path = '../chat';

2. Now upload the file poc.php into your SMF directory.
If you have your SMF installed in a directory named forum, you have to upload it in to that directory.

Example: hxxp:www.mysite.com/forum/poc.php [nonactive]


3. Upload the graphic to your smf images folder.
   
Example: hxxp:www.mysite.com/smfdirectory/Themes/default/images/ [nonactive]english/chat.gif

If you are running your forum in another language you have to upload the graphic to the directory of the corresponding language.

Ex.  /Themes/default/images/spanish/chat.gif
       /Themes/default/images/german/chat.gif


4.Now you have to make a little change in your smf index language file.
  Find your index language file that is located in your languages directory

Example: hxxp:www.mysite.com/smfdirectory/Themes/default/languages/ [nonactive]index.english.php

Open the file and find this

$txt[34] = 'Login';
$txt[35] = 'Username';
$txt[36] = 'Password';

After add this

$txt[38] = 'Chat';

Now it must look like this

$txt[34] = 'Login';
$txt[35] = 'Username';
$txt[36] = 'Password';

$txt[38] = 'Chat';

$txt[40] = 'That username does not exist.';


5.Now open the file index.template.php
It must be located in your default directory

Example: hxxp:www.mysite.com/smfdirectory/Themes/default/ [nonactive]index.template.php

In this file find this

// Otherwise, they might want to [logout]...
   else
      echo '
            <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';


Before this line

<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';


Add this

<a href="poc.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[38] . '" style="margin: 2px 0;" border="0" />' : $txt[38]), '</a>', $context['menu_separator'], '


Now it must look like as follows


// Otherwise, they might want to [logout]...
else
   echo '
      <a href="poc.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[38] . '" style="margin: 2px 0;" border="0" />' : $txt[38]), '</a>', $context['menu_separator'], '
      <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';


That's all..
Now the register members of your forums are able to use the chat without register again.


Well i have something more to say. This is functioning in my forum but the members  just can access the chat through the forum. if they try to log into the chat  with their usernames and password, using the chat login page they cant do it.  And they have no access to their profiles pages in the chat.  I thought that this used the db information of the smf but its not, because a member who enter in the chat through the forum appears in the chat db like a member but without password. so i think that's why they cant access the chat using the chat loging page.

It could be better if the information of the forum db  could be the same as the chat db.

Well... greeting  i hope this can help someone. And sorry about my english, im a puertorican girl and dont speak a good english.
Bye

marcnyc

Are you planning on doing a mod of this for RC1 so that we can all install/uninstall it without having to do lots of hardcoding?

Kindred

Just as a note:  You should also have the poc.php file in your SMF directory...


I actually found a file specifically for SMF (after I did some work and was getting annoyed, lol)

It was in German, but I translated it.

Apart from the code below, all you need is the chat icon...

This is the readme file

##########################################################################################
- unpack the file poc_smf.zip
- then upload poc.php into the main SMF file directory.
  e.g. smf/poc.php
- In poc.php define the paths to your Chat to indicate:
  $poc_doc_root = '/chat';
  $poc_root_path = './../chat';
  Or whatever directory you have chosen for your chat
  e.g. your Chat is installed to run at http://deine_seite.de/chat/index.php
       then you would indicate:
       $poc_doc_root = '/chat';
       $poc_root_path = './../chat';
- upload the chat.gif file in the smf/Themes/default/images directory.
##########################################################################################

Two files must still be changed:
Open the file smf/Themes/default/languages/index.english.php
Look for $txt[36>] and insert $txt[38>] = 'Chat';
It should then look like:
$txt[34] = 'Login';
$txt[35] = 'Username';
$txt[36] = 'Password';
$txt[38] = 'zum Chat';

$txt[40] = 'That username does not exist.';

##########################################################################################
Open smf/Themes/default/index.template.php, and find the lines reading (line 428?)

// Otherwise, they might want to [logout]...
else
  echo '
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';

and add the following line before the logout line
   <a href="poc.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[38] . '" style="margin: 2px 0;" border="0" />' : $txt[38]), '</a>', $context['menu_separator'], '

so it the reads:
// Otherwise, they might want to [logout]...
else
echo '
<a href="poc.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/chat.gif" alt="' . $txt[38] . '" style="margin: 2px 0;" border="0" />' : $txt[38]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';

Save the file and you're ready to go.

##########################################################################################
I hope that this small guidance is understandable by everyone and I didn't forget anything
:-)
When using other Themes and/or languages in addition the appropriate files must
naturally be changed in this way.
Regards,
Teuton
Many thanks to Horseman for his patience and support

Translation by Kindred - all errors in text can be blamed on me...



Here is the poc.php

<?php //-*-php-*-
/*   ********************************************************************   **
**   Copyright notice                                                       **
**                                                                          **
**   (c) 1995-2004 PHPOpenChat Development Team                             **
**   http://phpopenchat.sourceforge.net/                                    **
**                                                                          **
**   All rights reserved                                                    **
**                                                                          **
**   This script is part of the PHPOpenChat project. The PHPOpenChat        **
**   project is free software; you can redistribute it and/or modify        **
**   it under the terms of the GNU General Public License as published by   **
**   the Free Software Foundation; either version 2 of the License, or      **
**   (at your option) any later version.                                    **
**                                                                          **
**   The GNU General Public License can be found at                         **
**   http://www.gnu.org/copyleft/gpl.html.                                  **
**   A copy is found in the textfile GPL and important notices to the       **
**   license from the team is found in the textfile LICENSE distributed     **
**   with these scripts.                                                    **
**                                                                          **
**   This script is distributed in the hope that it will be useful,         **
**   but WITHOUT ANY WARRANTY; without even the implied warranty of         **
**   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          **
**   GNU General Public License for more details.                           **
**                                                                          **
**   This copyright notice MUST APPEAR in all copies of the script!         **
**   ********************************************************************   */

/*
 $Author: Horseman (Hartmut Götze) and Germane (Freddy Hiller)
 $Date:$2004-23-06
 $for SMF Public Beta5
 $Revision:$1.0.0.0
*/
/*PHPOpenChat properties
supposition is, you have installed SMF and PHPOpenChat within the document root
of your webserver side by side.

<http://your.host.tld>
                     |
                     +</smf>
                     |
                     +</chat>

*/
$poc_doc_root  = '/chat';
$poc_root_path = '../chat';

define('SMF', 1);
// Load the settings and important includes.
include_once('Settings.php');
include_once(
'Sources/QueryString.php');
include_once(
'Sources/Subs.php');
include_once(
'Sources/Errors.php');
include_once(
'Sources/Load.php');
include_once(
'Sources/Security.php');

/* If $maintenance is set specifically to 2, then we're upgrading or something.
if ($maintenance == 2)
db_fatal_error(); */

// Connect to the MySQL database.
if (empty($db_persist))
$db_connection = @mysql_connect($db_server, $db_user, $db_passwd);
else
$db_connection = @mysql_pconnect($db_server, $db_user, $db_passwd);

// Show an error if the connection couldn't be made.
if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
db_fatal_error();

// Load the settings from the settings table, and perform operations like optimizing.
//reloadSettings();

// Load the user's cookie (or set as guest) and load their settings.
loadUserSettings();

//if( $username != 'Guest' )
 
if ($ID_MEMBER != 0) {
 require_once(
$poc_root_path.'/config.inc.php');
 require_once(
POC_INCLUDE_PATH.'/class.Chatter.inc');
 require_once(
POC_INCLUDE_PATH.'/adodb/adodb.inc.php');

 
$chatter = &new POC_Chatter();
 
$chatter->set_nick($user_settings['memberName']); // Forum-User
 
$current_chatter = $chatter;                      //save current
 
$chatter->set_user($user_settings['memberName']); // Forum-User

 
$chatter->set_email($user_settings['emailAdress']); //is hidden by default
 
$chatter->set_name($user_settings['realName']);
 
$chatter->set_homePageURL($user_settings['websiteUrl']);
 
$chatter->set_icqNumber($user_settings['ICQ']);
 
$chatter->set_aimNickname($user_settings['AIM']);
 
$chatter->set_yimNickname($user_settings['YIM']);
 
$chatter->set_motto($user_settings['signature']);
 
$chatter->set_interests($user_settings['personalText']);
 if( !empty(
$user_settings['gender']) ) $gender = ($settings['gender']=='Male')? 'f':'m';
 
$chatter->set_gender($gender);
 unset(
$gender);
 
$chatter->set_birthday($settings['birthday']);
 
$chatter->set_theme( 'openchat' ); //use default theme of PHPOpenChat

 
if( $user_settings['ID_GROUP'] == '1' ){$chatter->add_to_group('operator');} //Forum-Administrator

 //do not send registration mails
 
$chatter->set_skip_email();

 if(
$current_chatter != $chatter ){
   if( !
$chatter->is_registered()) {
     
$chatter->register();
   } else {
     
$chatter->update();
   }
 }
 unset(
$current_chatter);

 
$chatter->mkinstance_persist();
 unset(
$chatter);

 
header('Status: 301');
 
header('Location: http://www.yoursite.com'.$poc_doc_root.'/index.php?use_db_instance='.$user_settings['memberName']);
 exit;
}else{
 die(
'No guest login possible to the chat!');
}
?>


Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

marcnyc

have you implemented it somewhere so we can see it?

NoRad

I tried this chat method earlier and opted to go with FlashChat. It was more efficient, looked nicer, and integrated with SMF easily (came with integration files).
http://www.tufat.com/script.php?script=chat

marcnyc

That's really nice and most importantly seems to be less demanding on the server because it's Flash instead of Java, right?
I didn't see mention of the integration with SMF but if it is really integrated it's worth the $5 it costs...
One question: how good is it integrated? Will the main page say something about how many people are in the chatroom etc?? Or does it simply use the user database (which is already a great thing!)?

NoRad

Right now it does not say how many people are logged in, but I think you can easily query the table to find that out (because there is like a table called smf_fc_sessions). It uses the same database and automatically understands moderators/admins in the chat room. You can also "skin" it rather easily.

There are files included that you use similar to coppermine's bridge, making it very easy. YOU MUST FOLLOW INTEGRATION METHODS BEFORE INSTALLING. ; )

and yes, it is very fast because each update from the client only pulls the latest chat message (and not an entire refresh like most PHP chats). The Database spits out some xml that flash grabs.

Kindred

I have it installed, but I do not yet have it active...  I am working on the interface look and also having one issue with the index calling an invalid db function.

I should have it running within a week...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Prone

It says Simple Machines Integration on the site (down with the features). But FlashChat is not free or open license, right? 5$?

P
Webmaster http://www.syndicate-1.com

SyndicateOne - For All your gaming needs

marcnyc


NoRad

Here is what another user has told me in regards to making Flash Chat show how many people are chatting on your SMF pages.

QuoteHello,

Well it's simpel ! :)

go to the file  themes/default/boardindex.template.php on your instalation, or in a other template !

at tehe top of that file on row 9  below   global $context, $settings, $options, $txt, $scripturl, $modSettings;
you have to put the folowing code !

ob_start();
@require("http://www.youre-site.nl/forum/FlashChat/info.php");
$chatwho = ob_get_contents();
ob_end_clean();

the link jou have to change in the link of your site !
Then go to the end of that file and search for  // "Users online Today"   just see below

// "Users online Today"
echo '
<tr>
  <td class="catbg" colspan="2">', $txt['158bis'], ' ( ', $context['num_users_today'], ' ', $context['num_users_today'] == 1 ? $txt['user'] : $txt['users'], ' )</td>
</tr><tr>
  <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['158bis'], '" border="0" /></td>
  <td class="windowbg2" width="100%"><span class="smalltext">', $context['user_today'], '</span></td>
</tr>';

if you found that add the folowing code under it !


// Who is in the chat !
echo '
<tr>
  <td class="catbg" colspan="2">';
echo $txt['indechat'] ;
echo '
  </td>
</tr><tr>
  <td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/icons/inchat.gif" alt="', $txt['indechat1'], '" border="0" /></td>
  <td class="windowbg2" width="100%"><span class="smalltext">', $chatwho, '</span></td>
</tr>';

Now you have to save that file, and open in themes/languages/ the file Modifications.dutch or a other Modifications.????? file !

add the folowing row's somwhere in that file

$txt['indechat'] = 'Wie zijn er in de chat?';
$txt['indechat1'] = 'Als je even ververst kun je zien wie er in de chat aan het kleppen zijn';

You can change the text Wie zijn er in de chat?,  in the tekst for your lanquage for example "How is in the chat?"

the second row is the tekst for the tag in my case (dutch) it's say, "When your refresh your screen, you can see how's talking in the chat"

Save that file also, and upload it to your server !

Thats all

Greetings Hans
Sorry for my English, but i think it's better as your dutch :D:D:D


marcnyc

I tried appying these instructions to SMF 1.0 RC1 but it doesn't seem to work. The code is different, and even though I found the places where to put your suggested code it didn't seem to work. Did anybody implement this successfully on 1.0?

marcnyc

In the meantime I have written a small tutorial to integrate FlashChat in SMF 1.0 as if it was PART of a page instead of a new page in a new window: http://www.simplemachines.org/community/index.php?topic=17856.0

NoRad

I have not tried the suggested code yet because I'm not sure exactly where I want to put it on my forum. Surely the RC1 problems are simple enough to fix/modify?

andi1

Hi!
I installed the chat also, i did everything, that was written in the manual, but if i click "chat" in Smf i get this message

Fatal error: Cannot instantiate non-existent class: poc_chatter in /xxxxx/xxxx/xxxx/xxxxxx/web/Forum/poc.php on line 85

Maybe somebody can help me??

webling

The day after  SMF was released I modified it and integrated a java chat. I will have it online soon since we are waiting for our staff to complete all their logins, etc. Anyone who wants the integration for their site can contact me. I am also configuring a new chat network for the purpose of supporting SMF forums. The chat can also be configured to run on any IRC server.

Advertisement: