aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-04-22 15:27:40 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-04-22 15:27:40 +0000
commit550f270a0027e67a0eb19d99fbe54d6045696a0b (patch)
treec0a38cbb0715d7a17b7226c134568d9392e550da /phpBB/includes/mcp
parent782c536c703959c643dc77b846c9617326b2a98e (diff)
downloadforums-550f270a0027e67a0eb19d99fbe54d6045696a0b.tar
forums-550f270a0027e67a0eb19d99fbe54d6045696a0b.tar.gz
forums-550f270a0027e67a0eb19d99fbe54d6045696a0b.tar.bz2
forums-550f270a0027e67a0eb19d99fbe54d6045696a0b.tar.xz
forums-550f270a0027e67a0eb19d99fbe54d6045696a0b.zip
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995 MCP fixes for user notes/warnings - #9981 Preserving imageset values on save/edit find a member link for Mass PM's - #9925 syndicate window.onload events where necessary - #9878 Duplicate topics in forums with announcements - #9840 Email template for forced re-activation - #9808 Topic pagination adjustment - #9763 Changed compose message layout in UCP - #9706, #9702 Fixed inline attachment font size (hopefully) git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp')
-rwxr-xr-xphpBB/includes/mcp/mcp_notes.php7
-rwxr-xr-xphpBB/includes/mcp/mcp_reports.php9
-rw-r--r--phpBB/includes/mcp/mcp_topic.php1
-rwxr-xr-xphpBB/includes/mcp/mcp_warn.php499
4 files changed, 262 insertions, 254 deletions
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index 9d4b522fe4..62ff6e0a92 100755
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -18,7 +18,7 @@ class mcp_notes
var $p_master;
var $u_action;
- function mcp_main(&$p_master)
+ function mcp_notes(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -91,6 +91,11 @@ class mcp_notes
$user_id = $userrow['user_id'];
+ // Populate user id to the currently active module (this module)
+ // The following method is another way of adjusting module urls. It is the easy variant if we want
+ // to directly adjust the current module url based on data retrieved within the same module.
+ $this->p_master->adjust_url('&amp;u=' . $user_id);
+
$deletemark = ($action == 'del_marked') ? true : false;
$deleteall = ($action == 'del_all') ? true : false;
$marked = request_var('marknote', array(0));
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 33c71b47b1..c3c39d22fe 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -66,7 +66,7 @@ class mcp_reports
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
- WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id AND r.report_closed = 0") . '
+ WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
AND rr.reason_id = r.reason_id
AND r.user_id = u.user_id';
$result = $db->sql_query($sql);
@@ -75,7 +75,12 @@ class mcp_reports
if (!$report)
{
- trigger_error('NO_REPORT_REPORT');
+ trigger_error('NO_REPORT');
+ }
+
+ if ($report_id && $report['report_closed'])
+ {
+ trigger_error('REPORT_CLOSED');
}
$post_id = $report['post_id'];
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 427c7e63d2..b9f66082fe 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -233,6 +233,7 @@ function mcp_topic_view($id, $mode, $action)
'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false,
'S_REPORT_VIEW' => ($action == 'reports') ? true : false,
'S_MERGE_VIEW' => ($action == 'merge') ? true : false,
+ 'S_SPLIT_VIEW' => ($action == 'split') ? true : false,
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
'S_TOPIC_ICON' => $icon_id,
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index 6d3961de2f..f041732b8a 100755
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -18,7 +18,7 @@ class mcp_warn
var $p_master;
var $u_action;
- function mcp_main(&$p_master)
+ function mcp_warn(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -40,332 +40,329 @@ class mcp_warn
switch ($mode)
{
case 'front':
- mcp_warn_front_view($id, $mode);
+ $this->mcp_warn_front_view();
$this->tpl_name = 'mcp_warn_front';
break;
case 'list':
- mcp_warn_list_view($id, $mode, $action);
+ $this->mcp_warn_list_view($action);
$this->tpl_name = 'mcp_warn_list';
break;
case 'warn_post':
- mcp_warn_post_view($id, $mode, $action);
+ $this->mcp_warn_post_view($action);
$this->tpl_name = 'mcp_warn_post';
break;
case 'warn_user':
- mcp_warn_user_view($id, $mode, $action);
+ $this->mcp_warn_user_view($action);
$this->tpl_name = 'mcp_warn_user';
break;
}
}
-}
-/**
-* Generates the summary on the main page of the warning module
-*/
-function mcp_warn_front_view($id, $mode)
-{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ /**
+ * Generates the summary on the main page of the warning module
+ */
+ function mcp_warn_front_view()
+ {
+ global $phpEx, $phpbb_root_path, $config;
+ global $template, $db, $user, $auth;
- $template->assign_vars(array(
- 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
- 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true', false),
- 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user'),
- )
- );
+ $template->assign_vars(array(
+ 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp&amp;field=username&amp;select_single=true'),
+ 'UA_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true', false),
+ 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_user'),
+ ));
- // Obtain a list of the 5 naughtiest users....
- // These are the 5 users with the highest warning count
+ // Obtain a list of the 5 naughtiest users....
+ // These are the 5 users with the highest warning count
+ $highest = array();
+ $count = 0;
- $highest = array();
- $count = 0;
+ view_warned_users($highest, $count, 5);
- view_warned_users($highest, $count, 5);
+ foreach ($highest as $row)
+ {
+ $template->assign_block_vars('highest', array(
+ 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
- foreach ($highest as $row)
- {
- $template->assign_block_vars('highest', array(
- 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;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&amp;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&amp;u=' . $row['user_id']),
+ 'WARNING_TIME' => $user->format_date($row['user_last_warning']),
+ 'WARNINGS' => $row['user_warnings'],
+ ));
+ }
- 'WARNING_TIME' => $user->format_date($row['user_last_warning']),
- 'WARNINGS' => $row['user_warnings'],
- )
- );
- }
+ // And now the 5 most recent users to get in trouble
+ $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time
+ FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w
+ WHERE u.user_id = w.user_id
+ ORDER BY w.warning_time DESC';
+ $result = $db->sql_query_limit($sql, 5);
- // And now the 5 most recent users to get in trouble
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('latest', array(
+ 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;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&amp;u=' . $row['user_id']),
- $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time
- FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w
- WHERE u.user_id = w.user_id
- ORDER BY w.warning_time DESC';
- $result = $db->sql_query_limit($sql, 5);
+ 'WARNING_TIME' => $user->format_date($row['warning_time']),
+ 'WARNINGS' => $row['user_warnings'],
+ ));
+ }
+ $db->sql_freeresult($result);
+ }
- while ($row = $db->sql_fetchrow($result))
+ /**
+ * Lists all users with warnings
+ */
+ function mcp_warn_list_view($action)
{
- $template->assign_block_vars('latest', array(
- 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
+ global $phpEx, $phpbb_root_path, $config;
+ global $template, $db, $user, $auth;
- '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&amp;u=' . $row['user_id']),
+ $user->add_lang('memberlist');
- 'WARNING_TIME' => $user->format_date($row['warning_time']),
- 'WARNINGS' => $row['user_warnings'],
- )
- );
- }
- $db->sql_freeresult($result);
-}
+ $start = request_var('start', 0);
+ $st = request_var('st', 0);
+ $sk = request_var('sk', 'b');
+ $sd = request_var('sd', 'd');
-/**
-* Lists all users with warnings
-*/
-function mcp_warn_list_view($id, $mode, $action)
-{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
+ $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);
+ $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings');
- $user->add_lang('memberlist');
+ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
+ gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
- $start = request_var('start', 0);
- $st = request_var('st', 0);
- $sk = request_var('sk', 'b');
- $sd = request_var('sd', 'd');
+ // Define where and sort sql for use in displaying logs
+ $sql_where = ($st) ? (time() - ($st * 86400)) : 0;
+ $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
- $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
- $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']);
- $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings');
+ $users = array();
+ $user_count = 0;
- $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
- gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
+ view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
- // Define where and sort sql for use in displaying logs
- $sql_where = ($st) ? (time() - ($st * 86400)) : 0;
- $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC');
+ foreach ($users as $row)
+ {
+ $template->assign_block_vars('user', array(
+ 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
- $users = array();
- $user_count = 0;
+ '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&amp;u=' . $row['user_id']),
+
+ 'WARNING_TIME' => $user->format_date($row['user_last_warning']),
+ 'WARNINGS' => $row['user_warnings'],
+ ));
+ }
- view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
+ $template->assign_vars(array(
+ 'U_POST_ACTION' => $this->u_action,
+ 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
+ 'S_SELECT_SORT_DIR' => $s_sort_dir,
+ 'S_SELECT_SORT_KEY' => $s_sort_key,
+ 'S_SELECT_SORT_DAYS' => $s_limit_days,
+
+ 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start),
+ 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&amp;mode=list&amp;st=$st&amp;sk=$sk&amp;sd=$sd"), $user_count, $config['topics_per_page'], $start),
+ 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count),
+ ));
+ }
- foreach ($users as $row)
+ /**
+ * Handles warning the user when the warning is for a specific post
+ */
+ function mcp_warn_post_view($action)
{
- $template->assign_block_vars('user', array(
- 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $row['user_id']),
+ global $phpEx, $phpbb_root_path, $config;
+ global $template, $db, $user, $auth;
+
+ $post_id = request_var('p', 0);
+ $forum_id = request_var('f', 0);
+ $notify = (isset($_REQUEST['notify_user'])) ? true : false;
+ $warning = request_var('warning', '', true);
+
+ $sql = 'SELECT u.*, p.*
+ FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
+ WHERE post_id = $post_id
+ AND u.user_id = p.poster_id";
+ $result = $db->sql_query($sql);
+ $user_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (!$user_row)
+ {
+ trigger_error($user->lang['NO_POST']);
+ }
- '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&amp;u=' . $row['user_id']),
-
- 'WARNING_TIME' => $user->format_date($row['user_last_warning']),
- 'WARNINGS' => $row['user_warnings'],
- )
- );
- }
+ // There is no point issuing a warning to ignored users (ie anonymous and bots)
+ if ($user_row['user_type'] == USER_IGNORE)
+ {
+ trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']);
+ }
- $template->assign_vars(array(
- 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode"),
- 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
- 'S_SELECT_SORT_DIR' => $s_sort_dir,
- 'S_SELECT_SORT_KEY' => $s_sort_key,
- 'S_SELECT_SORT_DAYS' => $s_limit_days,
-
- 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start),
- 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;st=$st&amp;sk=$sk&amp;sd=$sd"), $user_count, $config['topics_per_page'], $start),
- 'TOTAL_USERS' => ($user_count == 1) ? $user->lang['LIST_USER'] : sprintf($user->lang['LIST_USERS'], $user_count),
- )
- );
+ // Prevent someone from warning themselves
+ if ($user_row['user_id'] == $user->data['user_id'])
+ {
+ trigger_error($user->lang['CANNOT_WARN_SELF']);
+ }
-}
+ // Check if there is already a warning for this post to prevent multiple
+ // warnings for the same offence
+ $sql = 'SELECT post_id
+ FROM ' . WARNINGS_TABLE . "
+ WHERE post_id = $post_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
-/**
-* Handles warning the user when the warning is for a specific post
-*/
-function mcp_warn_post_view($id, $mode, $action)
-{
- global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ if ($row)
+ {
+ trigger_error($user->lang['ALREADY_WARNED']);
+ }
- $post_id = request_var('p', 0);
- $forum_id = request_var('f', 0);
- $notify = (isset($_REQUEST['notify_user'])) ? true : false;
- $warning = request_var('warning', '', true);
+ $user_id = $user_row['user_id'];
- $sql = 'SELECT u.*, p.*
- FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
- WHERE post_id = $post_id
- AND u.user_id = p.poster_id";
- $result = $db->sql_query($sql);
- $user_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $this->p_master->adjust_url('&amp;f=' . $forum_id . '&amp;p=' . $post_id);
- if (!$user_row)
- {
- trigger_error($user->lang['NO_POST']);
- }
+ if ($warning && $action == 'add_warning')
+ {
+ add_warning($user_row, $warning, $notify, $post_id);
- // There is no point issuing a warning to ignored users (ie anonymous and bots)
- if ($user_row['user_type'] == USER_IGNORE)
- {
- trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']);
- }
+ $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
+ meta_refresh(2, $redirect);
+ trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
+ }
- // Prevent someone from warning themselves
- if ($user_row['user_id'] == $user->data['user_id'])
- {
- trigger_error($user->lang['CANNOT_WARN_SELF']);
- }
+ // OK, they didn't submit a warning so lets build the page for them to do so
+
+ // We want to make the message available here as a reminder
+ // Parse the message and subject
+ $message = $user_row['post_text'];
+ $message = str_replace("\n", '<br />', censor_text($message));
- // Check if there is already a warning for this post to prevent multiple
- // warnings for the same offence
- $sql = 'SELECT post_id
- FROM ' . WARNINGS_TABLE . "
- WHERE post_id = $post_id";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ // Second parse bbcode here
+ if ($user_row['bbcode_bitfield'])
+ {
+ include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
- if ($row)
- {
- trigger_error($user->lang['ALREADY_WARNED']);
- }
+ $bbcode = new bbcode($user_row['bbcode_bitfield']);
+ $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
+ }
- $user_id = $user_row['user_id'];
+ // Always process smilies after parsing bbcodes
+ $message = smiley_text($message);
- if ($warning && $action == 'add_warning')
- {
- add_warning($user_row, $warning, $notify, $post_id);
+ // Generate the appropriate user information for the user we are looking at
+ if (!function_exists('get_user_avatar'))
+ {
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ }
- $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
+ $rank_title = $rank_img = '';
+ $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
- // OK, they didn't submit a warning so lets build the page for them to do so
-
- // We want to make the message available here as a reminder
- // Parse the message and subject
- $message = $user_row['post_text'];
- $message = str_replace("\n", '<br />', censor_text($message));
+ $template->assign_vars(array(
+ 'U_POST_ACTION' => $this->u_action . "p=$post_id",
- // Second parse bbcode here
- if ($user_row['bbcode_bitfield'])
- {
- include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
+ 'POST' => $message,
+ 'USERNAME' => $user_row['username'],
+ 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
+ 'RANK_TITLE' => $rank_title,
+ 'JOINED' => $user->format_date($user_row['user_regdate']),
+ 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
+ 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
- $bbcode = new bbcode($user_row['bbcode_bitfield']);
- $bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
- }
+ 'AVATAR_IMG' => $avatar_img,
+ 'RANK_IMG' => $rank_img,
- // Always process smilies after parsing bbcodes
- $message = smiley_text($message);
+ 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&amp;p=$post_id"),
+ ));
+ }
- // Generate the appropriate user information for the user we are looking at
- if (!function_exists('get_user_avatar'))
+ /**
+ * Handles warning the user
+ */
+ function mcp_warn_user_view($action)
{
- include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
- }
+ global $phpEx, $phpbb_root_path, $config, $module;
+ global $template, $db, $user, $auth;
- $rank_title = $rank_img = '';
- $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
+ $user_id = request_var('u', 0);
+ $username = request_var('username', '', true);
+ $notify = (isset($_REQUEST['notify_user'])) ? true : false;
+ $warning = request_var('warning', '', true);
- $template->assign_vars(array(
- 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;p=$post_id"),
+ $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
- 'POST' => $message,
- 'USERNAME' => $user_row['username'],
- 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
- 'RANK_TITLE' => $rank_title,
- 'JOINED' => $user->format_date($user_row['user_regdate']),
- 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
+ $sql = 'SELECT *
+ FROM ' . USERS_TABLE . '
+ WHERE ' . $sql_where;
+ $result = $db->sql_query($sql);
+ $user_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- 'AVATAR_IMG' => $avatar_img,
- 'RANK_IMG' => $rank_img,
+ if (!$user_row)
+ {
+ trigger_error('NO_USER');
+ }
- 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&amp;p=$post_id"),
- )
- );
-}
+ // Prevent someone from warning themselves
+ if ($user_row['user_id'] == $user->data['user_id'])
+ {
+ trigger_error($user->lang['CANNOT_WARN_SELF']);
+ }
-/**
-* Handles warning the user
-*/
-function mcp_warn_user_view($id, $mode, $action)
-{
- global $phpEx, $phpbb_root_path, $config, $module;
- global $template, $db, $user, $auth;
+ $user_id = $user_row['user_id'];
- $user_id = request_var('u', 0);
- $username = request_var('username', '', true);
- $notify = (isset($_REQUEST['notify_user'])) ? true : false;
- $warning = request_var('warning', '', true);
+ $this->p_master->adjust_url('&amp;u=' . $user_id);
- $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
+ if ($warning && $action == 'add_warning')
+ {
+ add_warning($user_row, $warning, $notify);
- $sql = 'SELECT *
- FROM ' . USERS_TABLE . '
- WHERE ' . $sql_where;
- $result = $db->sql_query($sql);
- $user_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
+ meta_refresh(2, $redirect);
+ trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
+ }
- if (!$user_row)
- {
- trigger_error('NO_USER');
- }
+ // Generate the appropriate user information for the user we are looking at
+ if (!function_exists('get_user_avatar'))
+ {
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ }
- // Prevent someone from warning themselves
- if ($user_row['user_id'] == $user->data['user_id'])
- {
- trigger_error($user->lang['CANNOT_WARN_SELF']);
- }
+ $rank_title = $rank_img = '';
+ $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
- $user_id = $user_row['user_id'];
+ // OK, they didn't submit a warning so lets build the page for them to do so
+ $template->assign_vars(array(
+ 'U_POST_ACTION' => $this->u_action . "u=$user_id",
- if ($warning && $action == 'add_warning')
- {
- add_warning($user_row, $warning, $notify);
+ 'USERNAME' => $user_row['username'],
+ 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
+ 'RANK_TITLE' => $rank_title,
+ 'JOINED' => $user->format_date($user_row['user_regdate']),
+ 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
+ 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
- $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
- meta_refresh(2, $redirect);
- trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
- }
+ 'AVATAR_IMG' => $avatar_img,
+ 'RANK_IMG' => $rank_img,
+ ));
- // Generate the appropriate user information for the user we are looking at
- if (!function_exists('get_user_avatar'))
- {
- include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ return $user_id;
}
-
- $rank_title = $rank_img = '';
- $avatar_img = get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']);
-
- // OK, they didn't submit a warning so lets build the page for them to do so
- $template->assign_vars(array(
- 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;u=$user_id"),
-
- 'USERNAME' => $user_row['username'],
- 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '',
- 'RANK_TITLE' => $rank_title,
- 'JOINED' => $user->format_date($user_row['user_regdate']),
- 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0,
- 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0,
-
- 'AVATAR_IMG' => $avatar_img,
- 'RANK_IMG' => $rank_img,
- )
- );
}
/**