From 1d06871ca5494a7fb44cec79f49bbabd26c6e224 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 24 Dec 2005 05:32:49 +0000 Subject: [PATCH] Make wp_insert_attachment() MySQL 5 strict mode compliant. fixes #2115 git-svn-id: https://develop.svn.wordpress.org/trunk@3353 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-post.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index e0136d4d49..6578d78965 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -283,6 +283,14 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { if ( !isset($post_password) ) $post_password = ''; + if ( isset($to_ping) ) + $to_ping = preg_replace('|\s+|', "\n", $to_ping); + else + $to_ping = ''; + + if ( ! isset($pinged) ) + $pinged = ''; + if ($update) { $wpdb->query( "UPDATE $wpdb->posts SET @@ -298,6 +306,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { post_password = '$post_password', post_name = '$post_name', to_ping = '$to_ping', + pinged = '$pinged', post_modified = '$post_date', post_modified_gmt = '$post_date_gmt', post_parent = '$post_parent', @@ -308,9 +317,9 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { } else { $wpdb->query( "INSERT INTO $wpdb->posts - (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) + (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES - ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); + ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); $post_ID = $wpdb->insert_id; }