From 98d7c471337c3d54f5b8e09618afba5705846b64 Mon Sep 17 00:00:00 2001 From: Ludovic Arnaud Date: Wed, 9 Apr 2003 22:00:23 +0000 Subject: [PATCH] "Report" button only shows up if the user is authorised. Default forum_id for globals temporary (and arbitrary) set to 2. git-svn-id: file:///svn/phpbb/trunk@3798 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/report.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/phpBB/report.php b/phpBB/report.php index 937dfa78ff..e4c0feadf4 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -33,6 +33,7 @@ $auth->acl($user->data); // var definitions $post_id = (!empty($_REQUEST['p'])) ? intval($_REQUEST['p']) : 0; $reason_id = (!empty($_REQUEST['reason_id'])) ? intval($_REQUEST['reason_id']) : 0; +$notify = (!empty($_REQUEST['notify']) && $user->data['user_id'] != ANONYMOUS) ? TRUE : FALSE; $description = (!empty($_REQUEST['description'])) ? stripslashes($_REQUEST['description']) : ''; // Start output of page @@ -77,11 +78,18 @@ if (isset($_POST['cancel'])) // Has the report been confirmed? if (!empty($_POST['reason_id'])) { + $result = $db->sql_query('SELECT reason_name FROM ' . REASONS_TABLE . " WHERE reason_id = $reason_id"); + $row = $db->sql_fetchrow($result); + if (!$row || (!$description && $row['reason_name'] == 'other')) + { + trigger_error('EMPTY_REPORT'); + } + $sql_ary = array( 'reason_id' => (int) $reason_id, 'post_id' => (int) $post_id, 'user_id' => (int) $user->user_id, - 'user_notify' => (!empty($_POST['notify'])) ? 1 : 0, + 'user_notify' => (int) $notify, 'report_time' => (int) time(), 'report_text' => (string) $description ); @@ -98,9 +106,9 @@ if (!empty($_POST['reason_id'])) $db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 1 WHERE topic_id = ' . $topic_id); } - // TODO: warn moderators or something ;) + trigger_error($user->lang['POST_REPORTED_SUCCESS'] . '

' . sprintf($user->lang['RETURN_TOPIC'], "", '')); - trigger_error($user->lang['POST_REPORTED'] . '

' . sprintf($user->lang['RETURN_TOPIC'], "", '')); + // TODO: warn moderators or something ;) } // Generate the form @@ -135,6 +143,7 @@ while ($row = $db->sql_fetchrow($result)) )); } +$template->assign_var('S_CAN_NOTIFY', ($user->data['user_id'] == ANONYMOUS) ? FALSE : TRUE); $template->set_filenames(array( 'body' => 'report.html' ));