mirror of
https://github.com/claradex/nativegallery.git
synced 2025-03-25 18:58:16 +03:00
main pages
This commit is contained in:
parent
57e0f96bd7
commit
91fdb43069
8 changed files with 457 additions and 72 deletions
45
views/pages/System/About.latte
Normal file
45
views/pages/System/About.latte
Normal file
|
@ -0,0 +1,45 @@
|
|||
{layout '..\@layout.latte'}
|
||||
{block content}
|
||||
<h1>О сервере <b>{$ngallery['root']['title']}</b></h1>
|
||||
<p>{$ngallery['root']['description']}</p>
|
||||
<table width="100%">
|
||||
<div class="p20">
|
||||
<h4><img src="/static/img/go-home.png">Общая информация</h4>
|
||||
<ul class="straight">
|
||||
<li>Зарегистрировано пользователей: <b>{\App\Services\DB::query('SELECT COUNT(*) FROM users')[0]['COUNT(*)']}</b></li>
|
||||
<li>Опубликовано фотографий: <b>{\App\Services\DB::query('SELECT COUNT(*) FROM photos WHERE moderated=1')[0]['COUNT(*)']}</b></li>
|
||||
<li>Пользователей онлайн: <b>{\App\Services\DB::query('SELECT COUNT(*) FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time'=>time()))[0]['COUNT(*)']}</b></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="p20">
|
||||
<h4><img src="/static/img/220.ico">Администраторы</h4>
|
||||
<ul style="list-style: none; margin: 0; padding: 0;">
|
||||
{var $admins = \App\Services\DB::query('SELECT * FROM users WHERE admin=1')}
|
||||
{foreach $admins as $a}
|
||||
<li><b><a href="/author/{$a['id']}/"><img onerror="this.src = `/static/img/avatar.png`; this.onerror = null;" src="{$a['photourl']}" width="32" style="border-radius: 3px; margin-right: 5px;">{$a['username']}</a></b></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="p20">
|
||||
<h4><img src="/static/img/248.ico">Фотомодераторы</h4>
|
||||
<ul style="list-style: none; margin: 0; padding: 0;">
|
||||
{var $admins = \App\Services\DB::query('SELECT * FROM users WHERE admin=2')}
|
||||
{foreach $admins as $a}
|
||||
<li><b><a href="/author/{$a['id']}/"><img onerror="this.src = `/static/img/avatar.png`; this.onerror = null;" src="{$a['photourl']}" width="32" style="border-radius: 3px; margin-right: 5px;">{$a['username']}</a></b></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="p20">
|
||||
<h4><img src="/static/img/152.ico">Модераторы</h4>
|
||||
<ul style="list-style: none; margin: 0; padding: 0;">
|
||||
{var $admins = \App\Services\DB::query('SELECT * FROM users WHERE admin=3')}
|
||||
{foreach $admins as $a}
|
||||
<li><b><a href="/author/{$a['id']}/"><img onerror="this.src = `/static/img/avatar.png`; this.onerror = null;" src="{$a['photourl']}" width="32" style="border-radius: 3px; margin-right: 5px;">{$a['username']}</a></b></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{/block}
|
1
views/pages/System/EmailVerify.latte
Normal file
1
views/pages/System/EmailVerify.latte
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>Спасибо, ваша почта подтверждена.</h1>
|
62
views/pages/System/Login.latte
Normal file
62
views/pages/System/Login.latte
Normal file
|
@ -0,0 +1,62 @@
|
|||
{layout '..\@layout.latte'}
|
||||
{block content}
|
||||
<center>
|
||||
<h1>Вход на сайт</h1>
|
||||
<div class="mf-center-block mf-label">
|
||||
|
||||
<form id="form" class="p20i mf-center-block-wide mf-label">
|
||||
<input type="text" name="username" id="username" class="mf-input-wide" placeholder="Имя или e-mail" value="">
|
||||
<div style="color:#e00" id="err_username"></div>
|
||||
|
||||
<input type="password" name="password" id="password" class="mf-input-wide" placeholder="Пароль">
|
||||
<div style="color:#e00" id="err_password"></div>
|
||||
|
||||
<input type="button" id="loginbtn" class="mf-button-wide" value="Войти">
|
||||
|
||||
</form>
|
||||
|
||||
<div style="margin-top:15px"><a href="/register" class="mf-button">Регистрация</a></div>
|
||||
</div><br />
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#username').on('input', function() {
|
||||
$('#err_password, #err_username').html('');
|
||||
});
|
||||
$('#password').on('input', function() {
|
||||
$('#err_password').html('');
|
||||
});
|
||||
|
||||
$('#loginbtn').on('click', function() {
|
||||
var username = $('#username').val().trim();
|
||||
var password = $('#password').val().trim();
|
||||
|
||||
var err_username = $('#err_username').html('');
|
||||
var err_password = $('#err_password').html('');
|
||||
|
||||
if (username == '') err_username.html('Поле не заполнено');
|
||||
if (password == '') err_password.html('Поле не заполнено');
|
||||
|
||||
if (err_username.html() + err_password.html() == '') {
|
||||
$('#loginbtn').prop('disabled', true).val('Отправка данных...');
|
||||
|
||||
$.post('/api/login', {
|
||||
username: username,
|
||||
password: password,
|
||||
remember: $('#remember').is('checked')
|
||||
}, function(r) {
|
||||
r = JSON.parse(r);
|
||||
if (r.errorcode == "1") {
|
||||
err_password.html('Неверно указаны логин и/или пароль');
|
||||
$('#loginbtn').prop('disabled', false).val('Войти');
|
||||
} else window.location.href = '/';
|
||||
})
|
||||
.fail(function(jx) {
|
||||
if (jx.responseText != '') alert(jx.responseText);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</center>
|
||||
{/block}
|
173
views/pages/System/Main.latte
Normal file
173
views/pages/System/Main.latte
Normal file
|
@ -0,0 +1,173 @@
|
|||
{layout '..\@layout.latte'}
|
||||
{block content}
|
||||
<table id="idx-main">
|
||||
<tr>
|
||||
|
||||
<td style="vertical-align:top; padding-right:20px">
|
||||
|
||||
<h4><a href="/top30">Самые популярные за 24 часа</a></h4>
|
||||
<div>
|
||||
{var $photos = \App\Services\DB::query('SELECT photo_id, COUNT(*) as view_count FROM photos_views WHERE time >= UNIX_TIMESTAMP(NOW()) - 86400 GROUP BY photo_id ORDER BY view_count DESC LIMIT 10;')}
|
||||
{foreach $photos as $pd}
|
||||
{var $photo = \App\Services\DB::query('SELECT * FROM photos WHERE id=:id', array(':id' => $pd['photo_id']))}
|
||||
{foreach $photo as $p}
|
||||
{var $author = new \App\Models\User($p['user_id'])}
|
||||
<a href="/photo/{$p['id']}" target="_blank" class="prw pop-prw">
|
||||
<img width="250" src="/api/photo/compress?url={$p['photourl']}">
|
||||
<div class="hpshade">
|
||||
<div class="eye-icon">+{$pd['view_count']}</div>
|
||||
</div>
|
||||
{if $p['priority'] === 1}
|
||||
<div class="temp" style="background-image:url(/static/img/cond.png)"></div>
|
||||
{/if}
|
||||
</a>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
|
||||
<div style="text-align:center; margin-bottom:20px">
|
||||
<div style="width: 250px;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<td style="vertical-align:top; width:70%; padding-top:4px">
|
||||
|
||||
|
||||
<h4><a href="/photo/" target="_blank">Случайные фотографии</a></h4>
|
||||
<div id="random-photos" class="ix-photos ix-photos-oneline">
|
||||
{var $photos = \App\Services\DB::query('SELECT * FROM photos WHERE moderated=1 ORDER BY RAND() DESC LIMIT 7')}
|
||||
{foreach $photos as $p}
|
||||
{var $photourl = $p['photourl']}
|
||||
{if $p['posted_at'] === 943909200 || \App\Services\Date::zmdate($p['posted_at']) === '30 ноября 1999 в 00:00'}
|
||||
{var $date = 'дата не указана'}
|
||||
{else}
|
||||
{var $date = Date::zmdate($p['posted_at'])}
|
||||
{/if}
|
||||
<div class="prw-grid-item">
|
||||
<div class="prw-wrapper"><span style="word-spacing:-1px"><b>{$p['place']}</b></span>
|
||||
<div>{$date}</div>
|
||||
</div>
|
||||
<a href="/photo/{$p['id']}" target="_blank" class="prw-animate" style='background-image:url("/api/photo/compress?url={$photourl}")'></a>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
<style>
|
||||
#contestNotify {
|
||||
background-size: 550px 211.2px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 550 211.2" width="550" height="211.2" style="opacity: 0.3; filter: grayscale(0);"><text x="0em" y="1em" font-size="88" transform="rotate(17 55 52.8)">🎁</text><text x="1.25em" y="2em" font-size="88" transform="rotate(17 165 140.8)">🎈</text><text x="2.5em" y="1em" font-size="88" transform="rotate(17 275 52.8)">🎀</text><text x="3.75em" y="2em" font-size="88" transform="rotate(17 385 140.8)">🎊</text><text x="5em" y="1em" font-size="88" transform="rotate(17 495 52.8)">🎉</text></svg>');
|
||||
}
|
||||
</style>
|
||||
|
||||
{if \App\Services\DB::query('SELECT status FROM contests WHERE status=2')[0]['status'] === 2}
|
||||
{var $contest = \App\Services\DB::query('SELECT * FROM contests WHERE status=2')[0]}
|
||||
{var $theme = \App\Services\DB::query('SELECT * FROM contests_themes WHERE id=:id', array(':id' => $contest['themeid']))[0]}
|
||||
<div id="contestNotify" style="float:left; border:solid 1px #171022; padding:6px 10px 7px; margin-bottom:13px; background-color:#E5D6FF"><h4>Фотоконкурс!</h4>
|
||||
<span id="timett">Закончится через:</span> <b id="countdown"></b><br>
|
||||
Тематика: <b>{$theme['title']}</b><br>
|
||||
<b style="color: #412378;">Голосуйте за лучшие фотографии, которые должны стать победителями сегодняшнего конкурса!</b><br><br>
|
||||
<div id="contestBtns"><a href="/voting" style="background-color: #37009D; color: #fff;" type="button">Голосовать!</a></div>
|
||||
<script>startCountdown(' . $contest['closedate'] . ');</script>
|
||||
{elseif \App\Services\DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1}
|
||||
{var $contest = DB::query('SELECT * FROM contests WHERE status=1')[0]}
|
||||
{var $theme = DB::query('SELECT * FROM contests_themes WHERE id=:id', array(':id' => $contest['themeid']))[0]}
|
||||
echo ' <div id="contestNotify" style="float:left; border:solid 1px #171022; padding:6px 10px 7px; margin-bottom:13px; background-color:#E5D6FF"><h4>Фотоконкурс!</h4>
|
||||
<span id="timett">Начнётся через:</span> <b id="countdown"></b><br>
|
||||
Тематика: <b>{$theme['title']}</b><br>
|
||||
<b id="textContest" style="color: #412378;">Лучшие фотографии по мнению сообщества {$ngallery['root']['title']} будут отмечены</b><br><br>
|
||||
<div id="contestBtns"><a href="/voting/sendpretend" style="background-color: #37009D; color: #fff;" type="button">Участвовать!</a> <a href="/voting/waiting" style="background-color: #37009D; color: #fff;" type="button">Голосовать за претендентов</a></div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let unixThreshold = '.$contest['closepretendsdate'].'; // Задайте нужное значение UNIX
|
||||
let checkInterval = 1000; // Интервал проверки в миллисекундах (1 секунда)
|
||||
let isRequestSent = false;
|
||||
|
||||
function checkUnixTime() {
|
||||
let currentUnixTime = Math.floor(Date.now() / 1000);
|
||||
|
||||
if (currentUnixTime > unixThreshold) {
|
||||
$("#countdown").text("Ожидаем ответ от сервера...");
|
||||
|
||||
$.ajax({
|
||||
url: "/api/contests/getinfo", // Укажите свой URL
|
||||
method: "GET",
|
||||
success: function (response) {
|
||||
|
||||
let data = typeof response === "string" ? JSON.parse(response) : response;
|
||||
if (data.statuses.pretends === "closed" && data.statuses.public === "opened") {
|
||||
clearInterval(pingInterval); // Останавливаем старый пинг
|
||||
$("#textContest").text("Голосуйте за лучшие фотографии, которые должны стать победителями сегодняшнего конкурса!");
|
||||
$("#timett").text("Закончится через:");
|
||||
$("#contestBtns").html(`<a href="/voting" style="background-color: #37009D; color: #fff;" type="button">Голосовать!</a>`)
|
||||
unixThreshold = data.contest.closedate;
|
||||
startCountdown(data.contest.closedate);
|
||||
pingInterval = setInterval(checkUnixTime, checkInterval);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Ошибка запроса:", error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(currentUnixTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Запускаем периодический пинг
|
||||
let pingInterval = setInterval(checkUnixTime, checkInterval);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
<h4 style="clear:both"><a href="/update">Недавно добавленные фотографии</a></h4>
|
||||
{var $photos = \App\Services\DB::query('SELECT * FROM photos WHERE moderated=1 ORDER BY id DESC LIMIT 30')}
|
||||
<div id="recent-photos" class="ix-photos ix-photos-multiline" lastpid="{$photos[0]['id']+1}" firstpid="{end($photos)['id']}">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align:center; margin:10px 0"><input type="button" name="button" id="loadmore" class="" value="Загрузить ещё"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Сейчас на сайте ({\App\Services\DB::query('SELECT COUNT(*) FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()))[0]['COUNT(*)']})</h4>
|
||||
<div>
|
||||
{var $online = \App\Services\DB::query('SELECT * FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()))}
|
||||
{foreach $online as $o}
|
||||
<a href="/author/{$o['id']}/">{$o['username']}</a>{if end($online)['id'] === $o['id']}.{else},{/if}
|
||||
{/foreach}
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td style="padding-left:20px; width:254px; vertical-align:top">
|
||||
|
||||
<h4>Новости сайта</h4>
|
||||
<div class="sm" style="margin-bottom:15px; line-height:13px; white-space:normal">
|
||||
{foreach \App\Services\DB::query('SELECT * FROM news ORDER BY id DESC LIMIT 10') as $n}
|
||||
<div class="ix-news-item"><b>{\App\Services\Date::zmdate($n['time'])}</b>
|
||||
<div class="break-links" style="padding-top:3px">{$n['body']}</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/block}
|
0
views/pages/System/Page.latte
Normal file
0
views/pages/System/Page.latte
Normal file
134
views/pages/System/Register.latte
Normal file
134
views/pages/System/Register.latte
Normal file
|
@ -0,0 +1,134 @@
|
|||
{layout '..\@layout.latte'}
|
||||
{block content}
|
||||
<style>
|
||||
.styled-input {
|
||||
position: relative;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.styled-input input {
|
||||
width: 100%;
|
||||
padding: 10px 10px 10px 0;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
border-bottom: 2px solid #ccc;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.styled-input input:focus {
|
||||
border-bottom: 2px solid #000;
|
||||
}
|
||||
|
||||
.styled-input label {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 0;
|
||||
font-size: 16px;
|
||||
color: #999;
|
||||
pointer-events: none;
|
||||
transition: 0.2s ease all;
|
||||
}
|
||||
|
||||
.styled-input input:focus~label,
|
||||
.styled-input input:valid~label {
|
||||
top: -20px;
|
||||
font-size: 12px;
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
||||
{if $ngallery['root']['registration']['access']['public'] === true}
|
||||
<center>
|
||||
<h1><b>Регистрация</b></h1>
|
||||
<table cellspacing="10" cellpadding="0" border="0" align="center" style="margin: 9px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="/static/img/logocube.png" style="width: 32px;" align="middle">
|
||||
</td>
|
||||
<td>
|
||||
<b>{$ngallery['root']['title']} — это универсальное средство для размещения своих фотографий и видеороликов, созданное на базе движка СТТС.</b><br>
|
||||
Публикуйте свои самые лучшие фотографии и великолепные видео на наш портал, чтобы их увидели все желающие.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="mf-center-block">
|
||||
<form method="post" id="form" class="p20i mf-label mf-center-block-wide">
|
||||
<input type="hidden" name="accept" value="yes">
|
||||
<div class="styled-input">
|
||||
<input type="text" name="username" id="username" required="">
|
||||
<label for="username">Ваш никнейм</label>
|
||||
</div>
|
||||
<div style="color:#e00" id="err_username"></div>
|
||||
<div class="styled-input">
|
||||
<input type="text" name="email" id="email" required="">
|
||||
<label for="email">Ваш e-mail</label>
|
||||
</div>
|
||||
<div style="color:#e00" id="err_email"></div>
|
||||
<div class="styled-input">
|
||||
<input name="password" id="password" type="password" required="">
|
||||
<label for="password">Ваш пароль</label>
|
||||
</div>
|
||||
<div style="color:#e00" id="err_password"></div>
|
||||
|
||||
|
||||
<input type="button" id="regbtn" class="mf-button-wide" style="margin-top:15px" value="Зарегистрироваться">
|
||||
<p>Регистрируясь на сервере <?= NGALLERY['root']['title'] ?>, вы <a href="/rules">принимаете его правила.</a></p>
|
||||
<p><b><a href="/tour">Вы можете пройти экскурсию по сайту.</a></b></p>
|
||||
</form><br><br>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script n:syntax=off>
|
||||
$(document).ready(function() {
|
||||
$('#email').on('input', function() {
|
||||
$('#err_email').html('');
|
||||
});
|
||||
|
||||
$('#regbtn').on('click', function() {
|
||||
var username = $('#username').val().trim();
|
||||
var err_username = $('#err_username').html('');
|
||||
var email = $('#email').val().trim();
|
||||
var err_email = $('#err_email').html('');
|
||||
var password = $('#password').val().trim();
|
||||
var err_password = $('#err_password').html('');
|
||||
|
||||
if (username == '') err_username.html('<i style="color:#e00" class="bx bx-error"></i> Поле не заполнено');
|
||||
if (password == '') err_password.html('<i style="color:#e00" class="bx bx-error"></i> Поле не заполнено');
|
||||
if (email == '') err_email.html('<i style="color:#e00" class="bx bx-error"></i> Поле не заполнено');
|
||||
else
|
||||
if (!email.match(/^[0-9a-z_\-.]+@[0-9a-z_\-^.]+\.[a-z]{2,4}$/i)) err_email.html('<i style="color:#e00" class="bx bx-error"></i> Некорректный адрес');
|
||||
|
||||
|
||||
if (err_email.html() == '') {
|
||||
$(this).prop('disabled', true).val('Отправка данных...');
|
||||
|
||||
$.post('/api/register', {
|
||||
username: username,
|
||||
email: email,
|
||||
password: password
|
||||
}, function(r) {
|
||||
r = JSON.parse(r);
|
||||
if (r.errorcode > 0) {
|
||||
$('#err_email').html('<i class="bx bx-error"></i>' + r.errortitle);
|
||||
$('#regbtn').prop('disabled', false).val('Зарегистрироваться');
|
||||
} else {
|
||||
window.location.href = "/"
|
||||
}
|
||||
})
|
||||
.fail(function(jx) {
|
||||
if (jx.responseText != '') alert(jx.responseText);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</center>
|
||||
{else}
|
||||
<center>
|
||||
<h1>К сожалению, регистрация на сервере <?= NGALLERY['root']['title'] ?> закрыта.</h1>
|
||||
</center>
|
||||
{/if}
|
||||
{/block}
|
42
views/pages/Top30.latte
Normal file
42
views/pages/Top30.latte
Normal file
|
@ -0,0 +1,42 @@
|
|||
{layout '@layout.latte'}
|
||||
{block content}
|
||||
<center>
|
||||
<h1>30 самых просматриваемых фото за 24 часа</h1>
|
||||
<div style="width:80%">
|
||||
{var $photos = \App\Services\DB::query('SELECT photo_id, COUNT(*) as view_count
|
||||
FROM photos_views
|
||||
WHERE time >= UNIX_TIMESTAMP(NOW()) - 86400
|
||||
GROUP BY photo_id
|
||||
ORDER BY view_count DESC
|
||||
LIMIT 30;')}
|
||||
{var $top = 0}
|
||||
{foreach $photos as $pd}
|
||||
{var $photo = \App\Services\DB::query('SELECT * FROM photos WHERE id=:id', array(':id' => $pd[photo_id]))}
|
||||
{foreach $photo as $p}
|
||||
{do $top++}
|
||||
{var $author = new \App\Models\User($p[user_id])} <div class="p20p">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align:center; padding:10px"><b style="font-size:25px">{$top}</b><br><br><small>Новых просмотров:</small><br><b>+{$pd[view_count]}</b><br><br>
|
||||
|
||||
</td>
|
||||
<td class="pb_photo" id="p1977446"><a href="/photo/{$p[id]}/" target="_blank" class="prw"><img class="f" src="{$p[photourl]}" alt="347 КБ">
|
||||
|
||||
</a></td>
|
||||
<td class="pb_descr">
|
||||
|
||||
<p><b class="pw-place">{$p[place]}</b></p>
|
||||
<span class="pw-descr">{$p[postbody]}</span>
|
||||
<p class="sm"><b>{\App\Services\Date::zmdate($p[timeupload])}</b><br>Автор: <a href="/author/{$p[user_id]}/">{$author->i(username)}</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
{/block}
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
use \App\Services\{Auth, DB, Date};
|
||||
use \App\Models\User;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
|
||||
<head>
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/LoadHead.php'); ?>
|
||||
|
||||
<body>
|
||||
<div id="backgr"></div>
|
||||
<table class="tmain">
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
|
||||
<tr>
|
||||
<td class="main">
|
||||
<center>
|
||||
<h1>30 самых просматриваемых фото за 24 часа</h1>
|
||||
<div style="width:80%">
|
||||
<?php
|
||||
$photos = DB::query('SELECT photo_id, COUNT(*) as view_count
|
||||
FROM photos_views
|
||||
WHERE time >= UNIX_TIMESTAMP(NOW()) - 86400
|
||||
GROUP BY photo_id
|
||||
ORDER BY view_count DESC
|
||||
LIMIT 30;');
|
||||
$top = 0;
|
||||
foreach ($photos as $pd) {
|
||||
|
||||
$photo = DB::query('SELECT * FROM photos WHERE id=:id', array(':id'=>$pd['photo_id']));
|
||||
foreach ($photo as $p) {
|
||||
$top++;
|
||||
$author = new User($p['user_id']);
|
||||
echo ' <div class="p20p">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align:center; padding:10px"><b style="font-size:25px">'.$top.'</b><br><br><small>Новых просмотров:</small><br><b>+'.$pd['view_count'].'</b><br><br>
|
||||
|
||||
</td>
|
||||
<td class="pb_photo" id="p1977446"><a href="/photo/'.$p['id'].'/" target="_blank" class="prw"><img class="f" src="'.$p['photourl'].'" alt="347 КБ">
|
||||
|
||||
</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>';
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Footer.php'); ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue