才讓小弟我更進步~~



下次小弟發文時,會特別注意前輩們的版權~~~



代碼: 選擇全部
##############################################################
## 外掛名稱: 合併HideMode4和attach_mod_245自動隱藏附加檔案
##
## 外掛作者: CAT < h5201141@yahoo.com.tw > http://sh31.no-ip.com/nkmu91me5
##
## 外掛說明:
## 合併HideMode4和attach_mod_245,
## 在文章使用[hide]時...自動隱藏附加檔案...回復之後才可下載
## 沒有使用[Hide]時...不隱藏附加檔案...
##
## 外掛版本: 1.0.0
##
## 安裝難度: Easy
## 安裝時間: 10 Minutes
## 編輯檔案: ./includes/bbcode.php
## ./templates/subSilver/bbcode.tpl
## ./attach_mod/displaying.php
## ./language/lang_chinese_traditional_taiwan/lang_main_attach.php
## ./templates/subSilver/viewtopic_attach_body.tpl
##
##
##
## 附加檔案: X
## 版權聲明: GNU General Public License v2
## http://opensource.org/licenses/gpl-license.php
##############################################################
## 由於安全上的考量, 請檢查: http://phpbb-tw.net/phpbb/index.php
## 是否有此外掛的最新版本.
################################################################
## 作者備註:
## 非常感謝 心靈捕手 以及 ~倉木麻衣~ 兩位大大的教學文章 ^^
##
##
## [強烈建議]先安裝Attach_Mod_245以及HideMode之後
## 按照 ~倉木麻衣~ 大大以及 心靈捕手 大大的步驟修改完成!!
##
## (幫 ~倉木麻衣~ 大大以及 心靈捕手 大大整理,以下會再寫一次)
##
## 1. ~倉木麻衣~大大的教學文章
## http://phpbb-tw.net/phpbb/viewtopic.php?p=255061#255061
##
## 2. 心靈捕手大大的教學文章
## http://phpbb2.tw/phpbb/viewtopic.php?t=48705
##
##
## 注意,不是在語言檔裡面的中文字,儲存時請以您論壇的語系儲存!
##
## 預先安裝
## 外掛作者: Attach_Mod_245
## (Acyd Burn < N/A > (Meik Sievertsen) http://www.opentools.de/)
## HideMode
## (Philiweb < http://www.philiweb.fr.st/ > )
##############################################################
## 外掛歷史:
##
## 2007-07-14 - 版本 1.0.0
## - 在phpbb 2.0.22中測試無誤
##
##############################################################
## 新增外掛前, 請先備份相關檔案.
##############################################################
以下是~倉木麻衣~大大的修改步驟:
以下是~倉木麻衣~大大的修改步驟:
以下是~倉木麻衣~大大的修改步驟:
#
#--------[ OPEN ]----------------
#
attach_mod/displaying.php
#
#--------[ FIND ]----------------
#
代碼:
if (intval($switch_attachment) == 0 || (!($is_auth['auth_download'] && $is_auth['auth_view'])) || intval($attach_config['disable_mod']) || $attach_config['topic_icon'] == '')
#
#--------[ REPLACE WITH ]----------------
#
代碼:
if (intval($switch_attachment) == 0 || intval($attach_config['disable_mod']) || $attach_config['topic_icon'] == '')
#
#--------[ FIND ]----------------
#
代碼:
// Not included because this would mean template and language file changes (at this stage this is not a wise step. ;))
#
#--------[ AFTER, ADD ]----------------
#
代碼:
display_attachments_notice();
#
#--------[ FIND ]----------------
#
代碼:
?>
#
#--------[ BEFORE, ADD ]----------------
#
代碼:
function display_attachments_notice()
{
global $template, $lang;
init_display_template('body', '{postrow.ATTACHMENTS}');
$template->assign_block_vars('postrow.attach', array());
$template->assign_block_vars('postrow.attach.attach_notice', array(
NOTICE => $lang['Attach_Notice']
));
}
#
#--------[ OPEN ]----------------
#
language/lang_chinese_traditional_taiwan/lang_main_attach.php
#
#--------[ FIND ]----------------
#
代碼:
?>
#
#--------[ BEFORE, ADD ]----------------
#
代碼:
$lang['Attach_Notice'] = '附加檔案: 您目前的權限無法檢視附加檔案';
#
#--------[ OPEN ]----------------
#
# 自行替換subSilver為你所使用的風格名稱目錄
templates/subSilver/viewtopic_attach_body.tpl
#
#--------[ FIND ]----------------
#
代碼:
<!-- END attach -->
#
#--------[ BEFORE, ADD ]----------------
#
代碼:
<!-- BEGIN attach_notice -->
<br /><br />
<div align="center"><hr width="95%" /></div>
<table width="95%" border="1" cellpadding="2" cellspacing="0" class="attachtable" align="center">
<tr>
<td width="100%" class="attachheader" align="center"><b><span class="gen">{postrow.attach.attach_notice.NOTICE}</span></b></td>
</tr>
</table>
<!-- END attach_notice -->
#
#--------[ SAVE/CLOSE ALL FILES ]----------------
#
# EoM
以下是心靈捕手大大的修改步驟:
以下是心靈捕手大大的修改步驟:
以下是心靈捕手大大的修改步驟:
#
#--------[ OPEN ]----------------
#
attach_mod/displaying.php
#
#--------[ FIND ]----------------
#
代碼:
function display_post_attachments($post_id, $switch_attachment)
{
global $attach_config, $is_auth;
#
#--------[ REPLACE WITH ]----------------
#
代碼:
function display_post_attachments($post_id, $switch_attachment)
{
global $attach_config, $is_auth, $valid;
#
#--------[ FIND ]----------------
#
代碼:
if ($is_auth['auth_download'] && $is_auth['auth_view'])
#
#--------[ REPLACE WITH ]----------------
#
代碼:
if ($is_auth['auth_download'] && $is_auth['auth_view'] && $valid == TRUE)
#
#--------[ OPEN ]----------------
#
language/lang_chinese_traditional_taiwan/lang_main_attach.php
#
#--------[ FIND ]----------------
#
代碼:
$lang['Attach_Notice'] = '附加檔案: 您目前的權限無法檢視附加檔案';
#
#--------[ REPLACE WITH ]----------------
#
代碼:
$lang['Attach_Notice'] = '===== 附加檔案 =====<br />--- 如果您是 *註冊會員*, 那麼您必須登入和回覆文章後, 才可下載附加檔案 ---';
#-----[ OPEN ]-----
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]-----
# ps. 有兩個
代碼:
Protected Message:
#
#-----[ REPLACE WITH ]-----
# ps. 都取代
代碼:
隱藏訊息:
#
#-----[ FIND ]-----
#
代碼:
--- If you are a *registered user* : you need to post in this topic to see the message ---
#
#-----[ REPLACE WITH ]-----
#
代碼:
--- 如果您是 *註冊會員*, 那麼您必須登入和回覆文章後, 才可閱讀 ---
#
#-----[ OPEN ]-----
#
includes/bbcode.php
#
#-----[ FIND ]-----
#
代碼:
--- phpBB : The Protected Message is not copied in this quote ---
#
#-----[ REPLACE WITH ]-----
#
代碼:
--- 這些隱藏訊息, 無法在引言中顯示 ---
#
#--------[ SAVE/CLOSE ALL FILES ]----------------
#
以下是自動隱藏附加檔案的修改.....(By CAT)======================
以下是自動隱藏附加檔案的修改.....(By CAT)======================
以下是自動隱藏附加檔案的修改.....(By CAT)======================
=====<開啟>
./include/bbcode.php
=====<尋找>
function bbencode_third_pass($text, $uid, $deprotect)
{
global $bbcode_tpl;
// pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0).
// This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it.
$text = " " . $text;
// First: If there isn't a "[" and a "]" in the message, don't bother.
if (! (strpos($text, "[") && strpos($text, "]")) )
{
// Remove padding, return.
$text = substr($text, 1);
return $text;
}
// Patterns and replacements for URL and email tags..
$patterns = array();
$replacements = array();
if ( $deprotect ) {
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['show'];
}
else
{
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['hide'];
}
$text = preg_replace($patterns, $replacements, $text);
// Remove our padding from the string..
$text = substr($text, 1);
return $text;
}
=====<在該部分尋找>
global $bbcode_tpl;
=====<取代為>
global $bbcode_tpl, $attvalid;
=====<在該部分尋找>
// Remove padding, return.
$text = substr($text, 1);
=====<再下一行加入>
$attvalid = TRUE;
=====<在該部分尋找>
$replacements[0] = $bbcode_tpl['show'];
=====<再下一行加入>
$attvalid = TRUE;
=====<在該部分尋找>
$replacements[0] = $bbcode_tpl['hide'];
=====<再下一行加入>
$attvalid = FALSE;
=====<開啟>
./attach_mod/displaying.php
=====<尋找>
function display_post_attachments($post_id, $switch_attachment)
{
global $attach_config, $is_auth, $attvalid;
if (intval($switch_attachment) == 0 || intval($attach_config['disable_mod']))
{
return;
}
if ($is_auth['auth_download'] && $is_auth['auth_view'] && $attvalid == TRUE )
{
display_attachments($post_id);
}
else
{
// Display Notice (attachment there but not having permissions to view it)
// Not included because this would mean template and language file changes (at this stage this is not a wise step. ;))
display_attachments_notice();
}
}
=====<在該部分尋找>
if ($is_auth['auth_download'] && $is_auth['auth_view'] && $valid == TRUE )
=====<取代為>
if ($is_auth['auth_download'] && $is_auth['auth_view'] && $attvalid == TRUE )
=====<開啟>
./viewtopic.php
=====<尋找>
$valid = FALSE;
if( $userdata['session_logged_in'] ) {
$sql = "SELECT p.poster_id, p.topic_id
FROM " . POSTS_TABLE . " p
WHERE p.topic_id = $topic_id
AND p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? TRUE : FALSE;}
=====<在該行中尋找>
$valid = FALSE;
=====<再下一行加入>
$attvalid = FALSE;
=====<儲存並關閉所有檔案>
=====<選用修改>(要不要改都可以)
=====<開啟>
./attach_mod/displaying.php
=====<尋找>
function display_review_attachments($post_id, $switch_attachment, $is_auth)
{
global $attach_config, $attachments;
if (intval($switch_attachment) == 0 || intval($attach_config['disable_mod']) || (!($is_auth['auth_download'] && $is_auth['auth_view'])) || intval($attach_config['attachment_topic_review']) == 0)
{
return;
}
@reset($attachments);
$attachments['_' . $post_id] = get_attachments_from_post($post_id);
if (sizeof($attachments['_' . $post_id]) == 0)
{
return;
}
display_attachments($post_id);
}
=====<在該行中尋找>
display_attachments($post_id);
=====<替換為>
//display_attachments($post_id);//因為在回覆的過程當中, 會漏餡....所以就不顯示了!!!
=====<儲存並關閉所有檔案>
請各位多多指教.....


