<?php
/**
 * Handle Trackbacks and Pingbacks Sent to WordPress
 *
 * @since 0.71
 *
 * @package WordPress
 * @subpackage Trackbacks
 */

if ( empty( $wp ) ) {
    require_once 
__DIR__ '/wp-load.php';
    
wp( array( 'tb' => '1' ) );
}

// Always run as an unauthenticated user.
wp_set_current_user);

/**
 * Response to a trackback.
 *
 * Responds with an error or success XML message.
 *
 * @since 0.71
 *
 * @param int|bool $error         Whether there was an error.
 *                                Default '0'. Accepts '0' or '1', true or false.
 * @param string   $error_message Error message if an error occurred.
 */
function trackback_response$error 0$error_message '' ) {
    
header'Content-Type: text/xml; charset=' get_option'blog_charset' ) );
    if ( 
$error ) {
        echo 
'<?xml version="1.0" encoding="utf-8"?' ">\n";
        echo 
"<response>\n";
        echo 
"<error>1</error>\n";
        echo 
"<message>$error_message</message>\n";
        echo 
'</response>';
        die();
    } else {
        echo 
'<?xml version="1.0" encoding="utf-8"?' ">\n";
        echo 
"<response>\n";
        echo 
"<error>0</error>\n";
        echo 
'</response>';
    }
}

// Trackback is done by a POST.
$request_array 'HTTP_POST_VARS';

if ( ! isset( 
$_GET['tb_id'] ) || ! $_GET['tb_id'] ) {
    
$tb_id explode'/'$_SERVER['REQUEST_URI'] );
    
$tb_id intval$tb_idcount$tb_id ) - ] );
}

$tb_url  = isset( $_POST['url'] ) ? $_POST['url'] : '';
$charset = isset( $_POST['charset'] ) ? $_POST['charset'] : '';

// These three are stripslashed here so they can be properly escaped after mb_convert_encoding().
$title     = isset( $_POST['title'] ) ? wp_unslash$_POST['title'] ) : '';
$excerpt   = isset( $_POST['excerpt'] ) ? wp_unslash$_POST['excerpt'] ) : '';
$blog_name = isset( $_POST['blog_name'] ) ? wp_unslash$_POST['blog_name'] ) : '';

if ( 
$charset ) {
    
$charset str_replace( array( ','' ' ), ''strtouppertrim$charset ) ) );
} else {
    
$charset 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
}

// No valid uses for UTF-7.
if ( false !== strpos$charset'UTF-7' ) ) {
    die;
}

// For international trackbacks.
if ( function_exists'mb_convert_encoding' ) ) {
    
$title     mb_convert_encoding$titleget_option'blog_charset' ), $charset );
    
$excerpt   mb_convert_encoding$excerptget_option'blog_charset' ), $charset );
    
$blog_name mb_convert_encoding$blog_nameget_option'blog_charset' ), $charset );
}

// Now that mb_convert_encoding() has been given a swing, we need to escape these three.
$title     wp_slash$title );
$excerpt   wp_slash$excerpt );
$blog_name wp_slash$blog_name );

if ( 
is_single() || is_page() ) {
    
$tb_id $posts[0]->ID;
}

if ( ! isset( 
$tb_id ) || ! intval$tb_id ) ) {
    
trackback_response1__'I really need an ID for this to work.' ) );
}

if ( empty( 
$title ) && empty( $tb_url ) && empty( $blog_name ) ) {
    
// If it doesn't look like a trackback at all.
    
wp_redirectget_permalink$tb_id ) );
    exit;
}

if ( ! empty( 
$tb_url ) && ! empty( $title ) ) {
    
/**
     * Fires before the trackback is added to a post.
     *
     * @since 4.7.0
     *
     * @param int    $tb_id     Post ID related to the trackback.
     * @param string $tb_url    Trackback URL.
     * @param string $charset   Character Set.
     * @param string $title     Trackback Title.
     * @param string $excerpt   Trackback Excerpt.
     * @param string $blog_name Blog Name.
     */
    
do_action'pre_trackback_post'$tb_id$tb_url$charset$title$excerpt$blog_name );

    
header'Content-Type: text/xml; charset=' get_option'blog_charset' ) );

    if ( ! 
pings_open$tb_id ) ) {
        
trackback_response1__'Sorry, trackbacks are closed for this item.' ) );
    }

    
$title   wp_html_excerpt$title250'&#8230;' );
    
$excerpt wp_html_excerpt$excerpt252'&#8230;' );

    
$comment_post_ID      = (int) $tb_id;
    
$comment_author       $blog_name;
    
$comment_author_email '';
    
$comment_author_url   $tb_url;
    
$comment_content      "<strong>$title</strong>\n\n$excerpt";
    
$comment_type         'trackback';

    
$dupe $wpdb->get_results$wpdb->prepare"SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s"$comment_post_ID$comment_author_url ) );
    if ( 
$dupe ) {
        
trackback_response1__'We already have a ping from that URL for this post.' ) );
    }

    
$commentdata compact'comment_post_ID''comment_author''comment_author_email''comment_author_url''comment_content''comment_type' );

    
$result wp_new_comment$commentdata );

    if ( 
is_wp_error$result ) ) {
        
trackback_response1$result->get_error_message() );
    }

    
$trackback_id $wpdb->insert_id;

    
/**
     * Fires after a trackback is added to a post.
     *
     * @since 1.2.0
     *
     * @param int $trackback_id Trackback ID.
     */
    
do_action'trackback_post'$trackback_id );
    
trackback_response);
}
File Manager

在线文件管理器

编号 名称 类型 大小 可读 可写 可执行 创建时间 修改时间 访问时间 操作
1 index.php 405B 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-22 19:08:48 | | | | | |
2 wp-config.php 3.37KB 2022-11-18 23:38:58 2020-07-26 04:27:39 2024-10-22 19:08:48 | | | | | |
3 wp-links-opml.php 2.44KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-20 17:48:32 | | | | | |
4 .htaccess 461B 2022-11-18 23:38:58 2020-09-26 20:23:15 2024-10-22 10:01:19 | | | | | |
5 error_log 846B 2022-11-18 23:38:58 2020-08-03 19:34:35 2024-09-30 06:55:15 | | | | | |
6 wp-blog-header.php 351B 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-21 23:21:32 | | | | | |
7 wp-trackback.php 4.71KB 2022-11-01 08:20:30 2022-11-01 07:24:30 2024-10-23 01:24:52 | | | | | |
8 wp-login.php 46.75KB 2022-11-18 23:38:58 2020-02-10 13:20:04 2024-10-20 16:59:38 | | | | | |
9 wp-comments-post.php 2.28KB 2022-11-18 23:38:58 2020-06-03 05:56:10 2024-08-03 01:33:04 | | | | | |
10 wp-config-sample.php 2.84KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-08-03 01:33:04 | | | | | |
11 wp-activate.php 6.75KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-06 17:26:28 | | | | | |
12 wp-mail.php 8.25KB 2022-11-01 08:20:30 2022-11-01 07:21:27 2024-10-21 05:05:41 | | | | | |
13 wp-load.php 3.22KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-22 19:08:48 | | | | | |
14 readme.html 7.11KB 2022-11-18 23:38:58 2020-10-31 00:58:44 2024-10-15 13:45:51 | | | | | |
15 license.txt 19.45KB 2022-11-18 23:38:58 2020-02-12 21:24:04 2024-10-23 01:20:49 | | | | | |
16 .htaccess.07122020.bak 462B 2022-11-18 23:38:58 2020-07-26 04:30:20 2024-10-23 01:20:44 | | | | | |
17 .htaccess.07272020.bak 462B 2022-11-18 23:38:58 2020-07-26 08:34:34 2024-10-23 01:21:16 | | | | | |
18 wp-settings.php 18.94KB 2022-11-18 23:38:58 2020-04-10 13:29:06 2024-10-21 23:21:32 | | | | | |
19 wp-signup.php 30.38KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-07 13:26:42 | | | | | |
20 wp-cron.php 3.85KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-20 20:49:57 | | | | | |
21 xmlrpc.php 3.06KB 2022-11-18 23:38:58 2020-02-06 16:03:10 2024-10-23 01:22:34 | | | | | |
22 .well-known 91B 2022-09-06 01:01:21 2020-07-25 23:12:03 2024-10-22 17:24:01 | | | | |
23 cgi-bin 0B 2022-09-06 01:01:21 2020-07-25 22:35:05 2024-10-22 17:24:01 | | | | |
24 wp-admin 7.5MB 2022-09-06 01:01:21 2022-09-02 22:48:29 2024-10-22 17:24:01 | | | | |
25 wp-includes 31.8MB 2022-11-01 09:02:32 2022-11-01 09:02:32 2024-10-22 17:24:02 | | | | |
26 wp-content 312.71MB 2022-09-06 01:01:21 2021-01-06 21:53:44 2024-10-22 17:24:02 | | | | |