Файл: modules/obmen/inc/dir.php
Строк: 160
<?php
/* DCMS Special
* Дата последнего редактирования 20.12.2015
* Модифицировал densnet
*/
$list = null;
if ($l == '/') {
$set['title'] = 'Файловый обменник';
} else {
$set['title'] = 'Обменник - ' . $dir_id['name'];
}
$_SESSION['page'] = 1;
require_once H . 'sys/inc/thead.php';
aut();
err();
include 'inc/upload_act.php';
include 'inc/admin_act.php';
define('ICONS_FILES', 'style/files/');
if ($l != '/') {
#Навигация
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='" . DIR_OBMEN . "'>Обменник</a></li>";
echo obmen_path($l);
echo "</ul>";
echo "</nav>";
} else {
#Навигация
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='" . DIR_OBMEN . "'>Обменник</a></li>";
echo "</ul>";
echo "</nav>";
}
echo "<a href='" . DIR_OBMEN . "search.php' class='list-group-item'><i class='material-icons'>search</i> Поиск</a>";
echo "<a href='" . DIR_OBMEN . "new.php' class='list-group-item'><i class='material-icons'>fiber_new</i> Новые файлы</a>";
$q = mysql_query("SELECT * FROM `obmennik_dir` WHERE `dir_osn` = '/$l' OR `dir_osn` = '$l/' OR `dir_osn` = '$l' ORDER BY `name`,`num` ASC");
while ($post = mysql_fetch_assoc($q)) {
$list[] = array('dir' => 1, 'post' => $post);
}
$q = mysql_query("SELECT * FROM `obmennik_files` WHERE `id_dir` = '$id_dir' ORDER BY `time` DESC");
while ($post = mysql_fetch_assoc($q)) {
$list[] = array('dir' => 0, 'post' => $post);
}
$k_post = sizeof($list);
$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> Нет результатов";
echo "</div>";
}
for ($i = $start; $i < $k_post && $i < $set['p_str'] * $page; $i++) {
if ($list[$i]['dir'] == 1) { // папка
$post = $list[$i]['post'];
$k_f = 0;
$k_n = 0;
$q3 = mysql_query("SELECT * FROM `obmennik_dir` WHERE `dir_osn` like '$post[dir]%'");
while ($post2 = mysql_fetch_assoc($q3)) {
$k_f = $k_f + mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post2[id]'"), 0);
$k_n = $k_n + mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post2[id]' AND `time` > '" . (time() - 60 * 60 * $set['loads_new_file_hour']) . "'", $db), 0);
}
$k_f = $k_f + mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post[id]'"), 0);
$k_n = $k_n + mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_files` WHERE `id_dir` = '$post[id]' AND `time` > '" . (time() - 60 * 60 * $set['loads_new_file_hour']) . "'", $db), 0);
if ($k_n == 0) {
$k_n = NULL;
} else {
$k_n = ' +' . $k_n;
}
echo "<div class='list-group-item' style='margin-top: 5px;margin-bottom: 5px;'>n";
echo "<span class='badge'>$k_f$k_n</span>";
echo "<a href='/modules/obmen" . htmlspecialchars($post['dir']) . "'><i class='material-icons'>folder</i> " . htmlspecialchars($post['name']) . "</a>";
echo "</div>";
} else {
unset($file); // зачищаем данные о файле
$file['id_user'] = $list[$i]['post']['id_user'];
$file['path'] = H . "sys/obmen/files/" . $list[$i]['post']['id'] . ".dat";
$file['size'] = $list[$i]['post']['size'];
$file['blok'] = $list[$i]['post']['blok'];
$file['parol'] = $list[$i]['post']['parol'];
$file['name'] = $list[$i]['post']['name'];
$file['time'] = $list[$i]['post']['time'];
$file['ras'] = $list[$i]['post']['ras'];
$file['file'] = $file['name'] . '.' . $file['ras'];
$file['file_base64'] = base64_encode($file['file']);
$file['ufile'] = 'obm~' . $file['name'] . '.' . $file['ras'];
echo "<div class='list-group-item' style='margin-top: 5px;margin-bottom: 5px;'>n";
$file['icon'] = false;
include 'inc/icons.php';
if ($file['ras'] == 'zip') {
$rs = 'ZIP';
} elseif ($file['ras'] == 'png') {
$rs = 'PNG';
} elseif ($file['ras'] == 'jpg') {
$rs = 'JPG';
} elseif ($file['ras'] == 'gif') {
$rs = 'GIF';
} else {
$rs = $file['ras'];
}
echo "<span style = 'float:right;color:green;'>";
echo "<small>" . size_file($file['size']) . " $rs</small> ";
if ($file['blok'] != NULL) {
echo "<span title = 'Заблокирован'><i class='material-icons'>block</i></span> ";
}
if ($file['parol'] != NULL) {
echo "<span title = 'Защищен паролем'><i class='material-icons'>block</i></span>";
}
echo "</span>";
if (is_file("inc/icons/$ras.php")) {
include "inc/icons/$ras.php";
}
echo "<img src='$file[icon]' style='width: 50px; height: 50px;'/> ";
if ($post['ras'] == 'zip' || $post['ras'] == 'rar') {
$r = "<i class='material-icons'>archive</i>";
} elseif ($post['ras'] == 'png' || $post['ras'] == 'jpg' || $post['ras'] == 'jpeg' || $post['ras'] == 'gif') {
$r = "<i class='material-icons'>insert_photo</i>";
} elseif ($post['ras'] == 'mp3') {
$r = "<i class='material-icons'>library_music</i>";
} elseif ($post['ras'] == 'txt') {
$r = "<i class='material-icons'>format_align_center</i>";
} elseif ($post['ras'] == 'mp4' || $post['ras'] == 'avi' || $post['ras'] == '3gp') {
$r = "<i class='material-icons'>video_library</i>";
} elseif ($post['ras'] == 'php') {
$r = "<i class='material-icons'>code</i>";
} else {
$r = "<i class='material-icons'>insert_drive_file</i>";
}
echo "<a href='/modules/obmen" . url($dir_id['dir'] . $file['name'] . '.' . $file['ras']) . "?showinfo'>$r $file[name]" . ($set['echo_rassh'] ? ".$file[ras]" : null) . "</a><br />";
$file['opis'] = false;
include 'inc/opis.php';
echo "</div>";
}
}
if ($k_page > 1) {
echo "<div class='list-group-item'>";
str('?', $k_page, $page);
echo "</div>";
} // Вывод страниц
include 'inc/upload_form.php';
include 'inc/admin_form.php';