Made filesize friendly

This commit is contained in:
botanic 2014-09-05 01:30:54 -07:00
parent e8bcdc75eb
commit 220d0edd3e
3 changed files with 13 additions and 3 deletions

View file

@ -216,6 +216,18 @@ class Ticket{
foreach ($fetchall as &$value) {
$webUser = new WebUsers($value['Uploader']);
$fetchall[$base]['Username'] = $webUser->getUsername();
$bytes = $fetchall[$base]['Filesize'];
$precision = 2;
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
$fetchall[$base]['Filesize'] = round($bytes, $precision) . ' ' . $units[$pow];;
$base++;
}
return $fetchall;

View file

@ -1,2 +0,0 @@
RewriteEngine On
RewriteRule ^$ /ams [R=301,L]

View file

@ -42,7 +42,7 @@
<tr>
<td><a href="{$FILE_WEB_PATH}{$array['Path']}">{$array['Filename']}</a></td>
<td>{$array['Timestamp']}</td>
<td>{$array['Filesize']} Bytes</td>
<td>{$array['Filesize']}</td>
<td>{if $permission > 1}
<a href="{$BASE_WEBPATH}index.php?page=show_user&id={$array['Uploader']}">{$array['Username']}</a>
{else}