diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-22 15:27:40 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-22 15:27:40 +0000 |
commit | 550f270a0027e67a0eb19d99fbe54d6045696a0b (patch) | |
tree | c0a38cbb0715d7a17b7226c134568d9392e550da /phpBB/includes/mcp/mcp_warn.php | |
parent | 782c536c703959c643dc77b846c9617326b2a98e (diff) | |
download | forums-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/mcp_warn.php')
-rwxr-xr-x | phpBB/includes/mcp/mcp_warn.php | 499 |
1 files changed, 248 insertions, 251 deletions
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&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'), - ) - ); + $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 + // 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&mode=user_notes&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&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'], - ) - ); - } + // 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&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']), - $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&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; + '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'], + )); + } - 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&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), + )); + } - 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&mode=user_notes&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&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&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), - ) - ); + // 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('&f=' . $forum_id . '&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&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>')); + } - // 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&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>')); - } + $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&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&mode=$mode&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&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('&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&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>')); + } - 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&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>')); - } + '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&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, - ) - ); } /** |