Extension:CreateArticle/sourcecode

ENDFORM; return $createform; }       /**         * If br=no, create button is placed on rh side of textbox * defaults to yes */       function lineBreak { # Should we be inserting a tag? $cond = ( strtolower( $this->br ) == "no" ); $this->br = $cond ? '' : ' ';       }        /**         * If the width is not supplied, set it to 50 */       function checkWidth { if( !$this->width || trim( $this->width ) == '' ) $this->width = 50; } } /* creates the requested article using the supplied parameters */ function actionCreatearticle($action, $article) { global $wgRequest, $wgTitle, $wgOut, $prefix;

if($action != 'createarticle') return true;

$prefix = $wgRequest->getVal('prefix'); $subpage = $wgRequest->getVal('subpage'); $title = $wgRequest->getVal('title');

if($prefix && strpos($title, $prefix)!==0) { $title = $prefix. $title; }   if($subpage && substr($title,-strlen($subpage))!=$subpage) { $title.= $subpage; }   $title = Title::newFromText( $title ); if (trim($wgRequest->getVal('title'))=='') { $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) ); $wgOut->errorpage( 'badtitle', 'badtitletext');   } if(isset($title) && $title->getArticleID == 0) { accRedirect($title, 'createarticle'); } elseif (!isset($title)) { $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) ); $wgOut->errorpage( 'badtitle', 'badtitletext'); } else { ##need to make this create error messages to disallow editing existing articles from here $wgTitle = Title::newFromText( wfMsgForContent( 'createarticle' ) ); $wgOut->errorpage( 'error', 'articleexists' ); }   return false; } /* builds and sends the URL to the browser */ function accRedirect($title, $action) { global $wgRequest, $wgOut; $query = "action=edit&section=". $wgRequest->getVal('section'). "&createintro=". $wgRequest->getVal('createintro'). "&preload=". $wgRequest->getVal('preload'). "&editintro=". $wgRequest->getVal('editintro');

$wgOut->setSquidMaxage( 1200 ); $wgOut->redirect($title->getFullURL( $query ), '301'); }