File size: 1.58Kb
<?php
$filtime=filemtime(BASEDIR."local/datatmp/downfor.dat");
$down_count=file_get_contents(BASEDIR."local/datatmp/downfor.dat");
$down_count=strtok($down_count,'/');
$filtime=$filtime+(3600*$config_downloadcache);
if($sitetime>$filtime || $down_count<50){
$dir = opendir (BASEDIR."forum");
while ($file = readdir ($dir)) {
if (is_dir(BASEDIR."forum/$file")) {
if($file=="."||$file=="..") continue;
$downdir_array[]=$file;
}}
closedir ($dir);
$totaldir = count($downdir_array);
$downtime_array=array();
for ($i = 0; $i < $totaldir; $i++){
$dir = opendir (BASEDIR."forum/$downdir_array[$i]");
while ($file = readdir ($dir)) {
if (( $file != ".")&&($file != "..")&&($file != ".htaccess")&&($file != "index.php")&&($file != "name.dat")&& !ereg (".txt$", "$file")&& !ereg (".JPG$", "$file")&& !ereg (".GIF$", "$file")) {
$downfile_array[]=$file;
$filetime=filemtime(BASEDIR."forum/$downdir_array[$i]/$file")+(3600*24*5);
if($filetime>$sitetime){
$downtime_array[]=$file;
}}}
closedir ($dir);
}
$totalfile = count($downfile_array);
$totalnewfile = count($downtime_array);
if($totalnewfile>0){
$dtext=(int)$totalfile.'<font color="#FF0000">+'.(int)$totalnewfile;
}else{
$dtext =(int)$totalfile;
}
$fp = fopen(BASEDIR."local/datatmp/downfor.dat","a+");
flock ($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$dtext);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
@chmod ($fp, 0777);
@chmod (BASEDIR."local/datatmp/downfor.dat", 0777);
}
$dinput = file_get_contents(BASEDIR."local/datatmp/downfor.dat");
echo ' ('.$dinput.'</font>';
include_once BASEDIR."forum/downforchet.php";
echo')<br>';
?>