/**
  * This method actually generates the output
  * @param mixed $params Comes from base class definition. Not used in this implementation.
  * @return string HTML output
  */
 public function execute($params = false)
 {
     $this->initFields();
     wfRunHooks('BsAuthorPageProfileImageAfterInitFields', array(&$this, $this->oUser));
     // CR RBV (03.06.11 08:39): Hook/Event!
     if (BsExtensionManager::isContextActive('MW::SecureFileStore::Active')) {
         $this->sImagePath = SecureFileStore::secureStuff($this->sImagePath, true);
     }
     $aOut = array();
     $aOut[] = '<div id="bs-authors-imageform" class="bs-userpagesettings-item">';
     $aOut[] = $this->renderLink(array('href' => htmlspecialchars($this->sImageUploadPath), 'title' => wfMessage('bs-authors-profileimage-change')->plain()), '<img src="' . $this->sImagePath . '" alt="' . $this->sUserDisplayName . '" width="64" title="' . wfMessage('bs-authors-profileimage')->plain() . '" />' . '<div class="bs-user-label">' . wfMessage('bs-authors-profileimage-change')->plain() . '</div>');
     $aOut[] = '</div>';
     return implode("\n", $aOut);
 }
 public function buildRssNs($aParams)
 {
     global $wgRequest, $wgSitename, $wgLang, $wgDBprefix;
     $dbr = wfGetDB(DB_SLAVE);
     $_showLimit = 10;
     if (isset($aParams['ns'])) {
         $ns = $aParams['ns'] + 0;
     } else {
         $ns = $wgRequest->getInt('ns', 0);
     }
     $aNamespaces = $wgLang->getNamespaces();
     $channel = RSSCreator::createChannel($wgSitename . ' - ' . wfMessage('bs-ns')->plain() . ' ' . $aNamespaces[$ns], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'], wfMessage('bs-rssstandards-desc-ns')->plain());
     $res = $dbr->query("select page_id from " . $wgDBprefix . "page where page_namespace = " . $ns);
     $entryIds = array();
     while ($row = $dbr->fetchRow($res)) {
         $entryIds[] = $row['page_id'];
     }
     if (count($entryIds)) {
         $query = "SELECT Min(r.rev_id) as rid, r.rev_page, r.rev_timestamp, r.rev_user_text FROM " . $wgDBprefix . "revision as r WHERE r.rev_page In (" . join(",", $entryIds) . ") GROUP BY r.rev_page, r.rev_timestamp, r.rev_user_text ORDER BY rid DESC";
         $res = $dbr->query($query);
         $numberOfEntries = $dbr->numRows($res);
         $query .= ' LIMIT ' . $_showLimit;
         $res = $dbr->query($query);
         while ($row = $dbr->fetchRow($res)) {
             $title = Title::newFromID($row['rev_page']);
             $article = new Article($title);
             if (!$title->userCan('read')) {
                 $numberOfEntries--;
                 continue;
             }
             $_title = str_replace("_", " ", $title->getText());
             $_link = $title->getFullURL();
             $_tmpText = preg_replace("#\\[<a\\ href\\=\"(.*)action\\=edit(.*)\"\\ title\\=\"(.*)\">(.*)<\\/a>\\]#", "", $this->mCore->parseWikiText($article->getContent(), $this->getTitle()));
             if (class_exists('SecureFileStore')) {
                 $_description = SecureFileStore::secureFilesInText($_tmpText);
             } else {
                 $_description = $_tmpText;
             }
             unset($_tmpText);
             $item = RSSItemCreator::createItem($_title, $_link, $_description);
             if ($item) {
                 $item->setPubDate(wfTimestamp(TS_UNIX, $row['rev_timestamp']));
                 $item->setComments($title->getTalkPage()->getFullURL());
                 $item->setGUID($title->getFullURL("oldid=" . $article->getRevIdFetched()), 'true');
                 $channel->addItem($item);
             }
         }
     }
     $dbr->freeResult($res);
     return $channel->buildOutput();
 }
 /**
  * Get the Users for specialpage, called via ajax
  * @param string $sPage page title
  * @return bool Always true
  */
 public static function getUsers($sPage)
 {
     $oTitle = Title::newFromText($sPage);
     if (!$oTitle->exists()) {
         return json_encode(array());
     }
     $iArticleID = $oTitle->getArticleID();
     $oStoreParams = BsExtJSStoreParams::newFromRequest();
     $iLimit = $oStoreParams->getLimit();
     $iStart = $oStoreParams->getStart();
     $sSort = $oStoreParams->getSort('MAX(readers_ts)');
     $sDirection = $oStoreParams->getDirection();
     if ($sSort == 'user_name') {
         $sSort = 'readers_user_name';
     } elseif ($sSort == 'user_ts') {
         $sSort = 'readers_ts';
     } elseif ($sSort == 'user_readers') {
         $sSort = 'readers_user_name';
     }
     $oDbr = wfGetDB(DB_SLAVE);
     $res = $oDbr->select(array('bs_readers'), array('readers_user_id', 'MAX(readers_ts) as readers_ts'), array('readers_page_id' => $iArticleID), __METHOD__, array('GROUP BY' => 'readers_user_id', 'ORDER BY' => $sSort . ' ' . $sDirection, 'LIMIT' => $iLimit, 'OFFSET' => $iStart));
     $aUsers = array();
     if ($oDbr->numRows($res) > 0) {
         $aParams = array();
         $oLanguage = RequestContext::getMain()->getLanguage();
         foreach ($res as $row) {
             $oUser = User::newFromId((int) $row->readers_user_id);
             $oTitle = Title::makeTitle(NS_USER, $oUser->getName());
             $oUserMiniProfile = BsCore::getInstance()->getUserMiniProfile($oUser, $aParams);
             $sImage = $oUserMiniProfile->getUserImageSrc();
             if (BsExtensionManager::isContextActive('MW::SecureFileStore::Active')) {
                 $sImage = SecureFileStore::secureStuff($sImage, true);
             }
             $aTmpUser = array();
             $aTmpUser['user_image'] = $sImage;
             $aTmpUser['user_name'] = $oUser->getName();
             $aTmpUser['user_page'] = $oTitle->getLocalURL();
             $aTmpUser['user_readers'] = SpecialPage::getTitleFor('Readers', $oTitle->getPrefixedText())->getLocalURL();
             $aTmpUser['user_ts'] = $row->readers_ts;
             $aTmpUser['user_date'] = $oLanguage->timeanddate($row->readers_ts);
             $aUsers['users'][] = $aTmpUser;
         }
     }
     $rowCount = $oDbr->select('bs_readers', 'readers_user_id', array('readers_page_id' => $iArticleID), __METHOD__, array('GROUP BY' => 'readers_user_id'));
     $aUsers['totalCount'] = $oDbr->numRows($rowCount);
     return json_encode($aUsers);
 }
 public function onSiteNoticeAfter(&$siteNotice)
 {
     $siteNotice = SecureFileStore::secureFilesInText($siteNotice);
     return true;
 }