Файл: user/mail/inc/photo.form.php
Строк: 34
<?php
if (isset($_GET['category_id'])) {
$category_id = (int) $_GET['category_id'];
$set['p_str'] = 24;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$user[id]' AND `id_gallery` = '$category_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='list-group-item'>";
echo "<span class='fa fa-info-circle fa-fw'></span> Нет результатов";
echo "</div>";
}
$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$user[id]' AND `id_gallery` = '$category_id' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
echo "<div class='list-group-item'>";
while ($post = mysql_fetch_assoc($q)) {
echo "<a href='?type=$type&attachments_id=$post[id]'><img src='/modules/foto/foto48/$post[id].$post[ras]' /></a>";
}
echo "</div>";
if ($k_page > 1) {
echo "<div class='list-group-item'>";
str('?type=' . $type . '&category_id=' . $category_id . '&', $k_page, $page);
echo "</div>";
}
$urlBack = '?type=' . $type . '&category';
} elseif (isset($_GET['category'])) {
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$user[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='list-group-item'>";
echo "<span class='fa fa-info-circle fa-fw'></span> Нет результатов";
echo "</div>";
}
$q = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$user[id]' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0);
echo "<div class='list-group-item'>";
echo "<a href='?type=$type&category_id=$post[id]'><span class='fa fa-folder fa-fw'></span> $post[name] ($count фото)</a>";
echo "</div>";
}
if ($k_page > 1) {
echo "<div class='list-group-item'>";
str('?type=' . $type . '&category&', $k_page, $page);
echo "</div>";
}
$urlBack = '?type=' . $type;
} else {
$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$user[id]' ORDER BY `id` DESC LIMIT 5");
if (mysql_num_rows($q) > 0) {
echo "<div class='list-group-item'>";
while ($post = mysql_fetch_assoc($q)) {
echo "<a href='?type=$type&attachments_id=$post[id]'><img src='/modules/foto/foto48/$post[id].jpg' /></a> ";
}
echo "</div>";
echo "<div class='list-group-item'>";
echo "<a href='?type=$type&category'>Показать все фото</a>";
echo "</div>";
} else {
echo "<div class='alert alert-info'>У вас еще нет на сайте загруженных фотографий, но вы можете воспользоваться формой ниже.</div>";
}
?>
<form class="list-group-item" action="?type=<?= $type ?>" method="POST" enctype="multipart/form-data">
<b>Добавить файл</b><br />
<label class="file">
<input type="file" id="file" name="file" accept="image/*,image/jpeg">
<span class="file-custom"></span>
</label>
<br />
<b>Описание</b><br />
<textarea name="msg" class="form-control" rows="2" placeholder=""></textarea><br />
<button type="submit" name="submit" class="btn btn-success">Загрузить</button>
</form>
<?php
$urlBack = '/user/mail/messageList.php?contact=' . urlencode($_SESSION['mail']['to']);
}
echo "<div class='list-group-item'><a href='$urlBack'><span class='fa fa-arrow-left'></span> Назад</a></div>";