File size: 1.62Kb
<?php
if (!defined("BASEDIR")) { header("Location:../index.php"); exit; }
$filtime=filemtime(BASEDIR."local/forums.dat");
$filtime=$filtime+300;
$ttime=time();
//if($ttime>=$filtime){
$uir = opendir (BASEDIR."local/dataforum/");
while($uile = readdir ($uir)){
if (( $uile != ".") && ($uile != "..") && ($uile != ".htaccess") && ($uile != "index.php") && !ereg ("topic", "$uile") && !ereg (".sex$", "$uile") && !ereg ("mainforum", "$uile")){
$urw[] = ''.date("YmdHis", filemtime(BASEDIR.'local/dataforum/'.$uile.'')).'||'.$uile.'||'.$at[$i].'';}}
closedir ($uir);
$utal = count($urw);
rsort($urw);
$ufp = fopen(BASEDIR."local/forums.dat","a+");
flock ($ufp,LOCK_EX);
ftruncate($ufp,0);
$car = array("1","2","3","4","5");
for ($ic=0; $ic<5; $ic++) {
$sexp = explode("||", $urw[$ic]);
$msg=file(BASEDIR."local/dataforum/$sexp[1]");
$msg=array_reverse($msg);
$vve=count($msg);
$a=count($msg);
$ba=ceil($a/$config_forumpost);
$ba2=floor(($a-1)/$config_forumpost)*$config_forumpost;
$dato = explode("|",$msg[0]);
$sexpi=str_replace (".dat","",$sexp[1]);
$udtext[]='<font color="red">-'.$car[$ic].'.</font> <b>Тема: </b><a href="forum/index.php?fid='.
$dato[8].'&id='.$sexpi.'&page='.(int)$ba2.'&'.SID.'">'.$dato[3].'</a><br />('.nickname($dato[0]).', '.date_fixed($dato[9],"H:i").')<br /><font color="olive">Постов:</font><b>'.(int)$vve.'</b>';
fputs($ufp,"$udtext[$ic]\r\n");}
fflush ($ufp);
flock ($ufp,LOCK_UN);
fclose($ufp);
chmod ($ufp, 0666);
chmod (BASEDIR."local/forums.dat", 0666);
//}
$tw = file(BASEDIR."local/forums.dat");
$dattem=implode('',$tw);
$dattem=preg_replace ("|[\r\n]+|si","<br>",$dattem);
echo' '.$dattem.' ';
?>