Можеш ли да слагаш icon папки във форума?

Проблеми, въпроси, модове и темплейти.
Post Reply
qnkovweb
Нов
Нов
Posts: 88
Joined: Wed Nov 06, 2013 6:04 pm

Можеш ли да слагаш icon папки във форума?

Post by qnkovweb » Tue Dec 31, 2013 4:55 pm

Как мога да си правя темите с някви снимки. Виждал съм разни форуми с разни картинки върху темите и някви такива. Къде точно от контрол панела мога да прикачвам такива работи.
Image
Ето там дето съм нарисувал да се сменят с някви икони.

User avatar
plamen_003
Турист
Турист
Posts: 494
Joined: Mon Nov 26, 2007 8:16 pm
Answers: 13
Location: София

Post by plamen_003 » Tue Dec 31, 2013 6:14 pm

От главната ти директория на форума влизаш в styles/името-на-темплейта/imageset и от там сменяш картинките.

User avatar
Msecurity
Потребител
Потребител
Posts: 753
Joined: Sat Sep 18, 2010 6:12 am
Answers: 19
Location: Варна

Post by Msecurity » Wed Jan 01, 2014 11:30 am

Ето готов модул за PHPBB3 - на всеки форум можеш да си слагаш произволна икона :)

Forum Icons Enhancement

qnkovweb
Нов
Нов
Posts: 88
Joined: Wed Nov 06, 2013 6:04 pm

Post by qnkovweb » Wed Jan 01, 2014 8:15 pm

Благодарим аз. Свеждаме проблемите до по-малко. Само сега ако мога и да разбера как да го инсталирам. :)

User avatar
Msecurity
Потребител
Потребител
Posts: 753
Joined: Sat Sep 18, 2010 6:12 am
Answers: 19
Location: Варна

Post by Msecurity » Wed Jan 01, 2014 9:56 pm

qnkovweb wrote:Благодарим аз. Свеждаме проблемите до по-малко. Само сега ако мога и да разбера как да го инсталирам. :)
Хоп свеждаме проблемите до 0 :D
Ето инструкция как се инсталира

Кои файлове добавяш, кой редактираш , какво им редактираш :P

qnkovweb
Нов
Нов
Posts: 88
Joined: Wed Nov 06, 2013 6:04 pm

Post by qnkovweb » Fri Jan 03, 2014 2:11 pm

Наистина проблемите се решиха, като че ли. :)

qnkovweb
Нов
Нов
Posts: 88
Joined: Wed Nov 06, 2013 6:04 pm

Post by qnkovweb » Fri Jan 03, 2014 4:47 pm

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/anisubs/public_html/forum/includes/acp/acp_forums.php on line 613

Дотук стигнах!

Code: Select all

<?php
/**
*
* @package acp
* @version $Id$
* @copyright &#40;c&#41; 2005 phpBB Group
* @license http&#58;//opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if &#40;!defined&#40;'IN_PHPBB'&#41;&#41;
&#123;
	exit;
&#125;

/**
* @package acp
*/
class acp_forums
&#123;
	var $u_action;
	var $parent_id = 0;

	function main&#40;$id, $mode&#41;
	&#123;
		global $db, $user, $auth, $template, $cache;
		global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;

		$user->add_lang&#40;'acp/forums'&#41;;
		$this->tpl_name = 'acp_forums';
		$this->page_title = 'ACP_MANAGE_FORUMS';

		$form_key = 'acp_forums';
		add_form_key&#40;$form_key&#41;;

		$action		= request_var&#40;'action', ''&#41;;
		$update		= &#40;isset&#40;$_POST&#91;'update'&#93;&#41;&#41; ? true &#58; false;
		$forum_id	= request_var&#40;'f', 0&#41;;

		$this->parent_id	= request_var&#40;'parent_id', 0&#41;;
		$forum_data = $errors = array&#40;&#41;;
		if &#40;$update && !check_form_key&#40;$form_key&#41;&#41;
		&#123;
			$update = false;
			$errors&#91;&#93; = $user->lang&#91;'FORM_INVALID'&#93;;
		&#125;

		// Check additional permissions
		switch &#40;$action&#41;
		&#123;
			case 'progress_bar'&#58;
				$start = request_var&#40;'start', 0&#41;;
				$total = request_var&#40;'total', 0&#41;;

				$this->display_progress_bar&#40;$start, $total&#41;;
				exit;
			break;

			case 'delete'&#58;

				if &#40;!$auth->acl_get&#40;'a_forumdel'&#41;&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_PERMISSION_FORUM_DELETE'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

			break;

			case 'add'&#58;

				if &#40;!$auth->acl_get&#40;'a_forumadd'&#41;&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_PERMISSION_FORUM_ADD'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

			break;
		&#125;

		// Major routines
		if &#40;$update&#41;
		&#123;
			switch &#40;$action&#41;
			&#123;
				case 'delete'&#58;
					$action_subforums	= request_var&#40;'action_subforums', ''&#41;;
					$subforums_to_id	= request_var&#40;'subforums_to_id', 0&#41;;
					$action_posts		= request_var&#40;'action_posts', ''&#41;;
					$posts_to_id		= request_var&#40;'posts_to_id', 0&#41;;

					$errors = $this->delete_forum&#40;$forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id&#41;;

					if &#40;sizeof&#40;$errors&#41;&#41;
					&#123;
						break;
					&#125;

					$auth->acl_clear_prefetch&#40;&#41;;
					$cache->destroy&#40;'sql', FORUMS_TABLE&#41;;

					trigger_error&#40;$user->lang&#91;'FORUM_DELETED'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;&#41;;

				break;

				case 'edit'&#58;
					$forum_data = array&#40;
						'forum_id'		=>	$forum_id
					&#41;;

				// No break here

				case 'add'&#58;

					$forum_data += array&#40;
						'parent_id'				=> request_var&#40;'forum_parent_id', $this->parent_id&#41;,
						'forum_type'			=> request_var&#40;'forum_type', FORUM_POST&#41;,
						'type_action'			=> request_var&#40;'type_action', ''&#41;,
						'forum_status'			=> request_var&#40;'forum_status', ITEM_UNLOCKED&#41;,
						'forum_parents'			=> '',
						'forum_name'			=> utf8_normalize_nfc&#40;request_var&#40;'forum_name', '', true&#41;&#41;,
						'forum_link'			=> request_var&#40;'forum_link', ''&#41;,
						'forum_link_track'		=> request_var&#40;'forum_link_track', false&#41;,
						'forum_desc'			=> utf8_normalize_nfc&#40;request_var&#40;'forum_desc', '', true&#41;&#41;,
						'forum_desc_uid'		=> '',
						'forum_desc_options'	=> 7,
						'forum_desc_bitfield'	=> '',
						'forum_rules'			=> utf8_normalize_nfc&#40;request_var&#40;'forum_rules', '', true&#41;&#41;,
						'forum_rules_uid'		=> '',
						'forum_rules_options'	=> 7,
						'forum_rules_bitfield'	=> '',
						'forum_rules_link'		=> request_var&#40;'forum_rules_link', ''&#41;,
						'forum_image'			=> request_var&#40;'forum_image', ''&#41;,
						'forum_style'			=> request_var&#40;'forum_style', 0&#41;,
						'display_subforum_list'	=> request_var&#40;'display_subforum_list', false&#41;,
						'display_on_index'		=> request_var&#40;'display_on_index', false&#41;,
						'forum_topics_per_page'	=> request_var&#40;'topics_per_page', 0&#41;,
						'enable_indexing'		=> request_var&#40;'enable_indexing', true&#41;,
						'enable_icons'			=> request_var&#40;'enable_icons', false&#41;,
						'enable_prune'			=> request_var&#40;'enable_prune', false&#41;,
						'enable_post_review'	=> request_var&#40;'enable_post_review', true&#41;,
						'enable_quick_reply'	=> request_var&#40;'enable_quick_reply', false&#41;,
						'prune_days'			=> request_var&#40;'prune_days', 7&#41;,
						'prune_viewed'			=> request_var&#40;'prune_viewed', 7&#41;,
						'prune_freq'			=> request_var&#40;'prune_freq', 1&#41;,
						'prune_old_polls'		=> request_var&#40;'prune_old_polls', false&#41;,
						'prune_announce'		=> request_var&#40;'prune_announce', false&#41;,
						'prune_sticky'			=> request_var&#40;'prune_sticky', false&#41;,
						'forum_password'		=> request_var&#40;'forum_password', '', true&#41;,
						'forum_password_confirm'=> request_var&#40;'forum_password_confirm', '', true&#41;,
						'forum_password_unset'	=> request_var&#40;'forum_password_unset', false&#41;,
					&#41;;

					// On add, add empty forum_options... else do not consider it &#40;not updating it&#41;
					if &#40;$action == 'add'&#41;
					&#123;
						$forum_data&#91;'forum_options'&#93; = 0;
					&#125;

					// Use link_display_on_index setting if forum type is link
					if &#40;$forum_data&#91;'forum_type'&#93; == FORUM_LINK&#41;
					&#123;
						$forum_data&#91;'display_on_index'&#93; = request_var&#40;'link_display_on_index', false&#41;;
					&#125;

					// Linked forums and categories are not able to be locked...
					if &#40;$forum_data&#91;'forum_type'&#93; == FORUM_LINK || $forum_data&#91;'forum_type'&#93; == FORUM_CAT&#41;
					&#123;
						$forum_data&#91;'forum_status'&#93; = ITEM_UNLOCKED;
					&#125;

					$forum_data&#91;'show_active'&#93; = &#40;$forum_data&#91;'forum_type'&#93; == FORUM_POST&#41; ? request_var&#40;'display_recent', true&#41; &#58; request_var&#40;'display_active', false&#41;;

					// Get data for forum rules if specified...
					if &#40;$forum_data&#91;'forum_rules'&#93;&#41;
					&#123;
						generate_text_for_storage&#40;$forum_data&#91;'forum_rules'&#93;, $forum_data&#91;'forum_rules_uid'&#93;, $forum_data&#91;'forum_rules_bitfield'&#93;, $forum_data&#91;'forum_rules_options'&#93;, request_var&#40;'rules_parse_bbcode', false&#41;, request_var&#40;'rules_parse_urls', false&#41;, request_var&#40;'rules_parse_smilies', false&#41;&#41;;
					&#125;

					// Get data for forum description if specified
					if &#40;$forum_data&#91;'forum_desc'&#93;&#41;
					&#123;
						generate_text_for_storage&#40;$forum_data&#91;'forum_desc'&#93;, $forum_data&#91;'forum_desc_uid'&#93;, $forum_data&#91;'forum_desc_bitfield'&#93;, $forum_data&#91;'forum_desc_options'&#93;, request_var&#40;'desc_parse_bbcode', false&#41;, request_var&#40;'desc_parse_urls', false&#41;, request_var&#40;'desc_parse_smilies', false&#41;&#41;;
					&#125;

					$errors = $this->update_forum_data&#40;$forum_data&#41;;

					if &#40;!sizeof&#40;$errors&#41;&#41;
					&#123;
						$forum_perm_from = request_var&#40;'forum_perm_from', 0&#41;;
						$cache->destroy&#40;'sql', FORUMS_TABLE&#41;;

						$copied_permissions = false;
						// Copy permissions?
						if &#40;$forum_perm_from && $forum_perm_from != $forum_data&#91;'forum_id'&#93; &&
							&#40;$action != 'edit' || empty&#40;$forum_id&#41; || &#40;$auth->acl_get&#40;'a_fauth'&#41; && $auth->acl_get&#40;'a_authusers'&#41; && $auth->acl_get&#40;'a_authgroups'&#41; && $auth->acl_get&#40;'a_mauth'&#41;&#41;&#41;&#41;
						&#123;
							copy_forum_permissions&#40;$forum_perm_from, $forum_data&#91;'forum_id'&#93;, &#40;$action == 'edit'&#41; ? true &#58; false&#41;;
							cache_moderators&#40;&#41;;
							$copied_permissions = true;
						&#125;
/* Commented out because of questionable UI workflow - re-visit for 3.0.7
						else if &#40;!$this->parent_id && $action != 'edit' && $auth->acl_get&#40;'a_fauth'&#41; && $auth->acl_get&#40;'a_authusers'&#41; && $auth->acl_get&#40;'a_authgroups'&#41; && $auth->acl_get&#40;'a_mauth'&#41;&#41;
						&#123;
							$this->copy_permission_page&#40;$forum_data&#41;;
							return;
						&#125;
*/
						$auth->acl_clear_prefetch&#40;&#41;;

						$acl_url = '&amp;mode=setting_forum_local&amp;forum_id&#91;&#93;=' . $forum_data&#91;'forum_id'&#93;;

						$message = &#40;$action == 'add'&#41; ? $user->lang&#91;'FORUM_CREATED'&#93; &#58; $user->lang&#91;'FORUM_UPDATED'&#93;;

						// Redirect to permissions
						if &#40;$auth->acl_get&#40;'a_fauth'&#41; && !$copied_permissions&#41;
						&#123;
							$message .= '<br /><br />' . sprintf&#40;$user->lang&#91;'REDIRECT_ACL'&#93;, '<a href="' . append_sid&#40;"&#123;$phpbb_admin_path&#125;index.$phpEx", 'i=permissions' . $acl_url&#41; . '">', '</a>'&#41;;
						&#125;

						// redirect directly to permission settings screen if authed
						if &#40;$action == 'add' && !$copied_permissions && $auth->acl_get&#40;'a_fauth'&#41;&#41;
						&#123;
							meta_refresh&#40;4, append_sid&#40;"&#123;$phpbb_admin_path&#125;index.$phpEx", 'i=permissions' . $acl_url&#41;&#41;;
						&#125;

						trigger_error&#40;$message . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;&#41;;
					&#125;

				break;
			&#125;
		&#125;

		switch &#40;$action&#41;
		&#123;
			case 'move_up'&#58;
			case 'move_down'&#58;

				if &#40;!$forum_id&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				$sql = 'SELECT *
					FROM ' . FORUMS_TABLE . "
					WHERE forum_id = $forum_id";
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				$move_forum_name = $this->move_forum_by&#40;$row, $action, 1&#41;;

				if &#40;$move_forum_name !== false&#41;
				&#123;
					add_log&#40;'admin', 'LOG_FORUM_' . strtoupper&#40;$action&#41;, $row&#91;'forum_name'&#93;, $move_forum_name&#41;;
					$cache->destroy&#40;'sql', FORUMS_TABLE&#41;;
				&#125;

			break;

			case 'sync'&#58;
				if &#40;!$forum_id&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				@set_time_limit&#40;0&#41;;

				$sql = 'SELECT forum_name, forum_topics_real
					FROM ' . FORUMS_TABLE . "
					WHERE forum_id = $forum_id";
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				if &#40;$row&#91;'forum_topics_real'&#93;&#41;
				&#123;
					$sql = 'SELECT MIN&#40;topic_id&#41; as min_topic_id, MAX&#40;topic_id&#41; as max_topic_id
						FROM ' . TOPICS_TABLE . '
						WHERE forum_id = ' . $forum_id;
					$result = $db->sql_query&#40;$sql&#41;;
					$row2 = $db->sql_fetchrow&#40;$result&#41;;
					$db->sql_freeresult&#40;$result&#41;;

					// Typecast to int if there is no data available
					$row2&#91;'min_topic_id'&#93; = &#40;int&#41; $row2&#91;'min_topic_id'&#93;;
					$row2&#91;'max_topic_id'&#93; = &#40;int&#41; $row2&#91;'max_topic_id'&#93;;

					$start = request_var&#40;'start', $row2&#91;'min_topic_id'&#93;&#41;;

					$batch_size = 2000;
					$end = $start + $batch_size;

					// Sync all topics in batch mode...
					sync&#40;'topic_approved', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, false&#41;;
					sync&#40;'topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true&#41;;

					if &#40;$end < $row2&#91;'max_topic_id'&#93;&#41;
					&#123;
						// We really need to find a way of showing statistics... no progress here
						$sql = 'SELECT COUNT&#40;topic_id&#41; as num_topics
							FROM ' . TOPICS_TABLE . '
							WHERE forum_id = ' . $forum_id . '
								AND topic_id BETWEEN ' . $start . ' AND ' . $end;
						$result = $db->sql_query&#40;$sql&#41;;
						$topics_done = request_var&#40;'topics_done', 0&#41; + &#40;int&#41; $db->sql_fetchfield&#40;'num_topics'&#41;;
						$db->sql_freeresult&#40;$result&#41;;

						$start += $batch_size;

						$url = $this->u_action . "&amp;parent_id=&#123;$this->parent_id&#125;&amp;f=$forum_id&amp;action=sync&amp;start=$start&amp;topics_done=$topics_done&amp;total=&#123;$row&#91;'forum_topics_real'&#93;&#125;";

						meta_refresh&#40;0, $url&#41;;

						$template->assign_vars&#40;array&#40;
							'U_PROGRESS_BAR'		=> $this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total=&#123;$row&#91;'forum_topics_real'&#93;&#125;",
							'UA_PROGRESS_BAR'		=> addslashes&#40;$this->u_action . "&amp;action=progress_bar&amp;start=$topics_done&amp;total=&#123;$row&#91;'forum_topics_real'&#93;&#125;"&#41;,
							'S_CONTINUE_SYNC'		=> true,
							'L_PROGRESS_EXPLAIN'	=> sprintf&#40;$user->lang&#91;'SYNC_IN_PROGRESS_EXPLAIN'&#93;, $topics_done, $row&#91;'forum_topics_real'&#93;&#41;&#41;
						&#41;;

						return;
					&#125;
				&#125;

				$url = $this->u_action . "&amp;parent_id=&#123;$this->parent_id&#125;&amp;f=$forum_id&amp;action=sync_forum";
				meta_refresh&#40;0, $url&#41;;

				$template->assign_vars&#40;array&#40;
					'U_PROGRESS_BAR'		=> $this->u_action . '&amp;action=progress_bar',
					'UA_PROGRESS_BAR'		=> addslashes&#40;$this->u_action . '&amp;action=progress_bar'&#41;,
					'S_CONTINUE_SYNC'		=> true,
					'L_PROGRESS_EXPLAIN'	=> sprintf&#40;$user->lang&#91;'SYNC_IN_PROGRESS_EXPLAIN'&#93;, 0, $row&#91;'forum_topics_real'&#93;&#41;&#41;
				&#41;;

				return;

			break;

			case 'sync_forum'&#58;

				$sql = 'SELECT forum_name, forum_type
					FROM ' . FORUMS_TABLE . "
					WHERE forum_id = $forum_id";
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				sync&#40;'forum', 'forum_id', $forum_id, false, true&#41;;

				add_log&#40;'admin', 'LOG_FORUM_SYNC', $row&#91;'forum_name'&#93;&#41;;
				$cache->destroy&#40;'sql', FORUMS_TABLE&#41;;

				$template->assign_var&#40;'L_FORUM_RESYNCED', sprintf&#40;$user->lang&#91;'FORUM_RESYNCED'&#93;, $row&#91;'forum_name'&#93;&#41;&#41;;

			break;

			case 'add'&#58;
			case 'edit'&#58;

				if &#40;$update&#41;
				&#123;
					$forum_data&#91;'forum_flags'&#93; = 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'forum_link_track', false&#41;&#41; ? FORUM_FLAG_LINK_TRACK &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'prune_old_polls', false&#41;&#41; ? FORUM_FLAG_PRUNE_POLL &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'prune_announce', false&#41;&#41; ? FORUM_FLAG_PRUNE_ANNOUNCE &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'prune_sticky', false&#41;&#41; ? FORUM_FLAG_PRUNE_STICKY &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'show_active'&#93;&#41; ? FORUM_FLAG_ACTIVE_TOPICS &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'enable_post_review', true&#41;&#41; ? FORUM_FLAG_POST_REVIEW &#58; 0;
					$forum_data&#91;'forum_flags'&#93; += &#40;request_var&#40;'enable_quick_reply', false&#41;&#41; ? FORUM_FLAG_QUICK_REPLY &#58; 0;
				&#125;

				// Show form to create/modify a forum
				if &#40;$action == 'edit'&#41;
				&#123;
					$this->page_title = 'EDIT_FORUM';
					$row = $this->get_forum_info&#40;$forum_id&#41;;
					$old_forum_type = $row&#91;'forum_type'&#93;;

					if &#40;!$update&#41;
					&#123;
						$forum_data = $row;
					&#125;
					else
					&#123;
						$forum_data&#91;'left_id'&#93; = $row&#91;'left_id'&#93;;
						$forum_data&#91;'right_id'&#93; = $row&#91;'right_id'&#93;;
					&#125;

					// Make sure no direct child forums are able to be selected as parents.
					$exclude_forums = array&#40;&#41;;
					foreach &#40;get_forum_branch&#40;$forum_id, 'children'&#41; as $row&#41;
					&#123;
						$exclude_forums&#91;&#93; = $row&#91;'forum_id'&#93;;
					&#125;

					$parents_list = make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $exclude_forums, false, false, false&#41;;

					$forum_data&#91;'forum_password_confirm'&#93; = $forum_data&#91;'forum_password'&#93;;
				&#125;
				else
				&#123;
					$this->page_title = 'CREATE_FORUM';

					$forum_id = $this->parent_id;
					$parents_list = make_forum_select&#40;$this->parent_id, false, false, false, false&#41;;

					// Fill forum data with default values
					if &#40;!$update&#41;
					&#123;
						$forum_data = array&#40;
							'parent_id'				=> $this->parent_id,
							'forum_type'			=> FORUM_POST,
							'forum_status'			=> ITEM_UNLOCKED,
							'forum_name'			=> utf8_normalize_nfc&#40;request_var&#40;'forum_name', '', true&#41;&#41;,
							'forum_link'			=> '',
							'forum_link_track'		=> false,
							'forum_desc'			=> '',
							'forum_rules'			=> '',
							'forum_rules_link'		=> '',
							'forum_image'			=> '',
							'forum_style'			=> 0,
							'display_subforum_list'	=> true,
							'display_on_index'		=> false,
							'forum_topics_per_page'	=> 0,
							'enable_indexing'		=> true,
							'enable_icons'			=> false,
							'enable_prune'			=> false,
							'prune_days'			=> 7,
							'prune_viewed'			=> 7,
							'prune_freq'			=> 1,
							'forum_flags'			=> FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS,
							'forum_options'			=> 0,
							'forum_password'		=> '',
							'forum_password_confirm'=> '',
						&#41;;
					&#125;
				&#125;

				$forum_rules_data = array&#40;
					'text'			=> $forum_data&#91;'forum_rules'&#93;,
					'allow_bbcode'	=> true,
					'allow_smilies'	=> true,
					'allow_urls'	=> true
				&#41;;

				$forum_desc_data = array&#40;
					'text'			=> $forum_data&#91;'forum_desc'&#93;,
					'allow_bbcode'	=> true,
					'allow_smilies'	=> true,
					'allow_urls'	=> true
				&#41;;

				$forum_rules_preview = '';

				// Parse rules if specified
				if &#40;$forum_data&#91;'forum_rules'&#93;&#41;
				&#123;
					if &#40;!isset&#40;$forum_data&#91;'forum_rules_uid'&#93;&#41;&#41;
					&#123;
						// Before we are able to display the preview and plane text, we need to parse our request_var&#40;&#41;'d value...
						$forum_data&#91;'forum_rules_uid'&#93; = '';
						$forum_data&#91;'forum_rules_bitfield'&#93; = '';
						$forum_data&#91;'forum_rules_options'&#93; = 0;

						generate_text_for_storage&#40;$forum_data&#91;'forum_rules'&#93;, $forum_data&#91;'forum_rules_uid'&#93;, $forum_data&#91;'forum_rules_bitfield'&#93;, $forum_data&#91;'forum_rules_options'&#93;, request_var&#40;'rules_allow_bbcode', false&#41;, request_var&#40;'rules_allow_urls', false&#41;, request_var&#40;'rules_allow_smilies', false&#41;&#41;;
					&#125;

					// Generate preview content
					$forum_rules_preview = generate_text_for_display&#40;$forum_data&#91;'forum_rules'&#93;, $forum_data&#91;'forum_rules_uid'&#93;, $forum_data&#91;'forum_rules_bitfield'&#93;, $forum_data&#91;'forum_rules_options'&#93;&#41;;

					// decode...
					$forum_rules_data = generate_text_for_edit&#40;$forum_data&#91;'forum_rules'&#93;, $forum_data&#91;'forum_rules_uid'&#93;, $forum_data&#91;'forum_rules_options'&#93;&#41;;
				&#125;

				// Parse desciption if specified
				if &#40;$forum_data&#91;'forum_desc'&#93;&#41;
				&#123;
					if &#40;!isset&#40;$forum_data&#91;'forum_desc_uid'&#93;&#41;&#41;
					&#123;
						// Before we are able to display the preview and plane text, we need to parse our request_var&#40;&#41;'d value...
						$forum_data&#91;'forum_desc_uid'&#93; = '';
						$forum_data&#91;'forum_desc_bitfield'&#93; = '';
						$forum_data&#91;'forum_desc_options'&#93; = 0;

						generate_text_for_storage&#40;$forum_data&#91;'forum_desc'&#93;, $forum_data&#91;'forum_desc_uid'&#93;, $forum_data&#91;'forum_desc_bitfield'&#93;, $forum_data&#91;'forum_desc_options'&#93;, request_var&#40;'desc_allow_bbcode', false&#41;, request_var&#40;'desc_allow_urls', false&#41;, request_var&#40;'desc_allow_smilies', false&#41;&#41;;
					&#125;

					// decode...
					$forum_desc_data = generate_text_for_edit&#40;$forum_data&#91;'forum_desc'&#93;, $forum_data&#91;'forum_desc_uid'&#93;, $forum_data&#91;'forum_desc_options'&#93;&#41;;
				&#125;

				$forum_type_options = '';
				$forum_type_ary = array&#40;FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'&#41;;

				foreach &#40;$forum_type_ary as $value => $lang&#41;
				&#123;
					$forum_type_options .= '<option value="' . $value . '"' . &#40;&#40;$value == $forum_data&#91;'forum_type'&#93;&#41; ? ' selected="selected"' &#58; ''&#41; . '>' . $user->lang&#91;'TYPE_' . $lang&#93; . '</option>';
				&#125;

				$styles_list = style_select&#40;$forum_data&#91;'forum_style'&#93;, true&#41;;

				$statuslist = '<option value="' . ITEM_UNLOCKED . '"' . &#40;&#40;$forum_data&#91;'forum_status'&#93; == ITEM_UNLOCKED&#41; ? ' selected="selected"' &#58; ''&#41; . '>' . $user->lang&#91;'UNLOCKED'&#93; . '</option><option value="' . ITEM_LOCKED . '"' . &#40;&#40;$forum_data&#91;'forum_status'&#93; == ITEM_LOCKED&#41; ? ' selected="selected"' &#58; ''&#41; . '>' . $user->lang&#91;'LOCKED'&#93; . '</option>';

				$sql = 'SELECT forum_id
					FROM ' . FORUMS_TABLE . '
					WHERE forum_type = ' . FORUM_POST . "
						AND forum_id <> $forum_id";
				$result = $db->sql_query_limit&#40;$sql, 1&#41;;

				$postable_forum_exists = false;
				if &#40;$db->sql_fetchrow&#40;$result&#41;&#41;
				&#123;
					$postable_forum_exists = true;
				&#125;
				$db->sql_freeresult&#40;$result&#41;;

				// Subforum move options
				if &#40;$action == 'edit' && $forum_data&#91;'forum_type'&#93; == FORUM_CAT&#41;
				&#123;
					$subforums_id = array&#40;&#41;;
					$subforums = get_forum_branch&#40;$forum_id, 'children'&#41;;

					foreach &#40;$subforums as $row&#41;
					&#123;
						$subforums_id&#91;&#93; = $row&#91;'forum_id'&#93;;
					&#125;

					$forums_list = make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $subforums_id&#41;;

					if &#40;$postable_forum_exists&#41;
					&#123;
						$template->assign_vars&#40;array&#40;
							'S_MOVE_FORUM_OPTIONS'		=> make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $subforums_id&#41;&#41; // , false, true, false???
						&#41;;
					&#125;

					$template->assign_vars&#40;array&#40;
						'S_HAS_SUBFORUMS'		=> &#40;$forum_data&#91;'right_id'&#93; - $forum_data&#91;'left_id'&#93; > 1&#41; ? true &#58; false,
						'S_FORUMS_LIST'			=> $forums_list&#41;
					&#41;;
				&#125;
				else if &#40;$postable_forum_exists&#41;
				&#123;
					$template->assign_vars&#40;array&#40;
						'S_MOVE_FORUM_OPTIONS'		=> make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $forum_id, false, true, false&#41;&#41;
					&#41;;
				&#125;

				$s_show_display_on_index = false;

				if &#40;$forum_data&#91;'parent_id'&#93; > 0&#41;
				&#123;
					// if this forum is a subforum put the "display on index" checkbox
					if &#40;$parent_info = $this->get_forum_info&#40;$forum_data&#91;'parent_id'&#93;&#41;&#41;
					&#123;
						if &#40;$parent_info&#91;'parent_id'&#93; > 0 || $parent_info&#91;'forum_type'&#93; == FORUM_CAT&#41;
						&#123;
							$s_show_display_on_index = true;
						&#125;
					&#125;
				&#125;

				if &#40;strlen&#40;$forum_data&#91;'forum_password'&#93;&#41; == 32&#41;
				&#123;
					$errors&#91;&#93; = $user->lang&#91;'FORUM_PASSWORD_OLD'&#93;;
				&#125;

		// Start mod list forum_images from kiss engine copyright 2007 phpbbireland.com //
				$dirslist = ' ';

				if &#40;!file_exists&#40;$phpbb_root_path . 'images/forum_icons'&#41;&#41;
				&#123;
					trigger_error&#40;sprintf&#40;$user->lang&#91;'MISSING_FILE_OR_FOLDER'&#93;, $file&#41;&#41;;
				&#125;

				$dirs = dir&#40;$phpbb_root_path . 'images/forum_icons'&#41;;
				while &#40;$file = $dirs->read&#40;&#41;&#41;
				&#123;
					if &#40;stripos&#40;$file, ".gif"&#41; ||  stripos&#40;$file, ".png"&#41;&#41;
					&#123;
						$dirslist .= "$file ";
					&#125;
				&#125;
				closedir&#40;$dirs->handle&#41;;
				$dirslist = explode&#40;" ", $dirslist&#41;;
				sort&#40;$dirslist&#41;;

				for &#40;$i = 0; $i < sizeof&#40;$dirslist&#41;; $i++&#41;
				&#123;
					if &#40;$dirslist&#91;$i&#93; != ''&#41;
					&#123;
						$template->assign_block_vars&#40;'forum_img_file_name', array&#40;'FORUM_IMAGE_OPT' => $dirslist&#91;$i&#93;&#41;&#41;;
					&#125;
				&#125;
				$dirslist = '';
				// End mod list forum_images from kiss engine code //		$template->assign_vars&#40;array&#40;
					'S_EDIT_FORUM'		=> true,
					'S_ERROR'			=> &#40;sizeof&#40;$errors&#41;&#41; ? true &#58; false,
					'S_PARENT_ID'		=> $this->parent_id,
					'S_FORUM_PARENT_ID'	=> $forum_data&#91;'parent_id'&#93;,
					'S_ADD_ACTION'		=> &#40;$action == 'add'&#41; ? true &#58; false,

					'U_BACK'		=> $this->u_action . '&amp;parent_id=' . $this->parent_id,
					'U_EDIT_ACTION'	=> $this->u_action . "&amp;parent_id=&#123;$this->parent_id&#125;&amp;action=$action&amp;f=$forum_id",

					'L_COPY_PERMISSIONS_EXPLAIN'	=> $user->lang&#91;'COPY_PERMISSIONS_' . strtoupper&#40;$action&#41; . '_EXPLAIN'&#93;,
					'L_TITLE'						=> $user->lang&#91;$this->page_title&#93;,
					'ERROR_MSG'						=> &#40;sizeof&#40;$errors&#41;&#41; ? implode&#40;'<br />', $errors&#41; &#58; '',

					'FORUM_NAME'				=> $forum_data&#91;'forum_name'&#93;,
					'FORUM_DATA_LINK'			=> $forum_data&#91;'forum_link'&#93;,
					'FORUM_IMAGE'				=> $forum_data&#91;'forum_image'&#93;,
					'FORUM_IMAGE_SRC'			=> &#40;$forum_data&#91;'forum_image'&#93;&#41; ? $phpbb_root_path . $forum_data&#91;'forum_image'&#93; &#58; '',
		'FORUM_IMAGE_SRC_PATH'			=> $phpbb_root_path . 'images/forum_icons/',
					'FORUM_IMAGE_PATH'			=> 'images/forum_icons/',			'FORUM_POST'				=> FORUM_POST,
					'FORUM_LINK'				=> FORUM_LINK,
					'FORUM_CAT'					=> FORUM_CAT,
					'PRUNE_FREQ'				=> $forum_data&#91;'prune_freq'&#93;,
					'PRUNE_DAYS'				=> $forum_data&#91;'prune_days'&#93;,
					'PRUNE_VIEWED'				=> $forum_data&#91;'prune_viewed'&#93;,
					'TOPICS_PER_PAGE'			=> $forum_data&#91;'forum_topics_per_page'&#93;,
					'FORUM_RULES_LINK'			=> $forum_data&#91;'forum_rules_link'&#93;,
					'FORUM_RULES'				=> $forum_data&#91;'forum_rules'&#93;,
					'FORUM_RULES_PREVIEW'		=> $forum_rules_preview,
					'FORUM_RULES_PLAIN'			=> $forum_rules_data&#91;'text'&#93;,
					'S_BBCODE_CHECKED'			=> &#40;$forum_rules_data&#91;'allow_bbcode'&#93;&#41; ? true &#58; false,
					'S_SMILIES_CHECKED'			=> &#40;$forum_rules_data&#91;'allow_smilies'&#93;&#41; ? true &#58; false,
					'S_URLS_CHECKED'			=> &#40;$forum_rules_data&#91;'allow_urls'&#93;&#41; ? true &#58; false,
					'S_FORUM_PASSWORD_SET'		=> &#40;empty&#40;$forum_data&#91;'forum_password'&#93;&#41;&#41; ? false &#58; true,

					'FORUM_DESC'				=> $forum_desc_data&#91;'text'&#93;,
					'S_DESC_BBCODE_CHECKED'		=> &#40;$forum_desc_data&#91;'allow_bbcode'&#93;&#41; ? true &#58; false,
					'S_DESC_SMILIES_CHECKED'	=> &#40;$forum_desc_data&#91;'allow_smilies'&#93;&#41; ? true &#58; false,
					'S_DESC_URLS_CHECKED'		=> &#40;$forum_desc_data&#91;'allow_urls'&#93;&#41; ? true &#58; false,

					'S_FORUM_TYPE_OPTIONS'		=> $forum_type_options,
					'S_STATUS_OPTIONS'			=> $statuslist,
					'S_PARENT_OPTIONS'			=> $parents_list,
					'S_STYLES_OPTIONS'			=> $styles_list,
					'S_FORUM_OPTIONS'			=> make_forum_select&#40;&#40;$action == 'add'&#41; ? $forum_data&#91;'parent_id'&#93; &#58; false, &#40;$action == 'edit'&#41; ? $forum_data&#91;'forum_id'&#93; &#58; false, false, false, false&#41;,
					'S_SHOW_DISPLAY_ON_INDEX'	=> $s_show_display_on_index,
					'S_FORUM_POST'				=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_POST&#41; ? true &#58; false,
					'S_FORUM_ORIG_POST'			=> &#40;isset&#40;$old_forum_type&#41; && $old_forum_type == FORUM_POST&#41; ? true &#58; false,
					'S_FORUM_ORIG_CAT'			=> &#40;isset&#40;$old_forum_type&#41; && $old_forum_type == FORUM_CAT&#41; ? true &#58; false,
					'S_FORUM_ORIG_LINK'			=> &#40;isset&#40;$old_forum_type&#41; && $old_forum_type == FORUM_LINK&#41; ? true &#58; false,
					'S_FORUM_LINK'				=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_LINK&#41; ? true &#58; false,
					'S_FORUM_CAT'				=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_CAT&#41; ? true &#58; false,
					'S_ENABLE_INDEXING'			=> &#40;$forum_data&#91;'enable_indexing'&#93;&#41; ? true &#58; false,
					'S_TOPIC_ICONS'				=> &#40;$forum_data&#91;'enable_icons'&#93;&#41; ? true &#58; false,
					'S_DISPLAY_SUBFORUM_LIST'	=> &#40;$forum_data&#91;'display_subforum_list'&#93;&#41; ? true &#58; false,
					'S_DISPLAY_ON_INDEX'		=> &#40;$forum_data&#91;'display_on_index'&#93;&#41; ? true &#58; false,
					'S_PRUNE_ENABLE'			=> &#40;$forum_data&#91;'enable_prune'&#93;&#41; ? true &#58; false,
					'S_FORUM_LINK_TRACK'		=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_LINK_TRACK&#41; ? true &#58; false,
					'S_PRUNE_OLD_POLLS'			=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_PRUNE_POLL&#41; ? true &#58; false,
					'S_PRUNE_ANNOUNCE'			=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_PRUNE_ANNOUNCE&#41; ? true &#58; false,
					'S_PRUNE_STICKY'			=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_PRUNE_STICKY&#41; ? true &#58; false,
					'S_DISPLAY_ACTIVE_TOPICS'	=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_POST&#41; ? &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_ACTIVE_TOPICS&#41; &#58; true,
					'S_ENABLE_ACTIVE_TOPICS'	=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_CAT&#41; ? &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_ACTIVE_TOPICS&#41; &#58; false,
					'S_ENABLE_POST_REVIEW'		=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_POST_REVIEW&#41; ? true &#58; false,
					'S_ENABLE_QUICK_REPLY'		=> &#40;$forum_data&#91;'forum_flags'&#93; & FORUM_FLAG_QUICK_REPLY&#41; ? true &#58; false,
					'S_CAN_COPY_PERMISSIONS'	=> &#40;$action != 'edit' || empty&#40;$forum_id&#41; || &#40;$auth->acl_get&#40;'a_fauth'&#41; && $auth->acl_get&#40;'a_authusers'&#41; && $auth->acl_get&#40;'a_authgroups'&#41; && $auth->acl_get&#40;'a_mauth'&#41;&#41;&#41; ? true &#58; false,
				&#41;&#41;;

				return;

			break;

			case 'delete'&#58;

				if &#40;!$forum_id&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'NO_FORUM'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				$forum_data = $this->get_forum_info&#40;$forum_id&#41;;

				$subforums_id = array&#40;&#41;;
				$subforums = get_forum_branch&#40;$forum_id, 'children'&#41;;

				foreach &#40;$subforums as $row&#41;
				&#123;
					$subforums_id&#91;&#93; = $row&#91;'forum_id'&#93;;
				&#125;

				$forums_list = make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $subforums_id&#41;;

				$sql = 'SELECT forum_id
					FROM ' . FORUMS_TABLE . '
					WHERE forum_type = ' . FORUM_POST . "
						AND forum_id <> $forum_id";
				$result = $db->sql_query_limit&#40;$sql, 1&#41;;

				if &#40;$db->sql_fetchrow&#40;$result&#41;&#41;
				&#123;
					$template->assign_vars&#40;array&#40;
						'S_MOVE_FORUM_OPTIONS'		=> make_forum_select&#40;$forum_data&#91;'parent_id'&#93;, $subforums_id, false, true&#41;&#41; // , false, true, false???
					&#41;;
				&#125;
				$db->sql_freeresult&#40;$result&#41;;

				$parent_id = &#40;$this->parent_id == $forum_id&#41; ? 0 &#58; $this->parent_id;

				$template->assign_vars&#40;array&#40;
					'S_DELETE_FORUM'		=> true,
					'U_ACTION'				=> $this->u_action . "&amp;parent_id=&#123;$parent_id&#125;&amp;action=delete&amp;f=$forum_id",
					'U_BACK'				=> $this->u_action . '&amp;parent_id=' . $this->parent_id,

					'FORUM_NAME'			=> $forum_data&#91;'forum_name'&#93;,
					'S_FORUM_POST'			=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_POST&#41; ? true &#58; false,
					'S_FORUM_LINK'			=> &#40;$forum_data&#91;'forum_type'&#93; == FORUM_LINK&#41; ? true &#58; false,
					'S_HAS_SUBFORUMS'		=> &#40;$forum_data&#91;'right_id'&#93; - $forum_data&#91;'left_id'&#93; > 1&#41; ? true &#58; false,
					'S_FORUMS_LIST'			=> $forums_list,
					'S_ERROR'				=> &#40;sizeof&#40;$errors&#41;&#41; ? true &#58; false,
					'ERROR_MSG'				=> &#40;sizeof&#40;$errors&#41;&#41; ? implode&#40;'<br />', $errors&#41; &#58; ''&#41;
				&#41;;

				return;
			break;

			case 'copy_perm'&#58;
				$forum_perm_from = request_var&#40;'forum_perm_from', 0&#41;;

				// Copy permissions?
				if &#40;!empty&#40;$forum_perm_from&#41; && $forum_perm_from != $forum_id&#41;
				&#123;
					copy_forum_permissions&#40;$forum_perm_from, $forum_id, true&#41;;
					cache_moderators&#40;&#41;;
					$auth->acl_clear_prefetch&#40;&#41;;
					$cache->destroy&#40;'sql', FORUMS_TABLE&#41;;

					$acl_url = '&amp;mode=setting_forum_local&amp;forum_id&#91;&#93;=' . $forum_id;

					$message = $user->lang&#91;'FORUM_UPDATED'&#93;;

					// Redirect to permissions
					if &#40;$auth->acl_get&#40;'a_fauth'&#41;&#41;
					&#123;
						$message .= '<br /><br />' . sprintf&#40;$user->lang&#91;'REDIRECT_ACL'&#93;, '<a href="' . append_sid&#40;"&#123;$phpbb_admin_path&#125;index.$phpEx", 'i=permissions' . $acl_url&#41; . '">', '</a>'&#41;;
					&#125;

					trigger_error&#40;$message . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;&#41;;
				&#125;

			break;
		&#125;

		// Default management page
		if &#40;!$this->parent_id&#41;
		&#123;
			$navigation = $user->lang&#91;'FORUM_INDEX'&#93;;
		&#125;
		else
		&#123;
			$navigation = '<a href="' . $this->u_action . '">' . $user->lang&#91;'FORUM_INDEX'&#93; . '</a>';

			$forums_nav = get_forum_branch&#40;$this->parent_id, 'parents', 'descending'&#41;;
			foreach &#40;$forums_nav as $row&#41;
			&#123;
				if &#40;$row&#91;'forum_id'&#93; == $this->parent_id&#41;
				&#123;
					$navigation .= ' -&gt; ' . $row&#91;'forum_name'&#93;;
				&#125;
				else
				&#123;
					$navigation .= ' -&gt; <a href="' . $this->u_action . '&amp;parent_id=' . $row&#91;'forum_id'&#93; . '">' . $row&#91;'forum_name'&#93; . '</a>';
				&#125;
			&#125;
		&#125;

		// Jumpbox
		$forum_box = make_forum_select&#40;$this->parent_id, false, false, false, false&#41;; //make_forum_select&#40;$this->parent_id&#41;;

		if &#40;$action == 'sync' || $action == 'sync_forum'&#41;
		&#123;
			$template->assign_var&#40;'S_RESYNCED', true&#41;;
		&#125;

		$sql = 'SELECT *
			FROM ' . FORUMS_TABLE . "
			WHERE parent_id = $this->parent_id
			ORDER BY left_id";
		$result = $db->sql_query&#40;$sql&#41;;

		if &#40;$row = $db->sql_fetchrow&#40;$result&#41;&#41;
		&#123;
			do
			&#123;
				$forum_type = $row&#91;'forum_type'&#93;;

				if &#40;$row&#91;'forum_status'&#93; == ITEM_LOCKED&#41;
				&#123;
					$folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang&#91;'LOCKED'&#93; . '" />';
				&#125;
				else
				&#123;
					switch &#40;$forum_type&#41;
					&#123;
						case FORUM_LINK&#58;
							$folder_image = '<img src="images/icon_folder_link.gif" alt="' . $user->lang&#91;'LINK'&#93; . '" />';
						break;

						default&#58;
							$folder_image = &#40;$row&#91;'left_id'&#93; + 1 != $row&#91;'right_id'&#93;&#41; ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang&#91;'SUBFORUM'&#93; . '" />' &#58; '<img src="images/icon_folder.gif" alt="' . $user->lang&#91;'FOLDER'&#93; . '" />';
						break;
					&#125;
				&#125;

				$url = $this->u_action . "&amp;parent_id=$this->parent_id&amp;f=&#123;$row&#91;'forum_id'&#93;&#125;";

				$template->assign_block_vars&#40;'forums', array&#40;
					'FOLDER_IMAGE'		=> $folder_image,
					'FORUM_IMAGE'		=> &#40;$row&#91;'forum_image'&#93;&#41; ? '<img src="' . $phpbb_root_path . $row&#91;'forum_image'&#93; . '" alt="" />' &#58; '',
					'FORUM_IMAGE_SRC'	=> &#40;$row&#91;'forum_image'&#93;&#41; ? $phpbb_root_path . $row&#91;'forum_image'&#93; &#58; '',
					'FORUM_NAME'		=> $row&#91;'forum_name'&#93;,
					'FORUM_DESCRIPTION'	=> generate_text_for_display&#40;$row&#91;'forum_desc'&#93;, $row&#91;'forum_desc_uid'&#93;, $row&#91;'forum_desc_bitfield'&#93;, $row&#91;'forum_desc_options'&#93;&#41;,
					'FORUM_TOPICS'		=> $row&#91;'forum_topics'&#93;,
					'FORUM_POSTS'		=> $row&#91;'forum_posts'&#93;,

					'S_FORUM_LINK'		=> &#40;$forum_type == FORUM_LINK&#41; ? true &#58; false,
					'S_FORUM_POST'		=> &#40;$forum_type == FORUM_POST&#41; ? true &#58; false,

					'U_FORUM'			=> $this->u_action . '&amp;parent_id=' . $row&#91;'forum_id'&#93;,
					'U_MOVE_UP'			=> $url . '&amp;action=move_up',
					'U_MOVE_DOWN'		=> $url . '&amp;action=move_down',
					'U_EDIT'			=> $url . '&amp;action=edit',
					'U_DELETE'			=> $url . '&amp;action=delete',
					'U_SYNC'			=> $url . '&amp;action=sync'&#41;
				&#41;;
			&#125;
			while &#40;$row = $db->sql_fetchrow&#40;$result&#41;&#41;;
		&#125;
		else if &#40;$this->parent_id&#41;
		&#123;
			$row = $this->get_forum_info&#40;$this->parent_id&#41;;

			$url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;f=' . $row&#91;'forum_id'&#93;;

			$template->assign_vars&#40;array&#40;
				'S_NO_FORUMS'		=> true,

				'U_EDIT'			=> $url . '&amp;action=edit',
				'U_DELETE'			=> $url . '&amp;action=delete',
				'U_SYNC'			=> $url . '&amp;action=sync'&#41;
			&#41;;
		&#125;
		$db->sql_freeresult&#40;$result&#41;;

		$template->assign_vars&#40;array&#40;
			'ERROR_MSG'		=> &#40;sizeof&#40;$errors&#41;&#41; ? implode&#40;'<br />', $errors&#41; &#58; '',
			'NAVIGATION'	=> $navigation,
			'FORUM_BOX'		=> $forum_box,
			'U_SEL_ACTION'	=> $this->u_action,
			'U_ACTION'		=> $this->u_action . '&amp;parent_id=' . $this->parent_id,

			'U_PROGRESS_BAR'	=> $this->u_action . '&amp;action=progress_bar',
			'UA_PROGRESS_BAR'	=> addslashes&#40;$this->u_action . '&amp;action=progress_bar'&#41;,
		&#41;&#41;;
	&#125;

	/**
	* Get forum details
	*/
	function get_forum_info&#40;$forum_id&#41;
	&#123;
		global $db;

		$sql = 'SELECT *
			FROM ' . FORUMS_TABLE . "
			WHERE forum_id = $forum_id";
		$result = $db->sql_query&#40;$sql&#41;;
		$row = $db->sql_fetchrow&#40;$result&#41;;
		$db->sql_freeresult&#40;$result&#41;;

		if &#40;!$row&#41;
		&#123;
			trigger_error&#40;"Forum #$forum_id does not exist", E_USER_ERROR&#41;;
		&#125;

		return $row;
	&#125;

	/**
	* Update forum data
	*/
	function update_forum_data&#40;&$forum_data&#41;
	&#123;
		global $db, $user, $cache, $phpbb_root_path;

		$errors = array&#40;&#41;;

		if &#40;!$forum_data&#91;'forum_name'&#93;&#41;
		&#123;
			$errors&#91;&#93; = $user->lang&#91;'FORUM_NAME_EMPTY'&#93;;
		&#125;

		if &#40;utf8_strlen&#40;$forum_data&#91;'forum_desc'&#93;&#41; > 4000&#41;
		&#123;
			$errors&#91;&#93; = $user->lang&#91;'FORUM_DESC_TOO_LONG'&#93;;
		&#125;

		if &#40;utf8_strlen&#40;$forum_data&#91;'forum_rules'&#93;&#41; > 4000&#41;
		&#123;
			$errors&#91;&#93; = $user->lang&#91;'FORUM_RULES_TOO_LONG'&#93;;
		&#125;

		if &#40;$forum_data&#91;'forum_password'&#93; || $forum_data&#91;'forum_password_confirm'&#93;&#41;
		&#123;
			if &#40;$forum_data&#91;'forum_password'&#93; != $forum_data&#91;'forum_password_confirm'&#93;&#41;
			&#123;
				$forum_data&#91;'forum_password'&#93; = $forum_data&#91;'forum_password_confirm'&#93; = '';
				$errors&#91;&#93; = $user->lang&#91;'FORUM_PASSWORD_MISMATCH'&#93;;
			&#125;
		&#125;

		if &#40;$forum_data&#91;'prune_days'&#93; < 0 || $forum_data&#91;'prune_viewed'&#93; < 0 || $forum_data&#91;'prune_freq'&#93; < 0&#41;
		&#123;
			$forum_data&#91;'prune_days'&#93; = $forum_data&#91;'prune_viewed'&#93; = $forum_data&#91;'prune_freq'&#93; = 0;
			$errors&#91;&#93; = $user->lang&#91;'FORUM_DATA_NEGATIVE'&#93;;
		&#125;

		$range_test_ary = array&#40;
			array&#40;'lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data&#91;'forum_topics_per_page'&#93;, 'column_type' => 'TINT&#58;0'&#41;,
		&#41;;

		if &#40;!empty&#40;$forum_data&#91;'forum_image'&#93;&#41; && !file_exists&#40;$phpbb_root_path . $forum_data&#91;'forum_image'&#93;&#41;&#41;
		&#123;
			$errors&#91;&#93; = $user->lang&#91;'FORUM_IMAGE_NO_EXIST'&#93;;
		&#125;

		validate_range&#40;$range_test_ary, $errors&#41;;

		// Set forum flags
		// 1 = link tracking
		// 2 = prune old polls
		// 4 = prune announcements
		// 8 = prune stickies
		// 16 = show active topics
		// 32 = enable post review
		$forum_data&#91;'forum_flags'&#93; = 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'forum_link_track'&#93;&#41; ? FORUM_FLAG_LINK_TRACK &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'prune_old_polls'&#93;&#41; ? FORUM_FLAG_PRUNE_POLL &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'prune_announce'&#93;&#41; ? FORUM_FLAG_PRUNE_ANNOUNCE &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'prune_sticky'&#93;&#41; ? FORUM_FLAG_PRUNE_STICKY &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'show_active'&#93;&#41; ? FORUM_FLAG_ACTIVE_TOPICS &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'enable_post_review'&#93;&#41; ? FORUM_FLAG_POST_REVIEW &#58; 0;
		$forum_data&#91;'forum_flags'&#93; += &#40;$forum_data&#91;'enable_quick_reply'&#93;&#41; ? FORUM_FLAG_QUICK_REPLY &#58; 0;

		// Unset data that are not database fields
		$forum_data_sql = $forum_data;

		unset&#40;$forum_data_sql&#91;'forum_link_track'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'prune_old_polls'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'prune_announce'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'prune_sticky'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'show_active'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'enable_post_review'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'enable_quick_reply'&#93;&#41;;
		unset&#40;$forum_data_sql&#91;'forum_password_confirm'&#93;&#41;;

		// What are we going to do tonight Brain? The same thing we do everynight,
		// try to take over the world ... or decide whether to continue update
		// and if so, whether it's a new forum/cat/link or an existing one
		if &#40;sizeof&#40;$errors&#41;&#41;
		&#123;
			return $errors;
		&#125;

		// As we don't know the old password, it's kinda tricky to detect changes
		if &#40;$forum_data_sql&#91;'forum_password_unset'&#93;&#41;
		&#123;
			$forum_data_sql&#91;'forum_password'&#93; = '';
		&#125;
		else if &#40;empty&#40;$forum_data_sql&#91;'forum_password'&#93;&#41;&#41;
		&#123;
			unset&#40;$forum_data_sql&#91;'forum_password'&#93;&#41;;
		&#125;
		else
		&#123;
			$forum_data_sql&#91;'forum_password'&#93; = phpbb_hash&#40;$forum_data_sql&#91;'forum_password'&#93;&#41;;
		&#125;
		unset&#40;$forum_data_sql&#91;'forum_password_unset'&#93;&#41;;

		if &#40;!isset&#40;$forum_data_sql&#91;'forum_id'&#93;&#41;&#41;
		&#123;
			// no forum_id means we're creating a new forum
			unset&#40;$forum_data_sql&#91;'type_action'&#93;&#41;;

			if &#40;$forum_data_sql&#91;'parent_id'&#93;&#41;
			&#123;
				$sql = 'SELECT left_id, right_id, forum_type
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $forum_data_sql&#91;'parent_id'&#93;;
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					trigger_error&#40;$user->lang&#91;'PARENT_NOT_EXIST'&#93; . adm_back_link&#40;$this->u_action . '&amp;parent_id=' . $this->parent_id&#41;, E_USER_WARNING&#41;;
				&#125;

				if &#40;$row&#91;'forum_type'&#93; == FORUM_LINK&#41;
				&#123;
					$errors&#91;&#93; = $user->lang&#91;'PARENT_IS_LINK_FORUM'&#93;;
					return $errors;
				&#125;

				$sql = 'UPDATE ' . FORUMS_TABLE . '
					SET left_id = left_id + 2, right_id = right_id + 2
					WHERE left_id > ' . $row&#91;'right_id'&#93;;
				$db->sql_query&#40;$sql&#41;;

				$sql = 'UPDATE ' . FORUMS_TABLE . '
					SET right_id = right_id + 2
					WHERE ' . $row&#91;'left_id'&#93; . ' BETWEEN left_id AND right_id';
				$db->sql_query&#40;$sql&#41;;

				$forum_data_sql&#91;'left_id'&#93; = $row&#91;'right_id'&#93;;
				$forum_data_sql&#91;'right_id'&#93; = $row&#91;'right_id'&#93; + 1;
			&#125;
			else
			&#123;
				$sql = 'SELECT MAX&#40;right_id&#41; AS right_id
					FROM ' . FORUMS_TABLE;
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				$forum_data_sql&#91;'left_id'&#93; = $row&#91;'right_id'&#93; + 1;
				$forum_data_sql&#91;'right_id'&#93; = $row&#91;'right_id'&#93; + 2;
			&#125;

			$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array&#40;'INSERT', $forum_data_sql&#41;;
			$db->sql_query&#40;$sql&#41;;

			$forum_data&#91;'forum_id'&#93; = $db->sql_nextid&#40;&#41;;

			add_log&#40;'admin', 'LOG_FORUM_ADD', $forum_data&#91;'forum_name'&#93;&#41;;
		&#125;
		else
		&#123;
			$row = $this->get_forum_info&#40;$forum_data_sql&#91;'forum_id'&#93;&#41;;

			if &#40;$row&#91;'forum_type'&#93; == FORUM_POST && $row&#91;'forum_type'&#93; != $forum_data_sql&#91;'forum_type'&#93;&#41;
			&#123;
				// Has subforums and want to change into a link?
				if &#40;$row&#91;'right_id'&#93; - $row&#91;'left_id'&#93; > 1 && $forum_data_sql&#91;'forum_type'&#93; == FORUM_LINK&#41;
				&#123;
					$errors&#91;&#93; = $user->lang&#91;'FORUM_WITH_SUBFORUMS_NOT_TO_LINK'&#93;;
					return $errors;
				&#125;

				// we're turning a postable forum into a non-postable forum
				if &#40;$forum_data_sql&#91;'type_action'&#93; == 'move'&#41;
				&#123;
					$to_forum_id = request_var&#40;'to_forum_id', 0&#41;;

					if &#40;$to_forum_id&#41;
					&#123;
						$errors = $this->move_forum_content&#40;$forum_data_sql&#91;'forum_id'&#93;, $to_forum_id&#41;;
					&#125;
					else
					&#123;
						return array&#40;$user->lang&#91;'NO_DESTINATION_FORUM'&#93;&#41;;
					&#125;
				&#125;
				else if &#40;$forum_data_sql&#91;'type_action'&#93; == 'delete'&#41;
				&#123;
					$errors = $this->delete_forum_content&#40;$forum_data_sql&#91;'forum_id'&#93;&#41;;
				&#125;
				else
				&#123;
					return array&#40;$user->lang&#91;'NO_FORUM_ACTION'&#93;&#41;;
				&#125;

				$forum_data_sql&#91;'forum_posts'&#93; = $forum_data_sql&#91;'forum_topics'&#93; = $forum_data_sql&#91;'forum_topics_real'&#93; = $forum_data_sql&#91;'forum_last_post_id'&#93; = $forum_data_sql&#91;'forum_last_poster_id'&#93; = $forum_data_sql&#91;'forum_last_post_time'&#93; = 0;
				$forum_data_sql&#91;'forum_last_poster_name'&#93; = $forum_data_sql&#91;'forum_last_poster_colour'&#93; = '';
			&#125;
			else if &#40;$row&#91;'forum_type'&#93; == FORUM_CAT && $forum_data_sql&#91;'forum_type'&#93; == FORUM_LINK&#41;
			&#123;
				// Has subforums?
				if &#40;$row&#91;'right_id'&#93; - $row&#91;'left_id'&#93; > 1&#41;
				&#123;
					// We are turning a category into a link - but need to decide what to do with the subforums.
					$action_subforums = request_var&#40;'action_subforums', ''&#41;;
					$subforums_to_id = request_var&#40;'subforums_to_id', 0&#41;;

					if &#40;$action_subforums == 'delete'&#41;
					&#123;
						$rows = get_forum_branch&#40;$row&#91;'forum_id'&#93;, 'children', 'descending', false&#41;;

						foreach &#40;$rows as $_row&#41;
						&#123;
							// Do not remove the forum id we are about to change. ;&#41;
							if &#40;$_row&#91;'forum_id'&#93; == $row&#91;'forum_id'&#93;&#41;
							&#123;
								continue;
							&#125;

							$forum_ids&#91;&#93; = $_row&#91;'forum_id'&#93;;
							$errors = array_merge&#40;$errors, $this->delete_forum_content&#40;$_row&#91;'forum_id'&#93;&#41;&#41;;
						&#125;

						if &#40;sizeof&#40;$errors&#41;&#41;
						&#123;
							return $errors;
						&#125;

						if &#40;sizeof&#40;$forum_ids&#41;&#41;
						&#123;
							$sql = 'DELETE FROM ' . FORUMS_TABLE . '
								WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
							$db->sql_query&#40;$sql&#41;;

							$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
								WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
							$db->sql_query&#40;$sql&#41;;

							$sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
								WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
							$db->sql_query&#40;$sql&#41;;

							// Delete forum ids from extension groups table
							$sql = 'SELECT group_id, allowed_forums
								FROM ' . EXTENSION_GROUPS_TABLE;
							$result = $db->sql_query&#40;$sql&#41;;

							while &#40;$_row = $db->sql_fetchrow&#40;$result&#41;&#41;
							&#123;
								if &#40;!$_row&#91;'allowed_forums'&#93;&#41;
								&#123;
									continue;
								&#125;

								$allowed_forums = unserialize&#40;trim&#40;$_row&#91;'allowed_forums'&#93;&#41;&#41;;
								$allowed_forums = array_diff&#40;$allowed_forums, $forum_ids&#41;;

								$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "
									SET allowed_forums = '" . &#40;&#40;sizeof&#40;$allowed_forums&#41;&#41; ? serialize&#40;$allowed_forums&#41; &#58; ''&#41; . "'
									WHERE group_id = &#123;$_row&#91;'group_id'&#93;&#125;";
								$db->sql_query&#40;$sql&#41;;
							&#125;
							$db->sql_freeresult&#40;$result&#41;;

							$cache->destroy&#40;'_extensions'&#41;;
						&#125;
					&#125;
					else if &#40;$action_subforums == 'move'&#41;
					&#123;
						if &#40;!$subforums_to_id&#41;
						&#123;
							return array&#40;$user->lang&#91;'NO_DESTINATION_FORUM'&#93;&#41;;
						&#125;

						$sql = 'SELECT forum_name
							FROM ' . FORUMS_TABLE . '
							WHERE forum_id = ' . $subforums_to_id;
						$result = $db->sql_query&#40;$sql&#41;;
						$_row = $db->sql_fetchrow&#40;$result&#41;;
						$db->sql_freeresult&#40;$result&#41;;

						if &#40;!$_row&#41;
						&#123;
							return array&#40;$user->lang&#91;'NO_FORUM'&#93;&#41;;
						&#125;

						$subforums_to_name = $_row&#91;'forum_name'&#93;;

						$sql = 'SELECT forum_id
							FROM ' . FORUMS_TABLE . "
							WHERE parent_id = &#123;$row&#91;'forum_id'&#93;&#125;";
						$result = $db->sql_query&#40;$sql&#41;;

						while &#40;$_row = $db->sql_fetchrow&#40;$result&#41;&#41;
						&#123;
							$this->move_forum&#40;$_row&#91;'forum_id'&#93;, $subforums_to_id&#41;;
						&#125;
						$db->sql_freeresult&#40;$result&#41;;

						$sql = 'UPDATE ' . FORUMS_TABLE . "
							SET parent_id = $subforums_to_id
							WHERE parent_id = &#123;$row&#91;'forum_id'&#93;&#125;";
						$db->sql_query&#40;$sql&#41;;
					&#125;

					// Adjust the left/right id
					$sql = 'UPDATE ' . FORUMS_TABLE . '
						SET right_id = left_id + 1
						WHERE forum_id = ' . $row&#91;'forum_id'&#93;;
					$db->sql_query&#40;$sql&#41;;
				&#125;
			&#125;
			else if &#40;$row&#91;'forum_type'&#93; == FORUM_CAT && $forum_data_sql&#91;'forum_type'&#93; == FORUM_POST&#41;
			&#123;
				// Changing a category to a forum? Reset the data &#40;you can't post directly in a cat, you must use a forum&#41;
				$forum_data_sql&#91;'forum_posts'&#93; = 0;
				$forum_data_sql&#91;'forum_topics'&#93; = 0;
				$forum_data_sql&#91;'forum_topics_real'&#93; = 0;
				$forum_data_sql&#91;'forum_last_post_id'&#93; = 0;
				$forum_data_sql&#91;'forum_last_post_subject'&#93; = '';
				$forum_data_sql&#91;'forum_last_post_time'&#93; = 0;
				$forum_data_sql&#91;'forum_last_poster_id'&#93; = 0;
				$forum_data_sql&#91;'forum_last_poster_name'&#93; = '';
				$forum_data_sql&#91;'forum_last_poster_colour'&#93; = '';
			&#125;

			if &#40;sizeof&#40;$errors&#41;&#41;
			&#123;
				return $errors;
			&#125;

			if &#40;$row&#91;'parent_id'&#93; != $forum_data_sql&#91;'parent_id'&#93;&#41;
			&#123;
				if &#40;$row&#91;'forum_id'&#93; != $forum_data_sql&#91;'parent_id'&#93;&#41;
				&#123;
					$errors = $this->move_forum&#40;$forum_data_sql&#91;'forum_id'&#93;, $forum_data_sql&#91;'parent_id'&#93;&#41;;
				&#125;
				else
				&#123;
					$forum_data_sql&#91;'parent_id'&#93; = $row&#91;'parent_id'&#93;;
				&#125;
			&#125;

			if &#40;sizeof&#40;$errors&#41;&#41;
			&#123;
				return $errors;
			&#125;

			unset&#40;$forum_data_sql&#91;'type_action'&#93;&#41;;

			if &#40;$row&#91;'forum_name'&#93; != $forum_data_sql&#91;'forum_name'&#93;&#41;
			&#123;
				// the forum name has changed, clear the parents list of all forums &#40;for safety&#41;
				$sql = 'UPDATE ' . FORUMS_TABLE . "
					SET forum_parents = ''";
				$db->sql_query&#40;$sql&#41;;
			&#125;

			// Setting the forum id to the forum id is not really received well by some dbs. ;&#41;
			$forum_id = $forum_data_sql&#91;'forum_id'&#93;;
			unset&#40;$forum_data_sql&#91;'forum_id'&#93;&#41;;

			$sql = 'UPDATE ' . FORUMS_TABLE . '
				SET ' . $db->sql_build_array&#40;'UPDATE', $forum_data_sql&#41; . '
				WHERE forum_id = ' . $forum_id;
			$db->sql_query&#40;$sql&#41;;

			// Add it back
			$forum_data&#91;'forum_id'&#93; = $forum_id;

			add_log&#40;'admin', 'LOG_FORUM_EDIT', $forum_data&#91;'forum_name'&#93;&#41;;
		&#125;

		return $errors;
	&#125;

	/**
	* Move forum
	*/
	function move_forum&#40;$from_id, $to_id&#41;
	&#123;
		global $db, $user;

		$to_data = $moved_ids = $errors = array&#40;&#41;;

		// Check if we want to move to a parent with link type
		if &#40;$to_id > 0&#41;
		&#123;
			$to_data = $this->get_forum_info&#40;$to_id&#41;;

			if &#40;$to_data&#91;'forum_type'&#93; == FORUM_LINK&#41;
			&#123;
				$errors&#91;&#93; = $user->lang&#91;'PARENT_IS_LINK_FORUM'&#93;;
				return $errors;
			&#125;
		&#125;

		$moved_forums = get_forum_branch&#40;$from_id, 'children', 'descending'&#41;;
		$from_data = $moved_forums&#91;0&#93;;
		$diff = sizeof&#40;$moved_forums&#41; * 2;

		$moved_ids = array&#40;&#41;;
		for &#40;$i = 0; $i < sizeof&#40;$moved_forums&#41;; ++$i&#41;
		&#123;
			$moved_ids&#91;&#93; = $moved_forums&#91;$i&#93;&#91;'forum_id'&#93;;
		&#125;

		// Resync parents
		$sql = 'UPDATE ' . FORUMS_TABLE . "
			SET right_id = right_id - $diff, forum_parents = ''
			WHERE left_id < " . $from_data&#91;'right_id'&#93; . "
				AND right_id > " . $from_data&#91;'right_id'&#93;;
		$db->sql_query&#40;$sql&#41;;

		// Resync righthand side of tree
		$sql = 'UPDATE ' . FORUMS_TABLE . "
			SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = ''
			WHERE left_id > " . $from_data&#91;'right_id'&#93;;
		$db->sql_query&#40;$sql&#41;;

		if &#40;$to_id > 0&#41;
		&#123;
			// Retrieve $to_data again, it may have been changed...
			$to_data = $this->get_forum_info&#40;$to_id&#41;;

			// Resync new parents
			$sql = 'UPDATE ' . FORUMS_TABLE . "
				SET right_id = right_id + $diff, forum_parents = ''
				WHERE " . $to_data&#91;'right_id'&#93; . ' BETWEEN left_id AND right_id
					AND ' . $db->sql_in_set&#40;'forum_id', $moved_ids, true&#41;;
			$db->sql_query&#40;$sql&#41;;

			// Resync the righthand side of the tree
			$sql = 'UPDATE ' . FORUMS_TABLE . "
				SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = ''
				WHERE left_id > " . $to_data&#91;'right_id'&#93; . '
					AND ' . $db->sql_in_set&#40;'forum_id', $moved_ids, true&#41;;
			$db->sql_query&#40;$sql&#41;;

			// Resync moved branch
			$to_data&#91;'right_id'&#93; += $diff;

			if &#40;$to_data&#91;'right_id'&#93; > $from_data&#91;'right_id'&#93;&#41;
			&#123;
				$diff = '+ ' . &#40;$to_data&#91;'right_id'&#93; - $from_data&#91;'right_id'&#93; - 1&#41;;
			&#125;
			else
			&#123;
				$diff = '- ' . abs&#40;$to_data&#91;'right_id'&#93; - $from_data&#91;'right_id'&#93; - 1&#41;;
			&#125;
		&#125;
		else
		&#123;
			$sql = 'SELECT MAX&#40;right_id&#41; AS right_id
				FROM ' . FORUMS_TABLE . '
				WHERE ' . $db->sql_in_set&#40;'forum_id', $moved_ids, true&#41;;
			$result = $db->sql_query&#40;$sql&#41;;
			$row = $db->sql_fetchrow&#40;$result&#41;;
			$db->sql_freeresult&#40;$result&#41;;

			$diff = '+ ' . &#40;$row&#91;'right_id'&#93; - $from_data&#91;'left_id'&#93; + 1&#41;;
		&#125;

		$sql = 'UPDATE ' . FORUMS_TABLE . "
			SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = ''
			WHERE " . $db->sql_in_set&#40;'forum_id', $moved_ids&#41;;
		$db->sql_query&#40;$sql&#41;;

		return $errors;
	&#125;

	/**
	* Move forum content from one to another forum
	*/
	function move_forum_content&#40;$from_id, $to_id, $sync = true&#41;
	&#123;
		global $db;

		$table_ary = array&#40;LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE&#41;;

		foreach &#40;$table_ary as $table&#41;
		&#123;
			$sql = "UPDATE $table
				SET forum_id = $to_id
				WHERE forum_id = $from_id";
			$db->sql_query&#40;$sql&#41;;
		&#125;
		unset&#40;$table_ary&#41;;

		$table_ary = array&#40;FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, MODERATOR_CACHE_TABLE&#41;;

		foreach &#40;$table_ary as $table&#41;
		&#123;
			$sql = "DELETE FROM $table
				WHERE forum_id = $from_id";
			$db->sql_query&#40;$sql&#41;;
		&#125;

		if &#40;$sync&#41;
		&#123;
			// Delete ghost topics that link back to the same forum then resync counters
			sync&#40;'topic_moved'&#41;;
			sync&#40;'forum', 'forum_id', $to_id, false, true&#41;;
		&#125;

		return array&#40;&#41;;
	&#125;

	/**
	* Remove complete forum
	*/
	function delete_forum&#40;$forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0&#41;
	&#123;
		global $db, $user, $cache;

		$forum_data = $this->get_forum_info&#40;$forum_id&#41;;

		$errors = array&#40;&#41;;
		$log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = '';
		$forum_ids = array&#40;$forum_id&#41;;

		if &#40;$action_posts == 'delete'&#41;
		&#123;
			$log_action_posts = 'POSTS';
			$errors = array_merge&#40;$errors, $this->delete_forum_content&#40;$forum_id&#41;&#41;;
		&#125;
		else if &#40;$action_posts == 'move'&#41;
		&#123;
			if &#40;!$posts_to_id&#41;
			&#123;
				$errors&#91;&#93; = $user->lang&#91;'NO_DESTINATION_FORUM'&#93;;
			&#125;
			else
			&#123;
				$log_action_posts = 'MOVE_POSTS';

				$sql = 'SELECT forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $posts_to_id;
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					$errors&#91;&#93; = $user->lang&#91;'NO_FORUM'&#93;;
				&#125;
				else
				&#123;
					$posts_to_name = $row&#91;'forum_name'&#93;;
					$errors = array_merge&#40;$errors, $this->move_forum_content&#40;$forum_id, $posts_to_id&#41;&#41;;
				&#125;
			&#125;
		&#125;

		if &#40;sizeof&#40;$errors&#41;&#41;
		&#123;
			return $errors;
		&#125;

		if &#40;$action_subforums == 'delete'&#41;
		&#123;
			$log_action_forums = 'FORUMS';
			$rows = get_forum_branch&#40;$forum_id, 'children', 'descending', false&#41;;

			foreach &#40;$rows as $row&#41;
			&#123;
				$forum_ids&#91;&#93; = $row&#91;'forum_id'&#93;;
				$errors = array_merge&#40;$errors, $this->delete_forum_content&#40;$row&#91;'forum_id'&#93;&#41;&#41;;
			&#125;

			if &#40;sizeof&#40;$errors&#41;&#41;
			&#123;
				return $errors;
			&#125;

			$diff = sizeof&#40;$forum_ids&#41; * 2;

			$sql = 'DELETE FROM ' . FORUMS_TABLE . '
				WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
			$db->sql_query&#40;$sql&#41;;

			$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
				WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
			$db->sql_query&#40;$sql&#41;;

			$sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
				WHERE ' . $db->sql_in_set&#40;'forum_id', $forum_ids&#41;;
			$db->sql_query&#40;$sql&#41;;
		&#125;
		else if &#40;$action_subforums == 'move'&#41;
		&#123;
			if &#40;!$subforums_to_id&#41;
			&#123;
				$errors&#91;&#93; = $user->lang&#91;'NO_DESTINATION_FORUM'&#93;;
			&#125;
			else
			&#123;
				$log_action_forums = 'MOVE_FORUMS';

				$sql = 'SELECT forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . $subforums_to_id;
				$result = $db->sql_query&#40;$sql&#41;;
				$row = $db->sql_fetchrow&#40;$result&#41;;
				$db->sql_freeresult&#40;$result&#41;;

				if &#40;!$row&#41;
				&#123;
					$errors&#91;&#93; = $user->lang&#91;'NO_FORUM'&#93;;
				&#125;
				else
				&#123;
					$subforums_to_name = $row&#91;'forum_name'&#93;;

					$sql = 'SELECT forum_id
						FROM ' . FORUMS_TABLE . "
						WHERE parent_id = $forum_id";
					$result = $db->sql_query&#40;$sql&#41;;

					while &#40;$row = $db->sql_fetchrow&#40;$result&#41;&#41;
					&#123;
						$this->move_forum&#40;$row&#91;'forum_id'&#93;, $subforums_to_id&#41;;

User avatar
Msecurity
Потребител
Потребител
Posts: 753
Joined: Sat Sep 18, 2010 6:12 am
Answers: 19
Location: Варна

Post by Msecurity » Fri Jan 03, 2014 7:57 pm

Ако дадеш само между 610 и 615 ред мисля че ще стане по лесно от колкото да гледаме целият файл :D

qnkovweb
Нов
Нов
Posts: 88
Joined: Wed Nov 06, 2013 6:04 pm

Post by qnkovweb » Sat Jan 04, 2014 12:02 am

Не знам как, при положени, че ползвам notepad само. :)
Това е чистият файл: http://dox.bg/files/dw?a=f96f95c2ef
А това е кода, който трябва да се сложи у него. При мен нещо не се получи:

Open: includes/acp/acp_forums.php
Find

Tip: This may be a partial find and not the whole line.
Code:Select all

Code: Select all

				if &#40;strlen&#40;$forum_data&#91;'forum_password'&#93;&#41; == 32&#41;
					&#123;
						$errors&#91;&#93; = $user->lang&#91;'FORUM_PASSWORD_OLD'&#93;;
					&#125;
Add after

Tip: Add these lines on a new blank line after the preceding line(s) to find.
Code:Select all

Code: Select all

				// Start mod list forum_images from kiss engine copyright 2007 phpbbireland.com //
				$dirslist = ' ';

				if &#40;!file_exists&#40;$phpbb_root_path . 'images/forum_icons'&#41;&#41;
				&#123;
					trigger_error&#40;sprintf&#40;$user->lang&#91;'MISSING_FILE_OR_FOLDER'&#93;, $file&#41;&#41;;
				&#125;

				$dirs = dir&#40;$phpbb_root_path . 'images/forum_icons'&#41;;
				while &#40;$file = $dirs->read&#40;&#41;&#41;
				&#123;
					if &#40;stripos&#40;$file, ".gif"&#41; ||  stripos&#40;$file, ".png"&#41;&#41;
					&#123;
						$dirslist .= "$file ";
					&#125;
				&#125;
				closedir&#40;$dirs->handle&#41;;
				$dirslist = explode&#40;" ", $dirslist&#41;;
				sort&#40;$dirslist&#41;;

				for &#40;$i = 0; $i < sizeof&#40;$dirslist&#41;; $i++&#41;
				&#123;
					if &#40;$dirslist&#91;$i&#93; != ''&#41;
					&#123;
						$template->assign_block_vars&#40;'forum_img_file_name', array&#40;'FORUM_IMAGE_OPT' => $dirslist&#91;$i&#93;&#41;&#41;;
					&#125;
				&#125;
				$dirslist = '';
				// End mod list forum_images from kiss engine code //
	
<< Hide
Find

Tip: This may be a partial find and not the whole line.
Code:Select all

Code: Select all

					'FORUM_IMAGE_SRC'			=> &#40;$forum_data&#91;'forum_image'&#93;&#41; ? $phpbb_root_path . $forum_data&#91;'forum_image'&#93; &#58; '',
Add after

Tip: Add these lines on a new blank line after the preceding line(s) to find.
Code:Select all

Code: Select all

					'FORUM_IMAGE_SRC_PATH'			=> $phpbb_root_path . 'images/forum_icons/',
					'FORUM_IMAGE_PATH'			=> 'images/forum_icons/',

Post Reply