Файл: app/user/profile.php
Строк: 44
<?php
if (filter_has_var(INPUT_GET, 'url'))
{
$filter = [
'url' => filter_input(INPUT_GET, 'url', FILTER_UNSAFE_RAW)
];
$profile = $db->query("SELECT * FROM `users` WHERE `login` = '".$filter['url']."' LIMIT 1")->fetch();
}
if (empty($profile))
{
Core::go("/");
}
$smarty->header($profile['login']);
$posts[] = [
'image' => User::photo($profile['id']),
'title' => User::login($profile['id'])
];
if ($db->query("SELECT `id` FROM `users_block` WHERE `id_profile` = '" . $profile['id'] . "' AND `time_ban` > '" . time() . "'")->rowCount() != 0)
{
$query = $db->query("SELECT * FROM `users_block` WHERE `id_profile` = '" . $profile['id'] . "' AND `time_ban` > '" . time() . "' ORDER BY `time` DESC");
while ($list = $query->fetch())
{
$posts[] = [
'div' => 'warning',
'image' => User::photo($list['id_user']),
'title' => User::login($list['id_user']) . ' до ' . Core::time($list['time_ban']),
'post' => Filter::output($list['text']),
'time' => Core::time($list['time']),
];
}
$smarty->assign([
'post' => $posts
]);
$smarty->display('posts.tpl');
$smarty->footer();
}
$listing[] = [
'title' => Lang::word('Регистрация') . ': '.Core::time($profile['time_reg']),
'div' => 'menu'
];
$listing[] = [
'title' => Lang::word('Посл. посещение') . ': '.core::time($profile['time_last']),
'div' => 'menu'
];
$listing[] = [
'title' => Lang::word('Пол') . ': '.($profile['sex'] == 0 ? Lang::word('Женский') : Lang::word('Мужской')),
'div' => 'menu'
];
$listing[] = [
'title' => Lang::word('Монеты') . ': '.$profile['money'],
'div' => 'menu'
];
if (isset($user))
{
if ($user['id'] != $profile['id'])
{
if ($user['level'] >= 1)
{
$listing[] = [
'title' => Lang::word('Управление профилем'),
'url' => '/admin/user/control?id='.$profile['id'],
'div' => 'block',
'icon' => 'user-tie'
];
}
$listing[] = [
'title' => Lang::word('Написать сообщение'),
'url' => '/mail/chat?id=' . $profile['id'],
'div' => 'block',
'icon' => 'mail2'
];
}
else
{
$listing[] = [
'title' => Lang::word('Редактировать профиль'),
'url' => '/user/edit',
'div' => 'block',
'icon' => 'pencil'
];
}
}
$smarty->assign([
'listing' => $listing,
'post' => $posts
]);
$smarty->display('posts.tpl');
$smarty->display('listing.tpl');
$smarty->footer();