本文整理汇总了PHP中bbcode::bbcode_second_pass方法的典型用法代码示例。如果您正苦于以下问题:PHP bbcode::bbcode_second_pass方法的具体用法?PHP bbcode::bbcode_second_pass怎么用?PHP bbcode::bbcode_second_pass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bbcode
的用法示例。
在下文中一共展示了bbcode::bbcode_second_pass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_message
/**
* Render BBCode in a message
*
* @param string $message Message to render -- should already be parsed using message parser. Using some modified code from $bbcode->bbcode_cache_init() in phpBB's bbcode.php.
* @param string $uid BBCode uid
* @param string $bitfield BBCode bitfield
* @return string Demo HTML
*/
public function render_message($message, $uid, $bitfield)
{
if (empty($this->bbcode_data)) {
return $message;
}
if (!is_object($this->bbcode)) {
if (!class_exists('\\bbcode')) {
require $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext;
}
$this->bbcode = new \bbcode();
}
// We define bbcode_bitfield here instead of when instantiating the class to prevent bbcode_cache_init() from running
$this->bbcode->bbcode_bitfield = $bitfield;
$bbcode_tpl = !empty($this->bbcode_data['second_pass_replace']) ? $this->bbcode_data['second_pass_replace'] : $this->bbcode_data['bbcode_tpl'];
// Handle language variables
$bbcode_tpl = preg_replace('/{L_([A-Z_]+)}/e', "(!empty(phpbb::\$user->lang['\$1'])) ? phpbb::\$user->lang['\$1'] : ucwords(strtolower(str_replace('_', ' ', '\$1')))", $bbcode_tpl);
if ($this->bbcode_data['second_pass_replace']) {
$this->bbcode->bbcode_cache[$this->contrib_id] = array('preg' => array($this->bbcode_data['second_pass_match'] => $bbcode_tpl));
} else {
$this->bbcode->bbcode_cache[$this->contrib_id] = array('str' => array($this->bbcode_data['second_pass_match'] => $bbcode_tpl));
}
$this->bbcode->bbcode_uid = $uid;
$this->bbcode->bbcode_second_pass($message);
return bbcode_nl2br($message);
}
示例2: get_user_info_func
//.........这里部分代码省略.........
$row = $db->sql_fetchrow($result);
$foe = $row['foe'] ? true : false;
$friend = $row['friend'] ? true : false;
$db->sql_freeresult($result);
if ($config['load_onlinetrack']) {
if ($config['version'] < '3.0.3') {
$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline, session_page
FROM ' . SESSIONS_TABLE . "\r\r\n WHERE session_user_id = {$user_id}\r\r\n GROUP BY session_page\r\r\n ORDER BY session_time DESC";
} else {
$sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline, session_page, session_forum_id
FROM ' . SESSIONS_TABLE . "\r\r\n WHERE session_user_id = {$user_id}\r\r\n GROUP BY session_page, session_forum_id\r\r\n ORDER BY session_time DESC";
}
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$member['session_time'] = isset($row['session_time']) ? $row['session_time'] : 0;
$member['session_viewonline'] = isset($row['session_viewonline']) ? $row['session_viewonline'] : 0;
$member['session_page'] = isset($row['session_page']) ? $row['session_page'] : 0;
$member['session_forum_id'] = isset($row['session_forum_id']) ? $row['session_forum_id'] : 0;
unset($row);
}
if ($config['load_user_activity']) {
display_user_activity($member);
}
// Do the relevant calculations
$memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
$posts_per_day = $member['user_posts'] / $memberdays;
$percentage = $config['num_posts'] ? min(100, $member['user_posts'] / $config['num_posts'] * 100) : 0;
if ($member['user_sig']) {
$member['user_sig'] = censor_text($member['user_sig']);
if ($member['user_sig_bbcode_bitfield']) {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
// We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
$zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false;
// Only check if the user is logged in
if ($user->data['is_registered']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
$module->list_modules('mcp');
$user_notes_enabled = $module->loaded('notes', 'user_notes') ? true : false;
$warn_user_enabled = $module->loaded('warn', 'warn_user') ? true : false;
$zebra_enabled = $module->loaded('zebra') ? true : false;
$friends_enabled = $module->loaded('zebra', 'friends') ? true : false;
$foes_enabled = $module->loaded('zebra', 'foes') ? true : false;
unset($module);
}
$template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = isset($profile_fields[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
示例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') . '&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}&f={$folder_id}&p=" . $row['msg_id'], 'U_QUOTE' => !$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS && $author_id != $user->data['user_id'] ? "{$url}&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', 'U_POST_REPLY_PM' => $author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm') ? "{$url}&mode=compose&action=reply&f={$folder_id}&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}&p=" . $next_history_pm : '', 'U_VIEW_PREVIOUS_HISTORY' => $previous_history_pm ? "{$url}&p=" . $previous_history_pm : ''));
return true;
}
示例4: 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_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, 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');
}
if (!$report_id && $report['report_closed']) {
trigger_error('REPORT_CLOSED');
}
$post_id = $report['post_id'];
$report_id = $report['report_id'];
$post_info = 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']));
}
$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;
// 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'])) {
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
AND in_message = 0
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&mode=report_details&f=' . $post_info['forum_id'] . '&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_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&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $report['user_id']), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_REPORTER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&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'] . '&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'] . '&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'] ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&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 . '&r=' . $report_id . '&p=' . $post_id . '&f=' . $forum_id . '&lookup=' . $post_info['poster_ip'] . '#ip' : ''));
$this->tpl_name = 'mcp_post';
//.........这里部分代码省略.........
示例5: sprintf
/**
* 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, "&f=$forum_id&p=$post_id") === false)
{
$this->p_master->adjust_url("&f=$forum_id&p=$post_id");
$this->u_action .= "&f=$forum_id&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&mode=user_notes&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);
}
//.........这里部分代码省略.........
示例6:
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
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)
示例7: generate_text_for_display
/**
* For display of custom parsed text on user-facing pages
* Expects $text to be the value directly from the database (stored value)
*/
function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true)
{
static $bbcode;
global $phpbb_dispatcher;
if ($text === '') {
return '';
}
/**
* Use this event to modify the text before it is parsed
*
* @event core.modify_text_for_display_before
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @var bool censor_text Whether or not to apply word censors
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags', 'censor_text');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars)));
if ($censor_text) {
$text = censor_text($text);
}
// Parse bbcode if bbcode uid stored and bbcode enabled
if ($uid && $flags & OPTION_FLAG_BBCODE) {
if (!class_exists('bbcode')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
}
if (empty($bbcode)) {
$bbcode = new bbcode($bitfield);
} else {
$bbcode->bbcode($bitfield);
}
$bbcode->bbcode_second_pass($text, $uid);
}
$text = bbcode_nl2br($text);
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
/**
* Use this event to modify the text after it is parsed
*
* @event core.modify_text_for_display_after
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars)));
return $text;
}
示例8: array
//.........这里部分代码省略.........
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$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);
示例9: bbcode
while ($row = $db->sql_fetchrow($result))
{
$power = '';
if ($karmamod->config['power_show'] || $karmamod->user_level == 'admin')
{
$power = $row['karma_action'] . $row['karma_power'];
}
$poster_id = $row['poster_id'];
$comment = censor_text($row['comment_text']);
// Parse bbcode
if ($row['bbcode_bitfield'])
{
$bbcode = new bbcode(base64_encode($row['bbcode_bitfield']));
$bbcode->bbcode_second_pass($comment, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$comment = bbcode_nl2br($comment);
$comment = smiley_text($comment, !$config['allow_smilies']);
if ($karmamod->user_level != 'admin' && (($karmamod->config['anonym_increase'] && $row['karma_action'] == '+') || ($karmamod->config['anonym_decrease'] && $row['karma_action'] == '-')))
{
$author_full = $user->lang['KARMA_NOTIFY_HIDDEN_SENDER'];
$author_colour = $user->lang['KARMA_NOTIFY_HIDDEN_SENDER'];
$author = $user->lang['KARMA_NOTIFY_HIDDEN_SENDER'];
$u_author = '';
}
else
{
$author_full = get_username_string('full', $poster_id, $row['username'], $row['user_colour']);
示例10: topic_review
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
global $_CLASS, $bbcode, $config;
// Go ahead and pull all data for this topic
$sql = 'SELECT u.username, u.user_id, p.post_id, p.post_username, p.post_subject, p.post_text, p.enable_smilies, p.bbcode_uid, p.bbcode_bitfield, p.post_time
FROM ' . FORUMS_POSTS_TABLE . ' p, ' . USERS_TABLE . " u\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND p.poster_id = u.user_id\n\t\t\t" . (!$_CLASS['auth']->acl_get('m_approve', $forum_id) ? 'AND p.post_approved = 1' : '') . '
' . ($mode == 'post_review' ? " AND p.post_id > {$cur_post_id}" : '') . '
ORDER BY p.post_time DESC';
$result = $_CLASS['core_db']->query_limit($sql, $config['posts_per_page']);
if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
return false;
}
$bbcode_bitfield = 0;
do {
$rowset[] = $row;
$bbcode_bitfield |= $row['bbcode_bitfield'];
} while ($row = $_CLASS['core_db']->fetch_row_assoc($result));
$_CLASS['core_db']->free_result($result);
// Instantiate BBCode class
if (!isset($bbcode) && $bbcode_bitfield) {
require_once SITE_FILE_ROOT . 'includes/forums/bbcode.php';
$bbcode = new bbcode($bbcode_bitfield);
}
foreach ($rowset as $i => $row) {
$poster_id = $row['user_id'];
$poster = $row['username'];
// Handle anon users posting with usernames
if ($poster_id == ANONYMOUS && $row['post_username']) {
$poster = $row['post_username'];
$poster_rank = $_CLASS['core_user']->lang['GUEST'];
}
$post_subject = $row['post_subject'];
$message = $row['post_text'];
if ($row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = smiley_text($message, !$row['enable_smilies']);
$post_subject = censor_text($post_subject);
$message = censor_text($message);
$_CLASS['core_template']->assign_vars_array($mode . '_row', array('POSTER_NAME' => $poster, 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $_CLASS['core_user']->img('icon_post', $_CLASS['core_user']->lang['POST']), 'POST_DATE' => $_CLASS['core_user']->format_date($row['post_time']), 'MESSAGE' => str_replace("\n", '<br />', $message), 'U_POST_ID' => $row['post_id'], 'U_MINI_POST' => generate_link('Forums&file=viewtopic&p=' . $row['post_id'] . '#' . $row['post_id']), 'U_MCP_DETAILS' => $_CLASS['auth']->acl_get('m_', $forum_id) ? generate_link('Forums&file=mcp&mode=post_details&p=' . $row['post_id']) : '', 'U_QUOTE' => $show_quote_button && $_CLASS['auth']->acl_get('f_quote', $forum_id) ? 'javascript:addquote(' . $row['post_id'] . ", '" . str_replace("'", "\\'", $poster) . "')" : ''));
unset($rowset[$i]);
}
if ($mode == 'topic_review') {
$_CLASS['core_template']->assign('QUOTE_IMG', $_CLASS['core_user']->img('btn_quote', $_CLASS['core_user']->lang['REPLY_WITH_QUOTE']));
}
return true;
}
示例11: switch
function mcp_queue($id, $mode, $url)
{
global $_CLASS, $site_file_root, $config;
$forum_id = request_var('f', 0);
$start = request_var('start', 0);
switch ($mode) {
case 'approve':
case 'disapprove':
require_once $site_file_root . 'includes/forums/functions_messenger.php';
require_once $site_file_root . 'includes/forums/functions_posting.php';
$post_id_list = request_var('post_id_list', array(0));
if (!sizeof($post_id_list)) {
trigger_error('NO_POST_SELECTED');
}
if ($mode == 'approve') {
approve_post($post_id_list);
} else {
disapprove_post($post_id_list);
}
break;
case 'approve_details':
$_CLASS['core_user']->add_lang('posting');
require_once $site_file_root . 'includes/forums/functions_posting.php';
$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');
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
}
$post_info = get_post_data(array($post_id), 'm_approve');
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)) {
$_CLASS['core_template']->assign_array(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
}
// Set some vars
$poster = $post_info['user_colour'] ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username'];
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield']) {
require_once $site_file_root . 'includes/forums/bbcode.php';
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = smiley_text($message);
$_CLASS['core_template']->assign_array(array('S_MCP_QUEUE' => true, 'S_APPROVE_ACTION' => generate_link("Forums&file=mcp&i=queue&p={$post_id}&f={$forum_id}"), 'S_CAN_VIEWIP' => $_CLASS['auth']->acl_get('m_ip', $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_WARNINGS' => $post_info['user_warnings'] ? true : false, 'U_VIEW_PROFILE' => generate_link('Members_List&mode=viewprofile&u=' . $post_info['user_id']), 'U_MCP_USERNOTES' => generate_link('Forums&file=mcp&i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARNINGS' => generate_link('Forums&file=mcp&i=warnings&mode=view_user&u=' . $post_info['user_id']), 'U_EDIT' => $_CLASS['auth']->acl_get('m_edit', $post_info['forum_id']) ? generate_link("Forums&file=posting&mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', 'REPORTED_IMG' => $_CLASS['core_user']->img('icon_reported', $_CLASS['core_user']->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $_CLASS['core_user']->img('icon_unapproved', $_CLASS['core_user']->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $_CLASS['core_user']->img('btn_edit', $_CLASS['core_user']->lang['EDIT_POST']), 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $_CLASS['core_user']->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => @gethostbyaddr($post_info['poster_ip']), 'POST_ID' => $post_info['post_id']));
$this->display($_CLASS['core_user']->lang['MCP_QUEUE'], 'mcp_post.html');
break;
case 'unapproved_topics':
case 'unapproved_posts':
$forum_info = array();
$forum_list_approve = get_forum_list('m_approve', false, true);
if (!$forum_id) {
$forum_list = array();
foreach ($forum_list_approve as $row) {
$forum_list[] = $row['forum_id'];
}
if (!($forum_list = implode(', ', $forum_list))) {
trigger_error('NOT_MODERATOR');
}
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
FROM ' . FORUMS_FORUMS_TABLE . "\n\t\t\t\t\t\tWHERE forum_id IN ({$forum_list})";
$result = $_CLASS['core_db']->query($sql);
$row = $_CLASS['core_db']->fetch_row_assoc($result);
$_CLASS['core_db']->free_result($result);
$forum_info['forum_topics'] = (int) $row['sum_forum_topics'];
} else {
$forum_info = get_forum_data(array($forum_id), 'm_approve');
if (!sizeof($forum_info)) {
trigger_error('NOT_MODERATOR');
}
$forum_info = $forum_info[$forum_id];
$forum_list = $forum_id;
}
$forum_options = '<option value="0"' . ($forum_id == 0 ? ' selected="selected"' : '') . '>' . $_CLASS['core_user']->lang['ALL_FORUMS'] . '</option>';
foreach ($forum_list_approve as $row) {
$forum_options .= '<option value="' . $row['forum_id'] . '"' . ($forum_id == $row['forum_id'] ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
}
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id);
$forum_topics = $total == -1 ? $forum_info['forum_topics'] : $total;
$limit_time_sql = $sort_days ? 'AND t.topic_last_post_time >= ' . (time() - $sort_days * 86400) : '';
if ($mode == 'unapproved_posts') {
$sql = 'SELECT p.post_id
FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_TOPICS_TABLE . ' t' . ($sort_order_sql[0] == 'u' ? ', ' . USERS_TABLE . ' u' : '') . "\n\t\t\t\t\t\tWHERE p.forum_id IN ({$forum_list})\n\t\t\t\t\t\t\tAND p.post_approved = 0\n\t\t\t\t\t\t\t" . ($sort_order_sql[0] == 'u' ? 'AND u.user_id = p.poster_id' : '') . "\n\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\tAND t.topic_first_post_id <> p.post_id\n\t\t\t\t\t\tORDER BY {$sort_order_sql}";
$result = $_CLASS['core_db']->query_limit($sql, $config['topics_per_page'], $start);
$i = 0;
$post_ids = array();
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$post_ids[] = $row['post_id'];
$row_num[$row['post_id']] = $i++;
}
if (sizeof($post_ids)) {
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, p.post_id, p.post_username, p.poster_id, p.post_time, u.username
FROM ' . FORUMS_POSTS_TABLE . ' p, ' . FORUMS_FORUMS_TABLE . ' f, ' . FORUMS_TOPICS_TABLE . ' t, ' . USERS_TABLE . " u\n\t\t\t\t\t\t\tWHERE p.post_id IN (" . implode(', ', $post_ids) . ")\n\t\t\t\t\t\t\t\tAND t.topic_id = p.topic_id\n\t\t\t\t\t\t\t\tAND f.forum_id = p.forum_id\n\t\t\t\t\t\t\t\tAND u.user_id = p.poster_id";
$result = $_CLASS['core_db']->query($sql);
$post_data = $rowset = array();
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$post_data[$row['post_id']] = $row;
//.........这里部分代码省略.........
示例12: save_raw_post_func
//.........这里部分代码省略.........
trigger_error('NOT_AUTHORISED');
}
$forum_id = $to_forum_id;
}
}
}
// Lock/Unlock Topic
$change_topic_status = $post_data['topic_status'];
$perm_lock_unlock = $auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED ? true : false;
if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) {
$change_topic_status = ITEM_UNLOCKED;
} else {
if ($post_data['topic_status'] == ITEM_UNLOCKED && $topic_lock && $perm_lock_unlock) {
$change_topic_status = ITEM_LOCKED;
}
}
if ($change_topic_status != $post_data['topic_status']) {
$sql = 'UPDATE ' . TOPICS_TABLE . "\r\r\n SET topic_status = {$change_topic_status}\r\r\n WHERE topic_id = {$topic_id}\r\r\n AND topic_moved_id = 0";
$db->sql_query($sql);
$user_lock = $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster'] ? 'USER_' : '';
add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . ($change_topic_status == ITEM_LOCKED ? 'LOCK' : 'UNLOCK'), $post_data['topic_title']);
}
// Lock/Unlock Post Edit
if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_LOCKED && !$post_lock && $auth->acl_get('m_edit', $forum_id)) {
$post_data['post_edit_locked'] = ITEM_UNLOCKED;
} else {
if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_UNLOCKED && $post_lock && $auth->acl_get('m_edit', $forum_id)) {
$post_data['post_edit_locked'] = ITEM_LOCKED;
}
}
$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' => (int) $post_id, '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'] : time(), 'post_checksum' => isset($post_data['post_checksum']) ? (string) $post_data['post_checksum'] : '', 'post_edit_reason' => $post_data['post_edit_reason'], 'post_edit_user' => $mode == 'edit' ? $user->data['user_id'] : (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, '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);
$data['topic_replies_real'] = $post_data['topic_replies_real'];
$data['topic_replies'] = $post_data['topic_replies'];
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$cwd = getcwd();
chdir('../');
$redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);
chdir($cwd);
// 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('/&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(?:="(.*?)")?:' . $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');
}
$xmlrpc_reply_topic = new xmlrpcval(array('result' => new xmlrpcval($reply_success, 'boolean'), 'state' => new xmlrpcval($approved ? 0 : 1, 'int'), 'post_title' => new xmlrpcval($updated_post_title, 'base64'), 'post_content' => new xmlrpcval(post_html_clean($message), 'base64')), 'struct');
return new xmlrpcresp($xmlrpc_reply_topic);
}
示例13: array
} else {
$sql = "SELECT * FROM " . SITE_PAGES . " WHERE parent={$page['page_id']} ORDER BY page_name ASC";
$result = $db->sql_query($sql);
$subpages = array();
while ($sub_row = $db->sql_fetchrow($result)) {
$subpages[] = '<a href="./index.php?page=' . $page['page_identifier'] . '/' . $sub_row['page_identifier'] . '">' . $sub_row['page_name'] . '</a>';
}
$subpages_list = (string) implode(', ', $subpages);
$has_subpages = sizeof($subpages) ? true : false;
$bbcode_bitfield = $page['bbcode_bitfield'] | base64_decode($page['bbcode_bitfield']);
if ($bbcode_bitfield !== '') {
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
// Parse the message and subject
$page_text = censor_text($page['page_text']);
// Second parse bbcode here
if ($page['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($page_text, $page['bbcode_uid'], $page['bbcode_bitfield']);
}
$page_text = bbcode_nl2br($page_text);
$page_text = smiley_text($page_text);
$page_name = $page['page_name'] = censor_text($page['page_name']);
page_header(ucfirst($page_name));
$page_time = date($user->data['user_dateformat'], $page['last_updated']);
$template->assign_vars(array('PAGE_NAME' => $page_name, 'PAGE_TEXT' => $page_text, 'PAGE_TIME' => $page_time, 'HAS_SUBPAGES' => $has_subpages, 'SUBPAGES' => $subpages_list));
}
}
$home_link = "{$phpbb_root_path}../index.php";
$template->assign_vars(array('U_SITE_INDEX' => $home_link, 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group using <a href="http://rayth-mods.com" target="_blank">Rayth\'s Content Management System</a>')));
$template->set_filenames(array('body' => $template_file));
page_footer();
示例14: display_comments
protected function display_comments($image_id, $image_data, $album_id, $album_data, $start, $limit)
{
$sort_order = $this->request->variable('sort_order', 'ASC') == 'ASC' ? 'ASC' : 'DESC';
$this->template->assign_vars(array('S_ALLOWED_READ_COMMENTS' => true, 'IMAGE_COMMENTS' => $image_data['image_comments'], 'SORT_ASC' => $sort_order == 'ASC' ? true : false));
if ($image_data['image_comments'] > 0) {
if (!class_exists('bbcode')) {
$this->url->_include('bbcode', 'phpbb');
}
$bbcode = new \bbcode();
$comments = $users = $user_cache = array();
$users[] = $image_data['image_user_id'];
$sql = 'SELECT *
FROM ' . $this->table_comments . '
WHERE comment_image_id = ' . $image_id . '
ORDER BY comment_id ' . $sort_order;
$result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result)) {
$comments[] = $row;
$users[] = $row['comment_user_id'];
if ($row['comment_edit_count'] > 0) {
$users[] = $row['comment_edit_user_id'];
}
}
$this->db->sql_freeresult($result);
$users = array_unique($users);
$sql = $this->db->sql_build_query('SELECT', array('SELECT' => 'u.*, gu.personal_album_id, gu.user_images', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array($this->table_users => 'gu'), 'ON' => 'gu.user_id = u.user_id')), 'WHERE' => $this->db->sql_in_set('u.user_id', $users)));
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->gallery_user->add_user_to_cache($user_cache, $row);
}
$this->db->sql_freeresult($result);
if ($this->config['load_onlinetrack'] && sizeof($users)) {
// Load online-information
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $this->db->sql_in_set('session_user_id', $users) . '
GROUP BY session_user_id';
$result = $this->db->sql_query($sql);
$update_time = $this->config['load_online_time'] * 60;
while ($row = $this->db->sql_fetchrow($result)) {
$user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $this->auth->acl_get('u_viewonline')) ? true : false;
}
$this->db->sql_freeresult($result);
}
foreach ($comments as $row) {
$edit_info = '';
if ($row['comment_edit_count'] > 0) {
$edit_info = $row['comment_edit_count'] == 1 ? $this->user->lang['EDITED_TIME_TOTAL'] : $this->user->lang['EDITED_TIMES_TOTAL'];
$edit_info = sprintf($edit_info, get_username_string('full', $user_cache[$row['comment_edit_user_id']]['user_id'], $user_cache[$row['comment_edit_user_id']]['username'], $user_cache[$row['comment_edit_user_id']]['user_colour']), $this->user->format_date($row['comment_edit_time'], false, true), $row['comment_edit_count']);
}
$user_id = $row['comment_user_id'];
$user_deleted = isset($user_cache[$user_id]) ? false : true;
if (!$user_deleted) {
if ($user_cache[$user_id]['sig'] && empty($user_cache[$user_id]['sig_parsed'])) {
$user_cache[$user_id]['sig'] = censor_text($user_cache[$user_id]['sig']);
if ($user_cache[$user_id]['sig_bbcode_bitfield']) {
$bbcode->bbcode_second_pass($user_cache[$user_id]['sig'], $user_cache[$user_id]['sig_bbcode_uid'], $user_cache[$user_id]['sig_bbcode_bitfield']);
}
$user_cache[$user_id]['sig'] = bbcode_nl2br($user_cache[$user_id]['sig']);
$user_cache[$user_id]['sig'] = smiley_text($user_cache[$user_id]['sig']);
$user_cache[$user_id]['sig_parsed'] = true;
}
}
$this->template->assign_block_vars('commentrow', array('U_COMMENT' => $this->helper->route('phpbbgallery_image', array('image_id' => $image_id)), 'COMMENT_ID' => $row['comment_id'], 'TIME' => $this->user->format_date($row['comment_time']), 'TEXT' => generate_text_for_display($row['comment'], $row['comment_uid'], $row['comment_bitfield'], 7), 'EDIT_INFO' => $edit_info, 'U_DELETE' => $this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id']) || $this->gallery_auth->acl_check('c_delete', $album_id, $album_data['album_user_id']) && $row['comment_user_id'] == $this->user->data['user_id'] && $this->user->data['is_registered'] ? $this->helper->route('phpbbgallery_comment_delete', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', 'U_QUOTE' => $this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id']) ? $this->helper->route('phpbbgallery_comment_add', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', 'U_EDIT' => $this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id']) || $this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id']) && $row['comment_user_id'] == $this->user->data['user_id'] && $this->user->data['is_registered'] ? $this->helper->route('phpbbgallery_comment_edit', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', 'U_INFO' => $this->auth->acl_get('a_') ? $this->url->append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', 'POST_AUTHOR_FULL' => get_username_string('full', $user_id, $row['comment_username'], $user_deleted ? '' : $user_cache[$user_id]['user_colour']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $user_id, $row['comment_username'], $user_deleted ? '' : $user_cache[$user_id]['user_colour']), 'POST_AUTHOR' => get_username_string('username', $user_id, $row['comment_username'], $user_deleted ? '' : $user_cache[$user_id]['user_colour']), 'U_POST_AUTHOR' => get_username_string('profile', $user_id, $row['comment_username'], $user_deleted ? '' : $user_cache[$user_id]['user_colour']), 'SIGNATURE' => $row['comment_signature'] && !$user_deleted ? $user_cache[$user_id]['sig'] : '', 'RANK_TITLE' => $user_deleted ? '' : $user_cache[$user_id]['rank_title'], 'RANK_IMG' => $user_deleted ? '' : $user_cache[$user_id]['rank_image'], 'RANK_IMG_SRC' => $user_deleted ? '' : $user_cache[$user_id]['rank_image_src'], 'POSTER_JOINED' => $user_deleted ? '' : $user_cache[$user_id]['joined'], 'POSTER_POSTS' => $user_deleted ? '' : $user_cache[$user_id]['posts'], 'POSTER_FROM' => isset($user_cache[$user_id]['from']) ? $user_cache[$user_id]['from'] : '', 'POSTER_AVATAR' => $user_deleted ? '' : $user_cache[$user_id]['avatar'], 'POSTER_WARNINGS' => $user_deleted ? '' : $user_cache[$user_id]['warnings'], 'POSTER_AGE' => $user_deleted ? '' : $user_cache[$user_id]['age'], 'ICQ_STATUS_IMG' => isset($user_cache[$user_id]['icq_status_img']) ? $user_cache[$user_id]['icq_status_img'] : '', 'ONLINE_IMG' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? '' : ($user_deleted ? '' : ($user_cache[$user_id]['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))), 'S_ONLINE' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? false : ($user_deleted ? '' : ($user_cache[$user_id]['online'] ? true : false)), 'U_PROFILE' => $user_deleted ? '' : $user_cache[$user_id]['profile'], 'U_SEARCH' => $user_deleted ? '' : $user_cache[$user_id]['search'], 'U_PM' => !$user_deleted && $user_id != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($user_cache[$user_id]['allow_pm'] || $this->auth->acl_gets('a_', 'm_')) ? $this->url->append_sid('phpbb', 'ucp', 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $user_deleted ? '' : $user_cache[$user_id]['email'], 'U_WWW' => isset($user_cache[$user_id]['www']) ? $user_cache[$user_id]['www'] : '', 'U_ICQ' => isset($user_cache[$user_id]['icq']) ? $user_cache[$user_id]['icq'] : '', 'U_AIM' => isset($user_cache[$user_id]['aim']) ? $user_cache[$user_id]['aim'] : '', 'U_MSN' => isset($user_cache[$user_id]['msn']) ? $user_cache[$user_id]['msn'] : '', 'U_YIM' => isset($user_cache[$user_id]['yim']) ? $user_cache[$user_id]['yim'] : '', 'U_JABBER' => isset($user_cache[$user_id]['jabber']) ? $user_cache[$user_id]['jabber'] : '', 'U_GALLERY' => $user_deleted ? '' : $user_cache[$user_id]['gallery_album'], 'GALLERY_IMAGES' => $user_deleted ? '' : $user_cache[$user_id]['gallery_images'], 'U_GALLERY_SEARCH' => $user_deleted ? '' : $user_cache[$user_id]['gallery_search']));
}
$this->db->sql_freeresult($result);
$this->pagination->generate_template_pagination(array('routes' => array('phpbbgallery_image', 'phpbbgallery_image_page'), 'params' => array('image_id' => $image_id)), 'pagination', 'page', $image_data['image_comments'], $limit, $start);
$this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('VIEW_IMAGE_COMMENTS', $image_data['image_comments'])));
}
}
示例15: get_content
function get_content($forum, $topic)
{
global $db, $user, $phpbb_root_path, $config, $template, $phpEx;
$search_limit = 1;
$bbcode_bitfield = '';
$forum_id = array($forum);
$topic_id = array($topic);
$forum_id_where = create_where_clauses($forum_id, 'forum');
$topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array('SELECT' => 'p.*, t.*, u.username, u.user_colour', 'FROM' => array(POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = p.poster_id'), array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id')), 'WHERE' => str_replace(array('WHERE ', 'topic_id'), array('', 't.topic_id'), $topic_id_where) . '
AND t.topic_status <> ' . ITEM_MOVED . '
AND t.topic_approved = 1', 'ORDER_BY' => 'p.post_id DESC');
$posts = $db->sql_build_query('SELECT', $posts_ary);
$posts_result = $db->sql_query_limit($posts, $search_limit);
while ($posts_row = $db->sql_fetchrow($posts_result)) {
$topic_title = $posts_row['topic_title'];
$post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']);
$post_date = $user->format_date($posts_row['post_time']);
$post_link = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']);
$post_text = nl2br($posts_row['post_text']);
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
$post_text = smiley_text($post_text);
$info = array('TOPIC_TITLE' => '<a href="' . $post_link . '">' . censor_text($topic_title) . '</a>', 'POST_AUTHOR' => $post_author, 'POST_DATE' => $post_date, 'POST_LINK' => '<a href="' . $post_link . '"><img src="./images/extras/link-url.png"></a> ', 'POST_TEXT' => censor_text($post_text));
/*
$template->assign_block_vars('web_pages', array(
'TOPIC_TITLE' => censor_text($topic_title),
'POST_AUTHOR' => $post_author,
'POST_DATE' => $post_date,
'POST_LINK' => $post_link,
'POST_TEXT' => censor_text($post_text),
));
*/
}
// we could return an array with all the info ??
//$topic_title = censor_text($topic_title);
//return($post_text);
return $info;
}