function execute($query) { ApprovedRevs::addCSS(); $this->setHeaders(); $rep = new SpecialApprovedFilesQueryPage($this->getRequest()->getVal('show')); return $rep->execute($query); }
function execute($query) { global $wgRequest; ApprovedRevs::addCSS(); $this->setHeaders(); list($limit, $offset) = wfCheckLimits(); $mode = $wgRequest->getVal('show'); $rep = new SpecialApprovedRevsPage($mode); if (method_exists($rep, 'execute')) { return $rep->execute($query); } else { return $rep->doQuery($offset, $limit); } }
/** * Same as addWarningToEditPage(), but for the Semantic Foms * 'edit with form' tab */ public static function addWarningToSFForm(&$pageName, &$preFormHTML) { // The title could be obtained via $pageName in theory - the // problem is that, pre-SF 2.0.2, that variable wasn't set // correctly. global $wgTitle; $approvedRevID = ApprovedRevs::getApprovedRevID($wgTitle); $latestRevID = $wgTitle->getLatestRevID(); if (!empty($approvedRevID) && $approvedRevID != $latestRevID) { ApprovedRevs::addCSS(); $preFormHTML .= Xml::element('p', array('style' => 'font-weight: bold'), wfMsg('approvedrevs-editwarning')) . "\n"; } return true; }
/** * On image pages (pages in NS_FILE), modify each line in the file history * (file history, not history of wikitext on file page). Add * "approved-revision" class to the appropriate row. For users with * approve permissions on this page add "approve" and "unapprove" links as * required. **/ public static function onImagePageFileHistoryLine($hist, $file, &$s, &$rowClass) { $fileTitle = $file->getTitle(); if (!ApprovedRevs::fileIsApprovable($fileTitle)) { return true; } $rowTimestamp = $file->getTimestamp(); $rowSha1 = $file->getSha1(); list($approvedRevTimestamp, $approvedRevSha1) = ApprovedRevs::getApprovedFileInfo($file->getTitle()); ApprovedRevs::addCSS(); // Apply class to row of approved revision // Note: both here and below in the "userCanApprove" section, if the // timestamp condition is removed then all rows with the same sha1 as // the approved rev will be given the class "approved-revision", and // highlighted. Only the actual approved rev will be given the message // approvedrevs-historylabel, though. if ($rowSha1 == $approvedRevSha1 && $rowTimestamp == $approvedRevTimestamp) { if ($rowClass) { $rowClass .= ' '; } $rowClass .= "approved-revision"; $pattern = "/<td[^>]+filehistory-selected+[^>]+>/"; $replace = "\$0" . wfMessage('approvedrevs-historylabel')->text() . "<br />"; $s = preg_replace($pattern, $replace, $s); } if (ApprovedRevs::userCanApprove($fileTitle)) { if ($rowSha1 == $approvedRevSha1 && $rowTimestamp == $approvedRevTimestamp) { $url = $fileTitle->getLocalUrl(array('action' => 'unapprovefile')); $msg = wfMessage('approvedrevs-unapprove')->text(); } else { $url = $fileTitle->getLocalUrl(array('action' => 'approvefile', 'ts' => $rowTimestamp, 'sha1' => $rowSha1)); $msg = wfMessage('approvedrevs-approve')->text(); } $s .= '<td>' . Xml::element('a', array('href' => $url), $msg) . '</td>'; } return true; }