Simple sub-foum

Frågor kring MODdar (modifikationer) för phpBB 2.0.x.

Moderatorer: Moderatorgrupp, Supportgrupp

KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Simple sub-foum

Inlägg av KimEdstrom »

Vad gör jag med den här och hur gör jag om jag måste göra nått?
#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_forums ADD forum_parent INT NOT NULL DEFAULT '0';


#
Gilthas
Aktiv medlem
Aktiv medlem
Inlägg: 63
Blev medlem: 2006-03-15 08:29
Svar: 0

Inlägg av Gilthas »

Det kör du in i phpmyadmin...
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

hur då?

~~

Den här delen av koden finns inte i min index.php fil.
Andra raden finns på ett flertal ställen. Har sökt på den första oclså men den hittar den inte ens om man kapar den.. Verkar inte finnas nån del av den överhuvud taget.

Några idér?
#
#-----[ OPEN ]------------------------------------------
#
index.php


#
#-----[ FIND ]------------------------------------------
#
while( $category_rows[] = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);


#
Senast redigerad av KimEdstrom den 2006-07-11 16:44, redigerad totalt 1 gång.
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Kod: Markera allt

<?php
/***************************************************************************
 *                                index.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: index.php,v 1.99.2.7 2006/01/28 11:13:39 acydburn 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);

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

$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' )
{
	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") . '">')
	);

	$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
//
$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);
}

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

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;
	}
	$db->sql_freeresult($result);

	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'])
	{
		// 60 days limit
		if ($userdata['user_lastvisit'] < (time() - 5184000))
		{
			$userdata['user_lastvisit'] = time() - 5184000;
		}

		$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'];
		}
		$db->sql_freeresult($result);
	}

	//
	// 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>';
	}
	$db->sql_freeresult($result);

	$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>';
	}
	$db->sql_freeresult($result);

	//
	// 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')
	);

	$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'], 

		'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
	);

	//
	// Let's decide which categories we should display
	//
	$display_categories = array();

	for ($i = 0; $i < $total_forums; $i++ )
	{
		if ($is_auth_ary[$forum_data[$i]['forum_id']]['auth_view'])
		{
			$display_categories[$forum_data[$i]['cat_id']] = true;
		}
	}

	//
	// Okay, let's build the index
	//
	for($i = 0; $i < $total_categories; $i++)
	{
		$cat_id = $category_rows[$i]['cat_id'];

		//
		// Yes, we should, so first dump out the category
		// title, then, if appropriate the forum list
		//
		if (isset($display_categories[$cat_id]) && $display_categories[$cat_id])
		{
			$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

}// 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);

?>
Användarens profilbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6571
Blev medlem: 2004-06-09 09:32
Svar: 1

Inlägg av Holger »

KimEdstrom skrev:hur då?

~~

Den här delen av koden finns inte i min index.php fil.
Andra raden finns på ett flertal ställen. Har sökt på den första oclså men den hittar den inte ens om man kapar den.. Verkar inte finnas nån del av den överhuvud taget.

Några idér?
#
#-----[ OPEN ]------------------------------------------
#
index.php


#
#-----[ FIND ]------------------------------------------
#
while( $category_rows[] = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);


#
Det verkar vara den här kodsnutten:

Kod: Markera allt

$category_rows = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
   $category_rows[] = $row; 
} 
$db->sql_freeresult($result); 
Vad kör du för phpBB-version?


Rörande phpmyadmin:
gå till phpmyadmin, klicka på din databas till vänster och sedan på SQL till höger.
Klistra in

Kod: Markera allt

ALTER TABLE phpbb_forums ADD forum_parent INT NOT NULL DEFAULT '0';
i rutan och klicka på Kör.
Holger Gremminger
Ingen support via PM!
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Jag kör den senaste. Den som dom har på http://www.phpbb.com för nerladdning just nu.
Har du någon lösning på vad jag kan göra?
Senast redigerad av KimEdstrom den 2006-07-11 16:55, redigerad totalt 1 gång.
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Fel

SQL-fråga:

ALTER TABLE phpbb_forums ADD forum_parent INT NOT NULL DEFAULT '0';

MySQL sa: Dokumentation
#1146 - Table 'wehrmacht.phpbb_forums' doesn't exist
När jag klistrade in den i phpmyadmin.

Rättat till felet.
Skrev om koden till

Kod: Markera allt

ALTER TABLE phpbb_wehrmachtforums ADD forum_parent INT NOT NULL DEFAULT '0'
och fick resultatet
Din SQL-fråga utfördes korrekt (Frågan tog 0.1444 sek)
SQL-fråga: ALTER TABLE phpbb_wehrmachtforums ADD forum_parent INT NOT NULL DEFAULT '0'
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Holger skrev:
Det verkar vara den här kodsnutten:

Kod: Markera allt

$category_rows = array(); 
while ($row = $db->sql_fetchrow($result)) 
{ 
   $category_rows[] = $row; 
} 
$db->sql_freeresult($result); 
Vad kör du för phpBB-version?
Jag tar en vild chansning och testar :D
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

När jag var klar med allting och öppnar forumet och går in på admin panelen så fungerar höger frame parfekt men i vänster frame (menyn) får jag detta medelande.
Parse error: parse error, unexpected T_FOR in D:\wamp\www\Forum\admin\admin_forums.php on line 1177
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Har provat att skriva om den också men fungerar fortfarande inte.

Dock fick jag inte riktigt samma medelande men näst intill.
Parse error: parse error, unexpected T_CASE in D:\wamp\www\Forum\admin\admin_forums.php on line 1029
Användarens profilbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6571
Blev medlem: 2004-06-09 09:32
Svar: 1

Inlägg av Holger »

Lägg upp instruktion och fil ...
Holger Gremminger
Ingen support via PM!
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Instruktion:
##############################################################
## MOD Title: Simple Subforums MOD
## MOD Author: pentapenguin < pentapenguin@bluebottle.com > (Jeremy Conley) http://www.pentapenguin.com
## MOD Author: CyberAlien <n/a> (Vjacheslav Trushkin) http://www.phpbbstyles.com
## MOD Description: This MOD is a simple subforums MOD that doesn't include any extras and makes only
## one small database change. It supports only one level deep subforums that should be enough for most forums.
## MOD Version: 1.0.1
##
## Installation Level: Intermediate
## Installation Time: 30 Minutes
##
## Files To Edit: 20
## admin/admin_forumauth.php
## admin/admin_forums.php
## includes/functions.php
## includes/functions_admin.php
## language/lang_english/lang_main.php
## templates/subSilver/admin/forum_admin_body.tpl
## 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/viewforum_body.tpl
## templates/subSilver/viewtopic_body.tpl
## index.php
## modcp.php
## posting.php
## search.php
## viewforum.php
## viewtopic.php
##
## Included Files: 3
## contrib/admin/xs_simple_subforums.cfg
## templates/subSilver/images/folders_big.gif
## templates/subSilver/images/folders_new_big.gif
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## Please remember that this MOD requires the eXtreme Styles MOD.
## See the DIY INSTRUCTIONS below for download links.
##
## Instructions for use: to create a subforum, simply go to your admin panel->Forum Admin->Management.
## From there, click on the "Edit" link next to a forum, and select the parent (main) forum from the
## "Category / Forum" dropdown box.
##
## This MOD includes a built-in update checker.
## To access the update checker, go to your admin panel->eXtreme Styles->Styles Management->Check for Updates
##
## To run the required SQL updates please see this article in the phpBB.com knowledge base:
## http://www.phpbb.com/kb/article.php?article_id=264
## Or use the SQL Generator Tool available here: http://www.phpbbstyles.com/sql.php
##
## This MOD is EasyMOD friendly! (http://area51.phpbb.com/phpBB/viewforum.php?sid=&f=17)
##
## For additional language and style downloads, please visit http://www.pentapenguin.com/forum/viewtopic.php?t=1416
##
## Thanks go out to CyberAlien for originally developing this MOD! :-)
##
## To update to version 1.0.1, please see the update/update_from_1.0.0_to_1.0.1.txt file.
##############################################################
## MOD History:
## 2005-12-11 - Version 1.0.1
## - Fixed security bug
##
## 2005-10-30 - Version 1.0.0
## - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
This MOD requires the eXtreme Styles MOD.
You *must* install the eXtreme Styles MOD which is available at these locations:
http://www.phpbbstyles.com/viewtopic.php?t=356
http://www.phpbb.com/phpBB/viewtopic.php?t=125251


#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_forums ADD forum_parent INT NOT NULL DEFAULT '0';


#
#-----[ COPY ]------------------------------------------
#
copy contrib/admin/xs_simple_subforums.cfg to admin/xs_simple_subforums.cfg
copy templates/subSilver/images/folders_big.gif to templates/subSilver/images/folders_big.gif
copy templates/subSilver/images/folders_new_big.gif to templates/subSilver/images/folders_new_big.gif


#
#-----[ OPEN ]------------------------------------------
#
admin/admin_forumauth.php


#
#-----[ FIND ]------------------------------------------
#
for($i = 0; $i < count($forum_rows); $i++)
{


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
if( !$forum_rows[$i]['forum_parent'] )
{
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$parent_id = $forum_rows[$i]['forum_id'];
for( $j = 0; $j < count($forum_rows); $j++ )
{
if( $forum_rows[$j]['forum_parent'] == $parent_id )
{
$select_list .= '<option value="' . $forum_rows[$j]['forum_id'] . '">-- ' . $forum_rows[$j]['forum_name'] . '</option>';
}
}
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
admin/admin_forums.php


#
#-----[ FIND ]------------------------------------------
#
return($catlist);
}


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
function get_list_cat($id, $parent, $forum_id)
{
global $db;

// Get categories
$sql = 'SELECT * FROM ' . CATEGORIES_TABLE . ' ORDER BY cat_order ASC';

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't get list of categories", '', __LINE__, __FILE__, $sql);
}

$cat_list = array();

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

$db->sql_freeresult($result);

// Get all forums and check if forum has subforums
$has_sub = false;
$sql = 'SELECT forum_id, cat_id, forum_name, forum_parent FROM ' . FORUMS_TABLE . ' ORDER BY forum_order ASC';

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't get list of forums", '', __LINE__, __FILE__, $sql);
}

$forums_list = array();

while( $row = $db->sql_fetchrow($result) )
{
if( $row['forum_parent'] > 0 && $row['forum_parent'] == $forum_id )
{
$has_sub = true;
}

if( !$row['forum_parent'] )
{
$forums_list[] = $row;
}
}
$db->sql_freeresult($result);

// Generate select
for( $i = 0; $i < count($cat_list); $i++ )
{
$cat_id = $cat_list[$i]['cat_id'];
$selected = ( $id == $cat_id && $parent == 0 ) ? ' selected="selected"' : '';
$str .= '<option value="' . $cat_id . '"' . $selected . '>' . $cat_list[$i]['cat_title'] . '</option>';

if( !$has_sub )
{
for( $j = 0; $j < count($forums_list); $j++)
{
if( $forums_list[$j]['cat_id'] == $cat_id && $forums_list[$j]['forum_id'] != $forum_id )
{
$forum_id2 = $forums_list[$j]['forum_id'];
$selected = ( $id == $cat_id && $parent == $forum_id2 ) ? ' selected="selected"' : '';
$str .= '<option value="' . $cat_id . ',' . $forum_id2 . '"' . $selected . '>- ' . $forums_list[$j]['forum_name'] . '</option>';
}
}
}
}
return $str;
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$cat_id = $row['cat_id'];


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$parent_id = $row['forum_parent'];
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$forum_id = '';
$prune_enabled = '';


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$parent_id = 0;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$catlist = get_list('category', $cat_id, TRUE);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$catlist = get_list_cat($cat_id, $parent_id, $forum_id);
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
'L_CATEGORY' => $lang['Category'],


#
#-----[ IN-LINE FIND ]------------------------------------------
#
$lang['Category']


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
. ' / ' . $lang['Forum']


#
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$list = explode(',', $HTTP_POST_VARS[POST_CAT_URL]);
$new_cat = ( count($list) ) ? intval($list[0]) : intval($HTTP_POST_VARS[POST_CAT_URL]);
$new_parent = ( isset($list[1]) ) ? intval($list[1]) : 0;
// End Simple Subforums MOD


#
#-----[ IN-LINE FIND ]------------------------------------------
#
# We're still in the FIND command above: $sql = "INSERT INTO " . FORUMS_TABLE . " [snip]....
#
cat_id,


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
forum_parent,


#
#-----[ IN-LINE FIND ]------------------------------------------
#
intval($HTTP_POST_VARS[POST_CAT_URL])


#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$new_cat . ', ' . $new_parent


#
#-----[ FIND ]------------------------------------------
#
case 'modforum':


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]);
$row = get_info('forum', $forum_id);
$list = explode(',', $HTTP_POST_VARS[POST_CAT_URL]);
$new_cat = ( count($list) ) ? intval($list[0]) : intval($HTTP_POST_VARS[POST_CAT_URL]);
$new_parent = ( isset($list[1]) ) ? intval($list[1]) : 0;

if( !$row['forum_parent'] && $row['cat_id'] !== $new_cat )
{
// Move subforums to new category
$sql = "UPDATE " . FORUMS_TABLE . " SET cat_id='$new_cat' WHERE forum_parent='$forum_id'";
$db->sql_query($sql);
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "',


#
#-----[ IN-LINE FIND ]------------------------------------------
#
" . intval($HTTP_POST_VARS[POST_CAT_URL]) . "


#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
$new_cat, forum_parent = $new_parent


#
#-----[ FIND ]------------------------------------------
#
$sql = "DELETE FROM " . FORUMS_TABLE . "
WHERE forum_id = $from_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
}


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
// Move subforums to category
$sql = "UPDATE " . FORUMS_TABLE . " SET forum_parent = '0' WHERE forum_parent = '$from_id'";
$db->sql_query($sql);
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$cat_id = $forum_info['cat_id'];


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
if( !$forum_info['forum_parent'] )
{
// Find previous/next forum
if( $move > 0 )
{
$sql = "SELECT forum_id, forum_order FROM " . FORUMS_TABLE . " WHERE cat_id = '$cat_id' AND forum_parent = '0' AND forum_order > '" . $forum_info['forum_order'] . "' ORDER BY forum_order ASC";
}

else
{
$sql = "SELECT forum_id, forum_order FROM " . FORUMS_TABLE . " WHERE cat_id = '$cat_id' AND forum_parent = '0' AND forum_order < '" . $forum_info['forum_order'] . "' ORDER BY forum_order DESC";
}

if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't change category order", '', __LINE__, __FILE__, $sql);
}

$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if($row !== false)
{
// Swap forum orders
$sql = "UPDATE " . FORUMS_TABLE . " SET forum_order = '" . $row['forum_order'] . "' WHERE forum_id = '$forum_id'";
$db->sql_query($sql);

$sql = "UPDATE " . FORUMS_TABLE . " SET forum_order = '" . $forum_info['forum_order'] . "' WHERE forum_id = '" . $row['forum_id'];
$db->sql_query($sql);
}
}

else
{
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
renumber_order('forum', $forum_info['cat_id']);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
if ($forum_rows[$j]['cat_id'] == $cat_id)


#
#-----[ IN-LINE FIND ]------------------------------------------
#
$cat_id


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&& $forum_rows[$j]['forum_parent'] == 0


#
#-----[ FIND ]------------------------------------------
#
'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id"))
);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
for( $k = 0; $k < $total_forums; $k++ )
{
$forum_id2 = $forum_rows[$k]['forum_id'];
if ( $forum_rows[$k]['forum_parent'] == $forum_id )
{
$template->assign_block_vars("catrow.forumrow", array(
'FORUM_NAME' => $forum_rows[$k]['forum_name'],
'FORUM_DESC' => $forum_rows[$k]['forum_desc'],
'ROW_COLOR' => $row_color,
'NUM_TOPICS' => $forum_rows[$k]['forum_topics'],
'NUM_POSTS' => $forum_rows[$k]['forum_posts'],
'STYLE' => ' style="padding-left: 20px;" ',

'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id2"),
'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id2"),
'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id2"),
'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id2"),
'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id2"),
'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id2"))
);

}

} // for ... forums
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php


#
#-----[ FIND ]------------------------------------------
#
function make_jumpbox($action, $match_forum_id = 0)
{


#
#-----[ AFTER, ADD ]------------------------------------------
#
$list = array();
return make_jumpbox_ref($action, $match_forum_id, $list);
}

function make_jumpbox_ref($action, $match_forum_id, &$forums_list)
{


#
#-----[ FIND ]------------------------------------------
#
$forum_rows[] = $row;


#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Simple Subforums MOD
$forums_list[] = $row;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$j]['auth_view'] <= AUTH_REG )


#
#-----[ IN-LINE FIND ]------------------------------------------
#
if (


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
!$forum_rows[$j]['forum_parent'] &&


#
#-----[ FIND ]------------------------------------------
#
// if ( $forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$j]['forum_id']]['auth_view'] )


#
#-----[ IN-LINE FIND ]------------------------------------------
#
if (


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
!$forum_rows[$j]['forum_parent'] &&


#
#-----[ FIND ]------------------------------------------
#
$selected = ( $forum_rows[$j]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$id = $forum_rows[$j]['forum_id'];
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
'title' => $forum_rows[$j]['forum_name']
);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
for( $k = 0; $k < $total_forums; $k++ )
{
if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $forum_rows[$k]['auth_view'] <= AUTH_REG )
{
// if ( $forum_rows[$k]['forum_parent'] == $id && $forum_rows[$k]['cat_id'] == $category_rows[$i]['cat_id'] && $is_auth[$forum_rows[$k]['forum_id']]['auth_view'] )
// {
$selected = ( $forum_rows[$k]['forum_id'] == $match_forum_id ) ? 'selected="selected"' : '';
$boxstring_forums .= '<option value="' . $forum_rows[$k]['forum_id'] . '"' . $selected . '>-- ' . $forum_rows[$k]['forum_name'] . '</option>';

//
// Add an array to $nav_links for the Mozilla navigation bar.
// 'chapter' and 'forum' can create multiple items, therefore we are using a nested array.
//
$nav_links['chapter forum'][$forum_rows[$k]['forum_id']] = array (
'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$k]['forum_id']),
'title' => $forum_rows[$k]['forum_name']
);

}
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
includes/functions_admin.php


#
#-----[ FIND ]------------------------------------------
#
$sql = 'SELECT f.forum_id, f.forum_name


#
#-----[ IN-LINE FIND ]------------------------------------------
#
f.forum_name


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, f.forum_parent


#
#-----[ FIND ]------------------------------------------
#
$forum_list = '';


#
#-----[ REPLACE WITH ]------------------------------------------
#
// Begin Simple Subforums MOD
$list = array();
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
while( $row = $db->sql_fetchrow($result) )
{


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$list[] = $row;
}
$forum_list = '';
for( $i = 0; $i < count($list); $i++ )
{
if( !$list[$i]['forum_parent'] )
{
$row = $list[$i];
$parent_hidden = true;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$parent_hidden = false;
}
if ( $is_auth_ary[$row['forum_id']]['auth_read'] )
{
$parent_id = $row['forum_id'];
for($j=0; $j<count($list); $j++)
{
$row = $list[$j];
if( $row['forum_parent'] == $parent_id && $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
{
if( $parent_hidden )
{
$forum_list .= '<option value="" disabled="disabled">' . $list[$i]['forum_name'] . '</option>';
$parent_hidden = false;
}
$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>-- ' . $row['forum_name'] . '</option>';
}
}
}
// End Simple Subforums MOD

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php


#
#-----[ FIND ]------------------------------------------
#
?>


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$lang['Subforums'] = 'Subforums';
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/forum_admin_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<td class="row2"><span class="gen"><a href="{catrow.forumrow.U_VIEWFORUM}"


#
#-----[ IN-LINE FIND ]------------------------------------------
#
"row2"


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{catrow.forumrow.STYLE}


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN forumrow -->


#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF ! forumrow.PARENT -->


#
#-----[ FIND ]------------------------------------------
#
<span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>


#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- IF catrow.forumrow.MODERATORS --><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}<br /></span><!-- ENDIF -->
<!-- BEGIN sub --><!-- DEFINE $HAS_SUB = 1 --><!-- IF catrow.forumrow.sub.NUM > 0 -->, <!-- ELSE --><span class="genmed">{L_SUBFORUMS}: <!-- ENDIF -->{catrow.forumrow.sub.LAST_POST_SUB} <a href="{catrow.forumrow.sub.U_VIEWFORUM}" <!-- IF catrow.forumrow.sub.UNREAD -->class="topic-new"<!-- ENDIF --> title="{catrow.forumrow.sub.FORUM_DESC_HTML}">{catrow.forumrow.sub.FORUM_NAME}</a><!-- END sub -->
<!-- IF $HAS_SUB --></span><!-- UNDEFINE $HAS_SUB --><!-- ENDIF -->
</td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOTAL_TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOTAL_POSTS}</span></td>


#
#-----[ FIND ]------------------------------------------
#
<!-- END forumrow -->


#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/modcp_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


#
#-----[ IN-LINE FIND ]------------------------------------------
#
</a>


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a> <!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/modcp_split.tpl


#
#-----[ FIND ]------------------------------------------
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a><span class="nav">


#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a> <!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl


#
#-----[ FIND ]------------------------------------------
#
@import url("templates/subSilver/formIE.css");


#
#-----[ AFTER, ADD ]------------------------------------------
#

/* Begin Simple Subforums MOD */
a.topic-new, a.topic-new:visited { color: {T_BODY_HLINK}; }
a.topic-new:hover, a.topic-new:active { color: {T_BODY_LINK}; }
/* End Simple Subforums MOD */


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN switch_not_privmsg -->


#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a> <!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.cfg


#
#-----[ FIND ]------------------------------------------
#
$images['forum_locked'] = "$current_template_images/folder_locked_big.gif";


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$images['forums'] = "$current_template_images/folders_big.gif";
$images['forums_new'] = "$current_template_images/folders_new_big.gif";
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewforum_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<td align="left" valign="middle" class="nav" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


#
#-----[ IN-LINE FIND ]------------------------------------------
#
</a>


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a> <!-- ENDIF -->


#
#-----[ FIND ]------------------------------------------
#
<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>


#
#-----[ AFTER, ADD ]------------------------------------------
#

<!-- BEGIN catrow -->
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&nbsp;{catrow.CAT_DESC}&nbsp;</th>
<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICS}&nbsp;</th>
<th width="50" class="thTop" nowrap="nowrap">&nbsp;{L_POSTS}&nbsp;</th>
<th class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
</tr>
<!-- BEGIN forumrow -->
<tr>
<td class="row1" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" width="46" height="25" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink<!-- IF catrow.forumrow.UNREAD --> topic-new<!-- ENDIF -->">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
<!-- END forumrow -->
</table>
<br />
<!-- END catrow -->

<!-- IF NUM_TOPICS || ! HAS_SUBFORUMS -->


#
#-----[ FIND ]------------------------------------------
#
<td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


#
#-----[ IN-LINE FIND ]------------------------------------------
#
</a>


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a><!-- ENDIF -->


#
#-----[ FIND ]------------------------------------------
#
<td align="right"><span class="gensmall">{S_AUTH_LIST}</span></td>
</tr>
</table>


#
#-----[ AFTER, ADD ]------------------------------------------
#

<!-- ELSE -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">{JUMPBOX}</td>
</tr>
</table>
<!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl


#
#-----[ FIND ]------------------------------------------
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


#
#-----[ IN-LINE FIND ]------------------------------------------
#
</a>


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a><!-- ENDIF -->


#
#-----[ FIND ]------------------------------------------
#
<td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>


#
#-----[ IN-LINE FIND ]------------------------------------------
#
</a>


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- IF PARENT_FORUM --> -> <a class="nav" href="{U_VIEW_PARENT_FORUM}">{PARENT_FORUM_NAME}</a><!-- ENDIF -->


#
#-----[ OPEN ]------------------------------------------
#
index.php


#
#-----[ FIND ]------------------------------------------
#
while( $category_rows[] = $db->sql_fetchrow($result) );
$db->sql_freeresult($result);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$subforums_list = array();
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
'L_FORUM' => $lang['Forum'],


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
'L_SUBFORUMS' => $lang['Subforums'],
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$unread_topics = false;
$folder_images = array(
'default' => $folder_image,
'new' => $images['forum_locked'],
'sub' => ( isset($images['forums_locked']) ) ? $images['forums_locked'] : $images['forum_locked'],
'subnew' => ( isset($images['forums_locked']) ) ? $images['forums_locked'] : $images['forum_locked'],
'subalt' => $lang['Forum_locked'],
'subaltnew' => $lang['Forum_locked'],
);
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$folder_images = array(
'default' => $folder_image,
'new' => $images['forum_new'],
'sub' => ( isset($images['forums']) ) ? $images['forums'] : $images['forum'],
'subnew' => ( isset($images['forums_new']) ) ? $images['forums_new'] : $images['forum_new'],
'subalt' => $lang['No_new_posts'],
'subaltnew' => $lang['New_posts'],
);
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$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>';


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$last_post_sub = '<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="' . ($unread_topics ? $images['icon_newest_reply'] : $images['icon_latest_reply']) . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
$last_post_time = $forum_data[$j]['post_time'];
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$last_post = $lang['No_Posts'];


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$last_post_sub = '<img src="' . $images['icon_minipost'] . '" border="0" alt="' . $lang['No_Posts'] . '" title="' . $lang['No_Posts'] . '" />';
$last_post_time = 0;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$moderator_list = '&nbsp;';


#
#-----[ IN-LINE FIND ]------------------------------------------
#
'&nbsp;';


#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
'';


#
#-----[ FIND ]------------------------------------------
#
'L_FORUM_FOLDER_ALT' => $folder_alt,


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
'FORUM_FOLDERS' => serialize($folder_images),
'HAS_SUBFORUMS' => 0,
'PARENT' => $forum_data[$j]['forum_parent'],
'ID' => $forum_data[$j]['forum_id'],
'UNREAD' => intval($unread_topics),
'TOTAL_UNREAD' => intval($unread_topics),
'TOTAL_POSTS' => $forum_data[$j]['forum_posts'],
'TOTAL_TOPICS' => $forum_data[$j]['forum_topics'],
'LAST_POST_FORUM' => $last_post,
'LAST_POST_TIME' => $last_post_time,
'LAST_POST_TIME_FORUM' => $last_post_time,
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
if( $forum_data[$j]['forum_parent'] )
{
$subforums_list[] = array(
'forum_data' => $forum_data[$j],
'folder_image' => $folder_image,
'last_post' => $last_post,
'last_post_sub' => $last_post_sub,
'moderator_list' => $moderator_list,
'unread_topics' => $unread_topics,
'l_moderators' => $l_moderators,
'folder_alt' => $folder_alt,
'last_post_time' => $last_post_time,
'desc' => $forum_data[$j]['forum_desc'],
);
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
else
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
unset($data);
unset($item);
unset($cat_item);
unset($row_item);
for( $i = 0; $i < count($subforums_list); $i++ )
{
$forum_data = $subforums_list[$i]['forum_data'];
$parent_id = $forum_data['forum_parent'];

// Find parent item
if( isset($template->_tpldata['catrow.']) )
{
$data = &$template->_tpldata['catrow.'];
$count = count($data);
for( $j = 0; $j < $count; $j++)
{
$cat_item = &$data[$j];
$row_item = &$cat_item['forumrow.'];
$count2 = count($row_item);
for( $k = 0; $k < $count2; $k++)
{
if( $row_item[$k]['ID'] == $parent_id )
{
$item = &$row_item[$k];
break;
}
}
if( isset($item) )
{
break;
}
}
}

if( isset($item) )
{
if( isset($item['sub.']) )
{
$num = count($item['sub.']);
$data = &$item['sub.'];
}
else
{
$num = 0;
$item[] = 'sub.';
$data = &$item['sub.'];
}

// Append new entry
$data[] = array(
'NUM' => $num,
'FORUM_FOLDER_IMG' => $subforums_list[$i]['folder_image'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => $forum_data['forum_desc'],
'FORUM_DESC_HTML' => htmlspecialchars(preg_replace('@<[\/\!]*?[^<>]*?>@si', '', $forum_data['forum_desc'])),
'POSTS' => $forum_data['forum_posts'],
'TOPICS' => $forum_data['forum_topics'],
'LAST_POST' => $subforums_list[$i]['last_post'],
'LAST_POST_SUB' => $subforums_list[$i]['last_post_sub'],
'LAST_TOPIC' => $forum_data['topic_title'],
'MODERATORS' => $subforums_list[$i]['moderator_list'],
'PARENT' => $forum_data['forum_parent'],
'ID' => $forum_data['forum_id'],
'UNREAD' => intval($subforums_list[$i]['unread_topics']),

'L_MODERATOR' => $subforums_list[$i]['l_moderators'],
'L_FORUM_FOLDER_ALT' => $subforums_list[$i]['folder_alt'],

'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $forum_data['forum_id'])
);
$item['HAS_SUBFORUMS'] ++;
$item['TOTAL_UNREAD'] += intval($subforums_list[$i]['unread_topics']);
// Change folder image
$images = unserialize($item['FORUM_FOLDERS']);
$item['FORUM_FOLDER_IMG'] = $item['TOTAL_UNREAD'] ? $images['subnew'] : $images['sub'];
$item['L_FORUM_FOLDER_ALT'] = $item['TOTAL_UNREAD'] ? $images['subaltnew'] : $images['subalt'];
// Check last post
if( $item['LAST_POST_TIME'] < $subforums_list[$i]['last_post_time'] )
{
$item['LAST_POST'] = $subforums_list[$i]['last_post'];
$item['LAST_POST_TIME'] = $subforums_list[$i]['last_post_time'];
}
if( !$item['LAST_POST_TIME_FORUM'] )
{
$item['LAST_POST_FORUM'] = $item['LAST_POST'];
}
// Add topics/posts
$item['TOTAL_POSTS'] += $forum_data['forum_posts'];
$item['TOTAL_TOPICS'] += $forum_data['forum_topics'];
}
unset($item);
unset($data);
unset($cat_item);
unset($row_item);
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
modcp.php


#
#-----[ FIND ]------------------------------------------
#
$template->set_filenames(array(
'split_body' => 'modcp_split.tpl')
);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$all_forums = array();
make_jumpbox_ref('modcp.'.$phpEx, $forum_id, $all_forums);

$parent_id = 0;
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $forum_id )
{
$parent_id = $all_forums[$i]['forum_parent'];
}
}

if( $parent_id )
{
for( $i = 0; $i < count($all_forums); $i++)
{
if( $all_forums[$i]['forum_id'] == $parent_id )
{
$template->assign_vars(array(
'PARENT_FORUM' => 1,
'U_VIEW_PARENT_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL .'=' . $all_forums[$i]['forum_id']),
'PARENT_FORUM_NAME' => $all_forums[$i]['forum_name'],
));
}
}
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
make_jumpbox('modcp.'.$phpEx);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$all_forums = array();
make_jumpbox_ref('modcp.'.$phpEx, $forum_id, $all_forums);

$parent_id = 0;
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $forum_id )
{
$parent_id = $all_forums[$i]['forum_parent'];
}
}

if( $parent_id )
{
for( $i = 0; $i < count($all_forums); $i++)
{
if( $all_forums[$i]['forum_id'] == $parent_id )
{
$template->assign_vars(array(
'PARENT_FORUM' => 1,
'U_VIEW_PARENT_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL .'=' . $all_forums[$i]['forum_id']),
'PARENT_FORUM_NAME' => $all_forums[$i]['forum_name'],
));
}
}
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
posting.php


#
#-----[ FIND ]------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$all_forums = array();
make_jumpbox_ref('viewforum.'.$phpEx, $forum_id, $all_forums);

$parent_id = 0;
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $forum_id )
{
$parent_id = $all_forums[$i]['forum_parent'];
}
}

if( $parent_id )
{
for( $i = 0; $i < count($all_forums); $i++)
{
if( $all_forums[$i]['forum_id'] == $parent_id )
{
$template->assign_vars(array(
'PARENT_FORUM' => 1,
'U_VIEW_PARENT_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL .'=' . $all_forums[$i]['forum_id']),
'PARENT_FORUM_NAME' => $all_forums[$i]['forum_name'],
));
}
}
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
search.php


#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id


#
#-----[ IN-LINE FIND ]------------------------------------------
#
f.forum_id


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, f.forum_parent


#
#-----[ FIND ]------------------------------------------
#
$s_forums = '';


#
#-----[ AFTER, ADD ]------------------------------------------
#
$list = array();


#
#-----[ FIND ]------------------------------------------
#
if ( $is_auth_ary[$row['forum_id']]['auth_read'] )
{


#
#-----[ AFTER, ADD ]------------------------------------------
#
$list[] = $row;
}
}

for( $i = 0; $i < count($list); $i++ )
{
if( !$list[$i]['forum_parent'] )
{
$row = $list[$i];


#
#-----[ FIND ]------------------------------------------
#
if ( empty($list_cat[$row['cat_id']]) )
{
$list_cat[$row['cat_id']] = $row['cat_title'];
}


#
#-----[ AFTER, ADD ]------------------------------------------
#
$parent_id = $row['forum_id'];
for( $j = 0; $j < count($list); $j++ )
{
if( $list[$j]['forum_parent'] == $parent_id )
{
$row = $list[$j];
$s_forums .= '<option value="' . $row['forum_id'] . '">-- ' . $row['forum_name'] . '</option>';
}
}


#
#-----[ OPEN ]------------------------------------------
#
viewforum.php


#
#-----[ FIND ]------------------------------------------
#
if ( $mark_read == 'topics' )
{


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
$mark_list = ( isset($HTTP_GET_VARS['mark_list']) ) ? explode(',', $HTTP_GET_VARS['mark_list']) : array($forum_id);
$old_forum_id = $forum_id;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$set_cookie = true;
if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) )
{
$HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f'] = serialize($tracking_forums);
}
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
if( $set_cookie )
{
setcookie($board_config['cookie_name'] . '_f', serialize($tracking_forums), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
$forum_id = $old_forum_id;
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$all_forums = array();
make_jumpbox_ref('viewforum.'.$phpEx, $forum_id, $all_forums);
// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics"))
);


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
if( $forum_row['forum_parent'] )
{
$parent_id = $forum_row['forum_parent'];
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $parent_id )
{
$template->assign_vars(array(
'PARENT_FORUM' => 1,
'U_VIEW_PARENT_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL .'=' . $all_forums[$i]['forum_id']),
'PARENT_FORUM_NAME' => $all_forums[$i]['forum_name'],
));
}
}
}
else
{
$sub_list = array();
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_parent'] == $forum_id )
{
$sub_list[] = $all_forums[$i]['forum_id'];
}
}
if( count($sub_list) )
{
$sub_list[] = $forum_id;
$template->vars['U_MARK_READ'] .= '&mark_list=' . implode(',', $sub_list);
}
}
// assign additional variables for subforums mod
$template->assign_vars(array(
'NUM_TOPICS' => $forum_row['forum_topics'],
'CAN_POST' => $is_auth['auth_post'] ? 1 : 0,
'L_FORUM' => $lang['Forum'],
));

// End Simple Subforums MOD


#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('switch_no_topics', array() );

}

#
#-----[ AFTER, ADD ]------------------------------------------
#

// Begin Simple Subforums MOD
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
AND f.forum_parent = '{$forum_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(+)
AND f.forum_parent = '{$forum_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 )
WHERE f.forum_parent = '{$forum_id}'
ORDER BY f.cat_id, f.forum_order";
break;
}
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query subforums information', '', __LINE__, __FILE__, $sql);
}

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

if ( ($total_forums = count($subforum_data)) > 0 )
{
//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $subforum_data);

$display_forums = false;
for( $j = 0; $j < $total_forums; $j++ )
{
if ( $is_auth_ary[$subforum_data[$j]['forum_id']]['auth_view'] )
{
$display_forums = true;
}
}

if( !$display_forums )
{
$total_forums = 0;
}
}

if( $total_forums )
{
$template->assign_var('HAS_SUBFORUMS', 1);
$template->assign_block_vars('catrow', array(
'CAT_ID' => $forum_id,
'CAT_DESC' => $forum_row['forum_name'],
'U_VIEWCAT' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
));

//
// 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'];
}
$db->sql_freeresult($result);
}
//
// Obtain list of moderators of each forum
// First users, then groups ... broken into two queries
//
$subforum_moderators = array();
$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, false, true)) )
{
message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

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

$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, false, true)) )
{
message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql);
}

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

// show subforums
for( $j = 0; $j < $total_forums; $j++ )
{
$subforum_id = $subforum_data[$j]['forum_id'];

if ( $is_auth_ary[$subforum_id]['auth_view'] )
{
$unread_topics = false;
if ( $subforum_data[$j]['forum_status'] == FORUM_LOCKED )
{
$folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
else
{
if ( $userdata['session_logged_in'] )
{
if ( !empty($new_topic_data[$subforum_id]) )
{
$subforum_last_post_time = 0;

while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$subforum_id]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$unread_topics = true;
$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$unread_topics = true;
$subforum_last_post_time = max($check_post_time, $subforum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$subforum_id]) )
{
if ( $tracking_forums[$subforum_id] > $subforum_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'] > $subforum_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 = $subforum_data[$j]['forum_posts'];
$topics = $subforum_data[$j]['forum_topics'];

if ( $subforum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $subforum_data[$j]['post_time'], $board_config['board_timezone']);

$last_post = $last_post_time . '<br />';

$last_post .= ( $subforum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($subforum_data[$j]['post_username'] != '' ) ? $subforum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $subforum_data[$j]['user_id']) . '">' . $subforum_data[$j]['username'] . '</a> ';

$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $subforum_data[$j]['forum_last_post_id']) . '#' . $subforum_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($subforum_moderators[$subforum_id]) > 0 )
{
$l_moderators = ( count($subforum_moderators[$subforum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$moderator_list = implode(', ', $subforum_moderators[$subforum_id]);
}
else
{
$l_moderators = '&nbsp;';
$moderator_list = '';
}

$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' => $subforum_data[$j]['forum_name'],
'FORUM_DESC' => $subforum_data[$j]['forum_desc'],
'POSTS' => $subforum_data[$j]['forum_posts'],
'TOPICS' => $subforum_data[$j]['forum_topics'],
'LAST_POST' => $last_post,
'MODERATORS' => $moderator_list,
'ID' => $subforum_data[$j]['forum_id'],
'UNREAD' => intval($unread_topics),
'LAST_POST_TIME' => $last_post_time,

'L_MODERATOR' => $l_moderators,
'L_FORUM_FOLDER_ALT' => $folder_alt,

'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$subforum_id"))
);

}
}
}
// End Simple Subforums MOD


#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php


#
#-----[ FIND ]------------------------------------------
#
make_jumpbox('viewforum.'.$phpEx, $forum_id);


#
#-----[ REPLACE WITH ]------------------------------------------
#

// Begin Simple Subforums MOD
$all_forums = array();
make_jumpbox_ref('viewforum.'.$phpEx, $forum_id, $all_forums);

$parent_id = 0;
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $forum_id )
{
$parent_id = $all_forums[$i]['forum_parent'];
}
}

if( $parent_id )
{
for( $i = 0; $i < count($all_forums); $i++ )
{
if( $all_forums[$i]['forum_id'] == $parent_id )
{
$template->assign_vars(array(
'PARENT_FORUM' => 1,
'U_VIEW_PARENT_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL .'=' . $all_forums[$i]['forum_id']),
'PARENT_FORUM_NAME' => $all_forums[$i]['forum_name'],
));
}
}
}
// End Simple Subforums MOD


#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Fil som inte är redigerad till simple sub-forum än.

Kod: Markera allt

<?php
/***************************************************************************
 *                             admin_forums.php
 *                            -------------------
 *   begin                : Thursday, Jul 12, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: admin_forums.php,v 1.40.2.13 2006/03/09 21:55:09 grahamje 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', 1);

if( !empty($setmodules) )
{
	$file = basename(__FILE__);
	$module['Forums']['Manage'] = $file;
	return;
}

//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

$forum_auth_ary = array(
	"auth_view" => AUTH_ALL, 
	"auth_read" => AUTH_ALL, 
	"auth_post" => AUTH_REG, 
	"auth_reply" => AUTH_REG, 
	"auth_edit" => AUTH_REG, 
	"auth_delete" => AUTH_REG, 
	"auth_sticky" => AUTH_MOD, 
	"auth_announce" => AUTH_MOD, 
	"auth_vote" => AUTH_REG, 
	"auth_pollcreate" => AUTH_REG
);

$forum_auth_ary['auth_attachments'] = AUTH_REG;
$forum_auth_ary['auth_download'] = AUTH_REG;
//
// Mode setting
//
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
	$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
	$mode = htmlspecialchars($mode);
}
else
{
	$mode = "";
}

// ------------------
// Begin function block
//
function get_info($mode, $id)
{
	global $db;

	switch($mode)
	{
		case 'category':
			$table = CATEGORIES_TABLE;
			$idfield = 'cat_id';
			$namefield = 'cat_title';
			break;

		case 'forum':
			$table = FORUMS_TABLE;
			$idfield = 'forum_id';
			$namefield = 'forum_name';
			break;

		default:
			message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
			break;
	}
	$sql = "SELECT count(*) as total
		FROM $table";
	if( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
	}
	$count = $db->sql_fetchrow($result);
	$count = $count['total'];

	$sql = "SELECT *
		FROM $table
		WHERE $idfield = $id"; 

	if( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
	}

	if( $db->sql_numrows($result) != 1 )
	{
		message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__);
	}

	$return = $db->sql_fetchrow($result);
	$return['number'] = $count;
	return $return;
}

function get_list($mode, $id, $select)
{
	global $db;

	switch($mode)
	{
		case 'category':
			$table = CATEGORIES_TABLE;
			$idfield = 'cat_id';
			$namefield = 'cat_title';
			break;

		case 'forum':
			$table = FORUMS_TABLE;
			$idfield = 'forum_id';
			$namefield = 'forum_name';
			break;

		default:
			message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
			break;
	}

	$sql = "SELECT *
		FROM $table";
	if( $select == 0 )
	{
		$sql .= " WHERE $idfield <> $id";
	}

	if( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
	}

	$cat_list = "";

	while( $row = $db->sql_fetchrow($result) )
	{
		$s = "";
		if ($row[$idfield] == $id)
		{
			$s = " selected=\"selected\"";
		}
		$catlist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n";
	}

	return($catlist);
}

function renumber_order($mode, $cat = 0)
{
	global $db;

	switch($mode)
	{
		case 'category':
			$table = CATEGORIES_TABLE;
			$idfield = 'cat_id';
			$orderfield = 'cat_order';
			$cat = 0;
			break;

		case 'forum':
			$table = FORUMS_TABLE;
			$idfield = 'forum_id';
			$orderfield = 'forum_order';
			$catfield = 'cat_id';
			break;

		default:
			message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
			break;
	}

	$sql = "SELECT * FROM $table";
	if( $cat != 0)
	{
		$sql .= " WHERE $catfield = $cat";
	}
	$sql .= " ORDER BY $orderfield ASC";


	if( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
	}

	$i = 10;
	$inc = 10;

	while( $row = $db->sql_fetchrow($result) )
	{
		$sql = "UPDATE $table
			SET $orderfield = $i
			WHERE $idfield = " . $row[$idfield];
		if( !$db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql);
		}
		$i += 10;
	}

}
//
// End function block
// ------------------

//
// Begin program proper
//
if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) )
{
	$mode = ( isset($HTTP_POST_VARS['addforum']) ) ? "addforum" : "addcat";

	if( $mode == "addforum" )
	{
		list($cat_id) = each($HTTP_POST_VARS['addforum']);
		$cat_id = intval($cat_id);
		// 
		// stripslashes needs to be run on this because slashes are added when the forum name is posted
		//
		$forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]);
	}
}

if( !empty($mode) ) 
{
	switch($mode)
	{
		case 'addforum':
		case 'editforum':
			//
			// Show form to create/modify a forum
			//
			if ($mode == 'editforum')
			{
				// $newmode determines if we are going to INSERT or UPDATE after posting?

				$l_title = $lang['Edit_forum'];
				$newmode = 'modforum';
				$buttonvalue = $lang['Update'];

				$forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

				$row = get_info('forum', $forum_id);

				$cat_id = $row['cat_id'];
				$forumname = $row['forum_name'];
				$forumdesc = $row['forum_desc'];
				$forumstatus = $row['forum_status'];

				//
				// start forum prune stuff.
				//
				if( $row['prune_enable'] )
				{
					$prune_enabled = "checked=\"checked\"";
					$sql = "SELECT *
               			FROM " . PRUNE_TABLE . "
               			WHERE forum_id = $forum_id";
					if(!$pr_result = $db->sql_query($sql))
					{
						 message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
        			}

					$pr_row = $db->sql_fetchrow($pr_result);
				}
				else
				{
					$prune_enabled = '';
				}
			}
			else
			{
				$l_title = $lang['Create_forum'];
				$newmode = 'createforum';
				$buttonvalue = $lang['Create_forum'];

				$forumdesc = '';
				$forumstatus = FORUM_UNLOCKED;
				$forum_id = ''; 
				$prune_enabled = '';
			}

			$catlist = get_list('category', $cat_id, TRUE);

			$forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";
			
			// These two options ($lang['Status_unlocked'] and $lang['Status_locked']) seem to be missing from
			// the language files.
			$lang['Status_unlocked'] = isset($lang['Status_unlocked']) ? $lang['Status_unlocked'] : 'Unlocked';
			$lang['Status_locked'] = isset($lang['Status_locked']) ? $lang['Status_locked'] : 'Locked';
			
			$statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n";
			$statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n"; 

			$template->set_filenames(array(
				"body" => "admin/forum_edit_body.tpl")
			);

			$s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode .'" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';

			$template->assign_vars(array(
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
				'S_HIDDEN_FIELDS' => $s_hidden_fields,
				'S_SUBMIT_VALUE' => $buttonvalue, 
				'S_CAT_LIST' => $catlist,
				'S_STATUS_LIST' => $statuslist,
				'S_PRUNE_ENABLED' => $prune_enabled,

				'L_FORUM_TITLE' => $l_title, 
				'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'], 
				'L_FORUM_SETTINGS' => $lang['Forum_settings'], 
				'L_FORUM_NAME' => $lang['Forum_name'], 
				'L_CATEGORY' => $lang['Category'], 
				'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
				'L_FORUM_STATUS' => $lang['Forum_status'],
				'L_AUTO_PRUNE' => $lang['Forum_pruning'],
				'L_ENABLED' => $lang['Enabled'],
				'L_PRUNE_DAYS' => $lang['prune_days'],
				'L_PRUNE_FREQ' => $lang['prune_freq'],
				'L_DAYS' => $lang['Days'],

				'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
				'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
				'FORUM_NAME' => $forumname,
				'DESCRIPTION' => $forumdesc)
			);
			$template->pparse("body");
			break;

		case 'createforum':
			//
			// Create a forum in the DB
			//
			if( trim($HTTP_POST_VARS['forumname']) == "" )
			{
				message_die(GENERAL_ERROR, "Can't create a forum without a name");
			}

			$sql = "SELECT MAX(forum_order) AS max_order
				FROM " . FORUMS_TABLE . "
				WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
			}
			$row = $db->sql_fetchrow($result);

			$max_order = $row['max_order'];
			$next_order = $max_order + 10;
			
			$sql = "SELECT MAX(forum_id) AS max_id
				FROM " . FORUMS_TABLE;
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
			}
			$row = $db->sql_fetchrow($result);

			$max_id = $row['max_id'];
			$next_id = $max_id + 1;

			//
			// Default permissions of public :: 
			//
			$field_sql = "";
			$value_sql = "";
			while( list($field, $value) = each($forum_auth_ary) )
			{
				$field_sql .= ", $field";
				$value_sql .= ", $value";

			}

			// There is no problem having duplicate forum names so we won't check for it.
			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
			}

			if( $HTTP_POST_VARS['prune_enable'] )
			{

				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "")
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
					VALUES('" . $next_id . "', " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql);
				}
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'modforum':
			// Modify a forum in the DB
			if( isset($HTTP_POST_VARS['prune_enable']))
			{
				if( $HTTP_POST_VARS['prune_enable'] != 1 )
				{
					$HTTP_POST_VARS['prune_enable'] = 0;
				}
			}

			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
			}

			if( $HTTP_POST_VARS['prune_enable'] == 1 )
			{
				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$sql = "SELECT *
					FROM " . PRUNE_TABLE . "
					WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql);
				}

				if( $db->sql_numrows($result) > 0 )
				{
					$sql = "UPDATE " . PRUNE_TABLE . "
						SET	prune_days = " . intval($HTTP_POST_VARS['prune_days']) . ",	prune_freq = " . intval($HTTP_POST_VARS['prune_freq']) . "
				 		WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				}
				else
				{
					$sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
						VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
				}

				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
				}
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'addcat':
			// Create a category in the DB
			if( trim($HTTP_POST_VARS['categoryname']) == '')
			{
				message_die(GENERAL_ERROR, "Can't create a category without a name");
			}

			$sql = "SELECT MAX(cat_order) AS max_order
				FROM " . CATEGORIES_TABLE;
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql);
			}
			$row = $db->sql_fetchrow($result);

			$max_order = $row['max_order'];
			$next_order = $max_order + 10;

			//
			// There is no problem having duplicate forum names so we won't check for it.
			//
			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'editcat':
			//
			// Show form to edit a category
			//
			$newmode = 'modcat';
			$buttonvalue = $lang['Update'];

			$cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

			$row = get_info('category', $cat_id);
			$cat_title = $row['cat_title'];

			$template->set_filenames(array(
				"body" => "admin/category_edit_body.tpl")
			);

			$s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '" />';

			$template->assign_vars(array(
				'CAT_TITLE' => $cat_title,

				'L_EDIT_CATEGORY' => $lang['Edit_Category'], 
				'L_EDIT_CATEGORY_EXPLAIN' => $lang['Edit_Category_explain'], 
				'L_CATEGORY' => $lang['Category'], 

				'S_HIDDEN_FIELDS' => $s_hidden_fields, 
				'S_SUBMIT_VALUE' => $buttonvalue, 
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"))
			);

			$template->pparse("body");
			break;

		case 'modcat':
			// Modify a category in the DB
			$sql = "UPDATE " . CATEGORIES_TABLE . "
				SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
				WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'deleteforum':
			// Show form to delete a forum
			$forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

			$select_to = '<select name="to_id">';
			$select_to .= "<option value=\"-1\"$s>" . $lang['Delete_all_posts'] . "</option>\n";
			$select_to .= get_list('forum', $forum_id, 0);
			$select_to .= '</select>';

			$buttonvalue = $lang['Move_and_Delete'];

			$newmode = 'movedelforum';

			$foruminfo = get_info('forum', $forum_id);
			$name = $foruminfo['forum_name'];

			$template->set_filenames(array(
				"body" => "admin/forum_delete_body.tpl")
			);

			$s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $forum_id . '" />';

			$template->assign_vars(array(
				'NAME' => $name, 

				'L_FORUM_DELETE' => $lang['Forum_delete'], 
				'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'], 
				'L_MOVE_CONTENTS' => $lang['Move_contents'], 
				'L_FORUM_NAME' => $lang['Forum_name'], 

				"S_HIDDEN_FIELDS" => $s_hidden_fields,
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
				'S_SELECT_TO' => $select_to,
				'S_SUBMIT_VALUE' => $buttonvalue)
			);

			$template->pparse("body");
			break;

		case 'movedelforum':
			//
			// Move or delete a forum in the DB
			//
			$from_id = intval($HTTP_POST_VARS['from_id']);
			$to_id = intval($HTTP_POST_VARS['to_id']);
			$delete_old = intval($HTTP_POST_VARS['delete_old']);

			// Either delete or move all posts in a forum
			if($to_id == -1)
			{
				// Delete polls in this forum
				$sql = "SELECT v.vote_id 
					FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t 
					WHERE t.forum_id = $from_id 
						AND v.topic_id = t.topic_id";
				if (!($result = $db->sql_query($sql)))
				{
					message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql);
				}

				if ($row = $db->sql_fetchrow($result))
				{
					$vote_ids = '';
					do
					{
						$vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id'];
					}
					while ($row = $db->sql_fetchrow($result));

					$sql = "DELETE FROM " . VOTE_DESC_TABLE . " 
						WHERE vote_id IN ($vote_ids)";
					$db->sql_query($sql);

					$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . " 
						WHERE vote_id IN ($vote_ids)";
					$db->sql_query($sql);

					$sql = "DELETE FROM " . VOTE_USERS_TABLE . " 
						WHERE vote_id IN ($vote_ids)";
					$db->sql_query($sql);
				}
				$db->sql_freeresult($result);
				
				include($phpbb_root_path . "includes/prune.$phpEx");
				prune($from_id, 0, true); // Delete everything from forum
			}
			else
			{
				$sql = "SELECT *
					FROM " . FORUMS_TABLE . "
					WHERE forum_id IN ($from_id, $to_id)";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql);
				}

				if($db->sql_numrows($result) != 2)
				{
					message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
				}
				$sql = "UPDATE " . TOPICS_TABLE . "
					SET forum_id = $to_id
					WHERE forum_id = $from_id";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $sql);
				}
				$sql = "UPDATE " . POSTS_TABLE . "
					SET	forum_id = $to_id
					WHERE forum_id = $from_id";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql);
				}
				sync('forum', $to_id);
			}

			// Alter Mod level if appropriate - 2.0.4
			$sql = "SELECT ug.user_id 
				FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug 
				WHERE a.forum_id <> $from_id 
					AND a.auth_mod = 1
					AND ug.group_id = a.group_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
			}

			if ($row = $db->sql_fetchrow($result))
			{
				$user_ids = '';
				do
				{
					$user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
				}
				while ($row = $db->sql_fetchrow($result));

				$sql = "SELECT ug.user_id 
					FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug 
					WHERE a.forum_id = $from_id 
						AND a.auth_mod = 1 
						AND ug.group_id = a.group_id
						AND ug.user_id NOT IN ($user_ids)";
				if( !$result2 = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
				}
					
				if ($row = $db->sql_fetchrow($result2))
				{
					$user_ids = '';
					do
					{
						$user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
					}
					while ($row = $db->sql_fetchrow($result2));

					$sql = "UPDATE " . USERS_TABLE . " 
						SET user_level = " . USER . " 
						WHERE user_id IN ($user_ids) 
							AND user_level <> " . ADMIN;
					$db->sql_query($sql);
				}
				$db->sql_freeresult($result);

			}
			$db->sql_freeresult($result2);

			$sql = "DELETE FROM " . FORUMS_TABLE . "
				WHERE forum_id = $from_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
			}
			
			$sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
				WHERE forum_id = $from_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
			}
			
			$sql = "DELETE FROM " . PRUNE_TABLE . "
				WHERE forum_id = $from_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'deletecat':
			//
			// Show form to delete a category
			//
			$cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

			$buttonvalue = $lang['Move_and_Delete'];
			$newmode = 'movedelcat';
			$catinfo = get_info('category', $cat_id);
			$name = $catinfo['cat_title'];

			if ($catinfo['number'] == 1)
			{
				$sql = "SELECT count(*) as total
					FROM ". FORUMS_TABLE;
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't get Forum count", "", __LINE__, __FILE__, $sql);
				}
				$count = $db->sql_fetchrow($result);
				$count = $count['total'];

				if ($count > 0)
				{
					message_die(GENERAL_ERROR, $lang['Must_delete_forums']);
				}
				else
				{
					$select_to = $lang['Nowhere_to_move'];
				}
			}
			else
			{
				$select_to = '<select name="to_id">';
				$select_to .= get_list('category', $cat_id, 0);
				$select_to .= '</select>';
			}

			$template->set_filenames(array(
				"body" => "admin/forum_delete_body.tpl")
			);

			$s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $cat_id . '" />';

			$template->assign_vars(array(
				'NAME' => $name, 

				'L_FORUM_DELETE' => $lang['Forum_delete'], 
				'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'], 
				'L_MOVE_CONTENTS' => $lang['Move_contents'], 
				'L_FORUM_NAME' => $lang['Forum_name'], 
				
				'S_HIDDEN_FIELDS' => $s_hidden_fields,
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
				'S_SELECT_TO' => $select_to,
				'S_SUBMIT_VALUE' => $buttonvalue)
			);

			$template->pparse("body");
			break;

		case 'movedelcat':
			//
			// Move or delete a category in the DB
			//
			$from_id = intval($HTTP_POST_VARS['from_id']);
			$to_id = intval($HTTP_POST_VARS['to_id']);

			if (!empty($to_id))
			{
				$sql = "SELECT *
					FROM " . CATEGORIES_TABLE . "
					WHERE cat_id IN ($from_id, $to_id)";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql);
				}
				if($db->sql_numrows($result) != 2)
				{
					message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__);
				}

				$sql = "UPDATE " . FORUMS_TABLE . "
					SET cat_id = $to_id
					WHERE cat_id = $from_id";
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql);
				}
			}

			$sql = "DELETE FROM " . CATEGORIES_TABLE ."
				WHERE cat_id = $from_id";
				
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'forum_order':
			//
			// Change order of forums in the DB
			//
			$move = intval($HTTP_GET_VARS['move']);
			$forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

			$forum_info = get_info('forum', $forum_id);

			$cat_id = $forum_info['cat_id'];

			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_order = forum_order + $move
				WHERE forum_id = $forum_id";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
			}

			renumber_order('forum', $forum_info['cat_id']);
			$show_index = TRUE;

			break;
			
		case 'cat_order':
			//
			// Change order of categories in the DB
			//
			$move = intval($HTTP_GET_VARS['move']);
			$cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

			$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');
			$show_index = TRUE;

			break;

		case 'forum_sync':
			sync('forum', intval($HTTP_GET_VARS[POST_FORUM_URL]));
			$show_index = TRUE;

			break;

		default:
			message_die(GENERAL_MESSAGE, $lang['No_mode']);
			break;
	}

	if ($show_index != TRUE)
	{
		include('./page_footer_admin.'.$phpEx);
		exit;
	}
}

//
// Start page proper
//
$template->set_filenames(array(
	"body" => "admin/forum_admin_body.tpl")
);

$template->assign_vars(array(
	'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
	'L_FORUM_TITLE' => $lang['Forum_admin'], 
	'L_FORUM_EXPLAIN' => $lang['Forum_admin_explain'], 
	'L_CREATE_FORUM' => $lang['Create_forum'], 
	'L_CREATE_CATEGORY' => $lang['Create_category'], 
	'L_EDIT' => $lang['Edit'], 
	'L_DELETE' => $lang['Delete'], 
	'L_MOVE_UP' => $lang['Move_up'], 
	'L_MOVE_DOWN' => $lang['Move_down'], 
	'L_RESYNC' => $lang['Resync'])
);

$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);

	$sql = "SELECT *
		FROM " . FORUMS_TABLE . "
		ORDER BY cat_id, forum_order";
	if(!$q_forums = $db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
	}

	if( $total_forums = $db->sql_numrows($q_forums) )
	{
		$forum_rows = $db->sql_fetchrowset($q_forums);
	}

	//
	// Okay, let's build the index
	//
	$gen_cat = array();

	for($i = 0; $i < $total_categories; $i++)
	{
		$cat_id = $category_rows[$i]['cat_id'];

		$template->assign_block_vars("catrow", array( 
			'S_ADD_FORUM_SUBMIT' => "addforum[$cat_id]", 
			'S_ADD_FORUM_NAME' => "forumname[$cat_id]", 

			'CAT_ID' => $cat_id,
			'CAT_DESC' => $category_rows[$i]['cat_title'],

			'U_CAT_EDIT' => append_sid("admin_forums.$phpEx?mode=editcat&" . POST_CAT_URL . "=$cat_id"),
			'U_CAT_DELETE' => append_sid("admin_forums.$phpEx?mode=deletecat&" . POST_CAT_URL . "=$cat_id"),
			'U_CAT_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=cat_order&move=-15&" . POST_CAT_URL . "=$cat_id"),
			'U_CAT_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=cat_order&move=15&" . POST_CAT_URL . "=$cat_id"),
			'U_VIEWCAT' => append_sid($phpbb_root_path."index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
		);

		for($j = 0; $j < $total_forums; $j++)
		{
			$forum_id = $forum_rows[$j]['forum_id'];
			
			if ($forum_rows[$j]['cat_id'] == $cat_id)
			{

				$template->assign_block_vars("catrow.forumrow",	array(
					'FORUM_NAME' => $forum_rows[$j]['forum_name'],
					'FORUM_DESC' => $forum_rows[$j]['forum_desc'],
					'ROW_COLOR' => $row_color,
					'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
					'NUM_POSTS' => $forum_rows[$j]['forum_posts'],

					'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),
					'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id"),
					'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id"),
					'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id"),
					'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id"),
					'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id"))
				);

			}// if ... forumid == catid
			
		} // for ... forums

	} // for ... categories

}// if ... total_categories

$template->pparse("body");

include('./page_footer_admin.'.$phpEx);

?>
KimEdstrom
Extra aktiv medlem
Extra aktiv medlem
Inlägg: 104
Blev medlem: 2006-03-14 17:51
Svar: 0
Kontakt:

Inlägg av KimEdstrom »

Jag har båda dom redigerade också så om du vill ha dom så är det bara att säga till.
Användarens profilbild
Holger
Support - Ledare
Support - Ledare
Inlägg: 6571
Blev medlem: 2004-06-09 09:32
Svar: 1

Inlägg av Holger »

här kommer den moddade filen. Du gjorde säkerligen rätt, men nu tar vi och dubbelkollar:

Kod: Markera allt

          : support@phpbb.com 
 * 
 *   $Id: admin_forums.php,v 1.40.2.13 2006/03/09 21:55:09 grahamje 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', 1); 

if( !empty($setmodules) ) 
{ 
   $file = basename(__FILE__); 
   $module['Forums']['Manage'] = $file; 
   return; 
} 

// 
// Load default header 
// 
$phpbb_root_path = "./../"; 
require($phpbb_root_path . 'extension.inc'); 
require('./pagestart.' . $phpEx); 
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); 

$forum_auth_ary = array( 
   "auth_view" => AUTH_ALL, 
   "auth_read" => AUTH_ALL, 
   "auth_post" => AUTH_REG, 
   "auth_reply" => AUTH_REG, 
   "auth_edit" => AUTH_REG, 
   "auth_delete" => AUTH_REG, 
   "auth_sticky" => AUTH_MOD, 
   "auth_announce" => AUTH_MOD, 
   "auth_vote" => AUTH_REG, 
   "auth_pollcreate" => AUTH_REG 
); 

$forum_auth_ary['auth_attachments'] = AUTH_REG; 
$forum_auth_ary['auth_download'] = AUTH_REG; 
// 
// Mode setting 
// 
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) 
{ 
   $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; 
   $mode = htmlspecialchars($mode); 
} 
else 
{ 
   $mode = ""; 
} 

// ------------------ 
// Begin function block 
// 
function get_info($mode, $id) 
{ 
   global $db; 

   switch($mode) 
   { 
      case 'category': 
         $table = CATEGORIES_TABLE; 
         $idfield = 'cat_id'; 
         $namefield = 'cat_title'; 
         break; 

      case 'forum': 
         $table = FORUMS_TABLE; 
         $idfield = 'forum_id'; 
         $namefield = 'forum_name'; 
         break; 

      default: 
         message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); 
         break; 
   } 
   $sql = "SELECT count(*) as total 
      FROM $table"; 
   if( !$result = $db->sql_query($sql) ) 
   { 
      message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); 
   } 
   $count = $db->sql_fetchrow($result); 
   $count = $count['total']; 

   $sql = "SELECT * 
      FROM $table 
      WHERE $idfield = $id"; 

   if( !$result = $db->sql_query($sql) ) 
   { 
      message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql); 
   } 

   if( $db->sql_numrows($result) != 1 ) 
   { 
      message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__); 
   } 

   $return = $db->sql_fetchrow($result); 
   $return['number'] = $count; 
   return $return; 
} 

function get_list($mode, $id, $select) 
{ 
   global $db; 

   switch($mode) 
   { 
      case 'category': 
         $table = CATEGORIES_TABLE; 
         $idfield = 'cat_id'; 
         $namefield = 'cat_title'; 
         break; 

      case 'forum': 
         $table = FORUMS_TABLE; 
         $idfield = 'forum_id'; 
         $namefield = 'forum_name'; 
         break; 

      default: 
         message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); 
         break; 
   } 

   $sql = "SELECT * 
      FROM $table"; 
   if( $select == 0 ) 
   { 
      $sql .= " WHERE $idfield <> $id"; 
   } 

   if( !$result = $db->sql_query($sql) ) 
   { 
      message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql); 
   } 

   $cat_list = ""; 

   while( $row = $db->sql_fetchrow($result) ) 
   { 
      $s = ""; 
      if ($row[$idfield] == $id) 
      { 
         $s = " selected=\"selected\""; 
      } 
      $catlist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n"; 
   } 

   return($catlist); 
} 

// Begin Simple Subforums MOD 
function get_list_cat($id, $parent, $forum_id) 
{ 
global $db; 

// Get categories 
$sql = 'SELECT * FROM ' . CATEGORIES_TABLE . ' ORDER BY cat_order ASC'; 

if( !($result = $db->sql_query($sql)) ) 
{ 
message_die(GENERAL_ERROR, "Couldn't get list of categories", '', __LINE__, __FILE__, $sql); 
} 

$cat_list = array(); 

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

$db->sql_freeresult($result); 

// Get all forums and check if forum has subforums 
$has_sub = false; 
$sql = 'SELECT forum_id, cat_id, forum_name, forum_parent FROM ' . FORUMS_TABLE . ' ORDER BY forum_order ASC'; 

if( !($result = $db->sql_query($sql)) ) 
{ 
message_die(GENERAL_ERROR, "Couldn't get list of forums", '', __LINE__, __FILE__, $sql); 
} 

$forums_list = array(); 

while( $row = $db->sql_fetchrow($result) ) 
{ 
if( $row['forum_parent'] > 0 && $row['forum_parent'] == $forum_id ) 
{ 
$has_sub = true; 
} 

if( !$row['forum_parent'] ) 
{ 
$forums_list[] = $row; 
} 
} 
$db->sql_freeresult($result); 

// Generate select 
for( $i = 0; $i < count($cat_list); $i++ ) 
{ 
$cat_id = $cat_list[$i]['cat_id']; 
$selected = ( $id == $cat_id && $parent == 0 ) ? ' selected="selected"' : ''; 
$str .= '<option value="' . $cat_id . '"' . $selected . '>' . $cat_list[$i]['cat_title'] . '</option>'; 

if( !$has_sub ) 
{ 
for( $j = 0; $j < count($forums_list); $j++) 
{ 
if( $forums_list[$j]['cat_id'] == $cat_id && $forums_list[$j]['forum_id'] != $forum_id ) 
{ 
$forum_id2 = $forums_list[$j]['forum_id']; 
$selected = ( $id == $cat_id && $parent == $forum_id2 ) ? ' selected="selected"' : ''; 
$str .= '<option value="' . $cat_id . ',' . $forum_id2 . '"' . $selected . '>- ' . $forums_list[$j]['forum_name'] . '</option>'; 
} 
} 
} 
} 
return $str; 
} 
// End Simple Subforums MOD

function renumber_order($mode, $cat = 0) 
{ 
   global $db; 

   switch($mode) 
   { 
      case 'category': 
         $table = CATEGORIES_TABLE; 
         $idfield = 'cat_id'; 
         $orderfield = 'cat_order'; 
         $cat = 0; 
         break; 

      case 'forum': 
         $table = FORUMS_TABLE; 
         $idfield = 'forum_id'; 
         $orderfield = 'forum_order'; 
         $catfield = 'cat_id'; 
         break; 

      default: 
         message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); 
         break; 
   } 

   $sql = "SELECT * FROM $table"; 
   if( $cat != 0) 
   { 
      $sql .= " WHERE $catfield = $cat"; 
   } 
   $sql .= " ORDER BY $orderfield ASC"; 


   if( !$result = $db->sql_query($sql) ) 
   { 
      message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql); 
   } 

   $i = 10; 
   $inc = 10; 

   while( $row = $db->sql_fetchrow($result) ) 
   { 
      $sql = "UPDATE $table 
         SET $orderfield = $i 
         WHERE $idfield = " . $row[$idfield]; 
      if( !$db->sql_query($sql) ) 
      { 
         message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql); 
      } 
      $i += 10; 
   } 

} 
// 
// End function block 
// ------------------ 

// 
// Begin program proper 
// 
if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) ) 
{ 
   $mode = ( isset($HTTP_POST_VARS['addforum']) ) ? "addforum" : "addcat"; 

   if( $mode == "addforum" ) 
   { 
      list($cat_id) = each($HTTP_POST_VARS['addforum']); 
      $cat_id = intval($cat_id); 
      // 
      // stripslashes needs to be run on this because slashes are added when the forum name is posted 
      // 
      $forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]); 
   } 
} 

if( !empty($mode) ) 
{ 
   switch($mode) 
   { 
      case 'addforum': 
      case 'editforum': 
         // 
         // Show form to create/modify a forum 
         // 
         if ($mode == 'editforum') 
         { 
            // $newmode determines if we are going to INSERT or UPDATE after posting? 

            $l_title = $lang['Edit_forum']; 
            $newmode = 'modforum'; 
            $buttonvalue = $lang['Update']; 

            $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]); 

            $row = get_info('forum', $forum_id); 

            $cat_id = $row['cat_id']; 
// Begin Simple Subforums MOD 
$parent_id = $row['forum_parent']; 
// End Simple Subforums MOD
            $forumname = $row['forum_name']; 
            $forumdesc = $row['forum_desc']; 
            $forumstatus = $row['forum_status']; 

            // 
            // start forum prune stuff. 
            // 
            if( $row['prune_enable'] ) 
            { 
               $prune_enabled = "checked=\"checked\""; 
               $sql = "SELECT * 
                        FROM " . PRUNE_TABLE . " 
                        WHERE forum_id = $forum_id"; 
               if(!$pr_result = $db->sql_query($sql)) 
               { 
                   message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__); 
                 } 

               $pr_row = $db->sql_fetchrow($pr_result); 
            } 
            else 
            { 
               $prune_enabled = ''; 
            } 
         } 
         else 
         { 
            $l_title = $lang['Create_forum']; 
            $newmode = 'createforum'; 
            $buttonvalue = $lang['Create_forum']; 

            $forumdesc = ''; 
            $forumstatus = FORUM_UNLOCKED; 
            $forum_id = ''; 
            $prune_enabled = ''; 
// Begin Simple Subforums MOD 
$parent_id = 0; 
// End Simple Subforums MOD 
         } 

// Begin Simple Subforums MOD 
$catlist = get_list_cat($cat_id, $parent_id, $forum_id); 
// End Simple Subforums MOD 

         $forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\""; 
          
         // These two options ($lang['Status_unlocked'] and $lang['Status_locked']) seem to be missing from 
         // the language files. 
         $lang['Status_unlocked'] = isset($lang['Status_unlocked']) ? $lang['Status_unlocked'] : 'Unlocked'; 
         $lang['Status_locked'] = isset($lang['Status_locked']) ? $lang['Status_locked'] : 'Locked'; 
          
         $statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n"; 
         $statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n"; 

         $template->set_filenames(array( 
            "body" => "admin/forum_edit_body.tpl") 
         ); 

         $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode .'" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 

         $template->assign_vars(array( 
            'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
            'S_HIDDEN_FIELDS' => $s_hidden_fields, 
            'S_SUBMIT_VALUE' => $buttonvalue, 
            'S_CAT_LIST' => $catlist, 
            'S_STATUS_LIST' => $statuslist, 
            'S_PRUNE_ENABLED' => $prune_enabled, 

            'L_FORUM_TITLE' => $l_title, 
            'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'], 
            'L_FORUM_SETTINGS' => $lang['Forum_settings'], 
            'L_FORUM_NAME' => $lang['Forum_name'], 
            'L_CATEGORY' => $lang['Category'] . ' / ' . $lang['Forum'] , 
            'L_FORUM_DESCRIPTION' => $lang['Forum_desc'], 
            'L_FORUM_STATUS' => $lang['Forum_status'], 
            'L_AUTO_PRUNE' => $lang['Forum_pruning'], 
            'L_ENABLED' => $lang['Enabled'], 
            'L_PRUNE_DAYS' => $lang['prune_days'], 
            'L_PRUNE_FREQ' => $lang['prune_freq'], 
            'L_DAYS' => $lang['Days'], 

            'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7, 
            'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1, 
            'FORUM_NAME' => $forumname, 
            'DESCRIPTION' => $forumdesc) 
         ); 
         $template->pparse("body"); 
         break; 

      case 'createforum': 
         // 
         // Create a forum in the DB 
         // 
         if( trim($HTTP_POST_VARS['forumname']) == "" ) 
         { 
            message_die(GENERAL_ERROR, "Can't create a forum without a name"); 
         } 

         $sql = "SELECT MAX(forum_order) AS max_order 
            FROM " . FORUMS_TABLE . " 
            WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]); 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); 
         } 
         $row = $db->sql_fetchrow($result); 

         $max_order = $row['max_order']; 
         $next_order = $max_order + 10; 
          
         $sql = "SELECT MAX(forum_id) AS max_id 
            FROM " . FORUMS_TABLE; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); 
         } 
         $row = $db->sql_fetchrow($result); 

         $max_id = $row['max_id']; 
         $next_id = $max_id + 1; 

         // 
         // Default permissions of public :: 
         // 
         $field_sql = ""; 
         $value_sql = ""; 
         while( list($field, $value) = each($forum_auth_ary) ) 
         { 
            $field_sql .= ", $field"; 
            $value_sql .= ", $value"; 

         } 

         // There is no problem having duplicate forum names so we won't check for it. 
// Begin Simple Subforums MOD 
$list = explode(',', $HTTP_POST_VARS[POST_CAT_URL]); 
$new_cat = ( count($list) ) ? intval($list[0]) : intval($HTTP_POST_VARS[POST_CAT_URL]); 
$new_parent = ( isset($list[1]) ) ? intval($list[1]) : 0; 
// End Simple Subforums MOD
         $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_parent, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ") 
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . $new_cat . ', ' . $new_parent 
 . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql); 
         } 

         if( $HTTP_POST_VARS['prune_enable'] ) 
         { 

            if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "") 
            { 
               message_die(GENERAL_MESSAGE, $lang['Set_prune_data']); 
            } 

            $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq) 
               VALUES('" . $next_id . "', " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql); 
            } 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 

      case 'modforum':
// Begin Simple Subforums MOD 
$forum_id = intval($HTTP_POST_VARS[POST_FORUM_URL]); 
$row = get_info('forum', $forum_id); 
$list = explode(',', $HTTP_POST_VARS[POST_CAT_URL]); 
$new_cat = ( count($list) ) ? intval($list[0]) : intval($HTTP_POST_VARS[POST_CAT_URL]); 
$new_parent = ( isset($list[1]) ) ? intval($list[1]) : 0; 

if( !$row['forum_parent'] && $row['cat_id'] !== $new_cat ) 
{ 
// Move subforums to new category 
$sql = "UPDATE " . FORUMS_TABLE . " SET cat_id='$new_cat' WHERE forum_parent='$forum_id'"; 
$db->sql_query($sql); 
} 
// End Simple Subforums MOD 
         // Modify a forum in the DB 
         if( isset($HTTP_POST_VARS['prune_enable'])) 
         { 
            if( $HTTP_POST_VARS['prune_enable'] != 1 ) 
            { 
               $HTTP_POST_VARS['prune_enable'] = 0; 
            } 
         } 

         $sql = "UPDATE " . FORUMS_TABLE . " 
            SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = $new_cat, forum_parent = $new_parent, forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . " 
            WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); 
         } 

         if( $HTTP_POST_VARS['prune_enable'] == 1 ) 
         { 
            if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" ) 
            { 
               message_die(GENERAL_MESSAGE, $lang['Set_prune_data']); 
            } 

            $sql = "SELECT * 
               FROM " . PRUNE_TABLE . " 
               WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql); 
            } 

            if( $db->sql_numrows($result) > 0 ) 
            { 
               $sql = "UPDATE " . PRUNE_TABLE . " 
                  SET   prune_days = " . intval($HTTP_POST_VARS['prune_days']) . ",   prune_freq = " . intval($HTTP_POST_VARS['prune_freq']) . " 
                   WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
            } 
            else 
            { 
               $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq) 
                  VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")"; 
            } 

            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql); 
            } 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 
          
      case 'addcat': 
         // Create a category in the DB 
         if( trim($HTTP_POST_VARS['categoryname']) == '') 
         { 
            message_die(GENERAL_ERROR, "Can't create a category without a name"); 
         } 

         $sql = "SELECT MAX(cat_order) AS max_order 
            FROM " . CATEGORIES_TABLE; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql); 
         } 
         $row = $db->sql_fetchrow($result); 

         $max_order = $row['max_order']; 
         $next_order = $max_order + 10; 

         // 
         // There is no problem having duplicate forum names so we won't check for it. 
         // 
         $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order) 
            VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql); 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 
          
      case 'editcat': 
         // 
         // Show form to edit a category 
         // 
         $newmode = 'modcat'; 
         $buttonvalue = $lang['Update']; 

         $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]); 

         $row = get_info('category', $cat_id); 
         $cat_title = $row['cat_title']; 

         $template->set_filenames(array( 
            "body" => "admin/category_edit_body.tpl") 
         ); 

         $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '" />'; 

         $template->assign_vars(array( 
            'CAT_TITLE' => $cat_title, 

            'L_EDIT_CATEGORY' => $lang['Edit_Category'], 
            'L_EDIT_CATEGORY_EXPLAIN' => $lang['Edit_Category_explain'], 
            'L_CATEGORY' => $lang['Category'], 

            'S_HIDDEN_FIELDS' => $s_hidden_fields, 
            'S_SUBMIT_VALUE' => $buttonvalue, 
            'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx")) 
         ); 

         $template->pparse("body"); 
         break; 

      case 'modcat': 
         // Modify a category in the DB 
         $sql = "UPDATE " . CATEGORIES_TABLE . " 
            SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "' 
            WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]); 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 
          
      case 'deleteforum': 
         // Show form to delete a forum 
         $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]); 

         $select_to = '<select name="to_id">'; 
         $select_to .= "<option value=\"-1\"$s>" . $lang['Delete_all_posts'] . "</option>\n"; 
         $select_to .= get_list('forum', $forum_id, 0); 
         $select_to .= '</select>'; 

         $buttonvalue = $lang['Move_and_Delete']; 

         $newmode = 'movedelforum'; 

         $foruminfo = get_info('forum', $forum_id); 
         $name = $foruminfo['forum_name']; 

         $template->set_filenames(array( 
            "body" => "admin/forum_delete_body.tpl") 
         ); 

         $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $forum_id . '" />'; 

         $template->assign_vars(array( 
            'NAME' => $name, 

            'L_FORUM_DELETE' => $lang['Forum_delete'], 
            'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'], 
            'L_MOVE_CONTENTS' => $lang['Move_contents'], 
            'L_FORUM_NAME' => $lang['Forum_name'], 

            "S_HIDDEN_FIELDS" => $s_hidden_fields, 
            'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
            'S_SELECT_TO' => $select_to, 
            'S_SUBMIT_VALUE' => $buttonvalue) 
         ); 

         $template->pparse("body"); 
         break; 

      case 'movedelforum': 
         // 
         // Move or delete a forum in the DB 
         // 
         $from_id = intval($HTTP_POST_VARS['from_id']); 
         $to_id = intval($HTTP_POST_VARS['to_id']); 
         $delete_old = intval($HTTP_POST_VARS['delete_old']); 

         // Either delete or move all posts in a forum 
         if($to_id == -1) 
         { 
            // Delete polls in this forum 
            $sql = "SELECT v.vote_id 
               FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t 
               WHERE t.forum_id = $from_id 
                  AND v.topic_id = t.topic_id"; 
            if (!($result = $db->sql_query($sql))) 
            { 
               message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql); 
            } 

            if ($row = $db->sql_fetchrow($result)) 
            { 
               $vote_ids = ''; 
               do 
               { 
                  $vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id']; 
               } 
               while ($row = $db->sql_fetchrow($result)); 

               $sql = "DELETE FROM " . VOTE_DESC_TABLE . " 
                  WHERE vote_id IN ($vote_ids)"; 
               $db->sql_query($sql); 

               $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . " 
                  WHERE vote_id IN ($vote_ids)"; 
               $db->sql_query($sql); 

               $sql = "DELETE FROM " . VOTE_USERS_TABLE . " 
                  WHERE vote_id IN ($vote_ids)"; 
               $db->sql_query($sql); 
            } 
            $db->sql_freeresult($result); 
             
            include($phpbb_root_path . "includes/prune.$phpEx"); 
            prune($from_id, 0, true); // Delete everything from forum 
         } 
         else 
         { 
            $sql = "SELECT * 
               FROM " . FORUMS_TABLE . " 
               WHERE forum_id IN ($from_id, $to_id)"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql); 
            } 

            if($db->sql_numrows($result) != 2) 
            { 
               message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__); 
            } 
            $sql = "UPDATE " . TOPICS_TABLE . " 
               SET forum_id = $to_id 
               WHERE forum_id = $from_id"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $sql); 
            } 
            $sql = "UPDATE " . POSTS_TABLE . " 
               SET   forum_id = $to_id 
               WHERE forum_id = $from_id"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql); 
            } 
            sync('forum', $to_id); 
         } 

         // Alter Mod level if appropriate - 2.0.4 
         $sql = "SELECT ug.user_id 
            FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug 
            WHERE a.forum_id <> $from_id 
               AND a.auth_mod = 1 
               AND ug.group_id = a.group_id"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql); 
         } 

         if ($row = $db->sql_fetchrow($result)) 
         { 
            $user_ids = ''; 
            do 
            { 
               $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id']; 
            } 
            while ($row = $db->sql_fetchrow($result)); 

            $sql = "SELECT ug.user_id 
               FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug 
               WHERE a.forum_id = $from_id 
                  AND a.auth_mod = 1 
                  AND ug.group_id = a.group_id 
                  AND ug.user_id NOT IN ($user_ids)"; 
            if( !$result2 = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql); 
            } 
                
            if ($row = $db->sql_fetchrow($result2)) 
            { 
               $user_ids = ''; 
               do 
               { 
                  $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id']; 
               } 
               while ($row = $db->sql_fetchrow($result2)); 

               $sql = "UPDATE " . USERS_TABLE . " 
                  SET user_level = " . USER . " 
                  WHERE user_id IN ($user_ids) 
                     AND user_level <> " . ADMIN; 
               $db->sql_query($sql); 
            } 
            $db->sql_freeresult($result); 

         } 
         $db->sql_freeresult($result2); 

         $sql = "DELETE FROM " . FORUMS_TABLE . " 
            WHERE forum_id = $from_id"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql); 
         } 
// Begin Simple Subforums MOD 
// Move subforums to category 
$sql = "UPDATE " . FORUMS_TABLE . " SET forum_parent = '0' WHERE forum_parent = '$from_id'"; 
$db->sql_query($sql); 
// End Simple Subforums MOD
          
         $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " 
            WHERE forum_id = $from_id"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql); 
         } 
          
         $sql = "DELETE FROM " . PRUNE_TABLE . " 
            WHERE forum_id = $from_id"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql); 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 
          
      case 'deletecat': 
         // 
         // Show form to delete a category 
         // 
         $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]); 

         $buttonvalue = $lang['Move_and_Delete']; 
         $newmode = 'movedelcat'; 
         $catinfo = get_info('category', $cat_id); 
         $name = $catinfo['cat_title']; 

         if ($catinfo['number'] == 1) 
         { 
            $sql = "SELECT count(*) as total 
               FROM ". FORUMS_TABLE; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't get Forum count", "", __LINE__, __FILE__, $sql); 
            } 
            $count = $db->sql_fetchrow($result); 
            $count = $count['total']; 

            if ($count > 0) 
            { 
               message_die(GENERAL_ERROR, $lang['Must_delete_forums']); 
            } 
            else 
            { 
               $select_to = $lang['Nowhere_to_move']; 
            } 
         } 
         else 
         { 
            $select_to = '<select name="to_id">'; 
            $select_to .= get_list('category', $cat_id, 0); 
            $select_to .= '</select>'; 
         } 

         $template->set_filenames(array( 
            "body" => "admin/forum_delete_body.tpl") 
         ); 

         $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $cat_id . '" />'; 

         $template->assign_vars(array( 
            'NAME' => $name, 

            'L_FORUM_DELETE' => $lang['Forum_delete'], 
            'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'], 
            'L_MOVE_CONTENTS' => $lang['Move_contents'], 
            'L_FORUM_NAME' => $lang['Forum_name'], 
             
            'S_HIDDEN_FIELDS' => $s_hidden_fields, 
            'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
            'S_SELECT_TO' => $select_to, 
            'S_SUBMIT_VALUE' => $buttonvalue) 
         ); 

         $template->pparse("body"); 
         break; 

      case 'movedelcat': 
         // 
         // Move or delete a category in the DB 
         // 
         $from_id = intval($HTTP_POST_VARS['from_id']); 
         $to_id = intval($HTTP_POST_VARS['to_id']); 

         if (!empty($to_id)) 
         { 
            $sql = "SELECT * 
               FROM " . CATEGORIES_TABLE . " 
               WHERE cat_id IN ($from_id, $to_id)"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql); 
            } 
            if($db->sql_numrows($result) != 2) 
            { 
               message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__); 
            } 

            $sql = "UPDATE " . FORUMS_TABLE . " 
               SET cat_id = $to_id 
               WHERE cat_id = $from_id"; 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql); 
            } 
         } 

         $sql = "DELETE FROM " . CATEGORIES_TABLE ." 
            WHERE cat_id = $from_id"; 
             
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql); 
         } 

         $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); 

         message_die(GENERAL_MESSAGE, $message); 

         break; 

      case 'forum_order': 
         // 
         // Change order of forums in the DB 
         // 
         $move = intval($HTTP_GET_VARS['move']); 
         $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]); 

         $forum_info = get_info('forum', $forum_id); 

         $cat_id = $forum_info['cat_id'];
// Begin Simple Subforums MOD 
if( !$forum_info['forum_parent'] ) 
{ 
// Find previous/next forum 
if( $move > 0 ) 
{ 
$sql = "SELECT forum_id, forum_order FROM " . FORUMS_TABLE . " WHERE cat_id = '$cat_id' AND forum_parent = '0' AND forum_order > '" . $forum_info['forum_order'] . "' ORDER BY forum_order ASC"; 
} 

else 
{ 
$sql = "SELECT forum_id, forum_order FROM " . FORUMS_TABLE . " WHERE cat_id = '$cat_id' AND forum_parent = '0' AND forum_order < '" . $forum_info['forum_order'] . "' ORDER BY forum_order DESC"; 
} 

if( !($result = $db->sql_query($sql)) ) 
{ 
message_die(GENERAL_ERROR, "Couldn't change category order", '', __LINE__, __FILE__, $sql); 
} 

$row = $db->sql_fetchrow($result); 
$db->sql_freeresult($result); 
if($row !== false) 
{ 
// Swap forum orders 
$sql = "UPDATE " . FORUMS_TABLE . " SET forum_order = '" . $row['forum_order'] . "' WHERE forum_id = '$forum_id'"; 
$db->sql_query($sql); 

$sql = "UPDATE " . FORUMS_TABLE . " SET forum_order = '" . $forum_info['forum_order'] . "' WHERE forum_id = '" . $row['forum_id']; 
$db->sql_query($sql); 
} 
} 

else 
{ 
// End Simple Subforums MOD 

         $sql = "UPDATE " . FORUMS_TABLE . " 
            SET forum_order = forum_order + $move 
            WHERE forum_id = $forum_id"; 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql); 
         } 

         renumber_order('forum', $forum_info['cat_id']);
// Begin Simple Subforums MOD 
} 
// End Simple Subforums MOD
         $show_index = TRUE; 

         break; 
          
      case 'cat_order': 
         // 
         // Change order of categories in the DB 
         // 
         $move = intval($HTTP_GET_VARS['move']); 
         $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]); 

         $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'); 
         $show_index = TRUE; 

         break; 

      case 'forum_sync': 
         sync('forum', intval($HTTP_GET_VARS[POST_FORUM_URL])); 
         $show_index = TRUE; 

         break; 

      default: 
         message_die(GENERAL_MESSAGE, $lang['No_mode']); 
         break; 
   } 

   if ($show_index != TRUE) 
   { 
      include('./page_footer_admin.'.$phpEx); 
      exit; 
   } 
} 

// 
// Start page proper 
// 
$template->set_filenames(array( 
   "body" => "admin/forum_admin_body.tpl") 
); 

$template->assign_vars(array( 
   'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"), 
   'L_FORUM_TITLE' => $lang['Forum_admin'], 
   'L_FORUM_EXPLAIN' => $lang['Forum_admin_explain'], 
   'L_CREATE_FORUM' => $lang['Create_forum'], 
   'L_CREATE_CATEGORY' => $lang['Create_category'], 
   'L_EDIT' => $lang['Edit'], 
   'L_DELETE' => $lang['Delete'], 
   'L_MOVE_UP' => $lang['Move_up'], 
   'L_MOVE_DOWN' => $lang['Move_down'], 
   'L_RESYNC' => $lang['Resync']) 
); 

$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); 

   $sql = "SELECT * 
      FROM " . FORUMS_TABLE . " 
      ORDER BY cat_id, forum_order"; 
   if(!$q_forums = $db->sql_query($sql)) 
   { 
      message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql); 
   } 

   if( $total_forums = $db->sql_numrows($q_forums) ) 
   { 
      $forum_rows = $db->sql_fetchrowset($q_forums); 
   } 

   // 
   // Okay, let's build the index 
   // 
   $gen_cat = array(); 

   for($i = 0; $i < $total_categories; $i++) 
   { 
      $cat_id = $category_rows[$i]['cat_id']; 

      $template->assign_block_vars("catrow", array( 
         'S_ADD_FORUM_SUBMIT' => "addforum[$cat_id]", 
         'S_ADD_FORUM_NAME' => "forumname[$cat_id]", 

         'CAT_ID' => $cat_id, 
         'CAT_DESC' => $category_rows[$i]['cat_title'], 

         'U_CAT_EDIT' => append_sid("admin_forums.$phpEx?mode=editcat&" . POST_CAT_URL . "=$cat_id"), 
         'U_CAT_DELETE' => append_sid("admin_forums.$phpEx?mode=deletecat&" . POST_CAT_URL . "=$cat_id"), 
         'U_CAT_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=cat_order&move=-15&" . POST_CAT_URL . "=$cat_id"), 
         'U_CAT_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=cat_order&move=15&" . POST_CAT_URL . "=$cat_id"), 
         'U_VIEWCAT' => append_sid($phpbb_root_path."index.$phpEx?" . POST_CAT_URL . "=$cat_id")) 
      ); 

      for($j = 0; $j < $total_forums; $j++) 
      { 
         $forum_id = $forum_rows[$j]['forum_id']; 
          
         if ($forum_rows[$j]['cat_id'] == $cat_id && $forum_rows[$j]['forum_parent'] == 0) 
         { 

            $template->assign_block_vars("catrow.forumrow",   array( 
               'FORUM_NAME' => $forum_rows[$j]['forum_name'], 
               'FORUM_DESC' => $forum_rows[$j]['forum_desc'], 
               'ROW_COLOR' => $row_color, 
               'NUM_TOPICS' => $forum_rows[$j]['forum_topics'], 
               'NUM_POSTS' => $forum_rows[$j]['forum_posts'], 

               'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"), 
               'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id"), 
               'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id"), 
               'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id"), 
               'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id"), 
               'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id")) 
            );
// Begin Simple Subforums MOD 
for( $k = 0; $k < $total_forums; $k++ ) 
{ 
$forum_id2 = $forum_rows[$k]['forum_id']; 
if ( $forum_rows[$k]['forum_parent'] == $forum_id ) 
{ 
$template->assign_block_vars("catrow.forumrow", array( 
'FORUM_NAME' => $forum_rows[$k]['forum_name'], 
'FORUM_DESC' => $forum_rows[$k]['forum_desc'], 
'ROW_COLOR' => $row_color, 
'NUM_TOPICS' => $forum_rows[$k]['forum_topics'], 
'NUM_POSTS' => $forum_rows[$k]['forum_posts'], 
'STYLE' => ' style="padding-left: 20px;" ', 

'U_VIEWFORUM' => append_sid($phpbb_root_path."viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id2"), 
'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=$forum_id2"), 
'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&" . POST_FORUM_URL . "=$forum_id2"), 
'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&move=-15&" . POST_FORUM_URL . "=$forum_id2"), 
'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&move=15&" . POST_FORUM_URL . "=$forum_id2"), 
'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&" . POST_FORUM_URL . "=$forum_id2")) 
); 

} 

} // for ... forums 
// End Simple Subforums MOD

         }// if ... forumid == catid 
          
      } // for ... forums 

   } // for ... categories 

}// if ... total_categories 

$template->pparse("body"); 

include('./page_footer_admin.'.$phpEx); 

?>
Holger Gremminger
Ingen support via PM!
Skriv svar

Vilka är online

Användare som besöker denna kategori: 1 och 0 gäst