Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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) . '&nbsp;' . ($tagSelector ? implode('&nbsp;', $tagSelector) . '&nbsp;' : '') . 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__);
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  *
  * Returns the html for the box at the
  * top of NFD Guardian which contains
  * information about the current
  * article being voted on.
  *
  */
 function getArticleInfoBox()
 {
     global $wgOut;
     //first find out who the author was
     $articleInfo = $this->getArticleInfo();
     if (intval($articleInfo->fe_user) > 0) {
         $u = User::newFromId($articleInfo->fe_user);
         $userLink = $u->getUserPage()->getInternalURL();
         $userName = $u->getName();
         $cp = new ContribsPager($userName);
         $uEdits = $cp->getNumRows();
     } else {
         $u = User::newFromName($articleInfo->fe_user_text);
         $userLink = "/User:"******"") {
         $t = Title::newFromText($nfdReason['article']);
         if ($t) {
             $nfdLongReason .= " with [[" . $t->getText() . "]]";
         }
     }
     //finally check the number of discussion items for this
     //article. We ask for confirmation for articles
     //with a lot of discussion items.
     $t = Title::newFromID($this->mResult->nfd_page);
     if ($t) {
         $a = new Article($t);
         $pageHistory = new PageHistory($a);
         $pager = new PageHistoryPager($pageHistory);
         $edits = $pager->getNumRows();
         $discussionTitle = Title::newFromText($t->getText(), NS_TALK);
         if ($discussionTitle) {
             $discussionArticle = new Article($discussionTitle);
             $pageHistory = new PageHistory($discussionArticle);
             $pager = new PageHistoryPager($pageHistory);
             $discussion = $pager->getNumRows();
         } else {
             $discussion = 0;
         }
     }
     $articleInfo = $this->getArticleInfo();
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('age' => wfTimeAgo($this->mResult->nfd_fe_timestamp), 'authorUrl' => $userLink, 'authorName' => $userName, 'views' => $articleInfo->page_counter, 'nfd' => $wgOut->parse($nfdLongReason), 'edits' => $edits, 'userEdits' => $uEdits, 'nfdVotes' => $this->getTotalVotes($this->mResult->nfd_id), 'discussion' => $discussion));
     $html = $tmpl->execute('NFDinfo.tmpl.php');
     return $html;
 }