2003-11-23 23:13:33 +01:00
|
|
|
<?php
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
if (!empty($HTTP_GET_VARS['tb_id'])) {
|
|
|
|
// trackback is done by a GET
|
2003-10-04 00:52:59 +02:00
|
|
|
$tb_id = intval($HTTP_GET_VARS['tb_id']);
|
2003-06-05 21:57:26 +02:00
|
|
|
$tb_url = $HTTP_GET_VARS['url'];
|
2003-04-01 16:12:34 +02:00
|
|
|
$title = $HTTP_GET_VARS['title'];
|
|
|
|
$excerpt = $HTTP_GET_VARS['excerpt'];
|
|
|
|
$blog_name = $HTTP_GET_VARS['blog_name'];
|
|
|
|
} elseif (!empty($HTTP_POST_VARS['url'])) {
|
|
|
|
// trackback is done by a POST
|
|
|
|
$request_array = 'HTTP_POST_VARS';
|
|
|
|
$tb_id = explode('/', $HTTP_SERVER_VARS['REQUEST_URI']);
|
2003-10-07 18:21:24 +02:00
|
|
|
$tb_id = intval($tb_id[count($tb_id)-1]);
|
2003-06-05 21:57:26 +02:00
|
|
|
$tb_url = $HTTP_POST_VARS['url'];
|
2003-04-01 16:12:34 +02:00
|
|
|
$title = $HTTP_POST_VARS['title'];
|
|
|
|
$excerpt = $HTTP_POST_VARS['excerpt'];
|
|
|
|
$blog_name = $HTTP_POST_VARS['blog_name'];
|
|
|
|
}
|
|
|
|
|
2003-06-05 21:57:26 +02:00
|
|
|
if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_url))) {
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
@header('Content-Type: text/xml');
|
|
|
|
|
2003-06-13 00:42:48 +02:00
|
|
|
require_once('wp-config.php');
|
2003-05-25 14:43:31 +02:00
|
|
|
require_once($abspath.$b2inc.'/b2template.functions.php');
|
|
|
|
require_once($abspath.$b2inc.'/b2vars.php');
|
|
|
|
require_once($abspath.$b2inc.'/b2functions.php');
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-11-23 23:13:33 +01:00
|
|
|
if (!$use_trackback)
|
2003-04-01 16:12:34 +02:00
|
|
|
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
|
2003-11-23 23:13:33 +01:00
|
|
|
|
2003-06-04 20:50:21 +02:00
|
|
|
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
|
2003-11-25 01:46:52 +01:00
|
|
|
++$querycount;
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-06-04 20:50:21 +02:00
|
|
|
if ('closed' == $pingstatus)
|
2003-11-23 23:13:33 +01:00
|
|
|
trackback_response(1, 'Sorry, trackbacks are closed for this item.');
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-06-05 21:57:26 +02:00
|
|
|
$tb_url = addslashes($tb_url);
|
2003-04-01 16:12:34 +02:00
|
|
|
$title = strip_tags($title);
|
|
|
|
$title = (strlen($title) > 255) ? substr($title, 0, 252).'...' : $title;
|
|
|
|
$excerpt = strip_tags($excerpt);
|
|
|
|
$excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252).'...' : $excerpt;
|
|
|
|
$blog_name = htmlspecialchars($blog_name);
|
|
|
|
$blog_name = (strlen($blog_name) > 255) ? substr($blog_name, 0, 252).'...' : $blog_name;
|
|
|
|
|
|
|
|
$comment = '<trackback />';
|
2003-11-23 23:13:33 +01:00
|
|
|
$comment .= "<strong>$title</strong>\n$excerpt";
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
$author = addslashes($blog_name);
|
|
|
|
$email = '';
|
|
|
|
$original_comment = $comment;
|
|
|
|
$comment_post_ID = $tb_id;
|
|
|
|
|
|
|
|
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
|
|
|
|
$user_domain = gethostbyaddr($user_ip);
|
|
|
|
$time_difference = get_settings('time_difference');
|
2003-11-23 23:13:33 +01:00
|
|
|
$now = current_time('mysql');
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
$comment = convert_chars($comment);
|
|
|
|
$comment = format_to_post($comment);
|
|
|
|
|
|
|
|
$comment_author = $author;
|
|
|
|
$comment_author_email = $email;
|
2003-06-05 21:57:26 +02:00
|
|
|
$comment_author_url = $tb_url;
|
2003-04-01 16:12:34 +02:00
|
|
|
|
|
|
|
$author = addslashes($author);
|
|
|
|
|
2003-11-23 23:13:33 +01:00
|
|
|
$comment_moderation = get_settings('comment_moderation');
|
|
|
|
$moderation_notify = get_settings('moderation_notify');
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-11-23 23:13:33 +01:00
|
|
|
if ('manual' == $comment_moderation) {
|
|
|
|
$approved = 0;
|
|
|
|
} else if ('auto' == $comment_moderation) {
|
|
|
|
$approved = 0;
|
|
|
|
} else { // none
|
|
|
|
$approved = 1;
|
|
|
|
}
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-11-23 23:13:33 +01:00
|
|
|
$result = $wpdb->query("INSERT INTO $tablecomments
|
|
|
|
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)
|
|
|
|
VALUES
|
|
|
|
('$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$comment', '$approved')
|
|
|
|
");
|
2003-04-01 16:12:34 +02:00
|
|
|
|
2003-11-23 23:13:33 +01:00
|
|
|
if (!$result) {
|
|
|
|
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>.");
|
|
|
|
} else {
|
|
|
|
$comment_ID = $wpdb->get_var('SELECT last_insert_id()');
|
2003-11-25 01:46:52 +01:00
|
|
|
++$querycount;
|
2003-11-23 23:13:33 +01:00
|
|
|
if ($comments_notify)
|
|
|
|
wp_notify_postauthor($comment_ID, 'trackback');
|
2003-04-01 16:12:34 +02:00
|
|
|
trackback_response(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|