Файл: modules/obmen/inc/dir.php
Строк: 92
<?php
/* Мод "Обменник"
* Версия v0.0.1
* Дата последнего редактирования 24.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Файл dir.php
* Описание: Выводит список папок и файлов
*/
$list = null;
if ($l == '/') {
$set['title'] = 'Файловый обменник';
} else {
$set['title'] = 'Обменник - ' . $dir_id['name'];
}
$_SESSION['page'] = 1;
require_once H.'sys/inc/thead.php';
title();
include 'inc/upload_act.php';
include 'inc/admin_act.php';
err();
aut();
define('ICONS_FILES', 'style/img/files/');
echo "<div class='razd'>";
echo "<a class = 'count' href = '".DIR_OBMEN."new.php'>".img('new.png')." Новые файлы</a> ";
echo "<a class = 'count' href = '".DIR_OBMEN."search.php'>Пойск</a><br/>";
echo "</div>n";
if ($l != '/') {
echo "<div class = 'razd'>";
echo "<a href = '/index.php'>Главная</a> > <a href='".DIR_OBMEN."'>Обменник</a> > <b>" . obmen_path($l) . "</b>";
echo "</div>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 = 'errs'>";
echo img('error.png') . " Нет результатов";
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 = 'razd'>";
echo "<div style = 'float:right;'><a class = 'add'>$k_f<font color = 'red'>$k_n</font></a></div>";
echo img('folder.png') . " <a href = '/modules/obmen" . htmlspecialchars($post['dir']) . "'>" . 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['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 "<table class = 'razd'><tr><td class = 'icon14'>";
$file['icon'] = false;
include 'inc/icons.php';
echo "<img src = '$file[icon]'/>";
echo "</td><td class = 'null'>";
echo "<a href='/modules/obmen" . url($dir_id['dir'] . $file['name'] . '.' . $file['ras']) . "?showinfo'>$file[name]" . ($set['echo_rassh'] ? ".$file[ras]" : null) . "</a> ";
echo '[' . size_file($file['size']) . "]<br />n";
$file['opis'] = false;
include 'inc/opis.php';
echo "</td></tr></table>";
}
}
}
if ($k_page > 1) {
str('?', $k_page, $page);
} // Вывод страниц
include 'inc/upload_form.php';
include 'inc/admin_form.php';