3 * Provide functions to handle article trackbacks.
8 require_once( './includes/WebStart.php' );
10 function XMLsuccess() {
11 header( "Content-Type: application/xml; charset=utf-8" );
12 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
20 function XMLerror( $err = "Invalid request." ) {
21 header( "HTTP/1.0 400 Bad Request" );
22 header( "Content-Type: application/xml; charset=utf-8" );
23 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
26 <message>Invalid request: $err</message>
32 if( !$wgUseTrackbacks )
33 XMLerror("Trackbacks are disabled.");
35 if( !isset( $_POST['url'] )
36 ||
!isset( $_REQUEST['article'] ) )
37 XMLerror("Required field not specified");
39 $dbw = wfGetDB( DB_MASTER
);
41 $tbtitle = strval( @$_POST['title'] );
42 $tbex = strval( @$_POST['excerpt'] );
43 $tburl = strval( $_POST['url'] );
44 $tbname = strval( @$_POST['blog_name'] );
45 $tbarticle = strval( $_REQUEST['article'] );
47 $title = Title
::newFromText($tbarticle);
48 if( !$title ||
!$title->exists() )
49 XMLerror( "Specified article does not exist." );
51 $dbw->insert('trackbacks', array(
52 'tb_page' => $title->getArticleID(),
53 'tb_title' => $tbtitle,