Made filesize friendly

hg/feature/cdb-packed
botanic 10 years ago
parent 5ae905d317
commit e99c43095e

@ -216,6 +216,18 @@ class Ticket{
foreach ($fetchall as &$value) { foreach ($fetchall as &$value) {
$webUser = new WebUsers($value['Uploader']); $webUser = new WebUsers($value['Uploader']);
$fetchall[$base]['Username'] = $webUser->getUsername(); $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++; $base++;
} }
return $fetchall; return $fetchall;

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

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

Loading…
Cancel
Save