diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /trackback.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'trackback.php')
-rw-r--r-- | trackback.php | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/trackback.php b/trackback.php deleted file mode 100644 index 0e2036a9..00000000 --- a/trackback.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * Provide functions to handle article trackbacks. - * @file - * @ingroup SpecialPage - */ - -if ( isset( $_SERVER['MW_COMPILED'] ) ) { - require ( 'phase3/includes/WebStart.php' ); -} else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); -} - -class TrackBack { - - private $r, $url, $title = null; - - private function XMLsuccess() { - header( "Content-Type: application/xml; charset=utf-8" ); - echo <<<XML -<?xml version="1.0" encoding="utf-8"?> -<response> - <error>0</error> -</response> -XML; - exit; - } - - private function XMLerror( $err = "Invalid request." ) { - header( "HTTP/1.0 400 Bad Request" ); - header( "Content-Type: application/xml; charset=utf-8" ); - echo <<<XML -<?xml version="1.0" encoding="utf-8"?> -<response> - <error>1</error> - <message>Invalid request: $err</message> -</response> -XML; - exit; - } - - public function __construct() { - global $wgUseTrackbacks, $wgRequest; - - if( !$wgUseTrackbacks ) - $this->XMLerror( "Trackbacks are disabled" ); - - $this->r = $wgRequest; - - if( !$this->r->wasPosted() ) { - $this->XMLerror( "Must be posted" ); - } - - $this->url = $wgRequest->getText( 'url' ); - $article = $wgRequest->getText( 'article' ); - - if( !$this->url || !$article ) { - $this->XMLerror( "Required field not specified" ); - } - - $this->title = Title::newFromText( $article ); - if( !$this->title || !$this->title->exists() ) { - $this->XMLerror( "Specified article does not exist." ); - } - } - - public function write() { - $dbw = wfGetDB( DB_MASTER ); - - $tbtitle = $this->r->getText( 'title' ); - $tbex = $this->r->getText( 'excerpt' ); - $tbname = $this->r->getText( 'blog_name' ); - - $dbw->insert('trackbacks', array( - 'tb_page' => $this->title->getArticleID(), - 'tb_title' => $tbtitle, - 'tb_url' => $this->url, - 'tb_ex' => $tbex, - 'tb_name' => $tbname - )); - - $dbw->commit(); - - $this->XMLsuccess(); - } -} - -$tb = new TrackBack(); -$tb->write(); |