FlashChat Integration

Started by Tyrsson, January 05, 2007, 03:44:53 AM

Previous topic - Next topic

b4pjoe

Quote from: Kindred on February 07, 2009, 05:21:17 PM
I don't have the code handy right now...   but essentially, you do the same thing as the iframe, but do it directly in the code of index.template.php (if you want it on every page) or boardindex.template.php (if you want it only on the index page of the forum.

Here is the FlashChat code for the iframe that I presently have underneath the Users Online section. How would I change it so it is included in the Users Online Section?

/*****Begin flashchat who is*/

echo '
<tr>
<td class="catbg" colspan="2" align="center">Chat Users</td>
</tr>
<tr>
<td class="windowbg">&nbsp;</td>
<td class="windowbg2" width="100%"><iframe frameborder="0" height="100" src="', $GLOBALS['boardurl'], '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 25; border: 0; overflow: hidden;" scrolling="no" border="1" allowtransparency="true"></iframe></td>
</tr>';

/*****End flashchat who is*/

Kindred

ah... well (without looking much closer, since I only have about 20 mins before work) , take the code out of the info_embedded.php file and paste it into your boardindex.template.php in place of the iframe.
Сл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."

apadong.net

dear friends,
whre's the link of this mods that compatible with SMF 1.1.7 & 1.1.8?

i mean, the free version :D

Mathias88

Hi everyone
First, accept my apologize for language mistakes, I'm a damn froggies...
I don't really understand what I have to do to integrate the FlashChat !
Let me explain what I understood, and please, just tell me if it's wrong, what's wrong and how to fix it.

MY_URL = the adress of my site.

My "SMF (1.1.8 )" is locate at "MY_URL/smf/"
I got "FlashChat 5.010"
I got "FlashChat Integration 1.0a"

1°) Install FlashChat at "MY_URL/smf/chat" (?) or at "MY_URL/chat" (?)
2°) Do files operation :

- Move the included file "Chat.php" to "MY_URL/smf/Sources".
- Move the included file "Chat.template.php" to "MY_URL/smf/Themes/default".
- Move the included file "dologout.php" to "MY_URL/smf/".
- What about "install.xml" adn "package-info.xml" ?

3°) Launch "add_settings.php" ? from where ? e.g. "MY_URL/smf/add_settings.php" ?

4°) Edit files - see the list here ...

Is it correct ?

thank for help me ;)

bullbreedluverz

Quote from: apadong.net on February 12, 2009, 12:15:09 AM
dear friends,
whre's the link of this mods that compatible with SMF 1.1.7 & 1.1.8?

i mean, the free version :D

the link for the mod on the first page will take you to mod that will install on 1.1.7 & 1.1.8 (the version numbers havent been updated) BUT it wont work on the new version of flashchat only the older 4.7.x

apadong.net

oh i see. let me try. thanks! ;)

Mathias88

Quote from: bullbreedluverz on February 12, 2009, 05:46:49 PM
the link for the mod on the first page will take you to mod that will install on 1.1.7 & 1.1.8 (the version numbers havent been updated) BUT it wont work on the new version of flashchat only the older 4.7.x

Aïe ! Only the older 4.7.x ...
Is someone planning to update the FlashChat Integration ?

Any idea's for my previous post ?

djrem

How do you stop the Logging in and Leaving time stamp?

LadyC

hey kindred, if you have a chance, would you look at the template and see where we would implement the "who's chatting" code? i tried on my own, but i really don't know what i'm doing!

bullbreedluverz

#1049
Quote from: joec88 on February 09, 2009, 01:58:07 AM
Quote from: Kindred on February 07, 2009, 05:21:17 PM
I don't have the code handy right now...   but essentially, you do the same thing as the iframe, but do it directly in the code of index.template.php (if you want it on every page) or boardindex.template.php (if you want it only on the index page of the forum.

Here is the FlashChat code for the iframe that I presently have underneath the Users Online section. How would I change it so it is included in the Users Online Section?

/*****Begin flashchat who is*/

echo '
<tr>
<td class="catbg" colspan="2" align="center">Chat Users</td>
</tr>
<tr>
<td class="windowbg">&nbsp;</td>
<td class="windowbg2" width="100%"><iframe frameborder="0" height="100" src="', $GLOBALS['boardurl'], '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 25; border: 0; overflow: hidden;" scrolling="no" border="1" allowtransparency="true"></iframe></td>
</tr>';

/*****End flashchat who is*/


ive used you code and added it after

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
{
echo '
', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);


on Boardindex.template.php

but it ent perfect as it lists members in chat down in a line rather than across so that needs some work

LadyC

wow, i just successfully modified my first bit of php! so this should help some of you, and with any luck, someone else can help ME figure out where to put it so that it shows up at the top with the welcome information (where it shows how many messages there are, and has the link to unread posts...)

i've attached a copy of what the following code changes look like in the chat information section.

replace your info_embedded.php file with this: (but naturally, back up the original!)
<?php

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');


/**
If this file is not in the FlashChat root folder, then change this
path to the location of the inc/common.php file.
*/

$GLOBALS['my_file_name'] = 'info_embedded';

require_once(
'inc/common.php');

ChatServer::purgeExpired();

/**
Retrieves the number of users who are chatting in any room.
Leave the $room parameter empty to return the number of users in all room.
*/
function numusers( $room = '' )
{
if($room)
{
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? AND roomid=?",214);
$rs = $stmt->process( SPY_USERID , $room );
}
else
{
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections,{$GLOBALS['fc_config']['db']['pref']}rooms
 WHERE userid IS NOT NULL AND userid <> ? AND ispublic IS NOT NULL
 AND
{$GLOBALS['fc_config']['db']['pref']}connections.roomid = {$GLOBALS['fc_config']['db']['pref']}rooms.id");
$rs = $stmt->process( SPY_USERID );
}

$rec = $rs->next();
return $rec?$rec['numb']:0;
}

/**
Retrieves a list of the users (by login ID) who are in $room.
Leave the $room parameter empty to return a list of all users in all rooms.
*/
function usersinroom( $room = '' )
{
$list = array();

if($room) {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ?  AND roomid=?");
$rs = $stmt->process( SPY_USERID , $room);
} else {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? ");
$rs = $stmt->process( SPY_USERID );
}

while($rec = $rs->next())
{
$usr = ChatServer::getUser($rec['userid']);
if($usr == null && $GLOBALS['fc_config']['enableBots']) $usr = $GLOBALS['fc_config']['bot']->getUser($rec['userid']);
$list[] = array_merge($usr, $rec);
}


return $list;
}

/**
Retrieves a list of all available rooms, as an array.
*/
function roomlist()
{
$list = array();

// populate $list with the names of all available rooms
$stmt = new Statement('SELECT * FROM '.$GLOBALS['fc_config']['db']['pref'].'rooms WHERE ispublic IS NOT NULL order by ispermanent' , 54 );
$rs = $stmt->process();

while($rec = $rs->next()) $list[] = $rec;

//result will be an array of arrays like ('id' => <room id>, 'updated' = <timestamp>, 'created' => <timestamp>, 'name' => <room name>, 'ispublic' => <public flag>, 'ispermanent' => <autoclose flag>)
return $list;
}


$rooms = roomlist();
$roomnumb = sizeof($rooms);
$usernumb = numusers();
?>

<html>
<head>
<title>Who's in the chat?</title>
<meta http-equiv=Content-Type content="text/html;  charset=UTF-8">

<style type="text/css">
<!--

body { background-color: transparent; margin: 0; padding: 0; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-size: 10px;}
....normal {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
margin: 0; padding: 0;
        text-align: center;
}

#roomList { margin: 0; padding: 0; }
#roomList a { color: black; text-decoration: none; } #roomList a:hover { text-decoration: underline; }
....userList { margin-left: 7px; margin-right: 0; margin-bottom: 0; margin-top: 0;  padding: 0; }

-->
</style>
<script type="text/javascript">
function toggleUserList(id) {
   if (l = document.getElementById(id)) {
      if (l.style.display == '' || l.style.display == 'block') l.style.display = 'none';
      else l.style.display = 'block';
   }
   return false;
}

</script>
</head>
<body>
<p class=normal align="left"><?php echo $usernumb ?> member<?php if ($usernumb != 1) echo "s" ?> chatting in <?php echo $roomnumb ?> room<?php if ($roomnumb != 1) echo "s"; ?>: <?php if($roomnumb) { ?>
<?php $users = usersinroom($room['id']); if ($users) {
                                         echo
'<id="room_'.$room['id'].'">';
                                         foreach(
$users as $user ) {
   echo $user['login']; echo ", ";  }
                                       }

?>
<?php } ?>
</p>
</body>
</html>






bullbreedluverz

which smf will this work for and what version of flashchat is it for?

LadyC

it's for RC1... i forget the version of flashchat... but it's the only version of fc that will work on RC1.

b4pjoe

Quote from: LadyC on February 23, 2009, 05:30:04 PM
wow, i just successfully modified my first bit of php! so this should help some of you, and with any luck, someone else can help ME figure out where to put it so that it shows up at the top with the welcome information (where it shows how many messages there are, and has the link to unread posts...)

i've attached a copy of what the following code changes look like in the chat information section.

replace your info_embedded.php file with this: (but naturally, back up the original!)
<?php

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');


/**
If this file is not in the FlashChat root folder, then change this
path to the location of the inc/common.php file.
*/

$GLOBALS['my_file_name'] = 'info_embedded';

require_once(
'inc/common.php');

ChatServer::purgeExpired();

/**
Retrieves the number of users who are chatting in any room.
Leave the $room parameter empty to return the number of users in all room.
*/
function numusers( $room = '' )
{
if($room)
{
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? AND roomid=?",214);
$rs = $stmt->process( SPY_USERID , $room );
}
else
{
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections,{$GLOBALS['fc_config']['db']['pref']}rooms
 WHERE userid IS NOT NULL AND userid <> ? AND ispublic IS NOT NULL
 AND
{$GLOBALS['fc_config']['db']['pref']}connections.roomid = {$GLOBALS['fc_config']['db']['pref']}rooms.id");
$rs = $stmt->process( SPY_USERID );
}

$rec = $rs->next();
return $rec?$rec['numb']:0;
}

/**
Retrieves a list of the users (by login ID) who are in $room.
Leave the $room parameter empty to return a list of all users in all rooms.
*/
function usersinroom( $room = '' )
{
$list = array();

if($room) {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ?  AND roomid=?");
$rs = $stmt->process( SPY_USERID , $room);
} else {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND userid <> ? ");
$rs = $stmt->process( SPY_USERID );
}

while($rec = $rs->next())
{
$usr = ChatServer::getUser($rec['userid']);
if($usr == null && $GLOBALS['fc_config']['enableBots']) $usr = $GLOBALS['fc_config']['bot']->getUser($rec['userid']);
$list[] = array_merge($usr, $rec);
}


return $list;
}

/**
Retrieves a list of all available rooms, as an array.
*/
function roomlist()
{
$list = array();

// populate $list with the names of all available rooms
$stmt = new Statement('SELECT * FROM '.$GLOBALS['fc_config']['db']['pref'].'rooms WHERE ispublic IS NOT NULL order by ispermanent' , 54 );
$rs = $stmt->process();

while($rec = $rs->next()) $list[] = $rec;

//result will be an array of arrays like ('id' => <room id>, 'updated' = <timestamp>, 'created' => <timestamp>, 'name' => <room name>, 'ispublic' => <public flag>, 'ispermanent' => <autoclose flag>)
return $list;
}


$rooms = roomlist();
$roomnumb = sizeof($rooms);
$usernumb = numusers();
?>

<html>
<head>
<title>Who's in the chat?</title>
<meta http-equiv=Content-Type content="text/html;  charset=UTF-8">

<style type="text/css">
<!--

body { background-color: transparent; margin: 0; padding: 0; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-size: 10px;}
....normal {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
margin: 0; padding: 0;
        text-align: center;
}

#roomList { margin: 0; padding: 0; }
#roomList a { color: black; text-decoration: none; } #roomList a:hover { text-decoration: underline; }
....userList { margin-left: 7px; margin-right: 0; margin-bottom: 0; margin-top: 0;  padding: 0; }

-->
</style>
<script type="text/javascript">
function toggleUserList(id) {
   if (l = document.getElementById(id)) {
      if (l.style.display == '' || l.style.display == 'block') l.style.display = 'none';
      else l.style.display = 'block';
   }
   return false;
}

</script>
</head>
<body>
<p class=normal align="left"><?php echo $usernumb ?> member<?php if ($usernumb != 1) echo "s" ?> chatting in <?php echo $roomnumb ?> room<?php if ($roomnumb != 1) echo "s"; ?>: <?php if($roomnumb) { ?>
<?php $users = usersinroom($room['id']); if ($users) {
                                         echo
'<id="room_'.$room['id'].'">';
                                         foreach(
$users as $user ) {
   echo $user['login']; echo ", ";  }
                                       }

?>
<?php } ?>
</p>
</body>
</html>







You need to add it to the index.template.php file to make it appear at the top.

bullbreedluverz

i just
Quotereplace your info_embedded.php file with this
on rc1 and flashchat 5.0.10 (latest version) and it didnt do anything lol

LadyC

did you clear your cache in your browser? or... if you're using firefox browser, right click in the chat information box, select "this frame > reload frame". it should look like the image i posted!

bullbreedluverz

just to clarify, is changing the info_embedded.php all youve done or have you made other edits elsewhere?

LadyC

nope, all i did was change the info_embedded... but i DID embed the iframe under the who's online information center at the bottom of the main index page... i sure would like to figure out how to add this to the top of the pages throughout the forum though!

see, it really does work though, check out http://ghhangout.com/forum/chat/info_embedded.php

bullbreedluverz

soz its late here and sleep deprivation is taking a hold could you tell me after what line you placed the iframe

i ent got to worry bout putting it at the top - i havent got a header to put it in lol


Advertisement: