function testNotice() { $exception = false; try { CoreUtils::notice('invalid type', 'asd'); } catch (Exception $e) { $exception = true; } self::assertTrue($exception, 'Invalid notice type must throw exception'); $result = CoreUtils::notice('info', 'text'); self::assertEquals("<div class='notice info'><p>text</p></div>", $result); $result = CoreUtils::notice('info', 'title', 'text'); self::assertEquals("<div class='notice info'><label>title</label><p>text</p></div>", $result); $result = CoreUtils::notice('info', 'title', "mutliline\n\nnotice"); self::assertEquals("<div class='notice info'><label>title</label><p>mutliline</p><p>notice</p></div>", $result); }
</tr> </tbody> </table> <input type="submit" class="hidden"> </form> <span></span> <div class="result"> <div class="preview"></div> <span class="hex" data-color="<?php echo $color; ?> "></span> <span class="hexa" data-color="<?php echo $color; ?> "></span> <span class="rgba" data-color="<?php echo $color; ?> "></span> <span class="opacity" data-color="value"></span> </div> </div> <div class="hidden delta-warn"> <?php echo CoreUtils::notice('warn', "<span class='typcn typcn-warning'></span> The result may not be accurate as the difference between the optimal {$color} and the closest match is too large", true); ?> </div> </div> <? echo CoreUtils::exportVars(array('HEX_COLOR_PATTERN' => $HEX_COLOR_REGEX));
</p> <? if ($elasticAvail){ ?> <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(),
</section> <?php } echo Appearances::getRelatedEpisodesHTML($Appearance, $EQG); if (!empty($Appearance['notes'])){ ?> <section> <h2><span class='typcn typcn-info-large'></span>Additional notes</h2> <p id="notes"><?=Appearances::getNotesHTML($Appearance, NOWRAP, NOTE_TEXT_ONLY)?></p> </section> <? } if (!empty($Appearance['cm_favme'])){ $preview = Appearances::getCMPreviewURL($Appearance); ?> <section class="approved-cutie-mark"> <h2>Recommended cutie mark vector</h2> <?=Permission::sufficient('staff')&&!isset($Appearance['cm_dir'])?CoreUtils::notice('fail','Missing CM orientation, falling back to <strong>Tail-Head</strong>. Please edit the appaearance and provide an orientation!'):''?> <a id="pony-cm" href="http://fav.me/<?=$Appearance['cm_favme']?>" style="background-image:url('<?=Appearances::getCMPreviewSVGURL($Appearance['id'])?>')"> <div class="img cm-dir-<?=$Appearance['cm_dir']===CM_DIR_HEAD_TO_TAIL?'ht':'th'?>" style="background-image:url('<?=CoreUtils::aposEncode($preview)?>')"></div> </a> <p class="aside">This is only an illustration, the body shape & colors are <strong>not</strong> guaranteed to reflect the actual design.</p> <p>The image above links to the vector made by <?php $Vector = DeviantArt::getCachedSubmission($Appearance['cm_favme']); echo Users::get($Vector['author'],'name','name, avatar_url')->getProfileLink(User::LINKFORMAT_FULL); ?> and shows which way the cutie mark should be facing.</p> </section> <? } ?> <section class="color-list"> <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>
<? if (isset($browser['browser_name'])){ ?> <div class="browser-<?php echo CoreUtils::browserNameToClass($browser['browser_name']); ?> "></div> <? } ?> <h1><?php echo rtrim(($browser['browser_name'] ?? 'Unknown browser') . ' ' . ($browser['browser_ver'] ?? '')); ?> </h1> <p><?php echo !empty($browser['platform']) ? "on {$browser['platform']}" : 'Unknown platform'; ?> </p> <?php echo !empty($Session) ? CoreUtils::notice('warn', "You're debugging session #{$Session['id']} (belongs to " . Users::get($Session['user'])->getProfileLink() . ")") : ''; ?> <?php echo CoreUtils::notice('info', 'Browser recognition testing page', "The following page is used to make sure that the site's browser detection script works as it should. If you're seeing a browser and/or operating system that's different from what you're currently using, please <a class='send-feedback'>let us know.</a>"); ?> <section> <h2>Your User Agent string</h2> <p><code><?php echo !empty($browser['user_agent']) ? CoreUtils::escapeHTML($browser['user_agent']) : '<empty>'; ?> </code></p> </section> </div>
<?php switch ($errcause) { case "db": ?> <h1>Database connection error</h1> <p>Could not connect to database on <?php echo DB_HOST; ?> </p> <?php echo CoreUtils::notice('info', '<span class="typcn typcn-info-large"></span> The database of our website cannot be reached. Hopefully this is just a temporary issue and everything will be back to normal soon. Sorry for the inconvenience. <a class="send-feedback">Notify the developer</a>', true); echo CoreUtils::notice('warn', '<strong>Probable cause / debug information:</strong><pre><code>' . $e->getMessage() . '</code></pre>', true); break; case "libmiss": ?> <h1>Configuration problem</h1> <p>A required extension/setting is missng</p> <?php echo CoreUtils::notice('info', '<span class="typcn typcn-info-large"></span> One of the site\'s core modules have not been installed yet. This usually happens after a software upgrade/reinstall and is just a temporary issue, no data has been lost and everything will be back to normal very soon. Sorry for the inconvenience. <a class="send-feedback">Notify the developer</a>', true); echo CoreUtils::notice('warn', '<strong>Probable cause / debug information:</strong><pre><code>' . $e->getMessage() . '</code></pre>', true); break; } ?> </div> <?php echo CoreUtils::exportVars(array('ServiceUnavailableError' => true)); $customJS = array("/js/min/global.js", "/js/min/moment.js", "/js/min/dialog.js"); foreach ($customJS as $k => $el) { $customJS[$k] .= '?' . filemtime(APPATH . CoreUtils::substring($el, 1)); } require "footer.php";
<button id="cg-relations" class="typcn typcn-pencil large darkblue">Guide relations</button> </p> </section> <?php } echo Posts::getReservationsSection(null, false, true); echo Posts::getRequestsSection(null, false, true); $export = array('SEASON' => $CurrentEpisode->season, 'EPISODE' => $CurrentEpisode->episode); if (Permission::sufficient('developer')) { $export['USERNAME_REGEX'] = $USERNAME_REGEX; } if ($signedIn) { $export['FULLSIZE_MATCH_REGEX'] = $FULLSIZE_MATCH_REGEX; } echo CoreUtils::exportVars($export); } else { ?> <h1>There's nothing here yet…</h1> <p>…but there will be!</p> <?php if (Permission::sufficient('staff')) { echo CoreUtils::notice('info', 'No episodes found', "To make the site functional, you must add an episode to the database first. Head on over to the <a href='/episodes'>Episodes</a> page and add one now!"); } } ?> </div> <? if (Permission::sufficient('staff')) echo CoreUtils::exportVars(array('EP_TITLE_REGEX' => $EP_TITLE_REGEX));
use App\CoreUtils; $about = file_get_contents(INCPATH . 'views/about.html'); if (!empty($about)) { echo str_replace(GITHUB_URL . '/blob/master/www', '', $about); $osver = About::getServerOS(); $phpver = About::getPHPVersion(); $server = About::getServerSoftware(); $pgver = About::getPostgresVersion(); $esver = About::getElasticSearchVersion(); $elastic = isset($esver) ? ", ElasticSearch {$esver}" : ''; echo <<<HTML <strong>Server Software:</strong> {$osver}, PHP {$phpver}, {$server}, PostgreSQL {$pgver}{$elastic}<br> </section> HTML; } else { echo CoreUtils::notice('warn', 'This section went missing due to a bug, and will be restored ASAP. Until then the section\'s contents are available at <a href="' . GITHUB_URL . '#attributions">' . GITHUB_URL . '#attributions</a>'); } ?> <section> <h2>Statistics</h2> <p>Here you can see various graphs about the site. The information below is cached to reduce server load, you can see when each graph was last updated below their title.</p> <div id="stats"> <div class="stats-posts"> <h3>Posts in the last 2 months</h3> <div class="stats-wrapper"> <canvas></canvas> </div> <div class="legend"></div> </div> <div class="stats-approvals"> <h3>Post approvals in the last 2 months</h3>