1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-15 05:24:41 +01:00

Prevent warning self

git-svn-id: file:///svn/phpbb/trunk@6108 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-06-20 20:32:53 +00:00
parent 4448249a44
commit 0cc3aff18d
3 changed files with 14 additions and 1 deletions

View File

@ -210,6 +210,12 @@ function mcp_warn_post_view($id, $mode, $action)
trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']);
}
// Prevent someone from warning themselves
if ($userrow['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
@ -321,6 +327,12 @@ function mcp_warn_user_view($id, $mode, $action)
trigger_error('NO_USER');
}
// Prevent someone from warning themselves
if ($userrow['user_id'] == $user->data['user_id'])
{
trigger_error($user->lang['CANNOT_WARN_SELF']);
}
$user_id = $userrow['user_id'];
if ($warning && $action == 'add_warning')

View File

@ -47,6 +47,7 @@ $lang = array_merge($lang, array(
'CANNOT_MOVE_SAME_FORUM'=> 'You cannot move a topic to the forum it\'s already in',
'CANNOT_WARN_ANONYMOUS' => 'You cannot warn an guest user',
'CANNOT_WARN_SELF' => 'You cannot warn yourself',
'CAN_LEAVE_BLANK' => 'This can be left blank.',
'CHANGE_POSTER' => 'Change poster',
'CLOSE_REPORT' => 'Close report',

View File

@ -1360,7 +1360,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&amp;mode=user_notes&amp;u=' . $poster_id, true, $user->session_id) : '',
'U_WARN' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_post&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
'U_WARN' => ($auth->acl_getf_global('m_warn') && $poster_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&amp;mode=warn_post&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '',
'POST_ID' => $row['post_id'],