Пример #1
0
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     # Check permissions
     if (!$wgUser->isAllowed('deletebatch')) {
         $this->displayRestrictionError();
         return;
     }
     # Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     # If user is blocked, s/he doesn't need to access this page
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     $wgOut->setPageTitle(wfMsg('deletebatch-title'));
     $cSF = new DeleteBatchForm($par, $this->getTitle());
     $action = $wgRequest->getVal('action');
     if ('success' == $action) {
         /* do something */
     } elseif ($wgRequest->wasPosted() && 'submit' == $action && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
         $cSF->doSubmit();
     } else {
         $cSF->showForm();
     }
 }
Пример #2
0
 function execute()
 {
     global $wgOut, $wgUser, $wgRequest;
     if (!$wgUser->isAllowed('deletebatch')) {
         throw new PermissionsError('deletebatch');
     }
     $wgOut->setPageTitle(wfMsg('deletebatch_title'));
     $cSF = new DeleteBatchForm();
     $action = $wgRequest->getVal('action');
     if ('success' == $action) {
         /* do something */
     } else {
         if ($wgRequest->wasPosted() && 'submit' == $action && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
             $cSF->doSubmit();
         } else {
             $cSF->showForm('');
         }
     }
 }