Browse Source

oops, I forgot to add few checks...
Lets check if the comment we want to edit wasn't already deleted.

Signed-off-by: Suki <[email protected]>

Suki 11 years ago
parent
commit
d46fc1aa3a

+ 5 - 1
Sources/ReportedPosts.php

@@ -432,7 +432,7 @@ function HandleComment()
  */
 function EditComment()
 {
-	global $smcFunc, $context, $txt, $scripturl;
+	global $smcFunc, $context, $txt, $scripturl, $user_info;
 
 	$comment = array();
 
@@ -462,6 +462,10 @@ function EditComment()
 	{
 		validateToken('mod-reportC-edit');
 
+		// Make sure there is some data to edit on the DB.
+		if (empty($context['comment']))
+			fatal_lang_error('report_action_message_edit_issue');
+
 		$edited_comment = trim($smcFunc['htmlspecialchars']($_POST['mod_comment']));
 
 		editModComment($context['comment_id'], $edited_comment);

+ 1 - 0
Themes/default/languages/ModerationCenter.english.php

@@ -126,6 +126,7 @@ $txt['mc_warning_template_delete_confirm'] = 'Are you sure you want to delete th
 $txt['report_action_message_saved'] = 'You successfully created a new comment.';
 $txt['report_action_message_edited'] = 'You successfully edited the comment.';
 $txt['report_action_message_deleted'] = 'The message was successfully deleted.';
+$txt['report_action_message_edit_issue'] = 'The message you\'re trying to edit isn\'t available any more. Please check if it wasn\'t deleted already.',
 $txt['report_action_ignore'] = 'The report was successfully ignored.';
 $txt['report_action_unignore'] = 'The report was successfully un-ignored.';
 $txt['report_action_close'] = 'The report was successfully closed.';