public function index()
 {
     $this->messages = $this->getVal('messages');
     // loading assets in Monobook that would normally load in oasis
     if ($this->app->checkSkin('monobook')) {
         $this->response->addAsset('skins/shared/styles/sprite.scss');
         $this->response->addAsset('extensions/wikia/Forum/css/monobook/RelatedForumMonobook.scss');
     }
     $title = $this->getContext()->getTitle();
     $topicTitle = Title::newFromText($title->getPrefixedText(), NS_WIKIA_FORUM_TOPIC_BOARD);
     // common data
     $this->sectionHeading = wfMessage('forum-related-discussion-heading', $title->getText())->escaped();
     $this->newPostButton = wfMessage('forum-related-discussion-new-post-button')->escaped();
     $this->newPostUrl = $topicTitle->getFullUrl('openEditor=1');
     $this->newPostTooltip = wfMessage('forum-related-discussion-new-post-tooltip', $title->getText())->escaped();
     $this->blankImgUrl = wfBlankImgUrl();
     $this->seeMoreUrl = $topicTitle->getFullUrl();
     $this->seeMoreText = wfMessage('forum-related-discussion-see-more')->escaped();
     // TODO: move classes to template when Venus will be live on all wikis
     $this->venusBtnClasses = '';
     if ($this->app->checkSkin('venus')) {
         $this->venusBtnClasses = 'wikia-button secondary';
         Wikia::addAssetsToOutput('related_forum_discussion_css');
     }
 }
 public function index()
 {
     wfProfileIn(__METHOD__);
     if (!$this->getUser()->isAllowed('coppatool')) {
         wfProfileOut(__METHOD__);
         $this->displayRestrictionError();
         return false;
     }
     $this->specialPage->setHeaders();
     $this->response->setTemplateEngine(WikiaResponse::TEMPLATE_ENGINE_MUSTACHE);
     $this->userName = trim($this->getVal('username', $this->getPar()));
     $this->isIP = false;
     $this->validUser = false;
     if (IP::isIPAddress($this->userName)) {
         $this->userName = IP::sanitizeIP($this->userName);
         $this->isIP = true;
         $this->validUser = true;
     } else {
         $userObj = User::newFromName($this->userName);
         if (!$userObj || $userObj->getId() === 0) {
             $this->validUser = false;
         } else {
             $this->userName = $userObj->getName();
             $this->validUser = true;
         }
     }
     $this->userForm = $this->app->renderView('WikiaStyleGuideForm', 'index', ['form' => ['isInvalid' => $this->validUser || $this->userName === '' ? false : true, 'errorMsg' => $this->validUser || $this->userName === '' ? '' : $this->msg('coppatool-nosuchuser', $this->userName)->escaped(), 'inputs' => [['type' => 'text', 'name' => 'username', 'isRequired' => true, 'label' => $this->msg('coppatool-label-username')->escaped(), 'value' => Sanitizer::encodeAttribute($this->userName)], ['type' => 'submit', 'value' => $this->msg('coppatool-submit')->escaped()]], 'method' => 'GET', 'action' => $this->getTitle()->getLocalUrl()]]);
     if ($this->validUser) {
         $this->getOutput()->addModules('ext.coppaTool');
         $this->buttons = [];
         $this->blankImgUrl = wfBlankImgUrl();
         $this->formHeading = $this->msg('coppatool-form-header')->escaped();
         if (!$this->isIP) {
             $this->buttons[] = ['buttonAction' => 'disable-account', 'buttonLink' => Html::element('a', ['href' => '#'], $this->msg('coppatool-disable')->escaped()), 'done' => $userObj->getGlobalFlag('disabled', false)];
             $this->buttons[] = ['buttonAction' => 'blank-profile', 'buttonLink' => Html::element('a', ['href' => '#'], $this->msg('coppatool-blank-user-profile')->escaped())];
             $this->buttons[] = ['buttonAction' => 'delete-userpages', 'buttonLink' => Html::element('a', ['href' => '#'], $this->msg('coppatool-delete-user-pages')->escaped())];
             $this->buttons[] = ['buttonAction' => 'coppa-imagereview', 'buttonLink' => Linker::link(Title::newFromText('CoppaImageReview', NS_SPECIAL), $this->msg('coppatool-imagereview')->escaped(), ['target' => '_blank'], ['username' => $this->userName], ['known', 'noclasses'])];
         } else {
             $this->buttons[] = ['buttonAction' => 'phalanx-ip', 'buttonLink' => Linker::link(Title::newFromText('Phalanx', NS_SPECIAL), $this->msg('coppatool-phalanx-ip')->escaped(), ['target' => '_blank'], ['type' => Phalanx::TYPE_USER, 'wpPhalanxCheckBlocker' => $this->userName, 'target' => $this->userName], ['known', 'noclasses'])];
             $this->buttons[] = ['buttonAction' => 'rename-ip', 'buttonLink' => Html::element('a', ['href' => '#'], $this->msg('coppatool-rename-ip')->escaped())];
         }
     }
     wfProfileOut(__METHOD__);
 }
</div>
				<div class="popular-toggle toggle-0"><span class="icon-hide"></span><?php 
echo wfMessage('user-tools-edit-hide-tools')->escaped();
?>
</div>
			</div>
		</div>
		<div class="column">
			<label><?php 
echo wfMessage('user-tools-edit-toolbar-list')->escaped();
?>
</label>
			<span class="reset-defaults">
				<a class="wikia-chiclet-button" href="#">
					<img height="0" width="0" src="<?php 
echo wfBlankImgUrl();
?>
">
				</a>
				<a href="#">
					<?php 
echo wfMessage('user-tools-edit-reset-defaults')->escaped();
?>
				</a>
			</span>
			<ul class="options-list">
			</ul>
		</div>
	</div>
</div>
    ?>
</div><?php 
}
if (!empty($video['isNew'])) {
    ?>
<div class="new"><?php 
    echo wfMsg('related-videos-video-is-new');
    ?>
<div  class="newRibbon" ></div></div><?php 
}
?>
<div class="playButton"></div><img class="Wikia-video-thumb" data-src="<?php 
echo $video['thumbnailData']['thumb'];
?>
" src="<?php 
echo $preloaded ? $video['thumbnailData']['thumb'] : wfBlankImgUrl();
?>
" style="margin-top:<?php 
echo floor(($elementHeight - $video['thumbnailData']['height']) / 2);
?>
px; height:<?php 
echo $video['thumbnailData']['height'];
?>
px; width:<?php 
echo $video['thumbnailData']['width'];
?>
px;" /></a>
	<div class="description"><?php 
echo $video['truncatedTitle'];
?>
</div>
Esempio n. 5
0
 /**
  * Update thumbnail img attributes when lazy loading
  * @param WikiaController $controller
  */
 public static function setLazyLoadingAttribs(WikiaController $controller)
 {
     $controller->onLoad = self::IMG_ONLOAD;
     $controller->imgClass = array_merge($controller->imgClass, explode(' ', self::LAZY_IMAGE_CLASSES));
     $controller->dataSrc = $controller->imgSrc;
     $controller->imgSrc = wfBlankImgUrl();
 }
ksort($combined);
print "<table class='WikiaTable'>\n";
print "<tr>\n";
print "<th colspan=2>name</th>\n";
print "<th colspan=2>" . WikiFactory::IDtoDB($wiki->city_id) . "</th>\n";
if ($to) {
    print "<th colspan=2>" . WikiFactory::IDtoDB($to) . "</th>\n";
}
print "</tr>\n";
global $wgServer;
$WF_base = Title::newFromText('WikiFactory', NS_SPECIAL)->getLocalURL();
$wfURL_L = $WF_base . "/{$vars['L']['city']}/variables/";
if ($to) {
    $wfURL_R = $WF_base . "/{$vars['R']['city']}/variables/";
}
$blankImg = wfBlankImgUrl();
$editSprite = "<img src='{$blankImg}' class='sprite edit-pencil' alt='Edit'>";
$findSprite = "<img src='{$blankImg}' class='sprite details' alt='Find more'>";
$WF_find = Title::newFromText('WikiFactoryReporter', NS_SPECIAL)->getLocalURL();
foreach ($combined as $var_id => $var) {
    /* var has:
    		* => the name
    		_ => if its printable (and compariable)
    		L => value of source wiki
    		R => value of target wiki
    	*/
    print "<tr>\n";
    /*************************************************************************/
    print "<td><abbr title='{$var_id}' >{$var['*']}</abbr></td>\n";
    print "<td><a href='{$WF_find}?varid={$var_id}' >{$findSprite}</a></td>\n";
    /*****************************************/
 function getCustomSettings()
 {
     global $wgExternalSharedDB;
     $city_list = 'city_list';
     $cv = 'city_variables';
     $cv_pool = 'city_variables_pool';
     $dbr = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB);
     $res = $dbr->select(array($city_list, $cv, $cv_pool), array('cv_value', 'city_url', 'city_id'), array("{$city_list}.city_id = {$cv}.cv_city_id", "{$cv}.cv_variable_id = {$cv_pool}.cv_id", "{$cv_pool}.cv_id     = '{$this->varid}'"), __METHOD__);
     $variable = WikiFactory::getVarById($this->varid, 0);
     $data = array();
     $values = array();
     $row_count = $dbr->numRows($res);
     if ($row_count == 0) {
         $dbr->freeResult($res);
         $out = "no settings found in WikiFactory\n";
         return $out;
     }
     $this->over_limit = false;
     if ($row_count > 1000) {
         $this->over_limit = true;
     }
     if ($this->disable_limit) {
         $this->over_limit = false;
     }
     while ($row = $dbr->fetchObject($res)) {
         $city_id = $row->city_id;
         $cv_value = unserialize($row->cv_value);
         $nom_value = $cv_value;
         if (is_array($cv_value)) {
             asort($cv_value);
             $cv_value = join(', ', $cv_value);
             $nom_value = 'array';
         } elseif (is_bool($cv_value)) {
             $cv_value = $cv_value ? 'true' : 'false';
             $nom_value = $cv_value;
         } else {
             #$cv_value = 'Error. Not an array?!?';
         }
         if (preg_match('/http:\\/\\/([\\w\\.\\-]+)\\//', $row->city_url, $matches)) {
             $city_url = str_ireplace('.wikia.com', '', $matches[1]);
         } else {
             $city_url = 'Error. Unknown wiki?!?';
         }
         if (!empty($cv_value)) {
             if (count($data) <= 1000 || $this->disable_limit) {
                 $data[] = array('value' => $cv_value, 'url' => $city_url, 'city' => $city_id);
             }
             $values[] = $nom_value;
         }
     }
     $dbr->freeResult($res);
     $acv = array_count_values($values);
     asort($acv);
     unset($values);
     global $wgCityId;
     if ($wgCityId == 177) {
         #we're on central (or are faking it), so link locallly
         $WF_title = SpecialPage::getTitleFor('WikiFactory');
         $wie_title = SpecialPage::getTitleFor('WhereIsExtension');
     } else {
         #we're away from home, so make sure the links link back right
         $WF_title = GlobalTitle::newFromText('WikiFactory', NS_SPECIAL, 177);
         $wie_title = GlobalTitle::newFromText('WhereIsExtension', NS_SPECIAL, 177);
     }
     $wie_query = array('var' => $variable->cv_variable_id, 'searchType' => 'full', 'val' => 0);
     #likeValue is appended manually inside the template;
     $wie_base = $wie_title->getFullURL(http_build_query($wie_query));
     unset($wie_query);
     unset($wie_title);
     $limit_message = '';
     if ($this->over_limit) {
         $limit_message = Wikia::errorbox("Warning, this variable has {$row_count} entries. Only first 1000 shown");
         $QS = http_build_query(array('varid' => $variable->cv_variable_id, 'nolimit' => 1));
         $limit_message .= "<a href='/index.php?title=Special:WikiFactoryReporter&{$QS}'>Click here to load all results</a>\n";
     }
     $groups = WikiFactory::getGroups();
     $variable->var_group = $groups[$variable->cv_variable_group];
     unset($groups);
     $sprites = array('search' => "<img src='" . wfBlankImgUrl() . "' class='sprite search' alt='search' height='16' width='22'>", 'edit' => "<img src='" . wfBlankImgUrl() . "' class='sprite edit-pencil' alt='edit'>");
     $tmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
     $tmpl->set_vars(array('th' => array($variable->cv_name, 'wiki', 'city_id'), 'data' => $data, 'variable' => $variable, 'acv' => $acv, 'wf_base' => $WF_title->getFullUrl(), 'limit_message' => $limit_message, 'sprites' => $sprites, 'wie_base' => $wie_base));
     $out = $tmpl->render('reporter');
     return $out;
 }
Esempio n. 8
0
<!-- s:<?php 
echo __FILE__;
?>
 -->
<div class="wk_blogs_panel" style="<?php 
echo isset($aOptions['style']) ? $aOptions['style'] : '';
?>
">
	<div class="wk_blogs_title color1">
		<div><?php 
echo !empty($aOptions['title']) ? $aOptions['title'] : "";
?>
</div>
		<div class="wk_blogs_title_refresh"><?php 
echo $skin->makeLinkObj($wgTitle, "<img src=\"" . wfBlankImgUrl() . "\" border=\"0\" class=\"sprite refresh\" />", "action=purge");
?>
</div>
	</div>
	<div class="wk_blogs_body">
<?php 
if (!empty($aRows)) {
    ?>
		<ul class="list" style="list-style-image:none;list-style-position:outside;list-style-type:none;margin:0.3em 0 0 0.5em">
<?php 
    foreach ($aRows as $pageId => $aRow) {
        $oTitle = Title::newFromText($aRow['title'], $aRow['namespace']);
        if (!$oTitle instanceof Title) {
            continue;
        }
        $isVoting = $isCommenting = 0;
        if (isset($aRow['props']) && array_key_exists('voting', $aRow['props'])) {
Esempio n. 9
0
<?php

foreach ($fileList as $fileUsage) {
    ?>
	<li class="page-listing">
		<div class="grid-1 alpha">
			<a class="page-listing-image" href="<?php 
    echo $fileUsage['url'];
    ?>
">
				<img src="<?php 
    echo empty($fileUsage['imageUrl']) ? wfBlankImgUrl() : $fileUsage['imageUrl'];
    ?>
" <?php 
    if (empty($fileUsage['imageUrl'])) {
        ?>
 class="no-image" <?php 
    }
    ?>
>
			</a>
		</div>
		<div class="grid-3">
			<h3 class="page-listing-title"><a href="<?php 
    echo $fileUsage['url'];
    ?>
"><?php 
    echo $fileUsage['titleText'];
    ?>
</a></h3>
			<?php 
<div id="MyToolsConfiguration" class="MyToolsConfiguration">

	<h1><?= wfMsg('oasis-toolbar-edit-title') ?></h1>

	<form class="toolbar-customize">
		<div class="column">
			<label><?= wfMsg('oasis-toolbar-edit-toolbar-list') ?></label>
			<span class="reset-defaults">
				<a class="wikia-chiclet-button" href="#">
					<img height="0" width="0" src="<?= wfBlankImgUrl() ?>">
				</a>
				<a href="#">
					<?= wfMsg('oasis-toolbar-edit-reset-defaults') ?>
				</a>
			</span>
			<ul class="options-list">
			</ul>
		</div>
		<div class="column">
			<label><?= wfMsg('oasis-toolbar-edit-find-a-tool') ?></label>
			<span class="advanced-tools"><?php echo wfMsgExt('oasis-toolbar-edit-advanced-tools', array('parseinline')); ?></span>
			<div class="search-box">
				<input type="text" class="search" autocomplete="off" placeholder="<?= wfMsg('oasis-toolbar-edit-search-for-tool') ?>">
			</div>
			<div class="popular-tools-group">
				<ul class="popular-list">
				</ul>
				<div class="popular-toggle toggle-1"><span class="icon-show"></span><?= wfMsg('oasis-toolbar-edit-popular-tools') ?></div>
				<div class="popular-toggle toggle-0"><span class="icon-hide"></span><?= wfMsg('oasis-toolbar-edit-hide-tools') ?></div>
			</div>
		</div>
 public function getCaruselElement()
 {
     wfProfileIn(__METHOD__);
     $video = $this->getVal('video');
     if (empty($video)) {
         $title = $this->getVal('videoTitle');
         $rvs = F::build('RelatedVideosService');
         $video = $rvs->getRelatedVideoDataFromTitle(array('title' => $title));
     }
     $preloaded = $this->getVal('preloaded');
     $videoTitle = F::build('Title', array($video['id'], NS_FILE), 'newFromText');
     $videoFile = wfFindFile($videoTitle);
     if ($videoFile) {
         $videoThumbObj = $videoFile->transform(array('width' => $video['thumbnailData']['width'], 'height' => $video['thumbnailData']['height']));
         $videoThumb = $videoThumbObj->toHtml(array('custom-url-link' => $video['fullUrl'], 'linkAttribs' => array('class' => 'video-thumbnail lightbox', 'data-video-name' => $video['title'], 'data-external' => $video['external'], 'data-ref' => $video['prefixedUrl']), 'duration' => true, 'src' => $preloaded ? false : wfBlankImgUrl(), 'constHeight' => RelatedVideosService::$height, 'usePreloading' => true, 'disableRDF' => true));
         $video['views'] = MediaQueryService::getTotalVideoViewsByTitle($videoTitle->getDBKey());
         // Add ellipses if title is too long
         $maxDescriptionLength = 45;
         $video['truncatedTitle'] = strlen($video['title']) > $maxDescriptionLength ? substr($video['title'], 0, $maxDescriptionLength) . '&#8230;' : $video['title'];
         $video['viewsMsg'] = wfMsg('related-videos-video-views', $this->wg->ContLang->formatNum($video['views']));
         $userGroups = $this->wg->User->getEffectiveGroups();
         $isAdmin = in_array('admin', $userGroups) || in_array('staff', $userGroups);
         $this->removeTooltip = wfMsg('related-videos-tooltip-remove');
         $this->videoThumb = $videoThumb;
         $this->video = $video;
         $this->preloaded = $preloaded;
         $this->isAdmin = $isAdmin;
     } else {
         Wikia::log(__METHOD__, false, 'A video file not found. ID: ' . $video['id']);
     }
     // set cache control to 1 day
     $this->response->setCacheValidity(86400, 86400, array(WikiaResponse::CACHE_TARGET_BROWSER, WikiaResponse::CACHE_TARGET_VARNISH));
     wfProfileOut(__METHOD__);
 }
Esempio n. 12
0
?>
			<li<?php echo ($counter == 0 ) ? ' class="marked"' : '';
				$counter++;
			?>>
				<a<?= empty( $menuNode0[ NavigationService::SPECIAL ] ) ? '' : ' data-extra="'.$menuNode0[ NavigationService::SPECIAL ].'"' ?> href="<?= $menuNode0[ NavigationService::HREF ] ?>"><?= $menuNode0[ NavigationService::TEXT ] ?></a>
<?php
			if (isset($menuNodes[$level0][ NavigationService::CHILDREN ])) {
?>
				<ul class="subnav-2 accent"<? if ( $firstChild ){ echo ' style="display:block"'; $firstChild = false; } ?>>
<?php
				foreach ($menuNodes[$level0][ NavigationService::CHILDREN ] as $level1) {
					$menuNode1 = $menuNodes[$level1];
					$hasChildNodes = isset($menuNode1[ NavigationService::CHILDREN ]);
?>
					<li>
						<a class="subnav-2a"<?= empty( $menuNode1[ NavigationService::SPECIAL ] ) ? '' : ' data-extra="'.$menuNode1[ NavigationService::SPECIAL ].'"' ?> href="<?= $menuNode1[ NavigationService::HREF ] ?>"<?= empty( $menuNode1[ NavigationService::CANONICAL_NAME ] ) ? '' : ' data-canonical="'.strtolower($menuNode1[ NavigationService::CANONICAL_NAME ]).'"' ?>><?= $menuNode1[ NavigationService::TEXT ] ?><?php if($hasChildNodes):?><img src="<?= wfBlankImgUrl() ?>" class="chevron"><?php endif; ?></a>
<?php
					if ($hasChildNodes) {
?>
						<ul class="subnav subnav-3">
<?php
						foreach ($menuNode1[ NavigationService::CHILDREN ] as $level2) {
							$menuNode2 = $menuNodes[$level2];
?>
							<li>
								<a class="subnav-3a"<?= empty( $menuNode2[ NavigationService::SPECIAL ] ) ? '' : ' data-extra="'.$menuNode2[ NavigationService::SPECIAL ].'"' ?> href="<?= $menuNode2[ NavigationService::HREF ] ?>"><?= $menuNode2[ NavigationService::TEXT ] ?></a>
							</li>
<?php
						}
?>
						</ul>
Esempio n. 13
0
	<h1><?= !empty($displaytitle) ? $title : htmlspecialchars($title) ?></h1>

<?php
	// edit button with actions dropdown
	if (!empty($action)) {
		echo F::app()->renderView('MenuButton', 'Index', array('action' => $action, 'image' => $actionImage, 'dropdown' => $dropdown, 'name' => $actionName));
	}

	// "Add a photo" button
	if (!empty($isNewFiles) && !empty($wg->EnableUploads)) {
		echo Wikia::specialPageLink('Upload', 'oasis-add-photo', (!$isUserLoggedIn ? 'wikia-button upphotoslogin' :'wikia-button upphotos'), 'blank.gif', 'oasis-add-photo-to-wiki', 'sprite photo');
	}

	// "Add a photo" button
	if (!empty($isSpecialVideos) && !empty($wg->EnableUploads)) { ?>
		<a class="button addVideo" href="#" rel="tooltip" title="<?=wfMsg('related-videos-tooltip-add');?>"><img src="<?=wfBlankImgUrl();?>" class="sprite addRelatedVideo" /> <?=wfMsg('videos-add-video')?></a>
	<? }

	// comments & like button
	if( !$isWallEnabled ) {
		echo F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'likes' => $likes));
	}
	foreach( $extraButtons as $button ){
		echo $button;
	}

	// "pages on this wiki" counter
	if (!is_null($tallyMsg)) {
?>
	<div class="tally">
		<?= $tallyMsg ?>
 public function renderImageTag()
 {
     wfProfileIn(__METHOD__);
     $attribs = $this->request->getVal('attributes', []);
     $params = $this->request->getVal('parameters', null);
     $linkAttribs = $this->request->getVal('anchorAttributes', []);
     $noscript = $this->request->getVal('noscript', null);
     $linked = $this->request->getBool('linked', false);
     $content = $this->request->getVal('content');
     $isSmall = $this->request->getVal('isSmall', false);
     // Don't include small or linked images in the mobile modal
     $includeInModal = !$linked && !$isSmall;
     $notClickable = !$linked && $isSmall;
     foreach ($linkAttribs as $linkAttribKey => $linkAttribValue) {
         $linkAttribs[$linkAttribKey] = htmlentities($linkAttribValue, ENT_QUOTES);
     }
     foreach ($attribs as $attribKey => $attribValue) {
         $attribs[$attribKey] = htmlentities($attribValue, ENT_QUOTES);
     }
     $attribs['data-src'] = $attribs['src'];
     $attribs['src'] = wfBlankImgUrl();
     $attribs['class'] = (!empty($attribs['class']) ? "{$attribs['class']} " : '') . self::CLASS_LAZYLOAD . ' ' . ($includeInModal ? ' ' . self::CLASS_MEDIA : '') . ($notClickable ? ' ' . self::CLASS_SMALL : '');
     if (!empty($params)) {
         $attribs['data-params'] = htmlentities(json_encode($params), ENT_QUOTES);
     }
     $this->response->setVal('attributes', $attribs);
     $this->response->setVal('anchorAttributes', $linkAttribs);
     $this->response->setVal('noscript', $noscript);
     $this->response->setVal('content', $content);
     wfProfileOut(__METHOD__);
 }