mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
A single post can now only be reported once
git-svn-id: file:///svn/phpbb/trunk@4193 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2b16fc0874
commit
01a68f9497
2 changed files with 18 additions and 35 deletions
|
@ -34,9 +34,7 @@ $auth->acl($user->data);
|
||||||
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
|
$post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0;
|
||||||
$reason_id = (!empty($_REQUEST['reason_id'])) ? intval($_REQUEST['reason_id']) : 0;
|
$reason_id = (!empty($_REQUEST['reason_id'])) ? intval($_REQUEST['reason_id']) : 0;
|
||||||
$notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? TRUE : FALSE;
|
$notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? TRUE : FALSE;
|
||||||
$description = (!empty($_REQUEST['description'])) ? stripslashes($_REQUEST['description']) : '';
|
$report_text = (!empty($_REQUEST['report_text'])) ? htmlspecialchars(stripslashes($_REQUEST['report_text'])) : '';
|
||||||
$report_id = (!empty($_REQUEST['report_id'])) ? intval($_REQUEST['report_id']) : 0;
|
|
||||||
$report_text = '';
|
|
||||||
|
|
||||||
// Has the report been cancelled?
|
// Has the report been cancelled?
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
|
@ -68,39 +66,24 @@ foreach ($acl_check_ary as $acl => $error)
|
||||||
{
|
{
|
||||||
if (!$auth->acl_get($acl, $forum_id))
|
if (!$auth->acl_get($acl, $forum_id))
|
||||||
{
|
{
|
||||||
trigger_error($user->lang[$error]);
|
trigger_error($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($acl_check_ary);
|
unset($acl_check_ary);
|
||||||
|
|
||||||
// Check if the user has already reported this post
|
// Check if the post has already been reported
|
||||||
if ($user->data['user_id'] != ANONYMOUS)
|
$result = $db->sql_query('SELECT * FROM ' . REPORTS_TABLE . " WHERE post_id = $post_id");
|
||||||
{
|
|
||||||
$result = $db->sql_query('SELECT * FROM ' . REPORTS_TABLE . " WHERE post_id = $post_id AND user_id = " . $user->data['user_id']);
|
|
||||||
|
|
||||||
if ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($report_id)
|
if ($user->data['user_id'] == $row['user_id'] && $user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] == $row['user_id'])
|
extract($row);
|
||||||
{
|
|
||||||
$report_text = $row['report_text'];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$report_id = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$report_id = intval($row['report_id']);
|
|
||||||
$reason_id = intval($row['reason_id']);
|
|
||||||
|
|
||||||
$return_topic = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>');
|
$return_topic = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&p=$post_id#$post_id\">", '</a>');
|
||||||
$return_report = '<br /><br />' . sprintf($user->lang['EDIT_REPORT'], "<a href=\"report.$phpEx$SID&report_id=$report_id&reason_id=$reason_id&p=$post_id\">", '</a>');
|
trigger_error($user->lang['ALREADY_REPORTED'] . $return_topic);
|
||||||
|
|
||||||
trigger_error($user->lang['ALREADY_REPORTED'] . $return_report . $return_topic);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -116,7 +99,7 @@ if (!empty($_POST['reason_id']))
|
||||||
WHERE reason_id = $reason_id";
|
WHERE reason_id = $reason_id";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
if (!($row = $db->sql_fetchrow($result)) || (!$description && $row['reason_name'] == 'other'))
|
if (!($row = $db->sql_fetchrow($result)) || (!$report_text && $row['reason_name'] == 'other'))
|
||||||
{
|
{
|
||||||
trigger_error('EMPTY_REPORT');
|
trigger_error('EMPTY_REPORT');
|
||||||
}
|
}
|
||||||
|
@ -128,7 +111,7 @@ if (!empty($_POST['reason_id']))
|
||||||
'user_id' => (int) $user->data['user_id'],
|
'user_id' => (int) $user->data['user_id'],
|
||||||
'user_notify' => (int) $notify,
|
'user_notify' => (int) $notify,
|
||||||
'report_time' => (int) time(),
|
'report_time' => (int) time(),
|
||||||
'report_text' => (string) $description
|
'report_text' => (string) $report_text
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($report_id)
|
if ($report_id)
|
||||||
|
@ -193,7 +176,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'REPORT_TEXT' => htmlspecialchars($report_text),
|
'REPORT_TEXT' => $report_text,
|
||||||
'S_REPORT_ACTION' => "report.$phpEx$SID&p=$post_id" . (($report_id) ? "&report_id=$report_id" : ''),
|
'S_REPORT_ACTION' => "report.$phpEx$SID&p=$post_id" . (($report_id) ? "&report_id=$report_id" : ''),
|
||||||
'S_CAN_NOTIFY' => ($user->data['user_id'] == ANONYMOUS) ? FALSE : TRUE
|
'S_CAN_NOTIFY' => ($user->data['user_id'] == ANONYMOUS) ? FALSE : TRUE
|
||||||
));
|
));
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}:</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td>
|
<td class="row1" valign="top"><span class="gen"><b>{L_MORE_INFO}:</b></span><br /><span class="gensmall">{L_CAN_LEAVE_BLANK}</span></td>
|
||||||
<td class="row2"><textarea class="post" style="width:500px" name="description" rows="25" cols="40" class="post">{REPORT_TEXT}</textarea></td>
|
<td class="row2"><textarea class="post" style="width:500px" name="report_text" rows="25" cols="40" class="post">{REPORT_TEXT}</textarea></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="cat" colspan="2" align="center" height="28"><input type="submit" name="submit" class="mainoption" value="{L_SUBMIT}" /> <input type="submit" name="cancel" class="liteoption" value="{L_CANCEL}"></td>
|
<td class="cat" colspan="2" align="center" height="28"><input type="submit" name="submit" class="mainoption" value="{L_SUBMIT}" /> <input type="submit" name="cancel" class="liteoption" value="{L_CANCEL}"></td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue