##############################################################
## MOD Title:		Categories hierarchy - Part 1 - install first MOD-cache
## MOD Author:		Ptirhiik < ptirhiik@clanmckeen.com > (Pierre) http://rpgnet.clanmckeen.com
## MOD Description:
##			This mod allows to attach a categorie to a higher level categorie,
##			keeping all the forum visible on the index page (vBulletin-like view),
##			or have a sub-forum view.
##			----------------------------------------------------------------------
##			o MOD-Cache part IS required : you have to install it, even if you don't plan to use it
##				Install it FIRST
##			o Part 1 is the main installation,
##			o Part 2 is the facultative modifications of the standard phpBB admin forums prog,
##			and is not required if you want to use the new admin forums tool.
##			----------------------------------------------------------------------
##
## MOD Version:		2.0.5-RC2
##
## Installation Level:	Moderate
## Installation Time:	~60 Minutes
## Files To Edit:
##			index.php
##			modcp.php
##			posting.php
##			search.php
##			viewforum.php
##			viewonline.php
##			viewtopic.php
##
##			admin/admin_forumauth.php
##			admin/admin_forum_prune.php
##			admin/admin_ug_auth.php
##
##			includes/auth.php
##			includes/constants.php
##			includes/functions.php
##			includes/page_header.php
##			includes/topic_review.php
##
##			templates/subSilver/index_body.tpl
##			templates/subSilver/modcp_body.tpl
##			templates/subSilver/modcp_move.tpl
##			templates/subSilver/modcp_split.tpl
##			templates/subSilver/posting_body.tpl
##			templates/subSilver/search_body.tpl
##			templates/subSilver/subSilver.cfg
##			templates/subSilver/viewforum_body.tpl
##			templates/subSilver/viewtopic_body.tpl
##
##			templates/subSilver/admin/auth_ug_body.tpl
##
## Included Files:
##			admin/admin_board_extend.php
##			admin/admin_forums_extend.php
##
##			includes/def_auth.php
##			includes/functions_categories_hierarchy.php
##			includes/functions_mods_settings.php
##			includes/lang_extend_mac.php
##
##			includes/mods_settings/mod_categories_hierarchy.php
##
##			language/lang_english/lang_extend_categories_hierarchy.php
##			language/lang_english/lang_extend_mods_settings.php
##
##			templates/subSilver/index_box.tpl
##
##			templates/subSilver/admin/board_config_extend_body.tpl
##			templates/subSilver/admin/forum_extend_body.tpl
##			templates/subSilver/admin/forum_extend_edit_body.tpl
##
##			templates/subSilver/images/cat_folder_big.gif
##			templates/subSilver/images/cat_folder_new_big.gif
##			templates/subSilver/images/cat_folder_locked_big.gif
##			templates/subSilver/images/icon_up_arrow.gif
##			templates/subSilver/images/icon_down_arrow.gif
##			templates/subSilver/images/icon_minicat.gif
##			templates/subSilver/images/icon_minicat_new.gif
##			templates/subSilver/images/icon_minicat_lock.gif
##			templates/subSilver/images/icon_minilink.gif
##			templates/subSilver/images/icon_minipost_lock.gif
##			templates/subSilver/images/link_folder.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:
##
##	v 2 features :
##		o attachment
##			- attach a category to another category
##			- attach a category to a forum
##			- optional : attach a forum to a forum, or to the index (note this one will
##				break slightly the data compliancy with a non-modded phpBB)
##
##		o forum type link management :
##			this allows you to set a link displayed as a forum, and suiting the users
##			view authorisations. You can choose in the acp whether you want to count
##			the number of hits or not.
##
##		o multi-language support in forums and cats name and description :
##			allow to use $lang[] key entry in the categories or forums name and
##			description in order to fit the language choosen by the user.
##
##		o order cats and forums as you want
##			You can now choose the order of appearance of the categories on the index page,
##			and mix categories and forums order.
##
##		o 3 choices of packing index
##			- No pack, giving the full incremental tree of cats and forums,
##			- Medium pack : the precs version sub-forum views : 2 levels displayed
##			- Full pack : Only one level is displayed.
##
##		o optional display of board statistics
##			The board statistics box can be removed from the root index, or from all,
##			reducing more the size of the index pages.
##
##		o split of the categories on the root index page
##			For a better seen of the board section.
##
##		o quick links under description (based on tidjojo and GilGraf one)
##			You can display the name and links to the direct sub-level, and also
##			have the new message icon present in front of this name.
##
##		o show the last topic title on index (based on e-sven's one)
##			You can display on the index the title of the topics last created
##			or replied to in the "Last Post" column.
##
##		o an icon can be set in front of each forum or category, and can suit your template choices
##
##		o admin interface for setting the display options
##			Part of the mod settings mod, included in this mod
##
##		o users can choose their prefered setup (required full mods settings mod to be installed).
##			Admin can also choose to override the users choice for each setup parameter.
##
##		o optional admin tool to edit your language in the ACP (see lang_settings note)
##
##		o use caches to speed up the process by reducing the sql requests usage
##
##
##	- About compliancy issue with original phpBB data structure while using real sub-forums feature :
##
##		Versions 2.0.x of phpBB accept only a forum to be attached to a category. The mod can allow
## if you wish to attach a forum to another forum, or to the index. Such an attachment won't be recognized
## original phpBB progs, and so the forum won't be displayed at all, or will be seen attached to a category,
## having the same id that the parent forum : this is only a display issue, and won't impact posts nor
## authorisations, nothing will be lost :). If you plan to remove the mod, just re-attach the sub-forums
## to a category, and all will be ok.
##------------------------------------------------------------
##
##	MOD-cache will settle the cache system, and is required for categories hierarchy
##		if you don't have yet installed it, install it FIRST.
##	Part 1 of this mod will include the new admin forums tool to your board
##	Part 2 of this mod will modify the old admin forums phpBB progs, and is facultative
##
##------------------------------------------------------------
##
##	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 (part 2 of the mod), so the mod will be
##	easier to install.
##
##	NB.: Take care while cleaning the auth constants definition to get back any added field
##	into includes/def_auth.php.
##
##------------------------------------------------------------
##
##	o You have to CHMOD 666 those files if you want to use the cache system :
##	(nb.: all caches are not fully used by this mod)
##
##			includes/def_birthday.php
##			includes/def_ranks.php
##			includes/def_smilies.php
##			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 functions_cache.php the following lines :
##
##			define('CACHE_WORDS', true);
##			define('CACHE_THEMES', true);
##			define('CACHE_SMILIES', true);
##			define('CACHE_RANKS', true);
##			define('CACHE_BIRTHDAY', true);
##			define('CACHE_TREE', true);
##
##	(nb: in all cases you have to install the MOD-cache part, even if you don't want to use caches)
##
##	o if you are using the management + (admin/admin_forums_extend.php), the modification of
##	admin/admin_forums.php is facultative.
##
##------------------------------------------------------------
##
##	This mod can be installed using Nutzzy's EasyMOD v Alpha3 0.0.11a3 & greater
##	( http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15 ),
##	on a phpBB 2.0.4 to 2.0.10
##
##############################################################
## MOD History:
##
##   2004-07-21 - Version 2.0.5-RC2
##      - some bugs updated
##      - fix various errors or omissions of variables (language and image)
##      - fix auto pruning in Management + : the number of days and frequency always returns to the default value
##      - fix bad indentation of the under-forums when the hierachy is not compressed
##      - fix topic title no viewable in search results for user no authorized
##      - fix cache reconstruction during an event of synchronization
##      - fix sort in Management + : sort function inoperative
##      - fix images url in hierarchy
##	- new jumpbox by flashdagger
##	- compliance PHP v5.x.x
##	A great thanks to akzhaiyk, cifroes, easythomas, helios, Patricia, PghBiker, tr3vor, Waagenbauer and others
##	for reports and fixs.
##
##   2003-11-22 - Version 2.0.5-RC1
##      - fix moderators not displaied in forums view
##	- split the cache module to a separate installation to use with other mods
##	- analyse and removal of sql requests usage
##	- reoganize distribution pack
##
##   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-RC2
##      - 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
##
##   2003-10-21 - Version 2.0.3
##	- upgrade the mods settings tool
##	- add the lang settings tool
##	- add the missing sub-forums links for the forums attached to index
##	- fix the prec/next topic link
##
##   2003-09-24 - Version 2.0.2
##      - fix the missing categories name in admin drop down box,
##	- remove HTML in overviewed forum/cat descriptions,
##	- remove extra line between forum desc, moderators and links on index,
##	- add the $lang['Subforums'] entry to display in front of the mini links on index (default is blank)
##
##   2003-09-18 - Version 2.0.1
##      - enhance quickness on hughe forums tree
##	- fix spacer issue in admin
##	- clean index_box.tpl from th classes
##	- fix auth_read and auth_view confusion in phpBB
##
##   2003-08-19 - Version 2.0.0
##	- support of multi-language forums and categories name and description
##	- add forum link type feature
##      - add the ability to attach a category to a forum
##	- add the ability (optional) to attach a forum to a forum
##	- add the ability to mix the sort of categories and forums at the same level
##	- add another level of packing the index (full packing)
##	- add the prec extension "last topic title on index" as an option to the base version
##	- add the prec enhancement "links to sub-level on description" as an option to the base version
##	- redesign of the forums and categories reading
##	- add the ability to split categories on index
##	- add the ability to remove within the acp the who's online box at different level
##	- more friendly admin forums and cats administration (ACP)
##	- admin interface for setting the display
##	- users preferences interface with mods settings mod (included in the pack)
##
##   2003-04-09 - Version 1.1.0
##   2003-03-24 - Version 1.0.9
##   2003-03-05 - Version 1.0.8
##   2003-03-01 - Version 1.0.7
##   2003-02-21 - Version 1.0.6
##   2003-02-21 - Version 1.0.5
##   2003-01-15 - Version 1.0.2
##   2003-01-05 - Version 1.0.1
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]-------------------------------------------------
#
ALTER TABLE phpbb_categories ADD cat_main_type CHAR(1);
ALTER TABLE phpbb_categories ADD cat_main MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_categories ADD cat_desc TEXT NOT NULL;
ALTER TABLE phpbb_categories ADD icon VARCHAR(255);
ALTER TABLE phpbb_forums ADD forum_link VARCHAR(255);
ALTER TABLE phpbb_forums ADD forum_link_internal TINYINT(1) NOT NULL;
ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT NULL;
ALTER TABLE phpbb_forums ADD forum_link_hit BIGINT(20) UNSIGNED NOT NULL;
ALTER TABLE phpbb_forums ADD icon VARCHAR(255);
#
#-----[ SQL ]-------------------------------------------------
#
#	the next request is optional. Run it only if you plan to use the real sub-forums feature
#
ALTER TABLE phpbb_forums ADD main_type CHAR(1);
#
#-----[ SQL ]-------------------------------------------------
#
# This part is optional : do it only if you want your users to be able to choose their setup
#	if you want so, you'll have to install the MOD-mods_settings mod included in the pack
#
ALTER TABLE phpbb_users ADD user_sub_forum TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_split_cat TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_last_topic_title TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_sub_level_links TINYINT(1) DEFAULT '2' NOT NULL;
ALTER TABLE phpbb_users ADD user_display_viewonline TINYINT(1) DEFAULT '2' NOT NULL;
#
#-----[ COPY ]------------------------------------------------
#
copy admin/admin_board_extend.php to admin/admin_board_extend.php
copy admin/admin_forums_extend.php to admin/admin_forums_extend.php
#
#-----[ COPY ]------------------------------------------------
#
copy includes/def_auth.php to includes/def_auth.php
copy includes/functions_categories_hierarchy.php to includes/functions_categories_hierarchy.php
copy includes/functions_mods_settings.php to includes/functions_mods_settings.php
copy includes/lang_extend_mac.php to includes/lang_extend_mac.php
#
#-----[ COPY ]------------------------------------------------
#
copy includes/mods_settings/mod_categories_hierarchy.php to includes/mods_settings/mod_categories_hierarchy.php
#
#-----[ COPY ]------------------------------------------------
#
copy language/lang_english/lang_extend_categories_hierarchy.php to language/lang_english/lang_extend_categories_hierarchy.php
copy language/lang_english/lang_extend_mods_settings.php to language/lang_english/lang_extend_mods_settings.php
#
#-----[ COPY ]------------------------------------------------
#
copy templates/subSilver/index_box.tpl to templates/subSilver/index_box.tpl
#
#-----[ COPY ]------------------------------------------------
#
copy templates/subSilver/admin/board_config_extend_body.tpl to templates/subSilver/admin/board_config_extend_body.tpl
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 templates/subSilver/images/cat_folder_big.gif to templates/subSilver/images/cat_folder_big.gif
copy templates/subSilver/images/cat_folder_new_big.gif to templates/subSilver/images/cat_folder_new_big.gif
copy templates/subSilver/images/cat_folder_locked_big.gif to templates/subSilver/images/cat_folder_locked_big.gif
copy templates/subSilver/images/icon_up_arrow.gif to templates/subSilver/images/icon_up_arrow.gif
copy templates/subSilver/images/icon_down_arrow.gif to templates/subSilver/images/icon_down_arrow.gif
copy templates/subSilver/images/icon_minicat.gif to templates/subSilver/images/icon_minicat.gif
copy templates/subSilver/images/icon_minicat_new.gif to templates/subSilver/images/icon_minicat_new.gif
copy templates/subSilver/images/icon_minicat_lock.gif to templates/subSilver/images/icon_minicat_lock.gif
copy templates/subSilver/images/icon_minilink.gif to templates/subSilver/images/icon_minilink.gif
copy templates/subSilver/images/icon_minipost_lock.gif to templates/subSilver/images/icon_minipost_lock.gif
copy templates/subSilver/images/link_folder.gif to templates/subSilver/images/link_folder.gif
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
$viewcat = intval($viewcat);
if ($viewcat <= 0) $viewcat = -1;
$viewcatkey = ($viewcat < 0) ? 'Root' : POST_CAT_URL . $viewcat;
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
if( $mark_read == 'forums' )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	if ( $viewcat < 0 )
	{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		"META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx") . '">')
	);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	}
	else
	{
		if( $userdata['session_logged_in'] )
		{
			// get the list of object authorized
			$keys = array();
			$keys = get_auth_keys($viewcatkey);

			// mark each forums
			for ($i=0; $i < count($keys['id']); $i++) if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
			{
				$forum_id = $tree['id'][ $keys['idx'][$i] ];
				$sql = "SELECT MAX(post_time) AS last_post FROM " . POSTS_TABLE . " WHERE forum_id = $forum_id";
				if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
				if ( $row = $db->sql_fetchrow($result) )
				{
					$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
					$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();

					if ( ( count($tracking_forums) + count($tracking_topics) ) >= 150 && empty($tracking_forums[$forum_id]) )
					{
						asort($tracking_forums);
						unset($tracking_forums[key($tracking_forums)]);
					}

					if ( $row['last_post'] > $userdata['user_lastvisit'] )
					{
						$tracking_forums[$forum_id] = time();
						setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
					}
				}
			}
		}

		$template->assign_vars(array(
			"META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx?" . POST_CAT_URL . "=$viewcat") . '">')
		);
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
// $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Start page proper
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
/*
#
#-----[ FIND ]------------------------------------------------
#
	$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
#
#-----[ AFTER, ADD ]------------------------------------------
#
*/
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	//
	// Start output of page
	//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
// set the parm of the mark read func
$mark = ($viewcat == -1 ) ? '' : '&' . POST_CAT_URL . '=' . $viewcat;
// monitor the board statistic
if (($board_config['display_viewonline'] == 2) || (($viewcat < 0) && ($board_config['display_viewonline'] == 1)))
{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	define('SHOW_ONLINE', true);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums")
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
// here we added
//	$mark
//-- modify
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
forums
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
$mark
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	//
	// Okay, let's build the index
	//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
/*
#
#-----[ FIND ]------------------------------------------------
#
}// if ... total_categories
else
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- add
*/
// don't display the board statistics
if ( ($board_config['display_viewonline'] == 2) || ( ($viewcat < 0) && ($board_config['display_viewonline'] == 1) ) )
{
	$template->assign_block_vars('disable_viewonline', array());
}

// display the index
$display = display_index($viewcatkey);

if ( !$display )
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
if (isset($HTTP_GET_VARS['selected_id']) || isset($HTTP_POST_VARS['selected_id']))
{
	$selected_id = isset($HTTP_POST_VARS['selected_id']) ? $HTTP_POST_VARS['selected_id'] : $HTTP_GET_VARS['selected_id'];
	$type	= substr($selected_id, 0, 1);
	$id		= intval(substr($selected_id, 1));
	if ($type == POST_FORUM_URL)
	{
		$forum_id = $id;
	}
	else if (($type == POST_CAT_URL) || ($selected_id == 'Root'))
	{
		$parm = ($id != 0) ? "?" . POST_CAT_URL . "=$id" : '';
		redirect(append_sid("./index.$phpEx" . $parm));
		exit;
	}
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_id = $topic_row['forum_id'];
	$forum_name = $topic_row['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	$forum_id = $topic_row['forum_id'];
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_name = $topic_row['forum_name'];
//-- add
	$forum_name = get_object_lang(POST_FORUM_URL . $topic_row['forum_id'], 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
	$forum_name = $topic_row['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_name = $topic_row['forum_name'];
//-- add
	$forum_name = get_object_lang(POST_FORUM_URL . $topic_row['forum_id'], 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$new_forum_id = intval($HTTP_POST_VARS['new_forum']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			$fid = $HTTP_POST_VARS['new_forum'];
			if ($fid == 'Root')
			{
				$type = POST_CAT_URL;
				$new_forum_id = 0;
			}
			else
			{
				$type = substr($fid, 0, 1);
				$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
			}
			if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				'S_FORUM_SELECT' => make_forum_select('new_forum', $forum_id),
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//				'S_FORUM_SELECT' => make_forum_select('new_forum', $forum_id), 
//-- add
				'S_FORUM_SELECT' => selectbox('new_forum', $forum_id),
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				$new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//				$new_forum_id = intval($HTTP_POST_VARS['new_forum_id']);
//-- add
				$fid = $HTTP_POST_VARS['new_forum_id'];
				if ($fid == 'Root')
				{
					$type = POST_CAT_URL;
					$new_forum_id = 0;
				}
				else
				{
					$type = substr($fid, 0, 1);
					$new_forum_id = ($type == POST_FORUM_URL) ? intval(substr($fid, 1)) : 0;
				}
				if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id))
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//					'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id))
//-- add
					'S_FORUM_SELECT' => selectbox("new_forum_id", false, $forum_id))
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_name = $post_info['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_name = $post_info['forum_name'];
//-- add
	$forum_name = get_object_lang(POST_FORUM_URL . $post_info['forum_id'], 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$search_cat = ( isset($HTTP_POST_VARS['search_cat']) ) ? intval($HTTP_POST_VARS['search_cat']) : -1;
$search_forum = ( isset($HTTP_POST_VARS['search_forum']) ) ? intval($HTTP_POST_VARS['search_forum']) : -1;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $search_cat = ( isset($HTTP_POST_VARS['search_cat']) ) ? intval($HTTP_POST_VARS['search_cat']) : -1;
// $search_forum = ( isset($HTTP_POST_VARS['search_forum']) ) ? intval($HTTP_POST_VARS['search_forum']) : -1;
//-- add
$search_where =  ( isset($HTTP_POST_VARS['search_where']) ) ? $HTTP_POST_VARS['search_where'] : 'Root';
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		if ( $search_forum != -1 )
		{
			$is_auth = auth(AUTH_READ, $search_forum, $userdata);

			if ( !$is_auth['auth_read'] )
			{
				message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
			}

			$auth_sql = "f.forum_id = $search_forum";
		}
		else
		{
			$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); 

			if ( $search_cat != -1 )
			{
				$auth_sql = "f.cat_id = $search_cat";
			}

			$ignore_forum_sql = '';
			while( list($key, $value) = each($is_auth_ary) )
			{
				if ( !$value['auth_read'] )
				{
					$ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
				}
			}

			if ( $ignore_forum_sql != '' )
			{
				$auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
			}
		}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		if ( $search_forum != -1 )
//		{
//			$is_auth = auth(AUTH_READ, $search_forum, $userdata);
//
//			if ( !$is_auth['auth_read'] )
//			{
//				message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
//			}
//
//			$auth_sql = "f.forum_id = $search_forum";
//		}
//		else
//		{
//			$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
//
//			if ( $search_cat != -1 )
//			{
//				$auth_sql = "f.cat_id = $search_cat";
//			}
//
//			$ignore_forum_sql = '';
//			while( list($key, $value) = each($is_auth_ary) )
//			{
//				if ( !$value['auth_read'] )
//				{
//					$ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
//				}
//			}
//
//			if ( $ignore_forum_sql != '' )
//			{
//				$auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
//			}
//		}
//-- add
		// get the object list
		$keys = array();
		$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'] )
			{
				$s_flist .= (($s_flist != '') ? ', ' : '') . $tree['id'][ $keys['idx'][$i] ];
			}
		}
		if ($s_flist != '')
		{
			$auth_sql .= (( $auth_sql != '' ) ? " AND" : '') . " f.forum_id IN ($s_flist) ";
		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
		}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					'TOPIC_TITLE' => $topic_title,
					'FORUM_NAME' => $searchset[$i]['forum_name'],
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
					'TOPIC_TITLE' => $topic_title,
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//					'FORUM_NAME' => $searchset[$i]['forum_name'],
//-- add
					'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $searchset[$i]['forum_id'], 'name'),
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				$template->assign_block_vars('searchresults', array( 
					'FORUM_NAME' => $searchset[$i]['forum_name'],
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				$template->assign_block_vars('searchresults', array(
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//					'FORUM_NAME' => $searchset[$i]['forum_name'],
//-- add
					'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $searchset[$i]['forum_id'], 'name'),
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id  
	FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
	WHERE f.cat_id = c.cat_id 
	ORDER BY c.cat_id, f.forum_order";
$result = $db->sql_query($sql);
if ( !$result )
{
	message_die(GENERAL_ERROR, 'Could not obtain forum_name/forum_id', '', __LINE__, __FILE__, $sql);
}

$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);

$s_forums = '';
while( $row = $db->sql_fetchrow($result) )
{
	if ( $is_auth_ary[$row['forum_id']]['auth_read'] )
	{
		$s_forums .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>';
		if ( empty($list_cat[$row['cat_id']]) )
		{
			$list_cat[$row['cat_id']] = $row['cat_title'];
		}
	}
}

if ( $s_forums != '' )
{
	$s_forums = '<option value="-1">' . $lang['All_available'] . '</option>' . $s_forums;

	//
	// Category to search
	//
	$s_categories = '<option value="-1">' . $lang['All_available'] . '</option>';
	while( list($cat_id, $cat_title) = @each($list_cat))
	{
		$s_categories .= '<option value="' . $cat_id . '">' . $cat_title . '</option>';
	}
}
else
{
	message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id  
//	FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
//	WHERE f.cat_id = c.cat_id 
//	ORDER BY c.cat_id, f.forum_order";
//$result = $db->sql_query($sql);
//if ( !$result )
//{
//	message_die(GENERAL_ERROR, 'Could not obtain forum_name/forum_id', '', __LINE__, __FILE__, $sql);
//}
//
//$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
//
//$s_forums = '';
//while( $row = $db->sql_fetchrow($result) )
//{
//	if ( $is_auth_ary[$row['forum_id']]['auth_read'] )
//	{
//		$s_forums .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>';
//		if ( empty($list_cat[$row['cat_id']]) )
//		{
//			$list_cat[$row['cat_id']] = $row['cat_title'];
//		}
//	}
//}
//
//if ( $s_forums != '' )
//{
//	$s_forums = '<option value="-1">' . $lang['All_available'] . '</option>' . $s_forums;
//
//	//
//	// Category to search
//	//
//	$s_categories = '<option value="-1">' . $lang['All_available'] . '</option>';
//	while( list($cat_id, $cat_title) = @each($list_cat))
//	{
//		$s_categories .= '<option value="' . $cat_id . '">' . $cat_title . '</option>';
//	}
//}
//else
//{
//	message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
//}
//-- add
$s_forums = get_tree_option();
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
define('IN_VIEWFORUM', true);
if ( isset($HTTP_GET_VARS['selected_id']) || isset($HTTP_POST_VARS['selected_id']) )
{
	$selected_id = isset($HTTP_POST_VARS['selected_id']) ? $HTTP_POST_VARS['selected_id'] : $HTTP_GET_VARS['selected_id'];
	$type	= substr($selected_id, 0, 1);
	$id		= intval(substr($selected_id, 1));
	if ($type == POST_FORUM_URL)
	{
		$forum_id = $id;
	}
	else if (($type == POST_CAT_URL) || ($selected_id == 'Root'))
	{
		$parm = ($id != 0) ? "?" . POST_CAT_URL . "=$id" : '';
		redirect(append_sid("./index.$phpEx" . $parm));
		exit;
	}
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
//
// End session management
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- 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');
}

// handle forum link type
$selected_id = POST_FORUM_URL . $forum_id;
$this_key = isset($tree['keys'][$selected_id]) ? $tree['keys'][$selected_id] : -1;
if ( ($this_key > -1) && !empty($tree['data'][$this_key]['forum_link']))
{
	// add 1 to hit if count ativated
	if ($tree['data'][$this_key]['forum_link_hit_count'])
	{
		$sql = "UPDATE " . FORUMS_TABLE . " 
					SET forum_link_hit = forum_link_hit + 1 
					WHERE forum_id=$forum_id";
		if (!$db->sql_query($sql)) message_die(GENERAL_ERROR, 'Could not increment forum hits information', '', __LINE__, __FILE__, $sql);
		cache_tree(true);
	}

	// prepare url
	$url = $tree['data'][$this_key]['forum_link'];
	if ($tree['data'][$this_key]['forum_link_internal'])
	{
		$part = explode( '?', $url);
		$url .= ((count($part) > 1) ? '&' : '?') . 'sid=' . $userdata['session_id'];
		$url = append_sid($url);

		// redirect to url
		redirect($url);
	}

	// Redirect via an HTML form for PITA webservers
	if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
	{
		header('Refresh: 0; URL=' . $url);
		echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $url . '"><title>' . $lang['Redirect'] . '</title></head><body><div align="center">' . sprintf($lang['Rediect_to'], '<a href="' . $url . '">', '</a>') . '</div></body></html>';
		exit;
	}

	// Behave as per HTTP/1.1 spec for others
	header('Location: ' . $url);
	exit;
}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row);
//-- add
$is_auth = $tree['auth'][POST_FORUM_URL . $forum_id];
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ 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($tree['mods'][$idx]['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($tree['mods'][$idx]['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 ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Dump out the page header and load viewforum template
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
$forum_row['forum_name'] = get_object_lang(POST_FORUM_URL . $forum_id, 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
display_index(POST_FORUM_URL . $forum_id);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
viewonline.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_data[$row['forum_id']] = $row['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$forum_data[$row['forum_id']] = $row['forum_name'];
//-- add
		$forum_data[$row['forum_id']] = get_object_lang(POST_FORUM_URL . $row['forum_id'], 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$topic_id = intval($row['topic_id']);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
			redirect( "./viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id" );
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);

if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
//
// if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
//-- add
$is_auth = $tree['auth'][POST_FORUM_URL . $forum_id];

if ( !$is_auth['auth_read'] )
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
//-- add
	$message = sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$forum_name = $forum_topic_data['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $forum_name = $forum_topic_data['forum_name'];
//-- add
$forum_name = get_object_lang(POST_FORUM_URL . $forum_topic_data['forum_id'], 'name');
$topic_forum_id = $forum_topic_data['forum_id'];
$topic_topic_title = $forum_topic_data['topic_title'];
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forumauth.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ 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_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
	$forum_sql = "AND forum_id = $forum_id";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
//	$forum_sql = "AND forum_id = $forum_id";
//-- add
	$fid = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
	$f_type = substr($fid, 0, 1);
	if ($f_type == POST_FORUM_URL)
	{
		$forum_id = intval(substr($fid, 1));
		$forum_sql = " WHERE forum_id = $forum_id";
	}
	else
	{
		unset($forum_id);
		$forum_sql = '';
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT f.*
	FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
	WHERE c.cat_id = f.cat_id
	$forum_sql
	ORDER BY c.cat_order ASC, f.forum_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
}

$forum_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $sql = "SELECT f.*
//	FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
//	WHERE c.cat_id = f.cat_id
//	$forum_sql
//	ORDER BY c.cat_order ASC, f.forum_order ASC";
// if ( !($result = $db->sql_query($sql)) )
// {
//	message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
// }
//
// $forum_rows = $db->sql_fetchrowset($result);
// $db->sql_freeresult($result);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$select_list = '<select name="' . POST_FORUM_URL . '">';
	for($i = 0; $i < count($forum_rows); $i++)
	{
		$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
	}
	$select_list .= '</select>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$select_list = '<select name="' . POST_FORUM_URL . '">';
//	for($i = 0; $i < count($forum_rows); $i++)
//	{
//		$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
//	}
//	$select_list .= '</select>';
//-- add
	$select_list = selectbox(POST_FORUM_URL, false, '', true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_name = $forum_rows[0]['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_name = $forum_rows[0]['forum_name'];
//-- add
	$forum_rows[0] = $tree['data'][$tree['keys'][POST_FORUM_URL . $forum_id]];
	$forum_name_trad = get_object_lang(POST_FORUM_URL . $forum_id, 'name');
	$forum_name = $forum_rows[0]['forum_name'];
	if ($forum_name != $forum_name_trad)
	{
		$forum_name = '(' . $forum_name . ') ' . $forum_name_trad;
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
//-- add
	$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . POST_FORUM_URL . "$forum_id&adv=$adv_mode");
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
//-- add
	$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . POST_FORUM_URL . $forum_id . '">';
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forum_prune.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];

	if( $forum_id == -1 )
	{
		$forum_sql = '';
	}
	else
	{
		$forum_id = intval($forum_id);
		$forum_sql = "AND forum_id = $forum_id";
	}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
//
//	if( $forum_id == -1 )
//	{
//		$forum_sql = '';
//	}
//	else
//	{
//		$forum_id = intval($forum_id);
//		$forum_sql = "AND forum_id = $forum_id";
//	}
//-- add
	$fid = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
	$type = substr($fid, 0, 1);
	$id = intval(substr($fid, 1));
	$cat_id = -1;
	$forum_id = -1;
	if ($fid == 'Root') $type = POST_CAT_URL;
	if ($type == POST_CAT_URL)
	{
		$cat_id = $id;
	}
	else
	{
		$forum_id = $id;
	}
	$fid = $type . $id;
	if ( empty($fid) || ( $fid == POST_CAT_URL . '0' ) )
	{
		$fid = 'Root';
	}

	// set the sql request
	$tkeys = array();
	$tkeys = get_auth_keys($fid, true);
	$forum_rows = array();
	for ($i=0; $i < count($tkeys['id']); $i++)
	{
		if ($tree['type'][$tkeys['idx'][$i]] == POST_FORUM_URL)
		{
			$forum_rows[] = $tree['data'][$tkeys['idx'][$i]];
		}
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_id = '';
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	$forum_rows = array();
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT f.*
	FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
	WHERE c.cat_id = f.cat_id
	$forum_sql
	ORDER BY c.cat_order ASC, f.forum_order ASC";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql);
}

$forum_rows = array();
while( $row = $db->sql_fetchrow($result) )
{
	$forum_rows[] = $row;
}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
// $sql = "SELECT f.*
//	FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
//	WHERE c.cat_id = f.cat_id
//	$forum_sql
//	ORDER BY c.cat_order ASC, f.forum_order ASC";
// if( !($result = $db->sql_query($sql)) )
// {
//	message_die(GENERAL_ERROR, 'Could not obtain list of forums for pruning', '', __LINE__, __FILE__, $sql);
// }
//
// $forum_rows = array();
// while( $row = $db->sql_fetchrow($result) )
// {
//	$forum_rows[] = $row;
// }
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'FORUM_NAME' => $forum_rows[$i]['forum_name'],
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//			'FORUM_NAME' => $forum_rows[$i]['forum_name'],
//-- add
			'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $forum_rows[$i]['forum_id'], 'name'),
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$select_list = '<select name="' . POST_FORUM_URL . '">';
		$select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';

		for($i = 0; $i < count($forum_rows); $i++)
		{
			$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
		}
		$select_list .= '</select>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$select_list = '<select name="' . POST_FORUM_URL . '">';
//		$select_list .= '<option value="-1">' . $lang['All_Forums'] . '</option>';
//
//		for($i = 0; $i < count($forum_rows); $i++)
//		{
//			$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
//		}
//		$select_list .= '</select>';
//-- add
		$select_list = selectbox(POST_FORUM_URL, false, '', true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
//-- add
		$forum_name = ($fid == 'Root') ? $lang['All_Forums'] : get_object_lang($fid, 'name');
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';
//-- add
		$hidden_input = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $fid . '" />';
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'FORUM_NAME' => $forum_name,

			'L_FORUM' => $lang['Forum'],
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
			'FORUM_NAME' => $forum_name,

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//			'L_FORUM' => $lang['Forum'],
//-- add
			'L_FORUM' => ( $cat_id > 0 ) ? $lang['Category'] : $lang['Forum'],
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_ug_auth.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
				}
			}

			$sql = "SELECT * 
				FROM " . FORUMS_TABLE . " f
				ORDER BY forum_order";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
			}

			$forum_access = array();
			while( $row = $db->sql_fetchrow($result) )
			{
				$forum_access[] = $row;
			}
			$db->sql_freeresult($result);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				}
			}

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//			$sql = "SELECT * 
//				FROM " . FORUMS_TABLE . " f
//				ORDER BY forum_order";
//			if ( !($result = $db->sql_query($sql)) )
//			{
//				message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
//			}
//
//			$forum_access = array();
//			while( $row = $db->sql_fetchrow($result) )
//			{
//				$forum_access[] = $row;
//			}
//			$db->sql_freeresult($result);
//-- add
			// get all sorted by level
			$keys = array();
			$keys = get_auth_keys('Root', true);
			$forum_access = array();

			// extract forums
			$forum_access = array();
			for ($i=0; $i < count($keys['id']); $i++)
			{
				if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
				{
					$forum_access[] = $tree['data'][ $keys['idx'][$i] ];
				}
			}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	// Front end
	//
	$sql = "SELECT * 
		FROM " . FORUMS_TABLE . " f
		ORDER BY forum_order";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
	}

	$forum_access = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_access[] = $row;
	}
	$db->sql_freeresult($result);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	// Front end
	//
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$sql = "SELECT * 
//		FROM " . FORUMS_TABLE . " f
//		ORDER BY forum_order";
//	if ( !($result = $db->sql_query($sql)) )
//	{
//		message_die(GENERAL_ERROR, "Couldn't obtain forum information", "", __LINE__, __FILE__, $sql);
//	}
//
//	$forum_access = array();
//	while( $row = $db->sql_fetchrow($result) )
//	{
//		$forum_access[] = $row;
//	}
//	$db->sql_freeresult($result);
//-- add
	// get all sorted by level
	$keys = array();
	$keys = get_auth_keys('Root', true);

	// get the maximum level
	$max_level = 0;
	for ($i=0; $i < count($keys['id']); $i++)
	{
		if ($keys['real_level'][$i] > $max_level) $max_level = $keys['real_level'][$i];
	}

	// extract forums
	$forum_access = array();
	for ($i=0; $i < count($keys['id']); $i++)
	{
		if ($tree['type'][ $keys['idx'][$i] ] == POST_FORUM_URL)
		{
			$forum_access[] = $tree['data'][ $keys['idx'][$i] ];
		}
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$i = 0;
	@reset($auth_ug);
	while( list($forum_id, $user_ary) = @each($auth_ug) )
	{
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//	$i = 0;
//	@reset($auth_ug);
//	while( list($forum_id, $user_ary) = @each($auth_ug) )
//	{
//-- add
	$s_column_span = 2 + $max_level; // Two columns always present
	if( $adv ) $s_column_span = $s_column_span + count($forum_auth_fields)-1;

	// read the objects without the index forum (i=0)
	for ($i=1; $i < count($keys['id']); $i++)
	{
		$this_key	= $keys['idx'][$i];
		$level	= $keys['real_level'][$i];
		if ($tree['type'][$this_key] == POST_CAT_URL)
		{
			$class_cat = "cat";
			$template->assign_block_vars('row', array());
			$template->assign_block_vars('row.cathead', array(
				'CLASS_CAT' => $class_cat,
				'CAT_TITLE' => get_object_lang( $tree['type'][$this_key] . $tree['id'][$this_key], 'name'),
				'INC_SPAN'	=> $max_level - $level+1,
				)
			);
			for ($k=1; $k <= $level; $k++) $template->assign_block_vars('row.cathead.inc', array());
			if ($adv)
			{
				for ($j=0; $j < count($forum_auth_fields); $j++)
				{
					$template->assign_block_vars('row.cathead.aclvalues', array());
				}
			}
			else
			{
				$template->assign_block_vars('row.cathead.aclvalues', array());
			}
		}

		if ($tree['type'][$this_key] == POST_FORUM_URL)
		{
			$forum_id = $tree['data'][ $keys['idx'][$i] ]['forum_id'];
			$user_ary = $auth_ug[$forum_id];
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$template->assign_block_vars('forums', array(
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$template->assign_block_vars('forums', array(
//-- add
		$template->assign_block_vars('row', array());
		$template->assign_block_vars('row.forums', array(
			'INC_SPAN' => $max_level - $level+1,
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'FORUM_NAME' => $forum_access[$i]['forum_name'],

			'U_FORUM_AUTH' => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']),
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//			'FORUM_NAME' => $forum_access[$i]['forum_name'],
//
//			'U_FORUM_AUTH' => append_sid("admin_forumauth.$phpEx?f=" . $forum_access[$i]['forum_id']),
//-- add
			'FORUM_NAME'	=> get_object_lang(POST_FORUM_URL . $tree['data'][ $keys['idx'][$i] ]['forum_id'], 'name'),
			'U_FORUM_AUTH'	=> append_sid("admin_forumauth.$phpEx?f=" . $tree['data'][ $keys['idx'][$i] ]['forum_id']),
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		if( !$adv )
		{
			$template->assign_block_vars('forums.aclvalues', array(
				'S_ACL_SELECT' => $optionlist_acl)
			);
		}
		else
		{
			for($j = 0; $j < count($forum_auth_fields); $j++)
			{
				$template->assign_block_vars('forums.aclvalues', array(
					'S_ACL_SELECT' => $optionlist_acl_adv[$forum_id][$j])
				);
			}
		}

		$i++;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		for ($k=1; $k <= $level; $k++) $template->assign_block_vars('row.forums.inc', array());
//-- fin mod : categories hierarchy ----------------------------------------------------------------

		if( !$adv )
		{
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//			$template->assign_block_vars('forums.aclvalues', array(
//-- add
			$template->assign_block_vars('row.forums.aclvalues', array(
//-- fin mod : categories hierarchy ----------------------------------------------------------------
				'S_ACL_SELECT' => $optionlist_acl)
			);
		}
		else
		{
			for($j = 0; $j < count($forum_auth_fields); $j++)
			{
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//				$template->assign_block_vars('forums.aclvalues', array(
//-- add
				$template->assign_block_vars('row.forums.aclvalues', array(
//-- fin mod : categories hierarchy ----------------------------------------------------------------
					'S_ACL_SELECT' => $optionlist_acl_adv[$forum_id][$j])
				);
			}
		}

//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$i++;
//-- add
	}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		'S_COLUMN_SPAN' => $s_column_span,
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		'S_COLUMN_SPAN' => $s_column_span,
//-- add
		'SPACER'		=> './../' . $images['spacer'],
		'INC_SPAN'		=> $max_level+1,
		'S_COLUMN_SPAN' => $s_column_span + $max_level+2,
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$sql = "SELECT group_id, group_name
			FROM " . GROUPS_TABLE . "
			WHERE group_single_user <> " . TRUE;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- delete
//		$sql = "SELECT group_id, group_name
//			FROM " . GROUPS_TABLE . "
//			WHERE group_single_user <> " . TRUE;
//-- add
		$sql = "SELECT group_id, group_name
			FROM " . GROUPS_TABLE . "
			WHERE group_single_user <> " . TRUE . "
			ORDER BY group_name";
//-- 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 ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_match_sql = ( $forum_id != AUTH_LIST_ALL ) ? "AND a.forum_id = $forum_id" : '';
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		if ( isset( $userdata['user_forums_auth'] ) )
		{
			if ( $forum_id != AUTH_LIST_ALL)
			{
				$u_access[] = $userdata['user_forums_auth'][$forum_id];
			}
			else
			{
				$u_access = $userdata['user_forums_auth'];
			}
		}
		else
		{
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			while( $row = $db->sql_fetchrow($result) );
		}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
		}
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
define('CATEGORIES_HIERARCHY_INSTALLED', true);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : language settings -----------------------------------------------------------------------
//-- mod : mods settings ---------------------------------------------------------------------------
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
function get_db_stat($mode)
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
include_once( $phpbb_root_path . './includes/functions_categories_hierarchy.' . $phpEx );
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
//	$is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	return jumpbox($action, $match_forum_id);
//-- fin mod : categories hierarchy ----------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
	if ( $userdata['user_id'] != ANONYMOUS )
	{
		if ( !empty($userdata['user_lang']))
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : mods settings ---------------------------------------------------------------------------
//-- add
	global $db, $mods, $list_yes_no, $userdata;

	//	get all the mods settings
	$dir = @opendir($phpbb_root_path . 'includes/mods_settings');
	while( $file = @readdir($dir) )
	{
		if( preg_match("/^mod_.*?\." . $phpEx . "$/", $file) )
		{
			include_once($phpbb_root_path . 'includes/mods_settings/' . $file);
		}
	}
	@closedir($dir);
//-- fin mod : mods settings -----------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	//
	// Set up style
	//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $tree;
	if (empty($tree['auth'])) get_user_tree($userdata);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
//-- mod : language settings -----------------------------------------------------------------------
//-- add
	include($phpbb_root_path . './includes/lang_extend_mac.' . $phpEx);
//-- fin mod : language settings -------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------------
#
	if(defined('HAS_DIED'))
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $tree;
//-- fin mod : categories hierarchy ----------------------------------------------------------------

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

		if ( empty($template) )
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : language settings -----------------------------------------------------------------------
//-- add
			include($phpbb_root_path . './includes/lang_extend_mac.' . $phpEx);
//-- fin mod : language settings -------------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$template->pparse('overall_header');
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
// get the nav sentence
$nav_key = '';
if (isset($HTTP_POST_VARS[POST_CAT_URL]) || isset($HTTP_GET_VARS[POST_CAT_URL]))
{
	$nav_key = POST_CAT_URL . ((isset($HTTP_POST_VARS[POST_CAT_URL])) ? intval($HTTP_POST_VARS[POST_CAT_URL]) : intval($HTTP_GET_VARS[POST_CAT_URL]));
}
if (isset($HTTP_POST_VARS[POST_FORUM_URL]) || isset($HTTP_GET_VARS[POST_FORUM_URL]))
{
	$nav_key = POST_FORUM_URL . ((isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]));
}
if (isset($HTTP_POST_VARS[POST_TOPIC_URL]) || isset($HTTP_GET_VARS[POST_TOPIC_URL]))
{
	$nav_key = POST_TOPIC_URL . ((isset($HTTP_POST_VARS[POST_TOPIC_URL])) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : intval($HTTP_GET_VARS[POST_TOPIC_URL]));
}
if (isset($HTTP_POST_VARS[POST_POST_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]))
{
	$nav_key = POST_POST_URL . ((isset($HTTP_POST_VARS[POST_POST_URL])) ? intval($HTTP_POST_VARS[POST_POST_URL]) : intval($HTTP_GET_VARS[POST_POST_URL]));
}
if ( empty($nav_key) && (isset($HTTP_POST_VARS['selected_id']) || isset($HTTP_GET_VARS['selected_id'])) )
{
   $nav_key = isset($HTTP_GET_VARS['selected_id']) ? $HTTP_GET_VARS['selected_id'] : $HTTP_POST_VARS['selected_id'];
}
if ( empty($nav_key) )
{
	$nav_key = 'Root';
}
$nav_cat_desc = make_cat_nav_tree($nav_key, $nav_pgm, 'nav', $topic_topic_title, $topic_forum_id);
if ( !empty($nav_cat_desc) )
{
	$nav_cat_desc = $nav_separator . $nav_cat_desc;
}

// send to template
$template->assign_vars(array(
	'SPACER'		=> $images['spacer'],
	'NAV_SEPARATOR' => $nav_separator,
	'NAV_CAT_DESC'	=> $nav_cat_desc,
	)
);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	global $starttime;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
	global $tree;
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
# at top of the file
#
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
</a>
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
{NAV_CAT_DESC}
#
#-----[ FIND ]------------------------------------------------
#
#************************************************************************************
#					NOTE :
#					------
#	The lines deleted here are reported in index_box.tpl. You will probably
#	want to customize index_box.tpl the same way index_body.tpl was if you use
#	a particular template with other classes than the one used by subSilver.
#
#************************************************************************************
#
# this is a partial search : the full lines are longer
#
<table
  <tr> 
		{L_FORUM}
		{L_TOPICS}
		{L_POSTS}
		{L_LASTPOST}
  </tr>
  <!-- BEGIN catrow -->
  <tr> 
		{catrow.CAT_DESC}
		&nbsp;
  </tr>
  <!-- BEGIN forumrow -->
  <tr> 
		<img src="{catrow.forumrow.FORUM_FOLDER_IMG}" 
		{catrow.forumrow.FORUM_NAME}
		{catrow.forumrow.FORUM_DESC}
		{catrow.forumrow.MODERATORS}
		{catrow.forumrow.TOPICS}
		{catrow.forumrow.POSTS}
		{catrow.forumrow.LAST_POST}
  </tr>
  <!-- END forumrow -->
  <!-- END catrow -->
</table>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
{BOARD_INDEX}
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full lines are longer
#
<table 
  <tr> 
	<a href="{U_VIEWONLINE}"
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- BEGIN disable_viewonline -->
#
#-----[ FIND ]------------------------------------------------
#

<!-- BEGIN switch_user_logged_out -->
<form method="post" action="{S_LOGIN_ACTION}">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- END disable_viewonline -->
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/modcp_body.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<form method="post" action="{S_MODCP_ACTION}">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
 -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
{NAV_CAT_DESC}
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/modcp_move.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<form action="{S_MODCP_ACTION}" method="post">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	  <td align="left" class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></td>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
 class="nav">
#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
><span
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
</a>
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
{NAV_CAT_DESC}</span>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/modcp_split.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<form method="post" action="{S_SPLIT_ACTION}">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	  <td align="left" class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a><span class="nav"> 
		-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	  <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}</span></td>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<script language="JavaScript" type="text/javascript">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
		-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
		<!-- END switch_not_privmsg -->
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		{NAV_CAT_DESC}
		<!-- END switch_not_privmsg -->
		</span></td>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/search_body.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<form action="{S_SEARCH_ACTION}" method="POST"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
name="search_forum"
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
search_forum
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
search_where
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
{L_CATEGORY}
{S_CATEGORY_OPTIONS}
</select>
{L_SORT_BY}
{S_SORT_OPTIONS}
</tr>
<tr> 
{L_DISPLAY_RESULTS}
{L_POSTS}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		<td class="row1" align="right" nowrap="nowrap"><span class="gen">{L_DISPLAY_RESULTS}:&nbsp;</span></td>
		<td class="row2" nowrap="nowrap"><input type="radio" name="show_results" value="posts" /><span class="genmed">{L_POSTS}<input type="radio" name="show_results" value="topics" checked="checked" />{L_TOPICS}</span></td>
		<td class="row1" align="right" rowspan="2"><span class="gen">{L_SORT_BY}:&nbsp;</span></td>
		<td class="row2" valign="middle" nowrap="nowrap" rowspan="2"><span class="genmed"><select class="post" name="sort_by">{S_SORT_OPTIONS}</select><br /><input type="radio" name="sort_dir" value="ASC" /> {L_SORT_ASCENDING}<br /><input type="radio" name="sort_dir" value="DESC" checked /> {L_SORT_DESCENDING}</span>&nbsp;</td>
	</tr>
	<tr>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
$images['category'] = "$current_template_images/cat_folder_big.gif";
$images['category_new'] = "$current_template_images/cat_folder_new_big.gif";
$images['category_locked'] = "$current_template_images/cat_folder_locked_big.gif";
$images['icon_minicat'] = "$current_template_images/icon_minicat.gif";
$images['icon_minicat_new'] = "$current_template_images/icon_minicat_new.gif";
$images['icon_minicat_locked'] = "$current_template_images/icon_minicat_lock.gif";
$images['icon_minipost_lock'] = "$current_template_images/icon_minipost_lock.gif";
$images['link'] = "$current_template_images/link_folder.gif";
$images['icon_minilink'] = "$current_template_images/icon_minilink.gif";

$images['up_arrow'] = "$current_template_images/icon_up_arrow.gif";
$images['down_arrow'] = "$current_template_images/icon_down_arrow.gif";

$images['spacer'] = "$current_template_images/spacer.gif";
//-- fin mod : categories hierarchy ----------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<form method="post" action="{S_POST_DAYS_ACTION}">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	  <td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><br /><span class="gensmall"><b>{L_MODERATOR}: {MODERATORS}<br /><br />{LOGGED_IN_USER_LIST}</b></span></td>
	  <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
	</tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	  <td align="left" valign="middle" class="nav" width="100%"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}</span></td>
	</tr>
  </table>

{BOARD_INDEX}

  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full lines are longer
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> 
<a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	  <td align="left" valign="bottom" width="100%"><span class="gensmall"><b>{L_MODERATOR}: {MODERATORS}<br /><br />{LOGGED_IN_USER_LIST}</b></span></td>
	  <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b><br /><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
#
#-----[ FIND ]------------------------------------------------
#
	  <th align="center" class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
<th
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
 width="150"
#
#-----[ FIND ]------------------------------------------------
#
	  <td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
 -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a>
#
#-----[ IN-LINE REPLACE WITH ]--------------------------------
#
{NAV_CAT_DESC}
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a><br />
	  <span class="gensmall"><b>{PAGINATION}</b><br />
	  &nbsp; </span></td>
  </tr>
</table>

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
  </tr>
</table>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : categories hierarchy v 2 -->
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<tr> 
	<td align="left" valign="middle" class="nav" width="100%"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}</span></td>
</tr>
<tr>
	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="right" valign="bottom" width="100%" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
</tr>
</table>
#
#-----[ FIND ]------------------------------------------------
#
	<td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	<td align="left" valign="middle" class="nav" width="100%"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}</span></td>
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/auth_ug_body.tpl
#
#-----[ FIND ]------------------------------------------------
# at top of the file
<h1>{L_AUTH_TITLE}</h1>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : categories hierarchy v 2 -->
#
#-----[ FIND ]------------------------------------------------
#
	  <th width="30%" class="thCornerL">{L_FORUM}</th>
#
#-----[ IN-LINE FIND ]---------------------------------------- 
#
class="thCornerL"
#
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
#
 colspan="{INC_SPAN}"
#
#-----[ FIND ]------------------------------------------------
#
	  <th class="thCornerR">{L_MODERATOR_STATUS}</th>
	</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
	<!-- BEGIN row -->
	<!-- BEGIN cathead -->
	<tr> 
		<!-- BEGIN inc -->
		<td class="row2" width="46"><img src="{SPACER}" width="46" height="0" /></td>
		<!-- END inc -->
		<td colspan="{row.cathead.INC_SPAN}" class="{row.cathead.CLASS_CAT}" align="left" nowrap="nowrap"> <span class="cattitlemed">{row.cathead.CAT_TITLE}</span></td>
		<!-- BEGIN aclvalues -->
		<td class="{row.cathead.CLASS_CAT}" align="left" nowrap="nowrap"><span class="cattitlemed">&nbsp;</span></td>
		<!-- END aclvalues -->
		<td class="{row.cathead.CLASS_CAT}" align="left" nowrap="nowrap"><span class="cattitlemed">&nbsp;</span></td>
	</tr>
	<!-- END cathead -->
#
#-----[ FIND ]------------------------------------------------
#
	<tr> 
	  <td class="{forums.ROW_CLASS}" align="center">{forums.FORUM_NAME}</td>
	  <!-- BEGIN aclvalues -->
	  <td class="{forums.ROW_CLASS}" align="center">{forums.aclvalues.S_ACL_SELECT}</td>
	  <!-- END aclvalues -->
	  <td class="{forums.ROW_CLASS}" align="center">{forums.S_MOD_SELECT}</td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		<!-- BEGIN inc -->
		<td class="row2" width="46"><img src="{SPACER}" width="46" height="0" /></td>
		<!-- END inc -->
		<td class="row1" align="left" colspan="{row.forums.INC_SPAN}"><span class="gentbl">{row.forums.FORUM_NAME}</span></td>
		<!-- BEGIN aclvalues -->
		<td class="row2" align="center">{row.forums.aclvalues.S_ACL_SELECT}</td>
		<!-- END aclvalues -->
		<td class="row1" align="center">{row.forums.S_MOD_SELECT}</td>
#
#-----[ FIND ]------------------------------------------------
#
	<!-- END forums -->
#
#-----[ AFTER, ADD ]------------------------------------------
#
	<!-- END row -->
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM