Файл: user/bookmark/foto.php
Строк: 116
<?php
/* DCMS Special
* Дата последнего редактирования 21.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../../sys/inc/{$inc}.php";
}
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id'])) {
$ank['id'] = intval($_GET['id']);
}
$ank = get_user($ank['id']);
if ($ank['id'] == 0) {
header("Location: /index.php?" . SID);
exit;
}
if (isset($user) && isset($_GET['delete']) && $user['id'] == $ank['id']) {
mysql_query("DELETE FROM `bookmark_foto` WHERE `id` = '" . intval($_GET['delete']) . "' AND `id_user` = '$user[id]' LIMIT 1");
msg('Закладка удалена');
header("Location: ?page=" . intval($_GET['page']) . "" . SID);
exit;
}
if (!$ank) {
header("Location: /index.php?" . SID);
exit;
}
$set['title'] = 'Закладки - Фото - ' . $ank['nick']; // заголовок страницы
require_once H . 'sys/inc/thead.php';
aut();
err();
$users = mysql_result(mysql_query("SELECT COUNT(id_user) FROM `bookmark_user` WHERE `id_user` = '" . $ank['id'] . "'"), 0);
$foto = mysql_result(mysql_query("SELECT COUNT(id_user) FROM `bookmark_foto` WHERE `id_user` = '" . $ank['id'] . "'"), 0);
#Навигация
echo "<nav class='navbar navbar-light' style='background-color: #607D8B; color: #fff;'>";
echo "<ul class='nav navbar-nav'>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/'><i class='material-icons'>home</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/info.php?id=$ank[id]'>$ank[nick]</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'>Закладки</a></li>";
echo "</ul>";
echo "</nav>";
echo "<div class='card'>";
echo "<div class='card-header'>Закладки</div><div class='card-block'>";
echo "<ul class='nav nav-tabs'>";
echo "<li class='nav-item'><a class='nav-link' href='index.php?id=$ank[id]'>Люди <span class='label label-default'>$users</span></a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Фото <span class='label label-default'>$foto</span></a></li>";
echo "<li class='nav-item'><a class='nav-link' href='forum.php?id=$ank[id]'>Форум <span class='label label-default'>0</span></a></li>";
echo "</ul>";
echo "</div>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `bookmark_foto` 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'];
if ($k_post == 0) {
echo "<div class='card-block'>";
echo "<i class='material-icons'>feedback</i> Нет закладок";
echo "</div>";
}
$q = mysql_query("SELECT * FROM `bookmark_foto` WHERE `id_user` = '$ank[id]' ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$f = $post['id_foto'];
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '" . $f . "' LIMIT 1"));
$gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id`='" . $foto['id_gallery'] . "' LIMIT 1"));
$ank_p = get_user($gallery['id_user']);
if ($foto['ras'] == 'zip' || $foto['ras'] == 'rar') {
$r = "<i class='material-icons'>archive</i>";
} elseif ($foto['ras'] == 'png' || $foto['ras'] == 'jpg' || $foto['ras'] == 'jpeg' || $foto['ras'] == 'gif') {
$r = "<i class='material-icons'>insert_photo</i>";
} elseif ($foto['ras'] == 'mp3') {
$r = "<i class='material-icons'>library_music</i>";
} elseif ($foto['ras'] == 'txt') {
$r = "<i class='material-icons'>format_align_center</i>";
} elseif ($foto['ras'] == 'mp4' || $foto['ras'] == 'avi' || $foto['ras'] == '3gp') {
$r = "<i class='material-icons'>video_library</i>";
} elseif ($foto['ras'] == 'php') {
$r = "<i class='material-icons'>code</i>";
} else {
$r = "<i class='material-icons'>insert_drive_file</i>";
}
echo "<div class='card-block'>";
echo "<table><tr><td class = 'icon14'>";
echo "<a href='/modules/foto/$ank_p[id]/$gallery[id]/$foto[id]/' title='Перейти к фото'><img src='/modules/foto/foto48/$foto[id].$foto[ras]' /></a>";
echo "</td><td class = 'null'>";
if ($ank['id'] == $user['id']) {
echo "<span style='float:right;'><a href='?delete=$post[id]&page=$page' title='Удалить'><i class='material-icons'>delete</i></a></span>";
}
echo "<a href='/modules/foto/$ank_p[id]/$gallery[id]/$foto[id]/' title='Перейти к фото'>$r " . htmlspecialchars($foto['name']) . "</a><br />";
echo "<span title='" . date::time($post['time']) . "' style='color:grey;'>" . date::times($post['time']) . "</span>";
echo "</td></tr></table></div>";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
echo "</div>";
require_once H . 'sys/inc/tfoot.php';