Blame Identity/Models/Html/phpBB/3.0.4/includes/ucp/ucp_main.php

d6e8d8
d6e8d8
/**
d6e8d8
*
d6e8d8
* @package ucp
d6e8d8
* @version $Id: ucp_main.php 9136 2008-11-30 14:36:59Z acydburn $
d6e8d8
* @copyright (c) 2005 phpBB Group
d6e8d8
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
d6e8d8
*
d6e8d8
*/
d6e8d8
d6e8d8
/**
d6e8d8
* @ignore
d6e8d8
*/
d6e8d8
if (!defined('IN_PHPBB'))
d6e8d8
{
d6e8d8
	exit;
d6e8d8
}
d6e8d8
d6e8d8
/**
d6e8d8
* ucp_main
d6e8d8
* UCP Front Panel
d6e8d8
* @package ucp
d6e8d8
*/
d6e8d8
class ucp_main
d6e8d8
{
d6e8d8
	var $p_master;
d6e8d8
	var $u_action;
d6e8d8
d6e8d8
	function ucp_main(&$p_master)
d6e8d8
	{
d6e8d8
		$this->p_master = &$p_master;
d6e8d8
	}
d6e8d8
d6e8d8
	function main($id, $mode)
d6e8d8
	{
d6e8d8
		global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
d6e8d8
d6e8d8
		switch ($mode)
d6e8d8
		{
d6e8d8
			case 'front':
d6e8d8
d6e8d8
				$user->add_lang('memberlist');
d6e8d8
d6e8d8
				$sql_from = TOPICS_TABLE . ' t ';
d6e8d8
				$sql_select = '';
d6e8d8
d6e8d8
				if ($config['load_db_track'])
d6e8d8
				{
d6e8d8
					$sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
d6e8d8
						AND tp.user_id = ' . $user->data['user_id'] . ')';
d6e8d8
					$sql_select .= ', tp.topic_posted';
d6e8d8
				}
d6e8d8
d6e8d8
				if ($config['load_db_lastread'])
d6e8d8
				{
d6e8d8
					$sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
d6e8d8
						AND tt.user_id = ' . $user->data['user_id'] . ')';
d6e8d8
					$sql_select .= ', tt.mark_time';
d6e8d8
				}
d6e8d8
d6e8d8
				$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
d6e8d8
				$folder = 'global_read';
d6e8d8
				$folder_new = 'global_unread';
d6e8d8
d6e8d8
				// Get cleaned up list... return only those forums not having the f_read permission
d6e8d8
				$forum_ary = $auth->acl_getf('!f_read', true);
d6e8d8
				$forum_ary = array_unique(array_keys($forum_ary));
d6e8d8
d6e8d8
				// Determine first forum the user is able to read into - for global announcement link
d6e8d8
				$sql = 'SELECT forum_id
d6e8d8
					FROM ' . FORUMS_TABLE . '
d6e8d8
					WHERE forum_type = ' . FORUM_POST;
d6e8d8
d6e8d8
				if (sizeof($forum_ary))
d6e8d8
				{
d6e8d8
					$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
d6e8d8
				}
d6e8d8
				$result = $db->sql_query_limit($sql, 1);
d6e8d8
				$g_forum_id = (int) $db->sql_fetchfield('forum_id');
d6e8d8
				$db->sql_freeresult($result);
d6e8d8
d6e8d8
				$sql = "SELECT t.* $sql_select
d6e8d8
					FROM $sql_from
d6e8d8
					WHERE t.forum_id = 0
d6e8d8
						AND t.topic_type = " . POST_GLOBAL . '
d6e8d8
					ORDER BY t.topic_last_post_time DESC';
d6e8d8
d6e8d8
				$topic_list = $rowset = array();
d6e8d8
				// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
d6e8d8
				if ($g_forum_id)
d6e8d8
				{
d6e8d8
					$result = $db->sql_query($sql);
d6e8d8
d6e8d8
					while ($row = $db->sql_fetchrow($result))
d6e8d8
					{
d6e8d8
						$topic_list[] = $row['topic_id'];
d6e8d8
						$rowset[$row['topic_id']] = $row;
d6e8d8
					}
d6e8d8
					$db->sql_freeresult($result);
d6e8d8
				}
d6e8d8
d6e8d8
				$topic_tracking_info = array();
d6e8d8
				if ($config['load_db_lastread'])
d6e8d8
				{
d6e8d8
					$topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list);
d6e8d8
				}
d6e8d8
				else
d6e8d8
				{
d6e8d8
					$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $topic_list);
d6e8d8
				}
d6e8d8
d6e8d8
				foreach ($topic_list as $topic_id)
d6e8d8
				{
d6e8d8
					$row = &$rowset[$topic_id];
d6e8d8
d6e8d8
					$forum_id = $row['forum_id'];
d6e8d8
					$topic_id = $row['topic_id'];
d6e8d8
d6e8d8
					$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
d6e8d8
d6e8d8
					$folder_img = ($unread_topic) ? $folder_new : $folder;
d6e8d8
					$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
d6e8d8
d6e8d8
					if ($row['topic_status'] == ITEM_LOCKED)
d6e8d8
					{
d6e8d8
						$folder_img .= '_locked';
d6e8d8
					}
d6e8d8
d6e8d8
					// Posted image?
d6e8d8
					if (!empty($row['topic_posted']) && $row['topic_posted'])
d6e8d8
					{
d6e8d8
						$folder_img .= '_mine';
d6e8d8
					}
d6e8d8
d6e8d8
					$template->assign_block_vars('topicrow', array(
d6e8d8
						'FORUM_ID'					=> $forum_id,
d6e8d8
						'TOPIC_ID'					=> $topic_id,
d6e8d8
						'TOPIC_AUTHOR'				=> get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
						'TOPIC_AUTHOR_COLOUR'		=> get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
						'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
						'FIRST_POST_TIME'			=> $user->format_date($row['topic_time']),
d6e8d8
						'LAST_POST_SUBJECT'			=> censor_text($row['topic_last_post_subject']),
d6e8d8
						'LAST_POST_TIME'			=> $user->format_date($row['topic_last_post_time']),
d6e8d8
						'LAST_VIEW_TIME'			=> $user->format_date($row['topic_last_view_time']),
d6e8d8
						'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
						'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
						'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
						'TOPIC_TITLE'				=> censor_text($row['topic_title']),
d6e8d8
						'TOPIC_TYPE'				=> $topic_type,
d6e8d8
d6e8d8
						'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
d6e8d8
						'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
d6e8d8
						'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', '') : '',
d6e8d8
d6e8d8
						'S_USER_POSTED'		=> (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
d6e8d8
						'S_UNREAD'			=> $unread_topic,
d6e8d8
d6e8d8
						'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
						'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
d6e8d8
						'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
						'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id&view=unread") . '#unread',
d6e8d8
						'U_VIEW_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&t=$topic_id"))
d6e8d8
					);
d6e8d8
				}
d6e8d8
d6e8d8
				if ($config['load_user_activity'])
d6e8d8
				{
d6e8d8
					if (!function_exists('display_user_activity'))
d6e8d8
					{
d6e8d8
						include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
d6e8d8
					}
d6e8d8
					display_user_activity($user->data);
d6e8d8
				}
d6e8d8
d6e8d8
				// Do the relevant calculations
d6e8d8
				$memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400));
d6e8d8
				$posts_per_day = $user->data['user_posts'] / $memberdays;
d6e8d8
				$percentage = ($config['num_posts']) ? min(100, ($user->data['user_posts'] / $config['num_posts']) * 100) : 0;
d6e8d8
d6e8d8
				$template->assign_vars(array(
d6e8d8
					'USER_COLOR'		=> (!empty($user->data['user_colour'])) ? $user->data['user_colour'] : '',
d6e8d8
					'JOINED'			=> $user->format_date($user->data['user_regdate']),
d6e8d8
					'VISITED'			=> (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),
d6e8d8
					'WARNINGS'			=> ($user->data['user_warnings']) ? $user->data['user_warnings'] : 0,
d6e8d8
					'POSTS'				=> ($user->data['user_posts']) ? $user->data['user_posts'] : 0,
d6e8d8
					'POSTS_DAY'			=> sprintf($user->lang['POST_DAY'], $posts_per_day),
d6e8d8
					'POSTS_PCT'			=> sprintf($user->lang['POST_PCT'], $percentage),
d6e8d8
d6e8d8
					'OCCUPATION'	=> (!empty($row['user_occ'])) ? $row['user_occ'] : '',
d6e8d8
					'INTERESTS'		=> (!empty($row['user_interests'])) ? $row['user_interests'] : '',
d6e8d8
d6e8d8
//					'S_GROUP_OPTIONS'	=> $group_options,
d6e8d8
d6e8d8
					'U_SEARCH_USER'		=> ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user->data['user_id'] . '&sr=posts') : '',
d6e8d8
				));
d6e8d8
d6e8d8
			break;
d6e8d8
d6e8d8
			case 'subscribed':
d6e8d8
d6e8d8
				include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
d6e8d8
d6e8d8
				$user->add_lang('viewforum');
d6e8d8
d6e8d8
				add_form_key('ucp_front_subscribed');
d6e8d8
d6e8d8
				$unwatch = (isset($_POST['unwatch'])) ? true : false;
d6e8d8
d6e8d8
				if ($unwatch)
d6e8d8
				{
d6e8d8
					if (check_form_key('ucp_front_subscribed'))
d6e8d8
					{
d6e8d8
						$forums = array_keys(request_var('f', array(0 => 0)));
d6e8d8
						$topics = array_keys(request_var('t', array(0 => 0)));
d6e8d8
						$msg = '';
d6e8d8
d6e8d8
						if (sizeof($forums) || sizeof($topics))
d6e8d8
						{
d6e8d8
							$l_unwatch = '';
d6e8d8
							if (sizeof($forums))
d6e8d8
							{
d6e8d8
								$sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . '
d6e8d8
									WHERE ' . $db->sql_in_set('forum_id', $forums) . '
d6e8d8
										AND user_id = ' . $user->data['user_id'];
d6e8d8
								$db->sql_query($sql);
d6e8d8
d6e8d8
								$l_unwatch .= '_FORUMS';
d6e8d8
							}
d6e8d8
d6e8d8
							if (sizeof($topics))
d6e8d8
							{
d6e8d8
								$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . '
d6e8d8
									WHERE ' . $db->sql_in_set('topic_id', $topics) . '
d6e8d8
										AND user_id = ' . $user->data['user_id'];
d6e8d8
								$db->sql_query($sql);
d6e8d8
d6e8d8
								$l_unwatch .= '_TOPICS';
d6e8d8
							}
d6e8d8
							$msg = $user->lang['UNWATCHED' . $l_unwatch];
d6e8d8
						}
d6e8d8
						else
d6e8d8
						{
d6e8d8
							$msg = $user->lang['NO_WATCHED_SELECTED'];
d6e8d8
						}
d6e8d8
					}
d6e8d8
					else
d6e8d8
					{
d6e8d8
						$msg = $user->lang['FORM_INVALID'];
d6e8d8
					}
d6e8d8
					$message = $msg . '

' . sprintf($user->lang['RETURN_UCP'], '', '');
d6e8d8
					meta_refresh(3, append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=subscribed"));
d6e8d8
					trigger_error($message);
d6e8d8
				}
d6e8d8
d6e8d8
				$forbidden_forums = array();
d6e8d8
d6e8d8
				if ($config['allow_forum_notify'])
d6e8d8
				{
d6e8d8
					$forbidden_forums = $auth->acl_getf('!f_read', true);
d6e8d8
					$forbidden_forums = array_unique(array_keys($forbidden_forums));
d6e8d8
d6e8d8
					$sql_array = array(
d6e8d8
						'SELECT'	=> 'f.*',
d6e8d8
d6e8d8
						'FROM'		=> array(
d6e8d8
							FORUMS_WATCH_TABLE	=> 'fw',
d6e8d8
							FORUMS_TABLE		=> 'f'
d6e8d8
						),
d6e8d8
d6e8d8
						'WHERE'		=> 'fw.user_id = ' . $user->data['user_id'] . '
d6e8d8
							AND f.forum_id = fw.forum_id
d6e8d8
							AND ' . $db->sql_in_set('f.forum_id', $forbidden_forums, true, true),
d6e8d8
d6e8d8
						'ORDER_BY'	=> 'left_id'
d6e8d8
					);
d6e8d8
d6e8d8
					if ($config['load_db_lastread'])
d6e8d8
					{
d6e8d8
						$sql_array['LEFT_JOIN'] = array(
d6e8d8
							array(
d6e8d8
								'FROM'	=> array(FORUMS_TRACK_TABLE => 'ft'),
d6e8d8
								'ON'	=> 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'
d6e8d8
							)
d6e8d8
						);
d6e8d8
d6e8d8
						$sql_array['SELECT'] .= ', ft.mark_time ';
d6e8d8
					}
d6e8d8
					else
d6e8d8
					{
d6e8d8
						$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
d6e8d8
						$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
d6e8d8
					}
d6e8d8
d6e8d8
					$sql = $db->sql_build_query('SELECT', $sql_array);
d6e8d8
					$result = $db->sql_query($sql);
d6e8d8
d6e8d8
					while ($row = $db->sql_fetchrow($result))
d6e8d8
					{
d6e8d8
						$forum_id = $row['forum_id'];
d6e8d8
d6e8d8
						if ($config['load_db_lastread'])
d6e8d8
						{
d6e8d8
							$forum_check = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark'];
d6e8d8
						}
d6e8d8
						else
d6e8d8
						{
d6e8d8
							$forum_check = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark'];
d6e8d8
						}
d6e8d8
d6e8d8
						$unread_forum = ($row['forum_last_post_time'] > $forum_check) ? true : false;
d6e8d8
d6e8d8
						// Which folder should we display?
d6e8d8
						if ($row['forum_status'] == ITEM_LOCKED)
d6e8d8
						{
d6e8d8
							$folder_image = ($unread_forum) ? 'forum_unread_locked' : 'forum_read_locked';
d6e8d8
							$folder_alt = 'FORUM_LOCKED';
d6e8d8
						}
d6e8d8
						else
d6e8d8
						{
d6e8d8
							$folder_image = ($unread_forum) ? 'forum_unread' : 'forum_read';
d6e8d8
							$folder_alt = ($unread_forum) ? 'NEW_POSTS' : 'NO_NEW_POSTS';
d6e8d8
						}
d6e8d8
d6e8d8
						// Create last post link information, if appropriate
d6e8d8
						if ($row['forum_last_post_id'])
d6e8d8
						{
d6e8d8
							$last_post_time = $user->format_date($row['forum_last_post_time']);
d6e8d8
							$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=" . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
d6e8d8
						}
d6e8d8
						else
d6e8d8
						{
d6e8d8
							$last_post_time = $last_post_url = '';
d6e8d8
						}
d6e8d8
d6e8d8
						$template->assign_block_vars('forumrow', array(
d6e8d8
							'FORUM_ID'				=> $forum_id,
d6e8d8
							'FORUM_FOLDER_IMG'		=> $user->img($folder_image, $folder_alt),
d6e8d8
							'FORUM_FOLDER_IMG_SRC'	=> $user->img($folder_image, $folder_alt, false, '', 'src'),
d6e8d8
							'FORUM_IMAGE'			=> ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '',
d6e8d8
							'FORUM_IMAGE_SRC'		=> ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '',
d6e8d8
							'FORUM_NAME'			=> $row['forum_name'],
d6e8d8
							'FORUM_DESC'			=> generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),
d6e8d8
							'LAST_POST_SUBJECT'		=> $row['forum_last_post_subject'],
d6e8d8
							'LAST_POST_TIME'		=> $last_post_time,
d6e8d8
d6e8d8
							'LAST_POST_AUTHOR'			=> get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
d6e8d8
							'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
d6e8d8
							'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
d6e8d8
							'U_LAST_POST_AUTHOR'		=> get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),
d6e8d8
d6e8d8
							'U_LAST_POST'			=> $last_post_url,
d6e8d8
							'U_VIEWFORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']))
d6e8d8
						);
d6e8d8
					}
d6e8d8
					$db->sql_freeresult($result);
d6e8d8
				}
d6e8d8
d6e8d8
				// Subscribed Topics
d6e8d8
				if ($config['allow_topic_notify'])
d6e8d8
				{
d6e8d8
					if (empty($forbidden_forums))
d6e8d8
					{
d6e8d8
						$forbidden_forums = $auth->acl_getf('!f_read', true);
d6e8d8
						$forbidden_forums = array_unique(array_keys($forbidden_forums));
d6e8d8
					}
d6e8d8
					$this->assign_topiclist('subscribed', $forbidden_forums);
d6e8d8
				}
d6e8d8
d6e8d8
				$template->assign_vars(array(
d6e8d8
					'S_TOPIC_NOTIFY'		=> $config['allow_topic_notify'],
d6e8d8
					'S_FORUM_NOTIFY'		=> $config['allow_forum_notify'],
d6e8d8
				));
d6e8d8
d6e8d8
			break;
d6e8d8
d6e8d8
			case 'bookmarks':
d6e8d8
d6e8d8
				if (!$config['allow_bookmarks'])
d6e8d8
				{
d6e8d8
					$template->assign_vars(array(
d6e8d8
						'S_NO_DISPLAY_BOOKMARKS'	=> true)
d6e8d8
					);
d6e8d8
					break;
d6e8d8
				}
d6e8d8
d6e8d8
				include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
d6e8d8
d6e8d8
				$user->add_lang('viewforum');
d6e8d8
d6e8d8
				if (isset($_POST['unbookmark']))
d6e8d8
				{
d6e8d8
					$s_hidden_fields = array('unbookmark' => 1);
d6e8d8
					$topics = (isset($_POST['t'])) ? array_keys(request_var('t', array(0 => 0))) : array();
d6e8d8
					$url = $this->u_action;
d6e8d8
d6e8d8
					if (!sizeof($topics))
d6e8d8
					{
d6e8d8
						trigger_error('NO_BOOKMARKS_SELECTED');
d6e8d8
					}
d6e8d8
d6e8d8
					foreach ($topics as $topic_id)
d6e8d8
					{
d6e8d8
						$s_hidden_fields['t'][$topic_id] = 1;
d6e8d8
					}
d6e8d8
d6e8d8
					if (confirm_box(true))
d6e8d8
					{
d6e8d8
						$sql = 'DELETE FROM ' . BOOKMARKS_TABLE . '
d6e8d8
							WHERE user_id = ' . $user->data['user_id'] . '
d6e8d8
								AND ' . $db->sql_in_set('topic_id', $topics);
d6e8d8
						$db->sql_query($sql);
d6e8d8
d6e8d8
						meta_refresh(3, $url);
d6e8d8
						$message = $user->lang['BOOKMARKS_REMOVED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', '');
d6e8d8
						trigger_error($message);
d6e8d8
					}
d6e8d8
					else
d6e8d8
					{
d6e8d8
						confirm_box(false, 'REMOVE_SELECTED_BOOKMARKS', build_hidden_fields($s_hidden_fields));
d6e8d8
					}
d6e8d8
				}
d6e8d8
				$forbidden_forums = $auth->acl_getf('!f_read', true);
d6e8d8
				$forbidden_forums = array_unique(array_keys($forbidden_forums));
d6e8d8
d6e8d8
				$this->assign_topiclist('bookmarks', $forbidden_forums);
d6e8d8
d6e8d8
			break;
d6e8d8
d6e8d8
			case 'drafts':
d6e8d8
d6e8d8
				$pm_drafts = ($this->p_master->p_name == 'pm') ? true : false;
d6e8d8
				$template->assign_var('S_SHOW_DRAFTS', true);
d6e8d8
d6e8d8
				$user->add_lang('posting');
d6e8d8
d6e8d8
				$edit		= (isset($_REQUEST['edit'])) ? true : false;
d6e8d8
				$submit		= (isset($_POST['submit'])) ? true : false;
d6e8d8
				$draft_id	= ($edit) ? intval($_REQUEST['edit']) : 0;
d6e8d8
				$delete		= (isset($_POST['delete'])) ? true : false;
d6e8d8
d6e8d8
				$s_hidden_fields = ($edit) ? '<input type="hidden" name="edit" value="' . $draft_id . '" />' : '';
d6e8d8
				$draft_subject = $draft_message = '';
d6e8d8
				add_form_key('ucp_draft');
d6e8d8
d6e8d8
				if ($delete)
d6e8d8
				{
d6e8d8
					if (check_form_key('ucp_draft'))
d6e8d8
					{
d6e8d8
						$drafts = array_keys(request_var('d', array(0 => 0)));
d6e8d8
d6e8d8
						if (sizeof($drafts))
d6e8d8
						{
d6e8d8
							$sql = 'DELETE FROM ' . DRAFTS_TABLE . '
d6e8d8
								WHERE ' . $db->sql_in_set('draft_id', $drafts) . '
d6e8d8
									AND user_id = ' . $user->data['user_id'];
d6e8d8
							$db->sql_query($sql);
d6e8d8
						}
d6e8d8
						$msg = $user->lang['DRAFTS_DELETED'];
d6e8d8
						unset($drafts);
d6e8d8
					}
d6e8d8
					else
d6e8d8
					{
d6e8d8
						$msg = $user->lang['FORM_INVALID'];
d6e8d8
					}
d6e8d8
					$message = $msg . '

' . sprintf($user->lang['RETURN_UCP'], '', '');
d6e8d8
					meta_refresh(3, $this->u_action);
d6e8d8
					trigger_error($message);
d6e8d8
				}
d6e8d8
d6e8d8
				if ($submit && $edit)
d6e8d8
				{
d6e8d8
					$draft_subject = utf8_normalize_nfc(request_var('subject', '', true));
d6e8d8
					$draft_message = utf8_normalize_nfc(request_var('message', '', true));
d6e8d8
					if (check_form_key('ucp_draft'))
d6e8d8
					{
d6e8d8
						if ($draft_message && $draft_subject)
d6e8d8
						{
d6e8d8
							$draft_row = array(
d6e8d8
								'draft_subject' => $draft_subject,
d6e8d8
								'draft_message' => $draft_message
d6e8d8
							);
d6e8d8
d6e8d8
							$sql = 'UPDATE ' . DRAFTS_TABLE . '
d6e8d8
								SET ' . $db->sql_build_array('UPDATE', $draft_row) . "
d6e8d8
								WHERE draft_id = $draft_id
d6e8d8
									AND user_id = " . $user->data['user_id'];
d6e8d8
							$db->sql_query($sql);
d6e8d8
d6e8d8
							$message = $user->lang['DRAFT_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', '');
d6e8d8
d6e8d8
							meta_refresh(3, $this->u_action);
d6e8d8
							trigger_error($message);
d6e8d8
						}
d6e8d8
						else
d6e8d8
						{
d6e8d8
							$template->assign_var('ERROR', ($draft_message == '') ? $user->lang['EMPTY_DRAFT'] : (($draft_subject == '') ? $user->lang['EMPTY_DRAFT_TITLE'] : ''));
d6e8d8
						}
d6e8d8
					}
d6e8d8
					else
d6e8d8
					{
d6e8d8
						$template->assign_var('ERROR', $user->lang['FORM_INVALID']);
d6e8d8
					}
d6e8d8
				}
d6e8d8
d6e8d8
				if (!$pm_drafts)
d6e8d8
				{
d6e8d8
					$sql = 'SELECT d.*, f.forum_name
d6e8d8
						FROM ' . DRAFTS_TABLE . ' d, ' . FORUMS_TABLE . ' f
d6e8d8
						WHERE d.user_id = ' . $user->data['user_id'] . ' ' .
d6e8d8
							(($edit) ? "AND d.draft_id = $draft_id" : '') . '
d6e8d8
							AND f.forum_id = d.forum_id
d6e8d8
						ORDER BY d.save_time DESC';
d6e8d8
				}
d6e8d8
				else
d6e8d8
				{
d6e8d8
					$sql = 'SELECT * FROM ' . DRAFTS_TABLE . '
d6e8d8
						WHERE user_id = ' . $user->data['user_id'] . ' ' .
d6e8d8
							(($edit) ? "AND draft_id = $draft_id" : '') . '
d6e8d8
							AND forum_id = 0
d6e8d8
							AND topic_id = 0
d6e8d8
						ORDER BY save_time DESC';
d6e8d8
				}
d6e8d8
				$result = $db->sql_query($sql);
d6e8d8
d6e8d8
				$draftrows = $topic_ids = array();
d6e8d8
d6e8d8
				while ($row = $db->sql_fetchrow($result))
d6e8d8
				{
d6e8d8
					if ($row['topic_id'])
d6e8d8
					{
d6e8d8
						$topic_ids[] = (int) $row['topic_id'];
d6e8d8
					}
d6e8d8
					$draftrows[] = $row;
d6e8d8
				}
d6e8d8
				$db->sql_freeresult($result);
d6e8d8
d6e8d8
				if (sizeof($topic_ids))
d6e8d8
				{
d6e8d8
					$sql = 'SELECT topic_id, forum_id, topic_title
d6e8d8
						FROM ' . TOPICS_TABLE . '
d6e8d8
						WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
d6e8d8
					$result = $db->sql_query($sql);
d6e8d8
d6e8d8
					while ($row = $db->sql_fetchrow($result))
d6e8d8
					{
d6e8d8
						$topic_rows[$row['topic_id']] = $row;
d6e8d8
					}
d6e8d8
					$db->sql_freeresult($result);
d6e8d8
				}
d6e8d8
				unset($topic_ids);
d6e8d8
d6e8d8
				$template->assign_var('S_EDIT_DRAFT', $edit);
d6e8d8
d6e8d8
				$row_count = 0;
d6e8d8
				foreach ($draftrows as $draft)
d6e8d8
				{
d6e8d8
					$link_topic = $link_forum = $link_pm = false;
d6e8d8
					$insert_url = $view_url = $title = '';
d6e8d8
d6e8d8
					if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
d6e8d8
					{
d6e8d8
						$link_topic = true;
d6e8d8
						$view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id']);
d6e8d8
						$title = $topic_rows[$draft['topic_id']]['topic_title'];
d6e8d8
d6e8d8
						$insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']);
d6e8d8
					}
d6e8d8
					else if ($auth->acl_get('f_read', $draft['forum_id']))
d6e8d8
					{
d6e8d8
						$link_forum = true;
d6e8d8
						$view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']);
d6e8d8
						$title = $draft['forum_name'];
d6e8d8
d6e8d8
						$insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']);
d6e8d8
					}
d6e8d8
					else if ($pm_drafts)
d6e8d8
					{
d6e8d8
						$link_pm = true;
d6e8d8
						$insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d=" . $draft['draft_id']);
d6e8d8
					}
d6e8d8
d6e8d8
					$template_row = array(
d6e8d8
						'DATE'			=> $user->format_date($draft['save_time']),
d6e8d8
						'DRAFT_MESSAGE'	=> ($submit) ? $draft_message : $draft['draft_message'],
d6e8d8
						'DRAFT_SUBJECT'	=> ($submit) ? $draft_subject : $draft['draft_subject'],
d6e8d8
						'TITLE'			=> $title,
d6e8d8
d6e8d8
						'DRAFT_ID'	=> $draft['draft_id'],
d6e8d8
						'FORUM_ID'	=> $draft['forum_id'],
d6e8d8
						'TOPIC_ID'	=> $draft['topic_id'],
d6e8d8
d6e8d8
						'U_VIEW'		=> $view_url,
d6e8d8
						'U_VIEW_EDIT'	=> $this->u_action . '&edit=' . $draft['draft_id'],
d6e8d8
						'U_INSERT'		=> $insert_url,
d6e8d8
d6e8d8
						'S_LINK_TOPIC'		=> $link_topic,
d6e8d8
						'S_LINK_FORUM'		=> $link_forum,
d6e8d8
						'S_LINK_PM'			=> $link_pm,
d6e8d8
						'S_HIDDEN_FIELDS'	=> $s_hidden_fields
d6e8d8
					);
d6e8d8
					$row_count++;
d6e8d8
d6e8d8
					($edit) ? $template->assign_vars($template_row) : $template->assign_block_vars('draftrow', $template_row);
d6e8d8
				}
d6e8d8
d6e8d8
				if (!$edit)
d6e8d8
				{
d6e8d8
					$template->assign_var('S_DRAFT_ROWS', $row_count);
d6e8d8
				}
d6e8d8
d6e8d8
			break;
d6e8d8
		}
d6e8d8
d6e8d8
d6e8d8
		$template->assign_vars(array(
d6e8d8
			'L_TITLE'			=> $user->lang['UCP_MAIN_' . strtoupper($mode)],
d6e8d8
d6e8d8
			'S_DISPLAY_MARK_ALL'	=> ($mode == 'watched' || ($mode == 'drafts' && !isset($_GET['edit']))) ? true : false,
d6e8d8
			'S_HIDDEN_FIELDS'		=> (isset($s_hidden_fields)) ? $s_hidden_fields : '',
d6e8d8
			'S_UCP_ACTION'			=> $this->u_action,
d6e8d8
d6e8d8
			'LAST_POST_IMG'			=> $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
d6e8d8
			'NEWEST_POST_IMG'		=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
d6e8d8
		));
d6e8d8
d6e8d8
		// Set desired template
d6e8d8
		$this->tpl_name = 'ucp_main_' . $mode;
d6e8d8
		$this->page_title = 'UCP_MAIN_' . strtoupper($mode);
d6e8d8
	}
d6e8d8
d6e8d8
	/**
d6e8d8
	* Build and assign topiclist for bookmarks/subscribed topics
d6e8d8
	*/
d6e8d8
	function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
d6e8d8
	{
d6e8d8
		global $user, $db, $template, $config, $auth, $phpbb_root_path, $phpEx;
d6e8d8
d6e8d8
		$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
d6e8d8
		$start = request_var('start', 0);
d6e8d8
d6e8d8
		$sql_array = array(
d6e8d8
			'SELECT'	=> 'COUNT(t.topic_id) as topics_count',
d6e8d8
d6e8d8
			'FROM'		=> array(
d6e8d8
				$table			=> 'i',
d6e8d8
				TOPICS_TABLE	=> 't'
d6e8d8
			),
d6e8d8
d6e8d8
			'WHERE'		=>	'i.topic_id = t.topic_id
d6e8d8
				AND i.user_id = ' . $user->data['user_id'] . '
d6e8d8
				AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true),
d6e8d8
		);
d6e8d8
		$sql = $db->sql_build_query('SELECT', $sql_array);
d6e8d8
		$result = $db->sql_query($sql);
d6e8d8
		$topics_count = (int) $db->sql_fetchfield('topics_count');
d6e8d8
		$db->sql_freeresult($result);
d6e8d8
d6e8d8
		if ($topics_count)
d6e8d8
		{
d6e8d8
			$template->assign_vars(array(
d6e8d8
				'PAGINATION'	=> generate_pagination($this->u_action, $topics_count, $config['topics_per_page'], $start),
d6e8d8
				'PAGE_NUMBER'	=> on_page($topics_count, $config['topics_per_page'], $start),
d6e8d8
				'TOTAL_TOPICS'	=> ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count))
d6e8d8
			);
d6e8d8
		}
d6e8d8
d6e8d8
		if ($mode == 'subscribed')
d6e8d8
		{
d6e8d8
			$sql_array = array(
d6e8d8
				'SELECT'	=> 't.*, f.forum_name',
d6e8d8
d6e8d8
				'FROM'		=> array(
d6e8d8
					TOPICS_WATCH_TABLE	=> 'tw',
d6e8d8
					TOPICS_TABLE		=> 't'
d6e8d8
				),
d6e8d8
d6e8d8
				'WHERE'		=> 'tw.user_id = ' . $user->data['user_id'] . '
d6e8d8
					AND t.topic_id = tw.topic_id
d6e8d8
					AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true),
d6e8d8
d6e8d8
d6e8d8
				'ORDER_BY'	=> 't.topic_last_post_time DESC'
d6e8d8
			);
d6e8d8
d6e8d8
			$sql_array['LEFT_JOIN'] = array();
d6e8d8
		}
d6e8d8
		else
d6e8d8
		{
d6e8d8
			$sql_array = array(
d6e8d8
				'SELECT'	=> 't.*, f.forum_name, b.topic_id as b_topic_id',
d6e8d8
d6e8d8
				'FROM'		=> array(
d6e8d8
					BOOKMARKS_TABLE		=> 'b',
d6e8d8
				),
d6e8d8
d6e8d8
				'WHERE'		=> 'b.user_id = ' . $user->data['user_id'] . '
d6e8d8
					AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true),
d6e8d8
d6e8d8
				'ORDER_BY'	=> 't.topic_last_post_time DESC'
d6e8d8
			);
d6e8d8
d6e8d8
			$sql_array['LEFT_JOIN'] = array();
d6e8d8
			$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'b.topic_id = t.topic_id');
d6e8d8
		}
d6e8d8
d6e8d8
		$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
d6e8d8
d6e8d8
		if ($config['load_db_lastread'])
d6e8d8
		{
d6e8d8
			$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']);
d6e8d8
			$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']);
d6e8d8
			$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time AS forum_mark_time';
d6e8d8
		}
d6e8d8
d6e8d8
		if ($config['load_db_track'])
d6e8d8
		{
d6e8d8
			$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']);
d6e8d8
			$sql_array['SELECT'] .= ', tp.topic_posted';
d6e8d8
		}
d6e8d8
d6e8d8
		$sql = $db->sql_build_query('SELECT', $sql_array);
d6e8d8
		$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
d6e8d8
d6e8d8
		$topic_list = $topic_forum_list = $global_announce_list = $rowset = array();
d6e8d8
		while ($row = $db->sql_fetchrow($result))
d6e8d8
		{
d6e8d8
			$topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
d6e8d8
d6e8d8
			$topic_list[] = $topic_id;
d6e8d8
			$rowset[$topic_id] = $row;
d6e8d8
d6e8d8
			$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
d6e8d8
			$topic_forum_list[$row['forum_id']]['topics'][] = $topic_id;
d6e8d8
d6e8d8
			if ($row['topic_type'] == POST_GLOBAL)
d6e8d8
			{
d6e8d8
				$global_announce_list[] = $topic_id;
d6e8d8
			}
d6e8d8
		}
d6e8d8
		$db->sql_freeresult($result);
d6e8d8
d6e8d8
		$topic_tracking_info = array();
d6e8d8
		if ($config['load_db_lastread'])
d6e8d8
		{
d6e8d8
			foreach ($topic_forum_list as $f_id => $topic_row)
d6e8d8
			{
d6e8d8
				$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), ($f_id == 0) ? $global_announce_list : false);
d6e8d8
			}
d6e8d8
		}
d6e8d8
		else
d6e8d8
		{
d6e8d8
			foreach ($topic_forum_list as $f_id => $topic_row)
d6e8d8
			{
d6e8d8
				$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics'], $global_announce_list);
d6e8d8
			}
d6e8d8
		}
d6e8d8
d6e8d8
		foreach ($topic_list as $topic_id)
d6e8d8
		{
d6e8d8
			$row = &$rowset[$topic_id];
d6e8d8
d6e8d8
			$forum_id = $row['forum_id'];
d6e8d8
			$topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
d6e8d8
d6e8d8
			$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
d6e8d8
d6e8d8
			// Replies
d6e8d8
			$replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies'];
d6e8d8
d6e8d8
			if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
d6e8d8
			{
d6e8d8
				$topic_id = $row['topic_moved_id'];
d6e8d8
			}
d6e8d8
d6e8d8
			// Get folder img, topic status/type related information
d6e8d8
			$folder_img = $folder_alt = $topic_type = '';
d6e8d8
			topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
d6e8d8
d6e8d8
			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");
d6e8d8
d6e8d8
			// Send vars to template
d6e8d8
			$template->assign_block_vars('topicrow', array(
d6e8d8
				'FORUM_ID'					=> $forum_id,
d6e8d8
				'TOPIC_ID'					=> $topic_id,
d6e8d8
				'FIRST_POST_TIME'			=> $user->format_date($row['topic_time']),
d6e8d8
				'LAST_POST_SUBJECT'			=> $row['topic_last_post_subject'],
d6e8d8
				'LAST_POST_TIME'			=> $user->format_date($row['topic_last_post_time']),
d6e8d8
				'LAST_VIEW_TIME'			=> $user->format_date($row['topic_last_view_time']),
d6e8d8
d6e8d8
				'TOPIC_AUTHOR'				=> get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
				'TOPIC_AUTHOR_COLOUR'		=> get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
				'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
				'U_TOPIC_AUTHOR'			=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
d6e8d8
d6e8d8
				'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
				'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
				'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
				'U_LAST_POST_AUTHOR'		=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
d6e8d8
d6e8d8
				'S_DELETED_TOPIC'	=> (!$row['topic_id']) ? true : false,
d6e8d8
				'S_GLOBAL_TOPIC'	=> (!$forum_id) ? true : false,
d6e8d8
d6e8d8
				'PAGINATION'		=> topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . "&t=$topic_id")),
d6e8d8
				'REPLIES'			=> $replies,
d6e8d8
				'VIEWS'				=> $row['topic_views'],
d6e8d8
				'TOPIC_TITLE'		=> censor_text($row['topic_title']),
d6e8d8
				'TOPIC_TYPE'		=> $topic_type,
d6e8d8
				'FORUM_NAME'		=> $row['forum_name'],
d6e8d8
d6e8d8
				'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
d6e8d8
				'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
d6e8d8
				'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
d6e8d8
				'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
d6e8d8
				'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
d6e8d8
				'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
d6e8d8
d6e8d8
				'S_TOPIC_TYPE'			=> $row['topic_type'],
d6e8d8
				'S_USER_POSTED'			=> (!empty($row['topic_posted'])) ? true : false,
d6e8d8
				'S_UNREAD_TOPIC'		=> $unread_topic,
d6e8d8
d6e8d8
				'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread',
d6e8d8
				'U_LAST_POST'			=> $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
d6e8d8
				'U_VIEW_TOPIC'			=> $view_topic_url,
d6e8d8
				'U_VIEW_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
d6e8d8
			));
d6e8d8
		}
d6e8d8
	}
d6e8d8
}
d6e8d8
d6e8d8
?>