Aufgabe:
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_admin.php
#
#-----[ FIND ]------------------------------------------
#
#Code: Alles auswählen
$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 ]------------------------------------------
#
#Code: Alles auswählen
// 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 ]------------------------------------------
#
#Code: Alles auswählen
$sql = "SELECT COUNT(topic_id) AS total FROM " . TOPICS_TABLE . " WHERE forum_id = $id AND topic_status <> " . TOPIC_MOVED;
#-----[ REPLACE WITH ]------------------------------------------
#
#Code: Alles auswählen
// 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 ]------------------------------------------
#
#Code: Alles auswählen
?>
#-----[ BEFORE, ADD ]------------------------------------------
#
Code: Alles auswählen
// DJ-Begin, 6.4.02, 15.4.02 // $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; } } // DJ-End, 6.4.02, 15.4.02
Datei die zu editieren ist:
http://k-jjacu.milten.lima-city.de/admin_forums.txt