Seite 1 von 2

UPItoDB funzt nicht mit hierachie mod

Verfasst: 23.07.2003 09:35
von joba
MOD Name: Unread Post Information to Database (UPItoDB)

ich möchte diesen mod installieren aber bekomme ihn nicht an den hierachie mod angepasst den ich schon drauf habe

kann jemand helfen bitte ?

thx

Verfasst: 23.07.2003 11:50
von Candy
Was für probs hatteste denn genau?

Grüße Candy

Verfasst: 23.07.2003 13:50
von andreasOymann
Gleiches Prob hatte ich auch,
habe die Änderungen in der index.php nicht geschafft, weil da sehr viel Code durch den hierarchy-MOD geändert wurde.

Hier mal meine index.php:

Code: Alles auswählen

<?php
//-- mod : hiérarchie des rubriques ----------------------------------------------------------------

/***************************************************************************
 *				index.php
 *			    -------------------
 *   begin		: Saturday, Feb 13, 2001
 *   copyright	    : (C) 2001 The phpBB Group
 *   email		: support@phpbb.com
 *
 *   $Id: index.php,v 1.99.2.1 2002/12/19 17:17:40 psotfx Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//-- mod : hiérarchie 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 défaut
				$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&" . 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 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++)
		
		// 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++)		
		
		
		
		
	} //  if ($catrow['cat_display'])
} // end function display_index_cat($catrow, $sub_forum, $main)
//-- fin mod : hiérarchie des rubriques ------------------------------------------------------------

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if( $userdata['session_logged_in'] ) 
{ 
$sql = "SELECT COUNT(post_id) as total 
FROM " . POSTS_TABLE . " 
WHERE post_time >= " . $userdata['user_lastvisit']; 
$result = $db->sql_query($sql); 
if( $result ) 
{ 
$row = $db->sql_fetchrow($result); 
$lang['Search_new'] = $lang['Search_new'] . " (" . $row['total'] . ")"; 
}
}

$viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1;

if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) )
{
	$mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark'];
}
else
{
	$mark_read = '';
}

//
// Handle marking posts
//
if( $mark_read == 'forums' )
{

//-- mod : hiérarchie des rubriques ----------------------------------------------------------------
//-- add v 1.0.9
	if ( $viewcat < 0 )
	{
//-- fin mod : hiérarchie des rubriques ------------------------------------------------------------

	if( $userdata['session_logged_in'] )
	{
		setcookie($board_config['cookie_name'] . '_f_all', time(), 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") . '">')
	);

//-- mod : hiérarchie 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 : hiérarchie des rubriques -----------------------------------------------------------

	$message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');

	message_die(GENERAL_MESSAGE, $message);
}
//
// End handle marking posts
//

$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();

//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];

if( $total_posts == 0 )
{
	$l_total_post_s = $lang['Posted_articles_zero_total'];
}
else if( $total_posts == 1 )
{
	$l_total_post_s = $lang['Posted_article_total'];
}
else
{
	$l_total_post_s = $lang['Posted_articles_total'];
}

if( $total_users == 0 )
{
	$l_total_user_s = $lang['Registered_users_zero_total'];
}
else if( $total_users == 1 )
{
	$l_total_user_s = $lang['Registered_user_total'];
}
else
{
	$l_total_user_s = $lang['Registered_users_total'];
}


//
// Start page proper
//

//-- mod : hiérarchie 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 : hiérarchie des rubriques ------------------------------------------------------------

if( ( $total_categories = count($category_rows) ) )
{
	//
	// Define appropriate SQL
	//
	switch(SQL_LAYER)
	{
		case 'postgresql':
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
				WHERE p.post_id = f.forum_last_post_id 
					AND u.user_id = p.poster_id  
					UNION (
						SELECT f.*, NULL, NULL, NULL, NULL
						FROM " . FORUMS_TABLE . " f
						WHERE NOT EXISTS (
							SELECT p.post_time
							FROM " . POSTS_TABLE . " p
							WHERE p.post_id = f.forum_last_post_id  
						)
					)
					ORDER BY cat_id, forum_order";
			break;

		case 'oracle':
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 
				FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
				WHERE p.post_id = f.forum_last_post_id(+)
					AND u.user_id = p.poster_id(+)
				ORDER BY f.cat_id, f.forum_order";
			break;

		default:
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
				FROM (( " . FORUMS_TABLE . " f
				LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
				LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
				ORDER BY f.cat_id, f.forum_order";
			break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_data[] = $row;
	}

	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}

	//
	// Obtain a list of topic ids which contain
	// posts made since user last visited
	//
	if ( $userdata['session_logged_in'] )
	{
		$sql = "SELECT t.forum_id, t.topic_id, p.post_time 
			FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p 
			WHERE p.post_id = t.topic_last_post_id 
				AND p.post_time > " . $userdata['user_lastvisit'] . " 
				AND t.topic_moved_id = 0"; 
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
		}

		$new_topic_data = array();
		while( $topic_data = $db->sql_fetchrow($result) )
		{
			$new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
		}
	}

	//
	// Obtain list of moderators of each forum
	// First users, then groups ... broken into two queries
	//
	$sql = "SELECT aa.forum_id, u.user_id, u.username 
		FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u
		WHERE aa.auth_mod = " . TRUE . " 
			AND g.group_single_user = 1 
			AND ug.group_id = aa.group_id 
			AND g.group_id = aa.group_id 
			AND u.user_id = ug.user_id 
		GROUP BY u.user_id, u.username, aa.forum_id 
		ORDER BY aa.forum_id, u.user_id";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
	}

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

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

	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
	}

	//
	// Find which forums are visible for this user
	//
	$is_auth_ary = array();
	$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

	//
	// Start output of page
	//
	define('SHOW_ONLINE', true);
	$page_title = $lang['Index'];
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);
	

	$template->set_filenames(array(
		'body' => 'index_body.tpl')
	);

//-- mod : hiérarchie des rubriques ----------------------------------------------------------------
//-- add
	if ($nav_cat_desc != "") $nav_cat_desc = $nav_separator . $nav_cat_desc;
	$mark = ($viewcat == -1 ) ? '' : '&' . POST_CAT_URL . '=' . $viewcat;
//-- fin mod : hiérarchie des rubriques ------------------------------------------------------------

	// ChatBox Mod
	require_once($phpbb_root_path . 'chatbox_front.php');


	$template->assign_vars(array(
		'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
		'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
		'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), 

		'FORUM_IMG' => $images['forum'],
		'FORUM_NEW_IMG' => $images['forum_new'],
		'FORUM_LOCKED_IMG' => $images['forum_locked'],

		'L_FORUM' => $lang['Forum'],
		'L_TOPICS' => $lang['Topics'],
		'L_REPLIES' => $lang['Replies'],
		'L_VIEWS' => $lang['Views'],
		'L_POSTS' => $lang['Posts'],
		'L_LASTPOST' => $lang['Last_Post'], 
		'L_NO_NEW_POSTS' => $lang['No_new_posts'],
		'L_NEW_POSTS' => $lang['New_posts'],
		'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], 
		'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], 
		'L_ONLINE_EXPLAIN' => $lang['Online_explain'], 

		'L_MODERATOR' => $lang['Moderators'], 
		'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
		'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
		'L_SEND_PASSWORD' => $lang['Forgotten_password'], 
		'U_SEND_PASSWORD' => append_sid("profile.$phpEx?mode=sendpassword"),
 
		// ChatBox Mod
		'TOTAL_CHATTERS_ONLINE' => sprintf($lang['How_Many_Chatters'], $howmanychat),
		'CHATTERS_LIST' => sprintf($lang['Who_Are_Chatting' ], $chatters),
		'L_CLICK_TO_JOIN_CHAT' => $lang['Click_to_join_chat'],
		'S_JOIN_CHAT' => append_sid("chatbox_mod/chatbox.$phpEx"),
		'CHATBOX_NAME' => $userdata['user_id'] . '_ChatBox', // To make easier to test on my PC
		'L_LOGIN_TO_JOIN_CHAT' => $lang['Login_to_join_chat'],		

//-- mod : hiérarchie 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 : hiérarchie des rubriques ------------------------------------------------------------

	);

//-- mod : hiérarchie des rubriques ----------------------------------------------------------------
//-- add
	$template->assign_vars(array(
		'NAV_CAT_DESC' => $nav_cat_desc)
	);
//-- fin mod : hiérarchie des rubriques ------------------------------------------------------------

	//
	// Okay, let's build the index
	//

//-- mod : hiérarchie des rubriques ----------------------------------------------------------------
//-- delete : most of the original code has been reported in the functions enhance_cat() & display_index_cat()
/*
//	for($i = 0; $i < $total_categories; $i++)
//	{
//		$cat_id = $category_rows[$i]['cat_id'];
//
//		//
//		// Should we display this category/forum set?
//		//
//		$display_forums = false;
//		for($j = 0; $j < $total_forums; $j++)
//		{
//			if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
//			{
//				$display_forums = true;
//			}
//		}
//
//		//
//		// Yes, we should, so first dump out the category
//		// title, then, if appropriate the forum list
//		//
//		if ( $display_forums )
//		{
//			$template->assign_block_vars('catrow', array(
//				'CAT_ID' => $cat_id,
//				'CAT_DESC' => $category_rows[$i]['cat_title'],
//				'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
//			);
//
//			if ( $viewcat == $cat_id || $viewcat == -1 )
//			{
//				for($j = 0; $j < $total_forums; $j++)
//				{
//					if ( $forum_data[$j]['cat_id'] == $cat_id )
//					{
//						$forum_id = $forum_data[$j]['forum_id'];
//
//						if ( $is_auth_ary[$forum_id]['auth_view'] )
//						{
//							if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
//							{
//								$folder_image = $images['forum_locked']; 
//								$folder_alt = $lang['Forum_locked'];
//							}
//							else
//							{
//								$unread_topics = false;
//								if ( $userdata['session_logged_in'] )
//								{
//									if ( !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);
//												}
//											}
//										}
//
//										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;
//											}
//										}
//
//									}
//								}
//
//								$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; 
//								$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; 
//							}
//
//							$posts = $forum_data[$j]['forum_posts'];
//							$topics = $forum_data[$j]['forum_topics'];
//
//							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&" . 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>';
//							}
//							else
//							{
//								$last_post = $lang['No_Posts'];
//							}
//
//							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]);
//							}
//							else
//							{
//								$l_moderators = '&nbsp;';
//								$moderator_list = '&nbsp;';
//							}
//
//							$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
//							$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
//
//							$template->assign_block_vars('catrow.forumrow',	array(
//								'ROW_COLOR' => '#' . $row_color,
//								'ROW_CLASS' => $row_class,
//								'FORUM_FOLDER_IMG' => $folder_image, 
//								'FORUM_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' => $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"))
//							);
//						}
//					}
//				}
//			}
//		}
//	} // for ... categories
*/
//-- add v 1.0.9
	// récupérer 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 : hiérarchie des rubriques ------------------------------------------------------------

}// if ... total_categories
else
{
	message_die(GENERAL_MESSAGE, $lang['No_forums']);
}

//
// Generate the page
//
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>

Verfasst: 23.07.2003 21:07
von joba
und haste aufgegeben oder bist du noch am ball ?

Verfasst: 23.07.2003 21:20
von andreasOymann
habe aufgegeben, dazu reichen meine php-Kenntnisse nicht :cry:

Vielleicht kann ja mal einer von den Profis drübergucken...

A.

Verfasst: 24.07.2003 21:50
von joba
schieb!!!!!!!

könnte mal jemand von den cracks dieses forums sich unserem problem witmen ?

bidde bidde bidde :grin:

ganz lieb frag :lol:

Verfasst: 25.07.2003 09:50
von Acid
..benutzt ihr alle denselben Hierarchie Hack? Welchen ?

Es könnte ja mal jemand die zu modifizierenden Dateien bereitstellen.. vielleicht findet sich jemand, der helfen kann. :roll:

Verfasst: 25.07.2003 12:22
von joba
ich benutze diesen hierachie mod:

Mod Title: Hierarchies
## Mod Version: 0.9.48

Verfasst: 27.07.2003 20:04
von andreasOymann
Bei den zu modifizierenden Dateien geht es in erster Linie um die oben gepostete index.php. Der Rest macht eigentlich keine Probleme.


A.

Verfasst: 29.07.2003 21:19
von joba
hat den hier nicht noch jemand unterforen und diesen mod schon installd ????

glaub ja nich das wir da allein auf weiter flur sind :wink:

hilfe !!!!! :o