Don't self ping. Props Mark Jaquith fixes #993

git-svn-id: http://svn.automattic.com/wordpress/trunk@2983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-11-05 16:20:09 +00:00
parent 43b9af22c6
commit e445ffe7e6
2 changed files with 4 additions and 1 deletions

View File

@ -590,7 +590,7 @@ function pingback($content, $post_ID) {
// We don't wanna ping first and second types, even if they have a valid <link/>
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;

View File

@ -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.');