/** * Print the history page for an article. * * @returns nothing */ function history() { global $wgOut, $wgRequest, $wgTitle; /* * Allow client caching. */ if ($wgOut->checkLastModified($this->mArticle->getTimestamp())) { /* Client cache fresh and headers sent, nothing more to do. */ return; } $wgOut->addScript("<script src='/skins/common/history.js'></script>"); $fname = 'PageHistory::history'; wfProfileIn($fname); /* * Setup page variables. */ $wgOut->setPageTitle(wfMsg('history-title', $this->mTitle->getPrefixedText())); $wgOut->setPageTitleActionText(wfMsg('history_short')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->setSyndicated(true); $wgOut->setFeedAppendQuery('action=history'); $logPage = SpecialPage::getTitleFor('Log'); $logLink = $this->mSkin->makeKnownLinkObj($logPage, wfMsgHtml('viewpagelogs'), 'page=' . $this->mTitle->getPrefixedUrl()); $wgOut->setSubtitle($logLink); $feedType = $wgRequest->getVal('feed'); if ($feedType) { wfProfileOut($fname); return $this->feed($feedType); } /* * Fail if article doesn't exist. */ if (!$this->mTitle->exists()) { $wgOut->addWikiMsg('nohistory'); wfProfileOut($fname); return; } /* * "go=first" means to jump to the last (earliest) history page. * This is deprecated, it no longer appears in the user interface */ if ($wgRequest->getText("go") == 'first') { $limit = $wgRequest->getInt('limit', 50); $wgOut->redirect($wgTitle->getLocalURL("action=history&limit={$limit}&dir=prev")); return; } wfRunHooks('PageHistoryBeforeList', array(&$this->mArticle)); // XXCHANGED - show last patrolled revision to staff global $wgUser; $userGroups = $wgUser ? $wgUser->getGroups() : array(); $this->mShowGoodRev = in_array('staff', $userGroups); if ($this->mShowGoodRev) { $gr = GoodRevision::newFromTitle($this->mTitle, $this->mArticle->getId()); if ($gr) { $this->mGoodRev = $gr->latestGood(); } } /** * Do the list */ $pager = new PageHistoryPager($this); $this->linesonpage = $pager->getNumRows(); $wgOut->addHTML($pager->getNavigationBar() . $this->beginHistoryList() . $pager->getBody() . $this->endHistoryList() . $pager->getNavigationBar()); wfProfileOut($fname); }
/** * Print the history page for an article. * * @returns nothing */ function history() { global $wgOut, $wgRequest, $wgTitle; /* * Allow client caching. */ if ($wgOut->checkLastModified($this->mArticle->getTimestamp())) { /* Client cache fresh and headers sent, nothing more to do. */ return; } $fname = 'PageHistory::history'; wfProfileIn($fname); /* * Setup page variables. */ $wgOut->setPageTitle($this->mTitle->getPrefixedText()); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->setSyndicated(true); $logPage = Title::makeTitle(NS_SPECIAL, 'Log'); $logLink = $this->mSkin->makeKnownLinkObj($logPage, wfMsgHtml('viewpagelogs'), 'page=' . $this->mTitle->getPrefixedUrl()); $subtitle = wfMsgHtml('revhistory') . '<br />' . $logLink; $wgOut->setSubtitle($subtitle); $feedType = $wgRequest->getVal('feed'); if ($feedType) { wfProfileOut($fname); return $this->feed($feedType); } /* * Fail if article doesn't exist. */ if (!$this->mTitle->exists()) { $wgOut->addWikiText(wfMsg('nohistory')); wfProfileOut($fname); return; } /* * "go=first" means to jump to the last (earliest) history page. * This is deprecated, it no longer appears in the user interface */ if ($wgRequest->getText("go") == 'first') { $limit = $wgRequest->getInt('limit', 50); $wgOut->redirect($wgTitle->getLocalURL("action=history&limit={$limit}&dir=prev")); return; } // JLD BEGIN PATCH (code from MW 1.10) wfRunHooks('PageHistoryBeforeList', array(&$this->mArticle)); // JLD END PATCH /** * Do the list */ $pager = new PageHistoryPager($this); $navbar = $pager->getNavigationBar(); $this->linesonpage = $pager->getNumRows(); $wgOut->addHTML($pager->getNavigationBar() . $this->beginHistoryList() . $pager->getBody() . $this->endHistoryList() . $pager->getNavigationBar()); wfProfileOut($fname); }
/** * Print the history page for an article. * * @returns nothing */ function history() { global $wgOut, $wgRequest, $wgTitle, $wgScript; /* * Allow client caching. */ if ($wgOut->checkLastModified($this->mArticle->getTouched())) { return; } // Client cache fresh and headers sent, nothing more to do. wfProfileIn(__METHOD__); /* * Setup page variables. */ $wgOut->setPageTitle(wfMsg('history-title', $this->mTitle->getPrefixedText())); $wgOut->setPageTitleActionText(wfMsg('history_short')); $wgOut->setArticleFlag(false); $wgOut->setArticleRelated(true); $wgOut->setRobotPolicy('noindex,nofollow'); $wgOut->setSyndicated(true); $wgOut->setFeedAppendQuery('action=history'); $wgOut->addScriptFile('history.js'); $logPage = SpecialPage::getTitleFor('Log'); $logLink = $this->mSkin->makeKnownLinkObj($logPage, wfMsgHtml('viewpagelogs'), 'page=' . $this->mTitle->getPrefixedUrl()); $wgOut->setSubtitle($logLink); $feedType = $wgRequest->getVal('feed'); if ($feedType) { wfProfileOut(__METHOD__); return $this->feed($feedType); } /* * Fail if article doesn't exist. */ if (!$this->mTitle->exists()) { $wgOut->addWikiMsg('nohistory'); wfProfileOut(__METHOD__); return; } /** * Add date selector to quickly get to a certain time */ $year = $wgRequest->getInt('year'); $month = $wgRequest->getInt('month'); $tagFilter = $wgRequest->getVal('tagfilter'); $tagSelector = ChangeTags::buildTagFilterSelector($tagFilter); $action = htmlspecialchars($wgScript); $wgOut->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset(wfMsg('history-fieldset-title'), false, array('id' => 'mw-history-search')) . Xml::hidden('title', $this->mTitle->getPrefixedDBKey()) . "\n" . Xml::hidden('action', 'history') . "\n" . xml::dateMenu($year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . Xml::submitButton(wfMsg('allpagessubmit')) . "\n" . '</fieldset></form>'); wfRunHooks('PageHistoryBeforeList', array(&$this->mArticle)); /** * Do the list */ $pager = new PageHistoryPager($this, $year, $month, $tagFilter); $this->linesonpage = $pager->getNumRows(); $wgOut->addHTML($pager->getNavigationBar() . $this->beginHistoryList() . $pager->getBody() . $this->endHistoryList() . $pager->getNavigationBar()); wfProfileOut(__METHOD__); }