diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_front.php')
| -rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 132 | 
1 files changed, 41 insertions, 91 deletions
| diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index af262baa29..ba4b15895a 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -2,9 +2,8 @@  /**  *  * @package mcp -* @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  *  */ @@ -39,7 +38,7 @@ function mcp_front_view($id, $mode, $action)  		{  			$sql = 'SELECT COUNT(post_id) AS total  				FROM ' . POSTS_TABLE . ' -				WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') +				WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '  					AND post_approved = 0';  			$result = $db->sql_query($sql);  			$total = (int) $db->sql_fetchfield('total'); @@ -47,8 +46,6 @@ function mcp_front_view($id, $mode, $action)  			if ($total)  			{ -				$global_id = $forum_list[0]; -  				$sql = 'SELECT forum_id, forum_name  					FROM ' . FORUMS_TABLE . '  					WHERE ' . $db->sql_in_set('forum_id', $forum_list); @@ -62,7 +59,7 @@ function mcp_front_view($id, $mode, $action)  				$sql = 'SELECT post_id  					FROM ' . POSTS_TABLE . ' -					WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') +					WHERE ' . $db->sql_in_set('forum_id', $forum_list) . '  						AND post_approved = 0  					ORDER BY post_time DESC';  				$result = $db->sql_query_limit($sql, 5); @@ -81,7 +78,7 @@ function mcp_front_view($id, $mode, $action)  			if ($total)  			{ -				$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id +				$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id  					FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u  					WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '  						AND t.topic_id = p.topic_id @@ -91,17 +88,11 @@ function mcp_front_view($id, $mode, $action)  				while ($row = $db->sql_fetchrow($result))  				{ -					$global_topic = ($row['forum_id']) ? false : true; -					if ($global_topic) -					{ -						$row['forum_id'] = $global_id; -					} -  					$template->assign_block_vars('unapproved', array(  						'U_POST_DETAILS'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $row['forum_id'] . '&p=' . $row['post_id']), -						'U_MCP_FORUM'		=> (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view&f=' . $row['forum_id']) : '', +						'U_MCP_FORUM'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view&f=' . $row['forum_id']),  						'U_MCP_TOPIC'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&f=' . $row['forum_id'] . '&t=' . $row['topic_id']), -						'U_FORUM'			=> (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', +						'U_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),  						'U_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),  						'AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']), @@ -109,12 +100,13 @@ function mcp_front_view($id, $mode, $action)  						'AUTHOR_COLOUR'		=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour']),  						'U_AUTHOR'			=> get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour']), -						'FORUM_NAME'	=> (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], +						'FORUM_NAME'	=> $forum_names[$row['forum_id']],  						'POST_ID'		=> $row['post_id'],  						'TOPIC_TITLE'	=> $row['topic_title'],  						'SUBJECT'		=> ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'], -						'POST_TIME'		=> $user->format_date($row['post_time'])) -					); +						'POST_TIME'		=> $user->format_date($row['post_time']), +						'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', +					));  				}  				$db->sql_freeresult($result);  			} @@ -126,22 +118,9 @@ function mcp_front_view($id, $mode, $action)  			$template->assign_vars(array(  				'S_HIDDEN_FIELDS'		=> $s_hidden_fields,  				'S_MCP_QUEUE_ACTION'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"), +				'L_UNAPPROVED_TOTAL'	=> $user->lang('UNAPPROVED_POSTS_TOTAL', (int) $total), +				'S_HAS_UNAPPROVED_POSTS'=> ($total != 0),  			)); - -			if ($total == 0) -			{ -				$template->assign_vars(array( -					'L_UNAPPROVED_TOTAL'		=> $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'], -					'S_HAS_UNAPPROVED_POSTS'	=> false) -				); -			} -			else -			{ -				$template->assign_vars(array( -					'L_UNAPPROVED_TOTAL'		=> ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total), -					'S_HAS_UNAPPROVED_POSTS'	=> true) -				); -			}  		}  	} @@ -159,31 +138,29 @@ function mcp_front_view($id, $mode, $action)  				WHERE r.post_id = p.post_id  					AND r.pm_id = 0  					AND r.report_closed = 0 -					AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; +					AND ' . $db->sql_in_set('p.forum_id', $forum_list);  			$result = $db->sql_query($sql);  			$total = (int) $db->sql_fetchfield('total');  			$db->sql_freeresult($result);  			if ($total)  			{ -				$global_id = $forum_list[0]; - -				$sql = $db->sql_build_query('SELECT', array( -					'SELECT'	=> 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', +				$sql_ary = array( +					'SELECT'	=> 'r.report_time, p.post_id, p.post_subject, p.post_time, p.post_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',  					'FROM'		=> array(  						REPORTS_TABLE			=> 'r',  						REPORTS_REASONS_TABLE	=> 'rr',  						TOPICS_TABLE			=> 't',  						USERS_TABLE				=> array('u', 'u2'), -						POSTS_TABLE				=> 'p' +						POSTS_TABLE				=> 'p',  					),  					'LEFT_JOIN'	=> array(  						array(  							'FROM'	=> array(FORUMS_TABLE => 'f'), -							'ON'	=> 'f.forum_id = p.forum_id' -						) +							'ON'	=> 'f.forum_id = p.forum_id', +						),  					),  					'WHERE'		=> 'r.post_id = p.post_id @@ -193,25 +170,20 @@ function mcp_front_view($id, $mode, $action)  						AND p.topic_id = t.topic_id  						AND r.user_id = u.user_id  						AND p.poster_id = u2.user_id -						AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')', +						AND ' . $db->sql_in_set('p.forum_id', $forum_list), -					'ORDER_BY'	=> 'p.post_time DESC' -				)); +					'ORDER_BY'	=> 'p.post_time DESC', +				); +				$sql = $db->sql_build_query('SELECT', $sql_ary);  				$result = $db->sql_query_limit($sql, 5);  				while ($row = $db->sql_fetchrow($result))  				{ -					$global_topic = ($row['forum_id']) ? false : true; -					if ($global_topic) -					{ -						$row['forum_id'] = $global_id; -					} -  					$template->assign_block_vars('report', array(  						'U_POST_DETAILS'	=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id'] . "&i=reports&mode=report_details"), -						'U_MCP_FORUM'		=> (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view") : '', +						'U_MCP_FORUM'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view"),  						'U_MCP_TOPIC'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . "&i=$id&mode=topic_view"), -						'U_FORUM'			=> (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', +						'U_FORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),  						'U_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),  						'REPORTER_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), @@ -224,29 +196,20 @@ function mcp_front_view($id, $mode, $action)  						'AUTHOR_COLOUR'		=> get_username_string('colour', $row['author_id'], $row['author_name'], $row['author_colour']),  						'U_AUTHOR'			=> get_username_string('profile', $row['author_id'], $row['author_name'], $row['author_colour']), -						'FORUM_NAME'	=> (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'], +						'FORUM_NAME'	=> $row['forum_name'],  						'TOPIC_TITLE'	=> $row['topic_title'],  						'SUBJECT'		=> ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],  						'REPORT_TIME'	=> $user->format_date($row['report_time']),  						'POST_TIME'		=> $user->format_date($row['post_time']), +						'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',  					));  				}  			} -			if ($total == 0) -			{ -				$template->assign_vars(array( -					'L_REPORTS_TOTAL'	=>	$user->lang['REPORTS_ZERO_TOTAL'], -					'S_HAS_REPORTS'		=>	false) -				); -			} -			else -			{ -				$template->assign_vars(array( -					'L_REPORTS_TOTAL'	=> ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total), -					'S_HAS_REPORTS'		=> true) -				); -			} +			$template->assign_vars(array( +				'L_REPORTS_TOTAL'	=> $user->lang('REPORTS_TOTAL', (int) $total), +				'S_HAS_REPORTS'		=> ($total != 0), +			));  		}  	} @@ -269,14 +232,14 @@ function mcp_front_view($id, $mode, $action)  		{  			include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); -			$sql = $db->sql_build_query('SELECT', array( -				'SELECT'	=> 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id', +			$sql_ary = array( +				'SELECT'	=> 'r.report_id, r.report_time, p.msg_id, p.message_subject, p.message_time, p.to_address, p.bcc_address, p.message_attachment, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id',  				'FROM'		=> array(  					REPORTS_TABLE			=> 'r',  					REPORTS_REASONS_TABLE	=> 'rr',  					USERS_TABLE				=> array('u', 'u2'), -					PRIVMSGS_TABLE				=> 'p' +					PRIVMSGS_TABLE				=> 'p',  				),  				'WHERE'		=> 'r.pm_id = p.msg_id @@ -286,8 +249,9 @@ function mcp_front_view($id, $mode, $action)  					AND r.user_id = u.user_id  					AND p.author_id = u2.user_id', -				'ORDER_BY'	=> 'p.message_time DESC' -			)); +				'ORDER_BY'	=> 'p.message_time DESC', +			); +			$sql = $db->sql_build_query('SELECT', $sql_ary);  			$result = $db->sql_query_limit($sql, 5);  			$pm_by_id = $pm_list = array(); @@ -320,24 +284,15 @@ function mcp_front_view($id, $mode, $action)  					'REPORT_TIME'		=> $user->format_date($row['report_time']),  					'PM_TIME'			=> $user->format_date($row['message_time']),  					'RECIPIENTS'		=> implode(', ', $address_list[$row['msg_id']]), +					'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_download') && $row['message_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',  				));  			}  		} -		if ($total == 0) -		{ -			$template->assign_vars(array( -				'L_PM_REPORTS_TOTAL'	=>	$user->lang['PM_REPORTS_ZERO_TOTAL'], -				'S_HAS_PM_REPORTS'		=>	false) -			); -		} -		else -		{ -			$template->assign_vars(array( -				'L_PM_REPORTS_TOTAL'	=> ($total == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total), -				'S_HAS_PM_REPORTS'		=> true) -			); -		} +		$template->assign_vars(array( +			'L_PM_REPORTS_TOTAL'	=> $user->lang('PM_REPORTS_TOTAL', (int) $total), +			'S_HAS_PM_REPORTS'		=> ($total != 0), +		));  	}  	// Latest 5 logs @@ -347,9 +302,6 @@ function mcp_front_view($id, $mode, $action)  		if (!empty($forum_list))  		{ -			// Add forum_id 0 for global announcements -			$forum_list[] = 0; -  			$log_count = false;  			$log = array();  			view_log('mod', $log, $log_count, 5, 0, $forum_list); @@ -376,5 +328,3 @@ function mcp_front_view($id, $mode, $action)  	$template->assign_var('S_MCP_ACTION', append_sid("{$phpbb_root_path}mcp.$phpEx"));  	make_jumpbox(append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view'), 0, false, 'm_', true);  } - -?>
\ No newline at end of file | 
