当前位置: 首页>>代码示例>>PHP>>正文


PHP parse_attachments函数代码示例

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


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

示例1: _get_block_content

 /**
  * @param array $attachments_ary
  * @param array $posts_data
  * @param array $extensions
  */
 protected function _get_block_content(array $attachments_ary, array $posts_data, array $extensions)
 {
     $message = '';
     $update_count = array();
     foreach ($attachments_ary as $post_id => $attachments) {
         $topic_id = $attachments[0]['topic_id'];
         $post_row = $posts_data[$topic_id][$post_id];
         parse_attachments($post_row['forum_id'], $message, $attachments, $update_count, true);
         $this->ptemplate->assign_block_vars('postrow', array());
         foreach ($attachments as $i => $attachment) {
             $row = $attachments_ary[$post_id][$i];
             $topic_id = $row['topic_id'];
             $post_id = $row['post_msg_id'];
             $this->ptemplate->assign_block_vars('postrow.attachment', array('DISPLAY_ATTACHMENT' => $attachment, 'EXTENSION_GROUP' => $extensions[$row['extension']]['group_name'], 'U_VIEWTOPIC' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "t={$topic_id}&p={$post_id}") . '#p' . $post_id));
         }
     }
 }
开发者ID:3D-I,项目名称:phpBB-ext-sitemaker,代码行数:22,代码来源:attachments.php

示例2: topic_review

/**
* Topic Review
*/
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
    global $user, $auth, $db, $template, $cache;
    global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
    /* @var $phpbb_content_visibility \phpbb\content_visibility */
    $phpbb_content_visibility = $phpbb_container->get('content.visibility');
    $sql_sort = $mode == 'post_review' ? 'ASC' : 'DESC';
    // Go ahead and pull all data for this topic
    $sql = 'SELECT p.post_id
		FROM ' . POSTS_TABLE . ' p' . "\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '
			' . ($mode == 'post_review' ? " AND p.post_id > {$cur_post_id}" : '') . '
			' . ($mode == 'post_review_edit' ? " AND p.post_id = {$cur_post_id}" : '') . '
		ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort;
    $result = $db->sql_query_limit($sql, $config['posts_per_page']);
    $post_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $post_list[] = $row['post_id'];
    }
    $db->sql_freeresult($result);
    if (!sizeof($post_list)) {
        return false;
    }
    // Handle 'post_review_edit' like 'post_review' from now on
    if ($mode == 'post_review_edit') {
        $mode = 'post_review';
    }
    $sql_ary = array('SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array(USERS_TABLE => 'u', POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id')), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
			AND u.user_id = p.poster_id');
    $sql = $db->sql_build_query('SELECT', $sql_ary);
    $result = $db->sql_query($sql);
    $rowset = array();
    $has_attachments = false;
    while ($row = $db->sql_fetchrow($result)) {
        $rowset[$row['post_id']] = $row;
        if ($row['post_attachment']) {
            $has_attachments = true;
        }
    }
    $db->sql_freeresult($result);
    // Grab extensions
    $extensions = $attachments = array();
    if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) {
        $extensions = $cache->obtain_attach_extensions($forum_id);
        // Get attachments...
        $sql = 'SELECT *
			FROM ' . ATTACHMENTS_TABLE . '
			WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
				AND in_message = 0
			ORDER BY filetime DESC, post_msg_id ASC';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $attachments[$row['post_msg_id']][] = $row;
        }
        $db->sql_freeresult($result);
    }
    for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) {
        // A non-existing rowset only happens if there was no user present for the entered poster_id
        // This could be a broken posts table.
        if (!isset($rowset[$post_list[$i]])) {
            continue;
        }
        $row = $rowset[$post_list[$i]];
        $poster_id = $row['user_id'];
        $post_subject = $row['post_subject'];
        $decoded_message = false;
        if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) {
            $decoded_message = censor_text($row['post_text']);
            decode_message($decoded_message, $row['bbcode_uid']);
            $decoded_message = bbcode_nl2br($decoded_message);
        }
        $parse_flags = $row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0;
        $parse_flags |= $row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
        $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
        if (!empty($attachments[$row['post_id']])) {
            $update_count = array();
            parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
        }
        $post_subject = censor_text($post_subject);
        $post_anchor = $mode == 'post_review' ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
        $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f={$forum_id}&amp;t={$topic_id}&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
        $post_row = array('POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]) ? true : false, 'S_FRIEND' => $row['friend'] ? true : false, 'S_IGNORE_POST' => $row['foe'] ? true : false, 'L_IGNORE_POST' => $row['foe'] ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"phpbb.toggleDisplay('{$post_anchor}', 1); return false;\">", '</a>') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], 'POST_TIME' => $row['post_time'], 'USER_ID' => $row['user_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_MCP_DETAILS' => $auth->acl_get('m_info', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=main&amp;mode=post_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '', 'POSTER_QUOTE' => $show_quote_button && $auth->acl_get('f_reply', $forum_id) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '');
        $current_row_number = $i;
        /**
         * Event to modify the template data block for topic reviews
         *
         * @event core.topic_review_modify_row
         * @var	string	mode				The review mode
         * @var	int		topic_id			The topic that is being reviewed
         * @var	int		forum_id			The topic's forum
         * @var	int		cur_post_id			Post offset id
         * @var	int		current_row_number	Number of the current row being iterated
         * @var	array	post_row			Template block array of the current post
         * @var	array	row					Array with original post and user data
         * @since 3.1.4-RC1
         */
        $vars = array('mode', 'topic_id', 'forum_id', 'cur_post_id', 'current_row_number', 'post_row', 'row');
        extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars)));
//.........这里部分代码省略.........
开发者ID:prototech,项目名称:phpbb,代码行数:101,代码来源:functions_posting.php

示例3: unset

            $parse_poll->message = $poll_option;
            $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']);
            $preview_poll_options[] = $parse_poll->message;
        }
        unset($parse_poll);
        foreach ($preview_poll_options as $key => $option) {
            $template->assign_block_vars('poll_option', array('POLL_OPTION_CAPTION' => $option, 'POLL_OPTION_ID' => $key + 1));
        }
        unset($preview_poll_options);
    }
    // Attachment Preview
    if (sizeof($message_parser->attachment_data)) {
        $template->assign_var('S_HAS_ATTACHMENTS', true);
        $update_count = array();
        $attachment_data = $message_parser->attachment_data;
        parse_attachments($forum_id, $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);
    }
    if (!sizeof($error)) {
        $template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
    }
}
// Decode text for message display
$post_data['bbcode_uid'] = $mode == 'quote' && !$preview && !$refresh && !sizeof($error) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);
if ($mode == 'quote' && !$submit && !$preview && !$refresh) {
    if ($config['allow_bbcode']) {
        $message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
开发者ID:PetsFundation,项目名称:Pets,代码行数:31,代码来源:posting.php

示例4: mcp_post_details

/**
* Handling actions in post details screen
*/
function mcp_post_details($id, $mode, $action)
{
    global $phpEx, $phpbb_root_path, $config;
    global $template, $db, $user, $auth, $cache;
    $user->add_lang('posting');
    $post_id = request_var('p', 0);
    $start = request_var('start', 0);
    // Get post data
    $post_info = get_post_data(array($post_id), false, true);
    add_form_key('mcp_post_details');
    if (!sizeof($post_info)) {
        trigger_error('POST_NOT_EXIST');
    }
    $post_info = $post_info[$post_id];
    $url = append_sid("{$phpbb_root_path}mcp.{$phpEx}?" . extra_url());
    switch ($action) {
        case 'whois':
            if ($auth->acl_get('m_info', $post_info['forum_id'])) {
                $ip = request_var('ip', '');
                include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
                $template->assign_vars(array('RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;mode={$mode}&amp;p={$post_id}") . '">', '</a>'), 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;mode={$mode}&amp;p={$post_id}"), 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), 'WHOIS' => user_ipwhois($ip)));
            }
            // We're done with the whois page so return
            return;
            break;
        case 'chgposter':
        case 'chgposter_ip':
            if ($action == 'chgposter') {
                $username = request_var('username', '', true);
                $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            } else {
                $new_user_id = request_var('u', 0);
                $sql_where = 'user_id = ' . $new_user_id;
            }
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . '
				WHERE ' . $sql_where;
            $result = $db->sql_query($sql);
            $row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$row) {
                trigger_error('NO_USER');
            }
            if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) {
                if (check_form_key('mcp_post_details')) {
                    change_poster($post_info, $row);
                } else {
                    trigger_error('FORM_INVALID');
                }
            }
            break;
    }
    // Set some vars
    $users_ary = $usernames_ary = array();
    $attachments = $extensions = array();
    $post_id = $post_info['post_id'];
    $topic_tracking_info = array();
    // Get topic tracking info
    if ($config['load_db_lastread']) {
        $tmp_topic_data = array($post_info['topic_id'] => $post_info);
        $topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
        unset($tmp_topic_data);
    } else {
        $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
    }
    $post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
    // Process message, leave it uncensored
    $message = $post_info['post_text'];
    if ($post_info['bbcode_bitfield']) {
        include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        $bbcode = new bbcode($post_info['bbcode_bitfield']);
        $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
    }
    $message = bbcode_nl2br($message);
    $message = smiley_text($message);
    if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
        $extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
        $sql = 'SELECT *
			FROM ' . ATTACHMENTS_TABLE . '
			WHERE post_msg_id = ' . $post_id . '
				AND in_message = 0
			ORDER BY filetime DESC, post_msg_id ASC';
        $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($post_info['forum_id'], $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));
            }
//.........这里部分代码省略.........
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:mcp_post.php

示例5: phpbb_fetch_news


//.........这里部分代码省略.........
                    $sql2 = 'SELECT *
					   FROM ' . ATTACHMENTS_TABLE . '
					   WHERE post_msg_id = ' . $row['post_id'] . '
					   AND in_message = 0
					   ORDER BY filetime DESC';
                    $result2 = $db->sql_query($sql2);
                    while ($row2 = $db->sql_fetchrow($result2)) {
                        $attachments[] = $row2;
                    }
                    $db->sql_freeresult($result2);
                }
                if ($row['user_id'] != ANONYMOUS && $row['user_colour']) {
                    $row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b> ';
                }
                $posts[$i]['bbcode_uid'] = $row['bbcode_uid'];
                $len_check = $row['post_text'];
                if ($text_length != 0 && utf8_strlen($len_check) > $text_length) {
                    $message = utf8_substr($len_check, 0, $text_length);
                    $message = str_replace("\n", '<br/> ', $message);
                    $message .= ' ...';
                    $posts[$i]['striped'] = true;
                } else {
                    $message = censor_text(str_replace("\n", '<br/> ', $row['post_text']));
                }
                if ($auth->acl_get('f_html', $row['forum_id'])) {
                    $message = preg_replace('#<!\\-\\-(.*?)\\-\\->#is', '', $message);
                    // Remove Comments from post content
                }
                // Second parse bbcode here
                if ($row['bbcode_bitfield']) {
                    $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
                }
                if (!empty($attachments)) {
                    parse_attachments($row['forum_id'], $message, $attachments, $update_count);
                }
                if ($portal_config['portal_acronyms_allow'] = 1) {
                    $phpEx = substr(strrchr(__FILE__, '.'), 1);
                    include_once $phpbb_root_path . 'portal/includes/functions_acronym.' . $phpEx;
                    $message = acronym_pass($message);
                }
                // dgTopic Thumb MOD - Added -->
                if ($row['topic_attachment']) {
                    $sql2 = 'SELECT topic_first_post_id 
			FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $row['topic_id'];
                    $dgresult_one_check_postid = $db->sql_query_limit($sql2, 1);
                    $dgrow_one_check_postid = (int) $db->sql_fetchfield('topic_first_post_id');
                    $db->sql_freeresult($dgresult_one_check_postid);
                    $sql2 = 'SELECT post_attachment 
			FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $dgrow_one_check_postid;
                    $dgresult_one_postid_confirmed = $db->sql_query_limit($sql2, 1);
                    $dgrow_one_postid_confirmed = (int) $db->sql_fetchfield('post_attachment');
                    $db->sql_freeresult($dgresult_one_postid_confirmed);
                    $sql2 = 'SELECT post_attachment 
			FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $dgrow_one_check_postid;
                    $dgresult_one = $db->sql_query_limit($sql2, 1);
                    $dgrow_one = (int) $db->sql_fetchfield('post_attachment');
                    $db->sql_freeresult($dgresult_one);
                    $sql2 = 'SELECT forum_topics_thumb_choice
			FROM ' . FORUMS_TABLE . ' WHERE forum_id =' . $row['forum_id'];
                    $result2 = $db->sql_query_limit($sql2, 1);
                    $rowchoice = (int) $db->sql_fetchfield('forum_topics_thumb_choice');
                    $topic_thumb_choice = $rowchoice;
                    $db->sql_freeresult($result2);
                    if ($dgrow_one == 1 && $topic_thumb_choice == 1) {
                        $dgrow_one = 1;
                    } else {
开发者ID:velocat,项目名称:phpbb3,代码行数:67,代码来源:functions.php

示例6: reply_post_func


//.........这里部分代码省略.........
        $db->sql_freeresult($result);
    }
    // HTML, BBCode, Smilies, Images and Flash status
    $bbcode_status = $config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id) ? true : false;
    $smilies_status = $bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id) ? true : false;
    $img_status = $bbcode_status && $auth->acl_get('f_img', $forum_id) ? true : false;
    $url_status = $config['allow_post_links'] ? true : false;
    $flash_status = $bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash'] ? true : false;
    $quote_status = $auth->acl_get('f_reply', $forum_id) ? true : false;
    $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);
    $post_data['post_subject'] = utf8_normalize_nfc($subject);
    $message_parser->message = utf8_normalize_nfc(htmlspecialchars($text_body));
    $post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
    $post_data['post_edit_reason'] = '';
    $post_data['orig_topic_type'] = $post_data['topic_type'];
    $post_data['topic_type'] = request_var('topic_type', (int) $post_data['topic_type']);
    $post_data['topic_time_limit'] = request_var('topic_time_limit', (int) $post_data['topic_time_limit']);
    $post_data['icon_id'] = request_var('icon', 0);
    $post_data['enable_bbcode'] = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
    $post_data['enable_smilies'] = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
    $post_data['enable_urls'] = isset($_POST['disable_magic_url']) ? 0 : 1;
    $post_data['enable_sig'] = !$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig') ? false : ($user->data['is_registered'] ? true : false);
    if ($config['allow_topic_notify'] && $user->data['is_registered']) {
        $notify = !$post_data['notify_set'] ? $user->data['user_notify'] : $post_data['notify_set'] ? true : false;
    } else {
        $notify = false;
    }
    $post_data['poll_title'] = utf8_normalize_nfc(request_var('poll_title', '', true));
    $post_data['poll_length'] = request_var('poll_length', 0);
    $post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true));
    $post_data['poll_max_options'] = request_var('poll_max_options', 1);
    $post_data['poll_vote_change'] = $auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change']) ? 1 : 0;
    // Parse Attachments - before checksum is calculated
    $message_parser->parse_attachments('fileupload', 'reply', $forum_id, true, false, false);
    // Grab md5 'checksum' of new message
    $message_md5 = md5($message_parser->message);
    // Check checksum ... don't re-parse message if the same
    if (sizeof($message_parser->warn_msg)) {
        trigger_error(join("\n", $message_parser->warn_msg));
    }
    $message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
    if ($config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id)) {
        // Flood check
        $last_post_time = 0;
        if ($user->data['is_registered']) {
            $last_post_time = $user->data['user_lastpost_time'];
        } else {
            $sql = 'SELECT post_time AS last_post_time
                FROM ' . POSTS_TABLE . "\n                WHERE poster_ip = '" . $user->ip . "'\n                    AND post_time > " . ($current_time - $config['flood_interval']);
            $result = $db->sql_query_limit($sql, 1);
            if ($row = $db->sql_fetchrow($result)) {
                $last_post_time = $row['last_post_time'];
            }
            $db->sql_freeresult($result);
        }
        if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
            trigger_error('FLOOD_ERROR');
        }
    }
    // Validate username
    if ($post_data['username'] && !$user->data['is_registered']) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        if (($result = validate_username($post_data['username'], !empty($post_data['post_username']) ? $post_data['post_username'] : '')) !== false) {
            $user->add_lang('ucp');
            trigger_error($result . '_USERNAME');
        }
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:67,代码来源:reply_post.php

示例7: delete_re

 /**
  * Delete Re:, lock post subject
  * Ctrl+Enter submit - template variables in the full editor
  * Ajax submit - error messages and preview
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function delete_re($event)
 {
     $forum_id = $event['forum_id'];
     $page_data = $event['page_data'];
     $post_data = $event['post_data'];
     // Delete Re:
     if ($this->config['qr_enable_re'] == 0) {
         $page_data['SUBJECT'] = preg_replace('/^Re: /', '', $page_data['SUBJECT']);
     }
     // Whether the user can change post subject or not
     if (!$this->auth->acl_get('f_qr_change_subject', $forum_id) && $event['mode'] != 'post' && $post_data['topic_first_post_id'] != $event['post_id']) {
         $this->template->assign_var('S_QR_NOT_CHANGE_SUBJECT', true);
     }
     // Ctrl+Enter submit
     $page_data = array_merge($page_data, array('S_QR_CE_ENABLE' => $this->config['qr_ctrlenter']));
     $event['page_data'] = $page_data;
     //Ajax submit
     if ($this->config['qr_ajax_submit'] && $this->request->is_ajax() && $this->request->is_set_post('qr')) {
         include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
         $error = $event['error'];
         $preview = $event['preview'];
         $post_data = $event['post_data'];
         $forum_id = (int) $post_data['forum_id'];
         $message_parser = $event['message_parser'];
         if (sizeof($error)) {
             $error_text = implode('<br />', $error);
             $url_next_post = '';
         }
         // Preview
         if (!sizeof($error) && $preview) {
             $message_parser->message = $this->request->variable('message', '', true);
             $preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false);
             $preview_attachments = false;
             // Attachment Preview
             if (sizeof($message_parser->attachment_data)) {
                 $preview_attachments = '<dl class="attachbox"><dt>' . $this->user->lang['ATTACHMENTS'] . '</dt>';
                 //$this->template->assign_var('S_HAS_ATTACHMENTS', true);
                 $update_count = array();
                 $attachment_data = $message_parser->attachment_data;
                 parse_attachments($forum_id, $preview_message, $attachment_data, $update_count, true);
                 foreach ($attachment_data as $i => $attachment) {
                     //$this->template->assign_block_vars('attachment', array(
                     //	'DISPLAY_ATTACHMENT'	=> $attachment)
                     //);
                     $preview_attachments .= '<dd>' . $attachment . '</dd>';
                 }
                 $preview_attachments .= '</dl>';
                 unset($attachment_data);
             }
             $error_text = $preview_message;
         }
         if (isset($error_text)) {
             $json_response = new \phpbb\json_response();
             if (!sizeof($error) && $preview) {
                 $json_response->send(array('preview' => true, 'PREVIEW_TITLE' => $this->user->lang['PREVIEW'], 'PREVIEW_TEXT' => $preview_message, 'PREVIEW_ATTACH' => $preview_attachments));
             } else {
                 $json_response->send(array('error' => true, 'MESSAGE_TITLE' => $this->user->lang['INFORMATION'], 'MESSAGE_TEXT' => $error_text, 'NEXT_URL' => isset($url_next_post) ? $url_next_post : ''));
             }
         }
     }
 }
开发者ID:edipdincer,项目名称:QuickReply,代码行数:70,代码来源:listener.php

示例8: generate_content

 /**
  * Generate text content
  *
  * @param string $content is feed text content
  * @param string $uid is bbcode_uid
  * @param string $bitfield is bbcode bitfield
  * @param int $options bbcode flag options
  * @param int $forum_id is the forum id
  * @param array $post_attachments is an array containing the attachments and their respective info
  * @return string the html content to be printed for the feed
  */
 public function generate_content($content, $uid, $bitfield, $options, $forum_id, $post_attachments)
 {
     if (empty($content)) {
         return '';
     }
     // Prepare some bbcodes for better parsing
     $content = preg_replace("#\\[quote(=&quot;.*?&quot;)?:{$uid}\\]\\s*(.*?)\\s*\\[/quote:{$uid}\\]#si", "[quote\$1:{$uid}]<br />\$2<br />[/quote:{$uid}]", $content);
     $content = generate_text_for_display($content, $uid, $bitfield, $options);
     // Add newlines
     $content = str_replace('<br />', '<br />' . "\n", $content);
     // Convert smiley Relative paths to Absolute path, Windows style
     $content = str_replace($this->phpbb_root_path . $this->config['smilies_path'], $this->get_board_url() . '/' . $this->config['smilies_path'], $content);
     // Remove "Select all" link and mouse events
     $content = str_replace('<a href="#" onclick="selectCode(this); return false;">' . $this->user->lang['SELECT_ALL_CODE'] . '</a>', '', $content);
     $content = preg_replace('#(onkeypress|onclick)="(.*?)"#si', '', $content);
     // Firefox does not support CSS for feeds, though
     // Remove font sizes
     //	$content = preg_replace('#<span style="font-size: [0-9]+%; line-height: [0-9]+%;">([^>]+)</span>#iU', '\1', $content);
     // Make text strong :P
     //	$content = preg_replace('#<span style="font-weight: bold?">(.*?)</span>#iU', '<strong>\1</strong>', $content);
     // Italic
     //	$content = preg_replace('#<span style="font-style: italic?">([^<]+)</span>#iU', '<em>\1</em>', $content);
     // Underline
     //	$content = preg_replace('#<span style="text-decoration: underline?">([^<]+)</span>#iU', '<u>\1</u>', $content);
     // Remove embed Windows Media Streams
     $content = preg_replace('#<\\!--\\[if \\!IE\\]>-->([^[]+)<\\!--<!\\[endif\\]-->#si', '', $content);
     // Do not use &lt; and &gt;, because we want to retain code contained in [code][/code]
     // Remove embed and objects
     $content = preg_replace('#<(object|embed)(.*?) (value|src)=(.*?) ([^[]+)(object|embed)>#si', ' <a href=$4 target="_blank"><strong>$1</strong></a> ', $content);
     // Remove some specials html tag, because somewhere there are a mod to allow html tags ;)
     $content = preg_replace('#<(script|iframe)([^[]+)\\1>#siU', ' <strong>$1</strong> ', $content);
     // Parse inline images to display with the feed
     if (!empty($post_attachments)) {
         $update_count = array();
         parse_attachments($forum_id, $content, $post_attachments, $update_count);
         $content .= implode('<br />', $post_attachments);
         // Convert attachments' relative path to absolute path
         $content = str_replace($this->phpbb_root_path . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $content);
     }
     // Remove Comments from inline attachments [ia]
     $content = preg_replace('#<dd>(.*?)</dd>#', '', $content);
     // Replace some entities with their unicode counterpart
     $entities = array('&nbsp;' => " ", '&bull;' => "•", '&middot;' => "·", '&copy;' => "©");
     $content = str_replace(array_keys($entities), array_values($entities), $content);
     // Remove CDATA blocks. ;)
     $content = preg_replace('#\\<\\!\\[CDATA\\[(.*?)\\]\\]\\>#s', '', $content);
     // Other control characters
     $content = preg_replace('#(?:[\\x00-\\x1F\\x7F]+|(?:\\xC2[\\x80-\\x9F])+)#', '', $content);
     return $content;
 }
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:61,代码来源:helper.php

示例9: while

        if ($config['allow_attachments'] && $row['post_id']) {
            // Pull attachment data
            $sql = 'SELECT *
				FROM ' . ATTACHMENTS_TABLE . '
				WHERE post_msg_id = ' . $row['post_id'] . '
				AND in_message = 0
				ORDER BY filetime DESC';
            $result3 = $db->sql_query($sql);
            while ($row3 = $db->sql_fetchrow($result3)) {
                $attachments[] = $row3;
            }
            $db->sql_freeresult($result3);
        }
        $img = !empty($attachments) && $config['allow_attachments'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '';
        if (!empty($attachments)) {
            parse_attachments($forum_id, $message, $attachments, $update_count);
        }
        // check config if we want edits to show in portal
        if ($config['bbdkp_portal_showedits']) {
            // reinitialise var for next loop
            $edit_reason = '';
            // build the 'user edited' comment
            if ($row['post_edit_count'] && $config['display_last_edited'] || $row['post_edit_reason']) {
                // Get username that edited post, if it has been edited
                if ($row['post_edit_reason'] or $row['post_edit_user']) {
                    $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour
						FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
						WHERE p.post_id = ' . $row['post_id'] . '
							AND p.post_edit_count <> 0
							AND p.post_edit_user <> 0
							AND p.post_edit_user = u.user_id';
开发者ID:ZerGabriel,项目名称:bbDKP,代码行数:31,代码来源:newsblock.php

示例10: file

    public function file($attach_id)
    {
        $this->user->setup('viewtopic');
        $sql_attach = 'SELECT a.*, u.username, u.user_colour, p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid
			FROM ' . ATTACHMENTS_TABLE . ' a, ' . USERS_TABLE . ' u, ' . POSTS_TABLE . " p\n\t\t\tWHERE a.attach_id = " . (int) $attach_id . "\n\t\t\t\tAND p.post_id = a.post_msg_id\n\t\t\t\tAND a.poster_id = u.user_id\n\t\t\t\tAND a.is_orphan = 0";
        $result = $this->db->sql_query($sql_attach);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // Start auth check
        if (!$this->auth->acl_get('u_download') || !$this->auth->acl_get('f_read', $row['forum_id'])) {
            trigger_error('LINKAGE_FORBIDDEN');
        }
        $attachments = $update_count = array();
        $sql_attach = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "\n\t\t\tWHERE post_msg_id = " . (int) $row['post_id'] . "\n\t\t\t\tAND is_orphan = 0";
        $result_attach = $this->db->sql_query($sql_attach);
        while ($attach_row = $this->db->sql_fetchrow($result_attach)) {
            $attachments[] = $attach_row;
        }
        $this->db->sql_freeresult($result_attach);
        // Parse the message and subject
        $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
        $message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
        // Parse attachments
        parse_attachments($row['forum_id'], $message, $attachments, $update_count);
        // Replace naughty words such as farty pants
        $row['post_subject'] = censor_text($row['post_subject']);
        $view_post = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "t={$row['topic_id']}&amp;p={$row['post_id']}") . "#p{$row['post_id']}";
        $this->template->assign_vars(array('POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']), 'POST_DATE' => $this->user->format_date($row['filetime'], false, false), 'POST_TITLE' => $row['post_subject'], 'DESCRIPTION' => $row['post_subject'], 'MESSAGE' => $message, 'U_VIEW_POST' => $view_post, 'U_ATTACHMENTS_TOPIC' => $this->helper->route("bb3mobi_attach_cat", array('t' => $row['topic_id'])), 'ATTACHMENTS_BY' => $this->user->lang('ATTACHMENTS_BY', '<a href="http://bb3.mobi/forum/viewtopic.php?t=226">Download by</a>'), 'S_HAS_ATTACHMENTS' => !empty($attachments) ? true : false));
        foreach ($attachments as $attachment) {
            $this->template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
        }
        return $row['real_filename'];
    }
开发者ID:bb3mobi,项目名称:attachments,代码行数:33,代码来源:route.php

示例11: extract_eml

function extract_eml($path)
{
    global $email, $atmail, $auth;
    $email2 = new ReadMsg(array('Username' => $atmail->username, 'Pop3host' => $atmail->pop3host, 'Password' => $auth->password, 'Type' => $atmail->MailType, 'Mode' => $atmail->Mode, 'SessionID' => $auth->SessionID, 'Language' => $atmail->Language, 'DateFormat' => $atmail->DateFormat, 'TimeFormat' => $atmail->TimeFormat, 'LoginType' => $type, 'head' => 1, 'rawemail' => $var['rawemail']));
    $email2->reademail('', '', '', '', $path);
    if ($email2->html) {
        $type = 'html';
    } elseif ($email2->txt) {
        $type = 'txt';
    } elseif ($email2->multiparttxt) {
        $type = 'multiparttxt';
    } else {
        $type = 'html';
    }
    $myvars = array('subject' => $email2->subject, 'from' => htmlentities($email2->from), 'to' => htmlentities($email2->to), 'date' => $email2->date, 'body' => $email2->{$type});
    $fwdmsg = $atmail->parse("html/{$atmail->Language}/fwdmsg.html", $myvars);
    if ($email->html) {
        $email->html .= $fwdmsg;
    } elseif ($email->txt) {
        $email->txt .= $fwdmsg;
    } else {
        $email->html .= $fwdmsg;
    }
    unset($fwdmsg);
    parse_attachments($email2);
    foreach ($email2->attachedemails as $path2) {
        extract_eml($path2);
    }
}
开发者ID:huluwa,项目名称:zz_atmailopen,代码行数:29,代码来源:reademail.php

示例12: compose_pm


//.........这里部分代码省略.........
	// Load Drafts
	if ($load && $drafts)
	{
		load_drafts(0, 0, $id);
	}

	if ($submit || $preview || $refresh)
	{
		if (!check_form_key('ucp_pm_compose'))
		{
			$error[] = $user->lang['FORM_INVALID'];
		}
		$subject = utf8_normalize_nfc(request_var('subject', '', true));
		$message_parser->message = utf8_normalize_nfc(request_var('message', '', true));

		$icon_id			= request_var('icon', 0);

		$enable_bbcode 		= (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;
		$enable_smilies		= (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true;
		$enable_urls 		= (isset($_POST['disable_magic_url'])) ? 0 : 1;
		$enable_sig			= (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false);

		if ($submit)
		{
			$status_switch	= (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
			$status_switch = ($status_switch != $check_value);
		}
		else
		{
			$status_switch = 1;
		}

		// Parse Attachments - before checksum is calculated
		$message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);

		if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc))
		{
			$error[] = implode('<br />', $message_parser->warn_msg);
			$message_parser->warn_msg = array();
		}

		// Parse message
		$message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);

		// On a refresh we do not care about message parsing errors
		if (sizeof($message_parser->warn_msg) && !$refresh)
		{
			$error[] = implode('<br />', $message_parser->warn_msg);
		}

		if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood'))
		{
			// Flood check
			$last_post_time = $user->data['user_lastpost_time'];

			if ($last_post_time)
			{
				if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval']))
				{
					$error[] = $user->lang['FLOOD_ERROR'];
				}
			}
		}

		// Subject defined
		if ($submit)
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:ucp_pm_compose.php

示例13: fill_posts_array

 /**
  * Fill posts array with data
  *
  * @param array $row Database row
  * @param int $text_length Text length
  * @param int $i Array pointer
  * @param int $have_icons Whether any post has icons
  * @param array $posts The posts array
  * @param array $topic_icons List of topic icons
  */
 public function fill_posts_array($row, $text_length, $i, &$have_icons, &$posts, &$topic_icons)
 {
     $update_count = array();
     // Get attachments
     $attachments = $this->get_post_attachments($row);
     $posts[$i]['bbcode_uid'] = $row['bbcode_uid'];
     // Format message
     $message = $this->format_message($row, $text_length, $posts[$i]['striped']);
     $row['bbcode_options'] = $this->get_setting_based_data($row['enable_bbcode'], OPTION_FLAG_BBCODE, 0) + $this->get_setting_based_data($row['enable_smilies'], OPTION_FLAG_SMILIES, 0) + $this->get_setting_based_data($row['enable_magic_url'], OPTION_FLAG_LINKS, 0);
     $message = generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
     if (!empty($attachments)) {
         parse_attachments($row['forum_id'], $message, $attachments, $update_count);
     }
     // Get proper global ID
     $this->global_id = $this->get_setting_based_data($this->global_id, $this->global_id, $row['forum_id']);
     $topic_icons[] = $row['enable_icons'];
     $have_icons = $this->get_setting_based_data($row['icon_id'], 1, $have_icons);
     $posts[$i] = array_merge($posts[$i], array('post_text' => ap_validate($message), 'topic_id' => $row['topic_id'], 'topic_last_post_id' => $row['topic_last_post_id'], 'topic_type' => $row['topic_type'], 'topic_posted' => $this->get_setting_based_data(isset($row['topic_posted']) && $row['topic_posted'], true, false), 'icon_id' => $row['icon_id'], 'topic_status' => $row['topic_status'], 'forum_id' => $row['forum_id'], 'topic_replies' => $row['topic_posts_approved'] + $row['topic_posts_unapproved'] + $row['topic_posts_softdeleted'] - 1, 'topic_replies_real' => $row['topic_posts_approved'] - 1, 'topic_time' => $this->user->format_date($row['post_time']), 'topic_last_post_time' => $row['topic_last_post_time'], 'topic_title' => $row['topic_title'], 'username' => $row['username'], 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']), 'username_full_last' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour'], $row['topic_last_poster_name']), 'user_id' => $row['user_id'], 'user_type' => $row['user_type'], 'user_colour' => $row['user_colour'], 'poll' => $this->get_setting_based_data($row['poll_title'], true, false), 'attachment' => $this->get_setting_based_data($row['topic_attachment'], true, false), 'topic_views' => $row['topic_views'], 'forum_name' => $row['forum_name'], 'attachments' => $this->get_setting_based_data($attachments, $attachments, array())));
     $posts['global_id'] = $this->global_id;
 }
开发者ID:sgtevmckay,项目名称:Board3-Portal,代码行数:30,代码来源:fetch_posts.php

示例14: topic_review

/**
* Topic Review
*/
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
    global $user, $auth, $db, $template, $bbcode, $cache;
    global $config, $phpbb_root_path, $phpEx;
    // Go ahead and pull all data for this topic
    $sql = 'SELECT p.post_id
		FROM ' . POSTS_TABLE . ' p' . "\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t" . (!$auth->acl_get('m_approve', $forum_id) ? 'AND p.post_approved = 1' : '') . '
			' . ($mode == 'post_review' ? " AND p.post_id > {$cur_post_id}" : '') . '
			' . ($mode == 'post_review_edit' ? " AND p.post_id = {$cur_post_id}" : '') . '
		ORDER BY p.post_time ';
    $sql .= $mode == 'post_review' ? 'ASC' : 'DESC';
    $result = $db->sql_query_limit($sql, $config['posts_per_page']);
    $post_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $post_list[] = $row['post_id'];
    }
    $db->sql_freeresult($result);
    if (!sizeof($post_list)) {
        return false;
    }
    // Handle 'post_review_edit' like 'post_review' from now on
    if ($mode == 'post_review_edit') {
        $mode = 'post_review';
    }
    $sql = $db->sql_build_query('SELECT', array('SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array(USERS_TABLE => 'u', POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id')), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
			AND u.user_id = p.poster_id'));
    $result = $db->sql_query($sql);
    $bbcode_bitfield = '';
    $rowset = array();
    $has_attachments = false;
    while ($row = $db->sql_fetchrow($result)) {
        $rowset[$row['post_id']] = $row;
        $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
        if ($row['post_attachment']) {
            $has_attachments = true;
        }
    }
    $db->sql_freeresult($result);
    // Instantiate BBCode class
    if (!isset($bbcode) && $bbcode_bitfield !== '') {
        include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        $bbcode = new bbcode(base64_encode($bbcode_bitfield));
    }
    // Grab extensions
    $extensions = $attachments = array();
    if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) {
        $extensions = $cache->obtain_attach_extensions($forum_id);
        // Get attachments...
        $sql = 'SELECT *
			FROM ' . ATTACHMENTS_TABLE . '
			WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
				AND in_message = 0
			ORDER BY filetime DESC, post_msg_id ASC';
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $attachments[$row['post_msg_id']][] = $row;
        }
        $db->sql_freeresult($result);
    }
    for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) {
        // A non-existing rowset only happens if there was no user present for the entered poster_id
        // This could be a broken posts table.
        if (!isset($rowset[$post_list[$i]])) {
            continue;
        }
        $row =& $rowset[$post_list[$i]];
        $poster_id = $row['user_id'];
        $post_subject = $row['post_subject'];
        $message = censor_text($row['post_text']);
        $decoded_message = false;
        if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) {
            $decoded_message = $message;
            decode_message($decoded_message, $row['bbcode_uid']);
            $decoded_message = bbcode_nl2br($decoded_message);
        }
        if ($row['bbcode_bitfield']) {
            $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
        }
        $message = bbcode_nl2br($message);
        $message = smiley_text($message, !$row['enable_smilies']);
        if (!empty($attachments[$row['post_id']])) {
            $update_count = array();
            parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
        }
        $post_subject = censor_text($post_subject);
        $post_anchor = $mode == 'post_review' ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
        $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f={$forum_id}&amp;t={$topic_id}&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}");
        $template->assign_block_vars($mode . '_row', array('POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]) ? true : false, 'S_FRIEND' => $row['friend'] ? true : false, 'S_IGNORE_POST' => $row['foe'] ? true : false, 'L_IGNORE_POST' => $row['foe'] ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"dE('{$post_anchor}', 1); return false;\">", '</a>') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_MCP_DETAILS' => $auth->acl_get('m_info', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=main&amp;mode=post_details&amp;f=' . $forum_id . '&amp;p=' . $row['post_id'], true, $user->session_id) : '', 'POSTER_QUOTE' => $show_quote_button && $auth->acl_get('f_reply', $forum_id) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : ''));
        // Display not already displayed Attachments for this post, we already parsed them. ;)
        if (!empty($attachments[$row['post_id']])) {
            foreach ($attachments[$row['post_id']] as $attachment) {
                $template->assign_block_vars($mode . '_row.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
            }
        }
        unset($rowset[$post_list[$i]]);
    }
    if ($mode == 'topic_review') {
//.........这里部分代码省略.........
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:101,代码来源:functions_posting.php

示例15: save_raw_post_func


//.........这里部分代码省略.........
    $flash_status = $bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash'] ? true : false;
    $quote_status = $auth->acl_get('f_reply', $forum_id) ? true : false;
    $solved_captcha = false;
    $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);
    $post_data['post_subject'] = utf8_normalize_nfc($post_title);
    $message_parser->message = utf8_normalize_nfc(htmlspecialchars($post_content));
    $post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
    $post_data['post_edit_reason'] = !empty($_POST['edit_reason']) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';
    $post_data['orig_topic_type'] = $post_data['topic_type'];
    $post_data['topic_type'] = request_var('topic_type', $mode != 'post' ? (int) $post_data['topic_type'] : POST_NORMAL);
    $post_data['topic_time_limit'] = request_var('topic_time_limit', $mode != 'post' ? (int) $post_data['topic_time_limit'] : 0);
    $post_data['icon_id'] = request_var('icon', 0);
    $post_data['enable_bbcode'] = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
    $post_data['enable_smilies'] = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
    $post_data['enable_urls'] = isset($_POST['disable_magic_url']) ? 0 : 1;
    $post_data['enable_sig'] = !$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig') ? false : ($user->data['is_registered'] ? true : false);
    if ($config['allow_topic_notify'] && $user->data['is_registered']) {
        $notify = isset($_POST['notify']) ? true : false;
    } else {
        $notify = false;
    }
    $topic_lock = isset($_POST['lock_topic']) ? true : $post_data['topic_status'];
    $post_lock = isset($_POST['lock_post']) ? true : $post_data['post_edit_locked'];
    $poll_delete = isset($_POST['poll_delete']) ? true : false;
    $status_switch = ($post_data['enable_bbcode'] + 1 << 8) + ($post_data['enable_smilies'] + 1 << 4) + ($post_data['enable_urls'] + 1 << 2) + ($post_data['enable_sig'] + 1 << 1);
    $status_switch = $status_switch != $check_value;
    //$post_data['poll_title']        = utf8_normalize_nfc(request_var('poll_title', '', true));
    //$post_data['poll_length']        = request_var('poll_length', 0);
    //$post_data['poll_option_text']    = utf8_normalize_nfc(request_var('poll_option_text', '', true));
    $post_data['poll_option_text'] = implode("\n", $post_data['poll_options']);
    //$post_data['poll_max_options']    = request_var('poll_max_options', 1);
    //$post_data['poll_vote_change']    = ($auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
    // Parse Attachments - before checksum is calculated
    $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);
    // Grab md5 'checksum' of new message
    $message_md5 = md5($message_parser->message);
    // Check checksum ... don't re-parse message if the same
    $update_message = $mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN ? true : false;
    // Parse message
    if ($update_message) {
        if (sizeof($message_parser->warn_msg)) {
            trigger_error(join("\n", $message_parser->warn_msg));
        }
        $message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
    } else {
        $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
    }
    // Validate username
    if ($post_data['username'] && !$user->data['is_registered'] || $mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username']) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        if (($result = validate_username($post_data['username'], !empty($post_data['post_username']) ? $post_data['post_username'] : '')) !== false) {
            $user->add_lang('ucp');
            trigger_error($result . '_USERNAME');
        }
    }
    // Parse subject
    if (utf8_clean_string($post_data['post_subject']) === '' && $post_data['topic_first_post_id'] == $post_id) {
        trigger_error('EMPTY_SUBJECT');
    }
    $post_data['poll_last_vote'] = isset($post_data['poll_last_vote']) ? $post_data['poll_last_vote'] : 0;
    if ($post_data['poll_option_text'] && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id)) {
        $poll = array('poll_title' => $post_data['poll_title'], 'poll_length' => $post_data['poll_length'], 'poll_max_options' => $post_data['poll_max_options'], 'poll_option_text' => $post_data['poll_option_text'], 'poll_start' => $post_data['poll_start'], 'poll_last_vote' => $post_data['poll_last_vote'], 'poll_vote_change' => $post_data['poll_vote_change'], 'enable_bbcode' => $post_data['enable_bbcode'], 'enable_urls' => $post_data['enable_urls'], 'enable_smilies' => $post_data['enable_smilies'], 'img_status' => $img_status);
        $message_parser->parse_poll($poll);
        $post_data['poll_options'] = isset($poll['poll_options']) ? $poll['poll_options'] : '';
        $post_data['poll_title'] = isset($poll['poll_title']) ? $poll['poll_title'] : '';
    } else {
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:67,代码来源:save_raw_post.php


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