############################################################## 
## MOD Title: categories hierarchie
## MOD Author: Ptirhiik - RPGNET-Fr < admin@rpgnet-fr.com > (P.Roge) http://www.RPGnet-fr.com 
## MOD Description: 
##		-----------------------------------------------------------------------------
##		allow 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
##		-----------------------------------------------------------------------------
##		v 1.1.0 : - fix a display error in admin/admin_ug_auth.php when no forums are in cat
##		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
##		v 1.0.8 : - fix an issue when moving categories
##		v 1.0.7 : - enhance the Admin. Panel Config for the forums management,
##			  - check and fix sub-categories tree in case of recursive attachment,
##			  - more friendly user and admin auth display (sort by cat/forum),
##			  - add category name and sort in the pull-down lists of forums,
##			  - add the nav sentence above the modcp display list,
##			  - group part 3 with part 1 in the installation txt
##		v 1.0.6 : fix in the enhanced_cat() func on in the global var sentence
##		v 1.0.5 : - minor modifications to the code,
##			  - add a category description for the subforums display,
##			  - how-to rewrite to stick the 2.0.4 version of phpBB
##		v 1.0.2 : add the display choice to the general board config in admin panel
##		v 1.0.1 : add the subforum view
##		-----------------------------------------------------------------------------
## 
## MOD Version: 1.1.0
## 
## Installation Level: (moderate) 
## Installation Time: 1 H 15
## Files To Edit: 
##		index.php
##		modcp.php
##		posting.php
##		viewforum.php
##		viewtopic.php
##
##		admin/admin_board.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
##
##		language/lang_english/lang_admin.php
##
##		templates/subSilver/index_body.tpl
##		templates/subSilver/modcp_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/board_config_body.tpl
##		templates/subSilver/admin/category_edit_body.tpl
##		templates/subSilver/admin/forum_admin_body.tpl
##		templates/subSilver/admin/page_header.tpl
##
## Included Files:
##		cat_folder_big.gif
##		cat_folder_new_big.gif
##		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 : how does it work ?
##
##
##
## o You have a forum tree like this :
## ----------------------------------
## Index
## - Cat 1
## --- Forum 1.1
## --- Forum 1.2
## --- Sub-Cat 1.1
## ----- Forum 1.1.1
## ----- Forum 1.1.2
## - Cat 2
## --- Forum 2.1
## --- Forum 2.2
##
## o displaying the index (no category selected) :
## ----------------------------------------------
## ---------------------
## vBulletin view
## ---------------------
## Index
## - Cat 1
## --- Forum 1.1
## --- Forum 1.2
## --- Sub-Cat 1.1
## ----- Forum 1.1.1
## ----- Forum 1.1.2
## - Cat 2
## --- Forum 2.1
## --- Forum 2.2
## ---------------------
## sub-forum view
## ---------------------
## Index
## - Cat 1
## --- Forum 1.1
## --- Forum 1.2
## --- Sub-Cat 1.1
## - Cat 2
## --- Forum 2.1
## --- Forum 2.2
## 
## o Choosing one categorie, ie Cat 1, you'll get on your index this :
## ------------------------------------------------------------------
## ---------------------
## vBulletin view
## ---------------------
## Index > Cat 1
## - Cat 1
## --- Forum 1.1
## --- Forum 1.2
## --- Sub-Cat 1.1
## ----- Forum 1.1.1
## ----- Forum 1.1.2
## ---------------------
## sub-forum view
## ---------------------
## Index > Cat 1
## - Cat 1
## --- Forum 1.1
## --- Forum 1.2
## --- Sub-Cat 1.1
## 
## o Or a sub-categorie (not limited in depth), ie Sub-Cat 1 :
## ----------------------------------------------------------
## ---------------------
## vBulletin view
## ---------------------
## Index > Cat 1 > Sub-Cat 1.1
## - Sub-Cat 1.1
## --- Forum 1.1.1
## --- Forum 1.1.2
## ---------------------
## sub-forum view
## ---------------------
## Index > Cat 1 > Sub-Cat 1.1
## - Sub-Cat 1.1
## --- Forum 1.1.1
## --- Forum 1.1.2
## 
## o Then getting in a forum, ie Forum 1.1.2, you'll get this :
## -----------------------------------------------------------
## Index > Cat 1 > Sub-Cat 1.1 > Forum 1.1.2
## - post 1
## - post 2
## etc.
## 
## 
## 
## 
## ____________________________________________________________
## 
##			Setting the board
## ____________________________________________________________
## 
## To choose the way you want to display your board : 
## -------------------------------------------------
##	- go to Admin Configuration Panel/General Admin/Configuration
##	- set "Display sub-categories as forums" :
##		sub-forum view : Yes
##		vBulletin view : No ("flat" view)
## 
## To attach a category to another category :
## -----------------------------------------
##	- go to Admin Configuration Panel/Forum Admin/Management,
##	- create it, 
##	- edit it, 
##	- on the edit category screen, choose the mother cat by setting "Attached to category"
## 
##############################################################
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
#
#-----[ COPY ]---------------------------------------
#
COPY cat_folder_big.gif to templates/subSilver/images/cat_folder_big.gif
COPY cat_folder_new_big.gif to templates/subSilver/images/cat_folder_new_big.gif
COPY cat_folder_locked_big.gif TO templates/subSilver/images/cat_folder_locked_big.gif
COPY cellpic4.gif TO templates/subSilver/images/cellpic4.gif
#
#-----[ SQL ]----------------------------------------
# 
SQL QUERY: 
ALTER TABLE phpbb_categories ADD cat_main MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_categories ADD cat_desc TEXT NOT NULL;

#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v1.0.1
//
// enhance categories informations : description, last post, numbers of posts/topics, and so
function enhance_cat($cat_id)
{
//-- fix v 1.0.6
	global $HTTP_COOKIE_VARS, $category_rows, $forum_data, $is_auth_ary, $tracking_forums, $tracking_topics, $new_topic_data, $images, $lang, $board_config, $userdata, $phpEx;
//--

	if ($cat_id < 0) $cat_id=0;

	// default values
	$ind = -1;
	//-- v 1.0.5
	$categories_desc = ''; // all the sub-cat titles
	$forums_desc = ''; // all the sub-forum titles
	//--
	$cat_display = false;
	$cat_locked = true;
	$cat_unread_topics = false;
	$cat_posts = 0;
	$cat_topics = 0;
	$cat_post_time = 0;
	$cat_last_post = '';

	// look up for sub-categories
	for ($i=0; $i < count($category_rows); $i++)
	{
		// let's fix the cat_main : attached to  index : lvl 0
		if ($category_rows[$i]['cat_main']==$category_rows[$i]['cat_id']) $category_rows[$i]['cat_main'] = 0;

		// get the tab index for $cat_id
		if ( ($cat_id > 0) && ($category_rows[$i]['cat_id']==$cat_id) ) $ind = $i;

		// identify category which are daughters of the one running
		if ( $category_rows[$i]['cat_main']==$cat_id && $category_rows[$i]['cat_id']>0 )
		{
			// enhance sub-categories
			enhance_cat($category_rows[$i]['cat_id']);

			// get the result
			//-- v 1.0.5
			$categories_desc .= empty($categories_desc) ? '':', ';
			$categories_desc .= $category_rows[$i]['cat_title'];
			//--
			if ( $category_rows[$i]['cat_display'] ) $cat_display = true;
			if ( !($category_rows[$i]['cat_locked']) ) $cat_locked = false;
			if ( $category_rows[$i]['unread_topics'] ) $cat_unread_topics = true;
			$cat_posts = $cat_posts + $category_rows[$i]['posts'];
			$cat_topics = $cat_topics + $category_rows[$i]['topics'];
			if ( $cat_post_time < $category_rows[$i]['post_time']) 
			{
				$cat_post_time = $category_rows[$i]['post_time'];
				$cat_last_post = $category_rows[$i]['last_post'];
			}
		} //  if ($category_rows[$i]['cat_main']==$cat_id) || ( ($cat_id==0) && ($category_rows[$i]['cat_main']==$category_rows[$i]['cat_id']) )
	} // for ($i=0; $i < count($category_rows); $i++)

	// deal with the forums of the category
	if ($ind > -1)
	{
		// Raz
		$category_rows[$ind]['cat_display'] = false;
		$category_rows[$ind]['cat_locked'] = true;
		$category_rows[$ind]['unread_topics'] = false;
		$category_rows[$ind]['posts'] = 0;
		$category_rows[$ind]['topics'] = 0;
		$category_rows[$ind]['post_time'] = 0;
		$category_rows[$ind]['last_post'] = '';

		// look up for the forums of the category
		for ($j=0;$j<count($forum_data);$j++)
		{
			if ($forum_data[$j]['cat_id'] == $cat_id)
			{
				$forum_id = $forum_data[$j]['forum_id'];

				// valeur par dfaut
				$display_forum = false;
				$unread_topics = false;
				$last_post = "";

				// forum visible ?
				if ( $display_forum = $is_auth_ary[$forum_id]['auth_view'] )
				{
					if ($forum_data[$j]['forum_status'] != FORUM_LOCKED)
					{
						if ( $userdata['session_logged_in'] && !empty($new_topic_data[$forum_id]) )
						{
							$forum_last_post_time = 0;
							while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
							{
								if ( empty($tracking_topics[$check_topic_id]) )
								{
									$unread_topics = true;
									$forum_last_post_time = max($check_post_time, $forum_last_post_time);
								}
								else
								{
									if ( $tracking_topics[$check_topic_id] < $check_post_time )
									{
										$unread_topics = true;
										$forum_last_post_time = max($check_post_time, $forum_last_post_time);
									}
								}
							} //  end while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
							if ( !empty($tracking_forums[$forum_id]) )
							{
								if ( $tracking_forums[$forum_id] > $forum_last_post_time )
								{
									$unread_topics = false;
								}
							}
							if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
							{
								if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time )
								{
									$unread_topics = false;
								}
							}
						} //  if ( $userdata['session_logged_in'] && !empty($new_topic_data[$forum_id]) )
					} //  if ($forum_data[$j]['forum_status'] != FORUM_LOCKED)

					$posts = $forum_data[$j]['forum_posts'];
					$topics = $forum_data[$j]['forum_topics'];

					$last_post = $lang['No_Posts'];
					if ( $forum_data[$j]['forum_last_post_id'] )
					{
						$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
						$last_post = $last_post_time . '<br />';
						$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
						$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
					}

				} //  if ($display_forums = $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'])

				// enhanced forum row
				$forum_data[$j]['display_forum'] = $display_forum;
				$forum_data[$j]['unread_topics'] = $unread_topics;
				$forum_data[$j]['last_post'] = $last_post;

				// ok : add forum informations to the category
				if ($forum_data[$j]['display_forum'])
				{
					//-- v 1.0.5
					$forums_desc .= empty($forums_desc) ? '':', ';
					$forums_desc .= $forum_data[$j]['forum_name'];
					//--
					$category_rows[$ind]['cat_display'] = true;
					if ( $forum_data[$j]['forum_status'] != FORUM_LOCKED ) $category_rows[$ind]['cat_locked'] = false;
					if ( $forum_data[$j]['unread_topics'] ) $category_rows[$ind]['unread_topics'] = true;
					$category_rows[$ind]['posts'] = $category_rows[$ind]['posts'] + $forum_data[$j]['forum_posts'];
					$category_rows[$ind]['topics'] = $category_rows[$ind]['topics'] + $forum_data[$j]['forum_topics'];
					if ( $forum_data[$j]['post_time'] > $category_rows[$ind]['post_time']) 
					{
						$category_rows[$ind]['post_time'] = $forum_data[$j]['post_time'];
						$category_rows[$ind]['last_post'] = $forum_data[$j]['last_post'];
					}
				} //  if ($display_forum)
			} // if ($forum_data['cat_id'] == $cat_id)
		} // for ($j=0;$j<count($forum_data);$j++)

		// all is done for the forums : add the sub-categories informations
		//-- v 1.0.5
		if ( empty($category_rows[$ind]['cat_desc']) )
		{
			$category_rows[$ind]['cat_desc']  = $forums_desc;
			$category_rows[$ind]['cat_desc'] .= ( empty($forums_desc) || empty($categories_desc) ) ? '': ', ';
			$category_rows[$ind]['cat_desc'] .= $categories_desc;
		}
		//--
		if ( $cat_display ) $category_rows[$ind]['cat_display'] = true;
		if ( !$cat_locked ) $category_rows[$ind]['cat_locked'] = false;
		if ( $cat_unread_topics ) $category_rows[$ind]['unread_topics'] = true;
		$category_rows[$ind]['posts'] = $category_rows[$ind]['posts'] + $cat_posts;
		$category_rows[$ind]['topics'] = $category_rows[$ind]['topics'] + $cat_topics;
		if ( $cat_post_time > $category_rows[$ind]['post_time']) 
		{
			$category_rows[$ind]['post_time'] = $cat_post_time;
			$category_rows[$ind]['last_post'] = $cat_last_post;
		}
	} // if ($ind > -1)
} // function enhance_cat_forum

function display_index_cat($catrow, $sub_forum, $main, $cur_depth = 0)
{
	global $total_categories, $category_rows, $total_forums, $forum_data, $forum_moderators, $images, $lang, $template, $phpEx;
	global $max_depth;
	if ( $sub_forum ) $cur_depth = 0;

	$cat_id = $catrow['cat_id'];
	if ($catrow['cat_display'])
	{
		// display cat title
		$class_catLeft = "catLeft";
		$class_rowpic  = "rowpic";
		if (!$sub_forum && $main)
		{
			$class_catLeft = "catRupt";
			$class_rowpic  = "catRupt";
		}
		$template->assign_block_vars('catrow', array(
			'INC_SPAN'		=> $max_depth-$cur_depth + 2,
			'CLASS_CATLEFT' => $class_catLeft,
			'CLASS_ROWPIC'  => $class_rowpic,
			'CAT_ID'        => $cat_id,
			'CAT_DESC'      => $catrow['cat_title'],
			'U_VIEWCAT'     => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
		);
		$color = true;
		$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;
		}

		// display forums
		for($j = 0; $j < $total_forums; $j++)
		{
			if ( ($forum_data[$j]['cat_id']==$cat_id) && $forum_data[$j]['display_forum'] )
			{
				$forum_id = $forum_data[$j]['forum_id'];
				$folder_image = ( $forum_data[$j]['unread_topics'] ) ? $images['forum_new'] : $images['forum']; 
				$folder_alt   = ( $forum_data[$j]['unread_topics'] ) ? $lang['New_posts'] : $lang['No_new_posts']; 
				if ($forum_data[$j]['forum_status'] == FORUM_LOCKED )
				{
					$folder_image = $images['forum_locked']; 
					$folder_alt = $lang['Forum_locked'];
				}
				$l_moderators = '&nbsp;';
				$moderator_list = '&nbsp;';
				if ( count($forum_moderators[$forum_id]) > 0 )
				{
					$l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
					$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" ),
					'ROW_COLOR' => '#' . $row_color,
					'ROW_CLASS' => $row_class,
					'FORUM_FOLDER_IMG' => $folder_image, 
					'FORUM_NAME' => $forum_data[$j]['forum_name'],
					'FORUM_DESC' => $forum_data[$j]['forum_desc'],
					'POSTS' => $forum_data[$j]['forum_posts'],
					'TOPICS' => $forum_data[$j]['forum_topics'],
					'LAST_POST' => $forum_data[$j]['last_post'],
					'MODERATORS' => $moderator_list,
					'L_MODERATOR' => $l_moderators, 
					'L_FORUM_FOLDER_ALT' => $folder_alt, 
					'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
				);
				$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;
				}
			} //  if ( ($forum_data[$j]['cat_id']==$cat_id) && $forum_data[$j]['display_forum'] )
		} //  for($j = 0; $j < $total_forums; $j++)

		// display sub-cat title 
		for ($j=0; $j < $total_categories; $j++)
		{
			if (($category_rows[$j]['cat_main']==$cat_id) && ($category_rows[$j]['cat_display']))
			{
				if (!$sub_forum)
				{
					display_index_cat($category_rows[$j], $sub_forum, false, $cur_depth+1);
				}
				if ($sub_forum)
				{
					$subcat_id = $category_rows[$j]['cat_id'];
					$folder_image = ( $category_rows[$j]['unread_topics'] ) ? $images['category_new'] : $images['category']; 
					$folder_alt   = ( $category_rows[$j]['unread_topics'] ) ? $lang['New_posts'] : $lang['No_new_posts']; 
					if ($category_rows[$j]['cat_locked'] )
					{
						$folder_image = $images['category_locked']; 
						$folder_alt = $lang['Forum_locked'];
					}
					$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(
						'INC_ROW'   => "row1",
						'ROW_COLOR' => '#' . $row_color,
						'ROW_CLASS' => $row_class,
						'FORUM_FOLDER_IMG' => $folder_image, 
						'FORUM_NAME' => $category_rows[$j]['cat_title'],
						'FORUM_DESC' => $category_rows[$j]['cat_desc'],
						'POSTS' => $category_rows[$j]['posts'],
						'TOPICS' => $category_rows[$j]['topics'],
						'LAST_POST' => $category_rows[$j]['last_post'],
						'MODERATORS' => "",
						'L_MODERATOR' => "", 
						'L_FORUM_FOLDER_ALT' => $folder_alt, 
						'U_VIEWFORUM' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$subcat_id"))
					);
				} //  if ($sub_forum)
			} //  if ($category_rows[$j]['cat_main']==$cat_id)
		} // for ($j=0; $j < $total_categories; $j++)
	} //  if ($catrow['cat_display'])
} // end function display_index_cat($catrow, $sub_forum, $main)
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
	$template->assign_vars(array(
		"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'] )
		{
			// get the list of the involved cats
			$catrows = array();
			$catrows = get_cat($viewcat);

			// build the string list
			$catids = array();
			for ( $i=0; $i < count($catrows); $i++) $catids[] = $catrows[$i]['cat_id'];
			$s_cat = implode(', ', $catids);

			// get the list of the involved 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;

			// mark each forums
			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 ]------------------------------------------------
#
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
	FROM " . CATEGORIES_TABLE . " c 
	ORDER BY c.cat_order";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}

while( $category_rows[] = $db->sql_fetchrow($result) );
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
// $sql = "SELECT c.cat_id, c.cat_title, c.cat_order
// 	FROM " . CATEGORIES_TABLE . " c 
// 	ORDER BY c.cat_order";
// if( !($result = $db->sql_query($sql)) )
// {
// 	message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
// }
// 
// while( $category_rows[] = $db->sql_fetchrow($result) );
//-- add
//
// get the nav sentence
$nav_cat_desc = make_cat_nav_tree($viewcat, false);
//
// categories array
$category_rows = get_cat($viewcat);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$template->set_filenames(array(
		'body' => 'index_body.tpl')
	);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
	if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
	$mark = ($viewcat == -1 ) ? '' : '&' . POST_CAT_URL . '=' . $viewcat;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
	//
	// Okay, let's build the index
	//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
	$template->assign_vars(array(
		'NAV_CAT_DESC' => $nav_cat_desc)
	);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
##************************************************************************************
##					NOTE :
##					------
## /!\ Important : I strongly recommand to mute all the lines between the nexts 
##     ---------  			/* and */ 
##		by adding // in front of each lines or by deleting all.
##
## ie: //  for($i = 0; $i < $total_categories; $i++)
##
##************************************************************************************
	//
	// Okay, let's build the index
	//
#
#-----[ AFTER, ADD ]------------------------------------------ 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete : most of the original code has been reported in the functions enhance_cat() & display_index_cat()
/*
# 
#-----[ FIND ]------------------------------------------ 
#
	} // for ... categories
#
#-----[ AFTER, ADD ]------------------------------------------ 
#
*/
//-- add v 1.0.9
	// rcuprer la profondeur max
	$max_depth = ( !$sub_forum ) ? get_max_depth($viewcat) : 0;
	$template->assign_vars(array(
		'INC_SPAN' => $max_depth + 2)
	);
//-- add v1.0.1
	//
	// enhance cat & forum informations
	enhance_cat($viewcat);

	// display the index
	$found=false;
	for ($i=0; ($i < $total_categories) && !$found; $i++)
	{
		if ( ($viewcat==-1 && $category_rows[$i]['cat_main']==0) || ($viewcat > 0 && $category_rows[$i]['cat_id']==$viewcat) )
		{
			display_index_cat($category_rows[$i], $sub_forum, true);
			$found = ($viewcat > 0);
		}
	} //  end for ($i=0; ($i < $total_categories) && !$found; $i++)
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
modcp.php
#
#-----[ FIND ]------------------------------------------------
#
	$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics
		FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
		WHERE t.topic_id = " . $topic_id . "
			AND f.forum_id = t.forum_id";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//	$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics
//		FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
//		WHERE t.topic_id = " . $topic_id . "
//			AND f.forum_id = t.forum_id";
//-- add v 1.0.7
	$sql = "SELECT f.forum_id, f.forum_name, f.forum_topics, f.cat_id, t.topic_title 
		FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f 
		WHERE t.topic_id = " . $topic_id . "
			AND f.forum_id = t.forum_id";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_id = $topic_row['forum_id'];
	$forum_name = $topic_row['forum_name'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
	$cat_id = $topic_row['cat_id'];
	$topic_title = $topic_row['topic_title'];
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$sql = "SELECT forum_name, forum_topics
		FROM " . FORUMS_TABLE . "
		WHERE forum_id = " . $forum_id;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//	$sql = "SELECT forum_name, forum_topics
//		FROM " . FORUMS_TABLE . "
//		WHERE forum_id = " . $forum_id;
//-- add v 1.0.7
	$sql = "SELECT forum_name, forum_topics, cat_id 
		FROM " . FORUMS_TABLE . "
		WHERE forum_id = " . $forum_id;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$forum_topics = ( $topic_row['forum_topics'] == 0 ) ? 1 : $topic_row['forum_topics'];
	$forum_name = $topic_row['forum_name'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
	$cat_id = $topic_row['cat_id'];
	$topic_title = '';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Start session management
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- 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>';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			if ( $new_forum_id != $old_forum_id )
#
#-----[ BEFORE, 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 ]------------------------------------------------
#
			$template->set_filenames(array(
				'movetopic' => 'modcp_move.tpl')
			);

			$template->assign_vars(array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
				'NAV_CAT_DESC' => $nav_cat_desc,
//-- 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 ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
					'L_SPLIT_TOPIC' => $lang['Split_Topic'],
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
					'NAV_CAT_DESC' => $nav_cat_desc,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		include($phpbb_root_path . 'includes/page_header.'.$phpEx);

		$template->assign_vars(array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
			'NAV_CAT_DESC' => $nav_cat_desc,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
//
// category name
$nav_cat_desc = "";
$cat_id = "";
if ($forum_id)
{
	$sqlw = "SELECT f.cat_id, c.cat_title FROM " . FORUMS_TABLE . " as f, ". CATEGORIES_TABLE ." as c WHERE f.forum_id=$forum_id and f.cat_id=c.cat_id";
	if ( !($resultw = $db->sql_query($sqlw)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sqlw);
	}
	if ( !($catrow = $db->sql_fetchrow($resultw)) )
	{
		message_die(GENERAL_ERROR, 'Catgorie inexistante', '', __LINE__, __FILE__, $sqlw);
	}
	$cat_id   = $catrow['cat_id'];
	//
	// get the nav sentence
	$nav_cat_desc = make_cat_nav_tree($cat_id, true);
	if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
}
//
// topic title
$topic_title = "";
if ($topic_id)
{
	$sqlw = "SELECT * FROM ".TOPICS_TABLE. " WHERE topic_id=$topic_id";
	if ( !($resultw = $db->sql_query($sqlw)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sqlw);
	}
	if ( !($topicrowW = $db->sql_fetchrow($resultw)) )
	{
		message_die(GENERAL_ERROR, 'Topic inexistant', '', __LINE__, __FILE__, $sqlw);
	}
	$topic_title = $topicrowW['topic_title'];
}
if ($topic_title != "")
{
	$topic_title = '<a href="viewtopic.'.$phpEx.'?t='.$topic_id.'" class="maintitle">'.$topic_title.'</a>';
}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// This enables the forum/topic title to be output for posting
// but not for privmsg (where it makes no sense)
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
$template->assign_vars(array(
	'NAV_CAT_DESC' => $nav_cat_desc,
	'U_VIEW_CAT' => append_sid("index.$phpEx?c=$cat_id"),
	'TOPIC_TITLE' => $topic_title
	)
);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------------
#
	$sql = "SELECT *
		FROM " . FORUMS_TABLE . "
		WHERE forum_id = $forum_id";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//	$sql = "SELECT *
//		FROM " . FORUMS_TABLE . "
//		WHERE forum_id = $forum_id";
//-- add
	$sql = "SELECT *, c.cat_title 
		FROM " . FORUMS_TABLE . " as f, ". CATEGORIES_TABLE ." as c 
		WHERE f.forum_id = $forum_id and f.cat_id = c.cat_id";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Start session management
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
//  get cat info
$cat_id = $forum_row['cat_id'];
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
// get nav sentence
$nav_cat_desc = make_cat_nav_tree($cat_id, true);
if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// End header
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
$template->assign_vars(array(
	'NAV_CAT_DESC' => $nav_cat_desc
	)
);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		$order_sql";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
// $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
//	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . " 
//	WHERE $join_sql
//		AND f.forum_id = t.forum_id
//		$order_sql";
//-- add
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.cat_id, c.cat_title" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f," . CATEGORIES_TABLE . " c" . $join_sql_table . " 
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		AND c.cat_id = f.cat_id
		$order_sql";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// End auth check
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
$cat_id   = $forum_topic_data['cat_id'];
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// If we've got a hightlight set pass it on to pagination,
// I get annoyed when I lose my highlight after the first page.
//
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
// get the nav sentence
$nav_cat_desc = make_cat_nav_tree($cat_id, true);
if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	'FORUM_ID' => $forum_id,
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
	'NAV_CAT_DESC' => $nav_cat_desc,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------------
#
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v1.0.2
$sub_forum_yes = ( $new['sub_forum'] ) ? "checked=\"checked\"" : "";
$sub_forum_no = ( !$new['sub_forum'] ) ? "checked=\"checked\"" : "";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	"S_CONFIG_ACTION" => append_sid("admin_board.$phpEx"),
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v1.0.2
	"SUB_FORUM_YES" => $sub_forum_yes,
	"SUB_FORUM_NO" => $sub_forum_no,
	"L_SUB_FORUM" => $lang['Use_sub_forum'],
//-- add v1.0.7
	"L_HIERARCHY_SETTINGS" => $lang['Hierarchy_setting'],
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ 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 ]------------------------------------------------
#
		$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 : 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 ]------------------------------------------------
#
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++)
	{
		$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
	}
	$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 ]------------------------------------------------
#
// ------------------
// Begin function block
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
//
// check and fix parm
function admin_check_cat()
{
	global $db;

	$res = false;
	// build the cat list
	$sql = "select * from " . CATEGORIES_TABLE . " order by cat_id";
	if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't access list of Categories", "", __LINE__, __FILE__, $sql);
	$last_cat = -1;
	while ( $row = $db->sql_fetchrow($result) ) 
	{
		// corriger la valeur de cat_main
		if ( $row['cat_main'] == $row['cat_id'] ) $row['cat_main'] = 0;
		// alimenter le tableau de hierarchie
		$cat_main[ $row['cat_id'] ] = $row['cat_main'];
		// rcuprer l'indice de catgorie le plus grand
		if ( $row['cat_id'] > $last_cat ) $last_cat = $row['cat_id'];
	}  // end while ( $row = $db->sql_fetchrow($result) )
	//
	// push each cat
	for ($i=0; $i <= $last_cat; $i++) if ( isset($cat_main[$i]) )
	{
		$root = false;
		$cur_cat = $i;
		$stack = array();
		$stack[0] = $cur_cat;
		while ( !$root )
		{
			$err = false;
			// la catgorie parente n'existe pas
			$err = ( ($cat_main[$cur_cat] != 0 ) && !isset($cat_main[ $cat_main[$cur_cat] ]) );
			// la catgorie parente est dj dans la pile (erreur dans le paramtrage)
			for ( $j = 0; ( !$err && ($j < count($stack)) ); $j++ ) $err = ( $cat_main[$cur_cat] == $stack[$j] );
			// corriger la catgorie parente en cas d'erreur
			if ( $err ) $cat_main[$cur_cat] = 0;
			// empiler la valeur du parent
			$stack[] = $cat_main[$cur_cat];
			// remonter d'un niveau
			$root = ($cat_main[$cur_cat] == 0);
			$cur_cat = $cat_main[$cur_cat];
			// signaler qu'il y avait une erreur de paramtrage qui a t corrige
			if ( $err ) $res = true;
		}  // while ( !$root )
		// mettre  niveau la bdd
		$sql = "update " . CATEGORIES_TABLE . " set cat_main = " . $cat_main[$i] . " where cat_id = $i";
		if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't update list of Categories", "", __LINE__, __FILE__, $sql);
	}  // end for ($i=0; $i <= $last_cat_id; $i++) if ( isset($cat_main[$i]) )
	return $res;
}  // end
//
// get daughter cat per level
function admin_get_cat_list($cat_main, &$cat_row, $level=0, $cat_except=-1)
{
	global $db;

	// lire les catgories filles
	$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;
	// empiler ces catgories filles et chercher leurs petites-filles
	for ($i = 0; $i < count($rowlevel); $i++ )
	{
		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 );
		}
	}
}
//
// renumber
function admin_renum_cat()
{
	global $db;

	// fix the param
	$err = admin_check_cat();
	// lire les catgories " plat"
	$cat_row = array();
	admin_get_cat_list(0, $cat_row);
	// renum
	for ($i=0; $i < count($cat_row); $i++) 
	{
		// get the order number
		$cat_row[$i]['cat_order'] = ($i+1)*10;
		// update db
		$sql = "update " . CATEGORIES_TABLE . " set cat_order = " . $cat_row[$i]['cat_order'] . 
					" where cat_id = " . $cat_row[$i]['cat_id'];
		if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't update list of Categories", "", __LINE__, __FILE__, $sql);
	}
	return $err;
}
//-- add v 1.0.8
//
// move a cat
function admin_move_cat($cat_id, $inc)
{
	global $db;
	//
	// fix the param
	admin_renum_cat();
	//
	// read the cat
	$sql = "select * from " . CATEGORIES_TABLE . " where cat_id = $cat_id";
	if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't access list of Categories", "", __LINE__, __FILE__, $sql);
	if ( !$row = $db->sql_fetchrow($result) ) message_die(GENERAL_ERROR, "Couldn't access Categorie $cat_id", "", __LINE__, __FILE__, $sql);
	//
	// get cat main id and order
	$cat_main  = $row['cat_main'];
	$cat_order = $row['cat_order'];
	//
	// get the prec or next cat
	$sql  = "SELECT * FROM "  . CATEGORIES_TABLE . " WHERE cat_main = $cat_main AND ";
	$sql .= ( $inc < 0 ) ? "cat_order < $cat_order ORDER BY cat_order DESC" : "cat_order > $cat_order ORDER BY cat_order ASC";
	if ( !$result = $db->sql_query($sql) ) message_die(GENERAL_ERROR, "Couldn't access list of Categories on the same level", "", __LINE__, __FILE__, $sql);
	//
	// first or last of the main category
	if ( !$row = $db->sql_fetchrow($result) ) return false;
	//
	// get a new order
	$new_order = ( $inc < 0 ) ? $row['cat_order'] - 5 : $row['cat_order'] + 5;
	//
	// update db
	$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);
}
//-- 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;
}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$catlist = get_list('category', $cat_id, TRUE);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- 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_title = $row['cat_title'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
			//-- v 1.0.5
			$cat_desc  = $row['cat_desc'];
			//--
			$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);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
				'CAT_TITLE' => $cat_title,
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add
				//-- v 1.0.5
				'L_CAT_DESCRIPTION' => $lang['Category_desc'],
				'CAT_DESCRIPTION' => $cat_desc,
				//--
				'S_CAT_LIST' => $catlist,
				'L_CATEGORY_ATTACHMENT' => $lang['Category_attachment'],
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
				WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$sql = "UPDATE " . CATEGORIES_TABLE . "
//				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
//				WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
//-- add
			//-- v 1.0.5
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', cat_main = ".intval($HTTP_POST_VARS['cat_main']). ", cat_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_desc']) . "' ".
				" WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'deleteforum':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
			$err = admin_renum_cat();
			if ( $err ) $message = $lang['Category_config_error_fixed'] . "<br /><br />" . $message;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
					message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql);
				}
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
				$sql = "UPDATE " . CATEGORIES_TABLE . "
					SET cat_main = $to_id
					WHERE cat_main = $from_id";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't move sub-categories to other category", "", __LINE__, __FILE__, $sql);
				}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'forum_order':
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
			$err = admin_renum_cat();
			if ( $err ) $message = $lang['Category_config_error_fixed'] . "<br /><br />" . $message;
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_order = cat_order + $move
				WHERE cat_id = $cat_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
			}

			renumber_order('category');
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$sql = "UPDATE " . CATEGORIES_TABLE . "
//				SET cat_order = cat_order + $move
//				WHERE cat_id = $cat_id";
//			if( !$result = $db->sql_query($sql) )
//			{
//				message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
//			}
//
//			renumber_order('category');
//-- add v 1.0.8
			admin_move_cat($cat_id, $move);
//-- add v 1.0.7
			admin_renum_cat();
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT cat_id, cat_title, cat_order
	FROM " . CATEGORIES_TABLE . "
	ORDER BY cat_order";
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 ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
// $sql = "SELECT cat_id, cat_title, cat_order
//	FROM " . CATEGORIES_TABLE . "
//	ORDER BY cat_order";
//-- 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 cats array
$category_rows = array();
admin_get_cat_list(0, $category_rows);
// get max inc level
$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 ]------------------------------------------
#
		$cat_id = $category_rows[$i]['cat_id'];
#
#-- [ AFTER, ADD ]--------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
		$class_catLeft   = "catLeft";
		$class_catMiddle = "cat";
		$class_catRight  = "catRight";
		if ( ($category_rows[$i]['cat_main'] == $cat_id) || ($category_rows[$i]['cat_main'] == 0) )
		{
			$class_catLeft   = "catRupt";
			$class_catMiddle = "catRupt";
			$class_catRight  = "catRupt";
		}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'CAT_DESC' => $category_rows[$i]['cat_title'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.7
			'CAT_DESCRIPTION' => $category_rows[$i]['cat_desc'],
			'CLASS_CATLEFT'   => $class_catLeft,
			'CLASS_CATMIDDLE' => $class_catMiddle,
			'CLASS_CATRIGHT'  => $class_catRight,
//-- add v 1.0.9
			'INC_SPAN' => $max_inc - $category_rows[$i]['level']+3,
			'INC_SPAN_ALL' => $max_inc - $category_rows[$i]['level']+7,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
						$change_acl_list[$forum_id][$auth_field] = $value;
					}
				}
			}

			$sql = "SELECT * 
				FROM " . FORUMS_TABLE . " f
				ORDER BY forum_order";
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
						$change_acl_list[$forum_id][$auth_field] = $value;
					}
				}
			}

//-- 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";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	//
	// Front end
	//
	$sql = "SELECT * 
		FROM " . FORUMS_TABLE . " f
		ORDER BY 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
	// get cat ids
	$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'];

	// get cats array sorted, with level
	$catrows = array();
	get_auth_cat_order( $catrows, $catids );

	// create a keyed by cat_id array
	$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";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	$i = 0;
	@reset($auth_ug);
	while( list($forum_id, $user_ary) = @each($auth_ug) )
	{
#
#-----[ REPLACE WITH ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete : fix 1.1.0
//	$i = 0;
//	@reset($auth_ug);
//	while( list($forum_id, $user_ary) = @each($auth_ug) )
//	{
//-- 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;
//-- add : fix 1.1.0
	@reset($categories);
	while ( list($cat_id, $catrow) = each($categories) )
	{
		// get the inc level
		$inc_col = $catrow['level'];
		$class_cat = "catLeft";
		if ( $catrow['cat_main'] == 0 ) $class_cat = "catRupt";

		$template->assign_block_vars('categorie', array(
			'CLASS_CAT' => $class_cat,
			'CAT_TITLE' => $catrow['cat_title'],
			'INC_SPAN' => $s_column_span - $inc_col,
			)
		);
		for ($k=1; $k <= $inc_col; $k++) $template->assign_block_vars('categorie.inc', array());

		for ($i=0; $i < count($forum_access); $i++) if ($forum_access[$i]['cat_id'] == $cat_id)
		{
			$forum_id = $forum_access[$i]['forum_id'];
			$user_ary = $auth_ug[$forum_id];
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$template->assign_block_vars('forums', array(
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$template->assign_block_vars('forums', array(
//-- add v 1.0.9
		$template->assign_block_vars('categorie.forums', array(
			'INC_SPAN' => $inc_max - $inc_col +1,
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
			'S_MOD_SELECT' => $optionlist_mod)
		);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
		// get the inc level
		$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 ]------------------------------------------------
#
		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 ]---------------------------------------- 
#
		if( !$adv )
		{

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$template->assign_block_vars('forums.aclvalues', array(
//-- add
			$template->assign_block_vars('categorie.forums.aclvalues', array(
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

				'S_ACL_SELECT' => $optionlist_acl)
			);
		}
		else
		{
			for($j = 0; $j < count($forum_auth_fields); $j++)
			{

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//			$template->assign_block_vars('forums.aclvalues', array(
//-- add
			$template->assign_block_vars('categorie.forums.aclvalues', array(
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

					'S_ACL_SELECT' => $optionlist_acl_adv[$forum_id][$j])
				);
			}
		}

//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete : fix 1.1.0
//		$i++;
//-- add : fix 1.1.0
	}
//-- 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 ------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$sql = "SELECT group_id, group_name
			FROM " . GROUPS_TABLE . "
			WHERE group_single_user <> " . TRUE;
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- delete
//		$sql = "SELECT group_id, group_name
//			FROM " . GROUPS_TABLE . "
//			WHERE group_single_user <> " . TRUE;
//-- add v 1.0.7
		$sql = "SELECT group_id, group_name
			FROM " . GROUPS_TABLE . "
			WHERE group_single_user <> " . TRUE . "
			ORDER BY group_name";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.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
$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;
}
//-- add
// build the nav sentence
function make_cat_nav_tree($cat_id, $with_link)
{
	global $db,$phpEx;
	global $nav_separator, $nav_link_active;

	if ($nav_link_active) $with_link = true;

	$this_cat = "";
	if ($cat_id > 0)
	{
		$sql = "SELECT * FROM ".CATEGORIES_TABLE." WHERE cat_id=$cat_id";
		if( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query categorie parm '.$sql, '', __LINE__, __FILE__, $sql);
		if ( $catw = $db->sql_fetchrow($result) )
		{
			$cat_main  = $catw['cat_main'];
			$cat_title = $catw['cat_title'];
			$this_cat = ($with_link) ? '<a href="'.append_sid("index.$phpEx?c=$cat_id").'" class="nav">'.$cat_title.'</a>' : $cat_title;
			// vrifier si un parent
			if ($cat_main != $cat_id && $cat_main > 0)
			{
				$this_cat = make_cat_nav_tree($cat_main, true) . $nav_separator . $this_cat;
			}
		}
	}
	return $this_cat;
}

//
// build sub categories list
function get_sub_cat($cat_main, $catrow )
{
	global $db;

	if ($cat_main > 0)
	{
		// lire les rubriques dpendantes
		$sql= "SELECT * FROM ".CATEGORIES_TABLE." WHERE cat_id <> $cat_main AND cat_main=$cat_main";
		if( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query categorie sons '.$sql, '', __LINE__, __FILE__, $sql);
		while ( $catw = $db->sql_fetchrow($result) )
		{
			// ajouter la catgorie
			$i = count($catrow);
			$catrow[$i] = $catw;
			// aller chercher les sous-catgories
			if ($catw['cat_id'] > 0) $catrow = get_sub_cat($catw['cat_id'],$catrow);
		}
	}
	return $catrow;
}

// build sorted cats array
function get_cat($cat_id)
{
	global $db;

	// vrifier la catgorie
	if ($cat_id <= 0) $cat_id = -1;
	if ($cat_id > 0)
	{
		$sql = "SELECT * FROM " . CATEGORIES_TABLE . " WHERE cat_id=$cat_id";
		if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query this categories', '', __LINE__, __FILE__, $sql);
		if ( !($row = $db->sql_fetchrow($result)) ) $cat_id = -1;
	}
	//
	// no cat selected : get all
	if ($cat_id <= 0)
	{
		//-- v 1.0.5
		$sql = "SELECT * FROM " . CATEGORIES_TABLE . " ORDER BY cat_order";
		//-- 
		if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
		while ( $row = $db->sql_fetchrow($result) ) $category_rows[] = $row;
	}
	//
	// a cat selected : get it and its sub-cats
	if ($cat_id > 0)
	{
		// add the current one
		$catrow[] = $row;
		// get sub-cats
		$catrow = get_sub_cat($cat_id,$catrow);
		// get cats
		//-- v 1.0.5
		$sql = "SELECT * FROM " . CATEGORIES_TABLE . " ORDER BY cat_order";
		//--
		if( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
		while ($row = $db->sql_fetchrow($result) )
		{
			$found = false;
			for ($i=0;( $i<count($catrow) && (!$found) );$i++) $found = ($row['cat_id'] == $catrow[$i]['cat_id']);
			if ($found) $category_rows[] = $row;
		}
	}
	return $category_rows;
}
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------
#
#-----[ 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 ]------------------------------------------------
#
	$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>';
		}
	}
#
#-----[ 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>';

	// get 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 ]------------------------------------------------
#
$template->pparse('overall_header');
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v1.0.2
if (!isset($board_config['sub_forum']) )
{
	$sqlw = "insert into ".CONFIG_TABLE." (config_name,config_value) VALUES('sub_forum','1')";
	if ( !($resultw = $db->sql_query($sqlw)) ) message_die(GENERAL_ERROR, 'Could not add key sub_forum in config table', '', __LINE__, __FILE__, $sql);
}
$sub_forum = (isset($board_config['sub_forum'])) ? intval($board_config['sub_forum']) : true;
//-- add v 1.0.9
$template->assign_vars(array(
	'NAV_SEPARATOR' => $nav_separator,
	)
);
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.1
$lang['Category_attachment'] = 'Attached to Category';
//-- add v 1.0.2
$lang['Use_sub_forum'] = 'Display the sub-categories as forums';
//-- add v 1.0.5
$lang['Category_desc'] = 'Description';
//-- add v 1.0.7
$lang['Hierarchy_setting'] = 'Categories Hierarchy settings';
$lang['Category_config_error_fixed'] = 'An error in the category setup has been fixed';
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
	{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a>
#
#-- [IN-LINE AFTER, ADD]------------------------------------------
#
{NAV_CAT_DESC}
#
#-----[ 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 ]------------------------------------------------
#
  <!-- BEGIN catrow -->
  <tr> 
	<td class="catLeft" colspan="2" height="28"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
	<td class="rowpic" colspan="3" align="right">&nbsp;</td>
  </tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
  <!-- BEGIN catrow -->

<!-- mod : hirarchie des rubriques -->
  <tr> 
<!-- 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> 
	<td class="{catrow.CLASS_ROWPIC}" colspan="3" align="right">&nbsp;</td> 
  </tr>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
	<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 ]---------------------------------------- 
#
<!-- 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_body.tpl
#
#-----[ 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>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
	<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>{NAV_CAT_DESC}</span></td>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/modcp_split.tpl
#
#-----[ 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 ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
	<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>
<!-- 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 ]------------------------------------------------
#
		<td align="left"><span  class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
		<!-- BEGIN switch_not_privmsg --> 
		-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
		<!-- END switch_not_privmsg -->
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
		<td align="left" valign="bottom">
			<span class="nav">
				<a href="{U_INDEX}" class="nav">{L_INDEX}</a>
				<!-- BEGIN switch_not_privmsg -->
				{NAV_CAT_DESC}{NAV_SEPARATOR}<a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a>
				<br />
				<span class="maintitle">{TOPIC_TITLE}</span>
				<!-- END switch_not_privmsg -->
			</span>
		</td>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : hirarchie des rubriques ----------------------------------------------------------------
//-- add v1.0.1
$images['category_new'] = "$current_template_images/cat_folder_new_big.gif";
$images['category'] = "$current_template_images/cat_folder_big.gif";
//-- add v 1.0.9
$images['category_locked'] = "$current_template_images/cat_folder_locked_big.gif";
//-- fin mod : hirarchie des rubriques ------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/subSilver.css
#
#-----[ FIND ]------------------------------------------------
#
td.cat,td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom {
			background-image: url(images/cellpic1.gif);
			background-color:#D1D7DC; border: #FFFFFF; border-style: solid; height: 28px;
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
/*-- 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 ]------------------------------------------------
#
  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr> 
	  <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>
	<tr> 
	  <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
	  <td align="left" valign="middle" class="nav" 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>
	  <td align="right" valign="bottom" class="nav" nowrap="nowrap"><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
	</tr>
  </table>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
  <!-- affichage de la phrase d'index -->
  <table width="100%" cellspacing="2" cellpadding="2" border="0">
    <tr>
	  <td align="left" valign="middle" width="100%">
		<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>
  </table>
  <br />

  <!-- affichage "new" | mods + users | "mark read" and pagination -->
  <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr>
	  <td align="left" valign="middle" width="0%">
		<a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a>
	  </td>
	  <td align="left" valign="bottom" width="100%">
		<span class="gensmall">
			<b>{L_MODERATOR}: {MODERATORS}<br />
			{LOGGED_IN_USER_LIST}</b>
		</span>
	  </td>
	  <td align="right" valign="bottom" nowrap>
		<span class="gensmall">
			<a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a><br />
			<b>{PAGINATION}</b>
		</span>
	  </td>
	</tr>
  </table>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr> 
	  <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
	  <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>
	  <td align="right" valign="middle" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
		</td>
	</tr>
	<tr>
	  <td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
	</tr>
  </table>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr> 
	  <td align="left" valign="middle" width="50"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" /></a></td>
	  <td align="left" valign="middle" width="100%">
		<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>
	  <td align="right" valign="middle" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
	</tr>
	<tr>
	  <td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
	</tr>
  </table>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ 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 : hirarchie des rubriques -->
<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <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>
	</td>
  </tr>
  <tr>
	<td align="left" valign="bottom">
		<a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a>
	</td>
  </tr>
</table>

<!-- affichage "new", "reply" | pagination -->
<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr>
	<td align="left" valign="top" 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%">
		<span class="gensmall">
			<b>{PAGINATION}</b>
		</span>
      </td>
  </tr>
</table>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ FIND ]------------------------------------------------
#
  <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="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>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
	  </td>
  </tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
  <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="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>
	</td>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
  </tr>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ 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 ]------------------------------------------------
#
	<!-- BEGIN forums -->
	<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>
	</tr>
	<!-- END forums -->
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
<!-- mod : hirarchie des rubriques -->
<!-- replace v 1.0.7 -->
	<!-- BEGIN categorie -->
	<tr> 
<!-- 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>
	</tr>
	<!-- BEGIN forums -->
	<tr> 
<!-- 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>
	  <!-- BEGIN aclvalues -->
	  <td class="row2" align="center">{categorie.forums.aclvalues.S_ACL_SELECT}</td>
	  <!-- END aclvalues -->
	  <td class="row1" align="center">{categorie.forums.S_MOD_SELECT}</td>
	</tr>
	<!-- END forums -->
	<!-- END categorie -->
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
	<tr>
		<th class="thHead" colspan="2">{L_COOKIE_SETTINGS}</th>
	</tr>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : hirarchie des rubriques -->
<!-- add v1.0.7 -->
	<tr>
		<th class="thHead" colspan="2">{L_HIERARCHY_SETTINGS}</th>
	</tr>
<!-- add v1.0.2 -->
	<tr>
		<td class="row1">{L_SUB_FORUM}</td>
		<td class="row2"><input type="radio" name="sub_forum" value="1" {SUB_FORUM_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="sub_forum" value="0" {SUB_FORUM_NO} /> {L_NO}</td>
	</tr>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/admin/category_edit_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
	<tr> 
	  <td class="catBottom" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="submit" value="{S_SUBMIT_VALUE}" class="mainoption" /></td>
	</tr>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- mod : hirarchie des rubriques -->
<!-- v 1.0.5 -->
	<tr>
	  <td class="row1">{L_CAT_DESCRIPTION}</td>
	  <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="cat_desc" class="post">{CAT_DESCRIPTION}</textarea></td>
	</tr>
<!-- // -->
	<tr>
	  <td class="row1">{L_CATEGORY_ATTACHMENT}</td>
	  <td class="row2"><select name="cat_main">{S_CAT_LIST}</select></td>
	</tr>
<!-- fin mod : hirarchie des rubriques -->

#
#-----[ 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 ]------------------------------------------------
#
	<!-- BEGIN catrow -->
	<tr>
		<td class="catLeft" colspan="3"><span class="cattitle"><b><a href="{catrow.U_VIEWCAT}">{catrow.CAT_DESC}</a></b></span></td>
		<td class="cat" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_EDIT}">{L_EDIT}</a></span></td>
		<td class="cat" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_DELETE}">{L_DELETE}</a></span></td>
		<td class="cat" align="center" valign="middle" nowrap="nowrap"><span class="gen"><a href="{catrow.U_CAT_MOVE_UP}">{L_MOVE_UP}</a> <a href="{catrow.U_CAT_MOVE_DOWN}">{L_MOVE_DOWN}</a></span></td>
		<td class="catRight" align="center" valign="middle"><span class="gen">&nbsp</span></td>
	</tr>
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
	<!-- BEGIN catrow -->
<!-- mod : hirarchie des rubriques -->
	<tr>
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
		<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>
		<td class="{catrow.CLASS_CATMIDDLE}" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_EDIT}" class="gen">{L_EDIT}</a></span></td>
		<td class="{catrow.CLASS_CATMIDDLE}" align="center" valign="middle"><span class="gen"><a href="{catrow.U_CAT_DELETE}" class="gen">{L_DELETE}</a></span></td>
		<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>
		<td class="{catrow.CLASS_CATRIGHT}"  align="center" valign="middle"><span class="gen">&nbsp</span></td>
	</tr>
	<tr>
		<!-- BEGIN inc -->
		<td class="row2"></td>
		<!-- END inc -->
		<td class="row3" colspan="{catrow.INC_SPAN_ALL}"><span class="gensmall">{catrow.CAT_DESCRIPTION}</span></td>
	</tr>
<!-- fin mod : hirarchie des rubriques -->
#
#-----[ 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 -->
<!-- v 1.0.9 : add inc + colspan=7 -> colspan={catrow.INC_SPAN_ALL} -->
	<tr>
		<!-- BEGIN inc -->
		<td class="row2"><span class="gen">&nbsp;&nbsp;</span></td>
		<!-- END inc -->
		<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>
		<!-- BEGIN inc -->
		<td class="row2"></td>
		<!-- END inc -->
		<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>
		<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