SECURITY: Add permission check for suppressed account
[lhc/web/wiklou.git] / includes / specials / SpecialNewSection.php
index b503141..c124c14 100644 (file)
@@ -52,6 +52,7 @@ class SpecialNewSection extends RedirectSpecialPage {
                                'type' => 'text',
                                'name' => 'page',
                                'label-message' => 'newsection-page',
+                               'required' => true,
                        ],
                ], $this->getContext(), 'newsection' );
                $form->setSubmitTextMsg( 'newsection-submit' );
@@ -60,7 +61,12 @@ class SpecialNewSection extends RedirectSpecialPage {
        }
 
        public function onFormSubmit( $formData ) {
-               $page = $formData['page'];
+               $title = $formData['page'];
+               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 );