<?php define('TRACKBACK', true); require_once "common.php"; if (!$config->enable_trackbacking) { exit; } $post = new Post($_GET['id']); if (empty($_POST['title']) and empty($_POST['url']) and empty($_POST['blog_name'])) { redirect($post->url()); } if (!Post::exists($_GET['id'])) { trackback_respond(true, __("Fake post ID, or nonexistant post.")); } if (!empty($_POST['url'])) { header('Content-Type: text/xml; charset=utf-8'); $url = strip_tags($_POST['url']); $title = strip_tags($_POST['title']); $excerpt = strip_tags($_POST['excerpt']); $blog_name = strip_tags($_POST['blog_name']); $excerpt = truncate($excerpt, 255); $title = truncate($title, 250); $trigger->call("trackback_receive", $url, $title, $excerpt, $blog_name); trackback_respond(); }
static function trackback_receive($url, $title, $excerpt, $blog_name) { $sql = SQL::current(); $count = $sql->count("comments", array("post_id" => $_GET['id'], "author_url" => $_POST['url'])); if ($count) { trackback_respond(true, __("A ping from that URL is already registered.", "comments")); } $post = new Post($_GET["id"]); if ($post->no_results) { return false; } Comment::create($blog_name, "", $_POST["url"], '<strong><a href="' . fix($url) . '">' . fix($title) . '</a></strong>' . "\n" . $excerpt, $post, "trackback"); }