update pages

This commit is contained in:
themohooks 2025-02-16 04:37:24 +03:00
parent be2963117a
commit 1dab03afe8
2 changed files with 80 additions and 71 deletions

View file

@ -31,6 +31,13 @@ use \App\Models\User;
<div class="p20p">
<table>
<tbody>
<?php
if (DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1) {
} else {
echo '<h2><b>Следующего конкурса нет. Пожалуйста, заходите сюда позже.</b></h2>';
}
?>
<tr>
<td class="pb_pre vote" style="padding-left:15px; padding-right:10px; display:table-cell" pid="2068639">
<a href="#" vote="1" class="konk_btn"><span>Красиво, на&nbsp;конкурс!</span></a>

View file

@ -79,10 +79,10 @@ LIMIT 10;');
<div class="hpshade">
<div class="eye-icon">+' . $pd['view_count'] . '</div>
</div>';
if ((int)$p['priority'] === 1) {
echo '<div class="temp" style="background-image:url(/static/img/cond.png)"></div>';
}
echo '
if ((int)$p['priority'] === 1) {
echo '<div class="temp" style="background-image:url(/static/img/cond.png)"></div>';
}
echo '
</a>';
}
}
@ -126,74 +126,76 @@ LIMIT 10;');
#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>
<script>
function startCountdown(unixTimestamp) {
function padZero(num) {
return num < 10 ? '0' + num : num;
}
function getWord(num, words) {
if (num % 10 === 1 && num % 100 !== 11) return words[0];
if (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)) return words[1];
return words[2];
}
function updateTimer() {
const now = Math.floor(Date.now() / 1000);
const diff = unixTimestamp - now;
if (diff <= 0) {
clearInterval(interval);
document.getElementById('countdown').textContent = "00 дней 00 часов 00 минут 00 секунд";
return;
}
const days = Math.floor(diff / 86400);
const hours = Math.floor((diff % 86400) / 3600);
const minutes = Math.floor((diff % 3600) / 60);
const seconds = diff % 60;
document.getElementById('countdown').textContent =
`${padZero(days)} ${getWord(days, ['день', 'дня', 'дней'])} ` +
`${padZero(hours)} ${getWord(hours, ['час', 'часа', 'часов'])} ` +
`${padZero(minutes)} ${getWord(minutes, ['минута', 'минуты', 'минут'])} ` +
`${padZero(seconds)} ${getWord(seconds, ['секунда', 'секунды', 'секунд'])}`;
}
updateTimer(); // сразу обновляем отображение
const interval = setInterval(updateTimer, 1000);
}
</script>
<?php
if (DB::query('SELECT status FROM contests WHERE status=2')[0]['status'] === 2) {
if (DB::query('SELECT status FROM contests WHERE status=2')[0]['status'] === 2) {
$contest = DB::query('SELECT * FROM contests WHERE status=2')[0];
$theme = DB::query('SELECT * FROM contests_themes WHERE id=:id', array(':id'=>$contest['themeid']))[0];
$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>
Закончится через: <b id="countdown"></b><br>
Тематика: <b>'.$theme['title'].'</b><br>
Тематика: <b>' . $theme['title'] . '</b><br>
<b style="color: #412378;">Голосуйте за лучшие фотографии, которые должны стать победителями сегодняшнего конкурса!</b><br><br>
<a href="/voting" style="background-color: #37009D; color: #fff;" type="button">Голосовать!</a>';
<a href="/voting" style="background-color: #37009D; color: #fff;" type="button">Голосовать!</a>
<script>startCountdown(' . $contest['closedate'] . ');</script>';
} else if (DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1) {
$contest = DB::query('SELECT * FROM contests WHERE status=1')[0];
$theme = DB::query('SELECT * FROM contests_themes WHERE id=:id', array(':id'=>$contest['themeid']))[0];
$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>
Начнётся через: <b id="countdown"></b><br>
Тематика: <b>'.$theme.'</b><br>
<b style="color: #412378;">Лучшие фотографии по мнению сообщества '.NGALLERY['root']['title'].' будут отмечены</b><br><br>
<a href="/voting/sendpretend" style="background-color: #37009D; color: #fff;" type="button">Участвовать!</a>';
Тематика: <b>' . $theme['title'] . '</b><br>
<b style="color: #412378;">Лучшие фотографии по мнению сообщества ' . NGALLERY['root']['title'] . ' будут отмечены</b><br><br>
<a href="/voting/sendpretend" style="background-color: #37009D; color: #fff;" type="button">Участвовать!</a>
<script>startCountdown(' . $contest['closepretendsdate'] . ');</script>';
}
?>
</div>
<script>
function startCountdown(unixTimestamp) {
function padZero(num) {
return num < 10 ? '0' + num : num;
}
function getWord(num, words) {
if (num % 10 === 1 && num % 100 !== 11) return words[0];
if (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)) return words[1];
return words[2];
}
function updateTimer() {
const now = Math.floor(Date.now() / 1000);
const diff = unixTimestamp - now;
if (diff <= 0) {
clearInterval(interval);
document.getElementById('countdown').textContent = "00 дней 00 часов 00 минут 00 секунд";
return;
}
const days = Math.floor(diff / 86400);
const hours = Math.floor((diff % 86400) / 3600);
const minutes = Math.floor((diff % 3600) / 60);
const seconds = diff % 60;
document.getElementById('countdown').textContent =
`${padZero(days)} ${getWord(days, ['день', 'дня', 'дней'])} ` +
`${padZero(hours)} ${getWord(hours, ['час', 'часа', 'часов'])} ` +
`${padZero(minutes)} ${getWord(minutes, ['минута', 'минуты', 'минут'])} ` +
`${padZero(seconds)} ${getWord(seconds, ['секунда', 'секунды', 'секунд'])}`;
}
</div>
updateTimer(); // сразу обновляем отображение
const interval = setInterval(updateTimer, 1000);
}
startCountdown(1740607200);
</script>
</div>
</div>
@ -207,26 +209,26 @@ startCountdown(1740607200);
$first_id = $photos[0]['id'];
$last_id = end($photos)['id'];
?>
<div id="recent-photos" class="ix-photos ix-photos-multiline" lastpid="<?=$first_id+1?>" firstpid="<?=$last_id?>">
</div>
</div>
<div style="text-align:center; margin:10px 0"><input type="button" name="button" id="loadmore" class="" value="Загрузить ещё"></div>
<div id="recent-photos" class="ix-photos ix-photos-multiline" lastpid="<?= $first_id + 1 ?>" firstpid="<?= $last_id ?>">
</div>
</div>
<div style="text-align:center; margin:10px 0"><input type="button" name="button" id="loadmore" class="" value="Загрузить ещё"></div>
<h4>Сейчас на сайте (<?= DB::query('SELECT COUNT(*) FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()))[0]['COUNT(*)'] ?>)</h4>
<div>
<?php
$online = DB::query('SELECT * FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()));
foreach ($online as $o) {
echo '<a href="/author/' . $o['id'] . '/">' . htmlspecialchars($o['username']) . '</a>, ';
}
?>
<h4>Сейчас на сайте (<?= DB::query('SELECT COUNT(*) FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()))[0]['COUNT(*)'] ?>)</h4>
<div>
<?php
$online = DB::query('SELECT * FROM users WHERE online>=:time-300 ORDER BY online DESC', array(':time' => time()));
foreach ($online as $o) {
echo '<a href="/author/' . $o['id'] . '/">' . htmlspecialchars($o['username']) . '</a>, ';
}
?>
</div>
</div>
</td>
<td style="padding-left:20px; width:254px; vertical-align:top">
@ -235,8 +237,8 @@ startCountdown(1740607200);
<?php
$news = DB::query('SELECT * FROM news ORDER BY id DESC LIMIT 10');
foreach ($news as $n) {
echo '<div class="ix-news-item"><b>'.Date::zmdate($n['time']).'</b>
<div class="break-links" style="padding-top:3px">'.$n['body'].'</div>
echo '<div class="ix-news-item"><b>' . Date::zmdate($n['time']) . '</b>
<div class="break-links" style="padding-top:3px">' . $n['body'] . '</div>
</div>';
}
?>