Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 89 lines (73 sloc) 2.998 kb
43e4a8a The great renaming.
saxmatt authored
1 <?php
2 require(dirname(__FILE__) . '/wp-config.php');
3 if (!empty($HTTP_GET_VARS['tb_id'])) {
4 // trackback is done by a GET
5 $tb_id = intval($HTTP_GET_VARS['tb_id']);
6 $tb_url = $HTTP_GET_VARS['url'];
7 $title = $HTTP_GET_VARS['title'];
8 $excerpt = $HTTP_GET_VARS['excerpt'];
9 $blog_name = $HTTP_GET_VARS['blog_name'];
10 } elseif (!empty($HTTP_POST_VARS['url'])) {
11 // trackback is done by a POST
12 $request_array = 'HTTP_POST_VARS';
13 $tb_id = explode('/', $HTTP_SERVER_VARS['REQUEST_URI']);
14 $tb_id = intval($tb_id[count($tb_id)-1]);
15 $tb_url = $HTTP_POST_VARS['url'];
16 $title = $HTTP_POST_VARS['title'];
17 $excerpt = $HTTP_POST_VARS['excerpt'];
18 $blog_name = $HTTP_POST_VARS['blog_name'];
19 }
20
21 if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_url))) {
22
23 @header('Content-Type: text/xml');
24
25 if (!$use_trackback)
26 trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
27
28 $pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
29
30 if ('closed' == $pingstatus)
31 trackback_response(1, 'Sorry, trackbacks are closed for this item.');
32
33 $tb_url = addslashes($tb_url);
34 $title = strip_tags($title);
35 $title = (strlen($title) > 255) ? substr($title, 0, 252).'...' : $title;
36 $excerpt = strip_tags($excerpt);
37 $excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252).'...' : $excerpt;
38 $blog_name = htmlspecialchars($blog_name);
39 $blog_name = (strlen($blog_name) > 255) ? substr($blog_name, 0, 252).'...' : $blog_name;
40
41 $comment = '<trackback />';
42 $comment .= "<strong>$title</strong>\n$excerpt";
43
44 $author = addslashes($blog_name);
45 $email = '';
46 $original_comment = $comment;
47 $comment_post_ID = $tb_id;
48
49 $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
50 $user_domain = gethostbyaddr($user_ip);
51 $time_difference = get_settings('time_difference');
52 $now = current_time('mysql');
53
54 $comment = convert_chars($comment);
55 $comment = format_to_post($comment);
56
57 $comment_author = $author;
58 $comment_author_email = $email;
59 $comment_author_url = $tb_url;
60
61 $author = addslashes($author);
62
63 $comment_moderation = get_settings('comment_moderation');
64 $moderation_notify = get_settings('moderation_notify');
65
66 if ('manual' == $comment_moderation) {
67 $approved = 0;
68 } else if ('auto' == $comment_moderation) {
69 $approved = 0;
70 } else { // none
71 $approved = 1;
72 }
73
74 $result = $wpdb->query("INSERT INTO $tablecomments
75 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)
76 VALUES
77 ('$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$comment', '$approved')
78 ");
79
80 if (!$result) {
81 die ("There is an error with the database, it can't store your comment...<br />Please contact the <a href='mailto:$admin_email'>webmaster</a>.");
82 } else {
83 $comment_ID = $wpdb->get_var('SELECT last_insert_id()');
84 if ($comments_notify)
85 wp_notify_postauthor($comment_ID, 'trackback');
86 trackback_response(0);
87 }
88 }
89 ?>
Something went wrong with that request. Please try again.