1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 07:35:29 +02:00

[ticket/11915] Provide the attachment file size to the template.

PHPBB3-11915
This commit is contained in:
Cesar G 2013-11-10 18:27:13 -08:00
parent 691dfd8453
commit be52a823f8
3 changed files with 6 additions and 3 deletions

View File

@ -862,6 +862,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a
'ATTACH_ID' => $attach_row['attach_id'], 'ATTACH_ID' => $attach_row['attach_id'],
'S_IS_ORPHAN' => $attach_row['is_orphan'], 'S_IS_ORPHAN' => $attach_row['is_orphan'],
'ASSOC_INDEX' => $count, 'ASSOC_INDEX' => $count,
'FILESIZE' => get_formatted_filesize($attach_row['filesize']),
'U_VIEW_ATTACHMENT' => $download_link, 'U_VIEW_ATTACHMENT' => $download_link,
'S_HIDDEN' => $hidden) 'S_HIDDEN' => $hidden)

View File

@ -1461,6 +1461,7 @@ class parse_message extends bbcode_firstpass
'is_orphan' => 1, 'is_orphan' => 1,
'real_filename' => $filedata['real_filename'], 'real_filename' => $filedata['real_filename'],
'attach_comment'=> $this->filename_data['filecomment'], 'attach_comment'=> $this->filename_data['filecomment'],
'filesize' => $filedata['filesize'],
); );
$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);
@ -1572,6 +1573,7 @@ class parse_message extends bbcode_firstpass
'is_orphan' => 1, 'is_orphan' => 1,
'real_filename' => $filedata['real_filename'], 'real_filename' => $filedata['real_filename'],
'attach_comment'=> $this->filename_data['filecomment'], 'attach_comment'=> $this->filename_data['filecomment'],
'filesize' => $filedata['filesize'],
); );
$this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data);
@ -1649,7 +1651,7 @@ class parse_message extends bbcode_firstpass
if (sizeof($not_orphan)) if (sizeof($not_orphan))
{ {
// Get the attachment data, based on the poster id... // Get the attachment data, based on the poster id...
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . '
AND poster_id = ' . $check_user_id; AND poster_id = ' . $check_user_id;
@ -1674,7 +1676,7 @@ class parse_message extends bbcode_firstpass
// Regenerate newly uploaded attachments // Regenerate newly uploaded attachments
if (sizeof($orphan)) if (sizeof($orphan))
{ {
$sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . ' WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . '
AND poster_id = ' . $user->data['user_id'] . ' AND poster_id = ' . $user->data['user_id'] . '

View File

@ -484,7 +484,7 @@ $message_parser->get_submitted_attachment_data($post_data['poster_id']);
if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit')
{ {
// Do not change to SELECT * // Do not change to SELECT *
$sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize
FROM ' . ATTACHMENTS_TABLE . " FROM ' . ATTACHMENTS_TABLE . "
WHERE post_msg_id = $post_id WHERE post_msg_id = $post_id
AND in_message = 0 AND in_message = 0