コード例 #1
0
 function showRevision($timestamp)
 {
     global $wgLang, $wgUser, $wgOut;
     if (!preg_match("/[0-9]{14}/", $timestamp)) {
         return 0;
     }
     $archive = new PageArchive($this->mTargetObj);
     $text = $archive->getRevisionText($timestamp);
     $wgOut->setPagetitle(wfMsg("undeletepage"));
     $wgOut->addWikiText("(" . wfMsg("undeleterevision", $wgLang->date($timestamp)) . ")\n");
     if ($this->mPreview) {
         $wgOut->addHtml("<hr />\n");
         $wgOut->addWikiText($text);
     }
     $self = Title::makeTitle(NS_SPECIAL, "Undelete");
     $wgOut->addHtml(wfElement('textarea', array('readonly' => true, 'cols' => intval($wgUser->getOption('cols')), 'rows' => intval($wgUser->getOption('rows'))), $text . "\n") . wfOpenElement('div') . wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalURL("action=submit"))) . wfElement('input', array('type' => 'hidden', 'name' => 'target', 'value' => $this->mTargetObj->getPrefixedDbKey())) . wfElement('input', array('type' => 'hidden', 'name' => 'timestamp', 'value' => $timestamp)) . wfElement('input', array('type' => 'hidden', 'name' => 'wpEditToken', 'value' => $wgUser->editToken())) . wfElement('input', array('type' => 'hidden', 'name' => 'preview', 'value' => '1')) . wfElement('input', array('type' => 'submit', 'value' => wfMsg('showpreview'))) . wfCloseElement('form') . wfCloseElement('div'));
 }