mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
the display code for inline attachments, isn't it cute? ;)
git-svn-id: file:///svn/phpbb/trunk@4818 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
75e83593b0
commit
b9bf2fe751
1 changed files with 29 additions and 2 deletions
|
@ -1193,6 +1193,28 @@ for ($i = 0; $i < count($post_list); ++$i)
|
||||||
$l_bumped_by = '';
|
$l_bumped_by = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assign inline attachments, only one preg_replace... yeah baby, you got it. :D
|
||||||
|
if (sizeof($attachments[$row['post_id']]))
|
||||||
|
{
|
||||||
|
$tpl = &$attachments[$row['post_id']];
|
||||||
|
$tpl = display_attachments(NULL, $tpl, $update_count, false, true);
|
||||||
|
$tpl_size = sizeof($tpl);
|
||||||
|
|
||||||
|
$message = preg_replace_callback('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', create_function('$matches', '
|
||||||
|
global $tpl, $user, $config, $tpl_size;
|
||||||
|
|
||||||
|
// Flip index if we are displaying the reverse way
|
||||||
|
$index = ($config["display_order"]) ? ($tpl_size-($matches[1] + 1)) : $matches[1];
|
||||||
|
$return = (isset($tpl[$index])) ? $tpl[$index] : sprintf($user->lang["MISSING_INLINE_ATTACHMENT"], $matches[0]);
|
||||||
|
|
||||||
|
unset($tpl[$index]);
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
'), $message);
|
||||||
|
|
||||||
|
unset($tpl, $tpl_size);
|
||||||
|
}
|
||||||
|
|
||||||
// Dump vars into template
|
// Dump vars into template
|
||||||
$template->assign_block_vars('postrow', array(
|
$template->assign_block_vars('postrow', array(
|
||||||
'POSTER_NAME' => $row['poster'],
|
'POSTER_NAME' => $row['poster'],
|
||||||
|
@ -1254,10 +1276,15 @@ for ($i = 0; $i < count($post_list); ++$i)
|
||||||
'S_FRIEND' => ($row['friend']) ? true : false)
|
'S_FRIEND' => ($row['friend']) ? true : false)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Process Attachments for this post
|
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
||||||
if (sizeof($attachments[$row['post_id']]))
|
if (sizeof($attachments[$row['post_id']]))
|
||||||
{
|
{
|
||||||
display_attachments('postrow.attachment', $attachments[$row['post_id']], $update_count);
|
foreach ($attachments[$row['post_id']] as $attachment)
|
||||||
|
{
|
||||||
|
$template->assign_block_vars('postrow.attachment', array(
|
||||||
|
'DISPLAY_ATTACHMENT' => $attachment)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$prev_post_id = $row['post_id'];
|
$prev_post_id = $row['post_id'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue