mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
r350
есть же спец. функция humn_size(); git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@350 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
321ee85734
commit
b11ae13f1a
10 changed files with 15 additions and 84 deletions
|
@ -263,18 +263,7 @@ if ($view == 'stats')
|
|||
{
|
||||
$upload_dir_size = get_formatted_dirsize();
|
||||
|
||||
if ($attach_config['attachment_quota'] >= 1048576)
|
||||
{
|
||||
$attachment_quota = round($attach_config['attachment_quota'] / 1048576 * 100) / 100 . ' ' . $lang['MB'];
|
||||
}
|
||||
else if ($attach_config['attachment_quota'] >= 1024)
|
||||
{
|
||||
$attachment_quota = round($attach_config['attachment_quota'] / 1024 * 100) / 100 . ' ' . $lang['KB'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$attachment_quota = $attach_config['attachment_quota'] . ' ' . $lang['BYTES'];
|
||||
}
|
||||
$attachment_quota = humn_size($attach_config['attachment_quota']);
|
||||
|
||||
// number_of_attachments
|
||||
$row = DB()->fetch_row("
|
||||
|
|
|
@ -91,19 +91,7 @@ else if( isset($_GET['pane']) && $_GET['pane'] == 'right' )
|
|||
@closedir($avatar_dir);
|
||||
|
||||
|
||||
if($avatar_dir_size >= 1048576)
|
||||
{
|
||||
$avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 .' '. $lang['MB'];
|
||||
}
|
||||
else if($avatar_dir_size >= 1024)
|
||||
{
|
||||
$avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 .' '. $lang['KB'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$avatar_dir_size = $avatar_dir_size .' '. $lang['BYTES'];
|
||||
}
|
||||
|
||||
$avatar_dir_size = humn_size($avatar_dir_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -217,16 +217,7 @@ function display_attachments($post_id)
|
|||
$upload_image = '<img src="' . $upload_icons[$attachments['_' . $post_id][$i]['extension']] . '" alt="" border="0" />';
|
||||
}
|
||||
|
||||
$filesize = $attachments['_' . $post_id][$i]['filesize'];
|
||||
$size_lang = ($filesize >= 1048576) ? $lang['MB'] : ( ($filesize >= 1024) ? $lang['KB'] : $lang['BYTES'] );
|
||||
if ($filesize >= 1048576)
|
||||
{
|
||||
$filesize = (round((round($filesize / 1048576 * 100) / 100), 2));
|
||||
}
|
||||
else if ($filesize >= 1024)
|
||||
{
|
||||
$filesize = (round((round($filesize / 1024 * 100) / 100), 2));
|
||||
}
|
||||
$filesize = humn_size($attachments['_' . $post_id][$i]['filesize']);
|
||||
|
||||
$display_name = htmlspecialchars($attachments['_' . $post_id][$i]['real_filename']);
|
||||
$comment = htmlspecialchars($attachments['_' . $post_id][$i]['comment']);
|
||||
|
@ -333,7 +324,6 @@ function display_attachments($post_id)
|
|||
|
||||
'IMG_SRC' => $img_source,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_VAR' => $size_lang,
|
||||
'COMMENT' => $comment,
|
||||
));
|
||||
|
||||
|
@ -384,7 +374,6 @@ function display_attachments($post_id)
|
|||
'IMG_SRC' => append_sid(BB_ROOT . 'download.php?id=' . $attachments['_' . $post_id][$i]['attach_id']),
|
||||
'IMG_THUMB_SRC' => $thumb_source,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_VAR' => $size_lang,
|
||||
'COMMENT' => $comment,
|
||||
));
|
||||
}
|
||||
|
@ -398,7 +387,6 @@ function display_attachments($post_id)
|
|||
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_VAR' => $size_lang,
|
||||
'COMMENT' => $comment,
|
||||
'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], $attachments['_' . $post_id][$i]['download_count']))
|
||||
);
|
||||
|
@ -425,7 +413,6 @@ function display_attachments($post_id)
|
|||
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_VAR' => $size_lang,
|
||||
'COMMENT' => $comment,
|
||||
'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], $attachments['_' . $post_id][$i]['download_count']),
|
||||
'WIDTH' => $width,
|
||||
|
@ -460,7 +447,6 @@ function display_attachments($post_id)
|
|||
|
||||
'DOWNLOAD_NAME' => $display_name,
|
||||
'FILESIZE' => $filesize,
|
||||
'SIZE_VAR' => $size_lang,
|
||||
'COMMENT' => $comment,
|
||||
'TARGET_BLANK' => $target_blank,
|
||||
|
||||
|
|
|
@ -224,20 +224,7 @@ function get_formatted_dirsize()
|
|||
@ftp_quit($conn_id);
|
||||
}
|
||||
|
||||
if ($upload_dir_size >= 1048576)
|
||||
{
|
||||
$upload_dir_size = round($upload_dir_size / 1048576 * 100) / 100 . ' ' . $lang['MB'];
|
||||
}
|
||||
else if ($upload_dir_size >= 1024)
|
||||
{
|
||||
$upload_dir_size = round($upload_dir_size / 1024 * 100) / 100 . ' ' . $lang['KB'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_dir_size = $upload_dir_size . ' ' . $lang['BYTES'];
|
||||
}
|
||||
|
||||
return $upload_dir_size;
|
||||
return humn_size($upload_dir_size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1103,23 +1103,14 @@ class attach_parent
|
|||
// check Filesize
|
||||
if (!$error && $allowed_filesize != 0 && $this->filesize > $allowed_filesize && !(IS_ADMIN || IS_MOD || IS_GROUP_MEMBER))
|
||||
{
|
||||
$size_lang = ($allowed_filesize >= 1048576) ? $lang['MB'] : ( ($allowed_filesize >= 1024) ? $lang['KB'] : $lang['BYTES'] );
|
||||
|
||||
if ($allowed_filesize >= 1048576)
|
||||
{
|
||||
$allowed_filesize = round($allowed_filesize / 1048576 * 100) / 100;
|
||||
}
|
||||
else if($allowed_filesize >= 1024)
|
||||
{
|
||||
$allowed_filesize = round($allowed_filesize / 1024 * 100) / 100;
|
||||
}
|
||||
$allowed_filesize = humn_size($allowed_filesize);
|
||||
|
||||
$error = TRUE;
|
||||
if(!empty($error_msg))
|
||||
{
|
||||
$error_msg .= '<br />';
|
||||
}
|
||||
$error_msg .= sprintf($lang['ATTACHMENT_TOO_BIG'], $allowed_filesize, $size_lang);
|
||||
$error_msg .= sprintf($lang['ATTACHMENT_TOO_BIG'], $allowed_filesize);
|
||||
}
|
||||
|
||||
// Check our complete quota
|
||||
|
|
|
@ -63,7 +63,7 @@ $bb_cfg = $tr_cfg = $page_cfg = array();
|
|||
|
||||
// Increase number of revision after update
|
||||
$bb_cfg['tp_version'] = '2.4 (beta)';
|
||||
$bb_cfg['tp_release_state'] = 'R349';
|
||||
$bb_cfg['tp_release_state'] = 'R350';
|
||||
$bb_cfg['tp_release_date'] = '02-02-2012';
|
||||
|
||||
// Database
|
||||
|
|
|
@ -1108,7 +1108,7 @@ $lang['ATTACHMENT_PHP_SIZE_NA'] = 'The Attachment is too big.<br />Couldn\'t get
|
|||
$lang['ATTACHMENT_PHP_SIZE_OVERRUN'] = 'The Attachment is too big.<br />Maximum Upload Size: %d MB.<br />Please note that this Size is defined in php.ini, this means it\'s set by PHP and the Attachment Mod can not override this value.'; // replace %d with ini_get('upload_max_filesize')
|
||||
$lang['DISALLOWED_EXTENSION'] = 'The Extension %s is not allowed'; // replace %s with extension (e.g. .php)
|
||||
$lang['DISALLOWED_EXTENSION_WITHIN_FORUM'] = 'You are not allowed to post Files with the Extension %s within this Forum'; // replace %s with the Extension
|
||||
$lang['ATTACHMENT_TOO_BIG'] = 'The Attachment is too big.<br />Max Size: %d %s'; // replace %d with maximum file size, %s with size var
|
||||
$lang['ATTACHMENT_TOO_BIG'] = 'The Attachment is too big.<br />Max Size: %d'; // replace %d with maximum file size, %s with size var
|
||||
$lang['ATTACH_QUOTA_REACHED'] = 'Sorry, but the maximum filesize for all Attachments is reached. Please contact the Board Administrator if you have questions.';
|
||||
$lang['TOO_MANY_ATTACHMENTS'] = 'Attachment cannot be added, since the max. number of %d Attachments in this post was achieved'; // replace %d with maximum number of attachments
|
||||
$lang['ERROR_IMAGESIZE'] = 'The Attachment/Image must be less than %d pixels wide and %d pixels high';
|
||||
|
|
|
@ -1115,7 +1115,7 @@ $lang['ATTACHMENT_PHP_SIZE_NA'] = 'Вложение слишком велико.
|
|||
$lang['ATTACHMENT_PHP_SIZE_OVERRUN'] = 'Вложение слишком велико.<br />Максимальный размер закачиваемого файла: %d MB.<br />Отметьте, что эта величина определена в php.ini и Attachment Mod не может изменить это значение в большую сторону.'; // replace %d with ini_get('upload_max_filesize')
|
||||
$lang['DISALLOWED_EXTENSION'] = 'Расширение %s запрещено администратором'; // replace %s with extension (e.g. .php)
|
||||
$lang['DISALLOWED_EXTENSION_WITHIN_FORUM'] = 'Вы не можете публиковать файлы с расширением %s в этом форуме'; // replace %s with the Extension
|
||||
$lang['ATTACHMENT_TOO_BIG'] = 'Вложение слишком велико.<br/>Максимальный размер: %d %s'; // replace %d with maximum file size, %s with size var
|
||||
$lang['ATTACHMENT_TOO_BIG'] = 'Вложение слишком велико.<br/>Максимальный размер: %d'; // replace %d with maximum file size, %s with size var
|
||||
$lang['ATTACH_QUOTA_REACHED'] = 'Достигнут максимальный общий размер ваших вложений. Пожалуйста, обратитесь к администратору по этому вопросу.';
|
||||
$lang['TOO_MANY_ATTACHMENTS'] = 'Вложение невозможно, так как максимальное количество (%d) вложений в этом сообщении достигнуто.'; // replace %d with maximum number of attachments
|
||||
$lang['ERROR_IMAGESIZE'] = 'Изображение должно быть меньше, чем %d пикселей в ширину и %d пикселей в высоту.';
|
||||
|
|
|
@ -55,18 +55,8 @@ if ($do == 'attach_rules')
|
|||
$group_name = $rows[$i]['group_name'];
|
||||
$f_size = intval(trim($rows[$i]['max_filesize']));
|
||||
$det_filesize = (!$f_size) ? $_max_filesize : $f_size;
|
||||
$size_lang = ($det_filesize >= 1048576) ? $lang['MB'] : (($det_filesize >= 1024) ? $lang['KB'] : $lang['BYTES']);
|
||||
|
||||
if ($det_filesize >= 1048576)
|
||||
{
|
||||
$det_filesize = round($det_filesize / 1048576 * 100) / 100;
|
||||
}
|
||||
else if($det_filesize >= 1024)
|
||||
{
|
||||
$det_filesize = round($det_filesize / 1024 * 100) / 100;
|
||||
}
|
||||
|
||||
$max_filesize = ($det_filesize == 0) ? $lang['UNLIMITED'] : $det_filesize . ' ' . $size_lang;
|
||||
$max_filesize = (!$det_filesize) ? $lang['UNLIMITED'] : humn_size($det_filesize);
|
||||
|
||||
$template->assign_block_vars('group_row', array(
|
||||
'GROUP_RULE_HEADER' => sprintf($lang['GROUP_RULE_HEADER'], $group_name, $max_filesize))
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td width="15%" class="attachrow"><span class="med"> {L_FILESIZE}:</span></td>
|
||||
<td width="75%" class="attachrow"><span class="med"> {postrow.attach.cat_stream.FILESIZE} {postrow.attach.cat_stream.SIZE_VAR}</td>
|
||||
<td width="75%" class="attachrow"><span class="med"> {postrow.attach.cat_stream.FILESIZE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="15%" class="attachrow"><span class="med"> {L_VIEWED}:</span></td>
|
||||
|
@ -73,7 +73,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td width="15%" class="attachrow"><span class="med"> {L_FILESIZE}:</span></td>
|
||||
<td width="75%" class="attachrow"><span class="med"> {postrow.attach.cat_swf.FILESIZE} {postrow.attach.cat_swf.SIZE_VAR}</td>
|
||||
<td width="75%" class="attachrow"><span class="med"> {postrow.attach.cat_swf.FILESIZE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="15%" class="attachrow"><span class="med"> {L_VIEWED}:</span></td>
|
||||
|
@ -98,7 +98,7 @@
|
|||
|
||||
<!-- BEGIN cat_images -->
|
||||
<fieldset class="attach">
|
||||
<legend>{ATTACHMENT_ICON} {L_ATTACHMENT} ({postrow.attach.cat_images.FILESIZE} {postrow.attach.cat_images.SIZE_VAR})</legend>
|
||||
<legend>{ATTACHMENT_ICON} {L_ATTACHMENT} ({postrow.attach.cat_images.FILESIZE})</legend>
|
||||
<p class="tCenter pad_6">
|
||||
<img src="{postrow.attach.cat_images.IMG_SRC}" id="attachImg" class="postImg" alt="img" border="0" />
|
||||
</p>
|
||||
|
@ -120,7 +120,7 @@
|
|||
</p>
|
||||
<p class="attach_link">
|
||||
<a href="{postrow.attach.cat_thumb_images.IMG_SRC}" target="_blank"><b>{postrow.attach.cat_thumb_images.DOWNLOAD_NAME}</b></a>
|
||||
<span class="attach_stats med">({postrow.attach.cat_thumb_images.FILESIZE} {postrow.attach.cat_thumb_images.SIZE_VAR})</span>
|
||||
<span class="attach_stats med">({postrow.attach.cat_thumb_images.FILESIZE})</span>
|
||||
</p>
|
||||
<!-- IF postrow.attach.cat_thumb_images.COMMENT -->
|
||||
<p class="attach_comment med">
|
||||
|
@ -137,7 +137,7 @@
|
|||
<legend>{postrow.attach.attachrow.S_UPLOAD_IMAGE} {L_ATTACHMENT}</legend>
|
||||
<p class="attach_link">
|
||||
<a href="{postrow.attach.attachrow.U_DOWNLOAD_LINK}" {postrow.attach.attachrow.TARGET_BLANK}><b>{postrow.attach.attachrow.DOWNLOAD_NAME}</b></a>
|
||||
<span class="attach_stats med">({postrow.attach.attachrow.FILESIZE} {postrow.attach.attachrow.SIZE_VAR}, {L_DOWNLOADED}: {postrow.attach.attachrow.DOWNLOAD_COUNT})</span>
|
||||
<span class="attach_stats med">({postrow.attach.attachrow.FILESIZE}, {L_DOWNLOADED}: {postrow.attach.attachrow.DOWNLOAD_COUNT})</span>
|
||||
</p>
|
||||
<!-- IF postrow.attach.attachrow.COMMENT -->
|
||||
<p class="attach_comment med">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue