last updates

This commit is contained in:
themohooks 2025-02-25 23:03:40 +03:00
parent 9c5ec99f24
commit efbfdb6226
5 changed files with 1717 additions and 1 deletions

View file

@ -308,7 +308,7 @@ class Register
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!DB::query('SELECT email FROM users WHERE email=:email', array(':email' => $email))) {
if (!DB::query('SELECT email FROM users WHERE LOWER(email) = LOWER(:email)', array(':email' => '%'.$email.'%'))) {

View file

@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Мессенджер</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
display: flex;
height: 100vh;
}
/* Боковое меню */
.sidebar {
width: 250px;
background-color: #2C3E50;
color: white;
padding: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.sidebar h2 {
text-align: center;
margin-bottom: 30px;
}
.chat-item {
display: flex;
align-items: center;
padding: 15px;
margin-bottom: 15px;
border-radius: 10px;
cursor: pointer;
transition: background-color 0.3s;
}
.chat-item:hover {
background-color: #34495E;
}
.chat-item img {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.chat-item .chat-details {
display: flex;
flex-direction: column;
}
.chat-item .chat-name {
font-weight: bold;
}
.chat-item .chat-message {
font-size: 0.9em;
color: #BDC3C7;
}
/* Основная область с чатами */
.chat-container {
flex-grow: 1;
display: flex;
flex-direction: column;
background-color: #ECF0F1;
}
.chat-header {
background-color: #3498DB;
padding: 20px;
color: white;
display: flex;
align-items: center;
}
.chat-header img {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 15px;
}
.chat-header .chat-title {
font-size: 1.5em;
font-weight: bold;
}
.chat-messages {
flex-grow: 1;
padding: 20px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 15px;
}
.message {
max-width: 70%;
padding: 10px;
border-radius: 10px;
background-color: #FFFFFF;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
align-self: flex-start;
}
.message.sender {
background-color: #3498DB;
color: white;
align-self: flex-end;
}
.chat-input {
display: flex;
padding: 15px;
background-color: #FFFFFF;
border-top: 1px solid #BDC3C7;
}
.chat-input input {
width: 100%;
padding: 10px;
border-radius: 20px;
border: 1px solid #BDC3C7;
font-size: 1em;
}
</style>
</head>
<body>
<!-- Боковое меню -->
<div class="sidebar">
<h2>Чаты</h2>
<div class="chat-item">
<img src="https://www.w3schools.com/w3images/avatar2.png" alt="Аватар 1">
<div class="chat-details">
<div class="chat-name">Чат 1</div>
<div class="chat-message">Привет! Как дела?</div>
</div>
</div>
<div class="chat-item">
<img src="https://www.w3schools.com/w3images/avatar6.png" alt="Аватар 2">
<div class="chat-details">
<div class="chat-name">Чат 2</div>
<div class="chat-message">Что нового?</div>
</div>
</div>
<div class="chat-item">
<img src="https://www.w3schools.com/w3images/avatar5.png" alt="Аватар 3">
<div class="chat-details">
<div class="chat-name">Чат 3</div>
<div class="chat-message">Можем поговорить позже?</div>
</div>
</div>
</div>
<!-- Основная область с чатами -->
<div class="chat-container">
<div class="chat-header">
<img src="https://www.w3schools.com/w3images/avatar2.png" alt="Аватар чата">
<div class="chat-title">Чат 1</div>
</div>
<div class="chat-messages">
<div class="message">Привет! Как дела?</div>
<div class="message sender">Все хорошо! А у тебя?</div>
<div class="message">Нормально, немного занят.</div>
<div class="message sender">Понимаю. Когда встречаемся?</div>
</div>
<div class="chat-input">
<input type="text" placeholder="Напишите сообщение...">
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,185 @@
{layout '..\@layout.latte'}
{block content}
{var $usercttc = False}
{var $city = htmlspecialchars(json_decode($userprofile->i(content), true)[aboutlive][value])}
{var $photourl = $userprofile->i(photourl)}
{var $regdate = \App\Services\Date::zmdate($userprofile->content(regdate))}
{var $about = json_decode($userprofile->i(content), true)[aboutmemo][value]}
{var $birthdate = json_decode($userprofile->i(content), true)[aboutbirthday][value]}
<h1>{$userprofile->i(username)}{if $userprofile->i(admin) === 1}<img width="32" src="/static/img/star.png">{/if}</h1>
{if $usercttc === True}<div style="float:left; border:solid 1px #3b7dc1; padding:6px 10px 7px; margin-bottom:13px; background-color:#0199ff44"><b>Профиль на transphoto.org</b><br>Пользователь не зарегистрирован на сервере {$ngallery[root][title]}. Информация может быть неполной.<br><a href="https://transphoto.org/author/{=(int) explode('/', explode('@', $_SERVER[REQUEST_URI])[0])[2]}" target="_blank">Открыть на transphoto.org</a></div>
{/if}
{if $userprofile->i(admin) === 1}Администратор сервера
{else}
{if $userprofile->i(admin) === 2}Фотомодератор
{/if}
{/if}
{if $userprofile->i(id) === $user_id}
<p><b><a href="/lk/profile">Редактировать мой профиль</a></b></p>
{/if}
<div class="p20" style="padding-right:12px; background-color: white !important;">
<table width="100%">
<tr>
{if $userprofile->content(badge) !== null}
<div style="float:left; border:solid 1px #3b7dc1; padding:6px 10px 7px; margin-bottom:13px; background-color:#0199ff44"><b>{nl2br($userprofile->content(badge))}</div><br>
{/if}
{var $content = json_decode($userprofile->i(content), true)}
<td style="vertical-align:top; width:100%" valign="top" width="100%">
<table style="margin-bottom: 15px;">
<colgroup><col width="170px"></colgroup>
{ifset $city}
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Откуда:</td>
<td>{$city}</td>
</tr>
{/ifset}
{ifset $birthdate}
<tr>
<td class="sm" style="padding:3px 10px 3px 0">День рождения:</td>
<td>{$birthdate}</td>
</tr>
{/ifset}
</table>
<table style="margin-bottom: 15px;">
<colgroup><col width="170px"></colgroup>
{foreach ['aboutlangs' => 'Владение языками', 'abouttelegram' => 'Telegram', 'aboutvk' => 'ВКонтакте',
'abouttwitter' => 'Twitter/X', 'aboutyoutube' => 'YouTube', 'aboutemail' => 'Почта',
'aboutinstagram' => 'Instagram', 'abouttransphoto' => 'TransPhoto', 'aboutwebsite' => 'Личный сайт'] as $key => $label}
{ifset $content[$key]['value']}
<tr>
<td class="sm" style="padding:3px 10px 3px 0">{$label}:</td>
<td>
{if $key === 'aboutemail'}
<a href="mailto:{$content[$key]['value']}">{$content[$key]['value']}</a>
{else}
{$content[$key]['value']}
{/if}
</td>
</tr>
{/ifset}
{/foreach}
</table>
<table style="margin-bottom: 15px;">
<colgroup><col width="170px"></colgroup>
{foreach ['aboutfavs_trains' => 'Любимые модели поездов', 'aboutfavs_countries' => 'Любимые страны', 'aboutfavs_cities' => 'Любимые города'] as $key => $label}
{ifset $content[$key]['value']}
<tr>
<td class="sm" style="padding:3px 10px 3px 0">{$label}:</td>
<td>{$content[$key]['value']}</td>
</tr>
{/ifset}
{/foreach}
</table>
<table>
<colgroup><col width="170px"></colgroup>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Дата регистрации:</td>
<td><span class="sm">{$regdate}</span></td>
</tr>
<tr>
<td class="sm" style="padding:3px 10px 3px 0">Был на сайте:</td>
<td>
<span class="sm">
{=\App\Services\Date::zmdate($userprofile->i(online))}
{if time() - 300 <= $userprofile->i(online)}(<b>online</b>){/if}
</span>
</td>
</tr>
</table>
<br />
<div class="sm" style="float:right">
<a href="/lk/ticket.php?action=add&amp;aid=140"></a>
</div>
</td>
<td valign="top" align="right">
<script n:syntax=off>
function getBodyScrollTop() {
return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function showUserPhoto() {
_getID('userphoto_big_img').src = '{$userprofile->i(photourl)}';
_getID('userphoto_big_div').style.top = '' + (getBodyScrollTop() + 10) + 'px';
_getID('userphoto_big_div').style.display = 'block';
}
function hideUserPhoto() {
_getID('userphoto_big_div').style.display = 'none';
}
document.onclick = function(e) {
e = e || window.event;
E = e.target || e.srcElement;
if (E.id != 'userphoto_big_div' && E.id != 'userphoto_img') {
_getID('userphoto_big_div').style.display = 'none';
}
}
</script>
<div id="userphoto_big_div" style="position:absolute; display:none; border:1px solid gray; padding:10px; background-color:white; margin:auto; text-align:center; right:100px; z-index:3000" class="p5 shadow"><a href="#" onclick="hideUserPhoto(); return false"><img src="" id="userphoto_big_img" border="0" style="vertical-align:middle"></a>
<div style="margin-top:8px"><a class="dot" href="#" onclick="hideUserPhoto(); return false">закрыть</a></div>
</div>
<a href="{$photourl}" onclick="showUserPhoto(); return false;"><img onerror="this.src = '/static/img/avatar.png'; this.onerror = null;" src="{$photourl}" alt="" id="userphoto_img" class="f" style="width:auto; max-width:100px"></a>
</td>
</tr>
</table>
</div>
{if $about != null && $usercttc === False}
<div class="p20" style="margin-top: 8px; background-color: white !important;">
<h4>О себе</h4>
{$about}
</div>
{else}
{if $usercttc === True}{$about}{/if}
{/if}
<div style="margin-top: 25px;"><b><a href="/search?id={$userprofile->i(id)}">Найти все фотографии, сделанные этим пользователем</a></b></div>
{if $userprofile->i(id) != $user_id}
<script>
$(document).ready(function()
{
$('.toggle, .toggle-label').on('click', function()
{
var toggle = $('.toggle').toggleClass('on');
var subscr_cnt = $('#subscr_cnt');
var cnt = parseInt(subscr_cnt.text());
subscr_cnt.html(toggle.is('.on') ? cnt+1 : cnt-1);
$.get('/api/subscribe', { action: 'subscribe', id: {$userprofile->i(id)}, subj: 'a' }, function (r)
{
if (r != 0 && r != 1)
{
toggle.toggleClass('on');
alert(r);
}
else toggle.attr('class', (r == 1) ? 'toggle on' : 'toggle');
});
});
});
</script>
{if \App\Services\DB::query('SELECT follower_id FROM followers WHERE user_id=:userid AND follower_id=:followerid', array(':userid' => $userprofile->i(id), ':followerid' => $user_id))}
{var $class = on}
{/if}
<div style="margin-top: 8px;"><div class="toggle {$class}"><div class="handle"></div></div> &nbsp;<label class="toggle-label"><b>Подписка на новые фотографии этого автора</b> (подписаны: <b id="subscr_cnt">{=\App\Services\DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid' => $userprofile->i(id)))[0]['COUNT(*)']}</b>)</label></div>
{else}
<div style="margin-top: 8px;">Пользователей, подписанных на мои фотографии: <b>{=\App\Services\DB::query('SELECT COUNT(*) FROM followers WHERE user_id=:uid', array(':uid' => $userprofile->i(id)))[0]['COUNT(*)']}</b></div>
{/if}
</td>
{/block}

File diff suppressed because it is too large Load diff

4
views/pages/t.latte Normal file
View file

@ -0,0 +1,4 @@
{layout '@layout.latte'}
{block content}
gjh
{/block}