和河風兄所發布的「[原創]討論區前方加入ICON」功能相同
只是這個MOD也可以在分區加上圖案
而且它採用資料庫管理,可在後台控制圖案位置\r
其他就沒什麼不同了
我把它中文化並且新增一些功能\r
包括新增後台管理說明
新增圖案大小限制\r
及參考河風兄修改版面設計
範例:http://bbs.csfuture.com/
代碼: 選擇全部
#################################################################
## Mod Title: Categories & Forum Icon <Improved Version>
## Mod Version: 1.0.0 Pro.
## Author: Anh Le Minh < netanh@zapo.net >
## Improved By Bill,Yuan-yao Shih < service@csfuture.com >
## Description:
## This Mod gives 1 images beside your categories name, forum name on index page
## Installation Level: easy
## Installation Time: 10-15 Minutes
## Files To Edit:
##
## admin\admin_forums.php,
## language\lang_xxx\lang_admin.php,
## language\lang_xxx\lang_main.php,
## templates\YOUR_TEMPLATE\index_body.tpl,
## templates\YOUR_TEMPLATEr\admin\category_edit_body.tpl,
## templates\YOUR_TEMPLATE\admin\forum_edit_body.tpl,
## index.php
## Included Files: none,
##
## Generator: phpBB2 phpBB MODCreator v 1.1
#################################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
#################################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ 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/downloads/
#################################################################
## Author Note:
## First always make a back-up from the files that you're going to edit.
## This add-on MOD adds a few field to your 'forums' & 'categories' table.
#################################################################
##
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ SQL ]------------------------------------------
# Notice the prefix(phpbb) ,you may chage it to fit in with your config.
SQL QUERY:
ALTER TABLE phpbb_forums ADD forum_icon VARCHAR(100);
ALTER TABLE phpbb_categories ADD cat_icon VARCHAR(100);
#
#-----[ OPEN ]------------------------------------------
#
language/lang_xxx/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
[English]
// Categories & Forum icon MOD
$lang['Icon'] = "Icon";
[Chinese]
// Categories & Forum icon MOD
$lang['Icon'] = "圖示";
####### SAVE & CLOSE: language/lang_xxx/lang_main.php #######
#############################################################
#
#-----[ OPEN ]------------------------------------------
#
language/lang_xxx/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]------------------------------------------
#
[English]
// Categories & Forum icon MOD
$lang['Icon'] = "Icon";
$lang['Icon_explain'] = "Notice! Size of All icons will be limited to 32x32 pixels"
[Chinese]
// Categories & Forum icon MOD
$lang['Icon'] = "圖示";
$lang['Icon_explain'] = "所有圖示的大小將會被限制在32x32像素<br>預設路徑為「系統程式存放路徑」"
####### SAVE & CLOSE: language/lang_xxx/lang_admin.php ######
#############################################################
#
#-----[ OPEN ]------------------------------------------
#
admin\admin_forums.php
#
#-----[ FIND ]------------------------------------------
#
case 'editforum':
//
// Show form to create/modify a forum
//
if ($mode == 'editforum')
{
// $newmode determines if we are going to INSERT or UPDATE after posting?
$l_title = $lang['Edit_forum'];
$newmode = 'modforum';
$buttonvalue = $lang['Update'];
$forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
$row = get_info('forum', $forum_id);
$cat_id = $row['cat_id'];
$forumname = $row['forum_name'];
$forumdesc = $row['forum_desc'];
$forumstatus = $row['forum_status'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$forumicon = $row['forum_icon'];
#
#-----[ FIND ]------------------------------------------
#
$forumdesc = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$forumicon = '';
#
#-----[ FIND ]------------------------------------------
#
'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_ICON' => $lang['Icon'],
'L_ICON_EXPLAIN' => $lang['Icon_explain'],
#
#-----[ FIND ]------------------------------------------
#
'DESCRIPTION' => $forumdesc)
#
#-----[ REPLACE WITH ]------------------------------------------
#
'DESCRIPTION' => $forumdesc,
'F_ICON' => $forumicon)
#
#-----[ FIND ]------------------------------------------
#
$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 . ")";
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, forum_icon, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', " . 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 . ")";
#
#-----[ FIND ]------------------------------------------
#
$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]);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$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_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', 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]);
#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
VALUES ('" . $HTTP_POST_VARS['categoryname'] . "', $next_order)";
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order, cat_icon)
VALUES ('" . $HTTP_POST_VARS['categoryname'] . "', $next_order, $caticon)";
#
#-----[ FIND ]------------------------------------------
#
$cat_title = $row['cat_title'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$caticon = $row['cat_icon'];
#
#-----[ FIND ]------------------------------------------
#
'CAT_TITLE' => $cat_title,
#
#-----[ AFTER, ADD ]------------------------------------------
#
'CAT_ICON' => $caticon,
'L_ICON' => $lang['Icon'],
'L_ICON_EXPLAIN' => $lang['Icon_explain'],
#
#-----[ FIND ]------------------------------------------
#
// Modify a category in the DB
$sql = "UPDATE " . CATEGORIES_TABLE . "
SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "UPDATE " . CATEGORIES_TABLE . "
SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', cat_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_icon']) . "'
WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
#
#-----[ FIND ]------------------------------------------
#
$name = $catinfo['cat_title'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$caticon = $catinfo['cat_icon'];
############ SAVE & CLOSE: admin\admin_forums.php ###########
#############################################################
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . CATEGORIES_TABLE . " c
#
#-----[ REPLACE WITH ]------------------------------------------
#
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order, c.cat_icon
FROM " . CATEGORIES_TABLE . " c
#
#-----[ FIND ]------------------------------------------
#
if ( $display_forums )
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
);
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $display_forums )
{
if ($category_rows[$i]['cat_icon'] != '')
{$c_icon = ' <img src="'.$category_rows[$i]['cat_icon'].'" onload="javascript:if(this.width>32) this.width=32" align="absmiddle"/> ';}
else {$c_icon = '';}
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'CAT_ICON' => $c_icon,
'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
);
#
#-----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_ID' => $forum_data[$j]['forum_id'],
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],
#
#-----[ REPLACE WITH ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
if ($forum_data[$j]['forum_icon'] != '')
{$f_icon = ' <img src="'.$forum_data[$j]['forum_icon'].'" onload="javascript:if(this.width>32) this.width=32" align="absmiddle"> ';}
else {$f_icon = '';}
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_ID' => $forum_data[$j]['forum_id'],
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'FORUM_ICON' => $f_icon,
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],
################## SAVE & CLOSE: index.php ##################
#############################################################
#
#-----[ OPEN ]------------------------------------------
#
templates\YOUR_TEMPLATE\admin\forum_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_FORUM_DESCRIPTION}</td>
<td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="forumdesc" class="post">{DESCRIPTION}</textarea></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_ICON}<br /><span class="gensmall">{L_ICON_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="40" name="forumicon" value="{F_ICON}" class="post" /></td>
</tr>
####### SAVE & CLOSE: templates\subSilver\admin\forum_edit_body.tpl #######
###########################################################################
#
#-----[ OPEN ]------------------------------------------
#
templates\subSilver\admin\category_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_CATEGORY}</td>
<td class="row2"><input type="text" size="25" name="cat_title" value="{CAT_TITLE}" /></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_ICON}<br /><span class="gensmall">{L_ICON_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="25" name="cat_icon" value="{CAT_ICON}" class="post" /></td>
</tr>
####### SAVE & CLOSE: templates\subSilver\admin\category_edit_body.tpl #######
##############################################################################
#
#-----[ OPEN ]------------------------------------------
#
templates\subSilver\index_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<a title="{catrow.CAT_DESC}">{catrow.CAT_ICON}</a>
#
#-----[ FIND ]------------------------------------------
#
<span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<table cellpadding="0" cellspacing="0"><tr><td>
<a title="{catrow.forumrow.FORUM_NAME}">{catrow.forumrow.FORUM_ICON}</a>
</td>
<td class="row1" width="100%" height="50" onMouseOver="this.style.backgroundColor='#FFFFFF';" onMouseOut="this.style.backgroundColor='#F5F3EB';"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
</tr></table>
####### SAVE & CLOSE: templates\subSilver\index_body.tpl #######
################################################################
#Eom