View file user/files.php

File size: 2.89Kb
<?php

/* DCMS Special
 * Дата последнего редактирования 20.01.2016
 * Модифицировал densnet, POLO75
 */

foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
    require_once "../sys/inc/$inc.php";
}
if (isset($user)) {
    $ank['id'] = $user['id'];
}

if (isset($_GET['id'])) {
    $ank['id'] = intval($_GET['id']);
}

$ank = get_user($ank['id']);

$set['title'] = lang('' . $ank['nick'] . ' Файлы');
require_once H . 'sys/inc/thead.php';
only_reg();
aut();
err();

#Навигация
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='/id$ank[id]'>$ank[nick]</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Файлы');
echo "</small></div><br />";

$k_post = $db->super_query("SELECT COUNT(*) as count FROM `loads_list` WHERE `id_user` = '$ank[id]'");
$k_post = $k_post['count'];
$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) {
    $doc->NoResult();
}
$q = $db->query("SELECT * FROM `loads_list` WHERE `id_user` = '$ank[id]' LIMIT $start, $set[p_str]");
while ($post = $db->get_array($q)) {
    $i = passgen();
    $l = $post['path'];
    $l = preg_replace("#\./|/\.#", NULL, $l);
    $l = preg_replace("#(/){1,}#", "/", $l);
    $l = preg_replace("#(^(/){1,})|((/){1,}$)#", "", $l);
    $dir_loads = H . 'sys/loads/files/' . $l;
    $dirlist[$i] = $post['name'];
    if (function_exists('iconv')) {
        $dirlist[$i] = iconv('utf-8', 'windows-1251', $dirlist[$i]);
    }
    $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 = $post['size'];

    echo "<table class='list-group-item-null-mini list-group-item-grey dop'><tr><td class='icon14'>";
    include H . 'loads/inc/icon48.php';
    echo "</td><td class='null'>";
    if ($set['echo_rassh'] == 1) {
        $ras2 = ".$ras";
    } else {
        $ras2 = NULL;
    }
    echo "<a href='/loads/?d=" . urlencode("$l") . "&amp;scr=1&amp;f=" . urlencode("$dirlist[$i]") . "'>$name2$ras2</a>\n";
    echo "<br />\n";
    include H . 'loads/inc/opis.php';
    echo "</td></tr></table>\n";
}
if ($k_page > 1) {
    str('?id=' . $ank['id'] . '&amp;', $k_page, $page);
}

require_once H . 'sys/inc/tfoot.php';