mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- fix pm date display and attachments in pms
git-svn-id: file:///svn/phpbb/trunk@4992 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f66a06e947
commit
b2d88fa157
2 changed files with 12 additions and 40 deletions
|
@ -149,14 +149,14 @@ function view_folder($id, $mode, $folder_id, $folder, $type)
|
||||||
'FOLDER_ID' => $folder_id,
|
'FOLDER_ID' => $folder_id,
|
||||||
'MESSAGE_ID' => $message_id,
|
'MESSAGE_ID' => $message_id,
|
||||||
'MESSAGE_AUTHOR' => $message_author,
|
'MESSAGE_AUTHOR' => $message_author,
|
||||||
'SENT_TIME' => $user->format_date($row['message_time'], $config['board_timezone']),
|
'SENT_TIME' => $user->format_date($row['message_time']),
|
||||||
'SUBJECT' => censor_text($row['message_subject']),
|
'SUBJECT' => censor_text($row['message_subject']),
|
||||||
'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '',
|
'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '',
|
||||||
'U_FOLDER' => (isset($folder[$row['folder_id']])) ? "$url&folder=" . $row['folder_id'] : '',
|
'U_FOLDER' => (isset($folder[$row['folder_id']])) ? "$url&folder=" . $row['folder_id'] : '',
|
||||||
'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||||
'FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
'FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||||
'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',
|
'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '',
|
||||||
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment'] && $config['pm_attachments'] && $config['auth_download_pm']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['message_attachment'])) : '',
|
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $row['message_attachment'] && $config['allow_pm_attach'] && $config['auth_download_pm']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['message_attachment'])) : '',
|
||||||
|
|
||||||
'S_PM_REPORTED' => (!empty($row['message_reported']) && $auth->acl_get('m_')) ? true : false,
|
'S_PM_REPORTED' => (!empty($row['message_reported']) && $auth->acl_get('m_')) ? true : false,
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,15 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign inline attachments
|
// Assign inline attachments
|
||||||
if (sizeof($attachments))
|
if (isset($attachments) && sizeof($attachments))
|
||||||
{
|
{
|
||||||
// preg_replace_callback does not work here because of inability to correctly assign globals (seems to be a bug in some PHP versions)
|
$unset_attachments = parse_inline_attachments($message, $attachments, $update_count, 0);
|
||||||
process_inline_attachments($message, $attachments, $update_count);
|
|
||||||
|
// Needed to let not display the inlined attachments at the end of the message again
|
||||||
|
foreach ($unset_attachments as $index)
|
||||||
|
{
|
||||||
|
unset($attachments[$index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_info['sig'] = '';
|
$user_info['sig'] = '';
|
||||||
|
@ -191,12 +196,12 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
||||||
if (sizeof($attachments))
|
if (isset($attachments) && sizeof($attachments))
|
||||||
{
|
{
|
||||||
foreach ($attachments as $attachment)
|
foreach ($attachments as $attachment)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('attachment', array(
|
$template->assign_block_vars('attachment', array(
|
||||||
'DISPLAY_ATTACHMENT' => $attachment)
|
'DISPLAY_ATTACHMENT' => $attachment)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,37 +436,4 @@ function get_user_informations($user_id, $user_row)
|
||||||
return $user_row;
|
return $user_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_inline_attachments(&$message, &$attachments, &$update_count)
|
|
||||||
{
|
|
||||||
global $user, $config;
|
|
||||||
|
|
||||||
$tpl = array();
|
|
||||||
$tpl = display_attachments(0, NULL, $attachments, $update_count, false, true);
|
|
||||||
$tpl_size = sizeof($tpl);
|
|
||||||
|
|
||||||
$unset_tpl = array();
|
|
||||||
|
|
||||||
preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches);
|
|
||||||
|
|
||||||
$replace = array();
|
|
||||||
foreach ($matches[0] as $num => $capture)
|
|
||||||
{
|
|
||||||
// Flip index if we are displaying the reverse way
|
|
||||||
$index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num];
|
|
||||||
|
|
||||||
$replace['from'][] = $matches[0][$index];
|
|
||||||
$replace['to'][] = (isset($tpl[$index])) ? $tpl[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][$num]);
|
|
||||||
|
|
||||||
$unset_tpl[] = $index;
|
|
||||||
}
|
|
||||||
unset($tpl, $tpl_size);
|
|
||||||
|
|
||||||
$message = str_replace($replace['from'], $replace['to'], $message);
|
|
||||||
|
|
||||||
foreach (array_unique($unset_tpl) as $index)
|
|
||||||
{
|
|
||||||
unset($attachments[$index]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue