############################################################## 
## MOD Title: categories hierarchie : upgrade 1.0.8 to 1.0.9
## MOD Author: Ptirhiik - RPGNET-Fr < admin@rpgnet-fr.com > (P.Roge) http://www.RPGnet-fr.com 
## MOD Description: 
##		This one is to upgrade the categorie hierarchie mod 
##		from 1.0.8 to 1.0.9
##
##		v 1.0.9 : 
##			- add the cat folder locked pic,
##			- add the catRupt desc in the headers for those who don't use the CSS
##			- fix a class missing in admin panel,
##			- indentation of forums and cats on flat views (ACP and vBulletin)
##			- indentated tree of forums and cats in jump boxes
##			- re-add the links missing to the current page in the nav sentence
##			- add the nav sentence on the split topic mod screen
##			- nav separator ( -> ) is now customizable
##			- the mark all read is now contextuel (mark forums and sub-cats of a cat)
##			- you can now choose to prune categories rather than a forum in the ACP
##
## MOD Version: 1.0.RC9-01
## 
## Installation Level: moderate
## Installation Time: 45 Minutes
## Files To Edit: 
##		index.php
##		modcp.php
##		posting.php
##		viewforum.php
##		viewtopic.php
##
##		admin/admin_forum_prune.php
##		admin/admin_forumauth.php
##		admin/admin_forums.php
##		admin/admin_ug_auth.php
##
##		includes/functions.php
##		includes/functions_admin.php
##		includes/page_header.php
##
##		templates/subSilver/index_body.tpl
##		templates/subSilver/modcp_split.tpl
##		templates/subSilver/overall_header.tpl
##		templates/subSilver/posting_body.tpl
##		templates/subSilver/subSilver.cfg
##		templates/subSilver/subSilver.css
##		templates/subSilver/viewforum_body.tpl
##		templates/subSilver/viewtopic_body.tpl
##
##		templates/subSilver/admin/auth_ug_body.tpl
##		templates/subSilver/admin/forum_admin_body.tpl
##		templates/subSilver/admin/page_header.tpl
##
## Included Files: 
##		cat_folder_locked_big.gif
##		cellpic4.gif
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
############################################################## 
##
##
## Author note : 
##	You should have the categories hierarchie v 1.0.8 installed before applying this one
##	This is only the upgrade to go from 1.0.8 to 1.0.9
##	See the file mod-hierarchisation-109.txt for a fresh install
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
#
#-----[ COPY ]------------------------------------------------
#
COPY cat_folder_locked_big.gif TO templates/subSilver/images/cat_folder_locked_big.gif
COPY cellpic4.gif TO templates/subSilver/images/cellpic4.gif

#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
function display_index_cat($catrow, $sub_forum, $main)
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
function display_index_cat($catrow, $sub_forum, $main, $cur_depth = 0)
#
#-----[ FIND ]------------------------------------------------
#
	global $total_categories, $category_rows, $total_forums, $forum_data, $forum_moderators, $images, $lang, $template, $phpEx;
#
#-----[ AFTER, ADD ]------------------------------------------
#
	global $max_depth;
	if ( $sub_forum ) $cur_depth = 0;
#
#-----[ FIND ]------------------------------------------------
#
			$class_rowpic  = "catRupt";
		}
		$template->assign_block_vars('catrow', array(

#
#-----[ AFTER, ADD ]------------------------------------------
#
			'INC_SPAN'		=> $max_depth-$cur_depth + 2,
#
#-----[ FIND ]------------------------------------------------
#
		$color = true;
#
#-----[ AFTER, ADD ]------------------------------------------
#
		$inc_row = true;
		for ($k=0; $k < $cur_depth; $k++ ) 
		{
			$template->assign_block_vars('catrow.inc', array('INC_ROW' => $inc_row ? "row1" : "row2" ) );
			$inc_row = !$inc_row;
		}
#
#-----[ FIND ]------------------------------------------------
#
					$moderator_list = implode(', ', $forum_moderators[$forum_id]);
				}
				$row_color = ( $color ) ? $theme['td_color1'] : $theme['td_color2'];
				$row_class = ( $color ) ? $theme['td_class1'] : $theme['td_class2'];
				$color = !$color;
				$template->assign_block_vars('catrow.forumrow',	array(
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
					$moderator_list = implode(', ', $forum_moderators[$forum_id]);
				}
				$row_color = ( $color ) ? $theme['td_color1'] : $theme['td_color2'];
				$row_class = ( $color ) ? $theme['td_class1'] : $theme['td_class2'];
				$color = !$color;
				$odd = ( $sub_forum || ( intval($cur_depth / 2) == ($cur_depth/2) ) );
				$template->assign_block_vars('catrow.forumrow',	array(
					'INC_SPAN'		=> $max_depth-$cur_depth+1,
					'INC_ROW'		=> ( $odd ? "row1" : "row2" ),
#
#-----[ FIND ]------------------------------------------------
#
					'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
				);
#
#-----[ AFTER, ADD ]------------------------------------------
#
				$inc_row = true;
				for ($k=0; $k < $cur_depth; $k++ ) 
				{
					$template->assign_block_vars('catrow.forumrow.inc', array('INC_ROW' => $inc_row ? "row1" : "row2" ) );
					$inc_row = !$inc_row;
				}
#
#-----[ FIND ]------------------------------------------------
#
					display_index_cat($category_rows[$j], $sub_forum, false);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
					display_index_cat($category_rows[$j], $sub_forum, false, $cur_depth+1);
#
#-----[ FIND ]------------------------------------------------
#
					$template->assign_block_vars('catrow.forumrow',	array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
						'INC_ROW'   => "row1",
#
#-----[ FIND ]------------------------------------------------
#
if( $mark_read == 'forums' )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
	if ( $viewcat < 0 )
	{
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		"META" => '<meta http-equiv="refresh" content="3;url='  .append_sid("index.$phpEx") . '">')
	);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
	}
	else
	{
		if( $userdata['session_logged_in'] )
		{
			// rcuprer la liste des catgories concernes
			$catrows = array();
			$catrows = get_cat($viewcat);

			// constituer la liste des catgories  regarder
			$catids = array();
			for ( $i=0; $i < count($catrows); $i++) $catids[] = $catrows[$i]['cat_id'];
			$s_cat = implode(', ', $catids);

			// rcuprer la liste des forums
			$forumids = array();
			$sql = "select * from " . FORUMS_TABLE . " where cat_id in ($s_cat)";
			if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query new forums information', '', __LINE__, __FILE__, $sql);
			while ( $row = $db->sql_fetchrow($result) ) $forumids[] = $row;

			// marquer chaque forum
			for ( $i=0; $i < count($forumids); $i++ )
			{
				$forum_id = $forumids[$i]['forum_id'];
				$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 : hirarchie des rubriques -----------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	if ($nav_cat_desc != "") $nav_cat_desc = " > ".$nav_cat_desc;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
	$mark = ($viewcat == -1 ) ? '' : '&' . POST_CAT_URL . '=' . $viewcat;
#
#-----[ FIND ]------------------------------------------------
#
		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
//-- add v 1.0.9
		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums$mark"))
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- add v1.0.1
	//
	// enhance cat & forum informations
	enhance_cat($viewcat);
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- add v 1.0.9
	// get max depth
	$max_depth = ( !$sub_forum ) ? get_max_depth($viewcat) : 0;
	$template->assign_vars(array(
		'INC_SPAN' => $max_depth + 2)
	);

#
#-----[ OPEN ]------------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------------
#
//-- add v 1.0.7
$nav_cat_desc = ' > '.make_cat_nav_tree($cat_id, true);
$nav_cat_desc .= ' > <a href="'.append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id").'" class="nav">'.$forum_name.'</a>';
if ($topic_title != '') $nav_cat_desc .= ' > <a href="'.append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id").'" class="nav">'.$topic_title.'</a>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- add v 1.0.9
$nav_cat_desc = $nav_separator . make_cat_nav_tree($cat_id, true);
$nav_cat_desc .= $nav_separator . '<a href="'.append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id").'" class="nav">'.$forum_name.'</a>';
if ($topic_title != '') $nav_cat_desc .= $nav_separator . '<a href="'.append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id").'" class="nav">'.$topic_title.'</a>';
#
#-----[ FIND ]------------------------------------------------
#
			$old_forum_id = $forum_id;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
			if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				$topic_time = time();
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
				if ($new_forum_id <= 0 ) message_die(GENERAL_MESSAGE, $lang['Forum_not_exist']);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------------
#
	if ($nav_cat_desc != "") $nav_cat_desc = " > ".$nav_cat_desc;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;

#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
if ($nav_cat_desc != "") $nav_cat_desc = " > ".$nav_cat_desc;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;

#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------------
#
if ($nav_cat_desc != "") $nav_cat_desc = " > ".$nav_cat_desc;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forum_prune.php
#
#-----[ FIND ]------------------------------------------------
#
	$forum_id = ( isset($HTTP_POST_VARS[POST_FORUM_URL]) ) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
	$cat_id = -1;
	if ( substr($forum_id, 0, 1) == 'C' ) $cat_id = intval( substr($forum_id, 1) );
	$forum_sql = '';
	if ( $cat_id > -1 )
	{
		$catrows = get_cat($cat_id);
		$catids = array();
		for ( $i = 0; $i < count($catrows); $i++ ) $catids[] = $catrows[$i]['cat_id'];
		$s_cat = implode(', ', $catids);
		if ( $s_cat != '' ) $forum_sql = " AND f.cat_id in ($s_cat)";
	}
	else
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- 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";
//-- add v 1.0.7
$sql = "SELECT f.*, c.cat_title 
	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";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
$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";
#
#-----[ 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++)
		{

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
//-- add v 1.0.7
			$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['cat_title'] . ": " . $forum_rows[$i]['forum_name'] . '</option>';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

		}
		$select_list .= '</select>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- 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 v 1.0.9
		$select_list = make_forum_select(POST_FORUM_URL, false, '', true);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
//-- add v 1.0.9
		$forum_id = $HTTP_POST_VARS[POST_FORUM_URL];
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$forum_name = ( $forum_id == -1 ) ? $lang['All_Forums'] : $forum_rows[0]['forum_name'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
		if ( $cat_id > -1 )
		{
			if ( $cat_id == 0)
			{
				$forum_name = $lang['All_Forums'];
			}
			else
			{
				$sql = "select * from " . CATEGORIES_TABLE . " where cat_id = $cat_id";
				if( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query category', '', __LINE__, __FILE__, $sql);
				if ( $row = $db->sql_fetchrow($result) ) $forum_name = $row['cat_title'];
			}
		}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'FORUM_NAME' => $forum_name,

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

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			'L_FORUM' => $lang['Forum'], 
//-- add v 1.0.9
			'L_FORUM' => ( $cat_id > 0 ) ? $lang['Category'] : $lang['Forum'], 
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forumauth.php
#
#-----[ FIND ]------------------------------------------------
#
require('./pagestart.' . $phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- 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";
//-- add v 1.0.7
$sql = "SELECT f.*, c.cat_title 
	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";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
$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";
#
#-----[ FIND ]------------------------------------------------
#
if( empty($forum_id) )
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
// if( empty($forum_id) )
//-- add v 1.0.9
if ( empty($forum_id) || ( $forum_id <= 0 ) )
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$select_list = '<select name="' . POST_FORUM_URL . '">';
	for($i = 0; $i < count($forum_rows); $i++)
	{

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
//-- add v 1.0.7
		$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['cat_title'] . ": " . $forum_rows[$i]['forum_name'] . '</option>';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

	}
	$select_list .= '</select>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- 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 v 1.0.9
	$select_list = make_forum_select(POST_FORUM_URL);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]------------------------------------------------
#
function admin_get_cat_list($cat_main, &$cat_row)
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
function admin_get_cat_list($cat_main, &$cat_row, $level=0, $cat_except=-1)
#
#-----[ FIND ]------------------------------------------------
#
		$cat_row[] = $rowlevel[$i];
		admin_get_cat_list( $rowlevel[$i]['cat_id'], $cat_row );
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		if ( $rowlevel[$i]['cat_id'] != $cat_except )
		{
			$rowlevel[$i]['level'] = $level;
			$cat_row[] = $rowlevel[$i];
			admin_get_cat_list( $rowlevel[$i]['cat_id'], $cat_row, ($level+1), $cat_except );
		}
#
#-----[ FIND ]------------------------------------------------
#
	//
	// mettre  jour la bdd
	$sql = "update " . CATEGORIES_TABLE . " set cat_order = $new_order where cat_id = $cat_id";
	if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't update Categories order", "", __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- add v 1.0.9
function admin_get_list($mode, $id, $select, $with_index=false)
{
	global $lang;

	if ($mode == 'forum') return get_list($mode, $id, $select);

	$row = array();
	admin_get_cat_list( 0, $row, NULL, ( ($select == 0) ? $id : NULL ) );

	$cat_list = "";

	// add Index
	if ($with_index)
	{
		$s = "";
		if ($id == 0) $s = ' selected="selected"';
		$cat_list .= '<option value="0"' . $s . '>' . $lang['Forum_index'] . '</option>\n';
	}

	// add other categories except the current one
	for ($i=0; $i < count($row); $i++ ) if ( ($select != 0) || ($row[$i]['cat_id'] != $id) )
	{
		$s = "";
		if ($row[$i]['cat_id'] == $id) $s = ' selected="selected"';
		$inc = '';
		for ($j=1; $j < $row[$i]['level']; $j++) $inc = '|&nbsp;&nbsp;&nbsp;' . $inc;
		if ( $with_index ) $inc = ( ($row[$i]['level'] > 0) ? '|&nbsp;&nbsp;&nbsp;' : '|--&nbsp;' ) . $inc;
		$inc .= ($row[$i]['level'] > 0) ? '|--&nbsp;' : '';
		$cat_list .= '<option value="' . $row[$i]['cat_id'] . '"' . $s . '>' . $inc . $row[$i]['cat_title'] . '</option>\n';
	}

	return $cat_list;
}
#
#-----[ FIND ]------------------------------------------------
#
				$prune_enabled = '';
			}

			$catlist = get_list('category', $cat_id, TRUE);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				$prune_enabled = '';
			}

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$catlist = get_list('category', $cat_id, TRUE);
//-- add v 1.0.9
			$catlist = admin_get_list('category', $cat_id, TRUE);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$cat_main  = $row['cat_main'];
			if ($cat_main <= 0) $cat_main = $cat_id;

			$catlist = get_list('category', $cat_main, TRUE);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
			$cat_main  = $row['cat_main'];
			if ($cat_main <= 0) $cat_main = 0;
//-- add v 1.0.9
			$catlist = admin_get_list('category', $cat_main, TRUE, true);
#
#-----[ FIND ]------------------------------------------------
#
				$select_to .= get_list('category', $cat_id, 0);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//				$select_to .= get_list('category', $cat_id, 0);
//-- add v 1.0.9
				$select_to .= admin_get_list('category', $cat_id, 0);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- add v 1.0.7
admin_renum_cat();
$sql = "SELECT * 
	FROM " . CATEGORIES_TABLE . "
	ORDER BY cat_order";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

if( !$q_categories = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
}

if( $total_categories = $db->sql_numrows($q_categories) )
{
	$category_rows = $db->sql_fetchrowset($q_categories);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- delete v 1.0.9
// if( !$q_categories = $db->sql_query($sql) )
// {
//	message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
// }
// if( $total_categories = $db->sql_numrows($q_categories) )
// {
//	$category_rows = $db->sql_fetchrowset($q_categories);
//-- add v 1.0.7
admin_renum_cat();
//-- add v 1.0.9
// get cat list
$category_rows = array();
admin_get_cat_list(0, $category_rows);
// get max inc
$max_inc = 0;
for ($i=0; $i < count($category_rows); $i++)
{
	if ( $max_inc < $category_rows[$i]['level'] ) $max_inc = $category_rows[$i]['level'];
}
$template->assign_vars(array(
	'INC_SPAN' => ($max_inc+7),
	)
);

// display cats and forums
if( $total_categories = count($category_rows) )
{
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'CLASS_CATRIGHT'  => $class_catRight,
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- add v 1.0.9
			'INC_SPAN' => $max_inc - $category_rows[$i]['level']+3,
			'INC_SPAN_ALL' => $max_inc - $category_rows[$i]['level']+7,
#
#-----[ FIND ]------------------------------------------------
#
			'U_VIEWCAT' => append_sid($phpbb_root_path."index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
		);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
		for ($k=0; $k < $category_rows[$i]['level']; $k++) $template->assign_block_vars("catrow.inc", array());
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					'NUM_POSTS' => $forum_rows[$j]['forum_posts'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
					'INC_SPAN' => $max_inc - $category_rows[$i]['level']+1,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&amp;" . POST_FORUM_URL . "=$forum_id"))
				);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
				for ($k=0; $k < $category_rows[$i]['level']; $k++) $template->assign_block_vars("catrow.forumrow.inc", array());
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_ug_auth.php
#
#-----[ FIND ]------------------------------------------------
#
require('./pagestart.' . $phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
include_once( $phpbb_root_path . 'includes/functions.' . $phpEx );
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	//
	// Front end
	//
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$sql = "SELECT * 
//			FROM " . FORUMS_TABLE . " f
//			ORDER BY forum_order";
//-- add v 1.0.7
	$sql = "SELECT f.*, c.cat_title, c.cat_main 
			FROM " . FORUMS_TABLE . " f, " .CATEGORIES_TABLE." as c 
			WHERE f.cat_id = c.cat_id 
			ORDER BY c.cat_order, f.forum_order";
#
#-----[ REPLACE WITH ]-----------------------------------------
#
	//
	// Front end
	//
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$sql = "SELECT * 
//			FROM " . FORUMS_TABLE . " f
//			ORDER BY forum_order";
//-- add v 1.0.9
	// lire les id catgories
	$catids = array();
	$sql = "select * from " . CATEGORIES_TABLE;
	if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, "Couldn't obtain cats information", "", __LINE__, __FILE__, $sql);
	while( $row = $db->sql_fetchrow($result) ) $catids[] = $row['cat_id'];

	// lire les catgories tries et avec le level
	$catrows = array();
	get_auth_cat_order( $catrows, $catids );

	// crer la table par cl
	$categories = array();
	$inc_max = 0;
	for ($i=0; $i < count($catrows); $i++)
	{
		$categories[ $catrows[$i]['cat_id'] ] = $catrows[$i];
		if ( $catrows[$i]['level'] > $inc_max ) $inc_max = $catrows[$i]['level'];
	}
//-- add v 1.0.7
	$sql = "SELECT f.*, c.cat_title, c.cat_main 
			FROM " . FORUMS_TABLE . " f, " .CATEGORIES_TABLE." as c 
			WHERE f.cat_id = c.cat_id 
			ORDER BY c.cat_order, f.forum_order";
#
#-----[ FIND ]------------------------------------------------
#
//-- add v 1.0.7
	$last_cat = -1;
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- add v 1.0.9
	$s_column_span = 3 + $inc_max +1; // Two columns always present
	if( $adv ) $s_column_span = $s_column_span + count($forum_auth_fields)-1;
#
#-----[ FIND ]------------------------------------------------
#
			$class_cat = "catLeft";
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
			// calculer l'incrment
			$inc_col = $categories[$forum_access[$i]['cat_id']]['level'];
#
#-----[ FIND ]------------------------------------------------
#
				'CAT_TITLE' => $forum_access[$i]['cat_title'],
				)
			);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				'CAT_TITLE' => $forum_access[$i]['cat_title'],
//-- add v 1.0.9
				'INC_SPAN' => $s_column_span - $inc_col,
				)
			);
			for ($k=1; $k <= $inc_col; $k++) $template->assign_block_vars('categorie.inc', array());
#
#-----[ FIND ]------------------------------------------------
#
		$template->assign_block_vars('categorie.forums', array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
			'INC_SPAN' => $inc_max - $inc_col +1,
#
#-----[ FIND ]------------------------------------------------
#
			'S_MOD_SELECT' => $optionlist_mod)
		);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
		// get inc
		$inc_col = $categories[$forum_access[$i]['cat_id']]['level'];
		for ($k=0; $k <= $inc_col; $k++) $template->assign_block_vars('categorie.forums.inc', array());
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		'S_COLUMN_SPAN' => $s_column_span,
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		'S_COLUMN_SPAN' => $s_column_span,
//-- add v 1.0.9
		'INC_SPAN' => $inc_max+2,
		'S_COLUMN_SPAN' => $s_column_span + $inc_max+1,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------------
#
//-- add
// constitue l'arbre de navigation ascendante d'une catgorie
function make_cat_nav_tree($cat_id, $with_link)
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- add v 1.0.9
$nav_separator = "&nbsp;->&nbsp;";
$nav_link_active = true;

// get the depth level
function get_max_depth($cat_id)
{
	global $db;
	if ($cat_id < 0) $cat_id = 0;
	$local_depth = 0;
	$sql = "select * from " . CATEGORIES_TABLE . " where cat_main = $cat_id";
	if( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query categorie parm', '', __LINE__, __FILE__, $sql);
	while ( $row = $db->sql_fetchrow($result) )
	{
		$branch_depth = get_max_depth( $row['cat_id'] );
		if ( $cat_id > 0 ) $branch_depth++;
		if ( $branch_depth > $local_depth ) $local_depth = $branch_depth;
	}
	return $local_depth;
}

// build the cat list sorted
function get_auth_cat_order(&$cat_row, &$cat_list, $cat_main=0, $level=0)
{
	global $db;

	// read daughter cats
	$sql = "select * from " . CATEGORIES_TABLE . " where cat_main = $cat_main order by cat_order, cat_id";
	if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't access list of Categories", "", __LINE__, __FILE__, $sql);
	while ( $row = $db->sql_fetchrow($result) ) $rowlevel[] = $row;
	// push and get the sub- daughter cat
	for ($i = 0; $i < count($rowlevel); $i++ )
	{
		if ( in_array( $rowlevel[$i]['cat_id'], $cat_list ) )
		{
			$rowlevel[$i]['level'] = $level;
			$cat_row[] = $rowlevel[$i];
			get_auth_cat_order( $cat_row, $cat_list, $rowlevel[$i]['cat_id'], ($level+1) );
		}
	}
}

// build the auth cat list
function get_auth_cat()
{
	global $db, $userdata;

	// get the cat id of all auth forums
	$catlist = array();
	$sql = "select * from " . FORUMS_TABLE;
	if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, "Couldn't obtain forum list.", "", __LINE__, __FILE__, $sql);
	while ( $row = $db->sql_fetchrow($result) )
	{
		$is_auth = array();
		$is_auth = auth(AUTH_ALL, $row['forum_id'], $userdata);
		if ( $is_auth['auth_view'] ) $catlist[] = $row['cat_id'];
	}

	// get the mother cat
	$t_cat = $catlist;
	while ( count($t_cat) > 0 )
	{
		$s_cat = implode( ', ', $t_cat );
		$t_cat = array();
		$sql = "select * from " . CATEGORIES_TABLE . " where cat_id in ($s_cat)";
		if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql);
		while ( $row = $db->sql_fetchrow($result) )
		{
			if ( !in_array($row['cat_main'], $catlist) )
			{
				$catlist[] = $row['cat_main'];
				$t_cat[] =  $row['cat_main'];
			}
		}
	}

	// read cat sorted
	$catrows = array();
	get_auth_cat_order( $catrows, $catlist );

	return $catrows;
}
#
#-----[ FIND ]------------------------------------------------
#
	$this_cat = "";
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
	global $nav_separator, $nav_link_active;

	if ($nav_link_active) $with_link = true;
#
#-----[ FIND ]------------------------------------------------
#
				$this_cat = make_cat_nav_tree($cat_main, true) . " > ".$this_cat;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
				$this_cat = make_cat_nav_tree($cat_main, true) . $nav_separator . $this_cat;
#
#-----[ FIND ]------------------------------------------------
#
		while ( $category_rows[] = $db->sql_fetchrow($result) );
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		while ( $row = $db->sql_fetchrow($result) ) $category_rows[] = $row;
#
#-----[ FIND ]------------------------------------------------
#
	$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
		FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
		WHERE f.cat_id = c.cat_id
		GROUP BY c.cat_id, c.cat_title, c.cat_order
		ORDER BY c.cat_order";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql);
	}
	
	$category_rows = array();
	while ( $row = $db->sql_fetchrow($result) )
	{
		$category_rows[] = $row;
	}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//	$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
//		FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
//		WHERE f.cat_id = c.cat_id
//		GROUP BY c.cat_id, c.cat_title, c.cat_order
//		ORDER BY c.cat_order";
//	if ( !($result = $db->sql_query($sql)) )
//	{
//		message_die(GENERAL_ERROR, "Couldn't obtain category list.", "", __LINE__, __FILE__, $sql);
//	}
//	
//	$category_rows = array();
//	while ( $row = $db->sql_fetchrow($result) )
//	{
//		$category_rows[] = $row;
//	}
//-- add v 1.0.9
	$category_rows = array();
	$category_rows = get_auth_cat();
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				$boxstring_forums = '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
				$inc = '';
				for ($k = 1; $k < $category_rows[$i]['level']; $k++) $inc = '|&nbsp;&nbsp;&nbsp;' . $inc;
				$inc = ( ($category_rows[$i]['level'] > 0) ? '|&nbsp;&nbsp;&nbsp;' : '|--' ) . $inc;
				$inc .= ($category_rows[$i]['level'] > 0) ? '|--' : '';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
					{
#
#-----[ REPLACE WITH ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete v 1.0.9
//					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )
//					{
//-- add v 1.0.9
					$do_it = false;
					if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] )
					{
						$is_auth = array();
						$is_auth = auth(AUTH_ALL, $forum_rows[$j]['forum_id'], $userdata);
						$do_it = $is_auth['auth_view'];
					}
					if ( $do_it )
					{
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
						$boxstring_forums .=  '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . $forum_rows[$j]['forum_name'] . '</option>';
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//						$boxstring_forums .=  '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . $forum_rows[$j]['forum_name'] . '</option>';
//-- add v 1.0.9
						$boxstring_forums .=  '<option value="' . $forum_rows[$j]['forum_id'] . '"' . $selected . '>' . '|&nbsp;&nbsp;&nbsp;' . $inc . '&nbsp;' . $forum_rows[$j]['forum_name'] . '</option>';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				if ( $boxstring_forums != '' )
				{
					$boxstring .= '<option value="-1">&nbsp;</option>';
					$boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>';
					$boxstring .= '<option value="-1">----------------</option>';
					$boxstring .= $boxstring_forums;
				}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete v 1.0.9
//				if ( $boxstring_forums != '' )
//				{
//					$boxstring .= '<option value="-1">&nbsp;</option>';
//					$boxstring .= '<option value="-1">' . $category_rows[$i]['cat_title'] . '</option>';
//					$boxstring .= '<option value="-1">----------------</option>';
//					$boxstring .= $boxstring_forums;
//				}
//-- add v 1.0.9
				if ( $i == 0 )
				{
					$boxstring .= '<option value="-1">&nbsp;</option>';
					$boxstring .= '<option value="-1">' . $lang['Forum_index'] . '</option>';
				}
				$boxstring .= '<option value="-1">' . $inc . '[' . $category_rows[$i]['cat_title'] . ']</option>';
				$boxstring .= $boxstring_forums;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_admin.php
#
#-----[ FIND ]------------------------------------------------
#
/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 ***************************************************************************/
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
include_once( $phpbb_root_path . 'includes/functions.' . $phpEx );
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//--delete
// function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
//-- add v 1.0.9
function make_forum_select($box_name, $ignore_forum = false, $select_forum = '', $for_prune=false)
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//	$sql = "SELECT forum_id, forum_name
//		FROM " . FORUMS_TABLE . " 
//		ORDER BY cat_id, forum_order";
//-- add v 1.0.7
	$sql = "SELECT f.forum_id, f.forum_name, c.cat_title 
		FROM " . FORUMS_TABLE . " as f, " . CATEGORIES_TABLE . " as c 
		WHERE c.cat_id = f.cat_id 
		ORDER BY cat_order, forum_order";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_list = '';
	while( $row = $db->sql_fetchrow($result) )
	{
		if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
		{
			$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';
//-- add v 1.0.7
			$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['cat_title'] . ": " . $row['forum_name'] . '</option>';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

		}
	}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
	global $phpEx, $lang;

	$category_rows = array();
	$category_rows = get_auth_cat();

	// add Index
	$forum_list .= '<option value="' . ( ($for_prune) ? 'C0' : -1 ) . '">[' . $lang['Forum_index'] . ']</option>';

	// read cats
	for ( $i = 0; $i < count($category_rows); $i++ )
	{
		// increment
		$inc = '';
		for ($k = 1; $k < $category_rows[$i]['level']; $k++) $inc = '|&nbsp;&nbsp;&nbsp;' . $inc;
		$inc = ( ($category_rows[$i]['level'] > 0) ? '|&nbsp;&nbsp;&nbsp;' : '|--' ) . $inc;
		$inc .= ($category_rows[$i]['level'] > 0) ? '|--' : '';

		// add cat
		$forum_list .= '<option value="' . ( ($for_prune) ? 'C' . $category_rows[$i]['cat_id'] : -1 ) . '">' . $inc . '[' . $category_rows[$i]['cat_title'] . ']' . '</option>';

		$sql = "select * from " . FORUMS_TABLE . " where cat_id = " . $category_rows[$i]['cat_id'];
		if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
		while( $row = $db->sql_fetchrow($result) )
		{
			if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
			{
				$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
				$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . '|&nbsp;&nbsp;&nbsp;' . $inc . '&nbsp;' . $row['forum_name'] . '</option>';
			}
		}
	}

//-- delete
//	$sql = "SELECT forum_id, forum_name
//		FROM " . FORUMS_TABLE . " 
//		ORDER BY cat_id, forum_order";
//	if ( !($result = $db->sql_query($sql)) )
//	{
//		message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
//	}
//
//	$forum_list = '';
//	while( $row = $db->sql_fetchrow($result) )
//	{
//		if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
//		{
//			$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
//			$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';
//		}
//	}
//
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------------
#
$sub_forum = (isset($board_config['sub_forum'])) ? intval($board_config['sub_forum']) : true;
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- add v 1.0.9
$template->assign_vars(array(
	'NAV_SEPARATOR' => $nav_separator,
	)
);

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
	<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie v 1.0.9 : colspan 2->INC_SPAN -->
	<th colspan="{INC_SPAN}" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>
#
#-----[ FIND ]------------------------------------------------
#
   <td class="{catrow.CLASS_CATLEFT}" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td> 
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie v 1.0.9 : colspan 2->INC_SPAN -->
	<!-- BEGIN inc -->
	<td class="{catrow.inc.INC_ROW}" width="46">&nbsp;</td>
	<!-- END inc -->
   <td class="{catrow.CLASS_CATLEFT}" colspan="{catrow.INC_SPAN}" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td> 
#
#-----[ FIND ]------------------------------------------------
#
  <!-- BEGIN forumrow -->
  <tr> 
	<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
	<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
  <!-- BEGIN forumrow -->
  <tr> 
<!-- add v 1.0.9 -->
    <!-- BEGIN inc -->
	<td class="{catrow.forumrow.inc.INC_ROW}">&nbsp;</td>
    <!-- END inc -->
	<td class="{catrow.forumrow.INC_ROW}" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<!-- add v 1.0.9 : colspan -->
	<td class="row1" width="100%" height="50" colspan="{catrow.forumrow.INC_SPAN}"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/modcp_split.tpl
#
#-----[ FIND ]------------------------------------------------
#
	<tr> 
	  <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>
	</tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
<!-- delete v 1.0.9 -->
  <!-- tr>
	  <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>
  </tr -->
<!-- add v 1.0.9 -->
  <tr> 
	<td align="left">
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}{NAV_SEPARATOR}<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>
	</td>
  </tr>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------------
