mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
Add recently images page
спрос рождает предложение
This commit is contained in:
parent
76b1aba5d6
commit
ebcfe7720b
4 changed files with 73 additions and 1 deletions
|
@ -26,6 +26,11 @@ class MainController
|
|||
{
|
||||
Page::set('Rules');
|
||||
|
||||
}
|
||||
public static function update()
|
||||
{
|
||||
Page::set('Update');
|
||||
|
||||
}
|
||||
|
||||
public static function logout()
|
||||
|
|
|
@ -20,6 +20,7 @@ class Routes
|
|||
Router::post('/api/register', 'ApiController@register');
|
||||
Router::get('/about', 'MainController@about');
|
||||
Router::get('/rules', 'MainController@rules');
|
||||
Router::get('/update', 'MainController@update');
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ foreach ($photos as $pd) {
|
|||
<br>
|
||||
|
||||
|
||||
<h4 style="clear:both"><a href="/update.php?time=72">Недавно добавленные фотографии</a></h4>
|
||||
<h4 style="clear:both"><a href="/update">Недавно добавленные фотографии</a></h4>
|
||||
<div id="recent-photos" class="ix-photos ix-photos-multiline" lastpid="1970527" firstpid="1970550">
|
||||
<?php
|
||||
$photos = DB::query('SELECT * FROM photos WHERE moderated=1 ORDER BY id DESC LIMIT 30');
|
||||
|
|
66
views/pages/Update.php
Normal file
66
views/pages/Update.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
use App\Services\{Router, Auth, DB, Date};
|
||||
?>
|
||||
<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>Новые фотографии за 72 часа</h1>
|
||||
|
||||
|
||||
<?php
|
||||
$photos = DB::query('SELECT * FROM photos WHERE moderated=1 AND timeupload>=:time ORDER BY timeupload DESC', array(':time'=>time()-259200));
|
||||
foreach ($photos as $p) {
|
||||
$photouser = new \App\Models\User($p['user_id']);
|
||||
echo '<div class="p20p">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="pb_photo" id="p1936120"><a href="/photo/'.$p['id'].'" target="_blank" class="prw"><img class="f" src="'.$p['photourl'].'">
|
||||
<div class="hpshade">
|
||||
';
|
||||
if (DB::query('SELECT COUNT(*) FROM photos_comments WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'] >= 1) {
|
||||
echo '<div class="com-icon">'.DB::query('SELECT COUNT(*) FROM photos_comments WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'</div>';
|
||||
}
|
||||
echo '
|
||||
<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/'.$p['user_id'].'/">'.htmlspecialchars($photouser->i('username')).'</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue