Topic: [Mod] Topic Preview
##
##
## Mod title: PunBB Topic Preview (with Mod Active Topic Lite)
##
## Mod version: 1.1 Build 051220
## Works on PunBB: 1.2, 1.2.10
## Author: Quoc Viet (aFeLiOn) e-mail: v[at]s[dot]vnn[dot]vn
##
## Description: Show first 256 characters in first post or last post
## of topic on the Forum view and on Active Topic
##
## Affected files: viewforum.php
## index.php (if using Mod Active Topic Lite)
##
## Affects DB: No
##
## Author notes: You can change Language, Config in file "mod_topicpreview.php".
## Mod Active Topic Lite is based on "Mod Active Topics" of Alex King.
## The Javascript is from Dynamic Drive DHTML code library.
## The Mod can't show last post on moved topic and the tooltip show
## behind combobox in IE.
## * Change from v1.0rc1:
## Add: Show last post
## Add: Include Mod Active Topic Lite
## Add: Config, Language
## Minor changes
##
## Disclaimer: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup all applicable files before proceeding.
##
##
#
#---------[ 1. UPLOAD ]---------
#
include/mod_topicpreview.js to /include/
include/mod_topicpreview.php to /include/
#
#---------[ 2. OPEN ]---------
#
viewforum.php
#
#---------[ 3. FIND ]---------
#
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
#
#---------[ 4. AFTER, ADD ]---------
#
require PUN_ROOT.'include/mod_topicpreview.php'; // [1] Mod Topic Preview
#
#---------[ 5. FIND ]---------
#
// Fetch list of topics to display on this page
if ($pun_user['is_guest'] || $pun_config['o_show_dot'] == '0')
{
#
#---------[ 6. BEFORE, ADD ]---------
#
// [2-] mod Topic Preview
$sql = 'SELECT p.message AS fpost, p.id AS fpost_id, v.message AS lpost, v.id AS lpost_id, t.id, t.moved_to, t.last_post_id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON (t.id=p.topic_id OR t.moved_to=p.topic_id) LEFT JOIN '.$db->prefix.'posts AS v ON (t.last_post_id=v.id AND t.moved_to IS NULL) WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
$result = $db->query($sql) or error('Unable to fetch first posts', __FILE__, __LINE__, $db->error());
$topic_preview = array();
while ($mod_tp = $db->fetch_assoc($result))
{
switch ($mtp_show)
{
case 1: $mtp_fp = ($mod_tp['lpost']!='') ? $mtp_lang['lastpost'].'<br />'.mtp_trim($mod_tp['lpost']) : ''; break;
case 2: $mtp_fp = $mtp_lang['firstpost'].'<br />'.mtp_trim($mod_tp['fpost']);
if ($mod_tp['moved_to'] == 0 && $mod_tp['fpost_id'] != $mod_tp['lpost_id'])
{
$mtp_fp .= '<br />'.$mtp_lang['lastpost'].'<br />'.mtp_trim($mod_tp['lpost']);
}
break;
case 0:
default: $mtp_fp = mtp_trim($mod_tp['fpost']); break;
}
if ($mod_tp['moved_to'] != 0 && $mtp_showmoved)
$topic_preview[$mod_tp['moved_to']] = $mtp_fp;
else
$topic_preview[$mod_tp['id']] = $mtp_fp;
}
// [-2] mod Topic Preview
#
#---------[ 7. FIND ]---------
#
if ($cur_topic['moved_to'] != 0)
$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else if ($cur_topic['closed'] == '0')
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else
{
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
$icon_text = $lang_common['Closed icon'];
$item_status = 'iclosed';
}
#
#---------[ 8. REPLACE WITH ]---------
#
// [3-] mod Topic Preview
if ($cur_topic['moved_to'] != 0)
$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'" onmouseover="ddrivetip(\''.$topic_preview[$cur_topic['moved_to']].'\')" onmouseout="hideddrivetip()">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else if ($cur_topic['closed'] == '0')
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'" onmouseover="ddrivetip(\''.$topic_preview[$cur_topic['id']].'\')" onmouseout="hideddrivetip()">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
else
{
$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'" onmouseover="ddrivetip(\''.$topic_preview[$cur_topic['id']].'\')" onmouseout="hideddrivetip()">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
$icon_text = $lang_common['Closed icon'];
$item_status = 'iclosed';
}
// [-3] mod Topic Preview
#
#---------[ 9. ONLY IF USING MOD ACTIVE TOPIC LITE ]---------
#
#
#---------[ 9a. OPEN ]---------
#
index.php
#
#---------[ 9b. FIND ]---------
#
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
#
#---------[ 9c. AFTER, ADD ]---------
#
require PUN_ROOT.'include/mod_topicpreview.php';
mtp_showactopic(); // Mod Topic Preview with Active Topic Lite
#
#---------[ 10. SAVE/UPLOAD ]---------
#
Preview:
Download here
:FlashGet:TCPOptimizer:SPECTralSMTPServer:UniExtract:PSPad:uStart:Everest:
:TotalCommander:ProcessExplorer:DriveMan:Regshot:Restoration:UPX:KolorGenerator:
:OpenOffice:AutoHotkey:IrfanView:Winamp:FSCapture:CDex:PNGOptimizer:spam: