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


PHP bbcode_nl2br函数代码示例

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


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

示例1: main

    function main($id, $mode)
    {
        global $auth, $db, $user, $template, $cache;
        global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container, $phpbb_dispatcher;
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_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');
                }
                close_report($report_id_list, $mode, $action);
                break;
        }
        switch ($mode) {
            case 'report_details':
                $user->add_lang(array('posting', 'viewforum', 'viewtopic'));
                $post_id = request_var('p', 0);
                // closed reports are accessed by report id
                $report_id = request_var('r', 0);
                $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, 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 ' . ($report_id ? 'r.report_id = ' . $report_id : "r.post_id = {$post_id}") . '
						AND rr.reason_id = r.reason_id
						AND r.user_id = u.user_id
						AND r.pm_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) {
                    trigger_error('NO_REPORT');
                }
                $phpbb_notifications = $phpbb_container->get('notification_manager');
                $phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']);
                if (!$report_id && $report['report_closed']) {
                    trigger_error('REPORT_CLOSED');
                }
                $post_id = $report['post_id'];
                $report_id = $report['report_id'];
                $parse_post_flags = $report['reported_post_enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;
                $parse_post_flags += $report['reported_post_enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
                $parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0;
                $post_info = phpbb_get_post_data(array($post_id), 'm_report', true);
                if (!sizeof($post_info)) {
                    trigger_error('NO_REPORT_SELECTED');
                }
                $post_info = $post_info[$post_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'])];
                }
                if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], 'TOPIC_TITLE' => $post_info['topic_title'], 'REPORTED_POST_ID' => $post_id));
                }
                $topic_tracking_info = $extensions = $attachments = 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;
                $message = generate_text_for_display($report['reported_post_text'], $report['reported_post_uid'], $report['reported_post_bitfield'], $parse_post_flags, false);
                $report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
                if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
                    $sql = 'SELECT *
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE post_msg_id = ' . $post_id . '
							AND in_message = 0
							AND filetime <= ' . (int) $report['report_time'] . '
						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($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));
                        }
                    }
                }
                $template->assign_vars(array('S_MCP_REPORT' => true, 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE, 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_REPORT_CLOSED' => $report['report_closed'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_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=' . $post_info['user_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=' . $post_info['user_id']) : '', 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $post_info['forum_id']), 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports' . ($post_info['post_reported'] ? '&amp;mode=reports' : '&amp;mode=reports_closed') . '&amp;start=' . $start . '&amp;f=' . $post_info['forum_id']) . '">', '</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', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), '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' => $post_info['post_subject'] ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : ''));
                $this->tpl_name = 'mcp_post';
                break;
//.........这里部分代码省略.........
开发者ID:Voxel37,项目名称:phpbb,代码行数:101,代码来源:mcp_reports.php

示例2: get_profile_value

	/**
	* Get Profile Value for display
	*/
	function get_profile_value($ident_ary)
	{
		$value = $ident_ary['value'];
		$field_type = $ident_ary['data']['field_type'];

		switch ($this->profile_types[$field_type])
		{
			case 'int':
				if ($value === '' && !$ident_ary['data']['field_show_novalue'])
				{
					return NULL;
				}
				return (int) $value;
			break;

			case 'string':
			case 'text':
				if (!$value && !$ident_ary['data']['field_show_novalue'])
				{
					return NULL;
				}

				$value = make_clickable($value);
				$value = censor_text($value);
				$value = bbcode_nl2br($value);
				return $value;
			break;

			// case 'datetime':
			case 'date':
				$date = explode('-', $value);
				$day = (isset($date[0])) ? (int) $date[0] : 0;
				$month = (isset($date[1])) ? (int) $date[1] : 0;
				$year = (isset($date[2])) ? (int) $date[2] : 0;

				if (!$day && !$month && !$year && !$ident_ary['data']['field_show_novalue'])
				{
					return NULL;
				}
				else if ($day && $month && $year)
				{
					global $user;
					// Date should display as the same date for every user regardless of timezone, so remove offset
					// to compensate for the offset added by user::format_date()
					return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
				}

				return $value;
			break;

			case 'dropdown':
				$field_id = $ident_ary['data']['field_id'];
				$lang_id = $ident_ary['data']['lang_id'];
				if (!isset($this->options_lang[$field_id][$lang_id]))
				{
					$this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false);
				}

				if ($value == $ident_ary['data']['field_novalue'] && !$ident_ary['data']['field_show_novalue'])
				{
					return NULL;
				}

				$value = (int) $value;

				// User not having a value assigned
				if (!isset($this->options_lang[$field_id][$lang_id][$value]))
				{
					if ($ident_ary['data']['field_show_novalue'])
					{
						$value = $ident_ary['data']['field_novalue'];
					}
					else
					{
						return NULL;
					}
				}

				return $this->options_lang[$field_id][$lang_id][$value];
			break;

			case 'bool':
				$field_id = $ident_ary['data']['field_id'];
				$lang_id = $ident_ary['data']['lang_id'];
				if (!isset($this->options_lang[$field_id][$lang_id]))
				{
					$this->get_option_lang($field_id, $lang_id, FIELD_BOOL, false);
				}

				if (!$value && $ident_ary['data']['field_show_novalue'])
				{
					$value = $ident_ary['data']['field_default_value'];
				}

				if ($ident_ary['data']['field_length'] == 1)
				{
					return (isset($this->options_lang[$field_id][$lang_id][(int) $value])) ? $this->options_lang[$field_id][$lang_id][(int) $value] : NULL;
//.........这里部分代码省略.........
开发者ID:gonzo1247,项目名称:hitman_roa,代码行数:101,代码来源:functions_profile_fields.php

示例3: message_history

/**
* Display Message History
*/
function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false)
{
    global $db, $user, $config, $template, $phpbb_root_path, $phpEx, $auth, $bbcode;
    // Get History Messages (could be newer)
    $sql = 'SELECT t.*, p.*, u.*
		FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u
		WHERE t.msg_id = p.msg_id
			AND p.author_id = u.user_id
			AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ")\n\t\t\tAND t.user_id = {$user_id}";
    if (!$message_row['root_level']) {
        $sql .= " AND (p.root_level = {$msg_id} OR (p.root_level = 0 AND p.msg_id = {$msg_id}))";
    } else {
        $sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')';
    }
    $sql .= ' ORDER BY p.message_time DESC';
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    if (!$row) {
        $db->sql_freeresult($result);
        return false;
    }
    $rowset = array();
    $bbcode_bitfield = '';
    $folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm') . '&amp;folder=';
    do {
        $folder_id = (int) $row['folder_id'];
        $row['folder'][] = isset($folder[$folder_id]) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
        if (isset($rowset[$row['msg_id']])) {
            $rowset[$row['msg_id']]['folder'][] = isset($folder[$folder_id]) ? '<a href="' . $folder_url . $folder_id . '">' . $folder[$folder_id]['folder_name'] . '</a>' : $user->lang['UNKNOWN_FOLDER'];
        } else {
            $rowset[$row['msg_id']] = $row;
            $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
        }
    } while ($row = $db->sql_fetchrow($result));
    $db->sql_freeresult($result);
    $title = $row['message_subject'];
    if (sizeof($rowset) == 1 && !$in_post_mode) {
        return false;
    }
    // Instantiate BBCode class
    if ((empty($bbcode) || $bbcode === false) && $bbcode_bitfield !== '') {
        if (!class_exists('bbcode')) {
            include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        }
        $bbcode = new bbcode(base64_encode($bbcode_bitfield));
    }
    $title = censor_text($title);
    $url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm');
    $next_history_pm = $previous_history_pm = $prev_id = 0;
    foreach ($rowset as $id => $row) {
        $author_id = $row['author_id'];
        $folder_id = (int) $row['folder_id'];
        $subject = $row['message_subject'];
        $message = $row['message_text'];
        $message = censor_text($message);
        $decoded_message = false;
        if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_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']);
        $subject = censor_text($subject);
        if ($id == $msg_id) {
            $next_history_pm = next($rowset);
            $next_history_pm = sizeof($next_history_pm) ? (int) $next_history_pm['msg_id'] : 0;
            $previous_history_pm = $prev_id;
        }
        $template->assign_block_vars('history_row', array('MESSAGE_AUTHOR_QUOTE' => $decoded_message ? addslashes(get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username'])) : '', 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), 'SUBJECT' => $subject, 'SENT_DATE' => $user->format_date($row['message_time']), 'MESSAGE' => $message, 'FOLDER' => implode(', ', $row['folder']), 'DECODED_MESSAGE' => $decoded_message, 'S_CURRENT_MSG' => $row['msg_id'] == $msg_id, 'S_AUTHOR_DELETED' => $author_id == ANONYMOUS ? true : false, 'S_IN_POST_MODE' => $in_post_mode, 'MSG_ID' => $row['msg_id'], 'U_VIEW_MESSAGE' => "{$url}&amp;f={$folder_id}&amp;p=" . $row['msg_id'], 'U_QUOTE' => !$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id'] ? "{$url}&amp;mode=compose&amp;action=quote&amp;f=" . $folder_id . "&amp;p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => $author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm') ? "{$url}&amp;mode=compose&amp;action=reply&amp;f={$folder_id}&amp;p=" . $row['msg_id'] : ''));
        unset($rowset[$id]);
        $prev_id = $id;
    }
    $template->assign_vars(array('QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), 'HISTORY_TITLE' => $title, 'U_VIEW_NEXT_HISTORY' => $next_history_pm ? "{$url}&amp;p=" . $next_history_pm : '', 'U_VIEW_PREVIOUS_HISTORY' => $previous_history_pm ? "{$url}&amp;p=" . $previous_history_pm : ''));
    return true;
}
开发者ID:jvinhit,项目名称:php,代码行数:82,代码来源:functions_privmsgs.php

示例4: mcp_topic_view


//.........这里部分代码省略.........
    if (!empty($sort_days_old) && $sort_days_old != $sort_days || $total <= $posts_per_page) {
        $start = 0;
    }
    // Make sure $start is set to the last page if it exceeds the amount
    if ($start < 0 || $start >= $total) {
        $start = $start < 0 ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
    }
    $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
		FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
		WHERE ' . ($action == 'reports' ? 'p.post_reported = 1 AND ' : '') . '
			p.topic_id = ' . $topic_id . ' ' . (!$auth->acl_get('m_approve', $topic_info['forum_id']) ? ' AND p.post_approved = 1 ' : '') . '
			AND p.poster_id = u.user_id ' . $limit_time_sql . '
		ORDER BY ' . $sort_order_sql;
    $result = $db->sql_query_limit($sql, $posts_per_page, $start);
    $rowset = $post_id_list = array();
    $bbcode_bitfield = '';
    while ($row = $db->sql_fetchrow($result)) {
        $rowset[] = $row;
        $post_id_list[] = $row['post_id'];
        $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
    }
    $db->sql_freeresult($result);
    if ($bbcode_bitfield !== '') {
        include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
        $bbcode = new bbcode(base64_encode($bbcode_bitfield));
    }
    $topic_tracking_info = array();
    // Get topic tracking info
    if ($config['load_db_lastread']) {
        $tmp_topic_data = array($topic_id => $topic_info);
        $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time']));
        unset($tmp_topic_data);
    } else {
        $topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
    }
    $has_unapproved_posts = false;
    // Grab extensions
    $extensions = $attachments = array();
    if ($topic_info['topic_attachment'] && sizeof($post_id_list)) {
        $extensions = $cache->obtain_attach_extensions($topic_info['forum_id']);
        // Get attachments...
        if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) {
            $sql = 'SELECT *
				FROM ' . ATTACHMENTS_TABLE . '
				WHERE ' . $db->sql_in_set('post_msg_id', $post_id_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);
        }
    }
    foreach ($rowset as $i => $row) {
        $message = $row['post_text'];
        $post_subject = $row['post_subject'] != '' ? $row['post_subject'] : $topic_info['topic_title'];
        if ($row['bbcode_bitfield']) {
            $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
        }
        $message = bbcode_nl2br($message);
        $message = smiley_text($message);
        if (!empty($attachments[$row['post_id']])) {
            $update_count = array();
            parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);
        }
        if (!$row['post_approved']) {
            $has_unapproved_posts = true;
        }
        $post_unread = isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id] ? true : false;
        $template->assign_block_vars('postrow', array('POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_DATE' => $user->format_date($row['post_time']), 'POST_SUBJECT' => $post_subject, 'MESSAGE' => $message, 'POST_ID' => $row['post_id'], 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 't=' . $topic_id) . '">', '</a>'), 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => $row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id']), 'S_POST_UNAPPROVED' => !$row['post_approved'] && $auth->acl_get('m_approve', $topic_info['forum_id']), 'S_CHECKED' => $submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list) || in_array(intval($row['post_id']), $checked_ids) ? true : false, 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]) ? true : false, 'U_POST_DETAILS' => "{$url}&amp;i={$id}&amp;p={$row['post_id']}&amp;mode=post_details" . ($forum_id ? "&amp;f={$forum_id}" : ''), 'U_MCP_APPROVE' => $auth->acl_get('m_approve', $topic_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : '', 'U_MCP_REPORT' => $auth->acl_get('m_report', $topic_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $topic_info['forum_id'] . '&amp;p=' . $row['post_id']) : ''));
        // 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('postrow.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
            }
        }
        unset($rowset[$i]);
    }
    // Display topic icons for split topic
    $s_topic_icons = false;
    if ($auth->acl_gets('m_split', 'm_merge', (int) $topic_info['forum_id'])) {
        include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
        $s_topic_icons = posting_gen_topic_icons('', $icon_id);
        // Has the user selected a topic for merge?
        if ($to_topic_id) {
            $to_topic_info = get_topic_data(array($to_topic_id), 'm_merge');
            if (!sizeof($to_topic_info)) {
                $to_topic_id = 0;
            } else {
                $to_topic_info = $to_topic_info[$to_topic_id];
                if (!$to_topic_info['enable_icons'] || $auth->acl_get('!f_icons', $topic_info['forum_id'])) {
                    $s_topic_icons = false;
                }
            }
        }
    }
    $s_hidden_fields = build_hidden_fields(array('st_old' => $sort_days, 'post_ids' => $post_id_list));
    $template->assign_vars(array('TOPIC_TITLE' => $topic_info['topic_title'], 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $topic_info['forum_id'] . '&amp;t=' . $topic_info['topic_id']), 'TO_TOPIC_ID' => $to_topic_id, 'TO_TOPIC_INFO' => $to_topic_id ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_topic_info['forum_id'] . '&amp;t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '', 'SPLIT_SUBJECT' => $subject, 'POSTS_PER_PAGE' => $posts_per_page, 'ACTION' => $action, 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), 'S_MCP_ACTION' => "{$url}&amp;i={$id}&amp;mode={$mode}&amp;action={$action}&amp;start={$start}", 'S_FORUM_SELECT' => $to_forum_id ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true), 'S_CAN_SPLIT' => $auth->acl_get('m_split', $topic_info['forum_id']) ? true : false, 'S_CAN_MERGE' => $auth->acl_get('m_merge', $topic_info['forum_id']) ? true : false, 'S_CAN_DELETE' => $auth->acl_get('m_delete', $topic_info['forum_id']) ? true : false, 'S_CAN_APPROVE' => $has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id']) ? true : false, 'S_CAN_LOCK' => $auth->acl_get('m_lock', $topic_info['forum_id']) ? true : false, 'S_CAN_REPORT' => $auth->acl_get('m_report', $topic_info['forum_id']) ? true : false, 'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']), 'S_REPORT_VIEW' => $action == 'reports' ? true : false, 'S_MERGE_VIEW' => $action == 'merge' ? true : false, 'S_SPLIT_VIEW' => $action == 'split' ? true : false, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_TOPIC_ICON' => $icon_id, 'U_SELECT_TOPIC' => "{$url}&amp;i={$id}&amp;mode=forum_view&amp;action=merge_select" . ($forum_id ? "&amp;f={$forum_id}" : ''), 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$topic_info['forum_id']}&amp;t={$topic_info['topic_id']}&amp;start={$start}") . '">', '</a>'), 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$topic_info['forum_id']}&amp;start={$start}") . '">', '</a>'), 'PAGE_NUMBER' => on_page($total, $posts_per_page, $start), 'PAGINATION' => !$posts_per_page ? '' : generate_pagination(append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&amp;t={$topic_info['topic_id']}&amp;mode={$mode}&amp;action={$action}&amp;to_topic_id={$to_topic_id}&amp;posts_per_page={$posts_per_page}&amp;st={$sort_days}&amp;sk={$sort_key}&amp;sd={$sort_dir}"), $total, $posts_per_page, $start), 'TOTAL_POSTS' => $total == 1 ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total)));
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:101,代码来源:mcp_topic.php

示例5: build_language_options

    /**
     * Build all Language specific options
     */
    function build_language_options(&$cp, $field_type, $action = 'create')
    {
        global $user, $config, $db;
        $default_lang_id = !empty($this->edit_lang_id) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']];
        $sql = 'SELECT lang_id, lang_iso
			FROM ' . LANG_TABLE . '
			WHERE lang_id <> ' . (int) $default_lang_id . '
			ORDER BY lang_english_name';
        $result = $db->sql_query($sql);
        $languages = array();
        while ($row = $db->sql_fetchrow($result)) {
            $languages[$row['lang_id']] = $row['lang_iso'];
        }
        $db->sql_freeresult($result);
        $options = array();
        $options['lang_name'] = 'string';
        if ($cp->vars['lang_explain']) {
            $options['lang_explain'] = 'text';
        }
        switch ($field_type) {
            case FIELD_BOOL:
                $options['lang_options'] = 'two_options';
                break;
            case FIELD_DROPDOWN:
                $options['lang_options'] = 'optionfield';
                break;
            case FIELD_TEXT:
            case FIELD_STRING:
                if (strlen($cp->vars['lang_default_value'])) {
                    $options['lang_default_value'] = $field_type == FIELD_STRING ? 'string' : 'text';
                }
                break;
        }
        $lang_options = array();
        foreach ($options as $field => $field_type) {
            $lang_options[1]['lang_iso'] = $this->lang_defs['id'][$default_lang_id];
            $lang_options[1]['fields'][$field] = array('TITLE' => $user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd>' . (is_array($cp->vars[$field]) ? implode('<br />', $cp->vars[$field]) : bbcode_nl2br($cp->vars[$field])) . '</dd>');
            if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) {
                $lang_options[1]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
            }
        }
        foreach ($languages as $lang_id => $lang_iso) {
            $lang_options[$lang_id]['lang_iso'] = $lang_iso;
            foreach ($options as $field => $field_type) {
                $value = $action == 'create' ? utf8_normalize_nfc(request_var('l_' . $field, array(0 => ''), true)) : $cp->vars['l_' . $field];
                if ($field == 'lang_options') {
                    $var = !isset($cp->vars['l_lang_options'][$lang_id]) || !is_array($cp->vars['l_lang_options'][$lang_id]) ? $cp->vars['lang_options'] : $cp->vars['l_lang_options'][$lang_id];
                    switch ($field_type) {
                        case 'two_options':
                            $lang_options[$lang_id]['fields'][$field] = array('TITLE' => $user->lang['CP_' . strtoupper($field)], 'FIELD' => '
											<dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . (isset($value[$lang_id][0]) ? $value[$lang_id][0] : $var[0]) . '" /> ' . $user->lang['FIRST_OPTION'] . '</dd>
											<dd><input class="medium" name="l_' . $field . '[' . $lang_id . '][]" value="' . (isset($value[$lang_id][1]) ? $value[$lang_id][1] : $var[1]) . '" /> ' . $user->lang['SECOND_OPTION'] . '</dd>');
                            break;
                        case 'optionfield':
                            $value = isset($value[$lang_id]) ? is_array($value[$lang_id]) ? implode("\n", $value[$lang_id]) : $value[$lang_id] : implode("\n", $var);
                            $lang_options[$lang_id]['fields'][$field] = array('TITLE' => $user->lang['CP_' . strtoupper($field)], 'FIELD' => '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="7" cols="80">' . $value . '</textarea></dd>');
                            break;
                    }
                    if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) {
                        $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
                    }
                } else {
                    $var = $action == 'create' || !is_array($cp->vars[$field]) ? $cp->vars[$field] : $cp->vars[$field][$lang_id];
                    $lang_options[$lang_id]['fields'][$field] = array('TITLE' => $user->lang['CP_' . strtoupper($field)], 'FIELD' => $field_type == 'string' ? '<dd><input class="medium" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . (isset($value[$lang_id]) ? $value[$lang_id] : $var) . '" /></dd>' : '<dd><textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . (isset($value[$lang_id]) ? $value[$lang_id] : $var) . '</textarea></dd>');
                    if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN'])) {
                        $lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
                    }
                }
            }
        }
        return $lang_options;
    }
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:75,代码来源:acp_profile.php

示例6: mcp_warn_post_view

	/**
	* Handles warning the user when the warning is for a specific post
	*/
	function mcp_warn_post_view($action)
	{
		global $phpEx, $phpbb_root_path, $config;
		global $template, $db, $user, $auth;

		$post_id = request_var('p', 0);
		$forum_id = request_var('f', 0);
		$notify = (isset($_REQUEST['notify_user'])) ? true : false;
		$warning = utf8_normalize_nfc(request_var('warning', '', true));

		$sql = 'SELECT u.*, p.*
			FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u
			WHERE post_id = $post_id
				AND u.user_id = p.poster_id";
		$result = $db->sql_query($sql);
		$user_row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if (!$user_row)
		{
			trigger_error('NO_POST');
		}

		// There is no point issuing a warning to ignored users (ie anonymous and bots)
		if ($user_row['user_type'] == USER_IGNORE)
		{
			trigger_error('CANNOT_WARN_ANONYMOUS');
		}

		// Prevent someone from warning themselves
		if ($user_row['user_id'] == $user->data['user_id'])
		{
			trigger_error('CANNOT_WARN_SELF');
		}

		// Check if there is already a warning for this post to prevent multiple
		// warnings for the same offence
		$sql = 'SELECT post_id
			FROM ' . WARNINGS_TABLE . "
			WHERE post_id = $post_id";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if ($row)
		{
			trigger_error('ALREADY_WARNED');
		}

		$user_id = $user_row['user_id'];

		if (strpos($this->u_action, "&amp;f=$forum_id&amp;p=$post_id") === false)
		{
			$this->p_master->adjust_url("&amp;f=$forum_id&amp;p=$post_id");
			$this->u_action .= "&amp;f=$forum_id&amp;p=$post_id";
		}

		if ($warning && $action == 'add_warning')
		{
			if (check_form_key('mcp_warn'))
			{
				add_warning($user_row, $warning, $notify, $post_id);
				$msg = $user->lang['USER_WARNING_ADDED'];
			}
			else
			{
				$msg = $user->lang['FORM_INVALID'];
			}
			$redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&amp;mode=user_notes&amp;u=$user_id");
			meta_refresh(2, $redirect);
			trigger_error($user->lang['USER_WARNING_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
		}

		// OK, they didn't submit a warning so lets build the page for them to do so
		
		// We want to make the message available here as a reminder
		// Parse the message and subject
		$message = censor_text($user_row['post_text']);

		// Second parse bbcode here
		if ($user_row['bbcode_bitfield'])
		{
			include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);

			$bbcode = new bbcode($user_row['bbcode_bitfield']);
			$bbcode->bbcode_second_pass($message, $user_row['bbcode_uid'], $user_row['bbcode_bitfield']);
		}

		$message = bbcode_nl2br($message);
		$message = smiley_text($message);

		// Generate the appropriate user information for the user we are looking at
		if (!function_exists('get_user_avatar'))
		{
			include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
		}

//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:mcp_warn.php

示例7: display_posts


//.........这里部分代码省略.........
                $update_time = $config['load_online_time'] * 60;
                while ($row = $db->sql_fetchrow($result)) {
                    $user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
                }
                $db->sql_freeresult($result);
            }
            unset($id_cache);
            // Instantiate BBCode
            if (empty($bbcode)) {
                $bbcode = new bbcode(base64_encode($bbcode_bitfield));
            } else {
                $bbcode->bbcode(base64_encode($bbcode_bitfield));
            }
            $prev_post_id = '';
            // Parse messages
            foreach ($forum_ids as $topic_id => $forum_id) {
                if (!isset($post_datas[$forum_id][$topic_id])) {
                    continue;
                }
                $row =& $post_datas[$forum_id][$topic_id];
                $topic_data =& $topic_datas[$forum_id][$topic_id];
                $poster_id = (int) $row['user_id'];
                $l_edited_by = $l_bumped_by = '';
                $s_first_unread = false;
                // End signature parsing, only if needed
                if (@$user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) {
                    $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']);
                    if ($user_cache[$poster_id]['sig_bbcode_bitfield']) {
                        if ($bbcode_filter) {
                            $user_cache[$poster_id]['sig'] = preg_replace($patterns, $replaces, $user_cache[$poster_id]['sig']);
                        }
                        $bbcode->bbcode_second_pass($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield']);
                    }
                    $user_cache[$poster_id]['sig'] = bbcode_nl2br($user_cache[$poster_id]['sig']);
                    $user_cache[$poster_id]['sig'] = $master->gym_master->smiley_text($user_cache[$poster_id]['sig'], !$master->module_config['html_allow_smilies']);
                    $user_cache[$poster_id]['sig_parsed'] = true;
                } else {
                    // Remove sig
                    $user_cache[$poster_id]['sig'] = '';
                }
                // Parse the message and subject
                $message =& $row['post_text'];
                if ($bbcode_filter) {
                    $message = preg_replace($patterns, $replaces, $message);
                }
                if ($display_sumarize > 0) {
                    $message = $master->gym_master->summarize($message, $display_sumarize, $master->call['display_sumarize_method']);
                    // Clean broken tag at the end of the message
                    $message = preg_replace('`\\<[^\\<\\>]*$`i', ' ...', $message);
                    // Close broken bbcode tags requiring it, only quotes for now
                    $master->gym_master->close_bbcode_tags($message, $row['bbcode_uid']);
                }
                // Parse the message and subject
                $message = censor_text($message);
                // Second parse bbcode here
                if ($row['bbcode_bitfield']) {
                    $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
                }
                $message = bbcode_nl2br($message);
                $message = $master->gym_master->smiley_text($message, !$master->module_config['html_allow_smilies']);
                if ($display_sumarize > 0) {
                    // Clean up
                    static $find = array('`\\<\\!--[^\\<\\>]+--\\>`Ui', '`\\[\\/?[^\\]\\[]*\\]`Ui');
                    $message = preg_replace($find, '', $message);
                }
                // Replace naughty words such as farty pants
开发者ID:jverkoey,项目名称:Three20-Scope,代码行数:67,代码来源:display_posts.php

示例8: 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

示例9: reply_post_func


//.........这里部分代码省略.........
            trigger_error(sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]));
        }
    }
    // Store message, sync counters
    $data = array('topic_title' => empty($post_data['topic_title']) ? $post_data['post_subject'] : $post_data['topic_title'], 'topic_first_post_id' => isset($post_data['topic_first_post_id']) ? (int) $post_data['topic_first_post_id'] : 0, 'topic_last_post_id' => isset($post_data['topic_last_post_id']) ? (int) $post_data['topic_last_post_id'] : 0, 'topic_time_limit' => (int) $post_data['topic_time_limit'], 'topic_attachment' => isset($post_data['topic_attachment']) ? (int) $post_data['topic_attachment'] : 0, 'post_id' => 0, 'topic_id' => (int) $topic_id, 'forum_id' => (int) $forum_id, 'icon_id' => (int) $post_data['icon_id'], 'poster_id' => (int) $post_data['poster_id'], 'enable_sig' => (bool) $post_data['enable_sig'], 'enable_bbcode' => (bool) $post_data['enable_bbcode'], 'enable_smilies' => (bool) $post_data['enable_smilies'], 'enable_urls' => (bool) $post_data['enable_urls'], 'enable_indexing' => (bool) $post_data['enable_indexing'], 'message_md5' => (string) $message_md5, 'post_time' => isset($post_data['post_time']) ? (int) $post_data['post_time'] : $current_time, 'post_checksum' => isset($post_data['post_checksum']) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => isset($post_data['post_edit_user']) ? (int) $post_data['post_edit_user'] : 0, 'forum_parents' => $post_data['forum_parents'], 'forum_name' => $post_data['forum_name'], 'notify' => $notify, 'notify_set' => $post_data['notify_set'], 'poster_ip' => isset($post_data['poster_ip']) ? $post_data['poster_ip'] : $user->ip, 'post_edit_locked' => (int) $post_data['post_edit_locked'], 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'topic_approved' => isset($post_data['topic_approved']) ? $post_data['topic_approved'] : false, 'post_approved' => isset($post_data['post_approved']) ? $post_data['post_approved'] : false, 'post_expire_time' => -1);
    include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
    $update_message = true;
    $cwd = getcwd();
    chdir('../');
    $phpbb_root_path_tmp = $phpbb_root_path;
    $phpbb_root_path = './';
    $redirect_url = submit_post('reply', $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);
    chdir($cwd);
    $phpbb_root_path = $phpbb_root_path_tmp;
    // Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected.
    $approved = true;
    if (($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts'] || !$auth->acl_get('f_noapprove', $data['forum_id'])) && !$auth->acl_get('m_approve', $data['forum_id'])) {
        $approved = false;
    }
    $reply_success = false;
    $post_id = '';
    if ($redirect_url) {
        preg_match('/&amp;p=(\\d+)/', $redirect_url, $matches);
        $post_id = $matches[1];
        $reply_success = true;
        // get new post_content
        $message = censor_text($data['message']);
        $quote_wrote_string = $user->lang['WROTE'];
        $message = str_replace('[/quote:' . $data['bbcode_uid'] . ']', '[/quote]', $message);
        $message = preg_replace('/\\[quote(?:=&quot;(.*?)&quot;)?:' . $data['bbcode_uid'] . '\\]/ise', "'[quote]' . ('\$1' ? '\$1' . ' {$quote_wrote_string}:\n' : '\n')", $message);
        $blocks = preg_split('/(\\[\\/?quote\\])/i', $message, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $quote_level = 0;
        $message = '';
        foreach ($blocks as $block) {
            if ($block == '[quote]') {
                if ($quote_level == 0) {
                    $message .= $block;
                }
                $quote_level++;
            } else {
                if ($block == '[/quote]') {
                    if ($quote_level <= 1) {
                        $message .= $block;
                    }
                    if ($quote_level >= 1) {
                        $quote_level--;
                    }
                } else {
                    if ($quote_level <= 1) {
                        $message .= $block;
                    }
                }
            }
        }
        $message = preg_replace('/\\[(youtube|video|googlevideo|gvideo):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $data['bbcode_uid'] . '\\]/sie', "video_bbcode_format('\$1', '\$2')", $message);
        $message = preg_replace('/\\[(BBvideo)[\\d, ]+:' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[url=\$2]YouTube Video[/url]", $message);
        $message = preg_replace('/\\[(spoil|spoiler):' . $row['bbcode_uid'] . '\\](.*?)\\[\\/\\1:' . $row['bbcode_uid'] . '\\]/si', "[spoiler]\$2[/spoiler]", $message);
        $message = preg_replace('/\\[b:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/b:' . $data['bbcode_uid'] . '\\]/si', '[b]$1[/b]', $message);
        $message = preg_replace('/\\[i:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/i:' . $data['bbcode_uid'] . '\\]/si', '[i]$1[/i]', $message);
        $message = preg_replace('/\\[u:' . $data['bbcode_uid'] . '\\](.*?)\\[\\/u:' . $data['bbcode_uid'] . '\\]/si', '[u]$1[/u]', $message);
        $message = preg_replace('/\\[color=#(\\w{6}):' . $data['bbcode_uid'] . '\\](.*?)\\[\\/color:' . $data['bbcode_uid'] . '\\]/si', '[color=#$1]$2[/color]', $message);
        // Second parse bbcode here
        if ($data['bbcode_bitfield']) {
            $bbcode = new bbcode(base64_encode($data['bbcode_bitfield']));
            $bbcode->bbcode_second_pass($message, $data['bbcode_uid'], $data['bbcode_bitfield']);
        }
        $message = bbcode_nl2br($message);
        $message = smiley_text($message);
        if (!empty($data['attachment_data'])) {
            parse_attachments($forum_id, $message, $data['attachment_data'], $update_count);
        }
        $updated_post_title = html_entity_decode(strip_tags(censor_text($data['topic_title'])), ENT_QUOTES, 'UTF-8');
        $edit_allowed = $auth->acl_get('m_edit', $forum_id) || $auth->acl_get('f_edit', $forum_id) && !$data['post_edit_locked'] && ($data['post_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time']);
        $delete_allowed = $auth->acl_get('m_delete', $forum_id) || $auth->acl_get('f_delete', $forum_id) && ($data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time']) && !$data['post_edit_locked'];
        $attachments = array();
        if (sizeof($attach_list) && sizeof($data['attachment_data'])) {
            $sql = 'SELECT *
                FROM ' . ATTACHMENTS_TABLE . '
                WHERE ' . $db->sql_in_set('attach_id', $attach_list) . '
                    AND in_message = 0
                ORDER BY filetime DESC';
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $attachment_by_id[$row['attach_id']] = $row;
            }
            $db->sql_freeresult($result);
            foreach ($data['attachment_data'] as $attachment) {
                if (preg_match('/<img src=\\".*?(\\/download\\/file.php\\?id=(\\d+).*?)\\"/is', $attachment, $matches)) {
                    $file_url = html_entity_decode($phpbb_home . $matches[1]);
                    $attach_id = $matches[2];
                    unset($matches);
                    $xmlrpc_attachment = new xmlrpcval(array('filename' => new xmlrpcval($attachment_by_id[$attach_id]['real_filename'], 'base64'), 'filesize' => new xmlrpcval($attachment_by_id[$attach_id]['filesize'], 'int'), 'content_type' => new xmlrpcval('image'), 'thumbnail_url' => new xmlrpcval(''), 'url' => new xmlrpcval($file_url)), 'struct');
                    $attachments[] = $xmlrpc_attachment;
                }
            }
        }
    }
    $xmlrpc_reply_topic = new xmlrpcval(array('result' => new xmlrpcval($reply_success, 'boolean'), 'post_id' => new xmlrpcval($post_id, 'string'), 'state' => new xmlrpcval($approved ? 0 : 1, 'int'), 'post_title' => new xmlrpcval($updated_post_title, 'base64'), 'post_content' => new xmlrpcval(post_html_clean($message), 'base64'), 'post_author_name' => new xmlrpcval(html_entity_decode($user->data['username']), 'base64'), 'is_online' => new xmlrpcval(true, 'boolean'), 'can_edit' => new xmlrpcval($edit_allowed, 'boolean'), 'icon_url' => new xmlrpcval($user->optionget('viewavatars') ? get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']) : ''), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($current_time), 'dateTime.iso8601'), 'can_delete' => new xmlrpcval($delete_allowed, 'boolean'), 'allow_smilies' => new xmlrpcval($data['enable_smilies'] ? true : false, 'boolean'), 'attachments' => new xmlrpcval($attachments, 'array')), 'struct');
    return new xmlrpcresp($xmlrpc_reply_topic);
}
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:101,代码来源:reply_post.php

示例10: 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;
        $forum_id = request_var('f', 0);
        $start = request_var('start', 0);
        $this->page_title = 'MCP_QUEUE';
        switch ($action) {
            case 'approve':
            case 'disapprove':
                include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
                $post_id_list = request_var('post_id_list', array(0));
                if (!sizeof($post_id_list)) {
                    trigger_error('NO_POST_SELECTED');
                }
                if ($action == 'approve') {
                    approve_post($post_id_list, 'queue', $mode);
                } else {
                    disapprove_post($post_id_list, 'queue', $mode);
                }
                break;
        }
        switch ($mode) {
            case 'approve_details':
                $this->tpl_name = 'mcp_post';
                $user->add_lang(array('posting', 'viewtopic'));
                $post_id = request_var('p', 0);
                $topic_id = request_var('t', 0);
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id), 'm_approve');
                    if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
                        $post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
                    } else {
                        $topic_id = 0;
                    }
                }
                $post_info = get_post_data(array($post_id), 'm_approve', true);
                if (!sizeof($post_info)) {
                    trigger_error('NO_POST_SELECTED');
                }
                $post_info = $post_info[$post_id];
                if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
                    $template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
                }
                $extensions = $attachments = $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));
                        }
                    }
                }
                $post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
                $topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']);
                $template->assign_vars(array('S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&amp;p={$post_id}&amp;f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $post_info['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=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&amp;mode=unapproved_topics' : '&amp;mode=unapproved_posts')) . "&amp;start={$start}\">", '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&amp;mode=approve_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id . '&amp;lookup=' . $post_info['poster_ip']) . '#ip' : ''));
                break;
            case 'unapproved_topics':
            case 'unapproved_posts':
                $user->add_lang(array('viewtopic', 'viewforum'));
                $topic_id = request_var('t', 0);
                $forum_info = array();
                if ($topic_id) {
                    $topic_info = get_topic_data(array($topic_id));
                    if (!sizeof($topic_info)) {
//.........这里部分代码省略.........
开发者ID:html,项目名称:PI,代码行数:101,代码来源:mcp_queue.php

示例11: get_profile_value

	/**
	* Get Profile Value for display
	*/
	function get_profile_value($ident_ary)
	{
		$value = $ident_ary['value'];
		$field_type = $ident_ary['data']['field_type'];

		switch ($this->profile_types[$field_type])
		{
			case 'int':
				if ($value === '')
				{
					return NULL;
				}
				return (int) $value;
			break;

			case 'string':
			case 'text':
				if (!$value)
				{
					return NULL;
				}

				$value = make_clickable($value);
				$value = censor_text($value);
				$value = bbcode_nl2br($value);
				return $value;
			break;

			// case 'datetime':
			case 'date':
				$date = explode('-', $value);
				$day = (isset($date[0])) ? (int) $date[0] : 0;
				$month = (isset($date[1])) ? (int) $date[1] : 0;
				$year = (isset($date[2])) ? (int) $date[2] : 0;

				if (!$day && !$month && !$year)
				{
					return NULL;
				}
				else if ($day && $month && $year)
				{
					global $user;
					// d/m/y 00:00 GMT isn't necessarily on the same d/m/y in the user's timezone, so add the timezone seconds
					return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) + $user->timezone + $user->dst, $user->lang['DATE_FORMAT'], true);
				}

				return $value;
			break;

			case 'dropdown':
				$field_id = $ident_ary['data']['field_id'];
				$lang_id = $ident_ary['data']['lang_id'];
				if (!isset($this->options_lang[$field_id][$lang_id]))
				{
					$this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false);
				}

				if ($value == $ident_ary['data']['field_novalue'])
				{
					return NULL;
				}

				$value = (int) $value;

				// User not having a value assigned
				if (!isset($this->options_lang[$field_id][$lang_id][$value]))
				{
					return NULL;
				}

				return $this->options_lang[$field_id][$lang_id][$value];
			break;

			case 'bool':
				$field_id = $ident_ary['data']['field_id'];
				$lang_id = $ident_ary['data']['lang_id'];
				if (!isset($this->options_lang[$field_id][$lang_id]))
				{
					$this->get_option_lang($field_id, $lang_id, FIELD_BOOL, false);
				}

				if ($ident_ary['data']['field_length'] == 1)
				{
					return (isset($this->options_lang[$field_id][$lang_id][(int) $value])) ? $this->options_lang[$field_id][$lang_id][(int) $value] : NULL;
				}
				else if (!$value)
				{
					return NULL;
				}
				else
				{
					return $this->options_lang[$field_id][$lang_id][(int) ($value) + 1];
				}
			break;

			default:
				trigger_error('Unknown profile type', E_USER_ERROR);
//.........这里部分代码省略.........
开发者ID:APTX,项目名称:phpbb3,代码行数:101,代码来源:functions_profile_fields.php

示例12: 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

示例13: generate_content

/**
* Enter description here...
*
* @param string		$content
* @param int		$uid
* @param int		$bitfield
* @return string	
**/
function generate_content( $content, $uid, $bitfield, $attach_list, $post_id, $forum_id )
{
	global $text_limit, $show_text, $board_url;
	global $user, $config, $phpbb_root_path, $phpEx;

	if ( $show_text && !empty($content) )
	{
		// Remove Comments from smiles
		$content	= smiley_text($content);

		// Truncates post text ?
		$content	= generate_truncate_content($content, $text_limit, $uid, false );

		// 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);

		/* Just remember : Never use it !
		* Commented out so I do not make the same error twice.
		$content	= html_entity_decode($content);
		*/

		// Parse it!
		$content	= generate_text_for_display($content, $uid, $bitfield, 7);

		// Fix smilies
		$content	= str_replace('{SMILIES_PATH}/', "{$phpbb_root_path}{$config['smilies_path']}/", $content);

		// Relative Path to Absolute path, Windows style
		$content	= str_replace('./', "$board_url/", $content);

		// Fix some spaces
		$content	= bbcode_nl2br($content);

		// Remove "Select all" link and mouse events
		$content	= str_replace('<a href="#" onclick="selectCode(this); return false;">' .$user->lang['SELECT_ALL_CODE'] . '</a>', '', $content);
		$content	= preg_replace('#(onkeypress|onclick)="(.*?)"#si', '', $content);

		// Remove Comments from post content
		$content	= preg_replace('#<!-- ([lmwe]) -->(.*?)<!-- ([lmwe]) -->#si', '$2', $content);

		// Remove embed Windows Media Streams
		$content	= preg_replace( '#<\!--\[if \!IE\]>-->([^[]+)<\!--<!\[endif\]-->#si', '', $content);

		// Remove embed and objects
		// Use (<|&lt;) and (>|&gt;) because can be contained into [code][/code]
		$content	= preg_replace( '#(<|&lt;)(object|embed)(.*?) (value|src)=(.*?) ([^[]+)(object|embed)(>|&gt;)#si',' <a href=$5 target="_blank"><strong>$2</strong></a> ',$content);

		// Remove some specials html tag, because somewhere there are a mod to allow html tags ;)
		// Use (<|&lt;) and (>|&gt;) because can be contained into [code][/code]
		$content	= preg_replace( '#(<|&lt;)script([^[]+)script(>|&gt;)#si', ' <strong>Script</strong> ', $content);
		$content	= preg_replace( '#(<|&lt;)iframe([^[]+)iframe(>|&gt;)#si', ' <strong>Iframe</strong> ', $content);

		// Resize images ?
		if ( $config['rss_image_size'] )
		{
			$content	= preg_replace('#<img.*?src=\"(.*?)\" alt=(.*?)/>#ise', "check_rss_imagesize( '$1' )", $content);
		}

		/* Convert special HTML entities back to characters
		* Some languages will need it
		* Commented out so I do not loose the code.
		$content = htmlspecialchars_decode($content);
		*/

		// Other control characters
		$content = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $content);

		// Pull attachment data
		if (sizeof($attach_list))
		{
			global $auth, $db;

			$attachments = $update_count = array();
			$attachments['post_id'][] = $post_id;

			// Pull attachment data
			if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
			{
				$attachments = array();
				$sql = 'SELECT *
					FROM ' . ATTACHMENTS_TABLE . '
					WHERE ' . $db->sql_in_set('post_msg_id', $attach_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);
			}
//.........这里部分代码省略.........
开发者ID:hkowata,项目名称:forum,代码行数:101,代码来源:rss.php

示例14: get_context

				if ($row['display_text_only'])
				{
					// now find context for the searched words
					$row['post_text'] = get_context($row['post_text'], array_filter(explode('|', $hilit), 'strlen'), $return_chars);
					$row['post_text'] = bbcode_nl2br($row['post_text']);
				}
				else
				{
					// Second parse bbcode here
					if ($row['bbcode_bitfield'])
					{
						$bbcode->bbcode_second_pass($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield']);
					}

					$row['post_text'] = bbcode_nl2br($row['post_text']);
					$row['post_text'] = smiley_text($row['post_text']);

					if (!empty($attachments[$row['post_id']]))
					{
						parse_attachments($forum_id, $row['post_text'], $attachments[$row['post_id']], $update_count);

						// we only display inline attachments
						unset($attachments[$row['post_id']]);
					}
				}

				if ($hilit)
				{
					// post highlighting
					$row['post_text'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">$1</span>', $row['post_text']);
开发者ID:renemilk,项目名称:spring-website,代码行数:30,代码来源:search.php

示例15: parse_template


//.........这里部分代码省略.........
				FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f\n\t\t\t\tWHERE t.forum_id = f.forum_id\n\t\t\t\t\tAND t.topic_visibility = 1\n\t\t\t\t\tAND t.poll_start > 0\n\t\t\t\t\t{$where}\n\t\t\t\t\tAND t.topic_moved_id = 0\n\t\t\t\t\tAND p.post_id = t.topic_first_post_id\n\t\t\t\t\t{$portal_poll_hide}\n\t\t\t\tORDER BY t.poll_start DESC";
            $limit = isset($this->config['board3_poll_limit_' . $module_id]) ? $this->config['board3_poll_limit_' . $module_id] : 3;
            $result = $this->db->sql_query_limit($sql, $limit);
            $has_poll = false;
            if ($result) {
                while ($data = $this->db->sql_fetchrow($result)) {
                    $has_poll = true;
                    $poll_has_options = false;
                    $topic_id = (int) $data['topic_id'];
                    $forum_id = (int) $data['forum_id'];
                    $cur_voted_id = array();
                    if ($this->config['board3_poll_allow_vote_' . $module_id]) {
                        if ($this->user->data['is_registered']) {
                            $vote_sql = 'SELECT poll_option_id
								FROM ' . POLL_VOTES_TABLE . '
								WHERE topic_id = ' . (int) $topic_id . '
									AND vote_user_id = ' . (int) $this->user->data['user_id'];
                            $vote_result = $this->db->sql_query($vote_sql);
                            while ($row = $this->db->sql_fetchrow($vote_result)) {
                                $cur_voted_id[] = $row['poll_option_id'];
                            }
                            $this->db->sql_freeresult($vote_result);
                        } else {
                            // Cookie based guest tracking ... I don't like this but hum ho
                            // it's oft requested. This relies on "nice" users who don't feel
                            // the need to delete cookies to mess with results.
                            if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE)) {
                                $cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $topic_id, 0, false, true));
                                $cur_voted_id = array_map('intval', $cur_voted_id);
                            }
                        }
                        $s_can_vote = (!sizeof($cur_voted_id) && $this->auth->acl_get('f_vote', $forum_id) || $this->auth->acl_get('f_votechg', $forum_id) && $data['poll_vote_change']) && ($data['poll_length'] != 0 && $data['poll_start'] + $data['poll_length'] > time() || $data['poll_length'] == 0) && $data['topic_status'] != ITEM_LOCKED && $data['forum_status'] != ITEM_LOCKED ? true : false;
                    } else {
                        $s_can_vote = false;
                    }
                    $s_display_results = !$s_can_vote || $s_can_vote && sizeof($cur_voted_id) || $view == 'viewpoll' && in_array($topic_id, $poll_view_ar) ? true : false;
                    $poll_sql = 'SELECT po.poll_option_id, po.poll_option_text, po.poll_option_total
						FROM ' . POLL_OPTIONS_TABLE . ' po
						WHERE po.topic_id = ' . (int) $topic_id . '
						ORDER BY po.poll_option_id';
                    $poll_result = $this->db->sql_query($poll_sql);
                    $poll_total_votes = 0;
                    $poll_data = array();
                    if ($poll_result) {
                        while ($polls_data = $this->db->sql_fetchrow($poll_result)) {
                            $poll_has_options = true;
                            $poll_data[] = $polls_data;
                            $poll_total_votes += $polls_data['poll_option_total'];
                        }
                    }
                    $this->db->sql_freeresult($poll_result);
                    $make_poll_view = array();
                    if (in_array($topic_id, $poll_view_ar) === false) {
                        $make_poll_view[] = $topic_id;
                        $make_poll_view = array_merge($poll_view_ar, $make_poll_view);
                    }
                    $poll_view_str = urlencode(implode(',', $make_poll_view));
                    $portalpoll_url = $this->modules_helper->route('board3_portal_controller') . "?polls={$poll_view_str}";
                    $portalvote_url = $this->modules_helper->route('board3_portal_controller') . "?f={$forum_id}&amp;t={$topic_id}";
                    $viewtopic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&amp;t={$topic_id}");
                    $poll_end = $data['poll_length'] + $data['poll_start'];
                    // Parse BBCode title
                    if ($data['bbcode_bitfield']) {
                        $poll_bbcode = new \bbcode();
                    } else {
                        $poll_bbcode = false;
                    }
                    $data['poll_title'] = censor_text($data['poll_title']);
                    if ($poll_bbcode !== false) {
                        $poll_bbcode->bbcode_second_pass($data['poll_title'], $data['bbcode_uid'], $data['bbcode_bitfield']);
                    }
                    $data['poll_title'] = bbcode_nl2br($data['poll_title']);
                    $data['poll_title'] = smiley_text($data['poll_title']);
                    unset($poll_bbcode);
                    $this->template->assign_block_vars($type !== '' ? 'poll_' . $type : 'poll', array('S_POLL_HAS_OPTIONS' => $poll_has_options, 'POLL_QUESTION' => $data['poll_title'], 'U_POLL_TOPIC' => append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, 't=' . $topic_id . '&amp;f=' . $forum_id), 'POLL_LENGTH' => $data['poll_length'], 'TOPIC_ID' => $topic_id, 'TOTAL_VOTES' => $poll_total_votes, 'L_MAX_VOTES' => $this->user->lang('MAX_OPTIONS_SELECT', $data['poll_max_options']), 'L_POLL_LENGTH' => $data['poll_length'] ? sprintf($this->user->lang[$poll_end > time() ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $this->user->format_date($poll_end)) : '', 'S_CAN_VOTE' => $s_can_vote, 'S_DISPLAY_RESULTS' => $s_display_results, 'S_IS_MULTI_CHOICE' => $data['poll_max_options'] > 1 ? true : false, 'S_POLL_ACTION' => $portalvote_url, 'U_VIEW_RESULTS' => $portalpoll_url . '&amp;view=viewpoll#viewpoll', 'U_VIEW_TOPIC' => $viewtopic_url));
                    foreach ($poll_data as $pd) {
                        $option_pct = $poll_total_votes > 0 ? $pd['poll_option_total'] / $poll_total_votes : 0;
                        $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100));
                        // Parse BBCode option text
                        if ($data['bbcode_bitfield']) {
                            $poll_bbcode = new \bbcode();
                        } else {
                            $poll_bbcode = false;
                        }
                        $pd['poll_option_text'] = censor_text($pd['poll_option_text']);
                        if ($poll_bbcode !== false) {
                            $poll_bbcode->bbcode_second_pass($pd['poll_option_text'], $data['bbcode_uid'], $data['bbcode_bitfield']);
                        }
                        $pd['poll_option_text'] = bbcode_nl2br($pd['poll_option_text']);
                        $pd['poll_option_text'] = smiley_text($pd['poll_option_text']);
                        unset($poll_bbcode);
                        $this->template->assign_block_vars(($type !== '' ? 'poll_' . $type : 'poll') . '.poll_option', array('POLL_OPTION_ID' => $pd['poll_option_id'], 'POLL_OPTION_CAPTION' => $pd['poll_option_text'], 'POLL_OPTION_RESULT' => $pd['poll_option_total'], 'POLL_OPTION_PERCENT' => $option_pct_txt, 'POLL_OPTION_PCT' => round($option_pct * 100), 'POLL_OPTION_IMG' => $this->user->img('poll_center', $option_pct_txt, round($option_pct * 35) . 'px'), 'POLL_OPTION_VOTED' => in_array($pd['poll_option_id'], $cur_voted_id) ? true : false));
                    }
                }
            }
            $this->db->sql_freeresult($result);
            $this->template->assign_vars(array('S_HAS_POLL' => $has_poll, 'POLL_LEFT_CAP_IMG' => $this->user->img('poll_left'), 'POLL_RIGHT_CAP_IMG' => $this->user->img('poll_right')));
        }
        return ($type !== '' ? 'poll_' . $type : 'poll_center') . '.html';
    }
开发者ID:alhitary,项目名称:Board3-Portal,代码行数:101,代码来源:poll.php


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