News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Tutorial: how to COMPLETELY integrate FlashChat into SMF so you have a cool CHAT

Started by marcnyc, October 09, 2004, 07:21:56 AM

Previous topic - Next topic

Owdy

It wont work. Guest see that notise.


Do you know how to get rid og those scrollbars in Firefox? I mean from that ifarme?
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

marcnyc

Are you saying it doesn't work?
I am assuming your code (to hide the notice to guests) works because I didn't test it.
IF your code works then I don't see why checking for the value $chatcount wouldn't work (I had tested this and it does work).
This:
if (!$context['user']['is_guest'] )
echo ' <font size="-2" >' . $chatcount . ' '.$singularplural2.' chattäilemässä.</font><br>

';

is assumed to hide the notice to guests. Right? Does it work?
If it works and you want to hide the notice to guests AND registered-users in case the chat is empty then you have to use:
if (!$context['user']['is_guest'] || $chatcount != 0 )
echo ' <font size="-2" >' . $chatcount . ' '.$singularplural2.' chattäilemässä.</font><br>

';

Owdy

I dont want guests to see that at all. Not if theres users or not. :)
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

marcnyc

Then the problem is in your code, not in mine.
Sorry but I don't have time to test your code now (i have a deadline on another project) but you'll just have to find which one is the variable/array to check if a user is a user or a guest.
One of the developers that is familiar with the internal structure of SMF should be able to tell you off hand.

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

edi67

great chat thx

will be very useful look not only number of user but name of user in chat will be possible ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

marcnyc

If you figured it out please post the solution so everybody can benefit from it or PM me the solution and I will add it to my tutorial.

edi67

i only solved the chat as u wrote not more...

there is only one problem number of users in chat is always the same and not change
where is the problem ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

marcnyc

if you followed the instructions I doubt the number can always be the same... Make sure you are not viewing cached pages (clear your cache)

Owdy

How to ad list of users who are in chat

In /FlashChat/info.php, find:

