i found this block at mkportal.it
how can i use it with tinyportal :uglystupid2:
<?php
/********************************************************/
/* Flashchat block v1.2 for Mkportal 1.0 + */
/* By: Ice2003 */
/* http://www.mkportal.it */
/* Copyright 2005 and Beyond by Ice2003 */
/********************************************************/
global $DB;
$flashchatprefix = "change this"; //Edit this to refelect the prefix of flashchat ie _fc_ or smf_fc_ ect,ect
// Don't change anything under this line or your server will self destruct :)
$curchat = "Current Chat Rooms";
$chatrooms = "Chat Rooms ";
$amtchatters = "Current Chatters";
// ok lets count how many rooms are available
$result = $DB->query("SELECT * FROM ".$flashchatprefix."rooms WHERE ispublic IS NOT NULL");
$files = $DB->get_num_rows($result);
// How many chatters are currently yacking in the rooms
$result = $DB->query("SELECT userid, state, color, lang, roomid FROM ".$flashchatprefix."connections WHERE userid IS NOT NULL");
$cats = $DB->get_num_rows($result);
$content .="<center><img src='$sitepath/mkportal/blocks/images/rooms.gif'></center>";
$content .= " $chatrooms: <b>$files</b><br> $amtchatters: <b>$cats</b><br></b>";
$content .="<center><img src='$sitepath/mkportal/blocks/images/users.gif'></center>";
// Lets print out a list of the rooms for all to see
$content .= "<center><b>".$curchat."</b></center>";
$a = 1;
$result = $DB->query("SELECT id, name FROM ".$flashchatprefix."rooms WHERE ispublic IS NOT NULL");
while(list( $id, $name) = mysql_fetch_row($result)) {
$title2 = ereg_replace("_", " ", $name);
$content .= " $a- <a href=\"/forum/chat/flashchat.php?lang=en&room=$id\">$title2</a><br>";
$a++;
}
unset($result);
unset($cats);
unset($files);
// yeaaaaa its the php end thingy it means i have finished
?>
What does it do? I use Flashchat and SMF/TP, and it works fine.
I think its just MKPortals way to display the online users in the chat. But Flashchat have - as you know ;) - a script to do it, just use an iframe to display it.
This is the Code Bloc gave me to show the members using flashchat in a Block (php).
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
wouldn't you change it to
height="100%"
since if it's just 100 it will not display properly in the block. (after around 2 users gets in the chat room)
Ah, but I changed scroll to "yes" so all users are seen.
I have a problem with this code. While logged in with admin accoun t i see the block and the information that shows who's logged in to chat. However, when i log in with my test account i still se the block, but no info in it
http://www.technodragon.net/forum/index.php
name=test
pass=test
could anyone help figure out why?
nm...figured it out...for some reason it has to do with changing the size from 100 to 100 %
so the problem is now, how do i make the block show all of the info without the 100%
do i just keep increasing the size from 100 to say 200?
Quotedo i just keep increasing the size from 100 to say 200?
Yes ;D
ok...when you integrate this chatroom into TP/SMF it makes changes to the code to show a button to open chat.
Is there a way to make it so that clicking that button opens the chat in a separate window rather than the one you are currently in? That way you can continue to use the forum while you are in chat.
Yes you can do that, or do as I did and make it a popup from a button (looks much tider than a new window)
true, but the problem i have is i am not really familiar with coding so i wanted to know what was the code you used to accomplish that.
Quote from: technodragon73 on January 18, 2006, 11:56:42 PM
true, but the problem i have is i am not really familiar with coding so i wanted to know what was the code you used to accomplish that.
hmm its a while since I installed smf and flash chat for someone on a forum and I have only done it once. All you do is insert target as follows after your url reference to the chat in your index.template page with the target="_blank" code
Find this
echo '<a href="', $GLOBALS['boardurl'], '/chat/flashchat.php">',
and replace with this :
echo '<a href="', $GLOBALS['boardurl'], '/chat/flashchat.php" target="_blank">',
That should open it in a new window.
HOORAY!
That was such a simple fix!
Ok, so is there a way to add defining the size of the window in the popup?
Or does it have to popup full screen?
I think something like this might work. Of course changing your dimensions...
<a href="http://www.yourlink.com" onclick="window.open(this.href, 'popupwindow', 'width=500,height=500,scrollbars,resizable'); return false;">Chat</a>
ok...call me stupid...how do i integrate that inot the index.template.php?
i have tried several different ways and i keep getting a parse error
Quote from: IchBinâââ,¬Å¾Ã,¢ on January 19, 2006, 01:01:57 AM
I think something like this might work. Of course changing your dimensions...
<a href="http://www.yourlink.com" onclick="window.open(this.href, 'popupwindow', 'width=500,height=500,scrollbars,resizable'); return false;">Chat</a>
Ichbin to be honest I haven't touched javascript much and this is javascript isn't it? If it is wouldn't they have to place a script arguments in the header or something for it to work? Or put in script tags at the beginning and end of the actual entry in the line above.
Actually no, because you are not calling a function from the header. This is javascript that is what I call stand alone code. But to echo it in a php statment with HTML you would actually have to write it out like this.
<a href="http://www.google.com" onclick="window.open(this.href, "popupwindow", "width=500,height=500,scrollbars,resizable"); return false;">Google</a>';
Quote from: IchBinâââ,¬Å¾Ã,¢ on January 19, 2006, 03:52:59 PM
Actually no, because you are not calling a function from the header. This is javascript that is what I call stand alone code. But to echo it in a php statment with HTML you would actually have to write it out like this.
Google</a>';
Really thats good so how would they insert it into the index.template file? Would it be something like this
Find this
echo '<a href="', $GLOBALS['boardurl'], '/chat/flashchat.php">',
and replace with this :
echo '<a href="', $GLOBALS['boardurl'],
onclick="window.open(/chat/flashchat.php, 'popupwindow', 'width=500,height=500,scrollbars,resizable'); return false;'">',
No, it would be like this. Make sure you click and highlite to the right. I just noticed in the blue101 theme that the BBC Code tags are not showing a scrollbar. It might be in other themes I am not sure.
echo'<a href="http://www.yourdomain.com/chat/flashchat.php" onclick="window.open(this.href, "popupwindow", "width=500,height=500,scrollbars,resizable"); return false;">Chat</a>';
Same in NDT as well.
Great IchBin! That code was nearly perfect...here is what i ended up doing to allow for the image at the top menu bar:
echo'
<a href="http://www.technodragon.net/forum/chat/flashchat.php" onclick="window.open(this.href, "popupwindow", "width=500,height=500,scrollbars,resizable"); return false;">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']. '/chat_icon.gif" alt="FlashChat" style="margin: 2px 0;" border="0" />' : "FlashChat"),'</a>';
Every them I use now has the chat successfully popup from the forum. Great work everyone! Although the Oxygen theme was rather difficult to get it to work properly...I almost have it right (the theme works, but the buttons at the top for some reason push the logout button to the secon row instead of keeping it on the same line).
If you post the whole function template_menu() section I'll gladlly take a look and see if anything is wrong.
Here you go:
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
$mycode='onmouseover="this.style.backgroundPosition=\'0 0px\'" onmouseout="this.style.backgroundPosition=\'0 -24px\'"';
echo '
<div id="myshrink"><div style=" position: relative; float: left;">';
// TinyPortal
if($context['TPortal']['showtop'])
echo '<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 0;" border="0" /></a><img id="upshrinkTemp" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 1ex;" /> ';
if($context['TPortal']['leftbar'])
echo '<a href="#" onclick="shrinkHeaderLeftbar(!current_leftbar); return false;"><img id="upshrinkLeftbar" src="', $settings['images_url'], '/', empty($options['collapse_leftbar']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 0;" border="0" /></a><img id="upshrinkTempLeftbar" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 0ex;" />';
if($context['TPortal']['rightbar'])
echo '<a href="#" onclick="shrinkHeaderRightbar(!current_rightbar); return false;"><img id="upshrinkRightbar" src="', $settings['images_url'], '/', empty($options['collapse_rightbar']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 0;" border="0" /></a><img id="upshrinkTempRightbar" src="', $settings['images_url'], '/blank.gif" alt="" style="margin-right: 0ex;" />';
// TinyPortal end
echo '</div><div id="bbhome" '.$mycode.'><a href="', $scripturl, '"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[103] . '" style="margin: 0px; width: 47px; height: 24px;" border="0" /></a></div>
<div id="bbforum" '.$mycode.'><a href="', $scripturl, '?action=forum"><img src="' . $settings['images_url'] . '/blank.gif" alt="forum" style="margin: 0px; width: 52px; height: 24px;" border="0" /></a></div>
<div id="bbhelp" '.$mycode.'><a href="', $scripturl, '?action=help" target="_blank"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[119] . '" style="margin: 0px; width: 36px; height: 24px;" border="0" /></a></div>';
// How about the [search] button?
if ($context['allow_search'])
echo '
<div id="bbsearch" '.$mycode.'><a href="', $scripturl, '?action=search"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[182] . '" style="margin: 0px; width: 56px; height: 24px;" border="0" /></a></div>';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin']){
echo '
<div id="bbadmin" '.$mycode.'><a href="', $scripturl, '?action=admin"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[2] . '" style="margin: 0px; width: 52px; height: 24px;" border="0" /></a></div>
<div id="bbtpadmin" '.$mycode.'><a href="', $scripturl, '?action=tpadmin"><img src="' . $settings['images_url'] . '/blank.gif" alt="tpadmin" style="margin: 0px; width: 65px; height: 24px;" border="0" /></a></div>';
}
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<div id="bbprofile" '.$mycode.'><a href="', $scripturl, '?action=profile"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[79] . '" style="margin: 0px; width: 56px; height: 24px;" border="0" /></a></div>';
// The [calendar]!
if ($context['allow_calendar'])
echo '
<div id="bbcalendar" '.$mycode.'><a href="', $scripturl, '?action=calendar"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt['calendar24'] . '" style="margin: 0px; width: 74px; height: 24px;" border="0" /></a></div>';
// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '
<div id="bblogin" '.$mycode.'><a href="', $scripturl, '?action=login"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[34] . '" style="margin: 0px; width: 48px; height: 24px;" border="0" /></a></div>
<div id="bbregister" '.$mycode.'><a href="', $scripturl, '?action=register"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[97] . '" style="margin: 0px; width: 62px; height: 24px;" border="0" /></a></div>';
}
// Otherwise, they might want to [logout]...
else
echo '
<div id="bbchat" '.$mycode.'><a href="http://www.technodragon.net/forum/chat/flashchat.php" onclick="window.open(this.href, "popupwindow", "width=500,height=500,scrollbars,resizable"); return false;">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']. '/chat_icon.gif" alt="Chat" style="margin: 0px; width: 52px; height: 24px;" border="0" />' : "FlashChat"),'</a></div>';
echo '
<div id="bblogout" '.$mycode.'><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '"><img src="' . $settings['images_url'] . '/blank.gif" alt="' . $txt[108] . '" style="margin: 0px; width: 60px; height: 24px;" border="0" /></a></div>';
}
You still need to add the id's to the style.css file. Scroll to the bottom of that file and you'll see what I mean. :)
coolness...well I was wondering what file thos codes were in Thanks IchBin
That fixed it! Finally, all of my themes now have the chat working and the window pops up...thank you everyone especially IchBin!
Quote from: gerrymo on November 02, 2005, 12:41:29 PM
This is the Code Bloc gave me to show the members using flashchat in a Block (php).
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
Do you notice any slowness of the page refreshing when you have the chat stats enabled? I notice a slight delay at times and others a longer delay where the chat stats box turns white on the inside of the box.
Quote from: RoarinRow on February 03, 2006, 04:16:51 AM
Quote from: gerrymo on November 02, 2005, 12:41:29 PM
This is the Code Bloc gave me to show the members using flashchat in a Block (php).
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
Do you notice any slowness of the page refreshing when you have the chat stats enabled? I notice a slight delay at times and others a longer delay where the chat stats box turns white on the inside of the box.
I am experiencing an issue where this block doesn't render in IE. the frame and the collapse button are there, but there is no text displayed w/in it. anyone know why, or maybe some kind of idea?
so, the block is also not rendering in Safari either.
anyone have an idea why this wouldn't work in Safari or IE?
anyone?
I bought FlashChat today and uploaded to my root. I did follow all the steps as told on the site www.tufat.com
I having problems to find the last code i have to replace: Add Flashchat to the CMS interface.
i need to replace:
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>';
with:
else {
echo '<a href="', $GLOBALS['boardurl'], '/chat/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>';
}
Im using the Black22 theme, so i need the change the code in Themes/TP_Black22_11rc2/index.template.php?
I looked in this file and tried many ways but nothing works fine :(
I can't find the exact first code, the only code i can't find there is:
// Otherwise, they might want to [logout]...
else
echo $bef.'
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', strtoupper($txt[108]) , '</a></td>';
Can someone please help me out here?
You dont add it in to Black22.
You make all the editing of the codes and integrations in the default themes files. that way you all you have to do is add a button for the ret of the themes you are using, the rest is fetched from the default files
Quote from: camflan on February 06, 2006, 02:55:31 AM
Quote from: RoarinRow on February 03, 2006, 04:16:51 AM
Quote from: gerrymo on November 02, 2005, 12:41:29 PM
This is the Code Bloc gave me to show the members using flashchat in a Block (php).
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
Do you notice any slowness of the page refreshing when you have the chat stats enabled? I notice a slight delay at times and others a longer delay where the chat stats box turns white on the inside of the box.
I am experiencing an issue where this block doesn't render in IE. the frame and the collapse button are there, but there is no text displayed w/in it. anyone know why, or maybe some kind of idea?
Is this the path that you put the flashchat? - /chat/info_embedded.php Did you trying changing that?
Your path should be:
Quote
forum/chat/flashchat.php
crip :)
I just put this code in a centre block!
include('http://www.rcmf.co.uk/4um/chat/info.php');
This lists the usernames that are in chat along the top of the forum. Obviously change the path to info.php to suit your own server!
If you want to list the rooms and users in them then use info_embedded.php
Gerry
Ok i changed all the files in the default theme and it works just fine now ;D
Thanks
Alrighty then! :)
Quote from: gerrymo on November 02, 2005, 12:41:29 PM
This is the Code Bloc gave me to show the members using flashchat in a Block (php).
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
im using this code on the Nostalgia Theme by husmen73 & Masterhan ..its a board with a black ground ..code works fine on on the lighter color boards, but this is my primary board and you cant view whos is chat,because the text is black..
i need the same code but in a different text color so it will stand out on my board..
i got it figured out it black text in a white box, but better that not seeing it all .heres the code i used if any one needs it
global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" #roomList { margin: 0; padding: 0; color: #C0C0C0; }allowtransparency="true"></iframe>';
The problem is that it is embedded.php that decides the text color..so either change that one or use what you do now.
im a noob to all this stuff,so its not easy for me to just change it,lol.im still learning ,id rather change the color of the text but at this point i happy to just see it,haha no what i mean ..thanks
I don't get it. Can someone please explain a simple way to change the font color for this? I have a black block. Thank you.
Check the code kontroldkhaos gave 3 posts up - it does indeed set the color to a lighter one.
Thank you
Surely there must be a way of getting info_embedded.php to use the current themes css ?
Quote from: Torsten on May 14, 2006, 02:55:37 PM
I bought FlashChat today and uploaded to my root. I did follow all the steps as told on the site www.tufat.com
I having problems to find the last code i have to replace: Add Flashchat to the CMS interface.
i need to replace:
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>';
with:
else {
echo '<a href="', $GLOBALS['boardurl'], '/chat/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>';
}
I'm using the Black22 theme, so i need the change the code in Themes/TP_Black22_11rc2/index.template.php?
I looked in this file and tried many ways but nothing works fine :(
I can't find the exact first code, the only code i can't find there is:
// Otherwise, they might want to [logout]...
else
echo $bef.'
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', strtoupper($txt[108]) , '</a></td>';
Can someone please help me out here?
Quote from: G6â„¢ on May 14, 2006, 04:18:46 PM
You dont add it in to Black22.
You make all the editing of the codes and integrations in the default themes files. that way you all you have to do is add a button for the ret of the themes you are using, the rest is fetched from the default files
Torsten refers to http://tufat.com/docs/flashchat/smf.html which is the method for the older SMF versions.
Check here (http://www.simplemachines.org/community/index.php?topic=66561.0) for FlashChat Integration with 1.1.1 Final, 1.1RC3 & 1.1RC2 Default Theme. It also works for 1.1.2.
Doh! Save yourself the trouble of manually adding this! Use this mod instead: http://custom.simplemachines.org/mods/index.php?mod=611
Hi,
I also use a black background and had to change the background and text colors of the info_embedded.php file.
You're welcome to use my code, though really all you have to do is open the info_embedded.php file and monkey around with the two color options until you find one that you like.
I tried to color the scrollbard to match the forum theme as well, though couldn't get it quite right so I scraped it. Colored scrollbars only work in IE anyways, so maybe thats a good thing ^^
Anyways, this works well with the black theme background. here's what it looks like on my forum: (I have it loaded in a center block so that people browsing the forum can tell right away who is in there).
http://thegamedomain.org/tgdmain/index.php?action=forum (http://thegamedomain.org/tgdmain/index.php?action=forum)
here's the codes:
PHP Block Code (already provided)
global $boardurl;
echo '
<iframe frameborder="2" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 99%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="yes" border="0" allowtransparency="true"></iframe>';
info_embedded.php code (Replace your existing file or just change the two colors on your own ^^ )
<?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.
*/
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=?");
$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");
$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: #444444; 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: none; }
....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><?php echo $usernumb ?> user<?php if ($usernumb != 1) echo "s" ?> in <?php echo $roomnumb ?> room<?php if ($roomnumb != 1) echo "s"; ?>.</p>
<ul id="roomList">
<?php if($roomnumb) { ?>
<?php foreach($rooms as $room) { ?>
<li><strong><a href="#" onclick="javascript:toggleUserList('room_<?php echo $room['id']?>')"><?php echo $room['name']?> (<?php echo numusers($room['id']) ?>)</a></strong>
<?php
$users = usersinroom($room['id']);
if ($users) {
echo "<ul class=\"userList\" id=\"room_".$room['id']."\">";
foreach( $users as $user ) {
echo "<li>".$user['login'] . "</li>";
}
echo "</ul>";
}
?> </li>
<?php } ?>
<?php } ?>
</ul>
</body>
</html>
Quote from: IchBinâ„¢ on January 19, 2006, 01:01:57 AM
I think something like this might work. Of course changing your dimensions...
<a href="http://www.yourlink.com" onclick="window.open(this.href, 'popupwindow', 'width=500,height=500,scrollbars,resizable'); return false;">Chat</a>
Hey how do you go on about using this code but instead of "a href" I am using a submit button(instead of text), that ones clicked will pop up the window in dimension I want, just like this code..
I tried playing around with it, couldnt manage fixing it for phpbox..
heres my code so far that works[edited the site out of course cause its still in construction]
echo ' <form name="doomz" action="http://[website-here]/forum/chat/flashchat.php" target="_blank">
<input type="submit" target="_blank" value="Doomz Flash" onsubmit="doomz()">';
global $boardurl;
echo '
<iframe frameborder="0" height="80" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
pretty cool javascript generator, that will create the code you;re looking for:
http://javascript.internet.com/generators/popup-window.html
there are about a millin different variations of this code. You can also try Dynamic drive, I have found alot of cool code generators there in the past.
nope, that didnt work for the phpbox..
I have good solution for implementing "who is in the chat". Make sure to backup file first.
TPortal stats box already have "who is online".
If you wont to show "who is in the chat" in same window, than u need to edit TPortalBlocks.template
find this code:
foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
}
echo '</div>';
}
}
Replace fith:
foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo '<br />';
}
echo '</div>';
}
// --- Begin FlashChat integration ---
// If there's users in the chat
if (!empty($context['users_chat']))
echo '
<br />
', $txt['fc_users_online'], 'Users currently in chat:<br />', implode(', ', $context['list_users_chat']);
// --- End FlashChat integration ---
}
Works for me! 8)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg523.imageshack.us%2Fimg523%2F8659%2Fnetve6.jpg&hash=376269b3d4698582f4352171048e80ae9e506621)
appears this only works on the default theme? I have cs-dark loaded and the new code didnt appear to affect the stats block.
thanks for the post though!!!!
Quote from: ash on August 23, 2007, 01:52:41 PM
appears this only works on the default theme? I have cs-dark loaded and the new code didnt appear to affect the stats block.
thanks for the post though!!!!
But I use this with Mirage theme. Did u integrated FlashChat in you theme? Link for tutorial. http://www.daniel15.com/forum/index.php/topic,856.html
First u must integrate flashchat in you theame.
Code that I posted up, is just to show who is in chat in TPortal stats box .
I have. I use a basic Iframe to post the "whos in chat". There afre alot of features that just dont work with the cs-dark theme. Ive learned to work around them. This I assume, is just another one :/