##############################################################
## MOD Title: Topic Preview
## MOD Author: kvfb97 < info@kvfb97.co.uk > (Robert Dougan) http://www.kvfb97.co.uk
## MOD Description: This MOD will add a topic preview box to the viewforum.php page
##                  when you roll over a topic name. It shows bbcode and emotions
##					within the preview.
## MOD Version: 0.4
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit: viewforum.php
##			templates/subSilver/viewforum_body.tpl
##			templates/subSilver/overall_header.tpl
##			language/lang_english/lang_main.php
## Included Files: overlib.js
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## Tested with phpBB 2.0.18
## Homepage of this MOD: http://www.kvfb97.co.uk
##
## This MOD use Overlib 4.21 (C) by Erik Bosrup. View more info in overlib.js 
##############################################################
## MOD History:
##
##   2005-12-27 - Version 0.0.1
##      - First version of this MOD
##
##   2005-12-28 - Version 0.2
##      - Fixed a issue with announcements.
##      - Edited the install file and where the overlib.js file is now placed.
##      - Adding upgrading files, and install instructions for other styles.
##      - Added 'Topic Preview' into the lang_main file (thanks to Bicet ;o))
##
##   2005-12-28 - Version 0.3
##      - Added <br /> tags
##
##   2005-12-28 - Version 0.4
##      - Error with '
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------ 
# 
viewforum.php

# 
#-----[ FIND ]------------------------------------------ 
# 
	'L_AUTHOR' => $lang['Author'],
	
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	//
	// Topic Preview MOD (kvfb97.co.uk)
	//
	'L_TOPIC_PREVIEW' => $lang['Topic_Preview'],
	//
	// Topic Preview MOD (kvfb97.co.uk)
	//

# 
#-----[ FIND ]------------------------------------------ 
# 
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id 
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_last_post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . " 
	ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql, false, 'posts_')) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
	
# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
//
// All announcement data, this keeps announcements
// on each viewforum page ...
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, pt.* 
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . POSTS_TEXT_TABLE . " pt
	WHERE t.forum_id = $forum_id 
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_last_post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . "
		AND pt.post_id = t.topic_first_post_id 
	ORDER BY t.topic_last_post_id DESC ";
if ( !($result = $db->sql_query($sql, false, 'posts_')) )
{
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewforum_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
Topic Preview:

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
{L_TOPIC_PREVIEW}

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

# 
#-----[ DELETE ]------------------------------------------ 
#
<script language="JavaScript" src="templates/overlib.js"></script>
<!-- OVERLIB STUFF !-->

# 
#-----[ FIND ]------------------------------------------ 
# 
</head>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# do this for ALL of your styles.
#
<script language="JavaScript" src="templates/overlib.js"></script>
<!-- OVERLIB STUFF !-->

#
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------ 
# 
//
// That's all, Folks!
// -------------------------------------------------

?>
	
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
//
// Topic Preview MOD (kvfb97.co.uk)
//
$lang['Topic_Preview'] = 'Topic Preview:';
//
// Topic Preview MOD (kvfb97.co.uk)
//

#
#-----[ COPY ]------------------------------------------ 
#
copy overlib.js to templates/verlib.js

#
#-----[ DELETE ]------------------------------------------ 
#
templates/subSilver/verlib.js

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