function execute($par)
 {
     global $wgRequest, $wgOut;
     global $wgAdsInterstitialsEnabled;
     global $wgUser;
     $url = trim($wgRequest->getVal('u'));
     $noAutoRedirect = $wgRequest->getText('noredirect') == 1 ? true : false;
     if ($wgAdsInterstitialsEnabled && !$wgUser->isLoggedIn()) {
         $COOKIE_KEY = "IntPgCounter";
         $pageCounter = isset($_COOKIE[$COOKIE_KEY]) ? $_COOKIE[$COOKIE_KEY] : 0;
         // By incrementing the count even for interstitials, we can know when to avoid repeated interstitials for tabbed-browsing.
         // In the calculations for when to display the interstitial, however, this is not considered a "page" (we add 1 to wgAdsInterstitialsPagesBetweenAds to accomplish this).
         global $wgCookiePath, $wgCookieDomain;
         setcookie($COOKIE_KEY, $pageCounter + 1, 0, $wgCookiePath, $wgCookieDomain);
         // If the user shouldn't be seeing an interstitial on this pv, then assume that we are only here because of the user opening many tabs and just redirect to destination right away.
         global $wgAdsInterstitialsPagesBeforeFirstAd;
         global $wgAdsInterstitialsPagesBetweenAds;
         $numToSkip = 2;
         // skip the interstitial and the page it was blocking as candidates
         if ($url != "" && !($wgAdsInterstitialsPagesBeforeFirstAd == $pageCounter - 1 || $pageCounter > $wgAdsInterstitialsPagesBeforeFirstAd && ($pageCounter - $wgAdsInterstitialsPagesBeforeFirstAd - 1) % ($wgAdsInterstitialsPagesBetweenAds + $numToSkip) == 0)) {
             return $this->redirectTo($url);
         }
         $redirectDelay = empty($wgAdsInterstitialsDurationInSeconds) ? INTERSTITIAL_DEFAULT_DURATION_IN_SECONDS : $wgAdsInterstitialsDurationInSeconds;
         // Set up the CSS
         $wgOut->setArticleBodyOnly(true);
         $skin = RequestContext::getMain()->getSkin();
         $skinName = get_class($skin);
         // this may not be set yet (and needs to be before setupUserCss in order for the right CSS file to be included)
         if ($skin->getSkinName() == '') {
             $skin->skinname = substr($skinName, 4);
         }
         if ($skinName == 'SkinMonaco') {
             $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
             $adSlots = array('INVISIBLE' => ' ', 'BOXAD_1' => AdEngine::getInstance()->getAd('SPECIAL_INTERSTITIAL_BOXAD_1'), 'BOXAD_2' => ' ');
             $oTmpl->set_vars(array('adSlots' => $adSlots));
             $adTemplate = 'adLayoutClassic';
             $athenaInitStuff = AdProviderAthena::getInstance()->getSetupHtml();
             $adCode = $oTmpl->render($adTemplate);
             $oTmpl->set_vars(array('adCode' => $adCode, 'athenaInitStuff' => $athenaInitStuff, 'pageType' => 'interstitial', 'redirectDelay' => $noAutoRedirect ? 0 : $this->redirectDelay, 'skip' => wfMsg('interstitial-skip-ad'), 'url' => $url));
             $wgOut->clearHTML();
             $wgOut->addHTML($oTmpl->render('page'));
         } else {
             return $this->redirectTo($url);
         }
     } else {
         if ($url == "") {
             // Nowhere to go.  Display an appropriate explanation (either wgAdsInterstitialsEnabled is false or the user is logged in).
             if ($wgUser->isLoggedIn()) {
                 $wgOut->addWikiText(wfMsg('interstitial-already-logged-in-no-link') . wfMsg('interstitial-link-away'));
             } else {
                 $wgOut->addWikiText(wfMsg('interstitial-disabled-no-link') . wfMsg('interstitial-link-away'));
             }
         } else {
             // Since interstitials aren't enabled or the user is logged in, just redirect to the destination URL immediately.
             return $this->redirectTo($url);
         }
     }
 }
 function execute()
 {
     global $wgOut, $wgUser, $wgRequest, $wgExtensionsPath, $wgOutboundScreenConfig, $wgCityId, $wgEnableOutboundScreenExt;
     $url = $wgRequest->getText('u');
     $noAutoRedirect = $wgRequest->getText('noredirect') == 1 ? true : false;
     $loggedIn = $wgUser->isLoggedIn();
     if (trim($url) == "") {
         // Nowhere to go.  Display an appropriate explanation (nowhere to go).
         $wgOut->addWikiText(wfMsg('outbound-screen-already-logged-in-no-link'));
     } else {
         if ($wgOutboundScreenConfig['anonsOnly'] == true && $loggedIn || empty($wgEnableOutboundScreenExt)) {
             $wgOut->redirect(htmlspecialchars_decode($url));
             return true;
         } else {
             // output only template content
             $wgOut->setArticleBodyOnly(true);
             // render template
             $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
             // Need to have the skinname correct before calling Athena.
             $skin = RequestContext::getMain()->getSkin();
             $skinName = get_class($skin);
             // this may not be set yet (and needs to be before setupUserCss in order for the right CSS$
             if ($skin->getSkinName() == '') {
                 $skin->skinname = strtolower(substr($skinName, 4));
             }
             $adSlots = array('INVISIBLE' => AdEngine::getInstance()->getAd('EXIT_STITIAL_INVISIBLE', array('ghostwriter' => true)), 'BOXAD_1' => AdEngine::getInstance()->getAd('EXIT_STITIAL_BOXAD_1', array('ghostwriter' => true)), 'BOXAD_2' => AdEngine::getInstance()->getAd('EXIT_STITIAL_BOXAD_2', array('ghostwriter' => true)));
             $oTmpl->set_vars(array('adSlots' => $adSlots));
             switch ($this->adLayoutMode) {
                 case 'V1':
                     $adTemplate = 'adLayoutV1';
                     break;
                 case 'V2':
                     $adTemplate = 'adLayoutV2';
                     break;
                 case 'V3':
                     $adTemplate = 'adLayoutV3';
                     break;
                 case 'V4':
                     $adTemplate = 'adLayoutV4';
                     break;
                 case 'V5':
                     $adTemplate = 'adLayoutV5';
                     break;
                 case 'CLASSIC':
                 default:
                     $adTemplate = 'adLayoutClassic';
             }
             $athenaInitStuff = AdProviderAthena::getInstance()->getSetupHtml();
             $adCode = $oTmpl->render($adTemplate);
             $loginMsg = wfMsgExt('outbound-screen-login-text', array('parseinline', 'content'));
             $pageBarMsg = wfMsg('outbound-screen-you-are-leaving');
             $oTmpl->set_vars(array('adCode' => $adCode, 'athenaInitStuff' => $athenaInitStuff, 'loginMsg' => $loginMsg, 'pageBarMsg' => $pageBarMsg, 'pageType' => 'exitPage', 'redirectDelay' => $noAutoRedirect ? 0 : $this->redirectDelay, 'skip' => wfMsg('interstitial-skip-ad'), 'url' => htmlspecialchars_decode($url)));
             // just output content of template
             $wgOut->clearHTML();
             $wgOut->addHTML($oTmpl->render('page'));
         }
     }
 }
Пример #3
0
 /**
  * Chat tag parser implementation
  */
 public static function parseTag($input, $args, $parser)
 {
     wfProfileIn(__METHOD__);
     $template = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $template->set('linkToSpecialChat', SpecialPage::getTitleFor("Chat")->escapeLocalUrl());
     if (F::app()->checkSkin('oasis')) {
         $html = $template->render('entryPointTag');
     } else {
         $html = $template->render('entryPointTagMonobook');
     }
     wfProfileOut(__METHOD__);
     return $html;
 }
Пример #4
0
 /**
  * Chat tag parser implementation
  */
 public static function parseTag($input, $args, $parser)
 {
     wfProfileIn(__METHOD__);
     $template = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $template->set_vars(self::getEntryPointTemplateVars(true));
     if (F::app()->checkSkin('oasis')) {
         $html = $template->render('entryPointTag');
     } else {
         $html = $template->render('entryPointTagMonobook');
     }
     // remove newlines so parser does not try to wrap lines into paragraphs
     $html = str_replace("\n", "", $html);
     wfProfileOut(__METHOD__);
     return '<nowiki>' . $html . '</nowiki>';
 }
 function execute($par)
 {
     global $wgOut, $wgCityId, $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgShowMyToolsOnly, $wgExtensionsPath, $wgBlankImgUrl, $wgJsMimeType, $wgTitle, $wgUser, $wgRequest;
     wfProfileIn(__METHOD__);
     // redirect to www.wikia.com
     if ($wgCityId == 177) {
         $destServer = WikiFactory::getVarValueByName('wgServer', $this->destCityId);
         $destArticlePath = WikiFactory::getVarValueByName('wgArticlePath', $this->destCityId);
         $wgOut->redirect($destServer . str_replace('$1', 'Special:LandingPage', $destArticlePath));
         return;
     }
     $this->setHeaders();
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LandingPage/css/LandingPage.scss'));
     // hide wiki and page header
     $wgSuppressWikiHeader = true;
     $wgSuppressPageHeader = true;
     // only shown "My Tools" on floating toolbar
     $wgShowMyToolsOnly = true;
     // parse language links (RT #71622)
     $languageLinks = array();
     $parsedMsg = wfStringToArray(wfMsg('landingpage-language-links'), '*', 10);
     foreach ($parsedMsg as $item) {
         if ($item != '') {
             list($text, $lang) = explode('|', $item);
             $languageLinks[] = array('text' => $text, 'href' => $wgTitle->getLocalUrl("uselang={$lang}"));
         }
     }
     // fetching the landingpage sites
     $landingPageLinks = CorporatePageHelper::parseMsgImg('landingpage-sites', false, false);
     // render HTML
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('imagesPath' => $wgExtensionsPath . '/wikia/LandingPage/images/', 'languageLinks' => $languageLinks, 'wgBlankImgUrl' => $wgBlankImgUrl, 'wgTitle' => $wgTitle, 'landingPageLinks' => $landingPageLinks, 'landingPageSearch' => F::app()->getView("SearchController", "Index", array("placeholder" => "Search Wikia", "fulltext" => "0", "wgBlankImgUrl" => $wgBlankImgUrl, "wgTitle" => $wgTitle))));
     $wgOut->addHTML($template->render('main'));
     wfProfileOut(__METHOD__);
 }
 public function getHTML()
 {
     wfProfileIn(__METHOD__);
     if ($this->isVisible()) {
         $ownerName = $this->ownerUser->getName();
         $tmplData = array();
         $tmplData['ownerBadges'] = $this->getBadgesAnnotated();
         $tmplData['challengesBadges'] = $this->getChallengesAnnotated();
         $tmplData['title_no'] = wfMsg('achievements-profile-title-no', $ownerName);
         $tmplData['title'] = wfMsgExt('achievements-profile-title', array('parsemag'), $ownerName, $this->owner->getBadgesCount());
         $tmplData['title_challenges'] = wfMsg('achievements-profile-title-challenges', $ownerName);
         $tmplData['leaderboard_url'] = Skin::makeSpecialUrl("Leaderboard");
         if ($this->owner->getBadgesCount() > 0) {
             $rankingService = new AchRankingService();
             $tmplData['user_rank'] = $rankingService->getUserRankingPosition($this->ownerUser);
         }
         if ($this->viewerUser->isAllowed('editinterface')) {
             $tmplData['customize_url'] = Skin::makeSpecialUrl("AchievementsCustomize");
         }
         $template = new EasyTemplate(dirname(__FILE__) . '/../templates');
         $template->set_vars($tmplData);
         $out = $template->render('ProfileBox');
     } else {
         $out = '';
     }
     wfProfileOut(__METHOD__);
     return $out;
 }
Пример #7
0
 public function getHTML()
 {
     wfProfileIn(__METHOD__);
     $this->report->loadSources();
     $aData = array();
     $aLabel = array();
     if (count($this->report->reportSources) == 0) {
         wfProfileOut(__METHOD__);
         return '';
     }
     foreach ($this->report->reportSources as $reportSource) {
         $reportSource->getData();
         $this->actualDate = $reportSource->actualDate;
         if (!empty($reportSource->dataAll) && !empty($reportSource->dataTitles)) {
             if (is_array($reportSource->dataAll)) {
                 foreach ($reportSource->dataAll as $key => $val) {
                     if (isset($aData[$key])) {
                         $aData[$key] = array_merge($aData[$key], $val);
                     } else {
                         $aData[$key] = $val;
                     }
                 }
             }
             $aLabel += $reportSource->dataTitles;
         }
     }
     sort($aData);
     $this->sourceData = array_reverse($aData);
     $this->sourceLabels = array_reverse($aLabel);
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array('data' => $this->sourceData, 'labels' => $this->sourceLabels));
     wfProfileOut(__METHOD__);
     $this->beforePrint();
     return $oTmpl->render('../../templates/output/' . self::TEMPLATE_MAIN);
 }
Пример #8
0
 function execute($par)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgExtensionsPath, $wgResourceBasePath, $wgJsMimeType, $wgUser;
     // set basic headers
     $this->setHeaders();
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         wfProfileOut(__METHOD__);
         return;
     }
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     // include resources (css and js)
     $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/AchievementsII/css/platinum.css\n");
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/AchievementsII/css/oasis.scss'));
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/AchievementsII/js/platinum.js\"></script>\n");
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgResourceBasePath}/resources/wikia/libraries/aim/jquery.aim.js\"></script>\n");
     // call service to get needed data
     $badges = AchPlatinumService::getList();
     // pass data to template
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('badges' => $badges));
     // render template
     $wgOut->addHTML($template->render('SpecialPlatinum'));
     wfProfileOut(__METHOD__);
 }
Пример #9
0
 function execute($par)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgRequest, $wgExtensionsPath, $wgStylePath;
     global $wgPhalanxSupportedLanguages, $wgUser, $wgTitle;
     // check restrictions
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $this->setHeaders();
     $wgOut->addStyle("{$wgExtensionsPath}/wikia/Phalanx/css/Phalanx.css");
     $wgOut->addScript("<script type='text/javascript' src='{$wgExtensionsPath}/wikia/Phalanx/js/Phalanx.js'></script>\n");
     $wgOut->addExtensionStyle("{$wgStylePath}/common/wikia_ui/tabs.css");
     $wgOut->setPageTitle(wfMsg('phalanx-title'));
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $pager = new PhalanxPager();
     $listing = $pager->getNavigationBar();
     $listing .= $pager->getBody();
     $listing .= $pager->getNavigationBar();
     $data = $this->prefillForm();
     $template->set_vars(array('expiries' => Phalanx::getExpireValues(), 'languages' => $wgPhalanxSupportedLanguages, 'listing' => $listing, 'data' => $data, 'action' => $wgTitle->getFullURL(), 'showEmail' => $wgUser->isAllowed('phalanxemailblock')));
     $wgOut->addHTML($template->render('phalanx'));
     wfProfileOut(__METHOD__);
 }
Пример #10
0
 /**
  * @access public
  * @author eloy@wikia
  *
  * @param $title mixed - Title object
  * @param $data array default null - unserialized arguments for task
  *
  * @return string HTML form for task
  */
 public function getForm($title, $data = null)
 {
     global $wgOut;
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/CloseWikiTask/");
     $oTmpl->set_vars(array("data" => $data, "type" => $this->mType, "title" => $title));
     return $oTmpl->render("form");
 }
Пример #11
0
 /**
  * Show the special page
  *
  * @param mixed $par Parameter passed to the page
  */
 public function execute($par)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgStatsDBEnabled, $wgJsMimeType;
     $this->setHeaders();
     $oAssetsManager = AssetsManager::getInstance();
     $sSrc = $oAssetsManager->getOneCommonURL('/extensions/wikia/UserRenameTool/js/NewUsernameUrlEncoder.js');
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$sSrc}\"></script>");
     if (wfReadOnly() || !$wgStatsDBEnabled) {
         $wgOut->readOnlyPage();
         wfProfileOut(__METHOD__);
         return;
     }
     if (!$wgUser->isAllowed('renameuser')) {
         wfProfileOut(__METHOD__);
         throw new PermissionsError('renameuser');
     }
     // Get the request data
     $oldusername = $wgRequest->getText('oldusername', $par);
     $newusername = $wgRequest->getText('newusername');
     $reason = $wgRequest->getText('reason');
     $token = $wgUser->getEditToken();
     $notifyRenamed = $wgRequest->getBool('notify_renamed', false);
     $confirmaction = false;
     if ($wgRequest->wasPosted() && $wgRequest->getInt('confirmaction')) {
         $confirmaction = true;
     }
     $warnings = array();
     $errors = array();
     $infos = array();
     if ($wgRequest->wasPosted() && $wgRequest->getText('token') !== '' && $wgUser->matchEditToken($wgRequest->getVal('token'))) {
         $process = new RenameUserProcess($oldusername, $newusername, $confirmaction, $reason);
         $status = $process->run();
         $warnings = $process->getWarnings();
         $errors = $process->getErrors();
         if ($status) {
             $infos[] = wfMessage('userrenametool-info-in-progress')->inContentLanguage()->text();
         }
     }
     $showConfirm = empty($errors) && empty($infos);
     // note: errors and infos beyond this point are non-blocking
     if (!empty($oldusername)) {
         $olduser = User::newFromName($oldusername);
         if ($olduser->getGlobalFlag('requested-rename', 0)) {
             $infos[] = wfMsg('userrenametool-requested-rename', $oldusername);
         } else {
             $errors[] = wfMsg('userrenametool-did-not-request-rename', $oldusername);
         }
         if ($olduser->getGlobalFlag('wasRenamed', 0)) {
             $errors[] = wfMsg('userrenametool-previously-renamed', $oldusername);
         }
     }
     $template = new EasyTemplate(dirname(__FILE__) . '/templates/');
     $template->set_vars(array("submitUrl" => $wgTitle->getLocalUrl(), "oldusername" => $oldusername, "oldusername_hsc" => htmlspecialchars($oldusername), "newusername" => $newusername, "newusername_hsc" => htmlspecialchars($newusername), "reason" => $reason, "move_allowed" => $wgUser->isAllowed('move'), "confirmaction" => $confirmaction, "warnings" => $warnings, "errors" => $errors, "infos" => $infos, "show_confirm" => $showConfirm, "token" => $token, "notify_renamed" => $notifyRenamed));
     $text = $template->render("rename-form");
     $wgOut->addHTML($text);
     wfProfileOut(__METHOD__);
     return;
 }
Пример #12
0
 function outHeader()
 {
     global $wgVersion;
     $this->outXmlHeader();
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("language" => $this->getLanguage(), "feedId" => $this->getFeedId(), "title" => $this->getTitle(), "selfUrl" => $this->getSelfUrl(), "url" => $this->getUrl(), "timeNow" => $this->formatTime(wfTimestampNow()), "description" => $this->getDescription(), "version" => $wgVersion));
     echo $oTmpl->render("atom-header");
 }
Пример #13
0
 public function execute($subpage)
 {
     global $wgOut, $wgUser, $wgRequest, $wgStylePath;
     global $wgExternalDatawareDB;
     wfProfileIn(__METHOD__);
     // Allow any logged in users to use this page (below, we make it so that non-staff can only see emails sent to themselves).
     if (!$wgUser || !$wgUser->isLoggedIn()) {
         $login = SpecialPage::getTitleFor('UserLogin');
         $wgOut->redirect($login->getFullURL('returnto=Special:MailerLog'));
         return false;
     }
     // Setup extra resources
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/SpecialMailerLog/css/oasis.scss'));
     // Keep track of the query parameters we need to add back to any URLs we write on this page
     $query = array();
     $filter_roster = array();
     // Create an array of filters based on was was passed to us
     $filter = self::getFilters($query, $filter_roster);
     // Set sorting and page length
     $sort = $wgRequest->getVal('new_sort', $wgRequest->getVal('sort', 'created'));
     $sort_dir = $wgRequest->getVal('new_sort_dir', $wgRequest->getVal('sort_dir', 'desc'));
     $limit = $wgRequest->getVal('new_limit', $wgRequest->getVal('limit', 100));
     $offset = $wgRequest->getVal('new_offset', $wgRequest->getVal('offset', '0'));
     // Add sorting terms
     if ($sort) {
         $query[] = "sort={$sort}";
     }
     if ($sort_dir) {
         $query[] = "sort_dir={$sort_dir}";
     }
     // Make 500 a hard upper limit
     $limit = $limit > 500 ? 500 : $limit;
     if ($limit) {
         $query[] = "limit={$limit}";
     }
     if ($offset) {
         $query[] = "offset={$offset}";
     }
     $num_rows = 0;
     $mail_records = array();
     if ($this->do_query()) {
         $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalDatawareDB);
         $num_rows = $dbr->selectField('wikia_mailer.mail', 'COUNT(*)', $filter, __METHOD__);
         $res = $dbr->select('wikia_mailer.mail', array('id', 'created', 'attempted', 'city_id', 'dst', 'hdr', 'subj', 'msg', 'transmitted', 'is_error', 'error_status', 'error_msg', 'opened'), $filter, __METHOD__, array('ORDER BY' => $sort . ' ' . $sort_dir, 'LIMIT' => $limit, 'OFFSET' => $offset));
         while ($row = $dbr->fetchObject($res)) {
             $body = self::getBody($row->msg);
             $mail_records[] = array('id' => $row->id, 'created' => $row->created, 'city_id' => $row->city_id, 'wiki_name' => Wikifactory::IdtoDB($row->city_id), 'to' => $row->dst, 'user_url' => self::getUserURL($row->dst), 'subject' => $row->subj, 'subj_short' => self::shortenStr($row->subj), 'msg_full' => $body, 'msg_short' => self::shortenStr($body), 'attempted' => $row->attempted, 'transmitted' => $row->transmitted, 'is_error' => $row->is_error, 'error_status' => $row->error_status, 'error_msg' => $row->error_msg, 'opened' => $row->opened);
         }
     }
     $titleObj = SpecialPage::getTitleFor("MailerLog");
     $scriptURL = $titleObj->getLocalURL();
     $query_string = join('&', $query);
     // Create a template object and give it all the data it needs
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array('wgUser' => $wgUser, 'wgStylePath' => $wgStylePath, 'records' => $mail_records, 'scriptURL' => $scriptURL, 'query_string' => $query_string, 'cur_limit' => $limit, 'num_rows' => $num_rows, 'cur_offset' => $offset, 'query' => $query, 'filter_roster' => $filter_roster));
     $wgOut->addHtml($oTmpl->render("wikia-mailer-log"));
     wfProfileOut(__METHOD__);
 }
Пример #14
0
 public static function getPlatinumForm($badge)
 {
     wfProfileIn(__METHOD__);
     $template = new EasyTemplate(dirname(__FILE__) . '/../templates');
     $template->set_vars($badge);
     $out = $template->render('PlatinumForm');
     wfProfileOut(__METHOD__);
     return $out;
 }
Пример #15
0
 function getFormHTML()
 {
     global $wgTitle;
     $categoryExhibitionSection = new CategoryExhibitionSection($wgTitle);
     $categoryExhibitionSection->setSortTypeFromParam();
     $categoryExhibitionSection->setDisplayTypeFromParam();
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array('path' => $wgTitle->getFullURL(), 'current' => $categoryExhibitionSection->getSortType(), 'sortTypes' => $categoryExhibitionSection->getSortTypes(), 'displayType' => $categoryExhibitionSection->getDisplayType()));
     return $oTmpl->render("form");
 }
Пример #16
0
 protected function getPlayer()
 {
     global $wgOut;
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Crunchyroll/css/Crunchyroll.scss'));
     if ($this->episodeId > 0 && !empty($this->serieId)) {
         $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
         $oTmpl->set_vars(array('episodeId' => $this->episodeId));
         return $oTmpl->render("CrunchyrollPlayer");
     } else {
         return '';
     }
 }
Пример #17
0
 /**
  * Return HTML for video upload dialog
  * @author Marooned
  */
 public static function getEditorDialog()
 {
     global $wgExtensionMessagesFiles, $wgTitle, $wgRequest, $wgExtensionsPath, $wgStylePath;
     wfProfileIn(__METHOD__);
     // render dialog
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('wgExtensionsPath' => $wgExtensionsPath, 'wgStylePath' => $wgStylePath));
     $html = $template->render('editorDialog');
     $result = array('html' => $html);
     wfProfileOut(__METHOD__);
     return $result;
 }
Пример #18
0
 function showArticleList()
 {
     global $wgOut;
     global $wgCanonicalNamespaceNames;
     global $wgContLang;
     wfProfileIn(__METHOD__);
     $articles = $this->getTagsInfo();
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("mTag" => $this->mTag, "articles" => $articles, "wgCanonicalNamespaceNames" => $wgCanonicalNamespaceNames, "wgContLang" => $wgContLang, "skin" => RequestContext::getMain()->getSkin()));
     $wgOut->addHTML($oTmpl->render("tag-activity"));
     wfProfileOut(__METHOD__);
 }
Пример #19
0
 public function execute()
 {
     global $wgRequest, $wgOut, $wgSolrHost, $wgSolrPort, $wgEnableWikiaSearchExt;
     if (empty($wgEnableWikiaSearchExt)) {
         $wgOut->addHTML("ERROR: WikiaSearch extension is disabled");
         return;
     }
     $params = array();
     $query = $wgRequest->getVal('q');
     $sort = $wgRequest->getVal('sort');
     $params['sort'] = !empty($sort) ? $sort : 'created desc';
     $params['fl'] = 'title,url,html,created';
     $lang = $wgRequest->getVal('uselang');
     if (!empty($lang) && !empty($query)) {
         $query .= ' AND lang:' . strtolower($lang);
     }
     $excludeWikis = $wgRequest->getVal('exclude');
     if (!empty($excludeWikis) && !empty($query)) {
         $excludeWikis = explode(',', $excludeWikis);
         foreach ($excludeWikis as $wikiDomain) {
             $wikiId = WikiFactory::DomainToID($wikiDomain);
             if (!empty($wikiId)) {
                 $query .= ' AND !wid:' . $wikiId;
             }
         }
     }
     $namespaces = $wgRequest->getVal('ns');
     if (!empty($namespaces) && !empty($query)) {
         $namespaces = explode(',', $namespaces);
         $nsQuery = '';
         foreach ($namespaces as $ns) {
             $nsQuery .= (!empty($nsQuery) ? ' OR ' : '') . 'ns:' . $ns;
         }
         $query .= " AND ({$nsQuery})";
     }
     $limit = $wgRequest->getVal('rows');
     $limit = empty($limit) || $limit > 100 ? 15 : $limit;
     if (!empty($query)) {
         $solr = new Apache_Solr_Service($wgSolrHost, $wgSolrPort, '/solr');
         try {
             $response = $solr->search($query, 0, $limit, $params);
         } catch (Exception $exception) {
             $wgOut->addHTML('ERROR: ' . $exception->getMessage());
         }
         // render template
         $oTmpl = new EasyTemplate(dirname(__FILE__) . '/templates');
         $oTmpl->set_vars(array('url' => $wgRequest->getFullRequestURL(), 'docs' => !is_null($response->response->docs) ? $response->response->docs : array(), 'dateFormat' => 'D, d M Y H:i:s O'));
         $wgRequest->response()->header('Cache-Control: max-age=60');
         $wgRequest->response()->header('Content-Type: application/xml');
         echo $oTmpl->render('results');
         exit;
     }
 }
Пример #20
0
 public function showForm($errors = array())
 {
     global $wgOut;
     $this->checkPermission();
     $titleObj = Title::makeTitle(NS_SPECIAL, 'WikiaVideoAdd');
     $action = htmlspecialchars($titleObj->getLocalURL("action=submit"));
     $name = $this->getRequest()->getVal('name', '');
     $wpWikiaVideoAddName = $this->getRequest()->getVal('wpWikiaVideoAddName', '');
     $wpWikiaVideoAddUrl = $this->getRequest()->getVal('wpWikiaVideoAddUrl', '');
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array('out' => $wgOut, 'action' => $action, 'name' => $name, 'errors' => $errors, 'wpWikiaVideoAddName' => $wpWikiaVideoAddName, 'wpWikiaVideoAddUrl' => $wpWikiaVideoAddUrl));
     $wgOut->addHTML($oTmpl->render('quickform'));
 }
Пример #21
0
 /**
  * @author Federico "Lox" Lucignano <*****@*****.**>
  *
  * Implementation of a parser function
  */
 public static function parseTag($input, $args, $parser)
 {
     $relatedTitle = null;
     $relatedImage = null;
     $relatedUrl = null;
     if (!empty($args[TOPLIST_ATTRIBUTE_RELATED])) {
         self::$mAttributes[TOPLIST_ATTRIBUTE_RELATED] = $args[TOPLIST_ATTRIBUTE_RELATED];
         $relatedTitle = Title::newFromText($args[TOPLIST_ATTRIBUTE_RELATED]);
         $relatedUrl = $relatedTitle->getLocalUrl();
     }
     if (!empty($args[TOPLIST_ATTRIBUTE_PICTURE])) {
         self::$mAttributes[TOPLIST_ATTRIBUTE_PICTURE] = $args[TOPLIST_ATTRIBUTE_PICTURE];
         if (!empty(self::$mAttributes[TOPLIST_ATTRIBUTE_PICTURE])) {
             $source = new ImageServing(null, 200);
             $result = $source->getThumbnails(array(self::$mAttributes[TOPLIST_ATTRIBUTE_PICTURE]));
             if (!empty($result[self::$mAttributes[TOPLIST_ATTRIBUTE_PICTURE]])) {
                 $relatedImage = $result[self::$mAttributes[TOPLIST_ATTRIBUTE_PICTURE]];
                 if (empty($relatedUrl)) {
                     $title = Title::newFromText($relatedImage['name'], NS_FILE);
                     $relatedUrl = $title->getLocalURL();
                 }
             }
         }
     }
     self::$mAttributes[TOPLIST_ATTRIBUTE_DESCRIPTION] = '';
     if (!empty($args[TOPLIST_ATTRIBUTE_DESCRIPTION])) {
         self::$mAttributes[TOPLIST_ATTRIBUTE_DESCRIPTION] = $args[TOPLIST_ATTRIBUTE_DESCRIPTION];
     }
     if (!empty(self::$mList)) {
         $list = self::$mList;
         self::$mList = null;
     } else {
         $list = TopList::newFromTitle($parser->mTitle);
     }
     if (!empty($list)) {
         $template = new EasyTemplate(dirname(__FILE__) . "/templates/");
         if ($relatedTitle instanceof Title) {
             $relatedTitleData = array('localURL' => $relatedTitle->getLocalURL(), 'text' => $relatedTitle->getText());
         } else {
             $relatedTitleData = null;
         }
         $template->set_vars(array('list' => $list, 'listTitle' => $list->getTitle()->getText(), 'relatedTitleData' => $relatedTitleData, 'relatedImage' => $relatedImage, 'attribs' => self::$mAttributes, 'relatedUrl' => $relatedUrl, 'description' => self::$mAttributes[TOPLIST_ATTRIBUTE_DESCRIPTION]));
         self::$mOutput = $template->render('list');
         // remove whitespaces to avoid extra <p> tags
         self::$mOutput = preg_replace("#[\n\t]+#", '', self::$mOutput);
     } else {
         self::$mOutput = '';
     }
     return self::$mOutput;
 }
 /**
  * @brief Adjusting title of a block group on RecentChanges page
  *
  * @param ChangesList $oChangeList
  * @param string $r
  * @param array $oRCCacheEntryArray an array of RCCacheEntry instances
  *
  * @author Andrzej 'nAndy' Łukaszewski
  */
 public static function onChangesListHeaderBlockGroup($oChangeList, &$r, &$oRCCacheEntryArray)
 {
     wfProfileIn(__METHOD__);
     $headerTitle = null;
     $oRCCacheEntry = null;
     if (!empty($oRCCacheEntryArray)) {
         $oRCCacheEntry = $oRCCacheEntryArray[0];
         if (!is_null($oRCCacheEntry)) {
             $oTitle = $oRCCacheEntry->getTitle();
             if ($oTitle instanceof Title) {
                 $changeRecentChangesHeader = false;
                 wfRunHooks('WikiaRecentChangesBlockHandlerChangeHeaderBlockGroup', array($oChangeList, $r, $oRCCacheEntryArray, &$changeRecentChangesHeader, $oTitle, &$headerTitle));
                 if ($changeRecentChangesHeader) {
                     $app = F::app();
                     $cnt = count($oRCCacheEntryArray);
                     $cntChanges = wfMsgExt('nchanges', array('parsemag', 'escape'), $app->wg->Lang->formatNum($cnt));
                     $timestamp = null;
                     $userlinks = array();
                     foreach ($oRCCacheEntryArray as $id => $oRCCacheEntry) {
                         $u = $oRCCacheEntry->userlink;
                         if (!isset($userlinks[$u])) {
                             $userlinks[$u] = 0;
                         }
                         $userlinks[$u]++;
                         if (is_null($timestamp)) {
                             $timestamp = $oRCCacheEntry->timestamp;
                         }
                     }
                     $users = array();
                     foreach ($userlinks as $userlink => $count) {
                         $text = $userlink;
                         $text .= $app->wg->ContLang->getDirMark();
                         if ($count > 1) {
                             $text .= ' (' . $app->wg->Lang->formatNum($count) . '×)';
                         }
                         array_push($users, $text);
                     }
                     $vars = array('cntChanges' => $cntChanges, 'hdrtitle' => $headerTitle, 'inx' => $oChangeList->rcCacheIndex, 'users' => $users, 'wgStylePath' => $app->wg->StylePath, 'title' => $oTitle, 'timestamp' => $timestamp);
                     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
                     $oTmpl->set_vars($vars);
                     $r = $oTmpl->render('RecentChangesHeaderBlock');
                 }
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 function showWikiForm($error = "")
 {
     global $wgOut, $wgLang;
     wfProfileIn(__METHOD__);
     /* no list when no user */
     if (empty($this->mUsername)) {
         wfProfileOut(__METHOD__);
         return false;
     }
     $action = htmlspecialchars($this->mTitle->getLocalURL());
     $oWiki = WikiFactory::getWikiByDB($this->mWiki);
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("title" => $this->mTitle, "error" => $error, "action" => $action, "username" => $this->mUsername, "wiki" => $this->mWiki));
     $wgOut->addHTML($oTmpl->render("wiki-form"));
     wfProfileOut(__METHOD__);
 }
 public function getNotifcationHTML($userObj)
 {
     wfProfileIn(__METHOD__);
     global $wgOut;
     $badge = $this->getBadgeToNotify($userObj->getId());
     if ($badge !== null) {
         $template = new EasyTemplate(dirname(__FILE__) . '/../templates');
         $template->set_vars(array('badge' => $badge, 'user' => $userObj));
         $out = $template->render('NotificationBox');
         wfRunHooks('AchievementsNotification', array($userObj, $badge, &$out));
     } else {
         $out = '';
     }
     wfProfileOut(__METHOD__);
     return $out;
 }
 public function view()
 {
     global $wgOut, $wgTitle;
     $data = $this->prepareData();
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("data" => $data));
     $wgOut->setHTMLTitle(wfMsg('hub-header', $data['title']));
     // does not add a h1, this is done later
     if (F::app()->checkSkin('oasis')) {
         $hubName = $wgTitle->getText();
         $wgOut->addHTML(F::app()->renderView('BlogsInHubs', 'HotNews', array('hubName' => $hubName)));
         $wgOut->addHTML(F::app()->renderView('CorporateSite', 'TopHubWikis'));
         parent::view();
     } else {
         $wgOut->addHTML($oTmpl->render("article"));
     }
 }
Пример #26
0
 function execute()
 {
     global $wgOut, $wgAVStag;
     $dataMaper = new Amazon_DataMapper();
     $fromAmazon = $dataMaper->findItemsByTag($wgAVStag);
     foreach ($fromAmazon as $key => $value) {
         $data[$key]['image'] = $value->ImageSets->ImageSet->LargeImage;
         $data[$key]['season'] = $value->ItemAttributes->SeasonSequence;
         $data[$key]['episode'] = $value->ItemAttributes->EpisodeSequence;
         $data[$key]['title'] = $value->ItemAttributes->Title;
         $data[$key]['video-widget'] = $dataMaper->findWidgetByAsin($key);
         $data[$key]['video-widget-code'] = htmlspecialchars('<avs_video align="right"  asin="' . $key . '" />');
         $data[$key]['image-widget-code'] = htmlspecialchars('<avs_image_link align="right" asin="' . $key . '" />');
     }
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("data" => $data));
     $wgOut->addHTML($oTmpl->render("list"));
 }
Пример #27
0
 public function showForm()
 {
     global $wgOut, $wgRequest, $wgUser;
     $titleObj = Title::makeTitle(NS_SPECIAL, 'WikiaVideoAdd');
     $action = htmlspecialchars($titleObj->getLocalURL("action=submit"));
     '' != $wgRequest->getVal('name') ? $name = $wgRequest->getVal('name') : ($name = '');
     if (!$wgUser->isAllowed('upload')) {
         if (!$wgUser->isLoggedIn()) {
             $wgOut->addHTML(wfMsg('wva-notlogged'));
         } else {
             $wgOut->addHTML(wfMsg('wva-notallowed'));
         }
     } else {
         $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
         $oTmpl->set_vars(array("out" => $wgOut, "action" => $action, "name" => $name));
         $wgOut->addHTML($oTmpl->render("quickform"));
     }
 }
Пример #28
0
 public function execute($param)
 {
     $this->setHeaders();
     $oOutput = new SpecialNewWikisGraphOutput();
     $endDate = new DateTime(date('Y-m-d'));
     $endDate->sub(new DateInterval('P1D'));
     $startDate = clone $endDate;
     $startDate->sub(new DateInterval('P1M'));
     $oOutput->set($this->getReport($startDate, $endDate, $param));
     $aAllOptions = array_merge($this->aAvailableLanguages, $this->aAvailableOtherOptions);
     $param = in_array($param, $aAllOptions) ? $param : '';
     $oOutput->setActive($param);
     $sReturnChart = $oOutput->getHTML();
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("tabs" => $this->aAvailableLanguages, "other" => $this->aAvailableOtherOptions, "active" => $param, "path" => SpecialPageFactory::getPage(self::NEW_WIKIS_GRAPH)->getTitle()->getFullURL()));
     F::app()->wg->out->addHTML($oTmpl->render("metrics-menu"));
     F::app()->wg->out->addHTML($sReturnChart);
 }
Пример #29
0
 function execute($par)
 {
     global $wgUser, $wgRequest, $wgOut;
     $this->setHeaders();
     $wgOut->setPageTitle('Configure a Wikia Widget');
     # Get request data from, e.g.
     //$param = $wgRequest->getText('param');
     # Do stuff
     # ...
     if (!$wgUser->isAllowed('wikiawidget')) {
         $wgOut->addHTML('Sorry, this feature is hidden away for staff only. Once we get it working really nicely, we\'ll open it up for everyone.');
         return;
     }
     $tmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
     $output = $tmpl->render('main');
     # Output
     $wgOut->addHTML($output);
 }
Пример #30
0
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser, $wgTitle, $wgExtensionsPath, $wgJsMimeType, $wgExtensionsPath;
     $reqTitle = $wgRequest->getText('title', false);
     $userspace = "";
     $list = explode('/', $reqTitle, 2);
     if (!empty($list[1])) {
         $t = Title::newFromText('Following', NS_SPECIAL);
         $wgOut->redirect($t->getFullURL());
     }
     if ($wgRequest->wasPosted()) {
         if ($wgUser->getId() != 0 && $wgRequest->getVal("show_followed", 0) == 1) {
             $wgUser->setGlobalPreference("hidefollowedpages", false);
             $wgUser->saveSettings();
         }
     }
     $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/Follow/css/special.css");
     $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/Follow/js/ajax.js\"></script>\n");
     $wgOut->setPageTitle(wfMsg('wikiafollowedpages-special-title'));
     if ($wgUser->getId() == 0) {
         $wgOut->addHTML(wfMsgExt('wikiafollowedpages-special-anon', array('parse')));
         return true;
     }
     $user = $wgUser;
     $is_hide = false;
     if ($user->getGlobalPreference('hidefollowedpages')) {
         $is_hide = true;
         if ($user->getId() != $wgUser->getId()) {
             $wgOut->addHTML(wfMsgExt('wikiafollowedpages-special-hidden', array('parse'), $user->getName));
             return true;
         }
     }
     $data = FollowModel::getWatchList($user->getId());
     if (empty($data) || $user->getId() == 0) {
         $wgOut->addHTML(wfMsgExt('wikiafollowedpages-special-empty', array('parse')));
         return true;
     }
     $this->setHeaders();
     $template = new EasyTemplate(dirname(__FILE__) . '/templates/');
     $template->set_vars(array("data" => $data, "owner" => $wgUser->getId() == $user->getId(), "user_id" => $user->getId(), "is_hide" => $is_hide, "show_link" => $wgTitle->getFullUrl()));
     $text = $template->render("followedPages");
     $wgOut->addHTML($text);
     return true;
 }