File size: 5.11Kb
<?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 ( is_user() )
$config_liblist = $udata[23];
else
$config_liblist = 10;
if ( isset( $_GET['start'] ) )
$start = ( int )$_GET['start'];
else
$start = 0;
$a = array();
$dir = opendir( "." );
while ( $file = readdir( $dir ) )
{
if ( is_dir( $file ) )
{
if ( $file == "." || $file == ".." )
continue;
$a[] = $file;
}
}
closedir( $dir );
$totaldir = count( $a );
$libdir = array();
$libfile = array();
for ( $i = 0; $i < $totaldir; $i++ )
{
$dircc = opendir( "$a[$i]" );
while ( $file = readdir( $dircc ) )
{
$filtime = filemtime( "$a[$i]/$file" );
$filtime = $filtime + ( 3600 * 24 * 5 ); //Сколько статью считать новой сейчас уст. на 5 суток
if ( $filtime >= $sitetime )
{
if ( ereg( ".txt$", "$file" ) )
{
$libdir[] = $a[$i];
$libfile[] = $file;
}
}
}
closedir( $dircc );
}
$total = count( $libfile );
if ( $total > 0 )
{
if ( $start < 0 || $start > $total )
{
$start = 0;
}
if ( $total < $start + $config_liblist )
{
$end = $total;
}
else
{
$end = $start + $config_liblist;
}
for ( $l = $start; $l < $end; $l++ )
{
$siz = file( "$libdir[$l]/$libfile[$l]" );
$count_lib = count( $siz );
$stranicy_lib = ceil( $count_lib / $config_liblist );
if ( $stranicy_lib == 0 )
{
$stranicy_lib = 1;
}
echo '<div class=b>';
$c2 = $libfile[$l];
$filtime = filemtime( "$libdir[$l]/$libfile[$l]" );
$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="">';
}
$st_name = file( "$libdir[$l]/$libfile[$l]" );
echo ' <b><a href="lib.php?action=count&did=' . $libdir[$l] . '&fid=' . $libfile[$l] .
'&' . SID . '">' . $st_name[0] . '</a></b> (' . $stranicy_lib . ' стр.)</div><div>';
$te = file( "../local/datalib/$libfile[$l].dat" );
$u = explode( "|", $te[0] );
$lib_name = file_get_contents( "$libdir[$l]/name.dat" );
echo 'Категория: <a href="lib.php?did=' . $libdir[$l] . '&' . SID . '">' . $lib_name .
'</a><br>';
echo 'Прочитали: ' . ( int )$u[0] . '<br>';
$filekomm = file( "../local/datalib/$libfile[$l].dat" );
$totalkomm = count( $filekomm ) - 1;
echo '<a href="lib.php?action=komm&did=' . $libdir[$l] . '&fid=' . $libfile[$l] .
'&' . 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_liblist ) . '&' . SID .
'"><-Назад</a> ';
}
else
{
echo '<-Назад';
}
echo ' | ';
if ( $total > $start + $config_liblist )
{
echo ' <a href="new.php?start=' . ( $start + $config_liblist ) . '&' . SID .
'">Далее-></a>';
}
else
{
echo 'Далее->';
}
if ( $total > 0 )
{
$ba = ceil( $total / $config_liblist );
$ba2 = $ba * $config_liblist - $config_liblist;
echo '<br><hr>Страницы:';
$asd = $start - ( $config_liblist * 3 );
$asd2 = $start + ( $config_liblist * 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_liblist );
if ( $start == $i )
{
echo ' <b>(' . $ii . ')</b>';
}
else
{
echo ' <a href="new.php?start=' . $i . '&' . SID . '">' . $ii . '</a>';
}
}
$i = $i + $config_liblist;
}
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>Всего статей: ' . ( int )$total . '<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" );
?>