Merge "Make DBAccessBase use DBConnRef, rename $wiki, and hide getLoadBalancer()"
[lhc/web/wiklou.git] / includes / specials / SpecialNewSection.php
index a24d8cd..6c328da 100644 (file)
@@ -24,7 +24,7 @@ class SpecialNewSection extends RedirectSpecialPage {
        public function __construct() {
                parent::__construct( 'NewSection' );
                $this->mAllowedRedirectParams = [ 'preloadtitle', 'nosummary', 'editintro',
-                       'preload', 'preloadparams[]', 'summary' ];
+                       'preload', 'preloadparams', 'summary' ];
        }
 
        /**
@@ -43,6 +43,7 @@ class SpecialNewSection extends RedirectSpecialPage {
        protected function showNoRedirectPage() {
                $this->setHeaders();
                $this->outputHeader();
+               $this->addHelpLink( 'Help:New section' );
                $this->showForm();
        }
 
@@ -62,7 +63,11 @@ class SpecialNewSection extends RedirectSpecialPage {
 
        public function onFormSubmit( $formData ) {
                $title = $formData['page'];
-               $page = Title::newFromText( $title );
+               try {
+                       $page = Title::newFromTextThrow( $title );
+               } catch ( MalformedTitleException $e ) {
+                       return Status::newFatal( $e->getMessageObject() );
+               }
                $query = [ 'action' => 'edit', 'section' => 'new' ];
                $url = $page->getFullUrlForRedirect( $query );
                $this->getOutput()->redirect( $url );