本文整理汇总了PHP中message_history函数的典型用法代码示例。如果您正苦于以下问题:PHP message_history函数的具体用法?PHP message_history怎么用?PHP message_history使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message_history函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compose_pm
//.........这里部分代码省略.........
$sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')';
}
$sql .= $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') ? ' WHERE ' : ' AND ';
$sql .= 'g.group_receive_pm = 1
AND ' . $db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . '
ORDER BY g.group_name ASC';
$result['g'] = $db->sql_query($sql);
}
$u = $g = array();
$_types = array('u', 'g');
foreach ($_types as $type) {
if (isset($result[$type]) && $result[$type]) {
while ($row = $db->sql_fetchrow($result[$type])) {
if ($type == 'g') {
$row['name'] = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['name']] : $row['name'];
}
${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']);
}
$db->sql_freeresult($result[$type]);
}
}
// Now Build the address list
$plain_address_field = '';
foreach ($address_list as $type => $adr_ary) {
foreach ($adr_ary as $id => $field) {
if (!isset(${$type}[$id])) {
unset($address_list[$type][$id]);
continue;
}
$field = $field == 'to' ? 'to' : 'bcc';
$type = $type == 'u' ? 'u' : 'g';
$id = (int) $id;
$tpl_ary = array('IS_GROUP' => $type == 'g' ? true : false, 'IS_USER' => $type == 'u' ? true : false, 'UG_ID' => $id, 'NAME' => ${$type}[$id]['name'], 'COLOUR' => ${$type}[$id]['colour'] ? '#' . ${$type}[$id]['colour'] : '', 'TYPE' => $type);
if ($type == 'u') {
$tpl_ary = array_merge($tpl_ary, array('U_VIEW' => get_username_string('profile', $id, ${$type}[$id]['name'], ${$type}[$id]['colour']), 'NAME_FULL' => get_username_string('full', $id, ${$type}[$id]['name'], ${$type}[$id]['colour'])));
} else {
$tpl_ary = array_merge($tpl_ary, array('U_VIEW' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=group&g=' . $id)));
}
$template->assign_block_vars($field . '_recipient', $tpl_ary);
}
}
}
// Build hidden address list
$s_hidden_address_field = build_address_field($address_list);
$bbcode_checked = isset($enable_bbcode) ? !$enable_bbcode : ($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') ? !$user->optionget('bbcode') : 1);
$smilies_checked = isset($enable_smilies) ? !$enable_smilies : ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') ? !$user->optionget('smilies') : 1);
$urls_checked = isset($enable_urls) ? !$enable_urls : 0;
$sig_checked = $enable_sig;
switch ($action) {
case 'post':
$page_title = $user->lang['POST_NEW_PM'];
break;
case 'quote':
$page_title = $user->lang['POST_QUOTE_PM'];
break;
case 'quotepost':
$page_title = $user->lang['POST_PM_POST'];
break;
case 'reply':
$page_title = $user->lang['POST_REPLY_PM'];
break;
case 'edit':
$page_title = $user->lang['POST_EDIT_PM'];
break;
case 'forward':
$page_title = $user->lang['POST_FORWARD_PM'];
break;
default:
trigger_error('NO_ACTION_MODE', E_USER_ERROR);
break;
}
$s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= isset($check_value) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields .= $draft_id || isset($_REQUEST['draft_loaded']) ? '<input type="hidden" name="draft_loaded" value="' . (isset($_REQUEST['draft_loaded']) ? $request->variable('draft_loaded', 0) : $draft_id) . '" />' : '';
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach') ? '' : ' enctype="multipart/form-data"';
// Start assigning vars for main posting page ...
$template->assign_vars(array('L_POST_A' => $page_title, 'L_ICON' => $user->lang['PM_ICON'], 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), 'SUBJECT' => isset($message_subject) ? $message_subject : '', 'MESSAGE' => $message_text, 'BBCODE_STATUS' => $bbcode_status ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $url_status ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'MAX_RECIPIENTS' => $config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group')) ? $max_recipients : 0, 'S_COMPOSE_PM' => true, 'S_EDIT_POST' => $action == 'edit', 'S_SHOW_PM_ICONS' => $s_pm_icons, 'S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_BBCODE_CHECKED' => $bbcode_checked ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => $smilies_checked ? ' checked="checked"' : '', 'S_SIG_ALLOWED' => $config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig'), 'S_SIGNATURE_CHECKED' => $sig_checked ? ' checked="checked"' : '', 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => $urls_checked ? ' checked="checked"' : '', 'S_SAVE_ALLOWED' => $auth->acl_get('u_savedrafts') && $action != 'edit' ? true : false, 'S_HAS_DRAFTS' => $auth->acl_get('u_savedrafts') && $drafts, 'S_FORM_ENCTYPE' => $form_enctype, 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => true, 'S_BBCODE_URL' => $url_status, 'S_POST_ACTION' => $s_action, 'S_HIDDEN_ADDRESS_FIELD' => $s_hidden_address_field, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.{$phpEx}", 'f=0&mode=popup'), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.{$phpEx}", 'f=0&mode=popup'))));
// Build custom bbcodes array
display_custom_bbcodes();
// Show attachment box for adding attachments if true
$allowed = $auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype;
if ($allowed) {
$max_files = $auth->acl_gets('a_', 'm_') ? 0 : (int) $config['max_attachments_pm'];
$plupload->configure($cache, $template, $s_action, false, $max_files);
}
// Attachment entry
posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);
// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward') {
if (message_history($msg_id, $user->data['user_id'], $post, array(), true)) {
$template->assign_var('S_DISPLAY_HISTORY', true);
}
}
}
示例2: view_message
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
global $_CLASS, $_CORE_CONFIG, $site_file_root, $config;
$_CLASS['core_user']->add_lang('viewtopic');
$msg_id = (int) $msg_id;
$folder_id = (int) $folder_id;
$author_id = (int) $message_row['author_id'];
// Not able to view message, it was deleted by the sender
if ($message_row['deleted']) {
trigger_error('NO_AUTH_READ_REMOVED_MESSAGE');
}
// Grab icons
$icons = array();
obtain_icons($icons);
// Instantiate BBCode if need be
if ($message_row['bbcode_bitfield']) {
require $site_file_root . 'includes/forums/bbcode.php';
$bbcode = new bbcode($message_row['bbcode_bitfield']);
}
// Assign TO/BCC Addresses to template
write_pm_addresses(array('to' => $message_row['to_address'], 'bcc' => $message_row['bcc_address']), $author_id);
$user_info = get_user_informations($author_id, $message_row);
// Parse the message and subject
$message = $message_row['message_text'];
// If the board has HTML off but the message has HTML on then we process it, else leave it alone
if ($message_row['enable_html'] && (!$config['auth_html_pm'] || !$_CLASS['auth']->acl_get('u_pm_html'))) {
$message = preg_replace('#(<!\\-\\- h \\-\\-><)([\\/]?.*?)(><!\\-\\- h \\-\\->)#is', "<\\2>", $message);
}
// Second parse bbcode here
if ($message_row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']);
}
// Always process smilies after parsing bbcodes
$message = smiley_text($message);
// Replace naughty words such as farty pants
$message_row['message_subject'] = censor_text($message_row['message_subject']);
$message = str_replace("\n", '<br />', censor_text($message));
// Editing information
if ($message_row['message_edit_count'] && $config['display_last_edited']) {
$l_edit_time_total = $message_row['message_edit_count'] == 1 ? $_CLASS['core_user']->lang['EDITED_TIME_TOTAL'] : $_CLASS['core_user']->lang['EDITED_TIMES_TOTAL'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, !$message_row['message_edit_user'] ? $message_row['username'] : $message_row['message_edit_user'], $_CLASS['core_user']->format_date($message_row['message_edit_time']), $message_row['message_edit_count']);
} else {
$l_edited_by = '';
}
// Pull attachment data
$display_notice = false;
$attachments = array();
if ($message_row['message_attachment'] && $config['allow_pm_attach']) {
if ($config['auth_download_pm'] && $_CLASS['auth']->acl_get('u_pm_download')) {
require $site_file_root . 'includes/forums/functions_display.php';
$sql = 'SELECT *
FROM ' . FORUMS_ATTACHMENTS_TABLE . "\n\t\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime " . (!$config['display_order'] ? 'DESC' : 'ASC') . ', post_msg_id ASC';
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$attachments[] = $row;
}
$_CLASS['core_db']->free_result($result);
// No attachments exist, but message table thinks they do so go ahead and reset attach flags
if (empty($attachments)) {
$sql = 'UPDATE ' . FORUMS_PRIVMSGS_TABLE . " \n\t\t\t\t\tSET message_attachment = 0 \n\t\t\t\t\tWHERE msg_id = {$msg_id}";
$_CLASS['core_db']->query($sql);
}
} else {
$display_notice = true;
}
}
// Assign inline attachments
if (!empty($attachments)) {
$unset_attachments = parse_inline_attachments($message, $attachments, $update_count, 0);
// 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'] = '';
$signature = $message_row['enable_sig'] && $config['allow_sig'] && $_CLASS['auth']->acl_get('u_sig') && $_CLASS['core_user']->optionget('viewsigs') ? $user_info['user_sig'] : '';
// End signature parsing, only if needed
if ($signature) {
if ($user_info['user_sig_bbcode_bitfield']) {
if (!isset($bbcode) || !$bbcode) {
require $site_file_root . 'includes/forums/bbcode.php';
$bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']);
}
$bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']);
}
$signature = smiley_text($signature);
$signature = str_replace("\n", '<br />', censor_text($signature));
}
$url = 'Control_Panel&i=' . $id;
$_CLASS['core_template']->assign(array('AUTHOR_NAME' => $user_info['user_colour'] ? '<span style="color:#' . $user_info['user_colour'] . '">' . $user_info['username'] . '</span>' : $user_info['username'], 'AUTHOR_RANK' => $user_info['rank_title'], 'RANK_IMAGE' => $user_info['rank_image'], 'AUTHOR_AVATAR' => isset($user_info['avatar']) ? $user_info['avatar'] : '', 'AUTHOR_JOINED' => $_CLASS['core_user']->format_date($user_info['user_reg_date']), 'AUTHOR_POSTS' => !empty($user_info['user_posts']) ? $user_info['user_posts'] : '', 'AUTHOR_FROM' => !empty($user_info['user_from']) ? $user_info['user_from'] : '', 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : (isset($user_info['online']) && $user_info['online'] ? $_CLASS['core_user']->img('btn_online', $_CLASS['core_user']->lang['ONLINE']) : $_CLASS['core_user']->img('btn_offline', $_CLASS['core_user']->lang['OFFLINE'])), 'DELETE_IMG' => $_CLASS['core_user']->img('btn_delete', $_CLASS['core_user']->lang['DELETE_MESSAGE']), 'INFO_IMG' => $_CLASS['core_user']->img('btn_info', $_CLASS['core_user']->lang['VIEW_PM_INFO']), 'REPORT_IMG' => $_CLASS['core_user']->img('btn_report', $_CLASS['core_user']->lang['REPORT_PM']), 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', $_CLASS['core_user']->lang['MESSAGE_REPORTED_MESSAGE']), 'PROFILE_IMG' => $_CLASS['core_user']->img('btn_profile', $_CLASS['core_user']->lang['READ_PROFILE']), 'EMAIL_IMG' => $_CLASS['core_user']->img('btn_email', $_CLASS['core_user']->lang['SEND_EMAIL']), 'QUOTE_IMG' => $_CLASS['core_user']->img('btn_quote', $_CLASS['core_user']->lang['POST_QUOTE_PM']), 'REPLY_IMG' => $_CLASS['core_user']->img('btn_reply_pm', $_CLASS['core_user']->lang['POST_REPLY_PM']), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', $_CLASS['core_user']->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $_CLASS['core_user']->img('icon_post', $_CLASS['core_user']->lang['PM']), 'SENT_DATE' => $_CLASS['core_user']->format_date($message_row['message_time']), 'SUBJECT' => $message_row['message_subject'], 'MESSAGE' => $message, 'SIGNATURE' => $message_row['enable_sig'] ? $signature : '', 'EDITED_MESSAGE' => $l_edited_by, 'U_MCP_REPORT' => generate_link('Forums&file=mcp&mode=pm_details&p=' . $message_row['msg_id']), 'U_REPORT' => $config['auth_report_pm'] && $_CLASS['auth']->acl_get('u_pm_report') ? generate_link('Forums&file=report&pm=' . $message_row['msg_id']) : '', 'U_INFO' => $_CLASS['auth']->acl_get('m_') && ($message_row['message_reported'] || $message_row['forwarded']) ? generate_link('Forums&file=mcp&mode=pm_details&p=' . $message_row['msg_id']) : '', 'U_DELETE' => $_CLASS['auth']->acl_get('u_pm_delete') ? generate_link("{$url}&mode=compose&action=delete&f={$folder_id}&p=" . $message_row['msg_id']) : '', 'U_AUTHOR_PROFILE' => generate_link('Members_List&mode=viewprofile&u=' . $author_id), 'U_EMAIL' => $user_info['email'], 'U_QUOTE' => $_CLASS['auth']->acl_get('u_sendpm') && $author_id != $_CLASS['core_user']->data['user_id'] ? generate_link("{$url}&mode=compose&action=quote&f={$folder_id}&p=" . $message_row['msg_id']) : '', 'U_EDIT' => ($message_row['message_time'] > time() - $config['pm_edit_time'] || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $_CLASS['auth']->acl_get('u_pm_edit') ? generate_link("{$url}&mode=compose&action=edit&f={$folder_id}&p=" . $message_row['msg_id']) : '', 'U_POST_REPLY_PM' => $author_id != $_CLASS['core_user']->data['user_id'] && $_CLASS['auth']->acl_get('u_sendpm') ? generate_link("{$url}&mode=compose&action=reply&f={$folder_id}&p=" . $message_row['msg_id']) : '', 'U_PREVIOUS_PM' => generate_link("{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=previous"), 'U_NEXT_PM' => generate_link("{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=next"), 'S_MESSAGE_REPORTED' => $message_row['message_reported'] && $_CLASS['auth']->acl_get('m_') ? true : false, 'S_HAS_ATTACHMENTS' => sizeof($attachments) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'U_PRINT_PM' => generate_link("{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=print"), 'U_EMAIL_PM' => $_CORE_CONFIG['email']['email_enable'] ? 'Email' : '', 'U_FORWARD_PM' => generate_link("{$url}&mode=compose&action=forward&f={$folder_id}&p=" . $message_row['msg_id'])));
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (isset($attachments) && sizeof($attachments)) {
foreach ($attachments as $attachment) {
$_CLASS['core_template']->assign_vars_array('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print') {
// Message History
if (message_history($msg_id, $_CLASS['core_user']->data['user_id'], $message_row, $folder)) {
$_CLASS['core_template']->assign('S_DISPLAY_HISTORY', true);
//.........这里部分代码省略.........
示例3: view_message
//.........这里部分代码省略.........
trigger_error($message);
}
// Do not allow hold messages to be seen
if ($folder_id == PRIVMSGS_HOLD_BOX) {
trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
}
// Grab icons
$icons = $cache->obtain_icons();
$bbcode = false;
// Instantiate BBCode if need be
if ($message_row['bbcode_bitfield']) {
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($message_row['bbcode_bitfield']);
}
// Assign TO/BCC Addresses to template
write_pm_addresses(array('to' => $message_row['to_address'], 'bcc' => $message_row['bcc_address']), $author_id);
$user_info = get_user_information($author_id, $message_row);
// Parse the message and subject
$message = censor_text($message_row['message_text']);
// Second parse bbcode here
if ($message_row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']);
}
// Always process smilies after parsing bbcodes
$message = bbcode_nl2br($message);
$message = smiley_text($message);
// Replace naughty words such as farty pants
$message_row['message_subject'] = censor_text($message_row['message_subject']);
// Editing information
if ($message_row['message_edit_count'] && $config['display_last_edited']) {
$l_edit_time_total = $message_row['message_edit_count'] == 1 ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, !$message_row['message_edit_user'] ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time'], false, true), $message_row['message_edit_count']);
} else {
$l_edited_by = '';
}
// Pull attachment data
$display_notice = false;
$attachments = array();
if ($message_row['message_attachment'] && $config['allow_pm_attach']) {
if ($auth->acl_get('u_pm_download')) {
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime DESC, post_msg_id ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[] = $row;
}
$db->sql_freeresult($result);
// No attachments exist, but message table thinks they do so go ahead and reset attach flags
if (!sizeof($attachments)) {
$sql = 'UPDATE ' . PRIVMSGS_TABLE . "\n\t\t\t\t\tSET message_attachment = 0\n\t\t\t\t\tWHERE msg_id = {$msg_id}";
$db->sql_query($sql);
}
} else {
$display_notice = true;
}
}
// Assign inline attachments
if (!empty($attachments)) {
$update_count = array();
parse_attachments(false, $message, $attachments, $update_count);
// Update the attachment download counts
if (sizeof($update_count)) {
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1
WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count));
$db->sql_query($sql);
}
}
$user_info['sig'] = '';
$signature = $message_row['enable_sig'] && $config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('viewsigs') ? $user_info['user_sig'] : '';
// End signature parsing, only if needed
if ($signature) {
$signature = censor_text($signature);
if ($user_info['user_sig_bbcode_bitfield']) {
if ($bbcode === false) {
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']);
}
$bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']);
}
$signature = bbcode_nl2br($signature);
$signature = smiley_text($signature);
}
$url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm');
// Number of "to" recipients
$num_recipients = (int) preg_match_all('/:?(u|g)_([0-9]+):?/', $message_row['to_address'], $match);
$template->assign_vars(array('MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $user_info['username'], $user_info['user_colour'], $user_info['username']), 'RANK_TITLE' => $user_info['rank_title'], 'RANK_IMG' => $user_info['rank_image'], 'AUTHOR_AVATAR' => isset($user_info['avatar']) ? $user_info['avatar'] : '', 'AUTHOR_JOINED' => $user->format_date($user_info['user_regdate']), 'AUTHOR_POSTS' => (int) $user_info['user_posts'], 'AUTHOR_FROM' => !empty($user_info['user_from']) ? $user_info['user_from'] : '', 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : (isset($user_info['online']) && $user_info['online'] ? $user->img('icon_user_online', $user->lang['ONLINE']) : $user->img('icon_user_offline', $user->lang['OFFLINE'])), 'S_ONLINE' => !$config['load_onlinetrack'] ? false : (isset($user_info['online']) && $user_info['online'] ? true : false), 'DELETE_IMG' => $user->img('icon_post_delete', $user->lang['DELETE_MESSAGE']), 'INFO_IMG' => $user->img('icon_post_info', $user->lang['VIEW_PM_INFO']), 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['READ_PROFILE']), 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['SEND_EMAIL']), 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['POST_QUOTE_PM']), 'REPLY_IMG' => $user->img('button_pm_reply', $user->lang['POST_REPLY_PM']), 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_PM'), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'SENT_DATE' => $view == 'print' ? $user->format_date($message_row['message_time'], false, true) : $user->format_date($message_row['message_time']), 'SUBJECT' => $message_row['message_subject'], 'MESSAGE' => $message, 'SIGNATURE' => $message_row['enable_sig'] ? $signature : '', 'EDITED_MESSAGE' => $l_edited_by, 'MESSAGE_ID' => $message_row['msg_id'], 'U_PM' => $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_info['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=compose&u=' . $author_id) : '', 'U_WWW' => !empty($user_info['user_website']) ? $user_info['user_website'] : '', 'U_ICQ' => $user_info['user_icq'] ? 'http://www.icq.com/people/webmsg.php?to=' . urlencode($user_info['user_icq']) : '', 'U_AIM' => $user_info['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=aim&u=' . $author_id) : '', 'U_YIM' => $user_info['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($user_info['user_yim']) . '&.src=pg' : '', 'U_MSN' => $user_info['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=msnm&u=' . $author_id) : '', 'U_JABBER' => $user_info['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=jabber&u=' . $author_id) : '', 'U_DELETE' => $auth->acl_get('u_pm_delete') ? "{$url}&mode=compose&action=delete&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_EMAIL' => $user_info['email'], 'U_REPORT' => $config['allow_pm_report'] ? append_sid("{$phpbb_root_path}report.{$phpEx}", "pm=" . $message_row['msg_id']) : '', 'U_QUOTE' => $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS ? "{$url}&mode=compose&action=quote&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_EDIT' => ($message_row['message_time'] > time() - $config['pm_edit_time'] * 60 || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit') ? "{$url}&mode=compose&action=edit&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS ? "{$url}&mode=compose&action=reply&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_ALL' => $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS ? "{$url}&mode=compose&action=reply&f={$folder_id}&reply_to_all=1&p=" . $message_row['msg_id'] : '', 'U_PREVIOUS_PM' => "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=next", 'U_PM_ACTION' => $url . '&mode=compose&f=' . $folder_id . '&p=' . $message_row['msg_id'], 'S_HAS_ATTACHMENTS' => sizeof($attachments) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'S_AUTHOR_DELETED' => $author_id == ANONYMOUS ? true : false, 'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)), 'S_PM_RECIPIENTS' => $num_recipients, 'U_PRINT_PM' => $config['print_pm'] && $auth->acl_get('u_pm_printpm') ? "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=print" : '', 'U_FORWARD_PM' => $config['forward_pm'] && $auth->acl_get('u_sendpm') && $auth->acl_get('u_pm_forward') ? "{$url}&mode=compose&action=forward&f={$folder_id}&p=" . $message_row['msg_id'] : ''));
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (isset($attachments) && sizeof($attachments)) {
foreach ($attachments as $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print') {
// Message History
if (message_history($msg_id, $user->data['user_id'], $message_row, $folder)) {
$template->assign_var('S_DISPLAY_HISTORY', true);
}
}
}
示例4: compose_pm
//.........这里部分代码省略.........
switch ($action)
{
case 'post':
$page_title = $user->lang['POST_NEW_PM'];
break;
case 'quote':
$page_title = $user->lang['POST_QUOTE_PM'];
break;
case 'quotepost':
$page_title = $user->lang['POST_PM_POST'];
break;
case 'reply':
$page_title = $user->lang['POST_REPLY_PM'];
break;
case 'edit':
$page_title = $user->lang['POST_EDIT_PM'];
break;
case 'forward':
$page_title = $user->lang['POST_FORWARD_PM'];
break;
default:
trigger_error('NO_ACTION_MODE', E_USER_ERROR);
break;
}
$s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? intval($_REQUEST['draft_loaded']) : $draft_id) . '" />' : '';
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';
// Start assigning vars for main posting page ...
$template->assign_vars(array(
'L_POST_A' => $page_title,
'L_ICON' => $user->lang['PM_ICON'],
'L_MESSAGE_BODY_EXPLAIN' => (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '',
'SUBJECT' => (isset($message_subject)) ? $message_subject : '',
'MESSAGE' => $message_text,
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']),
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'S_COMPOSE_PM' => true,
'S_EDIT_POST' => ($action == 'edit'),
'S_SHOW_PM_ICONS' => $s_pm_icons,
'S_BBCODE_ALLOWED' => $bbcode_status,
'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '',
'S_SMILIES_ALLOWED' => $smilies_status,
'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '',
'S_SIG_ALLOWED' => ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig')),
'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '',
'S_LINKS_ALLOWED' => $url_status,
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '',
'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false,
'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts),
'S_FORM_ENCTYPE' => $form_enctype,
'S_BBCODE_IMG' => $img_status,
'S_BBCODE_FLASH' => $flash_status,
'S_BBCODE_QUOTE' => true,
'S_BBCODE_URL' => $url_status,
'S_POST_ACTION' => $s_action,
'S_HIDDEN_ADDRESS_FIELD' => $s_hidden_address_field,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']),
'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'),
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')),
));
// Build custom bbcodes array
display_custom_bbcodes();
// Attachment entry
if ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype)
{
posting_gen_attachment_entry($attachment_data, $filename_data);
}
// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward')
{
if (message_history($msg_id, $user->data['user_id'], $post, array(), true))
{
$template->assign_var('S_DISPLAY_HISTORY', true);
}
}
}
示例5: view_message
//.........这里部分代码省略.........
if ($folder_id == PRIVMSGS_HOLD_BOX) {
trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
}
// Grab icons
$icons = array();
$cache->obtain_icons($icons);
$bbcode = false;
// Instantiate BBCode if need be
if ($message_row['bbcode_bitfield']) {
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($message_row['bbcode_bitfield']);
}
// Assign TO/BCC Addresses to template
write_pm_addresses(array('to' => $message_row['to_address'], 'bcc' => $message_row['bcc_address']), $author_id);
$user_info = get_user_informations($author_id, $message_row);
// Parse the message and subject
$message = $message_row['message_text'];
// Second parse bbcode here
if ($message_row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($message, $message_row['bbcode_uid'], $message_row['bbcode_bitfield']);
}
// Always process smilies after parsing bbcodes
$message = smiley_text($message);
// Replace naughty words such as farty pants
$message_row['message_subject'] = censor_text($message_row['message_subject']);
$message = str_replace("\n", '<br />', censor_text($message));
// Editing information
if ($message_row['message_edit_count'] && $config['display_last_edited']) {
$l_edit_time_total = $message_row['message_edit_count'] == 1 ? $user->lang['EDITED_TIME_TOTAL'] : $user->lang['EDITED_TIMES_TOTAL'];
$l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, !$message_row['message_edit_user'] ? $message_row['username'] : $message_row['message_edit_user'], $user->format_date($message_row['message_edit_time']), $message_row['message_edit_count']);
} else {
$l_edited_by = '';
}
// Pull attachment data
$display_notice = false;
$attachments = array();
if ($message_row['message_attachment'] && $config['allow_pm_attach']) {
if ($config['auth_download_pm'] && $auth->acl_get('u_pm_download')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime " . (!$config['display_order'] ? 'DESC' : 'ASC') . ', post_msg_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[] = $row;
}
$db->sql_freeresult($result);
// No attachments exist, but message table thinks they do so go ahead and reset attach flags
if (!sizeof($attachments)) {
$sql = 'UPDATE ' . PRIVMSGS_TABLE . "\n\t\t\t\t\tSET message_attachment = 0\n\t\t\t\t\tWHERE msg_id = {$msg_id}";
$db->sql_query($sql);
}
} else {
$display_notice = true;
}
}
// Assign inline attachments
if (isset($attachments) && sizeof($attachments)) {
$update_count = array();
$unset_attachments = parse_inline_attachments($message, $attachments, $update_count, 0);
// Needed to let not display the inlined attachments at the end of the message again
foreach ($unset_attachments as $index) {
unset($attachments[$index]);
}
// Update the attachment download counts
if (sizeof($update_count)) {
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1
WHERE attach_id IN (' . implode(', ', array_unique($update_count)) . ')';
$db->sql_query($sql);
}
}
$user_info['sig'] = '';
$signature = $message_row['enable_sig'] && $config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('viewsigs') ? $user_info['user_sig'] : '';
// End signature parsing, only if needed
if ($signature) {
if ($user_info['user_sig_bbcode_bitfield']) {
if ($bbcode === false) {
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($user_info['user_sig_bbcode_bitfield']);
}
$bbcode->bbcode_second_pass($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield']);
}
$signature = smiley_text($signature);
$signature = str_replace("\n", '<br />', censor_text($signature));
}
$url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm');
$template->assign_vars(array('AUTHOR_NAME' => $user_info['user_colour'] ? '<span style="color:#' . $user_info['user_colour'] . '">' . $user_info['username'] . '</span>' : $user_info['username'], 'AUTHOR_RANK' => $user_info['rank_title'], 'RANK_IMAGE' => $user_info['rank_image'], 'AUTHOR_AVATAR' => isset($user_info['avatar']) ? $user_info['avatar'] : '', 'AUTHOR_JOINED' => $user->format_date($user_info['user_regdate']), 'AUTHOR_POSTS' => !empty($user_info['user_posts']) ? $user_info['user_posts'] : '', 'AUTHOR_FROM' => !empty($user_info['user_from']) ? $user_info['user_from'] : '', 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : (isset($user_info['online']) && $user_info['online'] ? $user->img('btn_online', $user->lang['ONLINE']) : $user->img('btn_offline', $user->lang['OFFLINE'])), 'S_ONLINE' => !$config['load_onlinetrack'] ? false : (isset($user_info['online']) && $user_info['online'] ? true : false), 'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_MESSAGE']), 'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']), 'PROFILE_IMG' => $user->img('btn_profile', $user->lang['READ_PROFILE']), 'EMAIL_IMG' => $user->img('btn_email', $user->lang['SEND_EMAIL']), 'QUOTE_IMG' => $user->img('btn_quote', $user->lang['POST_QUOTE_PM']), 'REPLY_IMG' => $user->img('btn_reply_pm', $user->lang['POST_REPLY_PM']), 'EDIT_IMG' => $user->img('btn_edit', $user->lang['POST_EDIT_PM']), 'MINI_POST_IMG' => $user->img('icon_post', $user->lang['PM']), 'SENT_DATE' => $user->format_date($message_row['message_time']), 'SUBJECT' => $message_row['message_subject'], 'MESSAGE' => $message, 'SIGNATURE' => $message_row['enable_sig'] ? $signature : '', 'EDITED_MESSAGE' => $l_edited_by, 'U_INFO' => $auth->acl_get('m_info') && $message_row['forwarded'] ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'mode=pm_details&p=' . $message_row['msg_id'], true, $user->session_id) : '', 'U_DELETE' => $auth->acl_get('u_pm_delete') ? "{$url}&mode=compose&action=delete&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_AUTHOR_PROFILE' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&u=' . $author_id), 'U_EMAIL' => $user_info['email'], 'U_QUOTE' => $auth->acl_get('u_sendpm') ? "{$url}&mode=compose&action=quote&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_EDIT' => ($message_row['message_time'] > time() - $config['pm_edit_time'] || !$config['pm_edit_time']) && $folder_id == PRIVMSGS_OUTBOX && $auth->acl_get('u_pm_edit') ? "{$url}&mode=compose&action=edit&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_POST_REPLY_PM' => $auth->acl_get('u_sendpm') ? "{$url}&mode=compose&action=reply&f={$folder_id}&p=" . $message_row['msg_id'] : '', 'U_PREVIOUS_PM' => "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=previous", 'U_NEXT_PM' => "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=next", 'S_HAS_ATTACHMENTS' => sizeof($attachments) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'], 'U_PRINT_PM' => $config['print_pm'] && $auth->acl_get('u_pm_printpm') ? "{$url}&f={$folder_id}&p=" . $message_row['msg_id'] . "&view=print" : '', 'U_FORWARD_PM' => $config['forward_pm'] && $auth->acl_get('u_pm_forward') ? "{$url}&mode=compose&action=forward&f={$folder_id}&p=" . $message_row['msg_id'] : ''));
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (isset($attachments) && sizeof($attachments)) {
foreach ($attachments as $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print') {
// Message History
if (message_history($msg_id, $user->data['user_id'], $message_row, $folder)) {
$template->assign_var('S_DISPLAY_HISTORY', true);
}
}
}