add Фотографии избранных авторов

This commit is contained in:
themohooks 2024-07-19 01:53:43 +03:00
parent 005c93ae0e
commit 099bc1b2c5
5 changed files with 72 additions and 2 deletions

View file

@ -36,6 +36,11 @@ class MainController
{ {
Page::set('Top30'); Page::set('Top30');
}
public static function favauthors()
{
Page::set('FavAuthors');
} }
public static function logout() public static function logout()

View file

@ -33,6 +33,8 @@ class Routes
Router::get('/lk/history', 'ProfileController@lkhistory'); Router::get('/lk/history', 'ProfileController@lkhistory');
Router::get('/lk/profile', 'ProfileController@lkprofile'); Router::get('/lk/profile', 'ProfileController@lkprofile');
Router::get('/fav_authors', 'MainController@favauthors');
Router::get('/search', 'SearchController@i'); Router::get('/search', 'SearchController@i');
Router::post('/api/upload', 'ApiController@upload'); Router::post('/api/upload', 'ApiController@upload');

View file

@ -40,6 +40,7 @@ if (NGALLERY['root']['title'] != null && NGALLERY['root']['showtitle'] === true)
<ul class="mm-level-2"> <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="/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> <li><a href="/feed.php" class="mm-item"><span class="mm-label">Лента обновлений</span></a></li>
<li><a href="/fav_authors" class="mm-item"><span class="mm-label">Фотографии избранных авторов</span></a></li>
<li><a href="/update.php" class="mm-item"><span class="mm-label">Архив обновлений по датам</span></a></li> <li><a href="/update.php" class="mm-item"><span class="mm-label">Архив обновлений по датам</span></a></li>
</ul> </ul>
</div> </div>

View file

@ -0,0 +1,62 @@
<?php
use \App\Services\{Auth, DB, Date};
use \App\Models\{User, Photo};
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/LoadHead.php'); ?>
</head>
<body>
<div id="backgr"></div>
<table class="tmain">
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
<tr>
<td class="main">
<h1>Фотографии избранных авторов</h1>
<?php
$followimgs = DB::query('SELECT * FROM followers_notifications WHERE follower_id=:id', array(':id'=>Auth::userid()));
foreach ($followimgs as $f) {
$author = new User($p['user_id']);
$p = new Photo($f['photo_id']);
echo ' <div class="p20p">
<table>
<tr>
<td class="pb_photo" id="p1941865"><a href="/photo/'.$f['photo_id'].'/" target="_blank" class="prw"><img class="f" src="'.$p['photourl'].'" alt="620 КБ">
<div class="hpshade">
<div class="eye-icon">'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'</div>
</div>
</a></td>
<td class="pb_descr">
<p><b class="pw-place">'.htmlspecialchars($p['place']).'</b></p>
<span class="pw-descr">'.htmlspecialchars($p['postbody']).'</span>
<p class="sm"><b>'.Date::zmdate($p['timeupload']).'</b><br>Автор: <a href="/author/'.$author->i('user_id').'/">'.htmlspecialchars($author->i('username')).'</a></p>
</td>
</tr>
</table>
</div>';
}
?>
</td>
</tr>
<tr>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
</tr>
</table>
</body>
</html>

View file

@ -251,10 +251,10 @@ if (DB::query('SELECT follower_id FROM followers WHERE user_id=:userid AND follo
$class = 'on'; $class = 'on';
} }
?> ?>
<div><div class="toggle <?=$class?>"><div class="handle"></div></div> &nbsp;<label class="toggle-label"><b>Подписка на новые фотографии этого автора</b> (подписаны: <b id="subscr_cnt"><?=DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid'=>$userprofile->i('id')))[0]['COUNT(*)'];?></b>)</label></div> <div style="margin-top: 8px;"><div class="toggle <?=$class?>"><div class="handle"></div></div> &nbsp;<label class="toggle-label"><b>Подписка на новые фотографии этого автора</b> (подписаны: <b id="subscr_cnt"><?=DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid'=>$userprofile->i('id')))[0]['COUNT(*)'];?></b>)</label></div>
<?php } else { ?> <?php } else { ?>
<div>Пользователей, подписанных на мои фотографии: <b><?=DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid'=>$userprofile->i('id')))[0]['COUNT(*)'];?></b></div> <div style="margin-top: 8px;">Пользователей, подписанных на мои фотографии: <b><?=DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid'=>$userprofile->i('id')))[0]['COUNT(*)'];?></b></div>
<?php } ?> <?php } ?>
<?php } else { ?> <?php } else { ?>
<center><h1>Пользователь не найден</h1></center> <center><h1>Пользователь не найден</h1></center>