diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 6a29403..c511e82 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -2137,6 +2137,7 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white '.fm_get_filesize($all_files_size).'' ?> + '.fm_get_diskfree().'' ?> '.$num_files.'' ?> '.$num_folders.'' ?> @@ -2560,6 +2561,20 @@ function fm_get_filesize($size) return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]); } +/** + * Get nice disk free + * @return string + */ +function fm_get_diskfree() +{ + $size = (float) disk_free_space("."); + $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + $power = ($size > 0) ? floor(log($size, 1024)) : 0; + $power = ($power > (count($units) - 1)) ? (count($units) - 1) : $power; + return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]); +} + + /** * Get total size of directory tree. * @@ -4170,6 +4185,7 @@ function lng($txt) { $tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'; $tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'; $tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'; + $tr['en']['DiskFree'] = 'Disk Free'; $i18n = fm_get_translations($tr); $tr = $i18n ? $i18n : $tr;