#
td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom {
			background-image: url(templates/subSilver/images/{T_TH_CLASS1});
			background-color:{T_TR_COLOR3}; border: {T_TH_COLOR3}; border-style: solid; height: 28px;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
/* mod : hirarchie des rubriques */
td.catRupt {
         background-color:#BCCED7;
         background-image: url(templates/subSilver/images/cellpic4.gif);
}
/* fin mod : hirarchie des rubriques */

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
			{NAV_CAT_DESC}&nbsp;>
			<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- add v 1.0.9 : nav_separator -->
			{NAV_CAT_DESC}{NAV_SEPARATOR}<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------------
#
$images['category'] = "$current_template_images/cat_folder_big.gif";
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- add v 1.0.9
$images['category_locked'] = "$current_template_images/cat_folder_locked_big.gif";

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.css
#
#-----[ FIND ]------------------------------------------------
#
/* mod : hirarchie des rubriques */
td.catRupt {
			background-color:#BCCED7; height: 28px;
}
/* fin mod : hirarchie des rubriques */
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
/*-- mod : hirarchie des rubriques */
td.catRupt {
         background-color:#BCCED7;
         background-image: url(images/cellpic4.gif);
}
/*-- fin mod : hirarchie des rubriques */

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>
			{NAV_CAT_DESC}&nbsp;>
		</span>
		<span class="nav">{FORUM_NAME}</span>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}{NAV_SEPARATOR}<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>
#
#-----[ FIND ]------------------------------------------------
#
		<span class="nav">
			&nbsp;&nbsp;&nbsp;
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>
			{NAV_CAT_DESC}&nbsp;>
		</span>
		<span class="nav">{FORUM_NAME}</span>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}{NAV_SEPARATOR}<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
  <tr>
	<td align="left" valign="bottom">
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}&nbsp;>
			<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
  <tr>
	<td align="left" valign="bottom">
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}{NAV_SEPARATOR}
			<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>
#
#-----[ FIND ]------------------------------------------------
#
	<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="left" valign="bottom">
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}&nbsp;>
			<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	<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="left" valign="bottom">
		<span class="nav">
			<a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}{NAV_SEPARATOR}
			<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
		</span>

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/auth_ug_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
	  <th width="30%" class="thCornerL">{L_FORUM}</th>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
<!-- add v 1.0.9 : colspan={INC_SPAN} -->
	  <th width="30%" class="thCornerL" colspan="{INC_SPAN}">{L_FORUM}</th>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
	  <td colspan="20" class="{categorie.CLASS_CAT}" align="left" nowrap> <span class="cattitlemed">{categorie.CAT_TITLE}</span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
<!-- v 1.0.9 : colspan=20 -> colspan=INC_SPAN -->
	  <td colspan="{categorie.INC_SPAN}" class="{categorie.CLASS_CAT}" align="left" nowrap> <span class="cattitlemed">{categorie.CAT_TITLE}</span></td>
#
#-----[ FIND ]------------------------------------------------
#
	  <td class="row1" align="left"> <span class="gentbl">{categorie.forums.FORUM_NAME}</span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"></td>
		<!-- END inc -->
<!-- add v 1.0.9 : colspan={INC_SPAN} -->
	  <td class="row1" align="left" colspan="{categorie.forums.INC_SPAN}"><span class="gentbl">{categorie.forums.FORUM_NAME}</span></td>

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/forum_admin_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
		<th class="thHead" colspan="7">{L_FORUM_TITLE}</th>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
<!-- v 1.0.9 : colspan= 7 -> colspan={INC_SPAN} -->
		<th class="thHead" colspan="{INC_SPAN}">{L_FORUM_TITLE}</th>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
		<td class="{catrow.CLASS_CATLEFT}"   colspan="3"><span class="cattitle"><b><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></b></span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
<!-- v 1.0.9 : colspan=3 -> colspan={catrow.INC_SPAN} -->
		<td class="{catrow.CLASS_CATLEFT}"   colspan="{catrow.INC_SPAN}"><span class="cattitle"><b><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></b></span></td>
#
#-----[ FIND ]------------------------------------------------
#
		<td class="{catrow.CLASS_CATMIDDLE}" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="{catrow.U_CAT_MOVE_UP}" class="gen">{L_MOVE_UP}</a> <a href="{catrow.U_CAT_MOVE_DOWN}">{L_MOVE_DOWN}</a></span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- v 1.0.9 : rajout class="gen" sur link movedown -->
		<td class="{catrow.CLASS_CATMIDDLE}" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="{catrow.U_CAT_MOVE_UP}" class="gen">{L_MOVE_UP}</a> <a href="{catrow.U_CAT_MOVE_DOWN}" class="gen">{L_MOVE_DOWN}</a></span></td>
#
#-----[ FIND ]------------------------------------------------
#
		<td class="row3" colspan="7"><span class="gensmall">{catrow.CAT_DESCRIPTION}</span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"></td>
		<!-- END inc -->
<!-- v 1.0.9 : colspan=3 -> colspan={catrow.INC_SPAN_ALL} -->
		<td class="row3" colspan="{catrow.INC_SPAN_ALL}"><span class="gensmall">{catrow.CAT_DESCRIPTION}</span></td>
#
#-----[ FIND ]------------------------------------------------
#
		<td class="row2"><span class="gen"><a href="{catrow.forumrow.U_VIEWFORUM}" target="_new">{catrow.forumrow.FORUM_NAME}</a></span><br /><span class="gensmall">{catrow.forumrow.FORUM_DESC}</span></td>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
	
<!-- v 1.0.9 : add colspan={catrow.forumrow.INC_SPAN} -->
		<td class="row2" colspan="{catrow.forumrow.INC_SPAN}"><span class="gen"><a href="{catrow.forumrow.U_VIEWFORUM}" target="_new">{catrow.forumrow.FORUM_NAME}</a></span><br /><span class="gensmall">{catrow.forumrow.FORUM_DESC}</span></td>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
	<tr>
		<td colspan="7" class="row2"><input class="post" type="text" name="{catrow.S_ADD_FORUM_NAME}" /> <input type="submit" class="liteoption"  name="{catrow.S_ADD_FORUM_SUBMIT}" value="{L_CREATE_FORUM}" /></td>
	</tr>
	<tr>
		<td colspan="7" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END catrow -->
	<tr>
		<td colspan="7" class="catBottom"><input class="post" type="text" name="categoryname" /> <input type="submit" class="liteoption"  name="addcategory" value="{L_CREATE_CATEGORY}" /></td>
	</tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
	<tr>
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
<!-- v 1.0.9 : colspan=7 -> colspan={catrow.INC_SPAN_ALL} -->
		<td colspan="{catrow.INC_SPAN_ALL}" class="row2"><input class="post" type="text" name="{catrow.S_ADD_FORUM_NAME}" /> <input type="submit" class="liteoption"  name="{catrow.S_ADD_FORUM_SUBMIT}" value="{L_CREATE_FORUM}" /></td>
	</tr>
	<tr>
<!-- add v1.0.9 -->
		<!-- BEGIN inc -->
		<td class="row2"></td>
		<!-- END inc -->
<!-- v 1.0.9 : colspan=7 -> colspan={catrow.INC_SPAN_ALL} -->
		<td colspan="{catrow.INC_SPAN_ALL}" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
	<!-- END catrow -->
	<tr>
<!-- v 1.0.9 : colspan= 7 -> colspan={INC_SPAN} -->
		<td colspan="{INC_SPAN}" class="catBottom"><input class="post" type="text" name="categoryname" /> <input type="submit" class="liteoption"  name="addcategory" value="{L_CREATE_CATEGORY}" /></td>
	</tr>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/page_header.tpl
#
#-----[ FIND ]------------------------------------------------
#
td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom {
			background-image: url(../templates/subSilver/images/{T_TH_CLASS1});
			background-color:{T_TR_COLOR3}; border: {T_TH_COLOR3}; border-style: solid; height: 28px;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
/*-- mod : hirarchie des rubriques */
td.catRupt {
         background-color:#BCCED7;
         background-image: url(../templates/subSilver/images/cellpic4.gif);
}
/*-- fin mod : hirarchie des rubriques */

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM