• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP write_pm_addresses函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中write_pm_addresses函数的典型用法代码示例。如果您正苦于以下问题:PHP write_pm_addresses函数的具体用法?PHP write_pm_addresses怎么用?PHP write_pm_addresses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了write_pm_addresses函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: compose_pm


//.........这里部分代码省略.........
            $attachment_data = $message_parser->attachment_data;
            parse_attachments(false, $preview_message, $attachment_data, $update_count, true);
            foreach ($attachment_data as $i => $attachment) {
                $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
            }
            unset($attachment_data);
        }
        $preview_subject = censor_text($subject);
        if (!sizeof($error)) {
            $template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
        }
        unset($message_text);
    }
    // Decode text for message display
    $bbcode_uid = ($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!sizeof($error) || sizeof($error) && !$submit) ? $bbcode_uid : $message_parser->bbcode_uid;
    $message_parser->decode_message($bbcode_uid);
    if (($action == 'quote' || $action == 'quotepost') && !$preview && !$refresh && !$submit) {
        if ($action == 'quotepost') {
            $post_id = request_var('p', 0);
            if ($config['allow_post_links']) {
                $message_link = "[url=" . generate_board_url() . "/viewtopic.{$phpEx}?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}[/url]\n\n";
            } else {
                $message_link = $user->lang['SUBJECT'] . $user->lang['COLON'] . ' ' . $message_subject . " (" . generate_board_url() . "/viewtopic.{$phpEx}?p={$post_id}#p{$post_id})\n\n";
            }
        } else {
            $message_link = '';
        }
        $message_parser->message = $message_link . '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
    }
    if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) {
        $message_subject = (!preg_match('/^Re:/', $message_subject) ? 'Re: ' : '') . censor_text($message_subject);
    }
    if ($action == 'forward' && !$preview && !$refresh && !$submit) {
        $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true);
        if ($config['allow_post_links']) {
            $quote_username_text = '[url=' . generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]";
        } else {
            $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.{$phpEx}?mode=viewprofile&u={$post['author_id']})";
        }
        $forward_text = array();
        $forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
        $forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));
        $forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true));
        $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text);
        $forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to']));
        $message_parser->message = implode("\n", $forward_text) . "\n\n[quote="{$quote_username}"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";
        $message_subject = (!preg_match('/^Fwd:/', $message_subject) ? 'Fwd: ' : '') . censor_text($message_subject);
    }
    $attachment_data = $message_parser->attachment_data;
    $filename_data = $message_parser->filename_data;
    $message_text = $message_parser->message;
    // MAIN PM PAGE BEGINS HERE
    // Generate smiley listing
    generate_smilies('inline', 0);
    // Generate PM Icons
    $s_pm_icons = false;
    if ($config['enable_pm_icons']) {
        $s_pm_icons = posting_gen_topic_icons($action, $icon_id);
    }
    // Generate inline attachment select box
    posting_gen_inline_attachments($attachment_data);
    // Build address list for display
    // array('u' => array($author_id => 'to'));
    if (sizeof($address_list)) {
        // Get Usernames and Group Names
        $result = array();
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:ucp_pm_compose.php


示例2: main

    function main($id, $mode)
    {
        global $auth, $db, $user, $template, $cache;
        global $config, $phpbb_root_path, $phpEx, $action;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
        $start = request_var('start', 0);
        $this->page_title = 'MCP_PM_REPORTS';
        switch ($action) {
            case 'close':
            case 'delete':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $report_id_list = request_var('report_id_list', array(0));
                if (!sizeof($report_id_list)) {
                    trigger_error('NO_REPORT_SELECTED');
                }
                if (!function_exists('close_report')) {
                    include $phpbb_root_path . 'includes/mcp/mcp_reports.' . $phpEx;
                }
                close_report($report_id_list, $mode, $action, true);
                break;
        }
        switch ($mode) {
            case 'pm_report_details':
                $user->add_lang(array('posting', 'viewforum', 'viewtopic', 'ucp'));
                $report_id = request_var('r', 0);
                $sql = 'SELECT r.pm_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
					FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
					WHERE r.report_id = ' . $report_id . '
						AND rr.reason_id = r.reason_id
						AND r.user_id = u.user_id
						AND r.post_id = 0
					ORDER BY report_closed ASC';
                $result = $db->sql_query_limit($sql, 1);
                $report = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$report_id || !$report) {
                    trigger_error('NO_REPORT');
                }
                $pm_id = $report['pm_id'];
                $report_id = $report['report_id'];
                $pm_info = get_pm_data(array($pm_id));
                if (!sizeof($pm_info)) {
                    trigger_error('NO_REPORT_SELECTED');
                }
                $pm_info = $pm_info[$pm_id];
                write_pm_addresses(array('to' => $pm_info['to_address'], 'bcc' => $pm_info['bcc_address']), (int) $pm_info['author_id']);
                $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
                if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) {
                    $reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
                    $reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
                }
                // Process message, leave it uncensored
                $message = $pm_info['message_text'];
                if ($pm_info['bbcode_bitfield']) {
                    include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
                    $bbcode = new bbcode($pm_info['bbcode_bitfield']);
                    $bbcode->bbcode_second_pass($message, $pm_info['bbcode_uid'], $pm_info['bbcode_bitfield']);
                }
                $message = bbcode_nl2br($message);
                $message = smiley_text($message);
                if ($pm_info['message_attachment'] && $auth->acl_get('u_pm_download')) {
                    $sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $pm_id . '
							AND in_message = 1
						ORDER BY filetime DESC';
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $attachments[] = $row;
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($attachments)) {
                        $update_count = array();
                        parse_attachments(0, $message, $attachments, $update_count);
                    }
                    // Display not already displayed Attachments for this post, we already parsed them. ;)
                    if (!empty($attachments)) {
                        $template->assign_var('S_HAS_ATTACHMENTS', true);
                        foreach ($attachments as $attachment) {
                            $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
                        }
                    }
                }
                $template->assign_vars(array('S_MCP_REPORT' => true, 'S_PM' => true, 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id), 'S_CAN_VIEWIP' => $auth->acl_getf_global('m_info'), 'S_POST_REPORTED' => $pm_info['message_reported'], 'S_USER_NOTES' => true, 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $report['user_id']), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $pm_info['author_id']), 'U_MCP_WARN_REPORTER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $report['user_id']) : '', 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $pm_info['author_id']) : '', 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'), 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=pm_reports' . ($pm_info['message_reported'] ? '&amp;mode=pm_reports' : '&amp;mode=pm_reports_closed') . '&amp;start=' . $start) . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'REPORT_DATE' => $user->format_date($report['report_time']), 'REPORT_ID' => $report_id, 'REPORT_REASON_TITLE' => $reason['title'], 'REPORT_REASON_DESCRIPTION' => $reason['description'], 'REPORT_TEXT' => $report['report_text'], 'POST_AUTHOR_FULL' => get_username_string('full', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), 'POST_AUTHOR' => get_username_string('username', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), 'U_POST_AUTHOR' => get_username_string('profile', $pm_info['author_id'], $pm_info['username'], $pm_info['user_colour']), 'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']), 'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']), 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $pm_info['message_subject'] ? $pm_info['message_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($pm_info['message_time']), 'POST_IP' => $pm_info['author_ip'], 'POST_IPADDR' => $auth->acl_getf_global('m_info') && request_var('lookup', '') ? @gethostbyaddr($pm_info['author_ip']) : '', 'POST_ID' => $pm_info['msg_id'], 'U_LOOKUP_IP' => $auth->acl_getf_global('m_info') ? $this->u_action . '&amp;r=' . $report_id . '&amp;pm=' . $pm_id . '&amp;lookup=' . $pm_info['author_ip'] . '#ip' : ''));
                $this->tpl_name = 'mcp_post';
                break;
            case 'pm_reports':
            case 'pm_reports_closed':
                $user->add_lang(array('ucp'));
                $sort_days = $total = 0;
                $sort_key = $sort_dir = '';
                $sort_by_sql = $sort_order_sql = array();
                mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total);
                $limit_time_sql = $sort_days ? 'AND r.report_time >= ' . (time() - $sort_days * 86400) : '';
                if ($mode == 'pm_reports') {
                    $report_state = 'p.message_reported = 1 AND r.report_closed = 0';
                } else {
                    $report_state = 'r.report_closed = 1';
                }
//.........这里部分代码省略.........
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:mcp_pm_reports.php


示例3: 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', "&lt;\\2&gt;", $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&amp;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&amp;file=mcp&amp;mode=pm_details&amp;p=' . $message_row['msg_id']), 'U_REPORT' => $config['auth_report_pm'] && $_CLASS['auth']->acl_get('u_pm_report') ? generate_link('Forums&amp;file=report&amp;pm=' . $message_row['msg_id']) : '', 'U_INFO' => $_CLASS['auth']->acl_get('m_') && ($message_row['message_reported'] || $message_row['forwarded']) ? generate_link('Forums&amp;file=mcp&amp;mode=pm_details&amp;p=' . $message_row['msg_id']) : '', 'U_DELETE' => $_CLASS['auth']->acl_get('u_pm_delete') ? generate_link("{$url}&amp;mode=compose&amp;action=delete&amp;f={$folder_id}&amp;p=" . $message_row['msg_id']) : '', 'U_AUTHOR_PROFILE' => generate_link('Members_List&amp;mode=viewprofile&amp;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}&amp;mode=compose&amp;action=quote&amp;f={$folder_id}&amp;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}&amp;mode=compose&amp;action=edit&amp;f={$folder_id}&amp;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}&amp;mode=compose&amp;action=reply&amp;f={$folder_id}&amp;p=" . $message_row['msg_id']) : '', 'U_PREVIOUS_PM' => generate_link("{$url}&amp;f={$folder_id}&amp;p=" . $message_row['msg_id'] . "&amp;view=previous"), 'U_NEXT_PM' => generate_link("{$url}&amp;f={$folder_id}&amp;p=" . $message_row['msg_id'] . "&amp;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}&amp;f={$folder_id}&amp;p=" . $message_row['msg_id'] . "&amp;view=print"), 'U_EMAIL_PM' => $_CORE_CONFIG['email']['email_enable'] ? 'Email' : '', 'U_FORWARD_PM' => generate_link("{$url}&amp;mode=compose&amp;action=forward&amp;f={$folder_id}&amp;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);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_pm_viewmessage.php


示例4: view_message

/**
* View private message
*/
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
    global $user, $template, $auth, $db, $cache;
    global $phpbb_root_path, $phpEx, $config;
    $user->add_lang(array('viewtopic', 'memberlist'));
    $msg_id = (int) $msg_id;
    $folder_id = (int) $folder_id;
    $author_id = (int) $message_row['author_id'];
    $view = request_var('view', '');
    // Not able to view message, it was deleted by the sender
    if ($message_row['pm_deleted']) {
        $meta_info = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&amp;folder={$folder_id}");
        $message = $user->lang['NO_AUTH_READ_REMOVED_MESSAGE'];
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
        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);
    }
//.........这里部分代码省略.........
开发者ID:puring0815,项目名称:OpenKore,代码行数:101,代码来源:ucp_pm_viewmessage.php


示例5: compose_pm


//.........这里部分代码省略.........
        if ($enable_sig && $config['allow_sig'] && $preview_signature) {
            $parse_sig = new parse_message($preview_signature);
            $parse_sig->bbcode_uid = $preview_signature_uid;
            $parse_sig->bbcode_bitfield = $preview_signature_bitfield;
            $parse_sig->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
            $preview_signature = $parse_sig->message;
            unset($parse_sig);
        } else {
            $preview_signature = '';
        }
        // Attachment Preview
        if (!empty($message_parser->attachment_data)) {
            require $site_file_root . 'includes/forums/functions_display.php';
            $extensions = $update_count = array();
            $_CLASS['core_template']->assign('S_HAS_ATTACHMENTS', true);
            display_attachments(0, 'attachment', $message_parser->attachment_data, $update_count, true);
        }
        $preview_subject = censor_text($subject);
        if (empty($error)) {
            $_CLASS['core_template']->assign(array('POST_DATE' => $_CLASS['core_user']->format_date($post_time), 'PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
        }
        unset($message_text);
    }
    // Decode text for message display
    $bbcode_uid = ($action == 'quote' || $action == 'forward') && !$preview && !$refresh && empty($error) ? $bbcode_uid : $message_parser->bbcode_uid;
    $message_parser->decode_message($bbcode_uid);
    if ($action == 'quote' && !$preview && !$refresh) {
        $message_parser->message = '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
    }
    if (($action == 'reply' || $action == 'quote') && !$preview && !$refresh) {
        $message_subject = (!preg_match('/^Re:/', $message_subject) ? 'Re: ' : '') . censor_text($message_subject);
    }
    if ($action == 'forward' && !$preview && !$refresh) {
        $fwd_to_field = write_pm_addresses(array('to' => $to_address), 0, true);
        $forward_text = array();
        $forward_text[] = $_CLASS['core_user']->lang['FWD_ORIGINAL_MESSAGE'];
        $forward_text[] = sprintf($_CLASS['core_user']->lang['FWD_SUBJECT'], censor_text($message_subject));
        $forward_text[] = sprintf($_CLASS['core_user']->lang['FWD_DATE'], $_CLASS['core_user']->format_date($message_time));
        $forward_text[] = sprintf($_CLASS['core_user']->lang['FWD_FROM'], $quote_username);
        $forward_text[] = sprintf($_CLASS['core_user']->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));
        $message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"[url=" . generate_link("Members_List&mode=viewprofile&u={$author_id}]{$quote_username}") . "[/url]\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";
        $message_subject = (!preg_match('/^Fwd:/', $message_subject) ? 'Fwd: ' : '') . censor_text($message_subject);
    }
    $attachment_data = $message_parser->attachment_data;
    $filename_data = $message_parser->filename_data;
    $message_text = $message_parser->message;
    unset($message_parser);
    // MAIN PM PAGE BEGINS HERE
    // Generate smiley listing
    generate_smilies('inline', 0);
    // Generate PM Icons
    $s_pm_icons = false;
    if ($config['enable_pm_icons']) {
        $s_pm_icons = posting_gen_topic_icons($action, $icon_id);
    }
    // Generate inline attachment select box
    posting_gen_inline_attachments($attachment_data);
    // Build address list for display
    // array('u' => array($author_id => 'to'));
    if (!empty($address_list)) {
        // Get Usernames and Group Names
        $result = array();
        if (isset($address_list['u']) && !empty($address_list['u'])) {
            $result['u'] = $_CLASS['core_db']->query('SELECT user_id as id, username as name, user_colour as colour 
				FROM ' . USERS_TABLE . ' 
				WHERE user_id IN (' . implode(', ', array_map('intval', array_keys($address_list['u']))) . ')');
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:67,代码来源:ucp_pm_compose.php


示例6: compose_pm


//.........这里部分代码省略.........
	// Decode text for message display
	$bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid;

	$message_parser->decode_message($bbcode_uid);

	if (($action == 'quote' || $action == 'quotepost') && !$preview && !$refresh && !$submit)
	{
		if ($action == 'quotepost')
		{
			$post_id = request_var('p', 0);
			if ($config['allow_post_links'])
			{
				$message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}: {$message_subject}[/url]\n\n";
			}
			else
			{
				$message_link = $user->lang['SUBJECT'] . ': ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n";
			}
		}
		else
		{
			$message_link = '';
		}
		$message_parser->message = $message_link . '[quote=&quot;' . $quote_username . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
	}

	if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
	{
		$message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject);
	}

	if ($action == 'forward' && !$preview && !$refresh && !$submit)
	{
		$fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true);

		if ($config['allow_post_links'])
		{
			$quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&amp;u={$post['author_id']}]{$quote_username}[/url]";
		}
		else
		{
			$quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&amp;u={$post['author_id']})";
		}

		$forward_text = array();
		$forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
		$forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));
		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time));
		$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text);
		$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));

		$message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"{$quote_username}\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";
		$message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject);
	}

	$attachment_data = $message_parser->attachment_data;
	$filename_data = $message_parser->filename_data;
	$message_text = $message_parser->message;
	unset($message_parser);

	// MAIN PM PAGE BEGINS HERE

	// Generate smiley listing
	generate_smilies('inline', 0);

	// Generate PM Icons
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:ucp_pm_compose.php


示例7: view_message

/**
* View private message
*/
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
    global $user, $template, $auth, $db, $cache;
    global $phpbb_root_path, $phpEx, $config;
    $user->add_lang(array('viewtopic', 'memberlist'));
    $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');
    }
    // Do not allow hold messages to be seen
    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));
//.........这里部分代码省略.........
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:ucp_pm_viewmessage.php



注:本文中的write_pm_addresses函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP write_post函数代码示例发布时间:2022-05-23
下一篇:
PHP write_memberslog函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap