From e442dd64f02f45ce0a40a7b7e17b1efa33933199 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 19 Dec 2010 04:55:46 +0000 Subject: [PATCH] Fix Pings/Trackback comment table filter. Props greuben. Fixes #15885 git-svn-id: http://svn.automattic.com/wordpress/trunk@17052 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 897d766dae..f62551572e 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -305,10 +305,13 @@ class WP_Comment_Query { $where .= $wpdb->prepare( ' AND comment_author_email = %s', $author_email ); if ( '' !== $karma ) $where .= $wpdb->prepare( ' AND comment_karma = %d', $karma ); - if ( 'comment' == $type ) + if ( 'comment' == $type ) { $where .= " AND comment_type = ''"; - elseif ( ! empty( $type ) ) + } elseif( 'pings' == $type ) { + $where .= ' AND comment_type IN ("pingback", "trackback")'; + } elseif ( ! empty( $type ) ) { $where .= $wpdb->prepare( ' AND comment_type = %s', $type ); + } if ( '' !== $parent ) $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent ); if ( '' !== $user_id ) @@ -1759,7 +1762,7 @@ function pingback($content, $post_ID) { $post_links = array(); $pung = get_pung($post_ID); - +var_Dump(compact('pung')); // Variables $ltrs = '\w'; $gunk = '/#~:.?+=&%@!\-'; @@ -1782,7 +1785,7 @@ function pingback($content, $post_ID) { // We don't wanna ping first and second types, even if they have a valid foreach ( (array) $post_links_temp[0] as $link_test ) : - 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 + if ( !in_array($link_test, $pung) && !in_array($link_test, $post_links) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. if ( $test = @parse_url($link_test) ) { if ( isset($test['query']) ) @@ -1792,11 +1795,12 @@ function pingback($content, $post_ID) { } endif; endforeach; - +var_dump(compact('post_links', 'post_links_temp')); do_action_ref_array('pre_ping', array(&$post_links, &$pung)); foreach ( (array) $post_links as $pagelinkedto ) { $pingback_server_url = discover_pingback_server_uri( $pagelinkedto ); + var_dump(compact('pagelinkedto', 'pingback_server_url')); if ( $pingback_server_url ) { @ set_time_limit( 60 ); @@ -1805,13 +1809,15 @@ function pingback($content, $post_ID) { // using a timeout of 3 seconds should be enough to cover slow servers $client = new WP_HTTP_IXR_Client($pingback_server_url); - $client->timeout = 3; + $client->timeout = 5; $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom); // when set to true, this outputs debug messages by itself - $client->debug = false; + $client->debug = true; if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered add_ping( $post_ID, $pagelinkedto ); + var_Dump($client); + echo '
'; } } }