[分享]主題類型分區劃2.0.0

網站架設,免費空間申請,架站技術交流區
頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

[分享]主題類型分區劃2.0.0

文章炎之虛空 » 2005-12-29 11:14 pm

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


http://imoml.phpbb-tw.com/phpbb/viewtopic.php?t=25



頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2005-12-30 12:40 am

代碼: 選擇全部
########################################################
## 外掛名稱:      主題類型分區劃 (資料庫版 by Martinet) 2.0.1 升級檔
## 外掛版本:      2.0.1
## 外掛原作者:    炎之虛空(御津闇慈)
## 外掛強化者:    炎之虛空(御津闇慈) <http://imoml.phpbb-tw.com/>
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述:    這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,
##      讓會員不會在版面上使用到錯誤的主題類型
##      並且新增加"主題分類功能"
##      2005/12/29新增加預設主題功能(感謝吉川拓也建議)
##
## 升級難度:      簡單
## 升級時間:      5 分鐘
##
## 需要編輯的檔案:   6
## viewforum.php
## posting.php 
## admin/admin_board.php
## admin/admin_forums.php
## template/你的風格/board_config_body.tpl   
## language/你的語言/lang_admin.php
##
## 附加的檔案:       n/a
##
## 附加的圖示:      n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################
#
#-----[ ADD SQL ]------------------------------------------
#

INSERT INTO phpbb_config (config_name , config_value) VALUES ('budget_types', '');

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

posting.php

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

$topictypes = explode(",",$post_info['forum_topictypes']);

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

if($post_info['forum_topictypes'] == '' && $board_config['budget_types'] != '')
{
$topictypes = explode(",",$board_config['budget_types']);
}else{
$topictypes = explode(",",$post_info['forum_topictypes']);
}

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

if($post_info['forum_topictypes']!='')

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

if(($mode == 'newtopic' && $post_info['forum_topictypes'] != '')||($mode == 'newtopic' && $board_config['budget_types'] != ''))

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

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

if($forum_row['forum_topictypes']!='')

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

if($forum_row['forum_topictypes']!='' || $board_config['budget_types']!='')

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

   $topictypes = explode(",",$forum_row['forum_topictypes']);

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

   if($forum_row['forum_topictypes'] =='' && $board_config['budget_types'] !='')
   {
   $topictypes = explode(",",$board_config['budget_types']);
   }else{
   $topictypes = explode(",",$forum_row['forum_topictypes']);
   }

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

   $topictypes = explode(",",$forum_row['forum_topictypes']);

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

   if($forum_row['forum_topictypes'] =='' && $board_config['budget_types'] !='')
   {
   $topictypes = explode(",",$board_config['budget_types']);
   }else{
   $topictypes = explode(",",$forum_row['forum_topictypes']);
   }

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php     

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

"L_RESET" => $lang['Reset'],

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

"BUDGET_TYPE" => $lang['Budget_Type'], // Budget_Types
"L_BUDGET_TYPES" => $lang['Budget_Types'], // Budget_Types
"BUDGET_TYPES" => $new['budget_types'], // Budget_Types
#
#-----[ OPEN ]------------------------------------------
#
template/你的風格/admin/board_config_body.tpl

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

<tr>
      <td class="row1">{L_ENABLE_PRUNE}</td>
      <td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}&&<input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
   </tr> 

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

<tr><!-- Budget_Types_MOD -->
      <th class="thHead" colspan="2">{BUDGET_TYPE}</th>
   </tr>
   <tr>
      <td class="row1" valign="top">{L_BUDGET_TYPES}</td>
      <td class="row2""><textarea name="budget_types" rows="5" cols="60" maxlength="255">{BUDGET_TYPES}</textarea></td>
   </tr>

#
#-----[ OPEN ]------------------------------------------
#
language/你的語言/lang_admin.php

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

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

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

$lang['Budget_Type'] = '預設主題'; // Budget_Type
$lang['Budget_Types'] = '預設主題類型(請以逗號分類)'; // Budget_Types
$lang['Forum_Budget_Types'] = '假如沒設定的話將會以預設主題為主(請到基本組態設定)'; // Budget_Types

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_forums.php

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

'L_FORUM_TOPICTYPES' => $lang['Forum_topictypes'] ,

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

'L_FORUM_TOPICTYPES' => ( $board_config['budget_types'] =='' ) ? $lang['Forum_topictypes'] : $lang['Forum_topictypes'].'<br>'.$lang['Forum_Budget_Types'],




頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2005-12-31 5:17 pm

因為升級檔一些筆誤而導致有些功能失效
請見諒
這也告訴我們
熬夜行為是不對的
修正檔已經修正



頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2006-01-04 11:58 pm

代碼: 選擇全部
########################################################
## 外掛名稱:      主題類型分區劃 (資料庫版 by Martinet) 2.0.2 升級檔
## 外掛版本:      2.0.2
## 外掛原作者:    炎之虛空(御津闇慈)
## 外掛強化者:    炎之虛空(御津闇慈) <http://imoml.phpbb-tw.com/>
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述:    這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,
##      讓會員不會在版面上使用到錯誤的主題類型
##      並且新增加"主題分類功能"
##      2005/12/29新增加預設主題功能(感謝吉川拓也建議)
##   2006/01/03新增加禁止自訂主題以及強制主題功能(感謝依夢兒跟倉木麻衣提供修改)
##
## 升級難度:      簡單
## 升級時間:      5 分鐘
##
## 需要編輯的檔案:   3 
## posting.php 
## includes/functions_post.php 
## language/你的語言/lang_main.php
##
## 附加的檔案:       n/a
##
## 附加的圖示:      n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php

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

      $ttoptions .= '<option value="' . $topictype . '">' . $topictype . "</option>\n";
#
#-----[ REPLACE ]------------------------------------------
#

      $ttoptions .= '<option value="' . $topictype . ' ">' . $topictype . "</option>\n";

#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php

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

//
// Prepare a message for posting
//
function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length)
{
   global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;

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

   global $post_info;

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

else if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
   {
      $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
   }

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

if(($post_info['forum_topictypes'] != '') || ($board_config['budget_types'] != ''))
{
   //強制主題類型   
   if ($mode == 'newtopic' && !preg_match("/^(\s| )*\[/",$subject) )
   {
      $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_subject_type'] : $lang['Empty_subject_type'];
   }
         
   // 禁止會員自訂主題
   $ject = explode(" ", $subject);
   if($post_info['forum_topictypes'] =='' && $board_config['budget_types'] !='')
      {
      $types = explode(",",$board_config['budget_types']);
      }else{
      $types = explode(",",$post_info['forum_topictypes']);
      }
   if(@!in_array($ject[0],$types) && $mode == 'newtopic')
      {
      $error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_type'] : $lang['Empty_type'];
      }
}

#
#-----[ OPEN ]------------------------------------------
#
language/你的語言/lang_main.php

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

$lang['All_Topics'] = '所有主題';

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

$lang['Empty_subject_type'] = '發表主題必須選擇主題類型';
$lang['Empty_type'] = '請正確選擇主題類型!';



最後由 炎之虛空 於 2006-01-07 11:41 pm 編輯,總共編輯了 1 次。

頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2006-01-04 11:58 pm

這個是額外的設定
原本就不歸納於升級部份
代碼: 選擇全部
########################################################
## 外掛名稱:      主題類型分區劃 (資料庫版 by Martinet) 額外設定
## 外掛版本:      額外設定
## 外掛原作者:    炎之虛空(御津闇慈)
## 外掛強化者:    炎之虛空(御津闇慈) <http://imoml.phpbb-tw.com/>
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述:    這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,
##      讓會員不會在版面上使用到錯誤的主題類型
##      並且新增加"主題分類功能"
##      2005/12/29新增加預設主題功能(感謝吉川拓也建議)
##   2006/01/03新增加禁止自訂主題以及強制主題功能(感謝依夢兒跟倉木麻衣提供修改)
##   額外設定:JS視窗彈出功能
##
## 升級難度:      簡單
## 升級時間:      5 分鐘
##
## 需要編輯的檔案:   4 
## posting.php 
## privmsg.php
## language/你的語言/lang_main.php
## posting_body.tpl
##
## 附加的檔案:       n/a
##
## 附加的圖示:      n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php

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

   $template->assign_block_vars('switch_topictypes', array());
   }

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

   $template->assign_block_vars('switch_topictypes', array());
   $typeserror = $lang['Types_Error'];
   }else{
   $typeserror = "false";
   }

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

   'SMILIES_STATUS' => $smilies_status,
   
#
#-----[ AFTER, ADD ]------------------------------------------
#

   'TYPESERROR' => $typeserror,

#
#-----[ OPEN ]------------------------------------------
#
privmsg.php

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

$template->assign_block_vars('switch_privmsg', array());

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

   $typeserror = "false";

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

   'FORUM_NAME' => $lang['Private_Message'],

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

   'TYPESERROR' => $typeserror,

#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl

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

if (document.post.message.value.length < 2) {
      formErrors = "{L_EMPTY_MESSAGE}";
   }

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

   if(document.post.subject.value != '' && (document.post.subject.value.charAt(0) != '[' || document.post.subject.value.lastIndexOf('] ') == -1) && document.post.subject.value.substring(0, 3) != 'Re:')
      {
         formErrors = {TYPESERROR};
      }

#
#-----[ OPEN ]------------------------------------------
#
language/你的語言/lang_main.php

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

$lang['All_Topics'] = '所有主題';

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

$lang['Types_Error'] = '"必需選擇 [主題類型] + 空格 + 主題名稱。"';




頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2006-01-04 11:59 pm

代碼: 選擇全部
########################################################
## 外掛名稱:      主題類型分區劃 (資料庫版 by Martinet) 2.0.3 升級檔
## 外掛版本:      2.0.3 升級檔
## 外掛原作者:    炎之虛空(御津闇慈)
## 外掛強化者:    炎之虛空(御津闇慈) <http://imoml.phpbb-tw.com/>
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述:    這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,
##      讓會員不會在版面上使用到錯誤的主題類型
##      並且新增加"主題分類功能"
##      2005/12/29新增加預設主題功能(感謝吉川拓也建議)
##   2006/01/03新增加禁止自訂主題以及強制主題功能(感謝依夢兒跟倉木麻衣提供修改)
##   額外設定:JS視窗彈出功能
##   2006/01/04新增加對Hide subject field on reply外掛支援
##
## 升級難度:      簡單
## 升級時間:      5 分鐘
##
## 需要編輯的檔案:   2 
## posting.php 
## posting_body.tpl
##
## 附加的檔案:       n/a
##
## 附加的圖示:      n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php

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

//Topic type mod
if($post_info['forum_topictypes'] == '' && $board_config['budget_types'] != '')
{
$topictypes = explode(",",$board_config['budget_types']);
}else{
$topictypes = explode(",",$post_info['forum_topictypes']);
}
$ttopions = '';
foreach ($topictypes as $topictype)
   {
      $ttoptions .= '<option value="' . $topictype . ' ">' . $topictype . "</option>\n";
   }
   $template->assign_vars(array(
      'L_TOPIC_TYPES_EXPLAIN' => $lang['topic_types_explain'],
      'TOPIC_TYPES' => $ttoptions)
   );
if(($mode == 'newtopic' && $post_info['forum_topictypes'] != '')||($mode == 'newtopic' && $board_config['budget_types'] != ''))
{
$template->assign_block_vars('switch_topictypes', array());
}

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

//Topic type mod
if($post_info['forum_topictypes'] == '' && $board_config['budget_types'] != '')
{
$topictypes = explode(",",$board_config['budget_types']);
}else{
$topictypes = explode(",",$post_info['forum_topictypes']);
}
$ttopions = '';
if(($mode == 'newtopic' && $post_info['forum_topictypes'] != '')||($mode == 'newtopic' && $board_config['budget_types'] != ''))
{
$ttoptions .='<select onchange="document.post.subject.focus(); document.post.subject.value = this.options[this.selectedIndex].value + document.post.subject.value;"><option selected value="">'.$lang['topic_types_explain'].'</option>';
foreach ($topictypes as $topictype)
   {
      $ttoptions .= '<option value="' . $topictype . ' ">' . $topictype . "</option>\n";
   }
$ttoptions .='</select>';
   $template->assign_vars(array( 
      'TOPIC_TYPES' => $ttoptions)
   );
}

#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl

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

   <!-- 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 -->

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

{TOPIC_TYPES}


--------------------[有使用額外設定部份]-----------------------
代碼: 選擇全部
########################################################
## 外掛名稱:      主題類型分區劃 (資料庫版 by Martinet) 2.0.3升級檔(有加裝額外設定)
## 外掛版本:      2.0.3升級檔(有加裝額外設定)
## 外掛原作者:    炎之虛空(御津闇慈)
## 外掛強化者:    炎之虛空(御津闇慈) <http://imoml.phpbb-tw.com/>
## 外掛資料庫化 : Martinet Oaf <oafwork@hotmail.com>
##
## 外掛描述:    這個外掛可以讓管理員在控制台中指定各個討論版發表主題的主題類型 ,
##      讓會員不會在版面上使用到錯誤的主題類型
##      並且新增加"主題分類功能"
##      2005/12/29新增加預設主題功能(感謝吉川拓也建議)
##   2006/01/03新增加禁止自訂主題以及強制主題功能(感謝依夢兒跟倉木麻衣提供修改)
##   額外設定:JS視窗彈出功能
##   2006/01/04新增加對Hide subject field on reply外掛支援
##
## 升級難度:      簡單
## 升級時間:      5 分鐘
##
## 需要編輯的檔案:   2 
## posting.php 
## posting_body.tpl
##
## 附加的檔案:       n/a
##
## 附加的圖示:      n/a
##
##############################################################
## 在增加此外掛前, 請務必備份所有需要修改的檔案
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php

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

//Topic type mod
if($post_info['forum_topictypes'] == '' && $board_config['budget_types'] != '')
{
$topictypes = explode(",",$board_config['budget_types']);
}else{
$topictypes = explode(",",$post_info['forum_topictypes']);
}
$ttopions = '';
foreach ($topictypes as $topictype)
   {
      $ttoptions .= '<option value="' . $topictype . ' ">' . $topictype . "</option>\n";
   }
   $template->assign_vars(array(
      'L_TOPIC_TYPES_EXPLAIN' => $lang['topic_types_explain'],
      'TOPIC_TYPES' => $ttoptions)
   );
if(($mode == 'newtopic' && $post_info['forum_topictypes'] != '')||($mode == 'newtopic' && $board_config['budget_types'] != ''))
{
$template->assign_block_vars('switch_topictypes', array());
}

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

//Topic type mod
if($post_info['forum_topictypes'] == '' && $board_config['budget_types'] != '')
{
$topictypes = explode(",",$board_config['budget_types']);
}else{
$topictypes = explode(",",$post_info['forum_topictypes']);
}
$ttopions = '';
if(($mode == 'newtopic' && $post_info['forum_topictypes'] != '')||($mode == 'newtopic' && $board_config['budget_types'] != ''))
{
$ttoptions .='<select onchange="document.post.subject.focus(); document.post.subject.value = this.options[this.selectedIndex].value + document.post.subject.value;"><option selected value="">'.$lang['topic_types_explain'].'</option>';
foreach ($topictypes as $topictype)
   {
      $ttoptions .= '<option value="' . $topictype . ' ">' . $topictype . "</option>\n";
   }
$ttoptions .='</select>';
   $template->assign_vars(array( 
      'TOPIC_TYPES' => $ttoptions)
   );
$typeserror = $lang['Types_Error'];
   }else{
   $typeserror = "false";
   }


#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl

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

   <!-- 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 -->

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

{TOPIC_TYPES}





ETERNAL
 
文章: 2937
註冊時間: 2003-12-03 11:08 pm
性別: 男生

文章ETERNAL » 2006-01-08 11:17 am

版主可以自訂主題類型嗎?
還是只有系統管理員才可以定主題類型?


水色論壇 http://www.et99.net
簡恩峻分享

頭像
炎之虛空
 
文章: 30
註冊時間: 2003-05-10 10:40 pm

文章炎之虛空 » 2006-01-08 11:47 pm

ETERNAL 寫:版主可以自訂主題類型嗎?
還是只有系統管理員才可以定主題類型?

只有系統管理員才可以自訂主題
:o




回到 架站討論

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 9 位訪客