mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/14437] Sort attachments after assigning inline attachments
This does not seem to cause any issues but prevents us from having to consider the currenty display order. PHPBB3-14437
This commit is contained in:
parent
c5c2f7f7d0
commit
1e10664739
1 changed files with 13 additions and 13 deletions
|
@ -974,18 +974,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||||
unset($new_attachment_data);
|
unset($new_attachment_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort correctly
|
|
||||||
if (!$config['display_order'])
|
|
||||||
{
|
|
||||||
// Ascending sort
|
|
||||||
krsort($attachments);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Descending sort
|
|
||||||
ksort($attachments);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($attachments as $attachment)
|
foreach ($attachments as $attachment)
|
||||||
{
|
{
|
||||||
if (!sizeof($attachment))
|
if (!sizeof($attachment))
|
||||||
|
@ -1233,7 +1221,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||||
foreach ($matches[0] as $num => $capture)
|
foreach ($matches[0] as $num => $capture)
|
||||||
{
|
{
|
||||||
// Flip index if we are displaying the reverse way
|
// Flip index if we are displaying the reverse way
|
||||||
$index = (!$config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num];
|
$index = $tpl_size-($matches[1][$num] + 1);
|
||||||
|
|
||||||
$replace['from'][] = $matches[0][$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])]);
|
$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]);
|
||||||
|
@ -1248,6 +1236,18 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||||
|
|
||||||
$unset_tpl = array_unique($unset_tpl);
|
$unset_tpl = array_unique($unset_tpl);
|
||||||
|
|
||||||
|
// Sort correctly
|
||||||
|
if ($config['display_order'])
|
||||||
|
{
|
||||||
|
// Ascending sort
|
||||||
|
krsort($attachments);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Descending sort
|
||||||
|
ksort($attachments);
|
||||||
|
}
|
||||||
|
|
||||||
// Needed to let not display the inlined attachments at the end of the post again
|
// Needed to let not display the inlined attachments at the end of the post again
|
||||||
foreach ($unset_tpl as $index)
|
foreach ($unset_tpl as $index)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue