Line ending fixes and commenting cleanups from Scott Reilly

git-svn-id: http://svn.automattic.com/wordpress/trunk@2556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-04-20 03:37:23 +00:00
parent 07730d904d
commit 68b4b3c61c
4 changed files with 282 additions and 277 deletions

View File

@ -32,7 +32,7 @@ endif;
$comment_type = '';
if ( get_settings('require_name_email') && !$user_ID ) {
if ('' == $comment_author_email || '' == $comment_author)
if ( 7 > strlen($comment_author_email) || '' == $comment_author )
die( __('Error: please fill the required fields (name, email).') );
elseif ( !is_email($comment_author_email))
die( __('Error: please enter a valid email address.') );

View File

@ -480,6 +480,11 @@ function wp_new_comment( $commentdata, $spam = false ) {
$now = current_time('mysql');
$now_gmt = current_time('mysql', 1);
if ( $user_id ) {
$userdata = get_userdata($user_id);
$post_author = $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = '$comment_post_ID' LIMIT 1");
}
// Simple flood-protection
if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) {
$time_lastcomment = mysql2date('U', $lasttime);
@ -496,6 +501,8 @@ function wp_new_comment( $commentdata, $spam = false ) {
$approved = 0;
if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) )
$approved = 'spam';
if ( $userdata && ( $user_id == $post_author || $userdata['user_level'] >= 9 ) )
$approved = 1;
$approved = apply_filters('pre_comment_approved', $approved);

View File

@ -27,11 +27,9 @@ function trackback_response($error = 0, $error_message = '') {
// trackback is done by a POST
$request_array = 'HTTP_POST_VARS';
if ( empty($_GET['tb_id']) ) {
if ( !$_GET['tb_id'] ) {
$tb_id = explode('/', $_SERVER['REQUEST_URI']);
$tb_id = intval( $tb_id[ count($tb_id) - 1 ] );
} else {
$tb_id = intval($_GET['tb_id']);
}
$tb_url = $_POST['url'];
@ -54,7 +52,7 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
if ( is_single() || is_page() )
$tb_id = $posts[0]->ID;
if ( !$tb_id )
if ( !intval( $tb_id ) )
trackback_response(1, 'I really need an ID for this to work.');
if (empty($title) && empty($tb_url) && empty($blog_name)) {