Файл: modules/foto/inc/user_gallery.php
Строк: 74
<?php
/* DCMS Special
* Дата последнего редактирования 11.12.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 = get_user($ank['id']);
if (!$ank) {
header("Location: /modules/foto/?" . SID);
exit;
}
$set['title'] = $ank['nick'] . ' - Фотоальбомы'; // заголовок страницы
require_once H . 'sys/inc/thead.php';
aut();
err();
include 'inc/gallery.php';
#Навигация
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='" . DIR_FOTO . "'>Фотоальбомы</a></li>";
echo "<li class='active'>Альбомы $ank[nick]</li>";
echo "</ol>";
$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'];
$where = NULL;
$q = mysql_query("SELECT * FROM `gallery`");
while ($post = mysql_fetch_assoc($q)) {
$ank2 = 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 class='list-group-item'>";
if (isset($user) && $user['id'] == $ank['id']) {
echo "<span style='float: right;' id='hides'>";
echo "<a href='" . DIR_FOTO . "$ank[id]/?act=create'><span style='padding: 10px;' data-toggle='tooltip' data-placement='left' title='Создать альбом'><i class='fa fa-plus fa-lg'></i></span></a>";
echo "</span>";
}
echo "<div style='font-size: 16px;font-weight: bold;color:#9197a3;-webkit-font-smoothing: antialiased;text-transform: uppercase;'>Фотоальбомов - $k_post</div>";
echo "</div>";
if ($k_post == 0) {
echo "<div class='list-group-item'>";
echo "<i class='fa fa-info-circle fa-fw'></i> Нет результатов";
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='list-group-item'>";
echo "<table><tr><td class='icon14'>";
if ($foto == null) {
echo "<div class = 'photos'>";
echo "<div class = 'photos_blok'><small><span class='fa fa-camera fa-fw'></span> <b>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0) . "</b></small></div>";
echo "<a href='" . DIR_FOTO . "$ank[id]/$post[id]/'><img style='width:100px;height:100px;' src='" . DIR_FOTO . "foto128/0.png' alt='Нет фото' />";
echo "</a></div>";
} else {
echo "<div class = 'photos'>";
echo "<div class = 'photos_blok'><small><span class='fa fa-camera fa-fw'></span> <b>" . mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0) . "</b></small></div>";
echo "<a href='" . DIR_FOTO . "$ank[id]/$post[id]/'>";
echo "<img style='width:100px;height:100px;' src='" . DIR_FOTO . "foto128/$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 "<a href='" . DIR_FOTO . "$ank[id]/$post[id]/'>$post[name]</a><br />";
if ($post['opis'] == null) {
echo "";
} else {
echo "<small>";
if ($post['opis'] == null) {
echo 'Без описания<br />';
} else {
echo toOutput($post['opis']) . "<br />n";
}
echo "</small>";
}
if ($post['access'] == 'all') {
echo "<small><i class='fa fa-unlock fa-fw'></i> Доступен всем</small>";
} elseif ($post['access'] == 'only_me') {
echo "<small><i class='fa fa-lock fa-fw'></i> Доступен только автору</small>";
} elseif ($post['access'] == 'friends') {
echo "<small><i class='fa fa-users fa-fw'></i> Доступен только друзьям автора</small>";
} elseif ($post['access'] == 'pass') {
echo "<small><i class='fa fa-key fa-fw'></i> Доступен только по паролю</small>";
} elseif ($post['access'] == 'auth') {
echo "<small><i class='fa fa-user fa-fw'></i> Доступен только авторизованным</small>";
}
echo "<span style='color:grey;' title='" . date::time($post['time_create']) . "'>";
echo "<br />" . date::times($post['time_create']) . "";
echo "</span>";
echo "</td></tr></table></div>n";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
require_once H . 'sys/inc/tfoot.php';
exit;