Experimental dark skin by Nikerabbit. Need some feedback and bug fixing though
[mediawiki.git] / trackback.php
bloba2c9d8dc451871922c8621bf147162443432dd10
1 <?php
2 /**
3 * Provide functions to handle article trackbacks.
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 unset($IP);
9 define('MEDIAWIKI', true);
10 require_once('./includes/Defines.php');
12 if (!file_exists('LocalSettings.php'))
13 exit;
15 require_once('./LocalSettings.php');
16 require_once('includes/Setup.php');
18 require_once('Title.php');
19 require_once('DatabaseFunctions.php');
21 /**
24 function XMLsuccess() {
25 echo "
26 <?xml version=\"1.0\" encoding=\"utf-8\"?>
27 <response>
28 <error>0</error>
29 </response>
31 exit;
34 function XMLerror($err = "Invalid request.") {
35 header("HTTP/1.0 400 Bad Request");
36 echo "
37 <?xml version=\"1.0\" encoding=\"utf-8\"?>
38 <response>
39 <error>1</error>
40 <message>Invalid request: $err</message>
41 </response>
43 exit;
46 if (!$wgUseTrackbacks)
47 XMLerror("Trackbacks are disabled.");
49 if ( !isset($_POST['url'])
50 || !isset($_POST['blog_name'])
51 || !isset($_REQUEST['article']))
52 XMLerror("Required field not specified");
54 $dbw =& wfGetDB(DB_MASTER);
56 $tbtitle = $_POST['title'];
57 $tbex = $_POST['excerpt'];
58 $tburl = $_POST['url'];
59 $tbname = $_POST['blog_name'];
60 $tbarticle = $_REQUEST['article'];
62 $title = Title::newFromText($tbarticle);
63 if (!$title->exists())
64 XMLerror("Specified article does not exist.");
66 $dbw->insert('trackbacks', array(
67 'tb_page' => $title->getArticleID(),
68 'tb_title' => $tbtitle,
69 'tb_url' => $tburl,
70 'tb_ex' => $tbex,
71 'tb_name' => $tbname
72 ));
74 XMLsuccess();
75 exit;