Esempio n. 1
0
	<form id="search-form">
		<input name="q" <?php 
echo !empty($_GET['q']) ? " value='" . CoreUtils::aposEncode($_GET['q']) . "'" : '';
?>
 title='Search'>
		<button type='submit'  class='blue'>Search</button>
		<button type='button' class='green typcn typcn-flash sanic-button' title="I'm feeling lucky"></button>
		<button type='reset' class='red typcn typcn-times' title='Clear'<?php 
echo empty($_GET['q']) ? ' disabled' : '';
?>
></button>
	</form>
<?  }
	else echo CoreUtils::notice('warn','<span class="typcn typcn-warning"></span> <strong>ElasticSearch server is down!</strong> Please <a class="send-feedback">let us know</a>, and in the meantime, use the <a class="btn darkblue typcn typcn-th-menu" href="/cg'.($EQG?'/eqg':'').'/full">Full List</a> to find appearances faster. Sorry for the inconvenience.',true); ?>
	<?php 
echo $Pagination->HTML . Appearances::getHTML($Ponies) . $Pagination->HTML;
?>
</div>

<?  $export = array(
		'Color' => $Color,
		'color' => $color,
		'EQG' => $EQG,
		'AppearancePage' => false,
	);
	if (Permission::sufficient('staff'))
		$export = array_merge($export, array(
			'TAG_TYPES_ASSOC' => Tags::$TAG_TYPES_ASSOC,
			'MAX_SIZE' => CoreUtils::getMaxUploadSize(),
			'HEX_COLOR_PATTERN' => $HEX_COLOR_REGEX,
		));
Esempio n. 2
0
			<h2 class="admin">Color groups</h2>
			<div class="admin">
				<button class="darkblue typcn typcn-arrow-unsorted reorder-cgs">Re-order groups</button>
				<button class="green typcn typcn-plus create-cg">Create group</button>
			</div>
<?  if ($placehold = Appearances::getPendingPlaceholderFor($Appearance))
		echo $placehold;
	else { ?>
			<ul id="colors" class="colors"><?php
		$CGs = ColorGroups::get($Appearance['id']);
		$AllColors = ColorGroups::getColorsForEach($CGs);
		foreach ($CGs as $cg)
			echo ColorGroups::getHTML($cg, $AllColors, WRAP, NO_COLON, OUTPUT_COLOR_NAMES);
			?></ul>
		</section>
		<?=Appearances::getRelatedHTML(Appearances::getRelated($Appearance['id']))?>
	</div>
<?  } ?>
</div>

