Файл: modules/foto/inc/user_gallery.php
Строк: 69
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 12.11.2015
* Модифицировал densnet
*/
if (!isset($user) && !isset($_GET['id_user'])) {
header("Location: /modules/foto/?" . SID);
exit;
}
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id_user'])) {
$ank['id'] = intval($_GET['id_user']);
}
$ank = user::get_user($ank['id']);
if (!$ank) {
header("Location: /modules/foto/?" . SID);
exit;
}
$set['title'] = $ank['nick'] . ' - Фотоальбомы'; // заголовок страницы
require_once H . 'sys/inc/thead.php';
title();
aut();
err();
include 'inc/gallery_act.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$ank[id]'"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
include 'inc/gallery_form.php';
$where = NULL;
$q = mysql_query("SELECT * FROM `gallery`");
while ($post = mysql_fetch_assoc($q)) {
$ank2 = user::get_user($post['id_user']);
if ($post['access'] == 'all' || $post['access'] == 'friends' && ($ank2['level'] < $user['level'] || isset($user) && $ank2['id'] == $user['id']) || $post['access'] == 'pass' || $post['access'] == 'friends' && (mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE (`user` = '$user[id]' AND `friends` = '$ank2[id]') OR (`user` = '$ank2[id]' AND `friends` = '$user[id]')"), 0) != 0 || $ank2['level'] < $user['level'] || isset($user) && $ank2['id'] == $user['id']) || $post['access'] == 'auth' && isset($user)) {
$where = $where . " " . ($where == NULL ? "AND (" : "OR ") . "`id` = '$post[id]'";
}
}
if ($where != NULL) {
$where = $where . ")";
}
echo "<div style = 'font-size: 16px;font-weight: bold;color:#9197a3;-webkit-font-smoothing: antialiased;text-transform: uppercase;' class = 'comm'>Фотоальбомы - $k_post</div>";
if ($k_post == 0) {
echo "<div class = 'alert alert-danger'>";
echo "<span class='glyphicon glyphicon-warning-sign'></span> Нет результатов";
echo "</div>";
}
$q = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]' ORDER BY RAND()"));
echo "<div class = 'comm'>";
echo "<table><tr><td class = 'icon14'>";
if ($foto == null) {
echo "<div class = 'photos'>";
echo "<div class = 'photos_blok'><img src = '/style/icons/foto_mini.png'/> " . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0) . "</div>";
echo "<a href='" . DIR_FOTO . "$ank[id]/$post[id]/'><img src='" . DIR_FOTO . "foto48/0.png' alt='Нет фото' />";
echo "</a></div>";
} else {
echo "<div class = 'photos'>";
echo "<div class = 'photos_blok'><img src = '/style/icons/foto_mini.png'/> " . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0) . "</div>";
echo "<a href='" . DIR_FOTO . "$ank[id]/$post[id]/'>";
echo "<img src='" . DIR_FOTO . "foto48/$foto[id].$foto[ras]' title = '" . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0) . " фото' alt='Фото_$foto[id]' />";
echo "</a></div>";
}
echo "</td><td class = 'null'>n";
echo "<span style = 'float:right;' id = 'hides'>";
echo "" . date::times($post['time_create']) . "";
echo "</span>";
echo "<a href = '" . DIR_FOTO . "$ank[id]/$post[id]/'>$post[name]</a><br />";
if ($post['opis'] == null) {
echo "";
} else {
echo "<small>";
echo text::toOutput($post['opis']) . "<br />n";
echo "</small>";
}
echo "</td></tr></table></div>n";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
require_once H . 'sys/inc/tfoot.php';
exit;