<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Новые файлы';
include_once '../sys/inc/thead.php';
title();
err();
aut();

echo "<div class='foot'>Сортировка: ";
echo "| Новинки</a>\n";
echo "<a href=\"top.php\">| Топ 20 |</a> </a><br />\n";
echo'</div>';
echo "<table class='post'>\n";

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_list` WHERE `time` > '".($time-60*60*24)."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];

$q = mysql_query("SELECT * FROM `loads_list` WHERE `time` > '".($time-60*60*24)."' ORDER BY `time` DESC LIMIT $start, $set[p_str];");
if (mysql_num_rows($q)==0){
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Нет файлов\n";
echo "  </td>\n";
echo "   </tr>\n";
}

while ($post = mysql_fetch_assoc($q))
{
$i=passgen();
echo "   <tr>\n";
$l=$post['path'];
$l=ereg_replace("\./|/\.",NULL,$l);
$l=ereg_replace("(/){1,}","/",$l);
$l=ereg_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(eregi_replace('^.*\.', NULL, $dirlist[$i]));
$name=eregi_replace('\.[^\.]*$', 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'];
if ($set['set_show_icon']==2){
echo "  <td rowspan='2' class='icon48'>\n";
include H.'loads/inc/icon48.php';
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1){
echo "  <td class='icon14'>\n";
include H.'loads/inc/icon48.php';
echo "  </td>\n";
}
echo "  <td class='p_t'>\n";
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 "  </td>\n";
echo "   </tr>\n";
echo "   <tr>\n";
if ($set['set_show_icon']==1)echo "  <td class='p_m' colspan='2'>\n"; else echo "  <td class='p_m'>\n";
include H.'loads/inc/opis.php';
echo "  </td>\n";
echo "   </tr>\n";
}
echo "</table>\n";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц

echo "<div class=\"foot\">\n";
echo "&laquo;<a href='/loads/'>Загрузки</a><br />\n";
echo "</div>\n";

include_once '../sys/inc/tfoot.php';
?>
