Файл: modules/obmen/inc/dir.php
Строк: 114
<?php
/* DCMS Special
* Дата последнего редактирования 13.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 "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='" . DIR_OBMEN . "'>Обменник</a></li>";
echo "" . obmen_path($l) . "";
echo "</ol>n";
} else {
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li class='active'>Обменник</li>";
echo "</ol>n";
}
echo "<a href='" . DIR_OBMEN . "search.php' class='list-group-item'><span class='fa fa-search fa-fw'></span> Поиск</a>";
echo "<a href='" . DIR_OBMEN . "new.php' class='list-group-item'><span class='fa fa-file-o fa-fw'></span> Новые файлы</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'>";
echo "<span class='fa fa-info-circle fa-fw'></span> Нет результатов";
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'>";
echo "<span class='label label-default pull-right'>$k_f$k_n</span>";
echo "<a href = '/modules/obmen" . htmlspecialchars($post['dir']) . "'><span class='fa fa-folder fa-fw'></span> " . 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'];
if ($file['blok'] != NULL) {
echo " <a href='/modules/obmen" . url($dir_id['dir'] . $file['name'] . '.' . $file['ras']) . "?showinfo'><font color='red'><b>Файл заблокирован </b></font></a>";
} else {
echo "<div class = 'list-group-item'>";
$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 = 'Заблокирован'><span class='fa fa-ban'></span></span> ";
}
if ($file['parol'] != NULL) {
echo "<span title = 'Защищен паролем'><span class='fa fa-lock'></span></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 ($file['ras'] == 'zip' || $file['ras'] == 'rar') {
$r = "<i class='fa fa-file-archive-o fa-fw'></i>";
} elseif ($file['ras'] == 'png' || $file['ras'] == 'jpg' || $file['ras'] == 'jpeg' || $file['ras'] == 'gif') {
$r = "<i class='fa fa-file-image-o fa-fw'></i>";
} elseif ($file['ras'] == 'mp3') {
$r = "<i class='fa fa-file-audio-o fa-fw'></i>";
} elseif ($file['ras'] == 'txt') {
$r = "<i class='fa fa-file-text-o fa-fw'></i>";
} elseif ($file['ras'] == 'mp4' || $file['ras'] == 'avi' || $file['ras'] == '3gp') {
$r = "<i class='fa fa-file-video-o fa-fw'></i>";
} elseif ($file['ras'] == 'php') {
$r = "<i class='fa fa-file-code-o fa-fw'></i>";
} else {
$r = "<i class='fa fa-file-o fa-fw'></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) {
str('?', $k_page, $page);
} // Вывод страниц
include 'inc/upload_form.php';
include 'inc/admin_form.php';