[外掛]Email Topic to Friend中文化

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

版主: 版主管理群

主題已鎖定
lucasart
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-08-31 15:15
來自: 明仔小鋪
聯繫:

[外掛]Email Topic to Friend中文化

文章 lucasart »

幾天前有看到小狐狸前輩在問轉寄文章的外掛
有人在文章裡把Email Topic to Friend提出來,因為尚未中文化,而且內容有些地方有問題
小弟就順手作了修正加中文化,現在打包一份上來跟大家分享\r

Email Topic to Friend V1.0.0

另外,小弟發現在信件寄出後,收信那方的連結會變成

代碼: 選擇全部

http://www.amily.idv.twviewtopic.php[color=red]/[/color]?t=728
那個 / 跑錯地方了
正常應該是\r

代碼: 選擇全部

http://www.amily.idv.tw/viewtopic.php?t=728
後來小弟找到了修正的方法,不知正不正確,因為對php還不是很熟
我測試過,後來就正常了,不知是不是我phpbb版本的問題,我用的是2.0.10
以下是修正,更改為正確解法,感謝ayaya兄的指導

代碼: 選擇全部

# 
#-----[ 開啟 ]-------------------------------------------- 
# 

emailtopic.php 

# 
#-----[ 找到 ]-------------------------------------------- 
# 

	// Send the email, but only after we prepared the board URL
	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
	$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
	$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
	$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
	$script_name = ($script_name == '') ? $script_name : '/' . $script_name;
	$u_viewtopic = $server_protocol . $server_name . $server_port . $script_name . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";

# 
#-----[ 取代為 ]-------------------------------------------- 
# 

	// Send the email, but only after we prepared the board URL
	$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
  $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
	$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
	$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\\1", trim($board_config['script_path']));
  $script_name = ($script_name != '') ? $script_name . '/' : '';
  $u_viewtopic = $server_protocol . $server_name . $server_port . $script_name . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";

# 
#-----[ 存檔/結束修改 ]-------------------------------------------- 
# 
另外,在emailtopic.php裡有一段語法如下

代碼: 選擇全部

//
// Uncomment the following lines to make a limit for the users.
// $email_limit sets the maximum number of emails.
// $email_time sets the time window for the limit (in hours).
//
/*
$email_limit = 5;
$email_time = 24;
$current_time = time();
$sql = 'SELECT COUNT(user_id) AS total
		FROM ' . TOPICS_EMAIL_TABLE . '
		WHERE user_id = ' . $userdata['user_id'] . '
		AND time >= ' . ($current_time - ($email_time * 3600));
if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not obtain user\'s email informaton', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if($row['total'] >= $email_limit)
{
	message_die(GENERAL_MESSAGE, sprintf($lang['Email_max_exceeded'], $email_limit, $email_time));
}
*/
$email_limit = 5 這個是設定一個人最多能發幾封
$email_time = 24 這是限制時間,是以小時計算
以我的設定是一個使用者一天內最多只能轉寄五封郵件,各位可以照自己喜好調整\r
記得要把/*以及*/這兩個註解拿掉才能正常使用\r

第一次發外掛文,如有錯誤的地方,還望各位前輩指點指點

小弟後來發覺,那行轉寄的字實在小的可憐,不注意看真的會找不到\r
因此把文字給轉換成了圖形,類似回覆文章那樣,小弟獻醜先

請先下載Email Topic to Friend 按鈕
以下是修改方法

代碼: 選擇全部

# 
#-----[ 複製 ]-------------------------------------------- 
# 

複製 topicemail.gif 到templates\你的風格檔案夾\images\lang_chinese_traditional_taiwan\topicemail.gif

# 
#-----[ 開啟 ]-------------------------------------------- 
# 

viewtopic.php

# 
#-----[ 尋找 ]-------------------------------------------- 
# 

$reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
$reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic'];
$post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
$post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];

# 
#-----[ 之後,加上 ]-------------------------------------------- 
#

$topicemail_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['topicemail'];

# 
#-----[ 尋找 ]-------------------------------------------- 
#

	'REPLY_IMG' => $reply_img,

# 
#-----[ 之後,加上 ]-------------------------------------------- 
#

	'TOPICEMAIL_IMG' => $topicemail_img,

# 
#-----[ 開啟 ]-------------------------------------------- 
# 請對照自己所安裝風格CFG檔

subSilver.cfg

# 
#-----[ 尋找 ]-------------------------------------------- 
#

?>

# 
#-----[ 在前面,加上 ]-------------------------------------------- 
#

//Email topic to friend
$images['topicemail'] = "$current_template_images/{LANG}/topicemail.gif"

# 
#-----[ 開啟 ]-------------------------------------------- 
#

templates/subSilver/viewtopic_body.tpl

# 
#-----[ 尋找 ]-------------------------------------------- 
#

	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>   <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>

# 
#-----[ 在同一行後加入 ]-------------------------------------------- 
#要加在</span>之前

   <a href="{S_EMAIL_TOPIC}"><img src="{TOPICEMAIL_IMG}" border="0" alt="{L_TOPIC_EMAIL}" align="middle"/></a>

# 
#-----[ 尋找 ]-------------------------------------------- 
#

	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>   <a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>

# 
#-----[ 在同一行後加入 ]-------------------------------------------- 
#要加在</span>之前

   <a href="{S_EMAIL_TOPIC}"><img src="{TOPICEMAIL_IMG}" border="0" alt="{L_TOPIC_EMAIL}" align="middle"/></a>

# 
#-----[ 尋找 ]-------------------------------------------- 
#

{S_WATCH_TOPIC}

# 
#-----[ 在同一行尋找 ]-------------------------------------------- 
#

<br />{S_EMAIL_TOPIC}

# 
#-----[ 刪除 ]-------------------------------------------- 
#

<br />{S_EMAIL_TOPIC}

# 
#-----[ 存檔/結束修改 ]-------------------------------------------- 
# 
這樣就有一顆像友善列印一樣的按鈕在文章的頂和底端了,可以更方便使用者轉寄信件功能
圖檔
主題已鎖定

回到「非官方認證外掛」