/**
  * Callback function to output a restriction
  */
 function formatRow($row)
 {
     global $wgUser, $wgLang, $wgContLang;
     wfProfileIn(__METHOD__);
     static $skin = null;
     if (is_null($skin)) {
         $skin = $wgUser->getSkin();
     }
     $title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
     $link = $skin->makeLinkObj($title);
     $description_items = array();
     $protType = wfMsgHtml('restriction-level-' . $row->pr_level);
     $description_items[] = $protType;
     if ($row->pr_cascade) {
         $description_items[] = wfMsg('protect-summary-cascade');
     }
     $expiry_description = '';
     $stxt = '';
     if ($row->pr_expiry != 'infinity' && strlen($row->pr_expiry)) {
         $expiry = Block::decodeExpiry($row->pr_expiry);
         $expiry_description = wfMsgForContent('protect-expiring', $wgLang->timeanddate($expiry));
         $description_items[] = $expiry_description;
     }
     if (!is_null($size = $row->page_len)) {
         if ($size == 0) {
             $stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>';
         } else {
             $stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum($size)) . '</small>';
         }
         $stxt = $wgContLang->getDirMark() . $stxt;
     }
     wfProfileOut(__METHOD__);
     return '<li>' . wfSpecialList($link . $stxt, implode($description_items, ', ')) . "</li>\n";
 }
 function formatResult($skin, $result)
 {
     $title = Title::makeTitle(NS_TEMPLATE, $result->title);
     $pageLink = $skin->makeKnownLinkObj($title, '', 'redirect=no');
     $wlhLink = $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Whatlinkshere'), wfMsgHtml('unusedtemplateswlh'), 'target=' . $title->getPrefixedUrl());
     return wfSpecialList($pageLink, $wlhLink);
 }
 /**
  * Make links to the page corresponding to the item
  *
  * @param $skin Skin to be used
  * @param $result Result row
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     $link = $skin->makeLinkObj($title);
     return wfSpecialList($link, '');
 }
 function formatResult($skin, $result)
 {
     $title = Title::makeTitle(NS_TEMPLATE, $result->title);
     $pageLink = $skin->linkKnown($title, null, array(), array('redirect' => 'no'));
     $wlhLink = $skin->linkKnown(SpecialPage::getTitleFor('Whatlinkshere'), wfMsgHtml('unusedtemplateswlh'), array(), array('target' => $title->getPrefixedText()));
     return wfSpecialList($pageLink, $wlhLink);
 }
示例#5
0
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitle(NS_CATEGORY, $result->title);
     $plink = $skin->makeLinkObj($title, $title->getText());
     $nlinks = wfMsgExt('nmembers', array('parsemag', 'escape'), $wgLang->formatNum($result->count));
     return wfSpecialList($plink, $nlinks);
 }
示例#6
0
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $d = $wgLang->timeanddate(wfTimestamp(TS_MW, $result->value), true);
     $title = Title::makeTitle($result->namespace, $result->title);
     $link = $skin->linkKnown($title, htmlspecialchars($wgContLang->convert($title->getPrefixedText())));
     return wfSpecialList($link, htmlspecialchars($d));
 }
示例#7
0
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getText());
     $plink = $this->isCached() ? $skin->makeLinkObj($nt, htmlspecialchars($text)) : $skin->makeBrokenLinkObj($nt, htmlspecialchars($text));
     return wfSpecialList($plink, $this->makeWlhLink($nt, $skin, $result));
 }
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $title = Title::makeTitle($result->namespace, $result->title);
     $link = $skin->makeKnownLinkObj($title, htmlspecialchars($wgContLang->convert($title->getPrefixedText())));
     $nv = wfMsgExt('nviews', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     return wfSpecialList($link, $nv);
 }
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     $count = wfMsgExt('ncategories', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     $link = $skin->link($title);
     return wfSpecialList($link, $count);
 }
示例#10
0
 /**
  * Make links to the page corresponding to the item, and the "what links here" page for it
  *
  * @param $skin Skin to be used
  * @param $result Result row
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     $link = $skin->makeLinkObj($title);
     $wlh = $this->makeWlhLink($title, wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value)), $skin);
     return wfSpecialList($link, $wlh);
 }
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = $skin->makeKnownLinkObj($nt, htmlspecialchars($text));
     $wlink = $skin->makeKnownLinkObj($nt, wfMsgHtml('watch'), 'action=watch');
     return wfSpecialList($plink, $wlink);
 }
 /**
  * @param $skin Skin
  * @param  $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $nt = Title::makeTitle(NS_CATEGORY, $result->title);
     $text = $wgContLang->convert($nt->getText());
     $plink = $skin->link($nt, htmlspecialchars($text));
     $nlinks = wfMsgExt('nmembers', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     return wfSpecialList($plink, $nlinks);
 }
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getText());
     $plink = $this->isCached() ? $skin->makeLinkObj($nt, htmlspecialchars($text)) : $skin->makeBrokenLinkObj($nt, htmlspecialchars($text));
     $nlinks = wfMsgExt('nmembers', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     return wfSpecialList($plink, $nlinks);
 }
 function formatResult($skin, $result)
 {
     global $wgContLang, $wgLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = $skin->makeKnownLink($nt->getPrefixedText(), $text);
     $nl = wfMsgExt('ncategories', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     $nlink = $skin->makeKnownLink($wgContLang->specialPage('Categories'), $nl, 'article=' . $nt->getPrefixedURL());
     return wfSpecialList($plink, $nlink);
 }
 /**
  * @param $skin Skin
  * @param $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = Title::makeTitle($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = Linker::linkKnown($nt, htmlspecialchars($text));
     $token = WatchAction::getWatchToken($nt, $this->getUser());
     $wlink = Linker::linkKnown($nt, wfMsgHtml('watch'), array(), array('action' => 'watch', 'token' => $token));
     return wfSpecialList($plink, $wlink);
 }
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $nt = Title::makeTitleSafe($result->namespace, $result->title);
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = $skin->makeKnownLinkObj($nt, $text);
     $nl = wfMsgExt('nrevisions', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     $nlink = $skin->makeKnownLinkObj($nt, $nl, 'action=history');
     return wfSpecialList($plink, $nlink);
 }
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     if (!$title instanceof Title) {
         throw new MWException('Invalid title in database');
     }
     $count = wfMsgExt('ncategories', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     $link = $skin->makeKnownLinkObj($title, $title->getText());
     return wfSpecialList($link, $count);
 }
 /**
  * @param $skin Skin object
  * @param $result Object: database row
  */
 function formatResult($skin, $result)
 {
     global $wgLang, $wgContLang;
     $nt = Title::makeTitleSafe($result->namespace, $result->title);
     if (!$nt) {
         return '<!-- bad title -->';
     }
     $text = $wgContLang->convert($nt->getPrefixedText());
     $plink = $skin->linkKnown($nt, $text);
     $nl = wfMsgExt('nrevisions', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     $redirect = $result->redirect ? ' - ' . wfMsgHtml('isredirect') : '';
     $nlink = $skin->linkKnown($nt, $nl, array(), array('action' => 'history')) . $redirect;
     return wfSpecialList($plink, $nlink);
 }
 function formatResult($skin, $result)
 {
     if (empty($this->show)) {
         $this->data[$result->title] = $result->value;
         return false;
     } else {
         $title = Title::makeTitle(NS_CATEGORY, $result->title);
         if ($title instanceof Title) {
             $titleText = $skin->makeLinkObj($title, htmlspecialchars($title->getText()));
             return wfSpecialList($titleText, $result->value);
         } else {
             return false;
         }
     }
 }
 /**
  * Format an individual result
  *
  * @param Skin $skin Skin to use for UI elements
  * @param object $result Result row
  * @return string
  */
 public function formatResult($skin, $result)
 {
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     if ($title instanceof Title) {
         if ($this->isCached()) {
             $pageLink = $title->exists() ? '<s>' . $skin->makeLinkObj($title) . '</s>' : $skin->makeBrokenLinkObj($title);
         } else {
             $pageLink = $skin->makeBrokenLinkObj($title);
         }
         return wfSpecialList($pageLink, $this->makeWlhLink($title, $skin, $result));
     } else {
         $tsafe = htmlspecialchars($result->title);
         return "Invalid title in result set; {$tsafe}";
     }
 }
 function formatRow($row)
 {
     $userPage = Title::makeTitle(NS_USER, $row->user_name);
     $name = $this->getSkin()->makeLinkObj($userPage, htmlspecialchars($userPage->getText()));
     if ($row->numgroups > 1 || $this->requestedGroup && $row->numgroups == 1) {
         $list = array();
         foreach (self::getGroups($row->user_id) as $group) {
             $list[] = self::buildGroupLink($group);
         }
         $groups = implode(', ', $list);
     } elseif ($row->numgroups == 1) {
         $groups = self::buildGroupLink($row->singlegroup);
     } else {
         $groups = '';
     }
     return '<li>' . wfSpecialList($name, $groups) . '</li>';
 }
示例#22
0
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     if ($this->isCached()) {
         # Check existence; which is stored in the link cache
         if (!$title->exists()) {
             # Make a redlink
             $pageLink = $skin->makeBrokenLinkObj($title);
         } else {
             # Make a a struck-out normal link
             $pageLink = "<s>" . $skin->makeLinkObj($title) . "</s>";
         }
     } else {
         # Not cached? Don't bother checking existence; it can't
         $pageLink = $skin->makeBrokenLinkObj($title);
     }
     # Make a link to "what links here" if it's required
     $wlhLink = $this->nlinks ? $this->makeWlhLink($title, $skin, wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value))) : null;
     return wfSpecialList($pageLink, $wlhLink);
 }
 /**
  * Callback function to output a restriction
  */
 function formatRow($row)
 {
     global $wgUser, $wgLang;
     wfProfileIn(__METHOD__);
     static $skin = null;
     if (is_null($skin)) {
         $skin = $wgUser->getSkin();
     }
     $title = Title::makeTitleSafe($row->pt_namespace, $row->pt_title);
     $link = $skin->link($title);
     $description_items = array();
     $protType = wfMsgHtml('restriction-level-' . $row->pt_create_perm);
     $description_items[] = $protType;
     $stxt = '';
     if ($row->pt_expiry != 'infinity' && strlen($row->pt_expiry)) {
         $expiry = Block::decodeExpiry($row->pt_expiry);
         $expiry_description = wfMsg('protect-expiring', $wgLang->timeanddate($expiry), $wgLang->date($expiry), $wgLang->time($expiry));
         $description_items[] = $expiry_description;
     }
     wfProfileOut(__METHOD__);
     return '<li>' . wfSpecialList($link . $stxt, implode($description_items, ', ')) . "</li>\n";
 }
示例#24
0
 /**
  * Callback function to output a restriction
  * @param $row object Protected title
  * @return string Formatted <li> element
  */
 public function formatRow($row)
 {
     global $wgUser, $wgLang, $wgContLang;
     wfProfileIn(__METHOD__);
     static $skin = null;
     if (is_null($skin)) {
         $skin = $wgUser->getSkin();
     }
     $title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
     $link = $skin->makeLinkObj($title);
     $description_items = array();
     $protType = wfMsgHtml('restriction-level-' . $row->pr_level);
     $description_items[] = $protType;
     if ($row->pr_cascade) {
         $description_items[] = wfMsg('protect-summary-cascade');
     }
     $expiry_description = '';
     $stxt = '';
     if ($row->pr_expiry != 'infinity' && strlen($row->pr_expiry)) {
         $expiry = Block::decodeExpiry($row->pr_expiry);
         $expiry_description = wfMsg('protect-expiring', $wgLang->timeanddate($expiry), $wgLang->date($expiry), $wgLang->time($expiry));
         $description_items[] = $expiry_description;
     }
     if (!is_null($size = $row->page_len)) {
         $stxt = $wgContLang->getDirMark() . ' ' . $skin->formatRevisionSize($size);
     }
     # Show a link to the change protection form for allowed users otherwise a link to the protection log
     if ($wgUser->isAllowed('protect')) {
         $changeProtection = ' (' . $skin->makeKnownLinkObj($title, wfMsgHtml('protect_change'), 'action=unprotect') . ')';
     } else {
         $ltitle = SpecialPage::getTitleFor('Log');
         $changeProtection = ' (' . $skin->makeKnownLinkObj($ltitle, wfMsgHtml('protectlogpage'), 'type=protect&page=' . $title->getPrefixedUrl()) . ')';
     }
     wfProfileOut(__METHOD__);
     return '<li>' . wfSpecialList($link . $stxt, implode($description_items, ', ')) . $changeProtection . "</li>\n";
 }
示例#25
0
 /**
  * Format an individual result
  *
  * @param $skin Skin to use for UI elements
  * @param $result Result row
  * @return string
  */
 public function formatResult($skin, $result)
 {
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     if ($title instanceof Title) {
         if ($this->isCached() || $this->forceExistenceCheck()) {
             $pageLink = $title->isKnown() ? '<del>' . $skin->link($title) . '</del>' : $skin->link($title, null, array(), array(), array('broken'));
         } else {
             $pageLink = $skin->link($title, null, array(), array(), array('broken'));
         }
         return wfSpecialList($pageLink, $this->makeWlhLink($title, $skin, $result));
     } else {
         $tsafe = htmlspecialchars($result->title);
         return wfMsgHtml('wantedpages-badtitle', $tsafe);
     }
 }
示例#26
0
 function formatRow($row)
 {
     global $wgLang;
     $userName = $row->user_name;
     $ulinks = $this->getSkin()->userLink($row->user_id, $userName);
     $ulinks .= $this->getSkin()->userToolLinks($row->user_id, $userName);
     $list = array();
     foreach (self::getGroups($row->user_id) as $group) {
         if (isset($this->groups[$group])) {
             return;
         }
         $list[] = self::buildGroupLink($group);
     }
     $groups = $wgLang->commaList($list);
     $item = wfSpecialList($ulinks, $groups);
     $count = wfMsgExt('activeusers-count', array('parsemag'), $wgLang->formatNum($row->recentedits), $userName, $wgLang->formatNum($this->RCMaxAge));
     $blocked = $row->blocked ? ' ' . wfMsgExt('listusers-blocked', array('parsemag'), $userName) : '';
     return Html::rawElement('li', array(), "{$item} [{$count}]{$blocked}");
 }
示例#27
0
 /**
  * Make links to the page corresponding to the item, and the "what links here" page for it
  *
  * @param $skin Skin to be used
  * @param $result Result row
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgLang;
     $title = Title::makeTitleSafe($result->namespace, $result->title);
     if (!$title) {
         return '<!-- ' . htmlspecialchars("Invalid title: [[{$title}]]") . ' -->';
     }
     $link = $skin->link($title);
     $wlh = $this->makeWlhLink($title, wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value)), $skin);
     return wfSpecialList($link, $wlh);
 }
示例#28
0
 function formatResult($skin, $result)
 {
     $userPage = Title::makeTitle($result->namespace, $result->title);
     $name = $skin->makeLinkObj($userPage, htmlspecialchars($userPage->getText()));
     $groups = null;
     if (!isset($result->numgroups) || $result->numgroups > 0) {
         $dbr =& wfGetDB(DB_SLAVE);
         $result = $dbr->select('user_groups', array('ug_group'), array('ug_user' => $result->user_id), 'ListUsersPage::formatResult');
         $groups = array();
         while ($row = $dbr->fetchObject($result)) {
             $groups[$row->ug_group] = User::getGroupMember($row->ug_group);
         }
         $dbr->freeResult($result);
         if (count($groups) > 0) {
             foreach ($groups as $group => $desc) {
                 if ($page = User::getGroupPage($group)) {
                     $list[] = $skin->makeLinkObj($page, htmlspecialchars($desc));
                 } else {
                     $list[] = htmlspecialchars($desc);
                 }
             }
             $groups = implode(', ', $list);
         } else {
             $groups = '';
         }
     }
     return wfSpecialList($name, $groups);
 }
 function formatResult($skin, $result)
 {
     $res = false;
     if (empty($this->show)) {
         $this->data[$result->title] = array('value' => $result->value, 'namespace' => $result->namespace);
     } else {
         $title = Title::newFromText($result->title, $result->namespace);
         if ($title) {
             $result->title = Xml::element("a", array("href" => $title->getLocalURL()), $title->getFullText());
         }
         $res = wfSpecialList($result->title, $result->value);
     }
     return $res;
 }
 public function outputResults($skin, $data)
 {
     global $wgContLang, $wgLang, $wgOut;
     wfProfileIn(__METHOD__);
     $num = 0;
     $html = array();
     if ($this->mShow) {
         $wgOut->addHTML(XML::openElement('div', array('class' => 'mw-spcontent')));
     }
     if (isset($data) && $data['numrec'] > 0) {
         $num = $data['numrec'];
         if ($this->mShow) {
             $html[] = XML::openElement('ol', array('start' => $this->offset + 1, 'class' => 'special'));
         }
         if ($data['numrec'] <= self::ORDER_ROWS) {
             arsort($data['order']);
         }
         $loop = 0;
         $skip = 0;
         foreach ($data['order'] as $city_id => $ordered) {
             # check loop
             if ($loop >= $this->offset && $loop < $this->limit + $this->offset) {
                 list($page_id, $page_url, $page_server) = $data['rows'][$city_id];
                 # page url
                 if (empty($page_url) || empty($page_server)) {
                     $oGTitle = GlobalTitle::newFromText($this->mPageTitle, $this->mPageNS, $city_id);
                     if (is_object($oGTitle)) {
                         $page_url = $oGTitle->getFullURL();
                         $page_server = $oGTitle->getServer();
                     }
                     if (empty($page_url) || empty($page_server)) {
                         $skip++;
                         continue;
                     }
                 }
                 # check Wiki
                 if (!empty($city_id)) {
                     $oWikia = WikiFactory::getWikiByID($city_id);
                     if (empty($oWikia) || empty($oWikia->city_public)) {
                         continue;
                     }
                 }
                 if (empty($this->mShow)) {
                     $res = "";
                     $this->data[$city_id] = array('city_id' => $city_id, 'page_id' => $page_id, 'url' => $page_url);
                 } else {
                     $res = wfSpecialList(Xml::openElement('a', array('href' => $page_url)) . $page_url . Xml::closeElement('a'), "");
                 }
                 $html[] = $this->mShow ? Xml::openElement('li') . $res . Xml::closeElement('li') : "";
             }
             $loop++;
         }
         $num = $num - $skip;
         if ($this->mShow) {
             $html[] = XML::closeElement('ol');
         }
     }
     # Top header and navigation
     if ($this->mShow) {
         $wgOut->addHTML('<p>' . wfMsgExt('multiwikirecords', array(), $num) . '</p>');
         if ($num > 0) {
             $wgOut->addHTML('<p>' . wfShowingResults($this->offset, $num) . '</p>');
             # Disable the "next" link when we reach the end
             $paging = $wgLang->viewPrevNext(SpecialPage::getTitleFor($this->mName), $this->offset, $this->limit, $this->linkParameters(), $num < $this->limit);
             $wgOut->addHTML('<p>' . $paging . '</p>');
         } else {
             $wgOut->addHTML(XML::closeElement('div'));
             return;
         }
     }
     $html = $this->mShow ? implode('', $html) : $wgContLang->listToText($html);
     $wgOut->addHTML($html);
     # Repeat the paging links at the bottom
     if ($this->mShow) {
         $wgOut->addHTML('<p>' . $paging . '</p>');
     }
     $wgOut->addHTML(XML::closeElement('div'));
     wfProfileOut(__METHOD__);
     return $num;
 }