Файл: modules/obmen/inc/dir.php
Строк: 118
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 25.11.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/icons/files/');
echo "<a href='" . DIR_OBMEN . "search.php' class='list-group-item'><span class='fa fa-search'></span> Поиск</a>";
echo "<a href='" . DIR_OBMEN . "new.php' class='list-group-item'><span class='fa fa-file-o'></span> Новые файлы</a>";
if ($l != '/') {
echo "<ol class = 'breadcrumb'>";
echo "<li><a href='/index.php'>Главная</a></li>";
echo "<li><a href='" . DIR_OBMEN . "'>Зона обмена</a></li>";
echo "" . obmen_path($l) . "";
echo "</ol>n";
}
$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 label-pill pull-right'>$k_f$k_n</span>";
echo "<a href = '/modules/obmen" . htmlspecialchars($post['dir']) . "'><span class='fa fa-folder'></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 ($post['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';
echo "<span style = 'float:right;color:green;'>";
echo "<small>" . size_file($file['size']) . "</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 ($file['ras'] == 'zip' || $file['ras'] == 'rar') {
$r = "<span class='fa fa-file-archive-o'></span>";
} elseif ($file['ras'] == 'png' || $file['ras'] == 'jpg' || $file['ras'] == 'jpeg' || $file['ras'] == 'gif') {
$r = "<span class='fa fa-file-image-o'></span>";
} elseif ($file['ras'] == 'mp3') {
$r = "<span class='fa fa-file-audio-o'></span>";
} elseif ($file['ras'] == 'txt') {
$r = "<span class='fa fa-file-text-o'></span>";
} elseif ($file['ras'] == 'mp4' || $file['ras'] == 'avi' || $file['ras'] == '3gp') {
$r = "<span class='fa fa-file-video-o'></span>";
} elseif ($file['ras'] == 'php') {
$r = "<span class='fa fa-file-code-o'></span>";
} else {
$r = "<span class='fa fa-file-o'></span>";
}
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';