<html>
<title>Who's in the chat?</title>
<head>
<style type="text/css">
<!--
.normal {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
}
A {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #0000FF;
}
A:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
}
-->
</style>
</head>
<body>
<center>
<p class=normal>There are <?=numusers()?> users in <?=$roomnumb?> rooms.</p>
<?php if($roomnumb) { ?>
<table border="1" cellpadding="1" class="normal">
<tr>
<th>ID</th>
<th>Name</th>
<th>Count</th>
<th>Users</th>
</tr>
<?php foreach($rooms as $room) { ?>
<tr>
<td><?=$room['id']?></td>
<td><?=$room['name']?></td>
<td><?=numusers($room['id'])?></td>
<td><?php

$users usersinroom($room['id']);

foreach( $users as $user ) {
echo $user['login'] . "<br>";
}

?>
</td>
</tr>
<?php ?>
</table>
<?php ?>

<p><a href="javascript:window.close()">Close</a></p>
<center>
</body>
</html>


Replace:

<span style="font-size:xx-small;color:#0232a1">
<?php

$users usersinroom($room['id']);

foreach( $users as $user ) {
echo $user['login'] . ",";
}

?>
</span>



then ad this in index.template.php:

<td colspan="2">
';
if ($context['user']['is_logged'])
echo '
<font size="-2">Users in chat:</font> ';
if ($context['user']['is_logged'])
{

readfile("http://www.example.com/FlashChat/info.php");
}
echo ' 



</td>
With this code only logged users see that list.  Code may be crappy (PHP N00b here), but it works.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Jerry

I am having troubles with the integration :( The Chat worked fine when I tested it before integration, but when I un comment the include SMF line(common.php), it does not work at all. It will start loading (the white page with the %'s) and then a screen with the backgrtound shows up like before it shows the chat rooms and stuff. but it just sits there. . .


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Owdy

is that 'only' cms line what is uncommented?

Read and follow those instructions: ;)

SimpleMachines.txt

***********************************************
SIMPLE MACHINES FORUM INTEGRATION FOR FLASHCHAT
***********************************************

This file describes the steps required to integrate FlashChat into a Simple Machines (henceforth referred as SMF) installation. The normal installation procedure, as described in the FlashChat readme.txt file, does NOT apply in this case.

YOU MUST FOLLOW THESE STEPS PRECISELY!


STEP 1:
Open the "common.php" file within the "inc" folder of your FlashChat distribution, and make sure that "smfCMS.php" is the ONLY uncommented line relating to CMS integration. I recommend that you use TextPad (www.textpad.com) as your plain text editor - NOT Windows Notepad or WordPad.

Thus, the common.php file will have something similar to this:


   //include_once(INC_DIR . 'cmses/statelessCMS.php');
   //include_once(INC_DIR . 'cmses/defaultCMS.php');
   //include_once(INC_DIR . 'cmses/phpNukeModCMS.php');//module version
   //include_once(INC_DIR . 'cmses/phpNukeCMS.php');//stand-alone version
   //include_once(INC_DIR . 'cmses/postNukeModCMS.php');//module version
   //include_once(INC_DIR . 'cmses/postNukeCMS.php');//stand-alone version
   //include_once(INC_DIR . 'cmses/xoopsCMS.php');
   //include_once(INC_DIR . 'cmses/phpBB2CMS.php');
   //include_once(INC_DIR . 'cmses/geeklogCMS.php');
   //include_once(INC_DIR . 'cmses/vbulletinCMS.php');
   //include_once(INC_DIR . 'cmses/xmbCMS.php');
   //include_once(INC_DIR . 'cmses/mamboCMS.php');
   //include_once(INC_DIR . 'cmses/e107CMS.php');
   //include_once(INC_DIR . 'cmses/ipbCMS.php');
   //include_once(INC_DIR . 'cmses/moodleCMS.php');
   include_once(INC_DIR . 'cmses/smfCMS.php');
   //include_once(INC_DIR . 'cmses/lunabyteCMS.php');
   //include_once(INC_DIR . 'cmses/fusionCMS.php');
   //include_once(INC_DIR . 'cmses/wowCMS.php');
   //include_once(INC_DIR . 'cmses/azdgCMS.php');

   //---
   //include_once(INC_DIR . 'cmses/defaultUsrExtCMS.php');
   //---

Thus, "//" appears before all the CMS references EXCEPT for the smfCMS.php reference. Double slashes are how programmers "comment-out" a line, thus deactivating it.


STEP 2:
On your web server, create a new folder called "FlashChat" as a sub-folder of the SMF directory (the directory that contains SMF's index.php file). Copy all of the files in the "chat" folder from your FlashChat download to the newly created FlashChat directory.

In other words, you should now have a folder called "FlashChat" which resides in the SMF directory, and within the "FlashChat" directory you have the actual FlashChat files... for example:

.../upload/FlashChat/index.php
.../upload/FlashChat/install.php
.../upload/FlashChat/inc/
.../upload/FlashChat/sql/
.../upload/FlashChat/templates/
...etc for other files in the "chat" folder of your FlashChat distribution.

CHMOD the /FlashChat/inc/config.srv.php file to a world-writable format, like 777. This will ensure that the FlashChat installer can write configuration data to the config.srv.php file. If you are unsure of how to do this, please contact your website administrator. You may change this file's permissions to a read-only format after installation.  CHMOD 777 the appdata/appTime.txt file too.


STEP 3:
Using your web browser, open the ./FlashChat/install.php file, and accept the provided values. These values will probably look familiar to you since they should draw from your current SMF configuration. If the values do not look familiar, then go back to steps 1-3 and make sure that you have done those steps correctly.

If the values are correct, submit the form to create database tables that are required for FlashChat.


STEP 4:
Go back to the the SMF folder on your web server

Go to 'Themes/default' directory.

Open index.template.php, and find the following text:


    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>';

           
Replace it with:

    else
    {
            echo '
                 <a href="', $GLOBALS['boardurl'], '/FlashChat/flashchat.php">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/chat_icon.gif" alt="FlashChat" style="margin: 2px 0;" border="0" />' : "FlashChat"),'</a>';
   
            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>';
    }



Be very careful that you paste this text correctly, since this is a very easy place to introduce PHP syntax errors, which could make your SMF setup to stop running. Be sure to get both of the curly braces, too! { and }


STEP 5:
Go to the 'Themes/default/images' directory, and upload the provided 'chat_icon.gif' file (this is in the FlashChat distribution, and has been designed to looks like other icons in the SMF default template).

Note: Steps 4 and 5 apply ONLY to the 'default' theme. The procedure for other themes should be very similar. The chat_icon.gif file has only been created for the default template, so you may need to use an image editor like Photoshop to create the 'chat' icon for other templates.


STEP 6:
Close all instances of your web browser.

Then, restart your browser, and open the SMF main page - upon logging in, you'll see the FlashChat link in the button bar, next to the "Profile" button. Logging in as a standard SMF user will now auto-login to FlashChat, and logging into SMF as an admin or moderator will auto-login to FlashChat as a chat moderator.


If you notice any errors in these steps, or have any suggestions for improvement, please post a message on the TUFaT.com support forum, located at http://www.tufat.com

Thank you for using FlashChat!
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Jerry

http://www.raclan.org/forums
I have followed those instructions /FlashChat/flashchat.php does not work alot with http://www.raclan.org/forums/index.php?action=chat

//include_once(INC_DIR . 'cmses/statelessCMS.php');
//include_once(INC_DIR . 'cmses/defaultCMS.php');
//include_once(INC_DIR . 'cmses/phpNukeModCMS.php');//module version
//include_once(INC_DIR . 'cmses/phpNukeCMS.php');//stand-alone version
//include_once(INC_DIR . 'cmses/postNukeModCMS.php');//module version
//include_once(INC_DIR . 'cmses/postNukeCMS.php');//stand-alone version
//include_once(INC_DIR . 'cmses/xoopsCMS.php');
//include_once(INC_DIR . 'cmses/phpBB2CMS.php');
//include_once(INC_DIR . 'cmses/geeklogCMS.php');
//include_once(INC_DIR . 'cmses/vbulletinCMS.php');
//include_once(INC_DIR . 'cmses/xmbCMS.php');
//include_once(INC_DIR . 'cmses/mamboCMS.php');
//include_once(INC_DIR . 'cmses/e107CMS.php');
//include_once(INC_DIR . 'cmses/ipbCMS.php');
//include_once(INC_DIR . 'cmses/moodleCMS.php');
include_once(INC_DIR . 'cmses/smfCMS.php');
//include_once(INC_DIR . 'cmses/lunabyteCMS.php');
//include_once(INC_DIR . 'cmses/fusionCMS.php');
//include_once(INC_DIR . 'cmses/wowCMS.php');
//include_once(INC_DIR . 'cmses/azdgCMS.php');

//---
//include_once(INC_DIR . 'cmses/defaultUsrExtCMS.php');
//---
is my CMS Section :S

I am going to try and install it again.


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Advertisement: