From c95b7d07b0bdbb7dcdb510a892fc1b8b80061f85 Mon Sep 17 00:00:00 2001 From: BoboTiG Date: Sat, 31 Aug 2013 17:02:06 +0200 Subject: [PATCH] Ajout du poids des documents --- index.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 054a08e..a8b0e66 100644 --- a/index.php +++ b/index.php @@ -76,6 +76,14 @@ function get_link_from_datafeed($data) { } } +function get_size($doc) { + $symbol = array('o', 'Kio', 'Mio', 'Gio', 'Tio'); + $size = filesize($doc); + $exp = floor(log($size) / log(1024)); + $nicesize = $size / pow(1024, floor($exp)); + return sprintf('%d %s', $nicesize, $symbol[$exp]); +} + function serverUrl($return_subfolder = false) { $https = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS'])=='on')) || $_SERVER["SERVER_PORT"]=='443'; // HTTPS detection. @@ -907,14 +915,21 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY foreach($subdirs as $unit) { if(!is_dir($unit) || file_exists( $unit . '/index.html' ) || file_exists( $unit . '/index.htm' ) || file_exists( $unit . '/index.php' ) ) { - $docs[] = ''. substr($unit, (strrpos($unit, '/')) + 1 ) .''; + $size = ''; + if ( is_file($unit) ) { $size = get_size($unit); } + $docs[] = array(''. substr($unit, (strrpos($unit, '/')) + 1 ) .'', $size); } } } if(!empty( $docs )) { echo '

Autres documents

'; } ?>