##############################################################
## MOD Title : 偽子分區-資料庫整合版
## MOD Author : ~倉木麻衣~ <
sabcat0613@yahoo.com.tw>
##
## MOD Description : 不需安裝子分區外掛,即可擁有類似子分區
## 功能的簡易外掛。具備後台控制功能,安裝
## 移除皆很容易。
##
## MOD Version : 1.0.1
##
## Installation Level : easy
## Installation Time : 5 minute(s)
## Files to edit : 3
## index.php
## includes/constants.php
## language/lang_chinese_traditional_taiwan/lang_admin.php
## Included Files : 3
## admin/admin_forums_control.php
## templates/subSilver/admin/forum_control_admin_body.tpl
## templates/subSilver/admin/forum_control_edit_body.tpl
##
##############################################################
## Author Notes:
## 這個文件是給從未安裝過偽子分區外掛的使用者參考之安裝文件。
## 程式語法邏輯若有可以加強的地方,也歡迎提出指教。
## 安裝完成後,請至系統管理控制台的偽子分區版面裡進行設定。
##
##############################################################
## MOD History:
##
## 2005-05-03
## Version 2.0.1 版釋出\r
## 嘗試修正偽子分區的版面id不可小於欲隱藏版面的最大id。
## 意即您可隨意設定被隱藏版面及偽子分區的版面,而不需要
## 考慮其大小關係。
## 偽子分區版面的新文章通知納入最後發表欄位。若只有版面\r
## 左方有出現新文章的大圖示,而版面說明裡並未出現新文章
## 小圖示,則代表僅有該偽子分區版面裡有新文章。
##
## 2005-03-18
## Version 1.0.2 版釋出\r
## 程式碼微調,並取消原本改變版面標題來達到新文章通知的效果,
## 改由在版面說明中對應的版面名稱顯示新文章小圖示。
## 偽子分區版面也能顯示被隱藏版內的文章及主題總數,以及該分區
## 內最後發表的資訊。
## 偽子分區版面新增、編輯採用更直覺的設定方式。
##
## 2005-01-13
## Version 1.0.1 版釋出\r
## 修正上一版儘能指定1個偽子區版面的問題
##
## 2005-01-08
## Version 1.0.0 版釋出\r
##
http://www.phpbb-tw.net/phpbb/viewtopic ... 574#178574
## 此版本儘能指定1個偽子分區版面\r
##
##############################################################
#
#-----[ SQL ]----------------------------------------------
#
# 1.將 root/db_create.php 複製到 db_create.php
# 2.以phpBB系統管理員的身份執行 db_create.php
# 3.執行完後請將 db_create.php 刪除\r
copy root/db_create.php to db_create.php
execute db_create.php
delete db_create.php
#
#-----[ COPY ]------------------------------------------------
#
root/admin/admin_forums_control.php to admin/admin_forums_control.php
root/templates/subSilver/admin/forum_control_admin_body.tpl to templates/subSilver/admin/forum_control_admin_body.tpl
root/templates/subSilver/admin/forum_control_edit_body.tpl to templates/subSilver/admin/forum_control_edit_body.tpl
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
if ( $viewcat == $cat_id || $viewcat == -1 )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
$sql = "SELECT fc.*, f.forum_desc
FROM " . FORUMS_CONTROL_TABLE . " AS fc, " . FORUMS_TABLE . " AS f
WHERE fc.show_forums = f.forum_id";
if(!$q_forums = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($q_forums) )
{
$forums_control[$row['show_forums']]['hide_forums'] = $row['hide_forums'];
}
$db->sql_freeresult($q_forums);
#
#-----[ FIND ]------------------------------------------------
#
$posts = $forum_data[$j]['forum_posts'];
$topics = $forum_data[$j]['forum_topics'];
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
if ($forums_control[$forum_id]['hide_forums'])
{
$hides = split(',', $forums_control[$forum_id]['hide_forums']);
for ($index=0; $index < count($hides); $index++)
{
settype($hides[$index], 'integer');
}
sort($hides);
reset($hides);
$found = false;
for ($index=0; $index < count($hides); $index++)
{
if ( !empty($new_topic_data[$hides[$index]]) )
{
$forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$hides[$index]]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$found = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$found = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$hides[$index]]) )
{
if ( $tracking_forums[$hides[$index]] > $forum_last_post_time )
{
$found = false;
}
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
{
$found = false;
}
}
$patten = '/(\?f=' . $hides[$index] . '[\'"]?.*?>)/i';
$forum_data[$j]['forum_desc']= ($found)? preg_replace($patten,'$1<img src="' . $images['icon_minipost_new'] . '" border="0" alt="' . $lang['New_post'] . '">' , $forum_data[$j]['forum_desc']) : $forum_data[$j]['forum_desc'];
}
$folder_image = ( $found ) ? $images['forum_new'] : $folder_image;
$folder_alt = ( $found ) ? $lang['New_posts'] : $folder_alt;
for ($k=0; $k < $total_forums; $k++)
{
if ($forum_data[$k]['forum_id'] == $hides[$index])
{
$forum_data[$j]['forum_posts'] += $forum_data[$k]['forum_posts'];
$forum_data[$j]['forum_topics'] += $forum_data[$k]['forum_topics'];
if ($forum_data[$j]['post_time'] < $forum_data[$k]['post_time'])
{
$forum_data[$j]['forum_last_post_id'] = $forum_data[$k]['forum_last_post_id'];
$forum_data[$j]['post_time'] = $forum_data[$k]['post_time'];
$forum_data[$j]['user_id'] = $forum_data[$k]['user_id'];
$forum_data[$j]['post_username'] = $forum_data[$k]['post_username'];
$forum_data[$j]['username'] = $forum_data[$k]['username'];
}
}
}
}
}
#
#-----[ OPEN ]------------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------------
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
define('FORUMS_CONTROL_TABLE', $table_prefix.'forums_control');
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_admin.php
#
#-----[ FIND ]------------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
$lang['Controls'] = '偽子分區';
$lang['Click_return_forumcontrol_admin'] = '點選 %s這裡%s 返回偽子分區版面管理';
$lang['Forum_control'] ='偽子分區版面管理';
$lang['Forum_control_explain'] = '在這個控制版面裡,您可以新增,刪除,編輯偽子區的設定資料.';
$lang['Forum_control_settings'] ='偽子分區版面設定';
$lang['Add_control'] = '新增偽子分區設定';
$lang['Edit_control'] = '編輯偽子分區設定';
$lang['Show_forums_id'] ='偽子分區版面編號';
$lang['Hide_forums_id'] ='隱藏版面編號';
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
#EoM