##############################################################
## MOD Title: onmouse over topic title display first and last post
## MOD Author: ShadowKnyght <forum> (James B)
http://forum.cyber-mag.com## Original MOD Author: emrag <emrah987> (Emrah TÃÂ ¼rkmen)
http://www.canver.net (TURKEY)
## MOD De.scription: with this hack when you hover the mouse on a topic link you
## will see first and last posted message as a hover title like vBulletin
##
## MOD Version: 1.2.0
##
## Installation Level: (Easy)
## Installation Time: 5 Minutes
## Files To Edit: - viewforum.php
## - templates/subSilver/viewforum_body.tpl
##
## Included Files:- N/A
##
## License:
http://opensource.org/licenses/gpl-license.php GNU General Public License v2
## Generator: MOD Studio [ ModTemplateTools 1.0.2288.38406 ]
##
##############################################################
## 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:
##
## Demo:
http://www.cyber-mag.com/phpBB2/index.php##
## - The java.script you will add to viewforum_body.tpl comes from Mojavlinux's MyCalendar 2.2.6
## (
http://www.mojavelinux.com/ )
##
##############################################################
##
## New MOD History:
##
## 2007-09-05 - Version 1.2.0
## - Release version added View last post as well to the mod
##
## Original MOD History:
##
## 25.09.2004 - 1.0.0
## - First release
##
## 07.10.2004 - 1.0.1
## - Fixed a bug - thanx to Clock
##
## 25.11.2004 - 1.0.2
## - added a character limit for hover title - you can change this value ;)
## (before if message is too long hover title won't be display. Now fixed)
##
## - EasyMod compitable
##
## 01.03.2005 - 1.1.0
## - compitable with bbcodes
## - now hover title show smilies :)
## - compitable with MODE "HIDE" - author: Philiweb
## - now using a java.script code for hover title - author: MojavLinux
## - fixed a bug about single and double quotes - ", '
## - i think this version is compitable with EasyMod but i didn't test it :(
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#----[ FIND ]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
#
#----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// display first message as title
//
//
// character limit for hover title
//
$chr_limit = '250';
$first_post = '<FONT><B>First post:</B></FONT><BR>';
$sql = "SELECT p.*, pt.post_text, pt.post_id, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND pt.post_id = p.post_id
ORDER BY p.post_time
LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$post_test = $row['post_text'];
$first_post .= $row['post_text'];
$first_post_bbcode_uid = $row['bbcode_uid'];
//
// if message is longer than character limit break message
// and add "..." at the last of message
//
if (strlen($first_post) > $chr_limit)
{
$first_post = substr($first_post, 0, $chr_limit);
$first_post .= '...';
}
//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$first_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $first_post);
}
}
//
// Parse message for BBCode if required
//
if ( $board_config['allow_bbcode'] )
{
if ( $first_post_bbcode_uid != '' )
{
$first_post = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($first_post, $first_post_bbcode_uid) : preg_replace('/:[0-9a-z:]+]/si', ']', $first_post);
}
}
//
// Parse smilies
//
if ( $board_config['allow_smilies'] )
{
if ( $row['enable_smilies'] )
{
$first_post = smilies_pass($first_post);
}
}
//
// replace n with <br>
//
$first_post = preg_replace("/[nr]{1,2}/", '<br>', $first_post);
//
// escape from double and/or single quotes
//
$first_post = str_replace(array('"', '''), array('"', '\''), $first_post);
//
// if message have [hide] [/hide] tags
// there will be an error message instead of normal message
//
if ( preg_match("/[hide]/i", $first_post) && preg_match("/[/hide]/i", $first_post))
{
$first_post = '<b>Protected message:</b><br>If you are a <b>*registered user*</b> :<br>you must post a reply to this topic to see the message';
}
//
// display first message as title
//
//
// Add last post to pop up text
//
$char_limit = '250';
$last_post = '<hr><FONT><B>Last post:</B></FONT><BR>';
$sql = "SELECT *, post_text, post_id, bbcode_uid
FROM " . POSTS_TEXT_TABLE . "
WHERE post_id=" . $topic_rowset[$i]['topic_last_post_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$post2_test = $row['post_text'];
$last_post .= $row['post_text'];
$last_post_bbcode_uid = $row['bbcode_uid'];
if (strlen($last_post) > $char_limit)
{
$last_post=substr($last_post, 0, $char_limit) . '...';
}
//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( !$board_config['allow_html'] )
{
if ( $row['enable_html'] )
{
$last_message = preg_replace('#(<)([/]?.*?)(>)#is', "<\2>", $last_post);
}
}
//
// Parse message for BBCode if required
//
if ( $board_config['allow_bbcode'] )
{
if ( $last_post_bbcode_uid != '' )
{
$last_post = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($last_post, $last_post_bbcode_uid) : preg_replace('/:[0-9a-z:]+]/si', ']', $last_post);
}
}
//
// Parse smilies
//
$last_post = smilies_pass($last_post);
//
// replace n with <br>
//
$last_post = preg_replace("/[nr]{1,2}/", '<br>', $last_post);
//
// escape from double and/or single quotes
//
$last_post = str_replace(array('"', '''), array('"', '\''), $last_post);
//
// if message have [hide] [/hide] tags
// there will be an error message instead of normal message
//
if ( preg_match("/[hide]/i", $last_post) && preg_match("/[/hide]/i", $last_post))
{
$last_post = '<b>Protected message:</b><br>If you are a <b>*registered user*</b> :<br>you must post a reply to this topic to see the message';
}
//
// END Adding last post to pop up text
//
//
// Join first and last post text
//
if (!($post_test == $post2_test))
{
$first_post .= $last_post;
}
//
// END Adding last post to pop up text
//
#
#----[ FIND ]------------------------------------------
#
'TOPIC_FOLDER_IMG' => $folder_image,
'TOPIC_AUTHOR' => $topic_author,
#
#-----[ BEFORE, ADD ]------------------------------------------
#
'FIRST_POST' => $first_post,
#
#-----[ OPEN ]------------------------------------------
#
templates/subsilver/viewforum_body.tpl
#
#----[ FIND ]------------------------------------------
#
# at the top of the page
<form>
<table>
#
#----[ BEFORE, ADD ]------------------------------------------
#
# at the top of the page
<The>
<script>
</span> 0 ? x - overFlowX : x;
// fix overflowing off the bottom of the screen
overFlowY = y + renderedHeight + excessHeight - window.innerHeight - window.pageYOffset;
y = overFlowY > 0 ? y - overFlowY : y;
renderedElement.style.top = (y + 15) + 'px';
renderedElement.style.left = (x + 15) + 'px';
// windows versions of mozilla are like too fast here...we have to slow it down
if (agt.indexOf('gecko') != -1 && agt.indexOf('win') != -1)
{
setTimeout("renderedElement.style.visibility = 'visible'", 1);
}
else
{
renderedElement.style.visibility = 'visible';
}
}
function destroyTitle()
{
// make sure we don't delete the actual page contents (java.script can get out of alignment)
if (document.body.firstChild != originalFirstChild)
{
document.body.removeChild(document.body.firstChild);
}
}
//-->
</script>
#
#----[ FIND ]------------------------------------------
#
<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle"
#
#----[ AFTER, ADD ]------------------------------------------
#
onmouseover="createTitle(this, '{topicrow.FIRST_POST}', event.pageX, event.pageY);" onmouseout="destroyTitle();"
#
#-----[ SAVE ALL FILES/CLOSE ]------------------------------------------
#
# EoM