Ticket #10377: 10377.3.patch
| File 10377.3.patch, 3.0 KB (added by , 11 years ago) |
|---|
-
src/wp-comments-post.php
130 130 wp_die( __( '<strong>ERROR</strong>: please type a comment.' ), 200 ); 131 131 } 132 132 133 $comment_content_length = wp_get_comment_content_max_length(); 134 if ( $comment_content_length < strlen( $comment_content ) ) { 135 wp_die( __( '<strong>ERROR</strong>: your comment is too large.' ), 200 ); 136 } 137 133 138 $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 134 139 135 140 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); -
src/wp-includes/comment-functions.php
853 853 } 854 854 855 855 /** 856 * Calculate the maximum length of the comment_content column of the comments table. 857 * 858 * @since 4.4.0 859 * 860 * @global wpdb $wpdb WordPress database abstraction object. 861 * 862 * @return int Maximum comment_content character length. 863 */ 864 function wp_get_comment_content_max_length() { 865 global $wpdb; 866 867 $col_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' ); 868 869 if ( ! is_array( $col_length ) && (int) $col_length > 0 ) { 870 $content_length = (int) $col_length; 871 } elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length > 0 ) { 872 $content_length = (int) $col_length['length']; 873 } else { 874 $content_length = 65535; 875 } 876 877 return intval( $content_length ) - 10; 878 } 879 880 /** 856 881 * Does comment contain blacklisted characters or words. 857 882 * 858 883 * @since 1.5.0 -
src/wp-includes/comment-template.php
1921 1921 $fields = apply_filters( 'comment_form_default_fields', $fields ); 1922 1922 $defaults = array( 1923 1923 'fields' => $fields, 1924 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required="required"></textarea></p>',1924 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="' . wp_get_comment_content_max_length() . '" aria-required="true" required="required"></textarea></p>', 1925 1925 /** This filter is documented in wp-includes/link-template.php */ 1926 1926 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>', 1927 1927 /** This filter is documented in wp-includes/link-template.php */