公告.置頂.分區Split topic type 1.0.5

主題已鎖定
頭像
cloudsnow30
.※.稜鏡之森の守護使者.※.
.※.稜鏡之森の守護使者.※.
文章: 145
註冊時間: 週六 2006-03-04 03:29
個人狀態: 冬眠喵型態
性別:
來自: 雲上天國
擁有感謝: 2 次
星座:
聯繫:

公告.置頂.分區Split topic type 1.0.5

文章 cloudsnow30 »

公告.置頂.分區

代碼: 選擇全部

<?php 
############################################################## 
## MOD Title: Split topic type 
## MOD Author: Ptirhiik < admin@rpgnet-fr.com > (Pierre) http://www.rpgnet-fr.com 
## MOD Description: 
## This mod splits the topic per type in the viewform display 
## MOD Version: 1.0.5 
## 
## Installation Level: Easy 
## Installation Time: 10 Minutes 
## Files To Edit: 
## viewforum.php 
## admin/admin_board.php 
## includes/page_header.php 
## language/lang_english/lang_admin.php 
## templates/subSilver/viewforum_body.tpl 
## templates/subSilver/admin/board_config_body.tpl 
## Included Files: n/a 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
############################################################## 
## MOD History: 
## 
## 2003-07-13 - Version 1.0.5 
## - allow to split the topic in boxes 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewforum.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
if( $total_topics ) 
{ 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
$prec_topic_real_type = -1; 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$template->assign_block_vars('topicrow', array( 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- delete 
// $template->assign_block_vars('topicrow', array( 
//-- add 
$topic_real_type = $topic_rowset[$i]['topic_type']; 

// if no split between global and standard announcement, group them with standard announcement 
if ( (!$switch_split_global_announce) && ($topic_real_type == POST_GLOBAL_ANNOUNCE) ) $topic_real_type = POST_ANNOUNCE; 

// if no split between announce and sticky, group them with sticky 
if ( (!$switch_split_announce) && ($topic_real_type == POST_ANNOUNCE) ) $topic_real_type = POST_STICKY; 

// if no split between sticky and normal, group them with normal 
if ( (!$switch_split_sticky) && ($topic_real_type == POST_STICKY) ) $topic_real_type = POST_NORMAL; 

// send to screen 
$is_rupt = false; 
if ( $prec_topic_real_type != $topic_real_type || ($i == 0)) 
{ 
// prec rupture : close tables 
if ($i != 0) 
{ 
if ($split_topic_split) 
{ 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.footer_table', array()); 
$template->assign_block_vars('row.footer_table.space', array()); 
} 
} 

$is_rupt = true; 
$title = ''; 
switch ($topic_real_type) 
{ 
case POST_GLOBAL_ANNOUNCE: 
$title = $lang['Post_global_announcement']; 
break; 
case POST_ANNOUNCE: 
$title = $lang['Post_Announcement']; 
break; 

case POST_STICKY: 
$title = $lang['Post_Sticky']; 
break; 

case POST_NORMAL: 
$title = $lang['Topics']; 
break; 

default: 
$title = '???'; 
break; 
} 

// rupture 
if (($i == 0) || $split_topic_split) 
{ 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.header_table', array( 
'TITLE' => ($split_topic_split) ? $title : $lang['Topics'], 
) 
); 
} 
if (!$split_topic_split) 
{ 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.header_row', array( 
'TITLE' => $title, 
) 
); 
} 
} 
$prec_topic_real_type = $topic_real_type; 

$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.topicrow', array( 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ FIND ]------------------------------------------------ 
# 
'U_VIEW_TOPIC' => $view_topic_url) 
); 
} 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.footer', array()); 

$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.footer_table', array()); 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$no_topics_msg = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['No_topics_post_one']; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.header_table', array( 
'TITLE' => $lang['Topics'], 
) 
); 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.switch_no_topics', array()); 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.footer', array()); 
$template->assign_block_vars('row', array()); 
$template->assign_block_vars('row.footer_table', array()); 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
admin/admin_board.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : ""; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
if ( isset($lang['Post_global_announcement']) ) 
{ 
$split_global_announce_yes = ( $new['split_global_announce'] ) ? 'checked="checked"' : ''; 
$split_global_announce_no = (!$new['split_global_announce'] ) ? 'checked="checked"' : ''; 
} 
$split_announce_yes = ( $new['split_announce'] ) ? 'checked="checked"' : ''; 
$split_announce_no = (!$new['split_announce'] ) ? 'checked="checked"' : ''; 
$split_sticky_yes = ( $new['split_sticky'] ) ? 'checked="checked"' : ''; 
$split_sticky_no = (!$new['split_sticky'] ) ? 'checked="checked"' : ''; 
$split_topic_split_yes = ( $new['split_topic_split'] ) ? 'checked="checked"' : ''; 
$split_topic_split_no = (!$new['split_topic_split'] ) ? 'checked="checked"' : ''; 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$template->assign_vars(array( 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
'L_ANNOUNCEMENT_SETTINGS' => $lang['Announce_settings'], 
'L_SPLIT_GLOBAL_ANNOUNCE' => $lang['split_global_announce'], 
'L_SPLIT_ANNOUNCE' => $lang['split_announce'], 
'L_SPLIT_STICKY' => $lang['split_sticky'], 
'L_SPLIT_TOPIC_SPLIT' => $lang['split_topic_split'], 
'SPLIT_GLOBAL_ANNOUNCE_YES' => $split_global_announce_yes, 
'SPLIT_GLOBAL_ANNOUNCE_NO' => $split_global_announce_no, 
'SPLIT_ANNOUNCE_YES' => $split_announce_yes, 
'SPLIT_ANNOUNCE_NO' => $split_announce_no, 
'SPLIT_STICKY_YES' => $split_sticky_yes, 
'SPLIT_STICKY_NO' => $split_sticky_no, 
'SPLIT_TOPIC_SPLIT_YES' => $split_topic_split_yes, 
'SPLIT_TOPIC_SPLIT_NO' => $split_topic_split_no, 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$template->pparse("body"); 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
if ( isset($lang['Post_global_announcement']) ) $template->assign_block_vars('switch_global_announce', array()); 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/page_header.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$template->pparse('overall_header'); 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
// split global announce 
$switch_split_global_announce = isset($lang['Post_global_announcement']); 
if ( isset($lang['Post_global_announcement']) && !isset( $board_config['split_global_announce'] ) ) 
{ 
$sqlw = "INSERT INTO ".CONFIG_TABLE." (config_name,config_value) VALUES('split_global_announce','" . $switch_split_global_announce . "')"; 
if ( !($resultw = $db->sql_query($sqlw)) ) message_die(GENERAL_ERROR, 'Could not add key split_annonce in config table', '', __LINE__, __FILE__, $sql); 
$board_config['split_global_announce'] = $switch_split_global_announce; 
} 
if ( isset($lang['Post_global_announcement']) ) 
{ 
$switch_split_global_announce = intval($board_config['split_global_announce']); 
} 

// split standard announce 
$switch_split_announce = true; 
if ( !isset( $board_config['split_announce'] ) ) 
{ 
$sqlw = "INSERT INTO ".CONFIG_TABLE." (config_name,config_value) VALUES('split_announce','" . $switch_split_announce . "')"; 
if ( !($resultw = $db->sql_query($sqlw)) ) message_die(GENERAL_ERROR, 'Could not add key split_annonce in config table', '', __LINE__, __FILE__, $sql); 
$board_config['split_announce'] = $switch_split_announce; 
} 
$switch_split_announce = intval($board_config['split_announce']); 

// split sticky 
$switch_split_sticky = true; 
if ( !isset( $board_config['split_sticky'] ) ) 
{ 
$sqlw = "INSERT INTO ".CONFIG_TABLE." (config_name,config_value) VALUES('split_sticky','" . $switch_split_sticky . "')"; 
if ( !($resultw = $db->sql_query($sqlw)) ) message_die(GENERAL_ERROR, 'Could not add key split_sticky in config table', '', __LINE__, __FILE__, $sql); 
$board_config['split_sticky'] = $switch_split_sticky; 
} 
$switch_split_sticky = intval($board_config['split_sticky']); 

// split in box 
$split_topic_split = false; 
if ( !isset($board_config['split_topic_split']) ) 
{ 
$sqlw = "INSERT INTO ".CONFIG_TABLE." (config_name,config_value) VALUES('split_topic_split','" . $split_topic_split . "')"; 
if ( !($resultw = $db->sql_query($sqlw)) ) message_die(GENERAL_ERROR, 'Could not add key split_topic_split in config table', '', __LINE__, __FILE__, $sql); 
$board_config['split_topic_split'] = $split_topic_split; 
} 
$split_topic_split = intval($board_config['split_topic_split']); 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_admin.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
// 
// That's all Folks! 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
//-- mod : split topic type ------------------------------------------------------------------------ 
//-- add 
$lang['Announce_settings'] = '公告?#93;置'; 
$lang['split_global_announce'] = '分離全区公告'; 
$lang['split_announce'] = '分離公告'; 
$lang['split_sticky'] = '分離置頂'; 
$lang['split_commend'] = '分離精華'; 
$lang['split_topic_split'] = '分?#125;主題類別於不同的欄框中'; 
//-- fin mod : split topic type -------------------------------------------------------------------- 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/viewforum_body.tpl 
# 
#-----[ FIND ]------------------------------------------------ 
# at top of the file 
<form method="post" action="{S_POST_DAYS_ACTION}"> 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
<!-- mod : split topic type --> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline"> 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
<!-- BEGIN row --> 
<!-- BEGIN header_table --> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<th colspan="2" align="center" height="25" class="thCornerL" nowrap="nowrap"> {L_TOPICS} </th> 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
<th width="100%" colspan="2" align="center" height="25" class="thCornerL" nowrap="nowrap"> {row.header_table.TITLE} </th> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<th align="center" class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th> 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
<th width="150" align="center" class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th> 
</tr> 
<!-- END header_table --> 
<!-- BEGIN header_row --> 
<tr> 
<td colspan="6" align="left" class="catLeft"><span class="cattitle">{row.header_row.TITLE}</span></td> 
</tr> 
<!-- END header_row --> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td> 
<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 /> 
{topicrow.GOTO_PAGE}</span></td> 
<td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td> 
<td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td> 
<td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td> 
<td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td> 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
# add row. in front of each field, also set title width to 100% 
<td class="row1" align="center" valign="middle" width="20"><img src="{row.topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{row.topicrow.L_TOPIC_FOLDER_ALT}" title="{row.topicrow.L_TOPIC_FOLDER_ALT}" /></td> 
<td class="row1" width="100%"><span class="topictitle">{row.topicrow.NEWEST_POST_IMG}{row.topicrow.TOPIC_TYPE}<a href="{row.topicrow.U_VIEW_TOPIC}" class="topictitle">{row.topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br /> 
{row.topicrow.GOTO_PAGE}</span></td> 
<td class="row2" align="center" valign="middle"><span class="postdetails">{row.topicrow.REPLIES}</span></td> 
<td class="row3" align="center" valign="middle"><span class="name">{row.topicrow.TOPIC_AUTHOR}</span></td> 
<td class="row2" align="center" valign="middle"><span class="postdetails">{row.topicrow.VIEWS}</span></td> 
<td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{row.topicrow.LAST_POST_TIME}<br />{row.topicrow.LAST_POST_AUTHOR} {row.topicrow.LAST_POST_IMG}</span></td> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<!-- END switch_no_topics --> 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<!-- BEGIN footer --> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
</span></td> 
</tr> 
</table> 
# 
#-----[ REPLACE WITH ]---------------------------------------- 
# 
</span></td> 
</tr> 
<!-- END footer --> 
<!-- BEGIN footer_table --> 
</table> 
<!-- BEGIN space --> 
<br class="gensmall"> 
<!-- END space --> 
<!-- END footer_table --> 
<!-- END row --> 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/board_config_body.tpl 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<h1>{L_CONFIGURATION_TITLE}</h1> 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
<!-- mod : split topic type --> 
# 
#-----[ FIND ]------------------------------------------------ 
# 
<tr> 
<th class="thHead" colspan="2">{L_ABILITIES_SETTINGS}</th> 
</tr> 
# 
#-----[ BEFORE, ADD ]----------------------------------------- 
# 
<tr> 
<th class="thHead" colspan="2">{L_ANNOUNCEMENT_SETTINGS}</th> 
</tr> 
<!-- BEGIN switch_global_announce --> 
<tr> 
<td class="row1">{L_SPLIT_GLOBAL_ANNOUNCE}</td> 
<td class="row2"><input type="radio" name="split_global_announce" value="1" {SPLIT_GLOBAL_ANNOUNCE_YES} /> {L_YES}  <input type="radio" name="split_global_announce" value="0" {SPLIT_GLOBAL_ANNOUNCE_NO} /> {L_NO}</td> 
</tr> 
<!-- END switch_global_announce --> 
<tr> 
<td class="row1">{L_SPLIT_ANNOUNCE}</td> 
<td class="row2"><input type="radio" name="split_announce" value="1" {SPLIT_ANNOUNCE_YES} /> {L_YES}  <input type="radio" name="split_announce" value="0" {SPLIT_ANNOUNCE_NO} /> {L_NO}</td> 
</tr> 
<tr> 
<td class="row1">{L_SPLIT_STICKY}</td> 
<td class="row2"><input type="radio" name="split_sticky" value="1" {SPLIT_STICKY_YES} /> {L_YES}  <input type="radio" name="split_sticky" value="0" {SPLIT_STICKY_NO} /> {L_NO}</td> 
</tr> 
<tr> 
<td class="row1">{L_SPLIT_TOPIC_SPLIT}</td> 
<td class="row2"><input type="radio" name="split_topic_split" value="1" {SPLIT_TOPIC_SPLIT_YES} /> {L_YES}  <input type="radio" name="split_topic_split" value="0" {SPLIT_TOPIC_SPLIT_NO} /> {L_NO}</td> 
</tr> 
# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM 
?>
Sakura Moon ~ 櫻井璃月 ~
論壇系統管理員-Cloud Snow 晴雪
主題已鎖定

回到「PHPBB2-外掛列表」