2003-10-03 18:52:59 -04:00
|
|
|
<?php if (!empty($tb)) {
|
2003-04-01 09:12:34 -05:00
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!empty($HTTP_GET_VARS['tb_id'])) {
|
|
|
|
// trackback is done by a GET
|
2003-10-03 18:52:59 -04:00
|
|
|
$tb_id = intval($HTTP_GET_VARS['tb_id']);
|
2003-06-05 15:57:26 -04:00
|
|
|
$tb_url = $HTTP_GET_VARS['url'];
|
2003-04-01 09:12:34 -05: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 12:21:24 -04:00
|
|
|
$tb_id = intval($tb_id[count($tb_id)-1]);
|
2003-06-05 15:57:26 -04:00
|
|
|
$tb_url = $HTTP_POST_VARS['url'];
|
2003-04-01 09:12:34 -05:00
|
|
|
$title = $HTTP_POST_VARS['title'];
|
|
|
|
$excerpt = $HTTP_POST_VARS['excerpt'];
|
|
|
|
$blog_name = $HTTP_POST_VARS['blog_name'];
|
|
|
|
}
|
|
|
|
|
2003-06-05 15:57:26 -04:00
|
|
|
if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_url))) {
|
2003-04-01 09:12:34 -05:00
|
|
|
|
|
|
|
@header('Content-Type: text/xml');
|
|
|
|
|
|
|
|
|
2003-06-12 18:42:48 -04:00
|
|
|
require_once('wp-config.php');
|
2003-05-25 08:43:31 -04:00
|
|
|
require_once($abspath.$b2inc.'/b2template.functions.php');
|
|
|
|
require_once($abspath.$b2inc.'/b2vars.php');
|
|
|
|
require_once($abspath.$b2inc.'/b2functions.php');
|
2003-04-01 09:12:34 -05:00
|
|
|
|
|
|
|
if (!$use_trackback) {
|
|
|
|
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
|
|
|
|
}
|
2003-06-04 14:50:21 -04:00
|
|
|
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-06-04 14:50:21 -04:00
|
|
|
if ('closed' == $pingstatus)
|
|
|
|
die('Sorry, trackbacks are closed for this item.');
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-06-05 15:57:26 -04:00
|
|
|
$tb_url = addslashes($tb_url);
|
2003-04-01 09:12:34 -05: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-06-04 14:50:21 -04:00
|
|
|
$comment .= "<strong>$title</strong><br />$excerpt";
|
2003-04-01 09:12:34 -05: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');
|
|
|
|
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
|
|
|
|
|
|
|
|
$comment = convert_chars($comment);
|
|
|
|
$comment = format_to_post($comment);
|
|
|
|
|
|
|
|
$comment_author = $author;
|
|
|
|
$comment_author_email = $email;
|
2003-06-05 15:57:26 -04:00
|
|
|
$comment_author_url = $tb_url;
|
2003-04-01 09:12:34 -05:00
|
|
|
|
|
|
|
$author = addslashes($author);
|
|
|
|
|
2003-10-03 18:52:59 -04:00
|
|
|
$result = $wpdb->query("INSERT INTO $tablecomments VALUES ('0', '$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$comment', '0')");
|
2003-04-01 09:12:34 -05:00
|
|
|
if (!$result) {
|
2003-06-04 14:50:21 -04:00
|
|
|
die ("There is an error with the database, it can't store your comment...<br />Contact the <a href=\"mailto:$admin_email\">webmaster</a>");
|
2003-04-01 09:12:34 -05:00
|
|
|
} else {
|
2003-10-03 18:52:59 -04:00
|
|
|
$postdata = get_postdata($comment_post_ID);
|
|
|
|
$authordata = get_userdata($postdata["Author_ID"]);
|
|
|
|
if ($comments_notify && '' != $authordata->user_email) {
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-10-03 19:04:54 -04:00
|
|
|
$notify_message = "New trackback on your post #$comment_post_ID \"".stripslashes($postdata['Title'])."\"\r\n\r\n";
|
2003-10-03 18:52:59 -04:00
|
|
|
$notify_message .= "Website: $comment_author (IP: $user_ip , $user_domain)\r\n";
|
|
|
|
$notify_message .= "URI : $comment_author_url\r\n";
|
|
|
|
$notify_message .= "Excerpt: \n".stripslashes($original_comment)."\r\n\r\n";
|
|
|
|
$notify_message .= "You can see all trackbacks on this post here: \r\n";
|
|
|
|
$notify_message .= "$siteurl/$blogfilename?p=$comment_post_ID&c=1\r\n\r\n";
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-10-03 18:52:59 -04:00
|
|
|
$subject = '[' . stripslashes($blogname) . '] Trackback: "' .stripslashes($postdata['Title']).'"';
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-10-03 18:52:59 -04:00
|
|
|
$from = "From: wordpress@".$HTTP_SERVER_VARS['SERVER_NAME'];
|
2003-10-09 12:06:29 -04:00
|
|
|
$from .= "\r\nX-Mailer: WordPress $b2_version with PHP/" . phpversion();
|
2003-04-01 09:12:34 -05:00
|
|
|
|
2003-10-03 18:52:59 -04:00
|
|
|
@mail($authordata->user_email, $subject, $notify_message, $from);
|
|
|
|
}
|
2003-04-01 09:12:34 -05:00
|
|
|
trackback_response(0);
|
|
|
|
}
|
|
|
|
}
|
2003-10-03 18:52:59 -04:00
|
|
|
}
|
2003-04-01 09:12:34 -05:00
|
|
|
?>
|