[外掛]主題類型分區劃(資料庫版)

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

版主: 版主管理群

主題已鎖定
Martinet
竹貓忠實會員
竹貓忠實會員
文章: 850
註冊時間: 2003-06-09 21:58
聯繫:

[外掛]主題類型分區劃(資料庫版)

文章 Martinet »

感謝 H.T.Demon 找出安裝文件的錯誤^^


########################################################
## 外掛名稱: 主題類型分區劃 (資料庫版 by Martinet)
## 外掛版本: 1.0.3
## 外掛原作者: 炎之虛空(御津闇慈)
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述: 這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,讓會員不會在版面上使用到錯誤的主題類型
##
## 安裝難度: 簡單
## 安裝時間: 5 分鐘
##
## 需要編輯的檔案: 6
## posting.php
## posting_body.tpl
## admin/admin_forums.php
## template/你的風格/admin/forum_edit_body.tpl
## language/你的語言/lang_admin.php
## language/你的語言/lang_main.php
##
## 附加的檔案: n/a
##
## 附加的圖示: n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################

由於有些是中途改出來的 , 若有錯誤請通知我修改一下^^

請先到你的資料庫裡執行SQL語法

代碼: 選擇全部

ALTER TABLE `phpbb_forums` ADD `forum_topictypes` VARCHAR( 255 ) DEFAULT '[等你改],[]' NOT NULL 
打開 posting.php

找到\r

代碼: 選擇全部

// 
// Include page header 
// 
在前面加上

代碼: 選擇全部

//Topic type mod
$topictypes =  explode(",",$post_info['forum_topictypes']);

$ttopions = ''; 
foreach ($topictypes as $topictype) 
	{ 
		$ttoptions .= '<option value="' . $topictype . '">' . $topictype . "</option>
"; 
	} 
	$template->assign_vars(array( 
		'L_TOPIC_TYPES_EXPLAIN' => $lang['topic_types_explain'], 
		'TOPIC_TYPES'
			
				=> $ttoptions) 
	); 
$template->assign_block_vars('switch_topictypes', array()); 

//Topic type mod end 

打開 admin/admin_forums.php

找到\r

代碼: 選擇全部

$forumstatus = $row['forum_status'];
後面加上

代碼: 選擇全部

$forum_topictypes = $row['forum_topictypes'];
找到\r

代碼: 選擇全部

$forumstatus = FORUM_UNLOCKED;
				$forum_id = ''; 
				$prune_enabled = '';
後面加上

代碼: 選擇全部

$forum_topictypes = '[等你改],[]';

找到\r

代碼: 選擇全部

'S_PRUNE_ENABLED' => $prune_enabled,
後面加上

代碼: 選擇全部

'S_FORUM_TOPICTYPES' => $forum_topictypes,
找到\r

代碼: 選擇全部

'L_DAYS' => $lang['Days'],
後面加上

代碼: 選擇全部

'L_FORUM_TOPICTYPES' => $lang['Forum_topictypes'],
找到\r

代碼: 選擇全部

// There is no problem having duplicate forum names so we won't check for it.
前面加上

代碼: 選擇全部

if(trim($HTTP_POST_VARS['topictypes'])==''){$HTTP_POST_VARS['topictypes']='[等你改],[]';}
找到\r

代碼: 選擇全部

$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
	VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

在行內找到\r

代碼: 選擇全部

prune_enable
後面加上

代碼: 選擇全部

, forum_topictypes
在行內找到\r

代碼: 選擇全部

$value_sql
前面加上

代碼: 選擇全部

",'".str_replace("\'", "''", $HTTP_POST_VARS['topictypes'])."'".


找到\r

代碼: 選擇全部

$sql = "UPDATE " . FORUMS_TABLE . "
	SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
	WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);

在行內找到\r

代碼: 選擇全部

prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
在後面加上

代碼: 選擇全部

,forum_topictypes = '".str_replace("\'", "''", $HTTP_POST_VARS['topictypes'])."'

打開 posting_body.tpl

找到\r

代碼: 選擇全部

<!-- END switch_privmsg --> 
<tr> 
<td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td> 
 

<td class="row2" width="78%"> <span class="gen">
在後面加上

代碼: 選擇全部

<!-- TopicTypes Mod --> 
<!-- BEGIN switch_topictypes --> 
<select onchange="document.post.subject.focus(); document.post.subject.value = this.options[this.selectedIndex].value + document.post.subject.value;"> 
<option selected value="">{L_TOPIC_TYPES_EXPLAIN}</option> 
{TOPIC_TYPES} 
</select> 
<!-- END switch_topictypes --> 
<!-- End Mod -->


打開 template/你的風格/admin/forum_edit_body.tpl

找到\r

代碼: 選擇全部

<tr> 
	<td class="row1">{L_FORUM_NAME}</td>
	<td class="row2"><input type="text" size="25" name="forumname" value="{FORUM_NAME}" class="post" /></td>
	</tr>
後面加上

代碼: 選擇全部

<tr> 
	<td class="row1">{L_FORUM_TOPICTYPES}</td>
	<td class="row2"><input type="text" size="45" name="topictypes" value="{S_FORUM_TOPICTYPES}" class="post" /></td>
	</tr>

打開 language/你的語言/lang_admin.php

找到\r

代碼: 選擇全部

//
// That's all Folks!

前面加上

代碼: 選擇全部

$lang['Forum_topictypes'] = '這個版面的主題類型';

打開 language/你的語言/lang_main.php

找到\r

代碼: 選擇全部

//
// That's all Folks!

前面加上

代碼: 選擇全部

$lang['topic_types_explain'] = '主題類型';
###############EOM 存檔結束##############
主題已鎖定

回到「非官方認證外掛」