Файл: loads/inc/dir.php
Строк: 247
<?php
if (dir_name($dir_loads) != NULL) {
$set['title'] = lang('Загрузки') . ' - ' . dir_name($dir_loads);
} else {
$set['title'] = lang('Загрузки');
}
include_once H . 'sys/inc/thead.php';
include 'inc/admin_act.php';
err();
aut();
$_SESSION['sort'] = 0;
if (isset($_GET['sort'])) {
$_SESSION['sort'] = $_GET['sort'];
}
if ($_SESSION['sort'] == "") {
$_SESSION['sort'] = 0;
}
if ($_SESSION['sort'] == 1) {
$order = "loads";
} elseif ($_SESSION['sort'] == 2) {
$order = "rating";
} elseif ($_SESSION['sort'] == 4) {
$order = "size";
} elseif ($_SESSION['sort'] == 3) {
$order = "name";
} else {
$order = "time";
}
$dirlist_t = NULL;
$opendir = opendir($dir_loads);
while ($readdir = readdir($opendir)) {
$dirlist = scandir($dir_loads);
}
$offsetarray = 0;
foreach ($dirlist as $readdir) {
if (!preg_match("#^.|.name$|.99.99.name|.99.99.jad$|.opis$|.php$|.sql$|.dirname$#i", $readdir) && !preg_match("#.1.JPG$|.1.PNG$|.1.GIF$|.1.JPEG$|.2.JPG$|.2.PNG$|.2.GIF$|.2.JPEG$|.3.JPG$|.3.PNG$|.3.GIF$|.3.JPEG$#", $readdir)) {
$offsetarray++;
if (is_file($dir_loads . '/' . $readdir))
$filesqlinfo = mysql_fetch_assoc(mysql_query("SELECT * FROM `loads_list` WHERE(`name`='$readdir' && `path`='/" . $l . "/' && `size`='" . filesize($dir_loads . '/' . $readdir) . "') LIMIT 1"));
$dirlist_t[] = is_dir($dir_loads . '/' . $readdir) ? array('dir' => 1, 'name' => '000' . $readdir . '', 'size' => 1000 * 1024 * 1024 * 1024 * 1024, 'loads' => '999999', 'rating' => '999999', 'time' => '9999999999') : array('dir' => 0, 'name' => $readdir, 'size' => $filesqlinfo['size'], 'loads' => $filesqlinfo['loads'], 'rating' => $filesqlinfo['rating'], 'time' => $filesqlinfo['time']);
}
}
function cmp_name($a2, $b2) {
return ($a2['name'] >= $b2['name']) ? 1 : 0;
}
function cmp_dir($a2, $b2) {
return ($a2['dir'] < $b2['dir']) ? 1 : 0;
}
function cmp_size($a2, $b2) {
return ($a2['size'] <= $b2['size']) ? 1 : 0;
}
function cmp_loads($a2, $b2) {
return ($a2['loads'] <= $b2['loads']) ? 1 : 0;
}
function cmp_rating($a2, $b2) {
return ($a2['rating'] <= $b2['rating']) ? 1 : 0;
}
function cmp_time($a2, $b2) {
return ($a2['time'] <= $b2['time']) ? 1 : 0;
}
if (count($dirlist_t) != 0) {
usort($dirlist_t, "cmp_" . $order . "");
}
$k_post = count($dirlist_t);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$end = $set['p_str'] * $page;
if ($l != NULL) {
#Навигация
echo "<div class='list-group-item-null list-group-item-grey'><small>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='?'>" . lang('Загрузки') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo rupath($l, '../sys/loads/files');
echo "</small></div><br />";
} else {
#Навигация
echo "<div class='list-group-item-null list-group-item-grey'><small>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Загрузки');
echo "</small></div><br />";
}
echo "<div class='list-group-item-null list-group-item-grey'><ul class='nav nav-pills'>";
if ($_SESSION['sort'] == 0) {
echo "<li class='nav-item'><a class='nav-link active'>" . lang('Дата') . "</a></li>";
} else {
echo "<li class='nav-item'><a class='nav-link' href='/loads/?d=$l&page=" . @$_GET['page'] . "&sort=0'>" . lang('Дата') . "</a></li>";
}
if ($_SESSION['sort'] == 3) {
echo "<li class='nav-item'><a class='nav-link active'>" . lang('Имя') . "</a></li>";
} else {
echo "<li class='nav-item'><a class='nav-link' href='/loads/?d=$l&page=" . @$_GET['page'] . "&sort=3'>" . lang('Имя') . "</a></li>";
}
if ($_SESSION['sort'] == 2) {
echo "<li class='nav-item'><a class='nav-link active'>" . lang('Рейтинг') . "</a></li>";
} else {
echo "<li class='nav-item'><a class='nav-link' href='/loads/?d=$l&page=" . @$_GET['page'] . "&sort=2'>" . lang('Рейтинг') . "</a></li>";
}
echo "</ul></div>";
if ($k_post == 0) {
$doc->NoResult();
}
for ($i = $start; $i < $end && $i < $k_post; $i++) {
$dirlist[$i] = $dirlist_t[$i]['name'];
#Список папок
if ($dirlist_t[$i]['dir'] == 1) {
$dirlist[$i] = substr($dirlist[$i], 3, strlen($dirlist[$i]));
echo "<div class='list-group-item-null'>n";
echo "<a href='?d=" . urlencode("$l/$dirlist[$i]") . "'><i class='fa fa-folder fa-fw'></i> <b>" . dir_name($dir_loads . '/' . $dirlist[$i]) . "</b></a> <span class='count'>" . k_files($l . '/' . $dirlist[$i]) . "</span>n";
if (access('loads_dir_rename') || access('loads_dir_mesto') || access('loads_dir_delete')) {
if (access('loads_dir_rename')) {
echo "<a href="?" . url("d=$l/$dirlist[$i]&act=rename&page=$page") . "" class='hint--top' data-hint='" . lang('Редактировать папку') . "'><i class='fa fa-edit fa-fw'></i></a> n";
}
if (access('loads_dir_delete')) {
echo "<a href="?" . url("d=$l/$dirlist[$i]&act=delete&page=$page") . "" class='hint--top' data-hint='" . lang('Удалить папку') . "'><i class='fa fa-trash-o'></i></a>n";
}
}
echo "</div>n";
echo "<div class='hr'></div>";
} else {
#Список файлов
$ras = strtolower(preg_replace('#^.*.#i', NULL, $dirlist[$i]));
$name = preg_replace('#.[^.]*$#i', NULL, $dirlist[$i]);
if (is_file($dir_loads . '/' . $dirlist[$i] . '.name')) {
$name2 = trim(esc(file_get_contents($dir_loads . '/' . $dirlist[$i] . '.name')));
} elseif (function_exists('iconv')) {
$name2 = iconv('windows-1251', 'utf-8', $name);
} else {
$name2 = $name;
}
$name2 = htmlspecialchars($name2);
$size = filesize($dir_loads . '/' . $dirlist[$i]);
echo "<table class='list-group-item-null'><tr><td class='icon14'>n";
if (is_file($dir_loads . '/' . $dirlist[$i] . '.1.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].1.GIF") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.1.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].1.JPG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.1.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].1.PNG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.1.JPEG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].1.JPEG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} else
if (is_file($dir_loads . '/' . $dirlist[$i] . '.2.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].2.GIF") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.2.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].2.JPG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.2.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].2.PNG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.2.JPEG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].2.JPEG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} else
if (is_file($dir_loads . '/' . $dirlist[$i] . '.3.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].3.GIF") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.3.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].3.JPG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.3.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].3.PNG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '.3.JPEG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i].3.JPEG") . "&w=59&h=59" style='width: 60px; heigth: 60px;' alt="Скрин..." /><br />n";
} else {
if (is_file(H . "loads/inc/icon48/$ras.php")) {
include H . "loads/inc/icon48/$ras.php";
}
}
echo "</td><td class='null'>n";
if ($set['echo_rassh'] == 1) {
$ras2 = ".$ras";
} else {
$ras2 = NULL;
}
if (access('loads_file_edit') || access('loads_file_delete')) {
echo "<span style='float: right;'>";
if (access('loads_file_edit')) {
echo "<a href="?" . url("d=$l&act=prop&f=" . urlencode("$dirlist[$i]") . "&page=$page") . "" class='hint--top' data-hint='" . lang('Редактировать') . "'><i class='fa fa-edit fa-fw'></i></a> n";
}
if (access('loads_file_delete')) {
echo "<a href="?" . url("d=$l&act=delete&f=" . urlencode("$dirlist[$i]") . "&page=$page") . "" class='hint--top' data-hint='" . lang('Удалить') . "'><i class='fa fa-trash-o'></i></a>n";
}
echo "</span>";
}
include 'inc/icon14.php';
echo "<a href="?" . url("d=$l&scr=1&f=" . urlencode("$dirlist[$i]") . "&page=$page") . "">$name2$ras2</a> " . file_new($dir_loads . '/' . $dirlist[$i]) . "<br />n";
if (!isset($set['prosm_select']) || $set['prosm_select'] == '0') {
if (is_file($dir_loads . '/' . $name . '.mp3')) {
if (IS_WEB) {
echo "<span style='float: right;'>";
echo '<object id="audioplayer56" type="application/x-shockwave-flash" data="/sys/uppod-audio.swf" width="20" height="20"><param name="bgcolor" value="#000000" /><param name="allowScriptAccess" value="always" /><param name="movie" value="/sys/uppod-audio.swf" /><param name="flashvars" value="comment=dfgh&st=/loads/st/audio145-1103.txt&file=/loads/down/' . $l . '/' . $dirlist[$i] . '" /></object>';
echo "</span>";
}
}
}
if (!isset($set['skrin_select']) || $set['skrin_select'] == '0') {
if (!isset($set['opis_select']) || $set['opis_select'] == '0') {
if (is_file($dir_loads . '/' . $dirlist[$i] . '.opis')) {
$tmp = toOutput(file_get_contents($dir_loads . '/' . $dirlist[$i] . '.opis'));
$tmp = text($tmp);
echo "<small style='color: grey;'>$tmp...</small><br />n";
}
}
if (!isset($set['opis_select']) || $set['opis_select'] == '1') {
$opis = mysql_result(mysql_query("SELECT `opis` FROM `loads_list` WHERE (`name` = '$dirlist[$i]' AND `path` = '" . mysql_real_escape_string($path) . "')"), 0);
if ($opis != NULL) {
echo text($opis) . "<br />n";
}
}
if ($set['echo_rassh'] == 1) {
$ras2 = ".$ras";
} else {
$ras2 = NULL;
}
if (!isset($set['podrob_select']) || $set['podrob_select'] == '0') {
echo "<table><tr><td rowspan='2'><small style='color: grey;'>n";
$prosm = @mysql_result(mysql_query("SELECT `prosm` FROM `loads_list` WHERE (`name` = '$dirlist[$i]' AND `path` = '$path')"), 0);
echo "<i class='fa fa-eye fa-fw'></i> " . $prosm . "<br />n";
echo "</small></td></tr></table>n";
}
}
if (!isset($set['skrin_select']) || $set['skrin_select'] == '1') {
if (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.1.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.1.GIF") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.1.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.1.JPG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.1.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.1.PNG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} else
if (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.2.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.2.GIF") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.2.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.2.JPG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.2.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.2.PNG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} else
if (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.3.GIF')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.3.GIF") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.3.JPG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.3.JPG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} elseif (is_file($dir_loads . '/' . $dirlist[$i] . '' . $file . '.3.PNG')) {
echo "<img src="resize.php?" . url("f=$l/$dirlist[$i]$file.3.PNG") . "&w=59&h=59" alt="Скрин..." /><br />n";
} else
if (is_file(H . "loads/inc/icon48/$ras.php")) {
include H . "loads/inc/icon48/$ras.php";
}
}
if (!isset($set['skrin_select']) || $set['skrin_select'] == '2') {
if (is_file($dir_loads . '/' . $dirlist[$i] . '.opis')) {
if (!isset($set['opis_select']) || $set['opis_select'] == '0') {
$tmp = toOutput(file_get_contents($dir_loads . '/' . $dirlist[$i] . '.opis'));
$tmp = text($tmp);
echo "<small style='color: grey;'>$tmp...</small><br />n";
}
}
if (!isset($set['opis_select']) || $set['opis_select'] == '1') {
$opis = mysql_result(mysql_query("SELECT `opis` FROM `loads_list` WHERE (`name` = '$dirlist[$i]' AND `path` = '" . mysql_real_escape_string($path) . "')"), 0);
if ($opis != NULL) {
echo text($opis) . "<br />n";
}
}
echo "n";
if (!isset($set['podrob_select']) || $set['podrob_select'] == '0') {
echo "n";
echo "<a href='?d=" . urlencode("$l") . "&scr=1&f=" . urlencode("$dirlist[$i]") . "&page=$page'><b>Подробно</b></a><br />n";
}
}
echo "</td></tr></table>n";
echo "<div class='hr'></div>n";
}
}
if ($k_page > 1) {
str("?d=" . urlencode("$l") . "&", $k_page, $page);
}
include 'inc/admin_form.php';
if ($l == NULL) {
echo "<a href='/loads/top.php' class='list-group-item-null list-group-item-grey'><i class='fa fa-bar-chart fa-fw'></i> Топ 20 файлов</a>n";
echo "<a href='/loads/search.php' class='list-group-item-null list-group-item-grey'><i class='fa fa-search fa-fw'></i> Поиск файлов</a>n";
echo "<a href='/loads/stats.php' class='list-group-item-null list-group-item-grey'><i class='fa fa-line-chart fa-fw'></i> Статистика</a>n";
}
include_once '../sys/inc/tfoot.php';
?>