############################################################## 
## MOD Title:		Categories hierarchy : upgrade from 2.0.3 to 2.0.4
## MOD Author:		Ptirhiik < ptirhiik@clanmckeen.com > (Pierre) http://rpgnet.clanmckeen.com
## MOD Description:
##			Upgrade Categories hierarchy from 2.0.3 to 2.0.4
## MOD Version:		2.0.4
## 
## Installation Level:	Moderate
## Installation Time:	30 Minutes
## Files To Edit:
##			index.php
##			search.php
##			viewforum.php
##
##			admin/admin_forumauth.php
##			admin/admin_forums.php
##			admin/admin_forum_prune.php
##			admin/admin_styles.php
##			admin/admin_ug_auth.php
##			admin/admin_words.php
##
##			includes/auth.php
##			includes/functions.php
##			includes/functions_admin.php
##			includes/functions_post.php
##
##			language/lang_english/lang_extend_categories_hierarchy.php
##
##			templates/subSilver/index_box.tpl
##			templates/subSilver/subSilver.cfg
##			templates/subSilver/admin/category_edit_body.tpl
##			templates/subSilver/admin/forum_admin_body.tpl
##			templates/subSilver/admin/forum_edit_body.tpl
##
## Included Files:
##			admin/admin_forums_extend.php
##
##			includes/def_auth.php
##			includes/def_themes.php
##			includes/def_tree.php
##			includes/def_words.php
##			includes/functions_categories_hierarchy.php
##
##			includes/mods_settings/mod_categories_hierarchy.php
##
##			includes/cache_tpls/def_themes_def.tpl
##			includes/cache_tpls/def_tree_def.tpl
##			includes/cache_tpls/def_words_def.tpl
##
##			templates/subSilver/admin/forum_extend_body.tpl
##			templates/subSilver/admin/forum_extend_edit_body.tpl
##
##			graph.gif/icon_down_arrow.gif 
##			graph.gif/icon_up_arrow.gif 
##
############################################################## 
## 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: 
##
##	o Take care while cleaning the auth constants definition to get back any added field
##	into includes/def_auth.php.
##
##	o This version includes a new forum administration option that will cover the forum management
##	and the forum permissions. You can still use the standards options, but if you prefer to use the
##	new tool, you will avoid to modify the admin_forums.php, so the mod will be easier to install.
##
##	o You have to CHMOD 666 those files if you want to use the cache system :
##
##		includes/def_themes.php
##		includes/def_tree.php
##		includes/def_words.php
##
##
##	o If you don't want to use the cache system, just comment or remove at top 
##	of includes/functions_categories_hierarchy.php the following lines :
##
##		define('CACHE_TREE', true);
##		define('CACHE_WORDS', true);
##		define('CACHE_THEMES', true);
##
## 
############################################################## 
## MOD History: 
## 
##   2003-11-22 - Version 2.0.4
##      - fix topics count and forum link type hit count not displayed when caches used
##	- fix moving cats and forums in forum extend
## 
##   2003-11-13 - Version 2.0.4 - RC 2
##      - add a cache system for tables : categories, forums, themes, and words
##	- fix : standard forums admin : icons not saved
##	- fix : extended forums admin : some forums options were showing in categories if topic display order was installed
##	- fix : extended forums admin : sql generated if no use of real subforums was wrong
## 
##   2003-11-10 - Version 2.0.4-RC
##      - fix topic title viewable in search results
##	- unqualify some path to images in admin context
##	- centralize all admin auth definition in def_auth.php (for further management of presets)
##	- add the forum icon feature
##	- add a more easy-to-use facultative forum administration
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
#
#-----[ SQL ]-------------------------------------------------
#
ALTER TABLE phpbb_forums ADD icon VARCHAR(255);
ALTER TABLE phpbb_categories ADD icon VARCHAR(255);
#
#-----[ COPY ]------------------------------------------------
#
copy includes/def_auth.php to includes/def_auth.php
copy includes/def_themes.php to includes/def_themes.php
copy includes/def_tree.php to includes/def_tree.php
copy includes/def_words.php to includes/def_words.php
copy includes/functions_categories_hierarchy.php to includes/functions_categories_hierarchy.php
#
#-----[ COPY ]------------------------------------------------
#
copy includes/mods_settings/mod_categories_hierarchy.php to includes/mods_settings/mod_categories_hierarchy.php
#
#-----[ COPY ]------------------------------------------------
#
copy includes/cache_tpls/def_themes_def.tpl to includes/cache_tpls/def_themes_def.tpl
copy includes/cache_tpls/def_tree_def.tpl to includes/cache_tpls/def_tree_def.tpl
copy includes/cache_tpls/def_words_def.tpl to includes/cache_tpls/def_words_def.tpl
#
#-----[ COPY ]------------------------------------------------
#
# this part is optional : do it only if you want to use the new admin forums tool
#
copy admin/admin_forums_extend.php to admin/admin_forums_extend.php
#
#-----[ COPY ]------------------------------------------------
#
# this part is optional : do it only if you want to use the new admin forums tool
#
copy templates/subSilver/admin/forum_extend_body.tpl to templates/subSilver/admin/forum_extend_body.tpl
copy templates/subSilver/admin/forum_extend_edit_body.tpl to templates/subSilver/admin/forum_extend_edit_body.tpl
#
#-----[ COPY ]------------------------------------------------
#
copy graph.gif/icon_up_arrow.gif to templates/subSilver/images/icon_up_arrow.gif
copy graph.gif/icon_down_arrow.gif to templates/subSilver/images/icon_down_arrow.gif
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
include_once($phpbb_root_path . 'includes/mods_settings/mod_categories_hierarchy.' . $phpEx);
if (($board_config['display_viewonline'] == 2) || (($viewcat < 0) && ($board_config['display_viewonline'] == 1)))
{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $total_posts = get_db_stat('postcount');
// $total_users = get_db_stat('usercount');
//-- add
include_once($phpbb_root_path . 'includes/mods_settings/mod_categories_hierarchy.' . $phpEx);
if ( ($board_config['display_viewonline'] == 2) || ( ($viewcat < 0) && ($board_config['display_viewonline'] == 1) ) )
{
	if ( empty($board_config['max_posts']) || empty($board_config['max_users']) )
	{
		board_stats();
	}
	$total_posts = $board_config['max_posts'];
	$total_users = $board_config['max_users'];
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------------
#
		$keys = get_auth_keys($search_where);
		$s_flist = '';
		for ($i=0; $i < count($keys['id']); $i++)
		{
			if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		$keys = get_auth_keys($search_where, true, -1, -1, 'auth_read');
		$s_flist = '';
		for ($i=0; $i < count($keys['id']); $i++)
		{
			if ( ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL) && $tree['auth'][ $keys['id'][$i] ]['auth_read'] )
#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
if ( !empty($forum_id) )
{
	$sql = "SELECT *
		FROM " . FORUMS_TABLE . "
		WHERE forum_id = $forum_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
	}
}
else
{
	message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}

//
// If the query doesn't return any rows this isn't a valid forum. Inform
// the user.
//
if ( !($forum_row = $db->sql_fetchrow($result)) )
{
	message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- deleted
// if ( !empty($forum_id) )
// {
//	$sql = "SELECT *
//		FROM " . FORUMS_TABLE . "
//		WHERE forum_id = $forum_id";
//	if ( !($result = $db->sql_query($sql)) )
//	{
//		message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
//	}
// }
// else
// {
//	message_die(GENERAL_MESSAGE, 'Forum_not_exist');
// }
//
//
// If the query doesn't return any rows this isn't a valid forum. Inform
// the user.
//
// if ( !($forum_row = $db->sql_fetchrow($result)) )
// {
//	message_die(GENERAL_MESSAGE, 'Forum_not_exist');
// }
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
// handle forum link type
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// get the forum row
$forum_row = $tree['data'][ $tree['keys'][ POST_FORUM_URL . $forum_id ] ];
if ( empty($forum_row) )
{
	message_die(GENERAL_MESSAGE, 'Forum_not_exist');
}

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

	// prepare url
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
		cache_tree(true);
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT u.user_id, u.username
	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
	WHERE aa.forum_id = $forum_id
		AND aa.auth_mod = " . TRUE . "
		AND g.group_single_user = 1
		AND ug.group_id = aa.group_id
		AND g.group_id = aa.group_id
		AND u.user_id = ug.user_id
	GROUP BY u.user_id, u.username
	ORDER BY u.user_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

$moderators = array();
while( $row = $db->sql_fetchrow($result) )
{
	$moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
}

$sql = "SELECT g.group_id, g.group_name
	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
	WHERE aa.forum_id = $forum_id
		AND aa.auth_mod = " . TRUE . "
		AND g.group_single_user = 0
		AND g.group_type <> ". GROUP_HIDDEN ."
		AND ug.group_id = aa.group_id
		AND g.group_id = aa.group_id
	GROUP BY g.group_id, g.group_name
	ORDER BY g.group_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
	$moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $sql = "SELECT u.user_id, u.username
//	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
//	WHERE aa.forum_id = $forum_id
//		AND aa.auth_mod = " . TRUE . "
//		AND g.group_single_user = 1
//		AND ug.group_id = aa.group_id
//		AND g.group_id = aa.group_id
//		AND u.user_id = ug.user_id
//	GROUP BY u.user_id, u.username
//	ORDER BY u.user_id";
// if ( !($result = $db->sql_query($sql)) )
// {
//	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
// }
//
// $moderators = array();
// while( $row = $db->sql_fetchrow($result) )
// {
//	$moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
// }
//
// $sql = "SELECT g.group_id, g.group_name
//	FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
//	WHERE aa.forum_id = $forum_id
//		AND aa.auth_mod = " . TRUE . "
//		AND g.group_single_user = 0
//		AND g.group_type <> ". GROUP_HIDDEN ."
//		AND ug.group_id = aa.group_id
//		AND g.group_id = aa.group_id
//	GROUP BY g.group_id, g.group_name
//	ORDER BY g.group_id";
// if ( !($result = $db->sql_query($sql)) )
// {
//	message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
// }
//
// while( $row = $db->sql_fetchrow($result) )
// {
//	$moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
// }
//-- add
// moderators list
$moderators = array();
$idx = $tree['keys'][ POST_FORUM_URL . $forum_id ];
for ( $i = 0; $i < count($data['user_id']); $i++ )
{
	$moderators[] = '<a href="' . append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $tree['mods'][$idx]['user_id'][$i]) . '">' . $tree['mods'][$idx]['username'][$i] . '</a>';
}
for ( $i = 0; $i < count($data['group_id']); $i++ )
{
	$moderators[] = '<a href="' . append_sid("./groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $tree['mods'][$idx]['group_id'][$i]) . '">' . $tree['mods'][$idx]['group_name'][$i] . '</a>';
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forumauth.php
#
#-----[ FIND ]------------------------------------------------
#
//                View      Read      Post      Reply     Edit     Delete    Sticky   Announce    Vote      Poll
$simple_auth_ary = array(
	0  => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
	1  => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
	2  => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
	3  => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
	4  => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
	5  => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
	6  => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
);

$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . ' [' . $lang['Hidden'] . ']', $lang['Private'], $lang['Private'] . ' [' . $lang['Hidden'] . ']', $lang['Moderators'], $lang['Moderators'] . ' [' . $lang['Hidden'] . ']');

$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');

$field_names = array(
	'auth_view' => $lang['View'],
	'auth_read' => $lang['Read'],
	'auth_post' => $lang['Post'],
	'auth_reply' => $lang['Reply'],
	'auth_edit' => $lang['Edit'],
	'auth_delete' => $lang['Delete'],
	'auth_sticky' => $lang['Sticky'],
	'auth_announce' => $lang['Announce'],
	'auth_vote' => $lang['Vote'],
	'auth_pollcreate' => $lang['Pollcreate']);

$forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// all the preset and auth fields definition has been moved to includes/def_auth.php
//-- add
// auth list : put in this file all the auth fields description
include( $phpbb_root_path . './includes/def_auth.' . $phpEx );

// build an indexed array on field names
@reset($field_names);
$forum_auth_fields = array();
while ( list($auth_key, $auth_name) = @each($field_names) )
{
	$forum_auth_fields[] = $auth_key;
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_sql = '';
		$adv = 0;
	}
#
#-----[ AFTER, ADD ]------------------------------------------
#

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$select_list = selectbox(POST_FORUM_URL);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	$select_list = selectbox(POST_FORUM_URL, false, '', true);
#
#-----[ OPEN ]------------------------------------------------
#
# this part is optional : do it only if you don't wan't to use the new forum administration tool
#
admin/admin_forums.php
#
#-----[ FIND ]------------------------------------------------
#
	$new_topic_data = array();
	$tracking_topics = array();
	$tracking_forums = array();
	$tracking_all = -1;
	build_tree($cats, $forums, $new_topic_data, $tracking_topic, $tracking_forums, $tracking_all, $parents);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	cache_tree_level('Root', $parents, $cats, $forums);
#
#-----[ FIND ]------------------------------------------------
#
				$forum_link_hit			= intval($row['forum_link_hit']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$icon = $row['icon'];
#
#-----[ FIND ]------------------------------------------------
#
				$forum_link_hit			= 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$icon = '';
#
#-----[ FIND ]------------------------------------------------
#
				'FORUM_LINK_HIT_COUNT_NO'			=> (!$forum_link_hit_count) ? ' checked="checked"' : '',
				'L_YES'								=> $lang['Yes'],
				'L_NO'								=> $lang['No'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'L_ICON'							=> $lang['icon'],
				'L_ICON_EXPLAIN'					=> $lang['icon_explain'],
				'ICON'								=> $icon,
				'ICON_IMG'							=> empty($icon) ? '' : '<br /><img src="' . ( isset($images[$icon]) ? $phpbb_root_path . $images[$icon] : $icon ) . '" border="0" alt="' . $icon . '" title="' . $icon . '" />',
#
#-----[ FIND ]------------------------------------------------
#
			$field_sql .= ", forum_link_hit_count";
			$value_sql .= ", $forum_link_hit_count";
#
#-----[ AFTER, ADD ]------------------------------------------
#
			$icon = isset($HTTP_POST_VARS['icon']) ? trim(stripslashes($HTTP_POST_VARS['icon'])) : '';
			$field_sql .= ", icon";
			$value_sql .= ", '$icon'";
#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'modforum':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_tree(true);
			board_stats();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
				$field_value_sql .= ", main_type = '$type'";
			}
#
#-----[ AFTER, ADD ]------------------------------------------
#
			$icon = isset($HTTP_POST_VARS['icon']) ? trim(stripslashes($HTTP_POST_VARS['icon'])) : '';
			$field_value_sql .= ", icon = '$icon'";
#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		case 'addcat':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_tree(true);
			board_stats();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
		case 'createcat':
			// Create a category in the DB
#
#-----[ AFTER, ADD ]------------------------------------------
#
			$icon = isset($HTTP_POST_VARS['icon']) ? trim($HTTP_POST_VARS['icon']) : '';
#
#-----[ FIND ]------------------------------------------------
#
			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_main_type, cat_main, cat_desc, cat_order)
				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', '" . $cat_main_type . "', " . $cat_main . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "', $next_order)";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_main_type, cat_main, cat_desc, icon, cat_order)
				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', '" . $cat_main_type . "', " . $cat_main . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "', '" . str_replace("\'", "''", $icon) . "', $next_order)";
#
#-----[ FIND ]------------------------------------------------
#
//-- fin mod : categories hierarchy ----------------------------------------------------------------

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		case 'addcat':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			cache_tree(true);
			board_stats();
#
#-----[ FIND ]------------------------------------------------
#
				$cat_desc	= $row['cat_desc'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$icon = $row['icon'];
#
#-----[ FIND ]------------------------------------------------
#
				$cat_desc  = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$icon = '';
#
#-----[ FIND ]------------------------------------------------
#
				'L_EDIT_CATEGORY'			=> $l_title,
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'L_ICON'					=> $lang['icon'],
				'L_ICON_EXPLAIN'			=> $lang['icon_explain'],
				'ICON'						=> $icon,
				'ICON_IMG'					=> empty($icon) ? '' : '<br /><img src="' . ( isset($images[$icon]) ? $phpbb_root_path . $images[$icon] : $icon ) . '" border="0" alt="' . $icon . '" title="' . $icon . '" />',
#
#-----[ FIND ]------------------------------------------------
#
		case 'modcat':
			// Modify a category in the DB
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
#
#-----[ AFTER, ADD ]------------------------------------------
#
			$icon = isset($HTTP_POST_VARS['icon']) ? trim($HTTP_POST_VARS['icon']) : '';
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
// here we added
//	, cat_main_type='" . $cat_main_type . "', cat_main = " . $cat_main . ", cat_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "' ".
//-- modify
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', cat_main_type='" . $cat_main_type . "', cat_main = " . $cat_main . ", cat_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "'
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
// here we added
//	, cat_main_type='" . $cat_main_type . "', cat_main = " . $cat_main . ", cat_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "', icon = '" . str_replace("\'", "''", $icon) . "'
//-- modify
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', cat_main_type='" . $cat_main_type . "', cat_main = " . $cat_main . ", cat_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "', icon = '" . str_replace("\'", "''", $icon) . "'
#
#-----[ FIND ]------------------------------------------------
#
			$err = admin_check_cat();
			if ( $err ) $message = $lang['Category_config_error_fixed'] . "<br /><br />" . $message;
//-- fin mod : categories hierarchy ----------------------------------------------------------------
			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'deleteforum':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			cache_tree(true);
			board_stats();
#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'deletecat':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_tree(true);
			board_stats();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
			$err = admin_check_cat();
			if ( $err ) $message = $lang['Category_config_error_fixed'] . "<br /><br />" . $message;
//-- fin mod : categories hierarchy ----------------------------------------------------------------

			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'forum_order':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			cache_tree(true);
			board_stats();
#
#-----[ FIND ]------------------------------------------------
#
//-- fin mod : categories hierarchy ----------------------------------------------------------------
			$show_index = TRUE;

			break;
			
		case 'cat_order':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			cache_tree(true);
			board_stats();
#
#-----[ FIND ]------------------------------------------------
#
//-- fin mod : categories hierarchy ----------------------------------------------------------------
			$show_index = TRUE;

			break;

		case 'forum_sync':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			cache_tree(true);
			board_stats();
#
#-----[ FIND ]------------------------------------------------
#
function display_admin_index($cur='Root', $level=0, $max_level=-1)
{
	global $template, $phpEx, $lang, $images;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
function display_admin_index($cur='Root', $level=0, $max_level=-1)
{
	global $template, $phpbb_root_path, $phpEx, $lang, $images;
#
#-----[ FIND ]------------------------------------------------
#
			// send to template
			$template->assign_block_vars('catrow', array());
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			// title and icon
			$cat_desc = $cat['cat_desc'];
			$cat_desc_trad = get_object_lang(POST_CAT_URL . $cat_id, 'desc');
			if ($cat_desc != $cat_desc_trad)
			{
				$cat_desc = '(' . $cat_desc . ') ' . $cat_desc_trad;
			}
			$cat_icon = empty($cat['icon']) ? '' : '<img src="' . ( isset($images[ $cat['icon'] ]) ? $phpbb_root_path . $images[ $cat['icon'] ] : $cat['icon'] ) . '" border="0" alt="' . $cat['icon'] . '" title="' . $cat['icon'] . '" />';

#
#-----[ FIND ]------------------------------------------------
#
			$template->assign_block_vars('catrow.cathead', array(
				'CAT_ID'			=> $cat_id,
				'CAT_TITLE'			=> $cat_title,
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'CAT_DESCRIPTION'	=> $cat_desc,
				'ICON_IMG'			=> $cat_icon,
#
#-----[ FIND ]------------------------------------------------
#
			$rowspan = empty($cat['cat_desc']) ? 1 : 2;
			for ($k=1; $k <= $level; $k++) $template->assign_block_vars('catrow.cathead.inc', array('ROWSPAN' => $rowspan));

			if (!empty($cat['cat_desc']))
			{
				$cat_desc = $cat['cat_desc'];
				$cat_desc_trad = get_object_lang(POST_CAT_URL . $cat_id, 'desc');
				if ($cat_desc != $cat_desc_trad) $cat_desc = '(' . $cat_desc . ') ' . $cat_desc_trad;

				$template->assign_block_vars('catrow', array());
				$template->assign_block_vars('catrow.cattitle', array(
					'CAT_DESCRIPTION'	=> $cat_desc,
					'INC_SPAN_ALL'		=> $max_level - $level+7,
					)
				);
			}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
			for ($k=1; $k <= $level; $k++) 
			{
				$template->assign_block_vars('catrow.cathead.inc', array());
			}
#
#-----[ FIND ]------------------------------------------------
#
				$forum_link_img = '<img src="../' . $images['link'] . '" border="0" />';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				$forum_link_img = '<img src="' . $phpbb_root_path . $images['link'] . '" border="0" />';
#
#-----[ FIND ]------------------------------------------------
#
				$forum_link_img = '<img src="../' . (($sub) ? $images['category'] : $images['forum']) . '" border="0" />';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				$forum_link_img = '<img src="' . $phpbb_root_path . (($sub) ? $images['category'] : $images['forum']) . '" border="0" />';
#
#-----[ FIND ]------------------------------------------------
#
					$forum_link_img = '<img src="../' . (($sub) ? $images['category_locked'] : $images['forum_locked']) . '" border="0" />';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
					$forum_link_img = '<img src="' . $phpbb_root_path . (($sub) ? $images['category_locked'] : $images['forum_locked']) . '" border="0" />';
#
#-----[ FIND ]------------------------------------------------
#
			$template->assign_block_vars('catrow.forumrow', array(
				'LINK_IMG'			=> $forum_link_img,
#
#-----[ AFTER, ADD ]------------------------------------------
#
				'ICON_IMG'			=> empty($forum['icon']) ? '' : '<img src="' . ( isset($images[ $forum['icon'] ]) ? $phpbb_root_path . $images[ $forum['icon'] ] : $forum['icon'] ) . '" border="0" alt="' . $forum['icon'] . '" title="' . $forum['icon'] . '" />',
#
#-----[ FIND ]------------------------------------------------
#
	'SPACER'			=> './../' . $images['spacer'],
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	'SPACER'			=> $phpbb_root_path . $images['spacer'],
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forum_prune.php
#
#-----[ FIND ]------------------------------------------------
#
	// set the sql request
	$tkeys = array();
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
	$fid = $type . $id;
	if ( empty($fid) || ( $fid == POST_CAT_URL . '0' ) )
	{
		$fid = 'Root';
	}
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_styles.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Theme_installed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);
		}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_themes();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
				$message = $lang['Theme_updated'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

				message_die(GENERAL_MESSAGE, $message);
			}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_themes();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
				$message = $lang['Theme_created'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

				message_die(GENERAL_MESSAGE, $message);
			}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
				cache_themes();
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Theme_info_saved'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

		}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_themes();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Style_removed'] . "<br /><br />" . sprintf($lang['Click_return_styleadmin'], "<a href=\"" . append_sid("admin_styles.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);
		}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_themes();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_ug_auth.php
#
#-----[ FIND ]------------------------------------------------
#
$forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');

$auth_field_match = array(
	'auth_view' => AUTH_VIEW,
	'auth_read' => AUTH_READ,
	'auth_post' => AUTH_POST,
	'auth_reply' => AUTH_REPLY,
	'auth_edit' => AUTH_EDIT,
	'auth_delete' => AUTH_DELETE,
	'auth_sticky' => AUTH_STICKY,
	'auth_announce' => AUTH_ANNOUNCE,
	'auth_vote' => AUTH_VOTE,
	'auth_pollcreate' => AUTH_POLLCREATE);

$field_names = array(
	'auth_view' => $lang['View'],
	'auth_read' => $lang['Read'],
	'auth_post' => $lang['Post'],
	'auth_reply' => $lang['Reply'],
	'auth_edit' => $lang['Edit'],
	'auth_delete' => $lang['Delete'],
	'auth_sticky' => $lang['Sticky'],
	'auth_announce' => $lang['Announce'],
	'auth_vote' => $lang['Vote'],
	'auth_pollcreate' => $lang['Pollcreate']);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// all the preset and auth fields definition has been moved to includes/def_auth.php
//-- add
// auth list : put in this file all the auth fields description
include( $phpbb_root_path . './includes/def_auth.' . $phpEx );

// build an indexed array on field names
@reset($field_names);
$forum_auth_fields = array();
while ( list($auth_key, $auth_name) = @each($field_names) )
{
	$forum_auth_fields[] = $auth_key;
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$message = $lang['Auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_userauth'], '<a href="' . append_sid("admin_ug_auth.$phpEx?mode=$mode") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
		message_die(GENERAL_MESSAGE, $message);
	}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
		if ( $unset_mod != '' )
		{
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_words.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		message_die(GENERAL_MESSAGE, $message);
	}
	else if( $mode == "delete" )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		cache_words();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
			$message = $lang['Word_removed'] . "<br /><br />" . sprintf($lang['Click_return_wordadmin'], "<a href=\"" . append_sid("admin_words.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);
		}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			cache_words();
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/auth.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
function auth($type, $forum_id, $userdata, $f_access = '')
{
	global $db, $lang;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $tree;

	if ( !empty($tree['data']) )
	{
		$f_access = array();
		if ( !empty($forum_id) )
		{
			$idx = $tree['keys'][ POST_FORUM_URL . $forum_id ];
			$f_access = $tree['data'][$idx];
		}
		else
		{
			for ( $i = 0; $i < count($tree['data']); $i++ )
			{
				if ( $tree['type'][$i] == POST_FORUM_URL )
				{
					$f_access[] = $tree['data'][$i];
				}
			}
		}
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------------
#
function setup_style($style)
{
	global $db, $board_config, $template, $images, $phpbb_root_path;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $phpEx, $themes_style;

	if ( defined('CACHE_THEMES') )
	{
		include( $phpbb_root_path . './includes/def_themes.' . $phpEx );
		if ( empty($themes_style) )
		{
			cache_themes();
			@include( $phpbb_root_path . './includes/def_themes.' . $phpEx );
		}
	}
	if ( !empty($themes_style[$style]) )
	{
		$row = $themes_style[$style];
	}
	else
	{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$template_path = 'templates/' ;
	$template_name = $row['template_name'] ;
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $global_orig_word, $global_replacement_word;

	if (isset($global_orig_word))
	{
		$orig_word			= $global_orig_word;
		$replacement_word	= $global_replacement_word;
	}
	else
	{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $global_orig_word, $global_replacement_word;
	global $phpbb_root_path, $phpEx;

	if (isset($global_orig_word))
	{
		$orig_word			= $global_orig_word;
		$replacement_word	= $global_replacement_word;
	}
	else
	{
		if ( defined('CACHE_WORDS') )
		{
			@include($phpbb_root_path . './includes/def_words.' . $phpEx);
			if ( !isset($word_replacement) )
			{
				cache_words();
				@include($phpbb_root_path . './includes/def_words.' . $phpEx);
			}
		}
		if ( isset($word_replacement) )
		{
			$orig_word = array();
			$replacement_word = array();
			@reset($word_replacement);
			while ( list($word, $replacement) = @each($word_replacement) )
			{
				$orig_word[] = '#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote(stripslashes($word), '#')) . ')\b#i';
				$replacement_word[] = $replacement;
			}
		}
		else
		{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$global_orig_word			= $orig_word;
		$global_replacement_word	= $replacement_word;
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
		}
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_admin.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	return true;
}

?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $board_config;
	board_stats();
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">';
	$message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

	return false;
}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	board_stats();
	cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
	return;
}

//
// Delete a post/poll
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	board_stats();
	cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	return;
}

//
// Handle user notification on new post
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	board_stats();
	cache_tree(true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_extend_categories_hierarchy.php
#
#-----[ FIND ]------------------------------------------------
#
 *	version				: 1.0.0 - 28/09/2003
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
 *	version				: 1.0.1 - 10/11/2003
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
	$lang['Forum_attached_to_link_denied']
#
#-----[ AFTER, ADD ]------------------------------------------
#

	$lang['Manage_extend']							= 'Management +';
	$lang['No_subforums']							= 'No sub-forums';
	$lang['Forum_type']								= 'Choose the kind of forum you want';
	$lang['Presets']								= 'Presets';
	$lang['Refresh']								= 'Refresh';
	$lang['Position_after']							= 'Position this forum after';
	$lang['Link_missing']							= 'The link is missing';
	$lang['Category_with_topics_deny']				= 'Topics remains in this forum. You can\'t change it into a category.';
	$lang['Recursive_attachment']					= 'You can\'t attach a forum to a lowest level of its own branch (recursive attachment)';
	$lang['Forum_with_attachment_denied']			= 'You can\'t change a category with forums attached to into a forum';
	$lang['icon']									= 'Icon';
	$lang['icon_explain']							= 'This icon will be displayed in front of the forum title. You can set here a direct URI or a $image[] key entry (see <i>your_template</i>/<i>your_template</i>.cfg).';
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_box.tpl
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
{catrow.forumrow.FORUM_NAME}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
		<!-- BEGIN forum_icon -->
		<table cellpadding="2" cellspacing="0" border="0" width="100%" height="47">
		<tr>
			<td width="46" align="center"><a href="{catrow.forumrow.U_VIEWFORUM}"><img src="{catrow.forumrow.ICON_IMG}" border="0" /></a></td>
			<td>
		<!-- END forum_icon -->
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
{catrow.forumrow.L_MODERATOR}{catrow.forumrow.MODERATORS}{catrow.forumrow.L_LINKS}{catrow.forumrow.LINKS}
#
#-----[ AFTER, ADD ]------------------------------------------
#
		<!-- BEGIN forum_icon -->
			</td>
		</tr>
		</table>
		<!-- END forum_icon -->
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------------
#
$images['spacer'] = "$current_template_images/spacer.gif";
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
$images['up_arrow'] = "$current_template_images/icon_up_arrow.gif";
$images['down_arrow'] = "$current_template_images/icon_down_arrow.gif";

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/category_edit_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full lines are longer
#
	<tr>
{L_CATEGORY_ATTACHMENT}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
	<tr>
		<td class="row1"><span class="gen">{L_ICON}</span><span class="gensmall"><br />{L_ICON_EXPLAIN}</span></td>
		<td class="row2"><span class="gen"><input name="icon" value="{ICON}" type="text" class="post" size="60" />{ICON_IMG}</span></td>
	</tr>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/forum_admin_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
class="row2" rowspan="{catrow.cathead.inc.ROWSPAN}"
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
class="row2" rowspan="{catrow.cathead.inc.ROWSPAN}"
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
class="row2"
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full lines are longer
#
<!-- END cathead -->
<!-- BEGIN cattitle -->
<tr>
{catrow.cattitle.CAT_DESCRIPTION}
</tr>
<!-- END cattitle -->
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<tr>
	<!-- BEGIN inc -->
	<td class="row2" width="46"><img src="{SPACER}" width="46" height="0" /></td>
	<!-- END inc -->
	<td class="row3" colspan="{catrow.cathead.INC_SPAN}"><table cellpadding="2" cellspacing="0" border="0" width="100%"><tr><td>{catrow.cathead.ICON_IMG}</td><td width="100%"><span class="gensmall">{catrow.cathead.CAT_DESCRIPTION}</span></td></tr></table></td>
	<td class="row3"><span class="gensmall">&nbsp;</span></td>
	<td class="row3"><span class="gensmall">&nbsp;</span></td>
	<td class="row3"><span class="gensmall">&nbsp;</span></td>
	<td class="row3"><span class="gensmall">&nbsp;</span></td>
</tr>
<!-- END cathead -->
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
<td>{catrow.forumrow.LINK_IMG}</td>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
<td>{catrow.forumrow.LINK_IMG}</td>
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
<td>{catrow.forumrow.ICON_IMG}</td>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/forum_edit_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
	<tr>
{L_CATEGORY}
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
	<tr>
		<td class="row1"><span class="gen">{L_ICON}</span><span class="gensmall"><br />{L_ICON_EXPLAIN}</span></td>
		<td class="row2"><span class="gen"><input name="icon" value="{ICON}" type="text" class="post" size="60" />{ICON_IMG}</span></td>
	</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM