107 lines
4.1 KiB
PHTML
107 lines
4.1 KiB
PHTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<?php if (isset($this->context->subTitle)): ?>
|
|
<title><?php printf('%s – %s', $this->context->title, $this->context->subTitle) ?></title>
|
|
<?php else: ?>
|
|
<title><?php echo $this->context->title ?></title>
|
|
<?php endif ?>
|
|
<?php foreach (array_unique($this->context->stylesheets) as $name): ?>
|
|
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>"/>
|
|
<?php endforeach ?>
|
|
<?php foreach (array_unique($this->context->scripts) as $name): ?>
|
|
<script type="text/javascript" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/js/' . $name) ?>"></script>
|
|
<?php endforeach ?>
|
|
</head>
|
|
|
|
<body>
|
|
<nav id="top-nav">
|
|
<div class="main-wrapper">
|
|
<ul class="main-nav">
|
|
<?php
|
|
$nav = [];
|
|
|
|
$nav []= ['Home', \Chibi\UrlHelper::route('index', 'index')];
|
|
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
|
$nav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')];
|
|
|
|
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
|
$nav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];
|
|
|
|
if (PrivilegesHelper::confirm(Privilege::UploadPost))
|
|
$nav []= ['Upload', \Chibi\UrlHelper::route('post', 'upload')];
|
|
|
|
if (PrivilegesHelper::confirm(Privilege::ListComments))
|
|
$nav []= ['Comments', \Chibi\UrlHelper::route('comment', 'list')];
|
|
|
|
if (PrivilegesHelper::confirm(Privilege::ListTags))
|
|
$nav []= ['Tags', \Chibi\UrlHelper::route('tag', 'list')];
|
|
|
|
if (PrivilegesHelper::confirm(Privilege::ListUsers))
|
|
$nav []= ['Users', \Chibi\UrlHelper::route('user', 'list')];
|
|
|
|
if (!$this->context->loggedIn)
|
|
{
|
|
$nav []= ['Log in', \Chibi\UrlHelper::route('auth', 'login')];
|
|
$nav []= ['Register', \Chibi\UrlHelper::route('user', 'registration')];
|
|
}
|
|
else
|
|
{
|
|
$nav []= ['My account', \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->user->name])];
|
|
$nav []= ['Log out', \Chibi\UrlHelper::route('auth', 'logout')];
|
|
}
|
|
|
|
$nav []= ['Help', \Chibi\UrlHelper::route('index', 'help')];
|
|
|
|
foreach ($nav as $navItem)
|
|
{
|
|
list ($text, $link) = $navItem;
|
|
echo '<li class="main-nav-item">';
|
|
echo '<a href="' . $link . '">' . $text . '</a>';
|
|
echo '</li>';
|
|
}
|
|
?>
|
|
|
|
<?php if ($this->context->loggedIn): ?>
|
|
<li class="safety">
|
|
<ul>
|
|
<?php foreach (PostSafety::getAll() as $safety): ?>
|
|
<?php if (PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety))): ?>
|
|
<li class="safety-<?php echo TextHelper::camelCaseToHumanCase(PostSafety::toString($safety)) ?>">
|
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'toggle-safety', ['safety' => $safety]) ?>" class="<?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>" title="Searching <?php echo TextHelper::camelCaseToHumanCase(PostSafety::ToString($safety)) ?> posts: <?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>">
|
|
<span><?php echo TextHelper::camelCaseToHumanCase(PostSafety::toString($safety), true) ?></span>
|
|
</a>
|
|
</li>
|
|
<?php endif ?>
|
|
<?php endforeach ?>
|
|
</ul>
|
|
</li>
|
|
<?php endif ?>
|
|
|
|
<li class="search">
|
|
<form name="search" action="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
|
|
<input type="search" name="query" placeholder="Search…" value="<?php echo isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '' ?>">
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
<div class="clear"></div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section id="content">
|
|
<div class="main-wrapper">
|
|
<?php echo $this->renderView() ?>
|
|
<div class="clear"></div>
|
|
</div>
|
|
</section>
|
|
|
|
<footer>
|
|
<div class="main-wrapper">
|
|
Load: <?php echo sprintf('%.05f', microtime(true) - trueStartTime()) ?>s
|
|
|
|
Queries: <?php echo count(queryLogger()->getLogs()) ?>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|