3 * Provide functions to handle article trackbacks.
5 * @subpackage SpecialPage
9 define('MEDIAWIKI', true);
10 if ( isset( $_REQUEST['GLOBALS'] ) ) {
11 echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
15 require_once('./includes/Defines.php');
17 if (!file_exists('LocalSettings.php'))
20 require_once('./LocalSettings.php');
21 require_once('includes/Setup.php');
23 require_once('Title.php');
24 require_once('DatabaseFunctions.php');
29 function XMLsuccess() {
31 <?xml version=\"1.0\" encoding=\"utf-8\"?>
39 function XMLerror($err = "Invalid request.") {
40 header("HTTP/1.0 400 Bad Request");
42 <?xml version=\"1.0\" encoding=\"utf-8\"?>
45 <message>Invalid request: $err</message>
51 if (!$wgUseTrackbacks)
52 XMLerror("Trackbacks are disabled.");
54 if ( !isset($_POST['url'])
55 ||
!isset($_POST['blog_name'])
56 ||
!isset($_REQUEST['article']))
57 XMLerror("Required field not specified");
59 $dbw =& wfGetDB(DB_MASTER
);
61 $tbtitle = $_POST['title'];
62 $tbex = $_POST['excerpt'];
63 $tburl = $_POST['url'];
64 $tbname = $_POST['blog_name'];
65 $tbarticle = $_REQUEST['article'];
67 $title = Title
::newFromText($tbarticle);
68 if (!$title->exists())
69 XMLerror("Specified article does not exist.");
71 $dbw->insert('trackbacks', array(
72 'tb_page' => $title->getArticleID(),
73 'tb_title' => $tbtitle,