## EasyMod 0.0.10a compliant
################################################################# 
## MOD Title: 		Board Message MOD XL
## MOD Author: 		Shannado <sven@shannado.nl> (Sven) http://www.shannado.nl/forumorg
## MOD Description: 	With this MOD the admin is able to set mulptiple message at the top of the board. 
##			He/She can choose in the board configuaration, if the message appear on ALL pages or on the Index ONLY or
##			not at all or on the forum you selected. It can handle more then 255 characters
## MOD Version: 	1.0.5 
##
## Installation Level: 	Intermediate
## Installation Time: 	15 - 25 Minutes 
## Files To Edit: 	page_header.php, 
##			overall_header_tpl,
##		  	constants.php, 
##			functions.php, 
##			session.php
## Included Files: 	admin_board_msg_xl.php, 
##			board_msg_xl_edit_body.tpl, 
##			board_msg_xl_view_body.tpl,
##		   	board_message_xl.php, 
##			functions_bm.php, 
##			board_msg_xl_preview_body.tpl,
##			lang_main_bm_xl.php,
##			lang_admin_bm_xl.php
##			default.gif
############################################################## 
## 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: 
## 
##   YYYY-MM-DD - Version x.x.x 
##      - version notes go here 
## 
## ------------
##	01-01-2002 - 0.6.0 beta 
##		- Beta
##
## 01-01-2002 - 0.9.0 beta 
##	- A lot of improvements and extended the functionality
##
## 01-01-2002 - 0.9.1 beta 
##	- Error in the sort function 
##
## 01-01-2002 - 0.9.2 beta 
##	- Fixed small errors
##	- Enabled BB Code
##
## 01-01-2002 - 0.9.3 beta 
##	- Fixed Typo in constants.php
##	- forgot to to include bbcode_strip() function in the HOW TO
##
## 01-01-2002 - 0.9.4 beta 
##	- When editing/adding the message, you can preview the message
##	- More Smilies window added (just like when posting a post)
##	- Cleaned up the code a bit
##
## 01-01-2002 - 1.0.0 FINAL 
##	- FINAL
##
## 01-01-2002 - 1.0.1 FINAL 
##	- When Gzip comression enabled there were some problems. 
##
## 01-01-2002 - 1.0.2 FINAL 
##	- Link to the FAQ was wrong
##
## 01-01-2002 - 1.0.3 FINAL 
##	- Fixed error in pagination
##
## 01-01-2002 - 1.0.4 FINAL
##	- Made phpBB v2.0.2 complaint and EasyMod 0.0.7 complaint
##
## 05-12-2003 - 1.0.5 FINAL
##	- Made phpBB v2.0.6 complaint and EasyMod 0.0.10a complaint
##	- Adjusted to the new Template
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 
#
#-----[ SQL ]-------------------------------------------
#
CREATE TABLE phpbb_board_message (
  msg_id mediumint(8) NOT NULL auto_increment,
  title varchar(25) NOT NULL default '(empty)',
  message text NOT NULL,
  showpage smallint(5) NOT NULL default '0',
  auth tinyint(2) NOT NULL default '5',
  width smallint(3) NOT NULL default '75',
  starttime int(11) NOT NULL default '0',
  endtime int(11) NOT NULL default '0',
  startdate int(11) NOT NULL default '0',
  enddate int(11) NOT NULL default '0',
  users_timezone tinyint(1) NOT NULL default '0',
  bbcode_uid varchar(10) NOT NULL default '',
  days varchar(7) NOT NULL default '0000000',
  images varchar(100) default NULL,
  ordr smallint(3) NOT NULL default '0',
  PRIMARY KEY  (msg_id) );

INSERT INTO phpbb_board_message (msg_id, title, message, showpage, auth, width, starttime, endtime, startdate, enddate, users_timezone, bbcode_uid, days, images, ordr) VALUES (1, 'All Pages', 'This message will be shown on all pages. It can be view by all visitors. The width of the table = 80%. It als display a gif file. Order 10', 9999, 0, 80, 946681200, 946681200, 988581600, 1293750000, 0, '', '1111111', '/images/default.gif', 10),
(3, 'Index Only', 'The message will be showed only on the index. Only for registered people. On all days. Order 20', 0, 1, 50, 946681200, 946681200, 1009839600, 1293750000, 0, '', '1111111', '', 20);

# 
#-----[ OPEN ]---------------------------------------------------
# 
includes/functions.php

# 
#-----[ FIND ]---------------------------------------------------
# 
//
// Initialise user settings on page load

# 
#-----[ BEFORE, ADD ]--------------------------------------------
# 
// 
// Include language files
// 
function language_include($category)
{
	global $phpbb_root_path, $board_config, $lang, $faq;

	$dirname = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'];

	$dir = opendir($dirname);

	while($file = readdir($dir))
	{
		if( ereg("^lang_" . $category, $file) && is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
		{
			$incname = str_replace("lang_" . $category, "", $file);
			include($dirname . '/lang_' . $category . $incname);
		}
	}

	closedir($dir);
}

# 
#-----[ FIND ]---------------------------------------------------
# 
	include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx);
	
# 
#-----[ REPLACE WITH ]------------------------------------------------
# 
	language_include('main');
	
# 
#-----[ FIND ]---------------------------------------------------
# 
	include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
	
# 
#-----[ REPLACE WITH ]------------------------------------------------
# 
	language_include('admin'); 

# 
#-----[ OPEN ]------------------------------------------ 
#  
includes/sessions.php


# 
#-----[ FIND ]------------------------------------------ 
# 
				setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
				setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
			}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
			$userdata['bm_page'] = $thispage_id;

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/page_header.php

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->assign_vars(array(

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
include($phpbb_root_path . 'board_message_xl.'.$phpEx);

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
define('BOARD_MSG_TABLE', $table_prefix.'board_message');

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/bbcode.php

# 
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
function bbencode_strip($message, $uid)
{

	$message = strip_tags($message);

	// url #2
	$message = str_replace("[url]","", $message);
	$message = str_replace("[/url]", "", $message);

	// url /\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\](.*?)\[/url\]/si
	$message = preg_replace("/\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\]/si", "", $message);
	$message = str_replace("[/url:$uid]", "", $message);

	$message = preg_replace("/\[.*?:$uid:?.*?\]/si", '', $message);
	$message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
	$message = str_replace('"', "'", $message);
	return $message;

}


# 
#-----[ OPEN ]------------------------------------------ 
#  
templates/SubSilver/overall_header.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
				</table></td>
			</tr>
		</table>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<!-- BEGIN switch_board_msg --> 
		<br />
<center>
<table border="0" width={BM_WIDTH} class="forumline">
  <tr> 
	<th colspan="3" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{BM_TITLE}&nbsp;</th>
  </tr>
  <tr>
	<td width="10%" align="center" class="row1">{BM_IMAGES}</td>
	<td class="row1"><span class="gen">{BM_MSG}</a></span></td>
	<td width="10%" align="center" class="row1">{BM_IMAGES}</td>
  </tr>

</table>
<table border="0" width={BM_WIDTH}>
  <tr> 
	<td align="left" valign="top"><span class="gensmall"><a href={U_BM_PRV} title="{BM_PRV_TITLE}" class="nav">{L_BM_PRV}</a></span></td>
	<td align="right" valign="top"><span class="gensmall"><a href={U_BM_NXT} title="{BM_NXT_TITLE}" class="nav">{L_BM_NXT}</a></span></td>
  </tr>

</table>
</center>

<!-- END switch_board_msg --> 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM