Verfasst: 28.08.2003 22:05
				
				noch ne frage: funzt der mod? ich hatte einen anderen heruntergeladen und der spinnt einfach nur...
			phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_admin.php
# 
#-----[ FIND ]------------------------------------------ 
# 
			$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total 
				FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE  . " t 
				WHERE p.forum_id = $id 
					AND t.topic_id = p.topic_id 
					AND t.topic_status <> " . TOPIC_MOVED;
Code: Alles auswählen
$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total 
				FROM " . POSTS_TABLE . "  
				WHERE forum_id = $id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
			}
			if ( $row = $db->sql_fetchrow($result) )
usw usw usw usw ............
Code: Alles auswählen
#-----[ OPEN ]------------------------------------------ 
# 
includes/functions_admin.php
# 
#-----[ FIND ]------------------------------------------ 
# 
			$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total 
				FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE  . " t 
				WHERE p.forum_id = $id 
					AND t.topic_id = p.topic_id 
					AND t.topic_status <> " . TOPIC_MOVED;
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
			// DJ-Begin, 15.4.02
			// count not only the posts/topics of the forum itself but of all forums junior to this
			//
			
			$forum_ids = get_list_inferior('forum', $id, 'forum');
			
			if( empty($forum_ids) )
			{
				$forum_ids = $id;
			}
			
			$sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total 
				FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE  . " t 
				WHERE p.forum_id IN ($forum_ids)
					AND t.topic_id = p.topic_id 
					AND t.topic_status <> " . TOPIC_MOVED;
			// DJ-End, 15.4.02
# 
#-----[ FIND ]------------------------------------------ 
# 
			$sql = "SELECT COUNT(topic_id) AS total
				FROM " . TOPICS_TABLE . "
				WHERE forum_id = $id 
					AND topic_status <> " . TOPIC_MOVED;
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
			// DJ-Begin, 15.4.02
			$sql = "SELECT COUNT(topic_id) AS total
				FROM " . TOPICS_TABLE . "
				WHERE forum_id IN ($forum_ids)
					AND topic_status <> " . TOPIC_MOVED;
			// DJ-End, 15.4.02
# 
#-----[ FIND ]------------------------------------------ 
# 
Das ist aber der MOD von NeodoomerMad-Max95 hat geschrieben:sorry...
ich habe den von neodoomer genommen, da kann ich dir nicht helfen..
Code: Alles auswählen
################################################################# 
## Mod Title: Hierarchies
## Mod Version: 0.9.48
## Author: Martin Kuhlmann < darkjedi@neodoomer.de > - http://www.neodoomer.de
## Updated to 2.0.2, 2.0.3 and 2.0.4 by David Drane (DoubleDoom) > phpbb@doubledoom.clara.co.uk
## (development from 0.9.4 onwards)
Code: Alles auswählen
includes/functions_admin.php
# 
#-----[ FIND ]------------------------------------------ 
# 
	  	case 'forum':
			
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
			// 
			// count not only the posts/topics of the forum itself but of all forums junior to this
			//
			
			$forum_ids = get_list_inferior('forum', $id, 'forum');
			
			if( empty($forum_ids) )
			{
				$forum_ids = $id;
			}
			
# 
#-----[ FIND ]------------------------------------------ 
# 
  
			$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total 
				FROM " . POSTS_TABLE . "  
				WHERE forum_id = $id";
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
				WHERE forum_id = $id";
# 
#-----[ IN-LINE, REPLACE ]------------------------------------------ 
# 
				WHERE forum_id IN($forum_ids)";
# 
#-----[ FIND ]------------------------------------------  
# 
			$sql = "SELECT COUNT(topic_id) AS total
				FROM " . TOPICS_TABLE . "
				WHERE forum_id = $id";
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
# 
				WHERE forum_id = $id";
# 
#-----[ IN-LINE, REPLACE ]------------------------------------------ 
# 
				WHERE forum_id IN($forum_ids)";
# 
#-----[ FIND ]------------------------------------------ 
# 
?>
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
// $mode means return inferior categories or inferior forums (== 'category' | 'forum')
// $id means to which category|forum the result have to be inferior
// $mode_of_id says $id is either a cat_id or a forum_id
function get_list_inferior($mode, $id, $mode_of_id = 'category')
{
	global $db;
	if( empty($id) || $id == 0 )
	{
		return;
	}
	switch($mode_of_id)
	{
		case 'forum': // $id is a forum_id
			switch($mode)
			{
				case 'category':
					$sql = "SELECT c.cat_id
						FROM " . CATEGORIES_TABLE . " c
						WHERE c.parent_forum_id = $id
						ORDER BY c.cat_id";
					if( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not query inferior categories', '', __LINE__, __FILE__, $sql);
					}
					while( $row = $db->sql_fetchrow($result) )
					{
						if( empty($cats_inferior) )
						{
							$cats_inferior .= $row['cat_id'];
						}
						else
						{
							$cats_inferior .= ", " . $row['cat_id'];
						}
						$return = get_list_inferior($mode, $row['cat_id'], 'category');
						if( !empty($return) )
						{
							$cats_inferior .= ", $return";
						}
					}
						
					return($cats_inferior);
					break;
				case 'forum':
					$sql = "SELECT c.cat_id
						FROM " . CATEGORIES_TABLE . " c
						WHERE c.parent_forum_id = $id
						ORDER BY c.cat_id";
					if( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not query inferior categories', '', __LINE__, __FILE__, $sql);
					}
					while( $row = $db->sql_fetchrow($result) )
					{
						$return = get_list_inferior($mode, $row['cat_id'], 'category');
						if( !empty($return) )
						{
							if( empty($forums_inferior) )
							{
								$forums_inferior = $return;
							}
							else
							{
								$forums_inferior .= ", $return";
							}
						}
					}
						
					return($forums_inferior);
					break;
				
				default:
					message_die(GENERAL_ERROR, "Wrong mode for generating list of inferior", "", __LINE__, __FILE__);
					break;
			}
	
		case 'category': // $id is a cat_id
		
			switch($mode) 
			{
				case 'category':
					// print "<br>get_list_inferior, $mode, got id: $id<br>";
					$cats_inferior = "";
					$sql = "SELECT c.cat_id
						FROM " . CATEGORIES_TABLE . " c, " . CAT_REL_CAT_PARENTS_TABLE . " ccp
						WHERE ccp.cat_id = c.cat_id
						AND ccp.parent_cat_id = $id
						ORDER BY c.cat_hier_level";
		
					if( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not query inferior categories', '', __LINE__, __FILE__, $sql);
					}
					while( $row = $db->sql_fetchrow($result) )
					{
						if( empty($cats_inferior) )
						{
							$cats_inferior .= $row['cat_id'];
						}
						else
						{
							$cats_inferior .= ", " . $row['cat_id'];
						}
					}
					// print "<br>get_list_inferior, $mode, SQL: $sql<br><br>get_list_inferior, $mode, Result: $cats_inferior<br><br>";
					return $cats_inferior;
					break;
				
				case 'forum':
					// print "<br>get_list_inferior, $mode, got id: $id<br>";
					$forums_inferior = "";
		
					// get inferior forum_ids of inferior cat_id of cat_id
					$sql = "SELECT f.forum_id
						FROM " . CAT_REL_CAT_PARENTS_TABLE . " ccp, " . FORUMS_TABLE . " f
						WHERE ccp.parent_cat_id = $id
						AND f.cat_id = ccp.cat_id
						ORDER BY f.forum_hier_level";
		
					if( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not query inferior forums', '', __LINE__, __FILE__, $sql);
					}
					while( $row = $db->sql_fetchrow($result) )
					{
						if( empty($forums_inferior) )
						{
							$forums_inferior .= $row['forum_id'];
						}
						else
						{
							$forums_inferior .= ", " . $row['forum_id'];
						}
					}
		
					// get directly inferior forum_ids of cat_id
					$sql = "SELECT forum_id
						FROM " . FORUMS_TABLE . "
						WHERE cat_id = $id";
		
					if( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not query inferior forums', '', __LINE__, __FILE__, $sql);
					}
					while( $row = $db->sql_fetchrow($result) )
					{
						if( empty($forums_inferior) )
						{
							$forums_inferior .= $row['forum_id'];
						}
						else
						{
							$forums_inferior .= ", " . $row['forum_id'];
						}
					}
		
					// print "<br>get_list_inferior, $mode, SQL: $sql<br><br>get_list_inferior, $mode, Result: $forums_inferior<br><br>";
					return $forums_inferior;
					
					break;
		
				default:
					message_die(GENERAL_ERROR, "Wrong mode for generating list of inferior", "", __LINE__, __FILE__);
					break;
			}
		break;
		
	default:
		message_die(GENERAL_ERROR, "Wrong mode for generating list of inferior", "", __LINE__, __FILE__);
		break;
	}
}