IRC Chat MOD Version 2.0.1

IRC Chat MOD
  • This MOD will add a flash chat page on your site. The nickname of the user is the login name and the name of the room is your site by default or anything you chose.
  • Version: 2.0.1
  • Installation Level: Easy
  • Installation Time: ~11.5 minutes
Author(s)

Files To Edit

Included Files


Disclaimer

For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the latest version of this MOD. Downloading this MOD from other sites could cause malicious code to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered in our MOD-Database, located at: http://www.phpbb.com/mods/

Author Notes


          

MOD History

2005-02-02 - Version 2.0.1
Fixed the room list bug with help from Flash4U  (Yitzy Kasowitz)
2005-02-01 - Version 2.0.0
Added admin console with the following options:
 - Select default chat room name
 - Flash width /height 
 - Frame/pop-up height 
 - Open chat in: Normal page or Pop-up or Frame 
 - Show number of online users next to chat link
 - Allow/Ban guests to enter chat page
 - Allow/Ban guests to write in chat
Known bugs:
 - Rooms list can not be updated from parameter.  Therefore this field is disabled in the admin page.
2005-01-23 - Version 1.0.1
Fixed PHP 3 and 4 compatibility 
Fixed the split rooms bug when room name contains spaces
To upgrade from version 1.0.0 just copy chat.php to chat.php
2005-01-19 - Version 1.0.0
     - First Stable release. Version 1.0.0 of a MOD is always it's first stable release.

Other Notes

Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD


SQL

File Copy

Copy: chat.php
To: chat.php
Copy: chat.tpl
To: templates/subSilver/chat.tpl
Copy: icon_mini_chat.gif
To: templates/subSilver/images/icon_mini_chat.gif
Copy: irc_chat_config_body.tpl
To: templates/subSilver/admin/irc_chat_config_body.tpl
Copy: admin_irc_chat.php
To: admin/admin_irc_chat.php

Edits

Open: language/lang_english/lang_admin.php

Find

//
// That's all, Folks!
// -------------------------------------------------

Before, Add

//
// MOD: IRC Chat v2.0.0
//
$lang['IRC_Chat_General_Config'] = 'General IRC Chat Configuration';
$lang['IRC_Chat_Config_explain'] = 'The form below will allow you to customize all the IRC Chat MOD options.';
$lang['IRC_Chat_General_Settings'] = 'General chat settings';
$lang['irc_chat_room_default'] = 'Default chat room';
$lang['irc_chat_room_default_explain'] = 'Leave blank to use site name as default chat room name';
$lang['irc_chat_rooms_string'] = 'Chat rooms in main list';
$lang['irc_chat_rooms_string_explain'] = 'Use comma separated values (my room1,my room 2,etc).Leave blank to use ICQ\'s default chat rooms list.';
$lang['irc_chat_width'] = 'Flash width in px.';
$lang['irc_chat_width_explain'] = '(rec. 585)';
$lang['irc_chat_height'] = 'Flash height in px.';
$lang['irc_chat_height_explain'] = '(rec. 350)';
$lang['irc_chat_frame_height'] = 'Frame/pop-up height in px.';
$lang['irc_chat_frame_height_explain'] = '(rec. 400)';
$lang['irc_chat_page_mode'] = 'Open chat in';
$lang['irc_chat_page_mode_page'] = 'Normal page';
$lang['irc_chat_page_mode_frame'] = 'Frame';
$lang['irc_chat_page_mode_pop'] = 'Pop-up';
$lang['irc_chat_permissions'] = 'Chat permissions';
$lang['irc_chat_permissions_explain'] = 'This is an IRC room, so users can enter using other IRC program (i.e. MIRC).';
$lang['irc_chat_show_online'] = 'Show number of online users next to chat link';
$lang['irc_chat_show_online_explain'] = 'Based on users that are curnntly on the chat page NOT the chat room';
$lang['irc_chat_allow_link'] = 'Allow guests to enter chat page';
$lang['irc_chat_allow_link_explain'] = 'If not allowed - guests will be promped to login to access chat';
$lang['irc_chat_allow_chat'] = 'Allow guests to write in chat';
$lang['irc_chat_allow_chat_explain'] = 'Guests can only view, but not type in flash.';
//
// MOD: -END-
//

Open: language/lang_english/lang_main.php

Find

//
// That's all, Folks!
// -------------------------------------------------

Before, Add

//
// MOD: IRC Chat v2.0.0
//
$lang['IRC_Chat'] = 'Chat';
$lang['IRC_chat_guests_not_allowed'] = 'You need to login to join the chat';
//
// MOD: -END-
//

Open: templates/subSilver/overall_header.tpl

Find

<td align="center" valign="top" nowrap="nowrap"><span class="mainmenu">

In-line, Find

{L_MEMBERLIST}</a>&nbsp;

In-line, After, Add

&nbsp;<a href="{U_IRC_CHAT}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_chat.gif" width="12" height="13" border="0" alt="{L_IRC_CHAT} {L_ONLINE_CHAT_USERS_EXPLAIN}" hspace="3" />{L_IRC_CHAT} {L_ONLINE_CHAT_USERS}</a>&nbsp;

Open: includes/page_header.php

Find

//
// Obtain number of new private messages

Before, Add

//
//IRC Chat MOD 2.0.0
//

//Get chat online users
$chat_online_users = 0;

if ($board_config[irc_chat_show_online])
{
	$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip
		FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
		WHERE u.user_id = s.session_user_id
			AND s.session_time >= ".( time() - 300 ) . "
			AND s.session_page = ". PAGE_IRC_CHAT ."
		ORDER BY u.username ASC, s.session_ip ASC";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
	}


	$prev_user_id = 0;
	$prev_user_ip = $prev_session_ip = '';

	while( $row = $db->sql_fetchrow($result) )
	{
		// User is logged in and therefor not a guest
		if ( $row['session_logged_in'] )
		{
	        // Skip multiple sessions for one user
			if ( $row['user_id'] != $prev_user_id )
			{
		        $chat_online_users++;
			}
			$prev_user_id = $row['user_id'];
		}
		else //user is a guest
		{
			// Skip multiple sessions for one user
			if ( $row['session_ip'] != $prev_session_ip )
			{
				$chat_online_users++;
			}
		}

		$prev_session_ip = $row['session_ip'];

	}
	$db->sql_freeresult($result);
 	$l_chat_online_users = "(".$chat_online_users.")";
 	$l_chat_online_users_explain = $l_chat_online_users." ".$lang['Online_explain'];
}

//generate chat URL
$u_irc_chat = append_sid('chat.'.$phpEx);

if ($board_config['irc_chat_page_mode'] == 2){ // page in frame mode
    $u_irc_chat .= "\" target=\"_top";
}else if ($board_config['irc_chat_page_mode'] == 1){ // page in popup mode
    $irc_width = $board_config['irc_chat_width'] + 50;
	$u_irc_chat = "$u_irc_chat\" target=\"chat_win\" onClick=\"javascript:window.open('".$u_irc_chat."','chat_win','width=".$irc_width.",height=".$board_config['irc_chat_frame_height'].",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes');";
}
//
// MOD: -END-
//

Find

	'L_USERNAME' => $lang['Username'],

Before, Add

//
// MOD: IRC Chat v2.0.0
//
	'ONLINE_CHAT_USERS' => $chat_online_users,
	'L_ONLINE_CHAT_USERS' => $l_chat_online_users,
	'U_IRC_CHAT' => $u_irc_chat,
	'L_IRC_CHAT' => $lang['IRC_Chat'] ,
	'L_ONLINE_CHAT_USERS_EXPLAIN' =>$l_chat_online_users_explain,

//
// MOD: -END-
//

Open: includes/constants.php

Find

define('PAGE_TOPIC_OFFSET', 5000);

Before, Add

//
// MOD: IRC Chat v2.0.0
//
define('PAGE_IRC_CHAT', -1155);
//
// MOD: -END-
//

Open: viewonline.php

Find

case PAGE_INDEX:

Before, Add

case PAGE_IRC_CHAT:
	$location = $lang['IRC_Chat'];
	$location_url = "chat.$phpEx";
	break;

Save all files. End of MOD.