aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_content.php8
-rw-r--r--phpBB/posting.php2
2 files changed, 5 insertions, 5 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 725707f7dc..ac3a35f8c9 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -974,6 +974,9 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
unset($new_attachment_data);
}
+ // Make sure attachments are properly ordered
+ ksort($attachments);
+
foreach ($attachments as $attachment)
{
if (!sizeof($attachment))
@@ -1211,8 +1214,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
$attachments = $compiled_attachments;
unset($compiled_attachments);
- $tpl_size = sizeof($attachments);
-
$unset_tpl = array();
preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches, PREG_PATTERN_ORDER);
@@ -1220,8 +1221,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
$replace = array();
foreach ($matches[0] as $num => $capture)
{
- // Flip index if we are displaying the reverse way
- $index = $tpl_size-($matches[1][$num] + 1);
+ $index = $matches[1][$num];
$replace['from'][] = $matches[0][$num];
$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]);
diff --git a/phpBB/posting.php b/phpBB/posting.php
index a7df1a018e..263809e998 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -599,7 +599,7 @@ if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode
WHERE post_msg_id = $post_id
AND in_message = 0
AND is_orphan = 0
- ORDER BY filetime DESC";
+ ORDER BY attach_id DESC";
$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);