Файл: modules/foto/inc/user_gallery.php
Строк: 63
<?php
/* Мод "Фотоальбомы"
* Версия v0.0.1
* Дата последнего редактирования 27.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Файл user_gallery.php
* Описание: выводит фотоальбомы пользователя
*/
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';
include 'inc/gallery_act.php';
title();
err();
aut();
#Навигация
echo "<div class = 'navigation'><a href = '/index.php'>Главная</a> > <a href = '" . DIR_FOTO . "'>Фотоальбомы</a> > <a href = '" . DIR_FOTO . "$ank[id]/'><b>Альбомы $ank[nick]</b></a></div>";
$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: 18px;font-weight: bold;' class = 'razdel'>" . img('albom.png') . " Фотоальбомы ($k_post)</div>";
if ($k_post == 0) {
echo "<div class = 'errs'>";
echo img('error.png') . " Нет результатов";
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 "<table class = 'razd'><tr><td class = 'icon14'>";
if ($foto == null) {
echo "<div class = 'photos'>";
echo "<div class = 'photos_blok'>" . img('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('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::time($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>n";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
require_once H . 'sys/inc/tfoot.php';
exit;