1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-23 10:01:55 +02:00

[ticket/13654] Moving reporting into controller

Moving report.php's content into different services and controllers to
better comply with the MVC model.

Also implementing:
 * Replacement for reasons_display()
 * Adding assign_meta_refresh_var() to \controller\helper
 * Adding separate routes for easy configuration
 * Updating unit tests to expect to correct results
 * Add BC tests

PHPBB3-13654
This commit is contained in:
MateBartus
2015-02-25 21:13:20 +01:00
parent 2c0b1252c8
commit a089ff5eb0
26 changed files with 1208 additions and 343 deletions

View File

@@ -1097,33 +1097,14 @@ function display_custom_bbcodes()
/**
* Display reasons
*
* @deprecated 3.2.0-dev
*/
function display_reasons($reason_id = 0)
{
global $db, $user, $template;
global $phpbb_container;
$sql = 'SELECT *
FROM ' . REPORTS_REASONS_TABLE . '
ORDER BY reason_order ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
{
$row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
$row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
}
$template->assign_block_vars('reason', array(
'ID' => $row['reason_id'],
'TITLE' => $row['reason_title'],
'DESCRIPTION' => $row['reason_description'],
'S_SELECTED' => ($row['reason_id'] == $reason_id) ? true : false)
);
}
$db->sql_freeresult($result);
$phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);
}
/**

View File

@@ -1402,11 +1402,6 @@ class mcp_queue
}
else
{
if (!function_exists('display_reasons'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}
$show_notify = false;
foreach ($post_info as $post_data)
@@ -1426,7 +1421,7 @@ class mcp_queue
$confirm_template = 'mcp_approve.html';
if ($is_disapproving)
{
display_reasons($reason_id);
$phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);
}
else
{

View File

@@ -232,7 +232,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '',
'U_EMAIL' => $user_info['email'],
'U_REPORT' => ($config['allow_pm_report']) ? append_sid("{$phpbb_root_path}report.$phpEx", "pm=" . $message_row['msg_id']) : '',
'U_REPORT' => ($config['allow_pm_report']) ? $phpbb_container->get('controller.helper')->route('phpbb_report_pm_controller', array('id' => $message_row['msg_id'])) : '',
'U_QUOTE' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=$folder_id&p=" . $message_row['msg_id'] : '',
'U_EDIT' => (($message_row['message_time'] > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit')) ? "$url&mode=compose&action=edit&f=$folder_id&p=" . $message_row['msg_id'] : '',
'U_POST_REPLY_PM' => ($auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $message_row['msg_id'] : '',