[推薦]滑鼠主題預覽 1.04版

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
ckm
竹貓好朋友
竹貓好朋友
文章: 10
註冊時間: 2002-05-02 22:57
來自: 遙遠的宇宙
聯繫:

[推薦]滑鼠主題預覽 1.04版

文章 ckm »

Mouse hover topic preview / 滑鼠主題預覽\r
這個mod可以讓使用者把滑鼠放在標題上時,可預覽文章內容;預設內定是顯示200字元,之前frank兄曾貼過0.90版的,現在這個可以讓管理員自行設定要顯示第一篇文章或最後回覆的文章,並解決了雙重回覆的問題;但是仍會顯示引言和BBcode!
展示論壇:http://forum.csfuture.com/
我是採用預設值並改用顯示第一篇文章

代碼: 選擇全部

################################################################# 
## Mod Title: Mouse hover topic preview
## Mod Version: 1.0.4 
## Author: Sven Ansem <sven@shannado.nl> - http://www.shannado.nl
## Description: With this MOD an user can see preview, when he/she holds the mouse over the topic in viewforum
##		It showes the first 200 characters of the LAST post.In the HOWTO is also described how to 
##		preview the FIRST post instead of the LAST Post.
##		
## 
## Installation Level: Easy
## Installation Time: 5 Minutes 
## Files To Edit: viewforum.php, viewforum_body.tpl, bbcode.php
## Included Files: N/A
################################################################# 
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites 
################################################################# 
## 
## Author Note: 
##	I have set a limit (200) on the number of characters show in the preview. You can adjust is yourself to anynumber.
##	Replace the '200' with your number. In the following code lines:
##		$topic_content = $topic_rowset[$i]['post_text'];
##
##		if (strlen($topic_content) > 200) 
##		{ 
##			$topic_content = substr($topic_content, 0, 200) . "..."; 
##		}
##		else 
##		{ 
##			$topic_content = $topic_content; 
##		}
##
##
##	If you want to preview the first post instead of the last. change the next lines in viewforum.php 
##	after you completed the HOW TO.
##
##
##	[ FIND ]
##
##		AND p.post_id = pt.post_id
##
##	[ REPLACE WITH ]
##
##		AND t.topic_first_post_id = pt.post_id 
##
##
##	[ FIND ]
##		AND p2.post_id = t.topic_last_post_id
##		AND p2.post_id = pt.post_id
##
##	[ REPLACE WITH ]
##		AND p2.post_id = t.topic_last_post_id
##		AND p.post_id = pt.post_id
##
## Known Issues:
##	- Smilies & HTML code visible in preview
##
##
##
## 	Compliant with phpBB v2.0.x
## 
##
## History:
## ------------
## 0.9.0 beta 
##	- Beta
##
## 0.9.1 beta
##	- BBCode was visible in the preview. BBCode will be stripped now
##
## 0.9.2 beta
##	- Forgot the adjust the SQL statements
##
## 0.9.3 beta 
##	- Author notes extended with HOWTO preview always the first post
##
## 1.0.0 Final
##	- Final
##
## 1.0.1 Final
##	- Fixed preview FIRST post Announcement. The Annoucement disappear in the viewforum.
##	  The Authors Notes theerfor have been adjusted.
##
## 1.0.2 Final
##	- Fixed typo in the HOWTO of the preview of the FIRST post
##
## 1.0.3 Final
##	- Adjusted (make shorter) the strip_bbcode function in the bbcode.php file
##
## 1.0.4 Final
##	- Text with double quotes was not displayed correctly
################################################################# 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
################################################################# 

# 
#-----[ OPEN ]------------------------------------------ 
# 

include/bbcode.php

# 
#-----[ FIND ]------------------------------------------ 
# 

?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 


//
// Mouse hover topic preview MOD - BEGIN
//

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;

}

//
// Mouse hover topic preview MOD - END
//

# 
#-----[ OPEN ]------------------------------------------ 
# 

viewforum.php

# 
#-----[ FIND ]------------------------------------------ 
# 

include($phpbb_root_path . 'common.'.$phpEx);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

include($phpbb_root_path . 'includes/bbcode.'.$phpEx);

# 
#-----[ 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 . " 

# 
#-----[ 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.post_text, pt.bbcode_uid
	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.post_id = pt.post_id
		AND p.poster_id = u2.user_id
		AND t.topic_type = " . POST_ANNOUNCE . " 

# 
#-----[ FIND ]------------------------------------------ 
# 

//
// Grab all the basic data (all topics except announcements)
// for this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2
	WHERE t.forum_id = $forum_id
		AND t.topic_poster = u.user_id
		AND p.post_id = t.topic_first_post_id
		AND p2.post_id = t.topic_last_post_id
		AND u2.user_id = p2.poster_id 
		AND t.topic_type <> " . POST_ANNOUNCE . " 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time, pt.post_text, pt.bbcode_uid
	FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . 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_first_post_id
		AND p2.post_id = t.topic_last_post_id
		AND p2.post_id = pt.post_id
		AND u2.user_id = p2.poster_id 
		AND t.topic_type <> " . POST_ANNOUNCE . " 

# 
#-----[ FIND ]------------------------------------------ 
# 

		$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

		$topic_content = $topic_rowset[$i]['post_text'];
		$bbcode_uid = $topic_rowset[$i]['bbcode_uid'];
		$topic_content = bbencode_strip($topic_content, $bbcode_uid);

		if (strlen($topic_content) > 200) 
		{ 
			$topic_content = substr($topic_content, 0, 200) . "..."; 
		}
		else 
		{ 
			$topic_content = $topic_content; 
		}


# 
#-----[ FIND ]------------------------------------------ 
# 

			'TOPIC_TITLE' => $topic_title,


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

			'TOPIC_CONTENT' => $topic_content,

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/SubSilver/viewforum_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 

<td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

<td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle" title="{topicrow.TOPIC_CONTENT}">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Seize the day and create a better future
ckm@NTHU Blog
主題已鎖定

回到「非官方認證外掛」