src/php/lib/class.LinfoCommon.php
// Convert bytes to stuff like KB MB GB TB etc
Convert bytes to stuff like KB MB GB TB etc
Convert bytes to stuff like KB MB GB TB etc
static function byteConvert($size, $precision = 2) {
		if (!is_numeric($size))
			return '?';
		$notation = self::$settings['byte_notation'] == 1000 ? 1000: 1024;
		$types = array('B', 'KB', 'MB', 'GB', 'TB');
		$types_i = array('B', 'KiB', 'MiB', 'GiB', 'TiB');
		for($i = 0; $size >= $notation && $i < (count($types) -1 ); $size /= $notation, $i++);
		return(round($size, $precision) . ' ' . ($notation == 1000 ? $types[$i] : $types_i[$i]));
	}
static function byteConvert ( $ size , $ precision = 2 ) { if ( ! is_numeric ( $ size ) ) return '?' ; $ notation = self :: $ settings [ 'byte_notation' ] == 1000 ? 1000 : 1024 ; $ types = array ( 'B' , 'KB' , 'MB' , 'GB' , 'TB' ) ; $ types_i = array ( 'B' , 'KiB' , 'MiB' , 'GiB' , 'TiB' ) ; for ( $ i = 0 ; $ size >= $ notation && $ i < ( count ( $ types ) - 1 ) ; $ size /= $ notation , $ i ++ ) ; return ( round ( $ size , $ precision ) . ' ' . ( $ notation == 1000 ? $ types [ $ i ] : $ types_i [ $ i ] ) ) ; }
Convert bytes to stuff like KB MB GB TB etc
Convert bytes to stuff like KB MB GB TB etc
// Sanity check // Get the notation // Fixes large disk size overflow issue // Found at http://www.php.net/manual/en/function.disk-free-space.php#81207