Exemplo n.º 1
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");
 }
 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__);
 }
Exemplo n.º 3
0
 /**
  * Returns HTML internals of the widget box.
  */
 public function getHTML($initialData)
 {
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('data' => $initialData, 'completedToday' => $this->getCompletion(), 'thresholds' => $this->getThresholds(), 'header' => $this->getHeaderHTML(), 'weather' => $this->getWeatherClass($initialData['ct']), 'countDescription' => $this->getCountDescription(), 'moreLink' => $this->getMoreLink(), 'widgetName' => $this->getName(), 'title' => $this->getLeaderboardTitle(), 'getAvatarLink' => array($this, 'getAvatarLink'), 'getUserLink' => array($this, 'getUserLink'), 'status' => $this->getWidgetStatus(), 'login' => $this->getLoginLink(), 'widgetMWName' => $this->getMWName(), 'extraInternalHTML' => $this->getExtraInternalHTML()));
     $html = $tmpl->execute('widgets/dashboardWidget.tmpl.php');
     return $html;
 }
Exemplo n.º 4
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__);
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
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__);
 }
 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;
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
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");
 }
Exemplo n.º 10
0
 public static function getCTA(&$t)
 {
     if (self::isActivePage() && !self::isReferredFromArticleCreator() && self::isValidTitle($t)) {
         $tmpl = new EasyTemplate(dirname(__FILE__));
         $tmpl->set_vars(array('title' => $t->getText()));
         return $tmpl->execute('AltMethodAdder.tmpl.php');
     }
 }
Exemplo n.º 11
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__);
 }
 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'));
         }
     }
 }
Exemplo n.º 13
0
 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' => '&nbsp;', 'BOXAD_1' => AdEngine::getInstance()->getAd('SPECIAL_INTERSTITIAL_BOXAD_1'), 'BOXAD_2' => '&nbsp;');
             $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);
         }
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 15
0
 private function setTemplatePath($templateName)
 {
     $path = $this->config->getSystemUITemplatesLocation();
     $et = new EasyTemplate($path);
     // If there isn't a template that is system specific, template should exist in WAP templates
     if (!$et->template_exists($templateName)) {
         $path = $this->config->getWAPUITemplatesLocation();
     }
     EasyTemplate::set_path($path);
 }
Exemplo n.º 16
0
 public function addBubbleTipToElement($element, $cookiePrefix, $text)
 {
     global $wgOut;
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('tipsbubble.css'), 'extensions/wikihow/interfaceelements', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js', 'common/jquery.cookie.js'), 'extensions/wikihow', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('text' => $text));
     InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
     $wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
 }
Exemplo n.º 17
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");
 }
Exemplo n.º 18
0
 function getCalculator($widget)
 {
     global $wgArticleWidgets;
     if (isset($wgArticleWidgets[$widget])) {
         $tmpl = new EasyTemplate(dirname(__FILE__));
         $html = $tmpl->execute($widget . '/' . $widget . '.tmpl.php');
     } else {
         $html = '';
     }
     return $html;
 }
Exemplo n.º 19
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodGuardian");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->isAnon()) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodguardian", MethodGuardian::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->deleteMethod($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->keepMethod($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodguardian'));
     $wgOut->setPageTitle(wfMsg('methodguardian'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodguardian.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodguardian.js'), 'extensions/wikihow/altmethodadder', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodGuardian.tmpl.php'));
     $this->displayLeaderboards();
 }
Exemplo n.º 20
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 '';
     }
 }
Exemplo n.º 21
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;
     }
 }
Exemplo n.º 22
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;
 }
Exemplo n.º 23
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__);
 }
Exemplo n.º 24
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;
 }
 function getPageHeader()
 {
     wfProfileIn(__METHOD__);
     if (empty($this->mShow)) {
         wfProfileOut(__METHOD__);
         return "";
     }
     $action = htmlspecialchars($this->mTitle->getLocalURL());
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("action" => $action, "mPage" => $this->mValidPage ? $this->mPage->getFullText() : ""));
     wfProfileOut(__METHOD__);
     return $oTmpl->render("main-finder-form");
 }
Exemplo n.º 26
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'));
 }
Exemplo n.º 27
0
 public function addBubbleTipToElement($element, $cookiePrefix, $text)
 {
     global $wgOut;
     $wgOut->addJSCode('jqck');
     //jQuery Cookie. Add as JS code so we don't have duplicate includes
     $wgOut->addCSSCode('tbc');
     // Tips Bubble CSS
     InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js'), 'extensions/wikihow', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('text' => $text));
     $wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
 }
Exemplo n.º 28
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;
 }
Exemplo n.º 29
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>';
 }
 /**
  * @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;
 }