private function sassProcessing()
 {
     global $IP, $wgSassExecutable, $wgDevelEnvironment;
     wfProfileIn(__METHOD__);
     $tempDir = sys_get_temp_dir();
     //replace \ to / is needed because escapeshellcmd() replace \ into spaces (?!!)
     $tempOutFile = str_replace('\\', '/', tempnam($tempDir, 'Sass'));
     $tempDir = str_replace('\\', '/', $tempDir);
     $params = urldecode(http_build_query($this->mParams, '', ' '));
     $cmd = "{$wgSassExecutable} {$IP}/{$this->mOid} {$tempOutFile} --cache-location {$tempDir}/sass -r {$IP}/extensions/wikia/SASS/wikia_sass.rb {$params}";
     $escapedCmd = escapeshellcmd($cmd) . " 2>&1";
     $sassResult = shell_exec($escapedCmd);
     if ($sassResult != '') {
         Wikia::log(__METHOD__, false, "commandline error: " . $sassResult . " -- Full commandline was: {$escapedCmd}", true);
         Wikia::log(__METHOD__, false, "Full commandline was: {$escapedCmd}", true);
         Wikia::log(__METHOD__, false, AssetsManager::getRequestDetails(), true);
         if (file_exists($tempOutFile)) {
             unlink($tempOutFile);
         }
         if (!empty($wgDevelEnvironment)) {
             $exceptionMsg = "Problem with SASS processing: {$sassResult}";
         } else {
             $exceptionMsg = 'Problem with SASS processing. Check the PHP error log for more info.';
         }
         throw new Exception("/* {$exceptionMsg} */");
     }
     $this->mContent = file_get_contents($tempOutFile);
     unlink($tempOutFile);
     wfProfileOut(__METHOD__);
 }
Ejemplo n.º 2
0
 public function testGetGroupsCommonURL()
 {
     $url = $this->instance->getGroupsCommonURL(array('foo', 'bar'), array(), true, true);
     $this->assertEquals(1, count($url));
     $this->assertContains('__am', $url[0]);
     $this->assertContains("/{$this->cb}/", $url[0]);
     $this->assertContains('foo,bar', $url[0]);
 }
Ejemplo n.º 3
0
 public function testGeneral()
 {
     $manager = new AssetsManager();
     $manager->getDescription();
     $manager->getUrl('/test');
     $manager->title()->add('temporary');
     $manager->setTitle(new Title());
     $manager->requirejs()->renderConfig();
     $manager->requirejs()->renderConfigHtml();
     $manager->requirejs()->renderScript();
     $manager->requirejs()->renderScriptHtml();
 }
Ejemplo n.º 4
0
 /**
  * WikiaSkin constructor
  *
  * @param String $templateClassName Mame of the QuickTemplate subclass to associate to this skin
  * @param String $skinName Name of the skin (lowercase)
  * @param String $styleName The style name, will use $skinName if not specified
  * @param null $themeName The theme name, will use $skinName if not specified
  */
 function __construct($templateClassName = null, $skinName = null, $themeName = null, $styleName = null)
 {
     $this->app = F::app();
     $this->wg = $this->app->wg;
     $this->wf = $this->app->wf;
     $this->assetsManager = AssetsManager::getInstance();
     /**
      * old skins initialize template, skinname, stylename and themename statically in the class declaration,
      * we need to support them too so, that's what the following checks are meant for
      */
     if ($templateClassName !== null) {
         $this->template = $templateClassName;
     }
     if ($skinName !== null) {
         $this->skinname = $skinName;
     }
     if ($styleName !== null) {
         $this->stylename = $styleName;
     } elseif (!isset($this->stylename)) {
         $this->stylename = $this->skinname;
     }
     if ($themeName !== null) {
         $this->themename = $themeName;
     } elseif (!isset($this->themename)) {
         $this->themename = $this->skinname;
     }
 }
 public function execute()
 {
     global $wgUser, $wgOut, $wgExtensionsPath, $wgEnableUserLoginExt;
     wfProfileIn(__METHOD__);
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!$wgUser->isAllowed('createnewwiki')) {
         $this->displayRestrictionError();
         wfProfileOut(__METHOD__);
         return;
     }
     $wgOut->setPageTitle(wfMsg('cnw-title'));
     $wgOut->addHtml(F::app()->renderView('CreateNewWiki', 'Index'));
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CreateNewWiki/css/CreateNewWiki.scss'));
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/ThemeDesigner/js/ThemeDesigner.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/AjaxLogin/AjaxLogin.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/CreateNewWiki/js/CreateNewWiki.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/CreateNewWiki/js/CreateNewWikiSupplemental.js"></script>');
     if ($wgEnableUserLoginExt) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/UserLogin/css/UserLoginModal.scss'));
     }
     wfProfileOut(__METHOD__);
 }
Ejemplo n.º 6
0
 /**
  * Add JS and CSS to File Page (except mobile skin - see onWikiaMobileAssetsPackages)
  *
  * @param OutputPage $out
  * @param $skin
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage $out, $skin)
 {
     global $wgEnableVideoPageRedesign;
     $app = F::app();
     wfProfileIn(__METHOD__);
     if ($app->wg->Title->getNamespace() == NS_FILE) {
         $assetsManager = AssetsManager::getInstance();
         $wikiaFilePageJs = 'wikia_file_page_js';
         foreach ($assetsManager->getURL($wikiaFilePageJs) as $url) {
             $out->addScript("<script src=\"{$url}\"></script>");
         }
         // load assets when File Page redesign is enabled
         if ($app->checkSkin('oasis') && !empty($wgEnableVideoPageRedesign)) {
             $filePageTabbedCss = 'file_page_tabbed_css';
             $filePageTabbedJs = 'file_page_tabbed_js';
             foreach ($assetsManager->getURL($filePageTabbedCss) as $url) {
                 $out->addStyle($url);
             }
             foreach ($assetsManager->getURL($filePageTabbedJs) as $url) {
                 $out->addScript("<script src=\"{$url}\"></script>");
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP;
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (endsWith($this->mOid, '.js', false)) {
         $this->mContentType = AssetsManager::TYPE_JS;
     } else {
         if (endsWith($this->mOid, '.css', false)) {
             $this->mContentType = AssetsManager::TYPE_CSS;
         } else {
             throw new Exception('Requested file must be .css or .js.');
         }
     }
     $filePath = $IP . '/' . $this->mOid;
     if (file_exists($filePath)) {
         $this->mContent = file_get_contents($filePath);
     } else {
         $requestDetails = AssetsManager::getRequestDetails();
         Wikia::log(__METHOD__, false, "file '{$filePath}' doesn't exist ({$requestDetails})", true);
         throw new Exception('File does not exist');
     }
 }
 function __construct($message)
 {
     // add referer and user agent info to the exception message
     $details = AssetsManager::getRequestDetails();
     $message .= " ({$details})";
     parent::__construct($message);
 }
 /**
  * Render Quiz namespace page
  */
 public function view()
 {
     global $wgOut, $wgUser, $wgTitle, $wgRequest;
     wfProfileIn(__METHOD__);
     // let MW handle basic stuff
     parent::view();
     // don't override history pages
     $action = $wgRequest->getVal('action');
     if (in_array($action, array('history', 'historysubmit'))) {
         wfProfileOut(__METHOD__);
         return;
     }
     // quiz doesn't exist
     if (!$wgTitle->exists() || empty($this->mQuiz)) {
         wfProfileOut(__METHOD__);
         return;
     }
     // set page title
     $title = $this->mQuiz->getTitle();
     $wgOut->setPageTitle($title);
     // add CSS/JS
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
     // render quiz page
     $wgOut->clearHTML();
     $wgOut->addHTML($this->mQuiz->render());
     wfProfileOut(__METHOD__);
 }
 public function execute($subpage)
 {
     global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
     // Boilerplate special page permissions
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (!$wgUser->isAllowed('wikiaquiz')) {
         $this->displayRestrictionError();
         return;
     }
     if (wfReadOnly() && !wfAutomaticReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $wgOut->addScript('<script src="' . $wgResourceBasePath . '/resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js"></script>');
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaQuiz/js/CreateWikiaQuizArticle.js"></script>');
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
     if ($subpage != '') {
         // We came here from the edit link, go into edit mode
         $wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'EditQuizArticle', array('title' => $subpage)));
     } else {
         $wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'CreateQuizArticle'));
     }
 }
Ejemplo n.º 11
0
 public function execute($subpage)
 {
     global $wgOut;
     $this->checkPermission();
     if ($this->getUser()->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (!$this->getUser()->isAllowed('videoupload')) {
         $wgOut->addHTML(wfMessage('videos-error-admin-only')->plain());
         return;
     }
     // Add css for form
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/VideoEmbedTool/css/WikiaVideoAdd.scss'));
     $this->mTitle = Title::makeTitle(NS_SPECIAL, 'WikiaVideoAdd');
     $wgOut->setRobotpolicy('noindex,nofollow');
     $wgOut->setPageTitle("WikiaVideoAdd");
     $wgOut->setArticleRelated(false);
     $this->mAction = $this->getRequest()->getVal("action");
     $this->mPosted = $this->getRequest()->wasPosted();
     switch ($this->mAction) {
         case 'submit':
             if ($this->mPosted) {
                 $this->mAction = $this->doSubmit();
             }
             break;
         default:
             $this->showForm();
             break;
     }
 }
 public function executeIndex($params)
 {
     $page_owner = User::newFromName($this->wg->Title->getText());
     if (!is_object($page_owner) || $page_owner->getId() == 0) {
         // do not show module if page owner does not exist or is an anonymous user
         return false;
     }
     // add CSS for this module
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/FollowedPages.scss"));
     $showDeletedPages = isset($params['showDeletedPages']) ? (bool) $params['showDeletedPages'] : true;
     // get 6 followed pages
     $watchlist = FollowModel::getWatchList($page_owner->getId(), 0, 6, null, $showDeletedPages);
     $data = array();
     // weird.  why is this an array of one element?
     foreach ($watchlist as $unused_id => $item) {
         $pagelist = $item['data'];
         foreach ($pagelist as $page) {
             $data[] = $page;
         }
     }
     // only display  your own page
     if ($page_owner->getId() == $this->wg->User->getId()) {
         $this->follow_all_link = Wikia::specialPageLink('Following', 'oasis-wikiafollowedpages-special-seeall', 'more');
     }
     $this->data = $data;
     $this->max_followed_pages = min(self::MAX_FOLLOWED_PAGES, count($this->data));
 }
 public function executeIndex()
 {
     $maxBadgesToDisplay = 6;
     // Could make this a global if we want
     wfProfileIn(__METHOD__);
     // include oasis.css override
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/AchievementsII/css/oasis.scss'));
     // This code was taken from SpecialLeaderboard so it can be used by both the module and the old Monaco .tmpl
     $rankingService = new AchRankingService();
     // ignore welcome badges
     $blackList = array(BADGE_WELCOME);
     $awardedBadges = $rankingService->getRecentAwardedBadges(null, $maxBadgesToDisplay, 3, $blackList);
     $recents = array();
     $count = 1;
     // getRecentAwardedBadges can sometimes return more than $max items
     foreach ($awardedBadges as $badgeData) {
         //$level = $badgeData['badge']->getLevel();
         $recents[] = $badgeData;
         if ($count++ >= $maxBadgesToDisplay) {
             break;
         }
     }
     $this->recents = $recents;
     wfProfileOut(__METHOD__);
 }
 public function executeIndex()
 {
     wfProfileIn(__METHOD__);
     $this->partnerId = "Wikia";
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/HuluVideoPanel.scss'));
     wfProfileOut(__METHOD__);
 }
 public function execute($subpage)
 {
     global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
     // Boilerplate special page permissions
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (wfReadOnly() && !wfAutomaticReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     if (!$wgUser->isAllowed('createpage') || !$wgUser->isAllowed('edit')) {
         $this->displayRestrictionError();
         return;
     }
     $wgOut->addModules("wikia.jquery.ui");
     $wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaPoll/js/CreateWikiaPoll.js"></script>');
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaPoll/css/CreateWikiaPoll.scss'));
     if ($subpage != '') {
         // We came here from the edit link, go into edit mode
         $wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPageEdit', array('title' => $subpage)));
     } else {
         $wgOut->addHtml(F::app()->renderView('WikiaPoll', 'SpecialPage'));
     }
 }
 public function index()
 {
     if (!$this->wg->User->isAllowed('gameguidescontent')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $title = $this->wf->Msg('wikiagameguides-content-title');
     $this->wg->Out->setPageTitle($title);
     $this->wg->Out->setHTMLTitle($title);
     $this->wg->Out->addModules('jquery.autocomplete');
     $assetManager = AssetsManager::getInstance();
     $styles = $assetManager->getUrl('extensions/wikia/GameGuides/css/GameGuidesContentManagmentTool.scss');
     foreach ($styles as $s) {
         $this->wg->Out->addStyle($s);
     }
     $scripts = $assetManager->getURL('extensions/wikia/GameGuides/js/GameGuidesContentManagmentTool.js');
     foreach ($scripts as $s) {
         $this->wg->Out->addScriptFile($s);
     }
     F::build('JSMessages')->enqueuePackage('GameGuidesContentMsg', JSMessages::INLINE);
     $tags = WikiFactory::getVarValueByName('wgWikiaGameGuidesContent', $this->wg->CityId);
     $this->response->setVal('tags', $tags);
     return true;
 }
Ejemplo n.º 17
0
function wfLatestQuestionsAjaxAddScript(&$out)
{
    global $wgJsMimeType, $wgExtensionsPath;
    $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/LatestQuestions/LatestQuestions.js\"></script>\n");
    $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LatestQuestions/LatestQuestions.scss'));
    return true;
}
 /**
  * Page Not Found
  *
  * Get 20 most recent edited page
  * get 5 images per page
  *
  * display random image on 404 page
  * example:
  *
  * Open non existent page on any wiki
  *
  */
 function pageNotFound()
 {
     //setup all needed assets on 404 page
     /**
      * @var $out OutputPage
      */
     $out = $this->request->getVal('out', $this->wg->Out);
     $assetManager = AssetsManager::getInstance();
     //add styles that belongs only to 404 page
     $styles = $assetManager->getURL(array('wikiamobile_404_scss'));
     //this is going to be additional call but at least it won't be loaded on every page
     foreach ($styles as $s) {
         $out->addStyle($s);
     }
     //this is mainly for tracking
     $scipts = $assetManager->getURL(array('wikiamobile_404_js'));
     foreach ($scipts as $s) {
         $out->addScript('<script src="' . $s . '"></script>');
     }
     //suppress rendering stuff that is not to be on 404 page
     WikiaMobileFooterService::setSkipRendering(true);
     WikiaMobilePageHeaderService::setSkipRendering(true);
     /**
      * @var $wikiaMobileStatsModel WikiaMobileStatsModel
      */
     $wikiaMobileStatsModel = new WikiaMobileStatsModel();
     $ret = $wikiaMobileStatsModel->getRandomPopularPage();
     $this->response->setVal('title', $this->wg->Out->getTitle());
     $this->response->setVal('link', $ret[0]);
     $this->response->setVal('img', $ret[1]);
 }
Ejemplo n.º 19
0
 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__);
 }
Ejemplo n.º 20
0
function renderSpoilerControl($input, $argv, $parser)
{
    // check arguments
    if (empty($argv['source'])) {
        return;
    }
    $controlOptionsStr = wfMsg('wikiaspoiler-' . $argv['source']);
    willdebug($controlOptionsStr);
    if (empty($controlOptionsStr)) {
        return;
    }
    $controlOptions = explode("\n", $controlOptionsStr);
    $numOptions = sizeof($controlOptions);
    // load assets
    $extPath = F::app()->wg->extensionsPath;
    F::app()->wg->out->addScript("<script src=\"{$extPath}/wikia/WikiaSpoiler/js/WikiaSpoiler.js\"></script>");
    F::app()->wg->out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaSpoiler/css/WikiaSpoiler.scss'));
    $output = '<form id="wikiaspoilercontrol" action="" onsubmit="return false;"><p>';
    $output .= wfMsg('wikiaspoiler-control-heading');
    $output .= '<select class="wikiaspoilerselect">';
    $output .= '<option value="0">none</option>';
    for ($i = 0; $i < $numOptions; $i++) {
        $output .= '<option value="' . ($i + 1) . '">' . $controlOptions[$i] . '</option>';
    }
    willdebug($output);
    $output .= '</select></p></form>';
    return $output;
}
Ejemplo n.º 21
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__);
 }
Ejemplo n.º 22
0
 public function testInit()
 {
     $this->wikiaMobileService->init();
     $this->assertAttributeEquals(RequestContext::getMain()->getSkin(), 'skin', $this->wikiaMobileService);
     $this->assertAttributeEquals($this->app->getSkinTemplateObj(), 'templateObject', $this->wikiaMobileService);
     $this->assertAttributeEquals(AssetsManager::getInstance(), 'assetsManager', $this->wikiaMobileService);
 }
Ejemplo n.º 23
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;
 }
Ejemplo n.º 24
0
 /**
  * @static
  * @return AssetsManager instance
  */
 public static function getInstance()
 {
     if (self::$mInstance == false) {
         global $wgCdnStylePath, $wgStyleVersion, $wgAllInOne, $wgRequest;
         self::$mInstance = new AssetsManager($wgCdnStylePath, $wgStyleVersion, $wgRequest->getBool('allinone', $wgAllInOne), $wgRequest->getBool('allinone', $wgAllInOne));
     }
     return self::$mInstance;
 }
Ejemplo n.º 25
0
 function __construct()
 {
     parent::__construct('SOTD');
     global $errors, $errorlist, $wgOut;
     $wgOut->addStyle(AssetsManager::getInstance()->getOneCommonURL('extensions/3rdparty/LyricWiki/SongOfTheDay/Special_SOTD.css'));
     $errors = array('set' => false);
     $errorlist = '';
 }
 public function executeIndex()
 {
     wfProfileIn(__METHOD__);
     // add CSS for this module
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/CommunityCorner.scss"));
     $this->isAdmin = $this->wg->User->isAllowed('editinterface');
     wfProfileOut(__METHOD__);
 }
Ejemplo n.º 27
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__);
 }
 public function executeIndex($params)
 {
     wfProfileIn(__METHOD__);
     // add CSS for this module
     $this->wg->Out->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/InsightsModule.scss"));
     $this->themeClass = SassUtil::isThemeDark() ? 'insights-dark' : 'insights-light';
     $this->messageKeys = InsightsHelper::getMessageKeys();
     wfProfileOut(__METHOD__);
 }
 /**
  * Send CSS and JS to the browser if have not been sent yet
  */
 public static function setupScripts()
 {
     if (!self::$initialized) {
         global $wgOut;
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CategoryGalleries/css/CategoryGalleries.scss'));
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CategoryGalleries/css/CategoryGalleries.IE.scss'), '', 'lte IE 8');
         self::$initialized = true;
     }
 }
Ejemplo n.º 30
0
 function openShowCategory()
 {
     global $wgOut;
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CategoryExhibition/css/CategoryExhibition.scss'));
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/CategoryExhibition/css/CategoryExhibition.IE.scss'), '', 'lte IE 8');
     $this->addScripts();
     $viewer = new $this->viewerClass($this->mTitle);
     $wgOut->addHTML($viewer->getFormHTML());
 }