From e445ffe7e6d26406cb008926d2353184da272271 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 5 Nov 2005 16:20:09 +0000 Subject: [PATCH] Don't self ping. Props Mark Jaquith fixes #993 git-svn-id: http://svn.automattic.com/wordpress/trunk@2983 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 2 +- xmlrpc.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 9e0bf2d27..69ef606b5 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -590,7 +590,7 @@ function pingback($content, $post_ID) { // We don't wanna ping first and second types, even if they have a valid foreach($post_links_temp[0] as $link_test) : - if ( !in_array($link_test, $pung) ) : // If we haven't pung it already + if ( !in_array($link_test, $pung) && url_to_postid($link_test) != $post_ID) : // If we haven't pung it already and it isn't a link to itself $test = parse_url($link_test); if (isset($test['query'])) $post_links[] = $link_test; diff --git a/xmlrpc.php b/xmlrpc.php index 1ff6b09e1..b2176f323 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1179,6 +1179,9 @@ class wp_xmlrpc_server extends IXR_Server { if ( !$post ) // Post_ID not found return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.'); + if ( $post_ID == url_to_postid($pagelinkedfrom) ) + return new IXR_Error(0, 'The source URI and the target URI cannot both point to the same resource.'); + // Check if pings are on if ( 'closed' == $post->ping_status ) return new IXR_Error(33, 'The specified target URI cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');