Photos history

This commit is contained in:
themohooks 2024-07-05 12:21:52 +03:00
parent e61a04ab7c
commit f6aa6bcdad
5 changed files with 104 additions and 22 deletions

View file

@ -11,7 +11,7 @@ class ProfileController
public static function lk() public static function lk()
{ {
Page::set('Profile/LK'); Page::set('Profile/LK/Index');
} }
public static function i() public static function i()
{ {
@ -21,6 +21,10 @@ class ProfileController
{ {
Page::set('Profile/UploadPhoto'); Page::set('Profile/UploadPhoto');
} }
public static function lkhistory()
{
Page::set('Profile/LK/History');
}
} }

View file

@ -28,6 +28,7 @@ class Routes
if (Auth::userid() > 0) { if (Auth::userid() > 0) {
Router::get('/lk', 'ProfileController@lk'); Router::get('/lk', 'ProfileController@lk');
Router::get('/lk/upload', 'ProfileController@upload'); Router::get('/lk/upload', 'ProfileController@upload');
Router::get('/lk/history', 'ProfileController@lkhistory');
Router::post('/api/upload', 'ApiController@upload'); Router::post('/api/upload', 'ApiController@upload');
Router::post('/api/photo/comment', 'ApiController@photocomment'); Router::post('/api/photo/comment', 'ApiController@photocomment');
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload'); Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');

View file

@ -3,7 +3,7 @@
use \App\Services\{Auth, DB, Date}; use \App\Services\{Auth, DB, Date};
use \App\Models\User; use \App\Models\User;
$user = new User(explode('/', $_SERVER['REQUEST_URI'])[2]); $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
@ -21,9 +21,9 @@ $user = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?> <?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
<tr> <tr>
<td class="main"> <td class="main">
<h1><?= $user->i('username') ?></h1> <h1><?= $userprofile->i('username') ?></h1>
<?php <?php
if ($user->i('id') === Auth::userid()) { ?> if ($userprofile->i('id') === Auth::userid()) { ?>
<p><b><a href="/lk/profile">Редактировать мой профиль</a></b></p> <p><b><a href="/lk/profile">Редактировать мой профиль</a></b></p>
<?php } ?> <?php } ?>
<table width="100%"> <table width="100%">
@ -33,35 +33,24 @@ $user = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<table> <table>
<col width="170px"> <col width="170px">
<?php <?php
if ($user->content('location') !== null) { ?> if ($userprofile->content('location') !== null) { ?>
<tr> <tr>
<td class="sm" style="padding:3px 10px 3px 0">Откуда:</td> <td class="sm" style="padding:3px 10px 3px 0">Откуда:</td>
<td><?= $user->content('location') ?></td> <td><?= $userprofile->content('location') ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<tr> <tr>
<td class="sm" style="padding:3px 10px 3px 0">Дата регистрации:</td> <td class="sm" style="padding:3px 10px 3px 0">Дата регистрации:</td>
<td><span class="sm"><?= Date::zmdate($user->content('regdate')) ?></span></td> <td><span class="sm"><?= Date::zmdate($userprofile->content('regdate')) ?></span></td>
</tr>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Рейтинг:</td>
<td><span class="sm">фото <b>0</b>, комментарии <b>+1</b></span></td>
</tr>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Время у пользователя:</td>
<td><span class="sm"><b>06:22</b></span></td>
</tr> </tr>
<tr> <tr>
<td class="sm" style="padding:3px 10px 3px 0">Был на сайте:</td> <td class="sm" style="padding:3px 10px 3px 0">Был на сайте:</td>
<td><span class="sm"><?= Date::zmdate($user->i('online')) ?> <?php if (time() - 300 <= $user->i('online')) { ?>(<b>online</b>)<?php } ?></span></td> <td><span class="sm"><?= Date::zmdate($userprofile->i('online')) ?> <?php if (time() - 300 <= $userprofile->i('online')) { ?>(<b>online</b>)<?php } ?></span></td>
</tr> </tr>
</table> </table>
</div><br /> </div><br />
<div class="sm" style="float:right"><a href="/lk/ticket.php?action=add&amp;aid=140"></a></div> <div class="sm" style="float:right"><a href="/lk/ticket.php?action=add&amp;aid=140"></a></div>
<div>Пользователей, подписанных на мои фотографии: <b>2</b></div><br>
<div><b><a href="/comments.php?w-aid=140">Комментарии, написанные этим пользователем</a><br />
<a href="/favorites/?aid=140&amp;type=1">Избранное пользователя</a></b></div>
<p><b><a href="/lk/pm.php?action=new&amp;to=140">Отправить личное сообщение пользователю</a></b></p>
</td> </td>
<td valign="top" align="right"> <td valign="top" align="right">
<script> <script>
@ -70,7 +59,7 @@ $user = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
} }
function showUserPhoto() { function showUserPhoto() {
_getID('userphoto_big_img').src = '<?= $user->i('photourl') ?>'; _getID('userphoto_big_img').src = '<?= $userprofile->i('photourl') ?>';
_getID('userphoto_big_div').style.top = '' + (getBodyScrollTop() + 10) + 'px'; _getID('userphoto_big_div').style.top = '' + (getBodyScrollTop() + 10) + 'px';
_getID('userphoto_big_div').style.display = 'block'; _getID('userphoto_big_div').style.display = 'block';
} }
@ -92,7 +81,7 @@ $user = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<div style="margin-top:8px"><a class="dot" href="#" onclick="hideUserPhoto(); return false">закрыть</a></div> <div style="margin-top:8px"><a class="dot" href="#" onclick="hideUserPhoto(); return false">закрыть</a></div>
</div> </div>
<a href="<?= $user->i('photourl') ?>" onclick="showUserPhoto(); return false;"><img src="<?= $user->i('photourl') ?>" alt="" id="userphoto_img" class="f" style="width:auto; max-width:100px"></a> <a href="<?= $userprofile->i('photourl') ?>" onclick="showUserPhoto(); return false;"><img src="<?= $userprofile->i('photourl') ?>" alt="" id="userphoto_img" class="f" style="width:auto; max-width:100px"></a>
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -0,0 +1,88 @@
<?php
use \App\Services\{Auth, DB, Date};
use \App\Models\User;
//$userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
?>
<!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>
<script src="/js/diff.js"></script>
<script src="/js/pwrite-compare.js"></script>
<div class="sm">
<div class="p20 s1" style="float:left; padding:1px 5px 2px; margin-right:15px">В рассмотрении</div>
<div class="p20 s2" style="float:left; padding:1px 5px 2px; margin-right:15px">Принято</div>
<div class="p20 s7" style="float:left; padding:1px 5px 2px; margin-right:15px">Принято условно</div>
<div class="p20 s9" style="float:left; padding:1px 5px 2px; margin-right:15px">Принято как временное</div>
<div class="p20 s3" style="float:left; padding:1px 5px 2px; margin-right:15px">Задержано до исправления замечаний</div>
<div class="p20 s5" style="float:left; padding:1px 5px 2px; margin-right:15px">Не подходит для сайта</div>
<div class="p20 s8" style="float:left; padding:1px 5px 2px; margin-right:15px">Удалено</div>
</div><br clear="all"><br>
<div class="sm">Сортировка фотографий:&ensp;<b>в порядке загрузки</b>&ensp;·&ensp;<a href="/set.php?lk_upl_sort=1">в порядке выхода из очереди</a>&ensp;·&ensp;<a href="/set.php?lk_upl_sort=2">сначала неопубликованные (в порядке загрузки)</a></div><br>
<div class="p20w" style="display:block">
<table>
<tbody>
<tr>
<th width="100">Изображение</th>
<th width="90%">Информация</th>
<th></th>
<th class="c nw">Покинуло очередь</th>
</tr>
<?php
$photos = DB::query('SELECT * FROM photos WHERE user_id=:uid ORDER BY id DESC', array(':uid'=>Auth::userid()));
foreach ($photos as $p) {
$author = new User($p['user_id']);
echo ' <tr class="s12">
<td class="pb-photo pb_photo">
<a href="/photo/'.$p['id'].'/" target="_blank" class="prw">
<img src="'.$p['photourl'].'" class="f">
</a>
</td>
<td class="d">
<p><span style="word-spacing:-1px"><b>'.$p['place'].'</b></span></p>
<p class="sm"><b>'.Date::zmdate($p['posted_at']).'</b><br>Автор: <a href="/author/'.$p['user_id'].'/">'.$author->i('username').'</a></p>
</td>
<td class="c" style="padding:10px">
</td>
<td class="cs">'.Date::zmdate($p['timeupload']).'<div style="margin-top:15px">Оценка<br><b>И+ К+</b></div>
</td>
</tr>';
}
?>
</tbody>
</table>
</div><br>
</td>
</tr>
</tbody>
</table>
</body>
</html>