-$dbw->insert('trackbacks', array(
- 'tb_id' => $title->getArticleID(),
- 'tb_title' => $tbtitle,
- 'tb_url' => $tburl,
- 'tb_ex' => $tbex,
- 'tb_name' => $tbname
-));
+ 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();
+ }
+}