- Modificatie & Versie:
Directe link naar de modificatie:
Adres van je forum: http://
2.22:
ja veel met succes?
er ontbreekt iets?
help maar ajb
Code: Selecteer alles
###############################################
##
## MOD Title: Categories & Forum Icon
## MOD Version: 1.0.0
## Author: Anh Le Minh < netanh@zapo.net >
## Website: http://www.netanh.com
## Forum: http://forum.netanh.com
## Description: This Mod gives 1 images beside your categories name, forum name on
## index page
##
## Files To Edit: 7
## language/lang_xxx/lang_main.php
## language/lang_xxx/lang_admin.php
## admin/admin_forums.php
## templates/YOUR_TEMPLATE/admin/forum_edit_body.tpl
## templates/YOUR_TEMPLATE/admin/category_edit_body.tpl
## templates/YOUR_TEMPLATE/index_body.tpl
## index.php
## Installation Time: 10-15 Minutes
## Included Files: none
##
###################################################################################
##
## Installation/Author Notes:
## 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.
###################################################################################
#
#-----[ ACTION: EXECUTE]-----------------------------------
#
#
SQL QUERY:
ALTER TABLE prefix_forums ADD forum_icon VARCHAR(100);
ALTER TABLE prefix_categories ADD cat_icon VARCHAR(100);
#
#-----[ ACTION: ]------------------------------------------
# OPEN: language/lang_xxx/lang_main.php
[FIND]:
//
// That's all Folks!
[ADD AFTER]:
// Categories & Forum icon MOD
$lang['Icon'] = "Icon";
####### SAVE & CLOSE: language/lang_xxx/lang_main.php #######
#############################################################
#
#-----[ ACTION: ]------------------------------------------
# OPEN: language/lang_xxx/lang_admin.php
[FIND]:
//
// That's all Folks!
[ADD AFTER]:
// Categories & Forum icon MOD
$lang['Icon'] = "Icon";
####### SAVE & CLOSE: language/lang_xxx/lang_admin.php #######
#############################################################
#
#-----[ ACTION: ]------------------------------------------
# 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'];
[ADD AFTER]:
$forumicon = $row['forum_icon'];
------------------------------
[FIND]:
$forumdesc = '';
[ADD AFTER]:
$forumicon = '';
------------------------------
[FIND]:
'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
[ADD AFTER]:
'L_ICON' => $lang['Icon'],
------------------------------
[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]:
$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]:
$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]:
$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'];
[ADD AFTER]:
$caticon = $row['cat_icon'];
------------------------------
[FIND]:
'CAT_TITLE' => $cat_title,
[ADD AFTER]:
'CAT_ICON' => $caticon,
'L_ICON' => $lang['Icon'],
------------------------------
[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]:
$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'];
[ADD AFTER]:
$caticon = $catinfo['cat_icon'];
####### SAVE & CLOSE: admin\admin_forums.php #######
#############################################################
#
#-----[ ACTION: ]------------------------------------------
# OPEN: index.php
[FIND]:
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . CATEGORIES_TABLE . " c
[REPLACE]:
//
// 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]:
if ( $display_forums )
{
if ($category_rows[$i]['cat_icon'] != '')
{$c_icon = ' <img src="'.$category_rows[$i]['cat_icon'].'"/> ';}
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]:
$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'].'"> ';}
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 #######
#############################################################
#
#-----[ ACTION: ]------------------------------------------
# OPEN: templates\subSilver\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>
[ADD AFTER]:
<tr>
<td class="row1">{L_ICON}</td>
<td class="row2"><input type="text" size="25" name="forumicon" value="{F_ICON}" class="post" /></td>
</tr>
####### SAVE & CLOSE: templates\subSilver\admin\forum_edit_body.tpl #######
###########################################################################
#
#-----[ ACTION: ]------------------------------------------
# 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>
[ADD AFTER]:
<tr>
<td class="row1">{L_ICON}</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 #######
##############################################################################
#
#-----[ ACTION: ]------------------------------------------
# OPEN: templates\subSilver\index_body.tpl
[FIND]:
<span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span>
[ADD BEFORE]:
{catrow.CAT_ICON}
------------------------------
[FIND]:
<span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a>
[ADD BEFORE]:
{catrow.forumrow.FORUM_ICON}
####### SAVE & CLOSE: templates\subSilver\index_body.tpl #######
################################################################