diff options
Diffstat (limited to 'phpBB/includes/functions_display.php')
| -rw-r--r-- | phpBB/includes/functions_display.php | 49 | 
1 files changed, 15 insertions, 34 deletions
| diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ee7048638d..18db64cc68 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -2,9 +2,8 @@  /**  *  * @package phpBB3 -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -23,6 +22,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  {  	global $db, $auth, $user, $template;  	global $phpbb_root_path, $phpEx, $config; +	global $request;  	$forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();  	$parent_id = $visible_forums = 0; @@ -90,7 +90,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  	}  	else if ($config['load_anon_lastread'] || $user->data['is_registered'])  	{ -		$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : ''; +		$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);  		$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();  		if (!$user->data['is_registered']) @@ -109,7 +109,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  		$sql_array['SELECT'] .= ', fa.user_id';  	} -	$sql = $db->sql_build_query('SELECT', array( +	$sql_ary = array(  		'SELECT'	=> $sql_array['SELECT'],  		'FROM'		=> $sql_array['FROM'],  		'LEFT_JOIN'	=> $sql_array['LEFT_JOIN'], @@ -117,25 +117,14 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  		'WHERE'		=> $sql_where,  		'ORDER_BY'	=> 'f.left_id', -	)); +	); +	$sql = $db->sql_build_query('SELECT', $sql_ary);  	$result = $db->sql_query($sql);  	$forum_tracking_info = array();  	$branch_root_id = $root_data['forum_id']; -	// Check for unread global announcements (index page only) -	$ga_unread = false; -	if ($root_data['forum_id'] == 0) -	{ -		$unread_ga_list = get_unread_topics($user->data['user_id'], 'AND t.forum_id = 0', '', 1); - -		if (!empty($unread_ga_list)) -		{ -			$ga_unread = true; -		} -	} -  	while ($row = $db->sql_fetchrow($result))  	{  		$forum_id = $row['forum_id']; @@ -281,11 +270,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  		$token = request_var('hash', '');  		if (check_link_hash($token, 'global'))  		{ -			// Add 0 to forums array to mark global announcements correctly -			$forum_ids[] = 0;  			markread('topics', $forum_ids);  			$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');  			meta_refresh(3, $redirect); +  			trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);  		}  		else @@ -334,12 +322,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  		$forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false; -		// Mark the first visible forum on index as unread if there's any unread global announcement -		if ($ga_unread && !empty($forum_ids_moderator) && $forum_id == $forum_ids_moderator[0]) -		{ -			$forum_unread = true; -		} -  		$folder_image = $folder_alt = $l_subforums = '';  		$subforums_list = array(); @@ -476,8 +458,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod  			'FORUM_DESC'			=> generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']),  			'TOPICS'				=> $row['forum_topics'],  			$l_post_click_count		=> $post_click_count, +			'FORUM_IMG_STYLE'		=> $folder_image,  			'FORUM_FOLDER_IMG'		=> $user->img($folder_image, $folder_alt), -			'FORUM_FOLDER_IMG_SRC'	=> $user->img($folder_image, $folder_alt, false, '', 'src'),  			'FORUM_FOLDER_IMG_ALT'	=> isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '',  			'FORUM_IMAGE'			=> ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $user->lang[$folder_alt] . '" />' : '',  			'FORUM_IMAGE_SRC'		=> ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', @@ -1061,10 +1043,10 @@ function display_user_activity(&$userdata)  	$template->assign_vars(array(  		'ACTIVE_FORUM'			=> $active_f_name, -		'ACTIVE_FORUM_POSTS'	=> ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), +		'ACTIVE_FORUM_POSTS'	=> $user->lang('USER_POSTS', (int) $active_f_count),  		'ACTIVE_FORUM_PCT'		=> sprintf($l_active_pct, $active_f_pct),  		'ACTIVE_TOPIC'			=> censor_text($active_t_name), -		'ACTIVE_TOPIC_POSTS'	=> ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), +		'ACTIVE_TOPIC_POSTS'	=> $user->lang('USER_POSTS', (int) $active_t_count),  		'ACTIVE_TOPIC_PCT'		=> sprintf($l_active_pct, $active_t_pct),  		'U_ACTIVE_FORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $active_f_id),  		'U_ACTIVE_TOPIC'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id), @@ -1078,6 +1060,7 @@ function display_user_activity(&$userdata)  function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '')  {  	global $template, $db, $user, $phpEx, $start, $phpbb_root_path; +	global $request;  	$table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE;  	$where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; @@ -1105,7 +1088,6 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,  		if (!is_null($notify_status) && $notify_status !== '')  		{ -  			if (isset($_GET['unwatch']))  			{  				$uid = request_var('uid', 0); @@ -1113,7 +1095,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,  				if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))  				{ -					if ($uid != $user_id || $_GET['unwatch'] != $mode) +					if ($uid != $user_id || $request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode)  					{  						$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");  						$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); @@ -1178,7 +1160,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,  				if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))  				{ -					if ($uid != $user_id || $_GET['watch'] != $mode) +					if ($uid != $user_id || $request->variable('watch', '', false, phpbb_request_interface::GET) != $mode)  					{  						$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");  						$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); @@ -1221,7 +1203,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,  	}  	else  	{ -		if ((isset($_GET['unwatch']) && $_GET['unwatch'] == $mode) || (isset($_GET['watch']) && $_GET['watch'] == $mode)) +		if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode) || +			(isset($_GET['watch']) && $request->variable('watch', '', false, phpbb_request_interface::GET) == $mode))  		{  			login_box();  		} @@ -1339,5 +1322,3 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $  	$avatar_img .= $avatar;  	return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';  } - -?>
\ No newline at end of file | 
