|
@@ -335,6 +335,29 @@ function ReportToModerator()
|
|
loadLanguage('Post');
|
|
loadLanguage('Post');
|
|
loadTemplate('SendTopic');
|
|
loadTemplate('SendTopic');
|
|
|
|
|
|
|
|
+ addInlineJavascript('
|
|
|
|
+ var error_box = $("#error_box");
|
|
|
|
+ $("#report_comment").keyup(function() {
|
|
|
|
+ var post_too_long = $("#error_post_too_long");
|
|
|
|
+ if ($(this).val().length > 254)
|
|
|
|
+ {
|
|
|
|
+ if (post_too_long.length == 0)
|
|
|
|
+ {
|
|
|
|
+ error_box.show();
|
|
|
|
+ if ($.trim(error_box.html()) == \'\')
|
|
|
|
+ error_box.append("<ul id=\'error_list\'></ul>");
|
|
|
|
+
|
|
|
|
+ $("#error_list").append("<li id=\'error_post_too_long\' class=\'error\'>" + ' . JavaScriptEscape($txt['post_too_long']) . ' + "</li>");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ post_too_long.remove();
|
|
|
|
+ if ($("#error_list li").length == 0)
|
|
|
|
+ error_box.hide();
|
|
|
|
+ }
|
|
|
|
+ });', true);
|
|
|
|
+
|
|
$context['comment_body'] = !isset($_POST['comment']) ? '' : trim($_POST['comment']);
|
|
$context['comment_body'] = !isset($_POST['comment']) ? '' : trim($_POST['comment']);
|
|
$context['email_address'] = !isset($_POST['email']) ? '' : trim($_POST['email']);
|
|
$context['email_address'] = !isset($_POST['email']) ? '' : trim($_POST['email']);
|
|
|
|
|
|
@@ -375,7 +398,10 @@ function ReportToModerator2()
|
|
// Make sure we have a comment and it's clean.
|
|
// Make sure we have a comment and it's clean.
|
|
if (!isset($_POST['comment']) || $smcFunc['htmltrim']($_POST['comment']) === '')
|
|
if (!isset($_POST['comment']) || $smcFunc['htmltrim']($_POST['comment']) === '')
|
|
$post_errors[] = 'no_comment';
|
|
$post_errors[] = 'no_comment';
|
|
- $poster_comment = strtr($smcFunc['htmlspecialchars']($_POST['comment']), array("\r" => '', "\n" => '', "\t" => ''));
|
|
|
|
|
|
+ $poster_comment = strtr($smcFunc['htmlspecialchars']($_POST['comment']), array("\r" => '', "\t" => ''));
|
|
|
|
+
|
|
|
|
+ if ($smcFunc['strlen']($poster_comment) > 254)
|
|
|
|
+ $post_errors[] = 'post_too_long';
|
|
|
|
|
|
// Guests need to provide their address!
|
|
// Guests need to provide their address!
|
|
if ($user_info['is_guest'])
|
|
if ($user_info['is_guest'])
|
|
@@ -410,7 +436,7 @@ function ReportToModerator2()
|
|
|
|
|
|
$context['post_errors'] = array();
|
|
$context['post_errors'] = array();
|
|
foreach ($post_errors as $post_error)
|
|
foreach ($post_errors as $post_error)
|
|
- $context['post_errors'][] = $txt['error_' . $post_error];
|
|
|
|
|
|
+ $context['post_errors'][$post_error] = $txt['error_' . $post_error];
|
|
|
|
|
|
return ReportToModerator();
|
|
return ReportToModerator();
|
|
}
|
|
}
|