diff options
Diffstat (limited to 'wp-includes/comment.php')
-rw-r--r-- | wp-includes/comment.php | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 6da2264..b1aee83 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -73,15 +73,20 @@ function get_approved_comments($post_id) { function &get_comment(&$comment, $output = OBJECT) { global $comment_cache, $wpdb; - if ( empty($comment) ) - return null; - - if ( is_object($comment) ) { + if ( empty($comment) ) { + if ( isset($GLOBALS['comment']) ) + $_comment = & $GLOBALS['comment']; + else + $_comment = null; + } elseif ( is_object($comment) ) { if ( !isset($comment_cache[$comment->comment_ID]) ) $comment_cache[$comment->comment_ID] = &$comment; $_comment = & $comment_cache[$comment->comment_ID]; } else { - if ( !isset($comment_cache[$comment]) ) { + $comment = (int) $comment; + if ( isset($GLOBALS['comment']) && ($GLOBALS['comment']->comment_ID == $comment) ) { + $_comment = & $GLOBALS['comment']; + } elseif ( !isset($comment_cache[$comment]) ) { $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1"); $comment_cache[$comment->comment_ID] = & $_comment; } else { @@ -671,9 +676,7 @@ function pingback($content, $post_ID) { include_once(ABSPATH . WPINC . '/class-IXR.php'); // original code by Mort (http://mort.mine.nu:8080) - $log = debug_fopen(ABSPATH . '/pingback.log', 'a'); $post_links = array(); - debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n"); $pung = get_pung($post_ID); @@ -689,10 +692,6 @@ function pingback($content, $post_ID) { // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); - // Debug - debug_fwrite($log, 'Post contents:'); - debug_fwrite($log, $content."\n"); - // Step 2. // Walking thru the links array // first we get rid of links pointing to sites, not to specific files @@ -716,16 +715,12 @@ function pingback($content, $post_ID) { do_action_ref_array('pre_ping', array(&$post_links, &$pung)); foreach ( (array) $post_links as $pagelinkedto ) { - debug_fwrite($log, "Processing -- $pagelinkedto\n"); $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); if ( $pingback_server_url ) { @ set_time_limit( 60 ); // Now, the RPC call - debug_fwrite($log, "Page Linked To: $pagelinkedto \n"); - debug_fwrite($log, 'Page Linked From: '); $pagelinkedfrom = get_permalink($post_ID); - debug_fwrite($log, $pagelinkedfrom."\n"); // using a timeout of 3 seconds should be enough to cover slow servers $client = new IXR_Client($pingback_server_url); @@ -737,13 +732,8 @@ function pingback($content, $post_ID) { if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) add_ping( $post_ID, $pagelinkedto ); - else - debug_fwrite($log, "Error.\n Fault code: ".$client->getErrorCode()." : ".$client->getErrorMessage()."\n"); } } - - debug_fwrite($log, "\nEND: ".time()."\n****************************\n"); - debug_fclose($log); } @@ -780,16 +770,6 @@ function trackback($trackback_url, $title, $excerpt, $ID) { $trackback_url['port'] = 80; $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); @fputs($fs, $http_request); -/* - $debug_file = 'trackback.log'; - $fp = fopen($debug_file, 'a'); - fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"); - while(!@feof($fs)) { - fwrite($fp, @fgets($fs, 4096)); - } - fwrite($fp, "\n\n"); - fclose($fp); -*/ @fclose($fs); $tb_url = addslashes( $tb_url ); @@ -814,4 +794,4 @@ function weblog_ping($server = '', $path = '') { $client->query('weblogUpdates.ping', get_option('blogname'), $home); } -?> +?>
\ No newline at end of file |