From 98807353fa7ff784e6f2ea26598d8ce4259215db Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 6 Jun 2009 15:38:18 +0000 Subject: [PATCH] Follow-up to r49973 (Revert r49880, r49883, r49885 - add uniwiki/CreatePage extension to core) * Special page addition was not reverted. --- includes/specials/SpecialCreatePage.php | 101 ------------------------ 1 file changed, 101 deletions(-) delete mode 100644 includes/specials/SpecialCreatePage.php diff --git a/includes/specials/SpecialCreatePage.php b/includes/specials/SpecialCreatePage.php deleted file mode 100644 index 5e84d21036..0000000000 --- a/includes/specials/SpecialCreatePage.php +++ /dev/null @@ -1,101 +0,0 @@ - for the Uniwiki extension CreatePage - * Originally licensed as: GNU GPL v2.0 or later - * - * This page has been copied and adapted from the Uniwiki extension CreatePage - * Originally licensed as: http://www.gnu.org/licenses/gpl-3.0.txt - * - * @license GNU GPL v3.0 http://www.gnu.org/licenses/gpl-3.0.txt - * @author Travis Derouin - * @author Merrick Schaefer - * @author Mark Johnston - * @author Evan Wheeler - * @author Adam Mckaig (at UNICEF) - * @author Siebrand Mazeland (integrated into MediaWiki core) - * @addtogroup SpecialPage - */ - -class SpecialCreatePage extends SpecialPage { - - public function __construct() { - parent::__construct( 'CreatePage', 'createpage' ); - } - - public function execute( $params ) { - global $wgOut, $wgRequest, $wgUser; - - $this->setHeaders(); - - if ( !$this->userCanExecute( $wgUser ) ) { - $this->displayRestrictionError(); - return; - } - - $wgOut->addWikiMsg( 'createpage-summary' ); - - // check to see if we are trying to create a page - $target = $wgRequest->getVal ( 'target' ); - $title = Title::newFromText ( $target ); - - // check for no title - if ( $wgRequest->wasPosted() && $target === '' ) { - $this->error( wfMsg( 'createpage-entertitle' ) ); - } - // check for invalid title - elseif ( $wgRequest->wasPosted() && is_null( $title ) ) { - $this->error( wfMsg( 'createpage-badtitle', $target ) ); - } - elseif ( $target != null ) { - if ( $title->getArticleID() > 0 ) { - // if the title exists then let the user know and give other options - $wgOut->addWikiText ( wfMsg ( 'createpage-titleexists', $title->getFullText() ) . "
" ); - $skin = $wgUser->getSkin(); - $editlink = $skin->makeLinkObj( $title, wfMsg ( 'createpage-editexisting' ), 'action=edit' ); - $thisPage = Title::newFromText ( 'CreatePage', NS_SPECIAL ); - $wgOut->addHTML ( $editlink . '
' - . $skin->makeLinkObj ( $thisPage, wfMsg ( 'createpage-tryagain' ) ) - ); - return; - } else { - /* TODO - may want to search for closely named pages and give - * other options here... */ - - // otherwise, redirect them to the edit page for their title - $wgOut->redirect ( $title->getEditURL() ); - } - } - - // if this is just a normal GET, then output the form - - // prefill the input with the title, if it was passed along - $newTitle = false; - $newTitleText = $wgRequest->getVal( 'newtitle', null ); - if ( $newTitleText != null ) { - $newTitle = Title::newFromURL( $newTitleText ); - if ( is_null( $newTitle ) ) - $newTitle = $newTitleText; - else - $newTitle = $newTitle->getText(); - } - - // output the form - $form = Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'createpage' ) ) . # This should really use a different message - wfMsgWikiHtml( 'createpage-instructions' ) . - Xml::openElement( 'form', array( 'method' => 'post', 'name' => 'createpageform', 'action' => '' ) ) . - Xml::element( 'input', array( 'type' => 'text', 'name' => 'target', 'size' => 50, 'value' => $newTitle ) ) . - '
' . - Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'createpage-submitbutton' ) ) ) . - Xml::closeElement( 'form' ) . - Xml::closeElement( 'fieldset' ); - $wgOut->addHTML( $form ); - } - /* - * Function to output an error message - * @param $msg String: message text or HTML - */ - function error( $msg ) { - global $wgOut; - $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), $msg ) ); - } -} -- 2.20.1