File size: 5.09Kb
<?php
require_once ( "../includes/start.php" );
require_once ( "../includes/functions.php" );
require_once ( "../includes/header.php" );
include_once ( "../themes/" . $config['themes'] . "/index.php" );
show_title( 'partners.gif', 'Новые файлы' );
if ( isset( $_GET['start'] ) )
$start = ( int )$_GET['start'];
else
$start = 0;
if ( is_user() )
$config_downlist = $udata[23];
else
$config_downlist = 10;
/////////////////////////////////////////
$a = array();
$dir = opendir( "." );
while ( $file = readdir( $dir ) )
{
if ( is_dir( $file ) )
{
if ( $file == "." || $file == ".." )
continue;
$a[] = $file;
}
}
closedir( $dir );
$totaldir = count( $a );
$downdir = array();
$downfile = array();
for ( $i = 0; $i < $totaldir; $i++ )
{
$dir = opendir( $a[$i] );
while ( $file = readdir( $dir ) )
{
$filtime = filemtime( "$a[$i]/$file" );
$filtime = $filtime + ( 3600 * 24 * 5 );
if ( $filtime >= $sitetime )
{
if ( ( $file != "." ) && ( $file != ".." ) && ( $file != ".htaccess" ) && ( $file !=
"index.php" ) && ( $file != "name.dat" ) && !ereg( ".txt$", "$file" ) && !ereg( ".JPG$", "$file" ) &&
!ereg( ".GIF$", "$file" ) )
{
$downdir[] = $a[$i];
$downfile[] = $file;
}
}
}
closedir( $dir );
}
$total = count( $downfile );
if ( $total > 0 )
{
$start = ( int )$_GET['start'];
if ( $start < 0 || $start > $total )
{
$start = 0;
}
if ( $total < $start + $config_downlist )
{
$end = $total;
}
else
{
$end = $start + $config_downlist;
}
for ( $d = $start; $d < $end; $d++ )
{
$siz = formatsize( filesize( "$downdir[$d]/$downfile[$d]" ) );
echo '<div class=b>';
$filtime = filemtime( "$downdir[$d]/$downfile[$d]" );
$filtime1 = $filtime + ( 3600 * 24 * 1 );
$filtime2 = $filtime + ( 3600 * 24 * 3 );
if ( $filtime1 >= $sitetime )
{
echo '<img src="../images/img/new.gif" alt="">';
} elseif ( $filtime2 >= $sitetime )
{
echo '<img src="../images/img/new1.gif" alt="">';
}
else
{
echo '<img src="../images/img/new2.gif" alt="">';
}
echo ' <b><a href="down.php?action=ob&did=' . $downdir[$d] . '&fid=' . $downfile[$d] .
'&' . SID . '">' . $downfile[$d] . '</a></b> (' . $siz . ')</div><div>';
$te = file( DATADIR . "datadown/$downfile[$d].dat" );
$u = explode( "|", $te[0] );
$down_name = file_get_contents( "$downdir[$d]/name.dat" );
echo 'Категория: <a href="down.php?did=' . $downdir[$d] . '&' . SID . '">' . $down_name .
'</a><br>';
echo 'Cкачиваний: ' . ( int )$u[0] . '<br>';
$filekomm = file( DATADIR . "datadown/$downfile[$d].dat" );
$totalkomm = count( $filekomm ) - 1;
echo '<a href="down.php?action=komm&did=' . $downdir[$d] . '&fid=' . $downfile[$d] .
'&' . SID . '">Комментарии</a> (' . ( int )$totalkomm . ')</div>';
}
}
else
{
echo '<br><img src="../images/img/reload.gif" alt=""> <b>В течении 5-ти дней новых скриптов не было!</b><br>';
}
echo '<hr>';
if ( $start != 0 )
{
echo '<a href="new.php?start=' . ( $start - $config_downlist ) . '&' . SID .
'"><-Назад</a> ';
}
else
{
echo '<-Назад';
}
echo ' | ';
if ( $total > $start + $config_downlist )
{
echo ' <a href="new.php?start=' . ( $start + $config_downlist ) . '&' . SID .
'">Далее-></a>';
}
else
{
echo 'Далее->';
}
if ( $total > 0 )
{
$ba = ceil( $total / $config_downlist );
$ba2 = $ba * $config_downlist - $config_downlist;
echo '<br><hr>Страницы:';
$asd = $start - ( $config_downlist * 3 );
$asd2 = $start + ( $config_downlist * 4 );
if ( $asd < $total && $asd > 0 )
{
echo ' <a href="new.php?start=0&' . SID . '">1</a> ... ';
}
for ( $i = $asd; $i < $asd2; )
{
if ( $i < $total && $i >= 0 )
{
$ii = floor( 1 + $i / $config_downlist );
if ( $start == $i )
{
echo ' <b>(' . $ii . ')</b>';
}
else
{
echo ' <a href="new.php?start=' . $i . '&' . SID . '">' . $ii . '</a>';
}
}
$i = $i + $config_downlist;
}
if ( $asd2 < $total )
{
echo ' ... <a href="new.php?start=' . $ba2 . '&' . SID . '">' . $ba . '</a>';
}
}
echo '<br><br><img src="../images/img/new.gif" alt=""> - Самая свежая загрузка<br>';
echo '<img src="../images/img/new1.gif" alt=""> - Более дня назад<br>';
echo '<img src="../images/img/new2.gif" alt=""> - Более 3 дней назад<br>';
echo '<br>Всего файлов: <b>' . ( int )$total . '</b><br><br>';
echo '<img src="../images/img/panel.gif" alt=""> <a href="index.php?' . SID .
'">К категориям</a><br>';
echo '<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?' . SID .
'">На главную</a>';
include_once ( "../themes/" . $config['themes'] . "/foot.php" );
?>