<?php
/*
*
* @author (Макс) Freedom <by_freedom@bk.ru>
* ICQ 286-0-666
*
*/
func::head($lang['statistics']);
function DirSize($path){
$returnSize=0;	
if (!$h = opendir($path)) return false;
while(($element = readdir($h)) !== false) {
// Исключаем директории "." и ".."
if ($element<>"." and $element<>"..") {
$all_path = $path."/".$element;
if (filetype($all_path)=="file") { $returnSize+=filesize($all_path);
} elseif (filetype($all_path)=="dir"){
$returnSize+=DirSize($all_path);
}	
}
}
closedir($h);
return $returnSize;
}
$new = DB::$dbs->querySingle("SELECT COUNT(id) FROM files WHERE time > ?", [time()-86400]);
echo '<div class="container">';
echo '<div class="list-group-item">&#187; '.$lang['allfile'].': <span class="badge">'.DB::$dbs->querySingle("SELECT COUNT(id) FROM files").(!empty($new) ? ' <font color="red">+'.$new.'</font>': NULL).'</span></div><div class="list-group-item">&#187; '.$lang['allsize'].': <span class="badge">'.func::size(DirSize($_SERVER['DOCUMENT_ROOT'].'/files')).'</span></div>';
echo '</div>';
func::foot();
?>