/** * Constructor */ function wfSpecialMovepage($par = null) { global $wgUser, $wgOut, $wgRequest, $action; # Check rights if (!$wgUser->isAllowed('move')) { $wgOut->showPermissionsErrorPage(array($wgUser->isAnon() ? 'movenologintext' : 'movenotallowed')); return; } # Don't allow blocked users to move pages if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } # Check for database lock if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } $f = new MovePageForm($par); if ('success' == $action) { $f->showSuccess(); } else { if ('submit' == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) { $f->doSubmit(); } else { $f->showForm(''); } } }
/** * Constructor */ function wfSpecialMovepage($par = null) { global $wgUser, $wgOut, $wgRequest, $action; # Check for database lock if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } $target = isset($par) ? $par : $wgRequest->getVal('target'); // Yes, the use of getVal() and getText() is wanted, see bug 20365 $oldTitleText = $wgRequest->getVal('wpOldTitle', $target); $newTitleText = $wgRequest->getText('wpNewTitle'); $oldTitle = Title::newFromText($oldTitleText); $newTitle = Title::newFromText($newTitleText); if (is_null($oldTitle)) { $wgOut->showErrorPage('notargettitle', 'notargettext'); return; } if (!$oldTitle->exists()) { $wgOut->showErrorPage('nopagetitle', 'nopagetext'); return; } # Check rights $permErrors = $oldTitle->getUserPermissionsErrors('move', $wgUser); if (!empty($permErrors)) { $wgOut->showPermissionsErrorPage($permErrors); return; } $form = new MovePageForm($oldTitle, $newTitle); if ('submit' == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) { $form->doSubmit(); } else { $form->showForm(''); } }
/** * Constructor */ function wfSpecialMovepage($par = null) { global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove; # check rights. We don't want newbies to move pages to prevents possible attack if ($wgUser->isAnon() or $wgUser->isBlocked() or $wgOnlySysopMayMove and $wgUser->isNewbie()) { $wgOut->errorpage("movenologin", "movenologintext"); return; } # We don't move protected pages if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } $f = new MovePageForm($par); if ('success' == $action) { $f->showSuccess(); } else { if ('submit' == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) { $f->doSubmit(); } else { $f->showForm(''); } } }
protected function doOldNormalMovePage() { global $wgRequest; $form = new MovePageForm( $this->oldTitle, $this->newTitle ); if ( 'submit' == $wgRequest->getVal( 'action' ) && $this->checkToken() && $wgRequest->wasPosted() ) { $form->doSubmit(); } else { $form->showForm( '' ); } }
/** * Partially copies from SpecialMovepage.php, because it cannot be * extended in other ways. */ public function execute($par) { $request = $this->getRequest(); $user = $this->getUser(); // Yes, the use of getVal() and getText() is wanted, see bug T22365 $this->oldText = $request->getVal('wpOldTitle', $request->getVal('target', $par)); $this->newText = $request->getText('wpNewTitle'); $this->oldTitle = Title::newFromText($this->oldText); $this->newTitle = Title::newFromText($this->newText); $this->reason = $request->getText('reason'); // Checkboxes that default being checked are tricky $this->moveSubpages = $request->getBool('subpages', !$request->wasPosted()); if ($this->doBasicChecks() !== true) { return; } // Real stuff starts here $page = TranslatablePage::newFromTitle($this->oldTitle); if ($page->getMarkedTag() !== false) { $this->page = $page; $this->getOutput()->setPagetitle($this->msg('pt-movepage-title', $this->oldText)); if (!$user->isAllowed('pagetranslation')) { throw new PermissionsError('pagetranslation'); } // Is there really no better way to do this? $subactionText = $request->getText('subaction'); switch ($subactionText) { case $this->msg('pt-movepage-action-check')->text(): $subaction = 'check'; break; case $this->msg('pt-movepage-action-perform')->text(): $subaction = 'perform'; break; case $this->msg('pt-movepage-action-other')->text(): $subaction = ''; break; default: $subaction = ''; } if ($subaction === 'check' && $this->checkToken() && $request->wasPosted()) { $blockers = $this->checkMoveBlockers(); if (count($blockers)) { $this->showErrors($blockers); $this->showForm(); } else { $this->showConfirmation(); } } elseif ($subaction === 'perform' && $this->checkToken() && $request->wasPosted()) { $this->performAction(); } else { $this->showForm(); } } else { // Delegate... don't want to reimplement this $sp = new MovePageForm(); $sp->execute($par); } }