small fixes

resolves #3
This commit is contained in:
themohooks 2024-07-11 22:45:27 +03:00
parent cec6811cf8
commit 9233b459c5
4 changed files with 45 additions and 59 deletions

View file

@ -36,7 +36,7 @@ use \App\Models\User;
<?php
$admins = DB::query('SELECT * FROM users WHERE admin=1');
foreach ($admins as $a) {
echo '<li><b><a href="/author/'.$a['id'].'/"><img src="'.$a['photourl'].'" width="32" style="border-radius: 3px; margin-right: 5px;">'.htmlspecialchars($a['username']).'</a></b></li>';
echo '<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;">'.htmlspecialchars($a['username']).'</a></b></li>';
}
?>
</ul>

View file

@ -94,10 +94,7 @@ foreach ($photos as $pd) {
</td>
<td style="vertical-align:top; width:100%; padding-top:4px">
<div id="morerand">
<a id="newrand" style="display:none" href="#">Показать другие</a>
<span id="newrand-loader" style="color:#888">Загрузка...</span>
</div>
<h4><a href="/photo/" target="_blank">Случайные фотографии</a></h4>
<div id="random-photos" class="ix-photos ix-photos-oneline">
<?php

View file

@ -22,7 +22,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<tr>
<td class="main">
<?php
if ($userprofile->i('id') === explode('/', $_SERVER['REQUEST_URI'])[2]) { ?>
if ((int)$userprofile->i('id') === (int)explode('/', $_SERVER['REQUEST_URI'])[2]) { ?>
<h1><?= htmlspecialchars($userprofile->i('username')) ?><?php if ($userprofile->i('admin') === 1) { echo '<img width="32" src="/static/img/star.png">'; } ?></h1>
<?php
@ -96,7 +96,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<?php
if (json_decode($userprofile->i('content'), true)['aboutyoutube']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Twitter/X:</td>
<td class="sm" style="padding:3px 10px 3px 0">YouTube:</td>
<td><?= htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutyoutube']['value']) ?></td>
</tr>
<?php } ?>
@ -104,7 +104,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
if (json_decode($userprofile->i('content'), true)['aboutemail']['value'] != null) { ?>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Почта:</td>
<td><?= htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutemail']['value']) ?></td>
<td><a href="emailto:<?=htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutemail']['value'])?>"><?= htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutemail']['value']) ?></a></td>
</tr>
<?php } ?>
<?php
@ -206,7 +206,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
<div style="margin-top:8px"><a class="dot" href="#" onclick="hideUserPhoto(); return false">закрыть</a></div>
</div>
<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>
<a href="<?= $userprofile->i('photourl') ?>" onclick="showUserPhoto(); return false;"><img onerror="this.src = '/static/img/avatar.png'; this.onerror = null;" src="<?= $userprofile->i('photourl') ?>" alt="" id="userphoto_img" class="f" style="width:auto; max-width:100px"></a>
</td>
</tr>
</table>

View file

@ -1,64 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Template Creator</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
<title>Таймер до 12 июля</title>
<style>
@font-face {
font-family: 'Pepperscreen';
src: url('/static/PEPPERSCREEN.ttf') format('truetype');
}
body {
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
font-family: 'Pepperscreen', sans-serif;
}
#timer {
font-size: 100px;
color: #000000;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="mb-4">Создание шаблона</h1>
<div id="template-form">
<div class="mb-3">
<label for="key-name" class="form-label">Ключ</label>
<input type="text" class="form-control" id="key-name">
</div>
<button id="add-key" class="btn btn-primary">Добавить ключ</button>
</div>
<hr>
<h2 class="mt-4">Шаблоны</h2>
<ul id="template-list" class="list-group"></ul>
<button id="save-templates" class="btn btn-success mt-4">Сохранить шаблоны</button>
<pre id="json-output" class="mt-4"></pre>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<center><h1 style="color: #f40300; font-size: 65px;">сайт будет захвачен через</h1></center><br>
<center><div id="timer">Загрузка...</div></center><br>
<center><img width="750" src="/static/img/sttslogo.png"></center>
<script>
$(document).ready(function () {
const template = {};
function updateTimer() {
const now = new Date();
const targetDate = new Date(now.getFullYear(), 6, 12, 12, 0, 0); // 12 июля 12:00 по локальному времени
if (now > targetDate) {
targetDate.setFullYear(now.getFullYear() + 1); // если уже прошло, тогда следующее 12 июля
}
const remainingTime = targetDate - now;
$('#add-key').on('click', function () {
const key = $('#key-name').val();
const days = Math.floor(remainingTime / (1000 * 60 * 60 * 24));
const hours = Math.floor((remainingTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((remainingTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000);
if (key) {
template[key] = '';
addKeyToTemplateList(key);
$('#key-name').val('');
document.getElementById('timer').textContent = `${days}:${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
}
});
$('#save-templates').on('click', function () {
const json = JSON.stringify(template, null, 2);
$('#json-output').text(json);
saveTemplates(json);
});
function addKeyToTemplateList(key) {
const templateList = $('#template-list');
const listItem = `<li class="list-group-item">${key}</li>`;
templateList.append(listItem);
}
function saveTemplates(json) {
$.post('save_templates.php', { data: json }, function (response) {
alert('Шаблоны сохранены!');
});
}
});
setInterval(updateTimer, 1000);
updateTimer(); // Начальное обновление
</script>
</body>
</html>