<?  $export = array(
		'Color' => $Color,
		'color' => $color,
		'EQG' => $EQG,
		'AppearancePage' => true,
	);
	if (Permission::sufficient('staff'))
		$export = array_merge($export, array(
			'TAG_TYPES_ASSOC' => Tags::$TAG_TYPES_ASSOC,
			'MAX_SIZE' => CoreUtils::getMaxUploadSize(),
			'HEX_COLOR_PATTERN' => $HEX_COLOR_REGEX,
Esempio n. 3
0
 static function getAppearancesSectionHTML(Episode $Episode) : string
 {
     global $CGDb, $Color;
     $HTML = '';
     $EpTagIDs = Episodes::getTagIDs($Episode);
     if (!empty($EpTagIDs)) {
         $TaggedAppearances = $CGDb->rawQuery("SELECT p.id, p.label, p.private\n\t\t\t\tFROM tagged t\n\t\t\t\tLEFT JOIN appearances p ON t.ponyid = p.id\n\t\t\t\tWHERE t.tid IN (" . implode(',', $EpTagIDs) . ") && p.ishuman = ?\n\t\t\t\tORDER BY p.label", array($Episode->isMovie));
         if (!empty($TaggedAppearances)) {
             $hidePreviews = UserPrefs::get('ep_noappprev');
             $pages = CoreUtils::makePlural('page', count($TaggedAppearances));
             $HTML .= "<section class='appearances'><h2>Related <a href='/cg'>{$Color} Guide</a> {$pages}</h2>";
             $LINKS = '<ul>';
             $isStaff = Permission::sufficient('staff');
             foreach ($TaggedAppearances as $p) {
                 $safeLabel = Appearances::getSafeLabel($p);
                 if (Appearances::isPrivate($p, true)) {
                     $preview = "<span class='typcn typcn-" . ($isStaff ? 'lock-closed' : 'time') . " color-" . ($isStaff ? 'orange' : 'darkblue') . "'></span> ";
                 } else {
                     if ($hidePreviews) {
                         $preview = '';
                     } else {
                         $preview = Appearances::getPreviewURL($p);
                         $preview = "<img src='{$preview}' class='preview'>";
                     }
                 }
                 $LINKS .= "<li><a href='/cg/v/{$p['id']}-{$safeLabel}'>{$preview}{$p['label']}</a></li>";
             }
             $HTML .= "{$LINKS}</ul></section>";
         }
     }
     return $HTML;
 }
Esempio n. 4
0
    if (!empty($search['hits']['hits'])) {
        $ids = [];
        foreach ($search['hits']['hits'] as $hit) {
            $ids[] = $hit['_id'];
        }
        $Ponies = $CGDb->where('id IN (' . implode(',', $ids) . ')')->orderBy('order', 'ASC')->get('appearances');
    }
}
if (!$elasticAvail) {
    $_EntryCount = $CGDb->where('ishuman', $EQG)->where('id != 0')->count('appearances');
    $Pagination = new Pagination('cg', $AppearancesPerPage, $_EntryCount);
    $Ponies = Appearances::get($EQG, $Pagination->getLimit());
}
if (isset($_REQUEST['GOFAST'])) {
    if (empty($Ponies[0]['id'])) {
        Response::fail('The search returned no results.');
    }
    Response::done(array('goto' => "{$CGPath}/v/{$Ponies[0]['id']}-" . Appearances::getSafeLabel($Ponies[0])));
}
CoreUtils::fixPath("{$CGPath}/{$Pagination->page}" . (!empty($Restrictions) ? "?q={$SearchQuery}" : ''));
$heading = ($EQG ? 'EQG ' : '') . "{$Color} Guide";
$title .= "Page {$Pagination->page} - {$heading}";
if (isset($_GET['js'])) {
    $Pagination->respond(Appearances::getHTML($Ponies, NOWRAP), '#list');
}
$settings = array('title' => $title, 'heading' => $heading, 'css' => array($do), 'js' => array('jquery.qtip', 'jquery.ctxmenu', $do, 'paginate'));
if (Permission::sufficient('staff')) {
    $settings['css'] = array_merge($settings['css'], $GUIDE_MANAGE_CSS);
    $settings['js'] = array_merge($settings['js'], $GUIDE_MANAGE_JS);
}
CoreUtils::loadPage($settings);
Esempio n. 5
0
use App\Appearances;
use App\DeviantArt;
use App\JSON;
use App\Permission;
use App\UserPrefs;
use App\Users;
use App\CoreUtils;
/** @var $signedIn bool */
$Title = (isset($title) ? $title . ' - ' : '') . SITE_TITLE;
$Description = "Handling requests, reservations & the Color Guide since 2015";
$ThumbImage = "/img/logo.png";
switch ($do ?? null) {
    case "colorguide":
        if (!empty($Appearance)) {
            $sprite = Appearances::getSpriteURL($Appearance['id']);
            if ($sprite) {
                $ThumbImage = $sprite;
            }
            $Description = 'Show accurate colors for "' . $Appearance['label'] . '" from the MLP-VectorClub\'s Official Color Guide';
        }
        break;
    case "s":
        if (!empty($LinkedPost)) {
            if (!$LinkedPost->isFinished) {
                $ThumbImage = $LinkedPost->preview;
            } else {
                $finishdeviation = DeviantArt::getCachedSubmission($LinkedPost->deviation_id);
                if (!empty($finishdeviation['preview'])) {
                    $ThumbImage = $finishdeviation['preview'];
                }