function formatFileSize($size = 0){
if ($size >= 1073741824) return round ($size / 1073741824 * 10) / 10 . " Go";
elseif ($size >= 1048576) return round ($size / 1048576 * 10) / 10 . " Mo";
elseif ($size >= 1024) return round ($size / 1024) . " Ko";
else return $size . " o";
}
$tabtype = array("Dossier","Communiqué");
$date_courante = time();
$sqlMesDocs = "Select * From systeam_presses Where `PresseTitreDoc_en` != '' AND PresseDatePublication <= $date_courante AND PresseDateDepublication >= $date_courante ORDER BY PresseDateCreation DESC";
require_once 'admin/db.inc.php';
$connexion = dbConnect();
$resultMesDocs = dbquery($sqlMesDocs, $connexion);
if(dbResOk($resultMesDocs)){
?>
Available documents
while($infoDocs = dbFetchArray($resultMesDocs,$connexion))
{ ?>
-
if(file_exists($infoDocs['PresseLinkToDoc'])){
$poids = filesize($infoDocs['PresseLinkToDoc']);
$poidsformat = formatFileSize($poids);
$extension = substr($infoDocs['PresseLinkToDoc'],-3);
if(file_exists("template/systeam/img/ico-".$extension.".gif"))
{
echo "
";
}else{
echo "
";
}
echo "
Download the document (".$poidsformat.")";
}
?>
}
}
?>