diff options
Diffstat (limited to 'phpBB/includes/mcp')
| -rw-r--r-- | phpBB/includes/mcp/info/mcp_pm_reports.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_ban.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 5 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 4 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_logs.php | 1 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 32 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_notes.php | 5 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 5 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 10 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 103 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_reports.php | 19 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 7 | ||||
| -rw-r--r-- | phpBB/includes/mcp/mcp_warn.php | 15 | 
13 files changed, 131 insertions, 79 deletions
| diff --git a/phpBB/includes/mcp/info/mcp_pm_reports.php b/phpBB/includes/mcp/info/mcp_pm_reports.php index 07dc564b19..d530a917cb 100644 --- a/phpBB/includes/mcp/info/mcp_pm_reports.php +++ b/phpBB/includes/mcp/info/mcp_pm_reports.php @@ -19,7 +19,7 @@ class mcp_pm_reports_info  			'title'		=> 'MCP_PM_REPORTS',  			'version'	=> '1.0.0',  			'modes'		=> array( -				'pm_reports'			=> array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')), +				'pm_reports'		=> array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),  				'pm_reports_closed'	=> array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),  				'pm_report_details'	=> array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report', 'cat' => array('MCP_REPORTS')),  			), diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index d3bc336293..925d0878fc 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -171,7 +171,7 @@ class mcp_ban  				case 'user':  					$pre_fill = (string) $db->sql_fetchfield('username');  				break; -				 +  				case 'ip':  					$pre_fill = (string) $db->sql_fetchfield('user_ip');  				break; diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index a3b2184d48..b4f7f4d70a 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -135,7 +135,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info)  		'S_MCP_ACTION'			=> $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''), -		'PAGE_NUMBER'			=> $pagination->on_page($base_url, $forum_topics, $topics_per_page, $start),  		'TOTAL_TOPICS'			=> $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics),  	)); @@ -225,7 +224,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)  		$topic_title = censor_text($row['topic_title']); -		$topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED  && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false; +		$topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE)  && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;  		$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])) ? true : false;  		$topic_deleted = $row['topic_visibility'] == ITEM_DELETED;  		$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? $url . '&i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . '&t=' . $row['topic_id'] : ''; @@ -303,7 +302,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)  		* @event core.mcp_view_forum_modify_topicrow  		* @var	array	row			Array with topic data  		* @var	array	topic_row	Template array with topic data -		* @since 3.1-A1 +		* @since 3.1.0-a1  		*/  		$vars = array('row', 'topic_row');  		extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_topicrow', compact($vars))); diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 44cab5d910..aee43c471d 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -39,7 +39,7 @@ function mcp_front_view($id, $mode, $action)  			$sql = 'SELECT COUNT(post_id) AS total  				FROM ' . POSTS_TABLE . '  				WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' -					AND post_visibility = ' . ITEM_UNAPPROVED; +					AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE));  			$result = $db->sql_query($sql);  			$total = (int) $db->sql_fetchfield('total');  			$db->sql_freeresult($result); @@ -60,7 +60,7 @@ function mcp_front_view($id, $mode, $action)  				$sql = 'SELECT post_id  					FROM ' . POSTS_TABLE . '  					WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' -						AND post_visibility = ' . ITEM_UNAPPROVED . ' +						AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . '  					ORDER BY post_time DESC';  				$result = $db->sql_query_limit($sql, 5); diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index ac7896606a..7bcb0fc477 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -177,7 +177,6 @@ class mcp_logs  		$pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);  		$template->assign_vars(array( -			'PAGE_NUMBER'		=> $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),  			'TOTAL'				=> $user->lang('TOTAL_LOGS', (int) $log_count),  			'L_TITLE'			=> $user->lang['MCP_LOGS'], diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index d9197da07e..6b2e9266b3 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -34,6 +34,7 @@ class mcp_main  	{  		global $auth, $db, $user, $template, $action;  		global $config, $phpbb_root_path, $phpEx, $request; +		global $phpbb_dispatcher;  		$quickmod = ($mode == 'quickmod') ? true : false; @@ -151,6 +152,16 @@ class mcp_main  				mcp_restore_topic($topic_ids);  			break; + +			default: +				/** +				* This event allows you to handle custom quickmod options +				* +				* @event core.modify_quickmod_actions +				* @since 3.1.0-a4 +				*/ +				$phpbb_dispatcher->dispatch('core.modify_quickmod_actions'); +			break;  		}  		switch ($mode) @@ -404,9 +415,8 @@ function change_topic_type($action, $topic_ids)  */  function mcp_move_topic($topic_ids)  { -	global $auth, $user, $db, $template; +	global $auth, $user, $db, $template, $phpbb_log, $request;  	global $phpEx, $phpbb_root_path; -	global $request;  	// Here we limit the operation to one forum only  	$forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); @@ -483,7 +493,7 @@ function mcp_move_topic($topic_ids)  			{  				$topics_moved++;  			} -			elseif ($topic_info['topic_visibility'] == ITEM_UNAPPROVED) +			elseif ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE)  			{  				$topics_moved_unapproved++;  			} @@ -514,9 +524,19 @@ function mcp_move_topic($topic_ids)  		$forum_ids = array($to_forum_id);  		foreach ($topic_data as $topic_id => $row)  		{ -			// Get the list of forums to resync, add a log entry +			// Get the list of forums to resync  			$forum_ids[] = $row['forum_id']; -			add_log('mod', $to_forum_id, $topic_id, 'LOG_MOVE', $row['forum_name'], $forum_data['forum_name']); + +			// We add the $to_forum_id twice, because 'forum_id' is updated +			// when the topic is moved again later. +			$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array( +				'forum_id'		=> (int) $to_forum_id, +				'topic_id'		=> (int) $topic_id, +				$row['forum_name'], +				$forum_data['forum_name'], +				(int) $row['forum_id'], +				(int) $forum_data['forum_id'], +			));  			// Leave a redirection if required and only if the topic is visible to users  			if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL) @@ -1210,6 +1230,7 @@ function mcp_fork_topic($topic_ids)  					$total_topics++;  				break;  				case ITEM_UNAPPROVED: +				case ITEM_REAPPROVE:  					$total_topics_unapproved++;  				break;  				case ITEM_DELETED: @@ -1296,6 +1317,7 @@ function mcp_fork_topic($topic_ids)  						$total_posts++;  					break;  					case ITEM_UNAPPROVED: +					case ITEM_REAPPROVE:  						$total_posts_unapproved++;  					break;  					case ITEM_DELETED: diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index 055ca0e882..be8e09b0c3 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -174,10 +174,6 @@ class mcp_notes  		}  		// Generate the appropriate user information for the user we are looking at -		if (!function_exists('phpbb_get_user_avatar')) -		{ -			include($phpbb_root_path . 'includes/functions_display.' . $phpEx); -		}  		$rank_title = $rank_img = '';  		$avatar_img = phpbb_get_user_avatar($userrow); @@ -229,7 +225,6 @@ class mcp_notes  			'L_TITLE'			=> $user->lang['MCP_NOTES_USER'], -			'PAGE_NUMBER'		=> $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),  			'TOTAL_REPORTS'		=> $user->lang('LIST_REPORTS', (int) $log_count),  			'RANK_TITLE'		=> $rank_title, diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index d0801a2b47..b0a06dd6ce 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -170,7 +170,7 @@ class mcp_pm_reports  					'U_MCP_USER_NOTES'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $pm_info['author_id']),  					'U_MCP_WARN_REPORTER'		=> ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '',  					'U_MCP_WARN_USER'			=> ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $pm_info['author_id']) : '', -					 +  					'EDIT_IMG'				=> $user->img('icon_post_edit', $user->lang['EDIT_POST']),  					'MINI_POST_IMG'			=> $user->img('icon_post_target', 'POST'), @@ -304,12 +304,11 @@ class mcp_pm_reports  				$template->assign_vars(array(  					'L_EXPLAIN'				=> ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_PM_REPORTS_CLOSED_EXPLAIN'],  					'L_TITLE'				=> ($mode == 'pm_reports') ? $user->lang['MCP_PM_REPORTS_OPEN'] : $user->lang['MCP_PM_REPORTS_CLOSED'], -					 +  					'S_PM'					=> true,  					'S_MCP_ACTION'			=> $this->u_action,  					'S_CLOSED'				=> ($mode == 'pm_reports_closed') ? true : false, -					'PAGE_NUMBER'			=> $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),  					'TOTAL'					=> $total,  					'TOTAL_REPORTS'			=> $user->lang('LIST_REPORTS', (int) $total),  					) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 06f27655ae..5925575577 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -203,7 +203,7 @@ function mcp_post_details($id, $mode, $action)  		'S_CAN_DELETE_POST'		=> $auth->acl_get('m_delete', $post_info['forum_id']),  		'S_POST_REPORTED'		=> ($post_info['post_reported']) ? true : false, -		'S_POST_UNAPPROVED'		=> ($post_info['post_visibility'] == ITEM_UNAPPROVED) ? true : false, +		'S_POST_UNAPPROVED'		=> ($post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE) ? true : false,  		'S_POST_DELETED'		=> ($post_info['post_visibility'] == ITEM_DELETED) ? true : false,  		'S_POST_LOCKED'			=> ($post_info['post_edit_locked']) ? true : false,  		'S_USER_NOTES'			=> true, @@ -294,8 +294,8 @@ function mcp_post_details($id, $mode, $action)  					'REPORT_ID'		=> $row['report_id'],  					'REASON_TITLE'	=> $row['reason_title'],  					'REASON_DESC'	=> $row['reason_description'], -					'REPORTER'		=> ($row['user_id'] != ANONYMOUS) ? $row['username'] : $user->lang['GUEST'], -					'U_REPORTER'	=> ($row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '', +					'REPORTER'		=> get_username_string('username', $row['user_id'], $row['username']), +					'U_REPORTER'	=> get_username_string('profile', $row['user_id'], $row['username']),  					'USER_NOTIFY'	=> ($row['user_notify']) ? true : false,  					'REPORT_TIME'	=> $user->format_date($row['report_time']),  					'REPORT_TEXT'	=> bbcode_nl2br(trim($row['report_text'])), @@ -354,11 +354,11 @@ function mcp_post_details($id, $mode, $action)  			foreach ($users_ary as $user_id => $user_row)  			{  				$template->assign_block_vars('userrow', array( -					'USERNAME'		=> ($user_id == ANONYMOUS) ? $user->lang['GUEST'] : $user_row['username'], +					'USERNAME'		=> get_username_string('username', $user_id, $user_row['username']),  					'NUM_POSTS'		=> $user_row['postings'],  					'L_POST_S'		=> ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'], -					'U_PROFILE'		=> ($user_id == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id), +					'U_PROFILE'		=> get_username_string('profile', $user_id, $user_row['username']),  					'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics'))  				);  			} diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 3b6897f4e1..a71bc997e9 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -115,10 +115,10 @@ class mcp_queue  				if (!empty($topic_id_list))  				{ -					$post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : ITEM_UNAPPROVED; +					$post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : array(ITEM_UNAPPROVED, ITEM_REAPPROVE);  					$sql = 'SELECT post_id  						FROM ' . POSTS_TABLE . ' -						WHERE post_visibility = ' . $post_visibility . ' +						WHERE ' . $db->sql_in_set('post_visibility', $post_visibility) . '  							AND ' . $db->sql_in_set('topic_id', $topic_id_list);  					$result = $db->sql_query($sql); @@ -281,7 +281,7 @@ class mcp_queue  					'U_APPROVE_ACTION'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),  					'S_CAN_VIEWIP'			=> $auth->acl_get('m_info', $post_info['forum_id']),  					'S_POST_REPORTED'		=> $post_info['post_reported'], -					'S_POST_UNAPPROVED'		=> ($post_info['post_visibility'] == ITEM_UNAPPROVED), +					'S_POST_UNAPPROVED'		=> $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE,  					'S_POST_LOCKED'			=> $post_info['post_edit_locked'],  					'S_USER_NOTES'			=> true,  					'S_POST_DELETED'		=> ($post_info['post_visibility'] == ITEM_DELETED), @@ -298,7 +298,6 @@ class mcp_queue  					'MINI_POST_IMG'			=> ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), -  					'RETURN_QUEUE'			=> sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . '&start=' . $start . '">', '</a>'),  					'RETURN_POST'			=> sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),  					'RETURN_TOPIC_SIMPLE'	=> sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), @@ -331,7 +330,7 @@ class mcp_queue  				$m_perm = 'm_approve';  				$is_topics = ($mode == 'unapproved_topics' || $mode == 'deleted_topics') ? true : false;  				$is_restore = ($mode == 'deleted_posts' || $mode == 'deleted_topics') ? true : false; -				$visibility_const = (!$is_restore) ? ITEM_UNAPPROVED : ITEM_DELETED; +				$visibility_const = (!$is_restore) ? array(ITEM_UNAPPROVED, ITEM_REAPPROVE) : ITEM_DELETED;  				$user->add_lang(array('viewtopic', 'viewforum')); @@ -419,7 +418,7 @@ class mcp_queue  					$sql = 'SELECT p.post_id  						FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . '  						WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . ' -							AND p.post_visibility = ' . $visibility_const . ' +							AND ' . $db->sql_in_set('p.post_visibility', $visibility_const) . '  							' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '  							' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "  							AND t.topic_id = p.topic_id @@ -472,7 +471,7 @@ class mcp_queue  					$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_attachment AS post_attachment, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour  						FROM ' . TOPICS_TABLE . ' t  						WHERE ' . $db->sql_in_set('forum_id', $forum_list) . ' -							AND topic_visibility = ' . $visibility_const . " +							AND  ' . $db->sql_in_set('topic_visibility', $visibility_const) . "  							AND topic_delete_user <> 0  							$limit_time_sql  						ORDER BY $sort_order_sql"; @@ -547,7 +546,6 @@ class mcp_queue  					'S_TOPICS'				=> $is_topics,  					'S_RESTORE'				=> $is_restore, -					'PAGE_NUMBER'			=> $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),  					'TOPIC_ID'				=> $topic_id,  					'TOTAL'					=> $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),  				)); @@ -654,13 +652,25 @@ class mcp_queue  				// Handle notifications  				foreach ($post_info as $post_id => $post_data)  				{ +					// A single topic approval may also happen here, so handle deleting the respective notification. +					if (!$post_data['topic_posts_approved']) +					{ +						$phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); +					}  					$phpbb_notifications->delete_notifications('post_in_queue', $post_id); -					$phpbb_notifications->add_notifications(array( -						'quote', -						'bookmark', -						'post', -					), $post_data); +					// Only add notifications, if we are not reapproving post +					// When the topic was already approved, but was edited and +					// now needs re-approval, we don't want to notify the users +					// again. +					if ($post_data['post_visibility'] == ITEM_UNAPPROVED) +					{ +						$phpbb_notifications->add_notifications(array( +							'quote', +							'bookmark', +							'post', +						), $post_data); +					}  					$phpbb_notifications->mark_notifications_read(array(  						'quote', @@ -773,9 +783,12 @@ class mcp_queue  			$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;  			$phpbb_content_visibility = $phpbb_container->get('content.visibility'); +			$first_post_ids = array(); +  			foreach ($topic_info as $topic_id => $topic_data)  			{  				$phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), ''); +				$first_post_ids[$topic_id] = (int) $topic_data['topic_first_post_id'];  				$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_data['forum_id']}&t={$topic_id}"); @@ -799,23 +812,51 @@ class mcp_queue  			// Only send out the mails, when the posts are being approved  			if ($action == 'approve')  			{ +				// Grab the first post text as it's needed for the quote notification. +				$sql = 'SELECT topic_id, post_text +					FROM ' . POSTS_TABLE . ' +					WHERE ' . $db->sql_in_set('post_id', $first_post_ids); +				$result = $db->sql_query($sql); + +				while ($row = $db->sql_fetchrow($result)) +				{ +					$topic_info[$row['topic_id']]['post_text'] = $row['post_text']; +				} +				$db->sql_freeresult($result); +  				// Handle notifications  				$phpbb_notifications = $phpbb_container->get('notification_manager');  				foreach ($topic_info as $topic_id => $topic_data)  				{ -					$phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); -					$phpbb_notifications->add_notifications(array( -						'quote', -						'topic', -					), $post_data); +					$topic_data = array_merge($topic_data, array( +						'post_id'		=> $topic_data['topic_first_post_id'], +						'post_subject'	=> $topic_data['topic_title'], +						'post_time'		=> $topic_data['topic_time'], +						'poster_id'		=> $topic_data['topic_poster'], +						'username'		=> $topic_data['topic_first_poster_name'], +					)); + +					$phpbb_notifications->delete_notifications('topic_in_queue', $topic_id); + +					// Only add notifications, if we are not reapproving post +					// When the topic was already approved, but was edited and +					// now needs re-approval, we don't want to notify the users +					// again. +					if ($topic_data['topic_visibility'] == ITEM_UNAPPROVED) +					{ +						$phpbb_notifications->add_notifications(array( +							'quote', +							'topic', +						), $topic_data); +					} -					$phpbb_notifications->mark_notifications_read('quote', $post_data['post_id'], $user->data['user_id']); -					$phpbb_notifications->mark_notifications_read('topic', $post_data['topic_id'], $user->data['user_id']); +					$phpbb_notifications->mark_notifications_read('quote', $topic_data['post_id'], $user->data['user_id']); +					$phpbb_notifications->mark_notifications_read('topic', $topic_id, $user->data['user_id']);  					if ($notify_poster)  					{ -						$phpbb_notifications->add_notifications('approve_topic', $post_data); +						$phpbb_notifications->add_notifications('approve_topic', $topic_data);  					}  				}  			} @@ -1033,7 +1074,7 @@ class mcp_queue  					if ($is_disapproving)  					{  						$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED'; -						add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason); +						add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason, $log_data['post_username']);  					}  					else  					{ @@ -1099,7 +1140,6 @@ class mcp_queue  						$post_data['disapprove_reason'] .= ($reason) ? "\n\n" . $reason : '';  					} -  					if ($disapprove_all_posts_in_topic && $topic_information[$topic_id]['topic_posts_unapproved'] == 1)  					{  						// If there is only 1 post when disapproving the topic, @@ -1117,7 +1157,6 @@ class mcp_queue  			unset($lang_reasons, $post_info, $disapprove_reason, $disapprove_reason_lang); -  			if ($num_disapproved_topics)  			{  				$success_msg = ($num_disapproved_topics == 1) ? 'TOPIC' : 'TOPICS'; @@ -1136,6 +1175,22 @@ class mcp_queue  				$success_msg .= '_DELETED_SUCCESS';  			} +			// If we came from viewtopic, we try to go back to it. +			if (strpos($redirect, $phpbb_root_path . 'viewtopic.' . $phpEx) === 0) +			{ +				if ($num_disapproved_topics == 0) +				{ +					// So we need to remove the post id part from the Url +					$redirect = str_replace("&p={$post_id_list[0]}#p{$post_id_list[0]}", '', $redirect); +				} +				else +				{ +					// However this is only possible if the topic still exists, +					// Otherwise we go back to the viewforum page +					$redirect = append_sid($phpbb_root_path . 'viewforum.' . $phpEx, 'f=' . $request->variable('f', 0)); +				} +			} +  			meta_refresh(3, $redirect);  			$message = $user->lang[$success_msg]; diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 02892964f1..5681b83212 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -98,10 +98,10 @@ class mcp_reports  				$post_id = $report['post_id'];  				$report_id = $report['report_id']; -				 +  				$parse_post_flags = $report['reported_post_enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;  				$parse_post_flags += $report['reported_post_enable_smilies'] ? OPTION_FLAG_SMILIES : 0; -				$parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0;  +				$parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0;  				$post_info = get_post_data(array($post_id), 'm_report', true); @@ -144,7 +144,6 @@ class mcp_reports  				$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false; -  				$report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));  				if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) @@ -187,7 +186,7 @@ class mcp_reports  					'S_CLOSE_ACTION'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),  					'S_CAN_VIEWIP'			=> $auth->acl_get('m_info', $post_info['forum_id']),  					'S_POST_REPORTED'		=> $post_info['post_reported'], -					'S_POST_UNAPPROVED'		=> ($post_info['post_visibility'] == ITEM_UNAPPROVED), +					'S_POST_UNAPPROVED'		=> $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE,  					'S_POST_LOCKED'			=> $post_info['post_edit_locked'],  					'S_REPORT_CLOSED'		=> $report['report_closed'],  					'S_USER_NOTES'			=> true, @@ -423,7 +422,6 @@ class mcp_reports  					'S_FORUM_OPTIONS'		=> $forum_options,  					'S_CLOSED'				=> ($mode == 'reports_closed') ? true : false, -					'PAGE_NUMBER'			=> $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),  					'TOPIC_ID'				=> $topic_id,  					'TOTAL'					=> $total,  					'TOTAL_REPORTS'			=> $user->lang('LIST_REPORTS', (int) $total), @@ -579,7 +577,6 @@ function close_report($report_id_list, $mode, $action, $pm = false)  			}  			$db->sql_query($sql); -  			if (sizeof($close_report_posts))  			{  				if ($pm) @@ -616,23 +613,25 @@ function close_report($report_id_list, $mode, $action, $pm = false)  		}  		unset($close_report_posts, $close_report_topics); +		$phpbb_notifications = $phpbb_container->get('notification_manager'); +  		foreach ($reports as $report)  		{  			if ($pm)  			{  				add_log('mod', 0, 0, 'LOG_PM_REPORT_' .  strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']); +				$phpbb_notifications->delete_notifications('report_pm', $report['pm_id']);  			}  			else  			{  				add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' .  strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']); +				$phpbb_notifications->delete_notifications('report_post', $report['post_id']);  			}  		}  		// Notify reporters  		if (sizeof($notify_reporters))  		{ -			$phpbb_notifications = $phpbb_container->get('notification_manager'); -  			foreach ($notify_reporters as $report_id => $reporter)  			{  				if ($reporter['user_id'] == ANONYMOUS) @@ -649,8 +648,6 @@ function close_report($report_id_list, $mode, $action, $pm = false)  						'closer_id'			=> $user->data['user_id'],  						'from_user_id'		=> $post_info[$post_id]['author_id'],  					))); - -					$phpbb_notifications->delete_notifications('report_pm', $post_id);  				}  				else  				{ @@ -658,8 +655,6 @@ function close_report($report_id_list, $mode, $action, $pm = false)  						'reporter'			=> $reporter['user_id'],  						'closer_id'			=> $user->data['user_id'],  					))); - -					$phpbb_notifications->delete_notifications('report_post', $post_id);  				}  			}  		} diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index a4c561a3bf..48efa330d4 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -212,7 +212,7 @@ function mcp_topic_view($id, $mode, $action)  			parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);  		} -		if ($row['post_visibility'] == ITEM_UNAPPROVED) +		if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE)  		{  			$has_unapproved_posts = true;  		} @@ -239,7 +239,7 @@ function mcp_topic_view($id, $mode, $action)  			'MINI_POST_IMG'			=> ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),  			'S_POST_REPORTED'	=> ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])), -			'S_POST_UNAPPROVED'	=> ($row['post_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $topic_info['forum_id'])), +			'S_POST_UNAPPROVED'	=> (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $topic_info['forum_id'])),  			'S_POST_DELETED'	=> ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])),  			'S_CHECKED'			=> (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,  			'S_HAS_ATTACHMENTS'	=> (!empty($attachments[$row['post_id']])) ? true : false, @@ -343,7 +343,6 @@ function mcp_topic_view($id, $mode, $action)  		'RETURN_TOPIC'		=> sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'),  		'RETURN_FORUM'		=> sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'), -		'PAGE_NUMBER'		=> $pagination->on_page($base_url, $total, $posts_per_page, $start),  		'TOTAL_POSTS'		=> $user->lang('VIEW_TOPIC_POSTS', (int) $total),  	));  } @@ -463,7 +462,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)  			while ($row = $db->sql_fetchrow($result))  			{  				// If split from selected post (split_beyond), we split the unapproved items too. -				if ($row['post_visibility'] == ITEM_UNAPPROVED && !$auth->acl_get('m_approve', $row['forum_id'])) +				if (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $row['forum_id']))  				{  //					continue;  				} diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index e39bddec5b..4275182d26 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -96,9 +96,6 @@ class mcp_warn  				'U_NOTES'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']),  				'USERNAME_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), -				'USERNAME'			=> $row['username'], -				'USERNAME_COLOUR'	=> ($row['user_colour']) ? '#' . $row['user_colour'] : '', -				'U_USER'			=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),  				'WARNING_TIME'	=> $user->format_date($row['user_last_warning']),  				'WARNINGS'		=> $row['user_warnings'], @@ -118,9 +115,6 @@ class mcp_warn  				'U_NOTES'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']),  				'USERNAME_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), -				'USERNAME'			=> $row['username'], -				'USERNAME_COLOUR'	=> ($row['user_colour']) ? '#' . $row['user_colour'] : '', -				'U_USER'			=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),  				'WARNING_TIME'	=> $user->format_date($row['warning_time']),  				'WARNINGS'		=> $row['user_warnings'], @@ -167,9 +161,6 @@ class mcp_warn  				'U_NOTES'		=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']),  				'USERNAME_FULL'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), -				'USERNAME'			=> $row['username'], -				'USERNAME_COLOUR'	=> ($row['user_colour']) ? '#' . $row['user_colour'] : '', -				'U_USER'			=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),  				'WARNING_TIME'	=> $user->format_date($row['user_last_warning']),  				'WARNINGS'		=> $row['user_warnings'], @@ -186,7 +177,6 @@ class mcp_warn  			'S_SELECT_SORT_KEY'		=> $s_sort_key,  			'S_SELECT_SORT_DAYS'	=> $s_limit_days, -			'PAGE_NUMBER'		=> $pagination->on_page($base_url, $user_count, $config['topics_per_page'], $start),  			'TOTAL_USERS'		=> $user->lang('LIST_USERS', (int) $user_count),  		));  	} @@ -294,7 +284,7 @@ class mcp_warn  		$message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true);  		// Generate the appropriate user information for the user we are looking at -		if (!function_exists('phpbb_get_user_avatar')) +		if (!function_exists('get_user_rank'))  		{  			include($phpbb_root_path . 'includes/functions_display.' . $phpEx);  		} @@ -399,11 +389,10 @@ class mcp_warn  		}  		// Generate the appropriate user information for the user we are looking at -		if (!function_exists('phpbb_get_user_avatar')) +		if (!function_exists('get_user_rank'))  		{  			include($phpbb_root_path . 'includes/functions_display.' . $phpEx);  		} -  		get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src);  		$avatar_img = phpbb_get_user_avatar($user_row); | 
