nativegallery-weryskok/views/components/Navbar.php

124 lines
8.4 KiB
PHP
Raw Permalink Normal View History

2024-07-05 06:09:25 +03:00
<?php
2024-07-18 19:09:32 +03:00
use \App\Services\{Auth, DB};
2024-07-05 06:09:25 +03:00
use \App\Models\User;
$user = new \App\Models\User(Auth::userid());
2024-07-06 10:28:50 +03:00
if (NGALLERY['root']['logo'] != null) {
$logo = NGALLERY['root']['logo'];
} else {
$logo = '/static/img/logosmall.png';
}
2024-07-09 01:02:18 +03:00
if (NGALLERY['root']['title'] != null && NGALLERY['root']['showtitle'] === true) {
2024-07-06 10:28:50 +03:00
$title = NGALLERY['root']['title'];
2024-07-09 01:02:18 +03:00
} else if (NGALLERY['root']['showtitle'] === false) {
$title = '';
2024-07-06 10:28:50 +03:00
} else {
$title = 'NativeGallery';
}
2024-07-20 23:54:28 +03:00
$noncheckedimgs = DB::query('SELECT COUNT(*) FROM followers_notifications WHERE checked=0 AND follower_id=:id', array(':id'=>Auth::userid()))[0]['COUNT(*)'];
if ($noncheckedimgs > 0) {
$nonrw = '<span class="mm-notify notify-count">'.$noncheckedimgs.'</span>';
}
2024-07-06 10:28:50 +03:00
2024-07-05 06:09:25 +03:00
?>
2024-07-04 12:36:23 +03:00
<tr>
2024-07-05 06:09:25 +03:00
<td class="mm-bar">
2024-07-20 23:29:38 +03:00
<?php
if (explode('/', $_SERVER['REQUEST_URI'])[1] === 'photo') { ?>
<a id="title-small" href="/"><img src="<?=$logo?>"><?=$title?></a>
<?php } ?>
2024-07-05 06:09:25 +03:00
<ul class="mm mm-level-1">
<li><a href="#" onclick="return false" class="mm-item"><span class="mm-label">Дополнительно</span></a>
<div>
<ul class="mm-level-2">
<li><a href="/news.php" class="mm-item"><span class="mm-label">Новости и хронология</span></a></li>
<li><a href="/misc/" class="mm-item"><span class="mm-label">Разные фотогалереи</span></a></li>
<li><a href="/voting.php" class="mm-item"><span class="mm-label">Фотоконкурс</span></a></li>
<li><a href="/news2.php" class="mm-item"><span class="mm-label">Новости сайта</span></a></li>
<li><a href="/links.php" class="mm-item"><span class="mm-label">Ссылки</span></a></li>
</ul>
</div>
</li>
<li><a href="/comments.php" class="mm-item"><span class="mm-label">Комментарии</span></a></li>
2024-07-20 23:54:28 +03:00
<li><a href="#" onclick="return false" class="mm-item"><span class="mm-label">Обновления</span><?=$nonrw?></a>
2024-07-05 06:09:25 +03:00
<div>
<ul class="mm-level-2">
<li><a href="/update.php?time=24" class="mm-item"><span class="mm-label">Новые фотографии</span></a></li>
<li><a href="/feed.php" class="mm-item"><span class="mm-label">Лента обновлений</span></a></li>
2024-07-20 23:54:28 +03:00
<li><a href="/fav_authors" class="mm-item"><span class="mm-label">Фотографии избранных авторов</span><?=$nonrw?></a></li>
2024-07-05 06:09:25 +03:00
<li><a href="/update.php" class="mm-item"><span class="mm-label">Архив обновлений по датам</span></a></li>
</ul>
</div>
</li>
<li><a href="/help/" class="mm-item"><span class="mm-label">Помощь</span></a>
<div>
<ul class="mm-level-2">
<li><a href="/rules/" class="mm-item"><span class="mm-label">Правила сайта</span></a></li>
<li><a href="/rules/pub/" class="mm-item"><span class="mm-label">Критерии отбора фотографий</span></a></li>
<li><a href="/rules/photo/" class="mm-item"><span class="mm-label">Правила подписи фотографий</span></a></li>
<li><a href="/rules/video/" class="mm-item"><span class="mm-label">Правила видеокаталога</span></a></li>
</ul>
</div>
</li>
<li><a href="/search.php" class="mm-item"><span class="mm-label">Поиск</span></a>
<div>
<ul class="mm-level-2">
<li><a href="/search.php" class="mm-item"><span class="mm-label">Поиск фотографий</span></a></li>
<li><a href="/vsearch.php" class="mm-item"><span class="mm-label">Поиск ТС</span></a></li>
<li><a href="/csearch.php" class="mm-item"><span class="mm-label">Поиск комментариев</span></a></li>
<li><a href="/authors.php" class="mm-item"><span class="mm-label">Поиск авторов</span></a></li>
</ul>
</div>
</li>
<?php
2024-07-07 08:05:44 +03:00
if (Auth::userid() <= 0) { ?>
2024-07-18 19:58:37 +03:00
2024-07-05 06:09:25 +03:00
<li class="mm-pad-right"><a href="/login" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-address-card"></i></span><span class="mm-label">Войти</span></a></li>
<li><a href="/register" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-user"></i></span><span class="mm-label">Регистрация</span></a></li>
<?php } else { ?>
2024-07-18 19:58:37 +03:00
<?php
2024-07-18 19:09:32 +03:00
if ($user->i('admin') > 0) {
$nonreviewedimgs = DB::query('SELECT COUNT(*) FROM photos WHERE moderated=0')[0]['COUNT(*)'];
if ($nonreviewedimgs > 0) {
$nonr = '<span class="mm-notify notify-count">'.$nonreviewedimgs.'</span>';
}
2024-07-18 19:58:37 +03:00
}
?>
<li class="mm-pad-right mm-wide"><a href="/author/<?=Auth::userid()?>/" class="mm-item"><span class="mm-icon"><i class="fas fa-xs fa-user"></i></span><span class="mm-label"><?=$user->i('username')?></span><?=$nonr?></a>
<div>
<ul class="mm-level-2">
<li><a href="/lk/" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-info-circle"></i></span><span class="mm-label">Общая информация</span></a></li>
<?php
if ($user->i('admin') > 0) {
2024-07-18 19:09:32 +03:00
?>
<li><a href="/admin" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-info-circle"></i></span><span class="mm-label">Admin</span><?=$nonr?></a></li>
2024-07-10 12:30:10 +03:00
<?php } ?>
2024-07-21 01:39:54 +03:00
<li><a href="/lk/upload" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-plus-square"></i></span><span class="mm-label"><b>Предложить медиа</b></span></a></li>
2024-07-05 12:58:12 +03:00
<li><a href="/lk/history" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-images"></i></span><span class="mm-label">Журнал</span></a></li>
2024-07-05 06:09:25 +03:00
<li><a href="/lk/konkurs.php" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-compass"></i></span><span class="mm-label">Конкурс</span></a></li>
<li><a href="/lk/vehicles.php" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-folder-plus"></i></span><span class="mm-label"><b>Правка БД</b></span></a></li>
<li><a href="/lk/ticket.php" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-question-circle"></i></span><span class="mm-label">Мои заявки</span></a></li>
2024-07-05 15:03:35 +03:00
<li><a href="/lk/profile" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-cog"></i></span><span class="mm-label">Настройки профиля</span></a></li>
2024-07-12 00:45:53 +03:00
<li><a href="/search?id=<?=Auth::userid()?>" class="mm-item"><span class="mm-icon"><i class="far fa-sm fa-fw fa-images"></i></span><span class="mm-label">Мои фотографии</span></a></li>
2024-07-05 06:09:25 +03:00
<li><a href="/fav.php" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-star"></i></span><span class="mm-label">Избранные снимки</span></a></li>
2024-07-08 23:04:37 +03:00
<li><a href="/logout" class="mm-item"><span class="mm-icon"><i class="fas fa-sm fa-fw fa-sign-out-alt"></i></span><span class="mm-label">Выход</span></a></li>
2024-07-05 06:09:25 +03:00
</ul>
</div>
</li>
<?php } ?>
</ul>
</td>
</tr>
2024-07-20 23:29:38 +03:00
<?php
if (explode('/', $_SERVER['REQUEST_URI'])[1] != 'photo') { ?>
2024-07-05 06:09:25 +03:00
<tr>
2024-07-06 10:28:50 +03:00
<td><a href="/" id="title"><img src="<?=$logo?>" alt="<?=$title?>"><span><?=$title?></span></a></td>
2024-07-20 23:29:38 +03:00
</tr>
<?php } ?>