function showSearchForm()
 {
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('undelete-search-title'));
     $out->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => wfScript())) . Xml::fieldset($this->msg('undelete-search-box')->text()) . Html::hidden('title', $this->getPageTitle()->getPrefixedDBkey()) . Html::rawElement('label', array('for' => 'prefix'), $this->msg('undelete-search-prefix')->parse()) . Xml::input('prefix', 20, $this->mSearchPrefix, array('id' => 'prefix', 'autofocus' => '')) . ' ' . Xml::submitButton($this->msg('undelete-search-submit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
     # List undeletable articles
     if ($this->mSearchPrefix) {
         $result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
         $this->showList($result);
     }
 }
示例#2
0
 function showSearchForm()
 {
     global $wgScript;
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('undelete-search-title'));
     $out->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::fieldset($this->msg('undelete-search-box')->text()) . Html::hidden('title', $this->getTitle()->getPrefixedDbKey()) . Xml::inputLabel($this->msg('undelete-search-prefix')->text(), 'prefix', 'prefix', 20, $this->mSearchPrefix) . ' ' . Xml::submitButton($this->msg('undelete-search-submit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
     # List undeletable articles
     if ($this->mSearchPrefix) {
         $result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
         $this->showList($result);
     }
 }
示例#3
0
 function execute($par)
 {
     $this->setHeaders();
     if (!$this->userCanExecute($this->getUser())) {
         $this->displayRestrictionError();
         return;
     }
     $this->outputHeader();
     $this->loadRequest();
     $out = $this->getOutput();
     if ($this->mAllowed) {
         $out->setPageTitle(wfMsg('undeletepage'));
     } else {
         $out->setPageTitle(wfMsg('viewdeletedpage'));
     }
     if ($par != '') {
         $this->mTarget = $par;
     }
     if ($this->mTarget !== '') {
         $this->mTargetObj = Title::newFromURL($this->mTarget);
         $this->getSkin()->setRelevantTitle($this->mTargetObj);
     } else {
         $this->mTargetObj = null;
     }
     if (is_null($this->mTargetObj)) {
         # Not all users can just browse every deleted page from the list
         if ($this->getUser()->isAllowed('browsearchive')) {
             $this->showSearchForm();
             # List undeletable articles
             if ($this->mSearchPrefix) {
                 $result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
                 $this->showList($result);
             }
         } else {
             $out->addWikiMsg('undelete-header');
         }
         return;
     }
     if ($this->mTimestamp !== '') {
         return $this->showRevision($this->mTimestamp);
     }
     if ($this->mFilename !== null) {
         $file = new ArchivedFile($this->mTargetObj, '', $this->mFilename);
         // Check if user is allowed to see this file
         if (!$file->exists()) {
             $out->addWikiMsg('filedelete-nofile', $this->mFilename);
             return;
         } elseif (!$file->userCan(File::DELETED_FILE)) {
             if ($file->isDeleted(File::DELETED_RESTRICTED)) {
                 $out->permissionRequired('suppressrevision');
             } else {
                 $out->permissionRequired('deletedtext');
             }
             return false;
         } elseif (!$this->getUser()->matchEditToken($this->mToken, $this->mFilename)) {
             $this->showFileConfirmationForm($this->mFilename);
             return false;
         } else {
             return $this->showFile($this->mFilename);
         }
     }
     if ($this->mRestore && $this->mAction == 'submit') {
         global $wgUploadMaintenance;
         if ($wgUploadMaintenance && $this->mTargetObj && $this->mTargetObj->getNamespace() == NS_FILE) {
             $out->wrapWikiMsg("<div class='error'>\n\$1\n</div>\n", array('filedelete-maintenance'));
             return;
         }
         return $this->undelete();
     }
     if ($this->mInvert && $this->mAction == 'submit') {
         return $this->showHistory();
     }
     return $this->showHistory();
 }
 function execute()
 {
     global $wgOut;
     if ($this->mAllowed) {
         $wgOut->setPagetitle(wfMsg("undeletepage"));
     } else {
         $wgOut->setPagetitle(wfMsg("viewdeletedpage"));
     }
     if (is_null($this->mTargetObj)) {
         $this->showSearchForm();
         # List undeletable articles
         if ($this->mSearchPrefix) {
             $result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
             $this->showList($result);
         }
         return;
     }
     if ($this->mTimestamp !== '') {
         return $this->showRevision($this->mTimestamp);
     }
     if ($this->mFile !== null) {
         return $this->showFile($this->mFile);
     }
     if ($this->mRestore && $this->mAction == "submit") {
         return $this->undelete();
     }
     return $this->showHistory();
 }
示例#5
0
 function execute()
 {
     global $wgOut, $wgUser;
     if ($this->mAllowed) {
         $wgOut->setPagetitle(wfMsg("undeletepage"));
     } else {
         $wgOut->setPagetitle(wfMsg("viewdeletedpage"));
     }
     if (is_null($this->mTargetObj)) {
         # Not all users can just browse every deleted page from the list
         if ($wgUser->isAllowed('browsearchive')) {
             $this->showSearchForm();
             # List undeletable articles
             if ($this->mSearchPrefix) {
                 $result = PageArchive::listPagesByPrefix($this->mSearchPrefix);
                 $this->showList($result);
             }
         } else {
             $wgOut->addWikiText(wfMsgHtml('undelete-header'));
         }
         return;
     }
     if ($this->mTimestamp !== '') {
         return $this->showRevision($this->mTimestamp);
     }
     if ($this->mFile !== null) {
         $file = new ArchivedFile($this->mTargetObj, '', $this->mFile);
         // Check if user is allowed to see this file
         if (!$file->userCan(File::DELETED_FILE)) {
             $wgOut->permissionRequired('suppressrevision');
             return false;
         } elseif (!$wgUser->matchEditToken($this->mToken, $this->mFile)) {
             $this->showFileConfirmationForm($this->mFile);
             return false;
         } else {
             return $this->showFile($this->mFile);
         }
     }
     if ($this->mRestore && $this->mAction == "submit") {
         return $this->undelete();
     }
     if ($this->mInvert && $this->mAction == "submit") {
         return $this->showHistory();
     }
     return $this->showHistory();
 }