diff --git a/libs/dirlist.lib.php b/libs/dirlist.lib.php index 409d391..6942e98 100644 --- a/libs/dirlist.lib.php +++ b/libs/dirlist.lib.php @@ -4,7 +4,7 @@ class dirList { /* - Class: dirList v2.1.2 beta + Class: dirList v2.2 beta Copyright © 2006 Jim Myhrberg. zynode@gmail.com @@ -216,6 +216,7 @@ class dirList { if ( is_file($item) ) { $return['type'] = 'file'; $return['size_raw'] = filesize($item); + if ( $return['size_raw'] < 0 ) $return['size_raw'] = $this->get_large_filesize($item); $return['size'] = $this->format_filesize($return['size_raw']); } elseif ( is_dir($item) ) { $return['type'] = 'dir'; @@ -225,6 +226,32 @@ class dirList { return $return; } + function get_large_filesize ($file) { + $system = $this->system_info(); + if ( $system == 'unix' ) { + exec('ls -l "'.str_replace('"', '\"', $file).'"', $details, $result); + if ( $result == 0 ) { + foreach( $details as $key => $value ) { + preg_match('/.*?([0-9]{10,32}).*/i', $value, $size); + return (!empty($size[1])) ? $size[1] : 'LARGE' ; + } + } else { + return 'LARGE'; + } + } else { + return 'LARGE'; + } + } + + function system_info () { + if ( stripos('windows', $_SERVER['SERVER_SOFTWARE']) ) { + return 'windows'; + } else { + return 'unix'; + } + + } + function getOwner ($item) { if ( function_exists('posix_getpwuid') ) { $id = fileowner($item); @@ -242,13 +269,17 @@ class dirList { } function format_filesize($bytes) { - $types = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); - for($n = 0; $bytes >= 1024; $n++) $bytes = $bytes / 1024; - $bytes = number_format($bytes, 2); - if ( preg_match("/^([0-9]+)(\.|,)([0-9]+0)$/", $bytes, $split) ) { - $bytes = ( ($split[3] = rtrim($split[3], '0')) == '' ) ? $split[1] : $split[1].$split[2].$split[3] ; + if ( $bytes !== 'LARGE' ) { + $types = array('bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + for($n = 0; $bytes >= 1024; $n++) $bytes = $bytes / 1024; + $bytes = number_format($bytes, 2); + if ( preg_match("/^([0-9]+)(\.|,)([0-9]+0)$/", $bytes, $split) ) { + $bytes = ( ($split[3] = rtrim($split[3], '0')) == '' ) ? $split[1] : $split[1].$split[2].$split[3] ; + } + return $bytes.' '.$types[$n]; + } else { + return '>2 GB'; } - return $bytes.' '.$types[$n]; } function smartDate ($timestamp, $datef='%B %d, %Y', $timef='%H:%M', $mainf='{date}, {time}') { diff --git a/templates/slik/_icons.phtml b/templates/slik/_icons.phtml index 7b2764b..f0ea097 100644 --- a/templates/slik/_icons.phtml +++ b/templates/slik/_icons.phtml @@ -12,12 +12,13 @@
owner.': '.$item['owner'].'
'; - if ( !empty($fields['group']) ) echo $lang->group.': '.$item['group'].'
'; - if ( !empty($fields['perms']) ) echo $lang->perms.': '.$item['perms'].'
'; - if ( !empty($fields['chmod']) ) echo $lang->chmod.': '.$item['chmod'].'
'; + if ( !empty($fields['size']) && $item['type'] == 'file' ) echo $lang->size.': '.$item['size'].' ('.number_format($item['size_raw']).' bytes)
'; if ( !empty($fields['mtime']) && $item['type'] == 'file' ) echo $lang->mtime.': '.$item['mtime'].'
'; if ( !empty($fields['atime']) ) echo $lang->atime.': '.$item['atime'].'
'; + if ( !empty($fields['perms']) ) echo $lang->perms.': '.$item['perms'].'
'; + if ( !empty($fields['chmod']) ) echo $lang->chmod.': '.$item['chmod'].'
'; + if ( !empty($fields['owner']) ) echo $lang->owner.': '.$item['owner'].'
'; + if ( !empty($fields['group']) ) echo $lang->group.': '.$item['group'].'
'; if ( !empty($fields['owner_id']) ) echo $lang->owner_id.': '.$item['owner_id'].'
'; if ( !empty($fields['group_id']) ) echo $lang->group_id.': '.$item['group_id'].'
'; ?> diff --git a/templates/slik/index.phtml b/templates/slik/index.phtml index ceefe44..a7c7ada 100644 --- a/templates/slik/index.phtml +++ b/templates/slik/index.phtml @@ -101,8 +101,8 @@ -
tpl_icons_file); ?>
- +
style="display: none;">tpl_icons_file); ?>
+
style="display: none;">tpl_details_file); ?>
Spacer