Файл: modules/foto/inc/user_show_foto.php
Строк: 370
<?php
/* DCMS Special
* Дата последнего редактирования 25.09.2016
* Модифицировал densnet
*/
if (!isset($user) && !isset($_GET['id_user'])) {
header("Location: " . DIR_FOTO . "?" . SID);
exit;
}
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id_user'])) {
$ank['id'] = $_GET['id_user'];
}
$ank = get_user($ank['id']);
if (!$ank) {
header("Location: " . DIR_FOTO . "?" . SID);
exit;
}
$gallery['id'] = intval($_GET['id_gallery']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"), 0) == 0) {
header("Location: " . DIR_FOTO . "$ank[id]/?" . SID);
exit;
}
$gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"));
$foto['id'] = intval($_GET['id_foto']);
if (isset($user) && isset($_GET['save']) && $user['id'] == $ank['id']) {
crop(H . "sys/gallery/avatar/$foto[id].jpg", H . "sys/gallery/50/$foto[id].tmp.jpg");
resize(H . "sys/gallery/50/$foto[id].tmp.jpg", H . "sys/gallery/50/$foto[id].jpg", 50, 50);
@chmod(H . "sys/gallery/50/$foto[id].jpg", 0777);
@unlink(H . "sys/gallery/50/$foto[id].tmp.jpg");
$_SESSION['message'] = lang('Изменения сохранены');
header("Location: ?" . SID);
exit;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id` = '$foto[id]' LIMIT 1"), 0) == 0) {
header("Location: " . DIR_FOTO . "$ank[id]/$gallery[id]/?" . SID);
exit;
}
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '$foto[id]' LIMIT 1"));
if (isset($_GET['fav']) && $_GET['fav'] == 1) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_foto` WHERE `id_user` = '" . $user['id'] . "' AND `id_foto` = '" . $foto['id'] . "' LIMIT 1"), 0) == 0) {
mysql_query("INSERT INTO `bookmark_foto` (`id_foto`, `id_user`, `time`) VALUES ('$foto[id]', '$user[id]', '$time')");
$_SESSION['message'] = lang('Фото добавлено в закладки');
header("Location: " . DIR_FOTO . "$ank[id]/$gallery[id]/$foto[id]/?page=" . intval($_GET['page']));
exit;
}
}
if (isset($_GET['fav']) && $_GET['fav'] == 0) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_foto` WHERE `id_user` = '" . $user['id'] . "' AND `id_foto` = '" . $foto['id'] . "' LIMIT 1"), 0) == 1) {
mysql_query("DELETE FROM `bookmark_foto` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]' ");
$_SESSION['message'] = lang('Фото удалено из закладок');
header("Location: " . DIR_FOTO . "$ank[id]/$gallery[id]/$foto[id]/?page=" . intval($_GET['page']));
exit;
}
}
if (isset($_GET['like']) && $_GET['like'] == 1) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_like` WHERE `id_foto` = '$foto[id]' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `gallery_like` (`id_user`, `id_foto`, `like`) values('$user[id]', '$foto[id]', '1')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "$SexOcen " . lang('Ваше') . " [url=/modules/foto/$ank[id]/$gallery[id]/$foto[id]/]" . lang('фото') . "[/url]
[img]/modules/foto/foto50/$foto[id].$foto[ras][/img].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `id_img`, `msg`, `time`) values('$user[id]', '$ank[id]', '1', '$msg', '$time')");
}
header("Location: " . DIR_FOTO . "$ank[id]/$gallery[id]/$foto[id]/?page=" . intval($_GET['page']));
exit;
}
if (isset($_GET['like']) && $_GET['like'] == 0) {
mysql_query("DELETE FROM `gallery_like` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]' LIMIT 1");
header("Location: " . DIR_FOTO . "$ank[id]/$gallery[id]/$foto[id]/?page=" . intval($_GET['page']));
exit;
}
$set['title'] = $ank['nick'] . ' - ' . $gallery['name'] . ' - ' . $foto['name'];
require_once H . 'sys/inc/thead.php';
aut();
err();
if (access('foto_foto_edit') && $ank['level'] > $user['level'] || isset($user) && $ank['id'] == $user['id']) {
include 'inc/gallery_show_foto_act.php';
}
if (isset($user) && $user['id'] != $ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]'"), 0) == 0) {
if (isset($_GET['rating']) && $_GET['rating'] == '1') {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '1', '$time', $foto[id_user])", $db);
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
} elseif (isset($_GET['rating']) && $_GET['rating'] == '2') {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '2', '$time', $foto[id_user])", $db);
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
} elseif (isset($_GET['rating']) && $_GET['rating'] == '3') {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '3', '$time', $foto[id_user])", $db);
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
} elseif (isset($_GET['rating']) && $_GET['rating'] == '4') {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '4', '$time', $foto[id_user])", $db);
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
} elseif (isset($_GET['rating']) && $_GET['rating'] == '5') {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '5', '$time', $foto[id_user])", $db);
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
} elseif (isset($_GET['rating']) && $_GET['rating'] == '5i') {
$c = mysql_result(mysql_query("SELECT COUNT(*) FROM `ocenky` WHERE `id_user` = '$user[id]' AND `time` > '$time'"), 0);
if ($c == 1) {
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`, `like`, `time`, `avtor`) values('$user[id]', '$foto[id]', '6', '$time', $foto[id_user])", $db);
mysql_query("UPDATE `gallery_foto` SET `rating` = '" . ($foto['rating'] + 10) . "' WHERE `id` = '$foto[id]' LIMIT 1", $db);
} else {
$_SESSION['url'] = "/modules/foto/$ank[id]/$gallery[id]/$foto[id]/";
header("Location: /modules/shop/plus5.php");
}
}
}
if (IS_WEB) {
$di = '640';
$width = '350';
} else {
$width = '';
$di = '128';
}
#Навигация
echo "<div class='list-group-item-null list-group-item-grey'><small>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='" . DIR_FOTO . "'>" . lang('Фотоальбомы') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='" . DIR_FOTO . "$ank[id]/'>" . lang('Альбомы') . " $ank[nick]</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='" . DIR_FOTO . "$ank[id]/$gallery[id]/'>" . cutStr($gallery['name'], 30) . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo cutStr($foto['name'], 30);
echo "</small></div><br />";
if (isset($_POST['password'])) {
setcookie("passfoto[$gallery[id]]", $_POST['password']);
if (isset($_POST['password']) && $_POST['password'] == $gallery['password']) {
header("Location:?enter=ok");
}
}
if ($gallery['access'] == 'only_me') {
if ($ank['id'] == $user['id'] && isset($user) || $user['level'] >= 3 && isset($user) || isset($umodd)) {
} else {
echo "<div class='alert alert-danger'>";
echo "<i class='fa fa-lock fa-fw'></i> " . lang('Вам запрещено просматривать это фото');
echo "</div>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
} elseif ($gallery['access'] == 'friends') {
if ($ank['id'] == $user['id'] && isset($user) || isset($umodd) || mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE (`user` = '$user[id]' AND `friends` = '$ank[id]') OR (`user` = '$ank[id]' AND `friends` = '$user[id]')"), 0) != 0) {
} else {
echo "<div class='alert alert-danger'>";
echo "<i class='fa fa-users fa-fw'></i> " . lang('Фото доступно только друзьям автора');
echo "</div>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
} elseif ($gallery['access'] == 'pass') {
if (isset($_COOKIE['passfoto'][$gallery['id']]) && $_COOKIE['passfoto'][$gallery['id']] == $gallery['password'] || $ank['id'] == $user['id'] && isset($user) || isset($umodd)) {
} else {
if (isset($_POST['password']) && $_POST['password'] != $gallery['password']) {
$_SESSION['err'] = lang('Пароль неправильный');
}
err();
echo "<form class='list-group-item-null' method='post'>";
echo lang('Чтобы просмотреть фотоальбом, введите пароль') . ":<br />n";
$doc->Input('password', 'Пароль', 16);
$doc->Button('btn btn-primary btn-sm', null, null, 'Далее');
echo "</form>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
} elseif ($gallery['access'] == 'auth') {
if (isset($user)) {
} else {
echo "<div class='alert alert-danger'><i class='fa fa-user fa-fw'></i> " . lang('Фотоальбом доступен только авторизованным пользователям') . "!</div>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
}
if (isset($user)) {
$user['ank_age'] = 0;
if ($user['ank_d_r'] != NULL && $user['ank_m_r'] != NULL && $user['ank_g_r'] != NULL) {
$user['ank_age'] = date("Y") - $user['ank_g_r'];
if (date("n") < $user['ank_m_r']) {
$user['ank_age'] = $user['ank_age'] - 1;
} elseif (date("n") == $user['ank_m_r'] && date("j") < $user['ank_d_r']) {
$user['ank_age'] = $user['ank_age'] - 1;
}
}
}
if (!isset($_SESSION['foto_adult']) && !isset($_GET['passed']) && $user['ank_age'] < 18 && $foto['adult'] == 1) {
if (!isset($user)) {
echo "<div class='list-group-item-null'>";
echo lang('Фото с меткой') . " <font color='red'>(+18)</font> " . lang('доступны только для авторизованных пользователей. Пожалуйста, пройдите процесс') . " <a href='/aut.php'>" . lang('авторизации') . "</a> или <a href='/reg.php'>" . lang('регистрации') . "</a>";
echo "</div>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
echo "<div class='list-group-item-null'>";
echo lang('Внимание! Это содержимое только для взрослых!<br/>После нажатия, Ваш выбор будет отправлен администрации') . "<br/>";
echo lang('Нажимая ДА, Вы подтверждаете, что Вам 18 или более лет') . ".<br />" . lang('Если Вам менее 18 лет - нажмите НЕТ') . ".<br /><br />";
$doc->Link('btn btn-primary btn-sm', '?passed', null, 'Подтверждаю');
$doc->Link('btn btn-sm btn-secondary', "" . DIR_FOTO . "$ank[id]/", null, 'Нет');
echo "</div>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
if (!isset($_SESSION['foto_adult']) && isset($_GET['passed']) && $foto['adult'] == 1) {
$_SESSION['foto_adult'] = 1;
}
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));
$rat = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `id_foto` = $foto[id] AND `like` = '6'"), 0);
$r = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$gallery[id]' AND `id` < '$foto[id]' ORDER BY `id` DESC LIMIT 1"));
$l = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$gallery[id]' AND `id` > '$foto[id]' ORDER BY `id` ASC LIMIT 1"));
if ($r['id'] || $l['id']) {
echo "<div class="list-group-item-null list-group-item-info">n";
if ($l['id']) {
echo "<a href='/modules/foto/$ank[id]/$gallery[id]/$l[id]/' style='float: left'><i class='fa fa-chevron-left fa-fw'></i> Пред.</a>";
}
if ($r['id']) {
echo "<a href='/modules/foto/$ank[id]/$gallery[id]/$r[id]/' style='float: right'>След. <i class='fa fa-chevron-right fa-fw'></i></a>";
}
echo "<div class='clear'></div>";
echo "</div>n";
}
echo "<div style='font-size: 18px;font-weight: bold;' class = 'list-group-item-null'>" . lang('Фотография') . " <a style='float:right;' href = '" . DIR_FOTO . "foto0/$foto[id].$foto[ras]'><i class='fa fa-search-plus fa-fw'></i></a></div>";
echo "<div class='list-group-item-null' style='text-align: center;'>n";
if (IS_WEB) {
echo "<div style='display:inline;'><img class='show_foto' src='" . DIR_FOTO . "foto0/$foto[id].$foto[ras]' style = '-moz-box-shadow: 0 0 10px rgba(0,0,0,0.5);-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.5);box-shadow: 0 0 10px rgba(0,0,0,0.5);border: 1px solid #CCDDED; padding: 2px; border-radius: 5px; max-width: 450px; max-height: 450px; ' alt='$foto[name]' /></div>n";
} else {
echo "<div style='display:inline;'><img class='show_foto' src='" . DIR_FOTO . "foto0/$foto[id].$foto[ras]' style = '-moz-box-shadow: 0 0 10px rgba(0,0,0,0.5);-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.5);box-shadow: 0 0 10px rgba(0,0,0,0.5);border: 1px solid #CCDDED; padding: 2px; border-radius: 5px; max-width: 200px; max-height: 200px;' alt='$foto[name]' /></div>n";
}
if ($rat > 0) {
echo "<div style='display:inline;margin-left:-25px;vertical-align:top;'><img style='padding-top:10px;' src='/style/icons/6.png'/></div>";
}
if ($foto['opis'] != null) {
echo toOutput($foto['opis']) . "<br />n";
}
echo "</div>";
$k_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_frend` where `id_foto` = '$foto[id]'"), 0);
if ($k_p > 0) {
echo "<div class='list-group-item-null'>";
if ($k_p == 1) {
$ot = lang('отмечен');
} else {
$ot = lang('отмечены');
}
echo "<small style='color: grey;'>" . lang('На этом фото') . " $ot </small><br />";
$q = mysql_query("SELECT * FROM `gallery_frend` where `id_foto` = '$foto[id]'");
$n = 0;
while ($post = mysql_fetch_assoc($q)) {
$n++;
$f = get_user($post['id_user']);
if ($f['id'] != $user['id']) {
echo " <a href='/info.php?id=$f[id]'>$f[nick]</a>, ";
} else {
echo "<b>Только Вы</b>";
}
}
echo "</div>";
}
if (isset($user)) {
$like = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_like` WHERE `id_foto` = '$foto[id]' LIMIT 1"), 0);
if ($like > 0) {
$like = $like;
} else {
$like = null;
}
echo "<div class='list-group-item-null list-group-item-grey'>";
echo "<i class='fa fa-star fa-fw'></i> <b>$foto[rating]</b> ";
echo "<i class='fa fa-bookmark fa-fw'></i> <b>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_foto` WHERE `id_foto` = '$foto[id]' LIMIT 1"), 0) . "</b> ";
echo "<i class='fa fa-heart fa-fw'></i> <b>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_like` WHERE `id_foto` = '$foto[id]' LIMIT 1"), 0) . "</b>";
echo "<br />";
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_foto` WHERE `id_user` = '" . $user['id'] . "' AND `id_foto` = '" . $foto['id'] . "' LIMIT 1"), 0) == 0) {
$doc->Link('btn btn-info btn-sm', "?fav=1", 'bookmark-o', 'Добавить в закладки');
} else {
$doc->Link('btn btn-info btn-sm', "?fav=0", 'bookmark', 'Убрать из закладок');
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_like` WHERE `id_foto` = '$foto[id]' AND `id_user` = '$user[id]' LIMIT 1"), 0) == 0) {
echo "<a href='?like=1' class='btn btn-info btn-sm hint--top' data-hint='" . lang('Мне нравится') . "'><i class='fa fa-heart-o fa-fw'></i> $like</a> ";
} else {
echo "<a href='?like=0' class='btn btn-info btn-sm hint--top' data-hint='" . lang('Не нравится') . "'><i class='fa fa-heart fa-fw'></i> $like</a> ";
}
echo "</div>";
}
if (isset($user) && $user['id'] != $ank['id'] && mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]'"), 0) == 0) {
echo "<div class='list-group-item-null list-group-item-info'><center>";
echo "<a href="?id=$foto[id]&rating=1" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 1?') . "'><img src='/style/icons/1.png' alt=''/></a> ";
echo "<a href="?id=$foto[id]&rating=2" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 2?') . "'><img src='/style/icons/2.png' alt=''/></a> ";
echo "<a href="?id=$foto[id]&rating=3" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 3?') . "'><img src='/style/icons/3.png' alt=''/></a> ";
echo "<a href="?id=$foto[id]&rating=4" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 4?') . "'><img src='/style/icons/4.png' alt=''/></a> ";
echo "<a href="?id=$foto[id]&rating=5" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 5?') . "'><img src='/style/icons/5.png' alt=''/></a> ";
echo "<a href="?id=$foto[id]&rating=5i" data-toggle='tooltip' data-placement='top' title='" . lang('Ваша оценка 5') . "+?'><img src='/style/icons/6.png' alt=''/></a> ";
echo "</center></div>";
} else {
$rate = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_rating` WHERE `id_foto` = $foto[id] AND `id_user` = '$user[id]' LIMIT 1"));
if (isset($user) && $user['id'] != $ank['id']) {
echo "<div class='list-group-item-null list-group-item-info'>";
echo "Ваша оценка <img style='vertical-align:middle;' src='/style/icons/$rate[like].png' alt=''/></a>";
echo "</div>";
}
}
if (access('foto_foto_edit') && $ank['level'] > $user['level'] || isset($user) && $ank['id'] == $user['id']) {
include 'inc/gallery_show_foto_form.php';
}
echo "<div class='list-group-item-null list-group-item-grey'>";
echo "<a href='" . DIR_FOTO . "$ank[id]/$gallery[id]/komm/$foto[id]/'>";
echo "<i class='fa fa-comments fa-fw'></i> " . lang('Показать все комментарии') . " <span class='label label-info'>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$foto[id]'"), 0) . "</span>";
echo "</a></div>";
if (isset($_POST['msg']) && isset($user)) {
$msg = $_POST['msg'];
$mat = antimat($msg);
if ($mat) {
$_SESSION['err'] = lang("В тексте сообщения обнаружен мат: $mat");
}
if (utf8_strlen($msg) > 10024) {
$_SESSION['err'] = lang("Сообщение слишком длинное");
} elseif (utf8_strlen($msg) < 2) {
$_SESSION['err'] = lang("Короткое сообщение");
} elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$foto[id]' AND `id_user` = '$user[id]' AND `msg` = '" . mysql_real_escape_string($msg) . "' LIMIT 1"), 0) != 0) {
$_SESSION['err'] = lang("Ваше сообщение повторяет предыдущее");
} elseif (!isset($err)) {
if ($ank['id'] != $user['id']) {
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$SexOst [url=/modules/foto/$ank[id]/$gallery[id]/komm/$foto[id]/]комментарий к Вашему фото[/url]', '$time')");
}
mysql_query("INSERT INTO `gallery_komm` (`id_foto`, `id_user`, `time`, `msg`) values('$foto[id]', '$user[id]', '$time', '" . mysql_real_escape_string($msg) . "')");
mysql_query("UPDATE `user` SET `money` = '" . ($user['money'] + 3) . "', `activity` = '" . ($user['activity'] + 2) . "' WHERE `id` = '$user[id]' LIMIT 1");
$_SESSION['message'] = lang('Сообщение успешно добавлено');
header("Location: ?");
}
}
if ((access('foto_foto_komm_del') || $ank['id'] == $user['id']) && isset($_GET['delete']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id`='" . intval($_GET['delete']) . "' AND `id_foto`='$foto[id]' LIMIT 1"), 0) != 0) {
mysql_query("DELETE FROM `gallery_komm` WHERE `id`='" . intval($_GET['delete']) . "' LIMIT 1");
admin_log('Фотоальбомы', 'Удаление сообщения', "Удаление сообщения от $anks[nick]");
$_SESSION['message'] = lang('Сообщение удалено');
header("Location: ?");
exit;
}
err();
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$foto[id]'"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
if ($k_post == 0) {
$doc->NoResult();
}
$q = mysql_query("SELECT * FROM `gallery_komm` WHERE `id_foto` = '$foto[id]' ORDER BY `id` ASC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$ank2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]' LIMIT 1"));
echo "<table class='list-group-item-null'><tr><td class='icon14'>";
avatar($ank2['id'], '40', 'border-radius: 2px;');
echo " </td><td class='null'>n";
echo "<div style='float:right;' id='hides' title='" . date::time($post['time']) . "'><small>" . date::timek($post['time']) . "</small></div>";
user($ank2['id']);
echo "<br />";
if (access('foto_foto_komm_del') || $ank['id'] == $user['id']) {
echo "<span style='float: right;' id='hides'>";
echo "<a href='?delete=$post[id]'><i class='fa fa-trash-o'></i></a>";
echo "</span>";
}
echo toOutput($post['msg']);
echo "</td></tr></table>n";
echo "<div class='hr'></div>";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
if (isset($user)) {
if ($foto['komm'] == 'all' || $foto['komm'] == 'only_me' && ($user['id'] == $ank['id'] || $user['level'] >= 3) || $foto['komm'] == 'friends' && ($ank['id'] == $user['id'] || $user['level'] >= 3 || mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE (`user` = '$user[id]' AND `friends` = '$ank[id]') OR (`user` = '$ank[id]' AND `friends` = '$user[id]')"), 0) != 0)) {
echo "<form method='post' class='list-group-item-null' name='message' action='?$passgen'>n";
echo auto_bb("message", "msg");
$doc->Textarea('msg', null, 10024);
echo "<br />";
$doc->Button('btn btn-primary btn-sm', null, 'pencil', 'Опубликовать');
echo "</form>";
} else {
echo "<div class='list-group-item-null list-group-item-info'>";
echo lang('Автор ограничил круг лиц, которые могут оставлять комментарии');
echo "</div>";
}
}
require_once H . 'sys/inc/tfoot.php';
exit;