mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
#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
This commit is contained in:
@@ -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('&u=' . $user_id);
|
||||
|
||||
$deletemark = ($action == 'del_marked') ? true : false;
|
||||
$deleteall = ($action == 'del_all') ? true : false;
|
||||
$marked = request_var('marknote', array(0));
|
||||
|
@@ -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'];
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&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&mode=warn_user'),
|
||||
)
|
||||
);
|
||||
|
||||
// Obtain a list of the 5 naughtiest users....
|
||||
// These are the 5 users with the highest warning count
|
||||
|
||||
$highest = array();
|
||||
$count = 0;
|
||||
|
||||
view_warned_users($highest, $count, 5);
|
||||
|
||||
foreach ($highest as $row)
|
||||
/**
|
||||
* Generates the summary on the main page of the warning module
|
||||
*/
|
||||
function mcp_warn_front_view()
|
||||
{
|
||||
$template->assign_block_vars('highest', array(
|
||||
'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&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&u=' . $row['user_id']),
|
||||
$template->assign_vars(array(
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&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&mode=warn_user'),
|
||||
));
|
||||
|
||||
'WARNING_TIME' => $user->format_date($row['user_last_warning']),
|
||||
'WARNINGS' => $row['user_warnings'],
|
||||
)
|
||||
);
|
||||
// Obtain a list of the 5 naughtiest users....
|
||||
// These are the 5 users with the highest warning count
|
||||
$highest = array();
|
||||
$count = 0;
|
||||
|
||||
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&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'],
|
||||
));
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('latest', array(
|
||||
'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'],
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
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&mode=user_notes&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&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&mode=user_notes&u=' . $row['user_id']),
|
||||
|
||||
$users = array();
|
||||
$user_count = 0;
|
||||
|
||||
view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
|
||||
|
||||
foreach ($users as $row)
|
||||
{
|
||||
$template->assign_block_vars('user', array(
|
||||
'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']),
|
||||
'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'],
|
||||
)
|
||||
);
|
||||
'WARNING_TIME' => $user->format_date($row['user_last_warning']),
|
||||
'WARNINGS' => $row['user_warnings'],
|
||||
));
|
||||
}
|
||||
|
||||
$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&mode=list&st=$st&sk=$sk&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),
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&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&mode=$mode&st=$st&sk=$sk&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),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
$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)
|
||||
/**
|
||||
* Handles warning the user when the warning is for a specific post
|
||||
*/
|
||||
function mcp_warn_post_view($action)
|
||||
{
|
||||
trigger_error($user->lang['NO_POST']);
|
||||
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']);
|
||||
}
|
||||
|
||||
// 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']);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
trigger_error($user->lang['ALREADY_WARNED']);
|
||||
}
|
||||
|
||||
$user_id = $user_row['user_id'];
|
||||
|
||||
$this->p_master->adjust_url('&f=' . $forum_id . '&p=' . $post_id);
|
||||
|
||||
if ($warning && $action == 'add_warning')
|
||||
{
|
||||
add_warning($user_row, $warning, $notify, $post_id);
|
||||
|
||||
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&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>'));
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
||||
// Second parse bbcode here
|
||||
if ($user_row['bbcode_bitfield'])
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
||||
|
||||
$bbcode = new bbcode($user_row['bbcode_bitfield']);
|
||||
$bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
// Always process smilies after parsing bbcodes
|
||||
$message = smiley_text($message);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$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']);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => $this->u_action . "p=$post_id",
|
||||
|
||||
'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,
|
||||
|
||||
'AVATAR_IMG' => $avatar_img,
|
||||
'RANK_IMG' => $rank_img,
|
||||
|
||||
'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id"),
|
||||
));
|
||||
}
|
||||
|
||||
// There is no point issuing a warning to ignored users (ie anonymous and bots)
|
||||
if ($user_row['user_type'] == USER_IGNORE)
|
||||
/**
|
||||
* Handles warning the user
|
||||
*/
|
||||
function mcp_warn_user_view($action)
|
||||
{
|
||||
trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']);
|
||||
global $phpEx, $phpbb_root_path, $config, $module;
|
||||
global $template, $db, $user, $auth;
|
||||
|
||||
$user_id = request_var('u', 0);
|
||||
$username = request_var('username', '', true);
|
||||
$notify = (isset($_REQUEST['notify_user'])) ? true : false;
|
||||
$warning = request_var('warning', '', true);
|
||||
|
||||
$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $sql_where;
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$user_row)
|
||||
{
|
||||
trigger_error('NO_USER');
|
||||
}
|
||||
|
||||
// Prevent someone from warning themselves
|
||||
if ($user_row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
trigger_error($user->lang['CANNOT_WARN_SELF']);
|
||||
}
|
||||
|
||||
$user_id = $user_row['user_id'];
|
||||
|
||||
$this->p_master->adjust_url('&u=' . $user_id);
|
||||
|
||||
if ($warning && $action == 'add_warning')
|
||||
{
|
||||
add_warning($user_row, $warning, $notify);
|
||||
|
||||
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&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>'));
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$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' => $this->u_action . "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,
|
||||
));
|
||||
|
||||
return $user_id;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
trigger_error($user->lang['ALREADY_WARNED']);
|
||||
}
|
||||
|
||||
$user_id = $user_row['user_id'];
|
||||
|
||||
if ($warning && $action == 'add_warning')
|
||||
{
|
||||
add_warning($user_row, $warning, $notify, $post_id);
|
||||
|
||||
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&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>'));
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
||||
// Second parse bbcode here
|
||||
if ($user_row['bbcode_bitfield'])
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
||||
|
||||
$bbcode = new bbcode($user_row['bbcode_bitfield']);
|
||||
$bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
|
||||
}
|
||||
|
||||
// Always process smilies after parsing bbcodes
|
||||
$message = smiley_text($message);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$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']);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id"),
|
||||
|
||||
'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,
|
||||
|
||||
'AVATAR_IMG' => $avatar_img,
|
||||
'RANK_IMG' => $rank_img,
|
||||
|
||||
'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id"),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = request_var('u', 0);
|
||||
$username = request_var('username', '', true);
|
||||
$notify = (isset($_REQUEST['notify_user'])) ? true : false;
|
||||
$warning = request_var('warning', '', true);
|
||||
|
||||
$sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $sql_where;
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$user_row)
|
||||
{
|
||||
trigger_error('NO_USER');
|
||||
}
|
||||
|
||||
// Prevent someone from warning themselves
|
||||
if ($user_row['user_id'] == $user->data['user_id'])
|
||||
{
|
||||
trigger_error($user->lang['CANNOT_WARN_SELF']);
|
||||
}
|
||||
|
||||
$user_id = $user_row['user_id'];
|
||||
|
||||
if ($warning && $action == 'add_warning')
|
||||
{
|
||||
add_warning($user_row, $warning, $notify);
|
||||
|
||||
$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&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>'));
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$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&mode=$mode&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,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user