Файл: user/mail/inc/photo.form.php
Строк: 41
<?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' style='margin-top: 5px;margin-bottom: 5px;'>n";
echo "<i class='material-icons'>feedback</i> Нет результатовn";
echo "</div>n";
}
$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' style='margin-top: 5px;margin-bottom: 5px;'>n";
echo "<i class='material-icons'>feedback</i> Нет результатовn";
echo "</div>n";
}
$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]'><i class='material-icons'>folder</i> $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>";
}
echo "<form class='list-group-item' action='?type=$type' method='POST' enctype='multipart/form-data'>";
echo "<div class='file-field input-field'>";
echo "<div class='btn'><span>Файл</span>";
echo "<input name='file' type='file' accept='image/*,image/jpeg' multiple>";
echo "</div>";
echo "<div class='file-path-wrapper'>";
echo "<input class='file-path validate' type='text' placeholder='Выберите изображение'>";
echo "</div>";
echo "</div>";
echo "<div class='row'>";
echo "<div class='input-field col s12'>";
echo "<textarea name='msg' id='msg' length='256' class='materialize-textarea'></textarea>";
echo "<label for='msg'>Описание</label>";
echo "</div>";
echo "</div>";
echo "<button type='submit' name='submit' class='waves-effect waves-light btn'>Загрузить</button>";
echo "</form>";
$urlBack = '/user/mail/messageList.php?contact=' . urlencode($_SESSION['mail']['to']);
}
echo "<div class='list-group-item'><a href='$urlBack'><i class='material-icons'>keyboard_backspace</i> Назад</a></div>";