From 75caf09741b6ae14a8c601b226fbf59dcc6c7b21 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Wed, 22 Sep 2004 19:45:29 +0000 Subject: [PATCH] make pingback.ping use wp_new_comment git-svn-id: http://svn.automattic.com/wordpress/trunk@1706 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- xmlrpc.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/xmlrpc.php b/xmlrpc.php index eaf1de6c1..30fc10596 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1237,10 +1237,6 @@ class wp_xmlrpc_server extends IXR_Server { $pagelinkedfrom = addslashes($pagelinkedfrom); $original_title = $title; $title = addslashes(strip_tags(trim($title))); - $user_ip = $_SERVER['REMOTE_ADDR']; - $user_agent = addslashes($_SERVER['HTTP_USER_AGENT']); - $now = current_time('mysql'); - $now_gmt = current_time('mysql', 1); // Check if the entry allows pings if( !check_comment($title, '', $pagelinkedfrom, $context, $user_ip, $user_agent) ) { @@ -1248,13 +1244,15 @@ class wp_xmlrpc_server extends IXR_Server { } - $consulta = $wpdb->query("INSERT INTO $wpdb->comments - (comment_post_ID, comment_author, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type) - VALUES - ($post_ID, '$title', '$pagelinkedfrom', '$user_ip', '$now', '$now_gmt', '$context', '1', '$user_agent', 'pingback') - "); + $comment_post_ID = $post_ID; + $comment_author = $title; + $comment_author_url = $pagelinkedfrom; + $comment_content = $context; + $comment_type = 'pingback'; - $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); + $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type'); + + $comment_ID = $wpdb->insert_id; if (get_settings('comments_notify')) { wp_notify_postauthor($comment_ID, 'pingback');