本文整理汇总了PHP中parse_message::format_display方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::format_display方法的具体用法?PHP parse_message::format_display怎么用?PHP parse_message::format_display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse_message
的用法示例。
在下文中一共展示了parse_message::format_display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $config, $request, $template, $user, $phpbb_container;
global $phpbb_root_path, $phpEx;
$config_text = $phpbb_container->get('config_text');
$this->page_title = 'ACP_POSTS_MERGING';
$this->tpl_name = 'acp_posts_merging';
$submit = isset($_POST['submit']) ? true : false;
$preview = isset($_POST['preview']) ? true : false;
$form_key = 'config_posts_merging';
add_form_key($form_key);
$display_vars = array('title' => 'ACP_POSTS_MERGING', 'vars' => array('legend1' => 'GENERAL_OPTIONS', 'merge_interval' => array('lang' => 'MERGE_INTERVAL', 'validate' => 'int:0', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['HOURS']), 'merge_no_forums' => array('lang' => 'MERGE_NO_FORUMS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_merge_no_forums', 'explain' => true), 'merge_no_topics' => array('lang' => 'MERGE_NO_TOPICS', 'validate' => 'string', 'type' => 'text:5:255', 'explain' => true), 'legend2' => 'MERGE_SEPARATOR'));
if (isset($display_vars['lang'])) {
$user->add_lang($display_vars['lang']);
}
$user->add_lang(array('posting'));
$this->new_config = $config;
$cfg_array = isset($_REQUEST['config']) ? $request->variable('config', array('' => ''), true) : $this->new_config;
$cfg_array['merge_no_forums'] = $submit ? implode(',', $request->variable('merge_no_forums', array('' => ''))) : $cfg_array['merge_no_forums'];
$posts_merging_separator_text = $request->variable('posts_merging_separator_text', '', true);
$error = array();
// We validate the complete config if wished
validate_config_vars($display_vars['vars'], $cfg_array, $error);
if ($submit && !check_form_key($form_key)) {
$error[] = $user->lang['FORM_INVALID'];
}
// Do not write values if there is an error
if (sizeof($error)) {
$submit = false;
}
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null) {
if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
continue;
}
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($submit) {
$config->set($config_name, $config_value);
}
}
if ($submit) {
$config_text->set('posts_merging_separator_text', $posts_merging_separator_text);
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
// Output relevant page
foreach ($display_vars['vars'] as $config_key => $vars) {
if (!is_array($vars) && strpos($config_key, 'legend') === false) {
continue;
}
if (strpos($config_key, 'legend') !== false) {
$template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
continue;
}
$type = explode(':', $vars['type']);
$l_explain = '';
if ($vars['explain'] && isset($vars['lang_explain'])) {
$l_explain = isset($user->lang[$vars['lang_explain']]) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
} else {
if ($vars['explain']) {
$l_explain = isset($user->lang[$vars['lang'] . '_EXPLAIN']) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
}
}
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
if (empty($content)) {
continue;
}
$template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
unset($display_vars['vars'][$config_key]);
}
$posts_merging_separator_text = $posts_merging_separator_text ?: $config_text->get('posts_merging_separator_text');
include_once $phpbb_root_path . 'includes/functions_display.' . $phpEx;
/*
* Constant preview
*/
include_once $phpbb_root_path . 'includes/message_parser.' . $phpEx;
// Prepare message separator
$user->add_lang_ext('rxu/PostsMerging', 'posts_merging');
// Calculate the time interval
$helper = $phpbb_container->get('rxu.PostsMerging.helper');
$current_time = time();
$interval = $helper->get_time_interval(strtotime('3 hours 17 minutes 56 seconds'), $current_time);
$time = array();
$time[] = $interval->h ? $user->lang('D_HOURS', $interval->h) : null;
$time[] = $interval->i ? $user->lang('D_MINUTES', $interval->i) : null;
$time[] = $interval->s ? $user->lang('D_SECONDS', $interval->s) : null;
// Allow using language variables like {L_LANG_VAR}
$posts_merging_separator_text_prewiew = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($matches) {
global $user;
return $user->lang($matches[1]);
}, $posts_merging_separator_text);
// Eval linefeeds and generate the separator, time interval included
$posts_merging_separator_text_prewiew = sprintf(str_replace('\\n', "\n", $posts_merging_separator_text_prewiew), implode(' ', $time));
$message_parser = new \parse_message($posts_merging_separator_text_prewiew);
// Allowing Quote BBCode
$message_parser->parse(true, true, true, true, true, true, true, true);
// Now parse it for displaying
$separator_preview = $message_parser->format_display(true, true, true, false);
unset($message_parser);
$template->assign_vars(array('SEPARATOR_PREVIEW' => $separator_preview));
/*
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
if ($dh) {
while (($file = readdir($dh)) !== false) {
if (file_exists($phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx)) {
// Inside of the style.php file, add to the $available_styles array
include $phpbb_root_path . 'blog/styles/' . $file . '/style.' . $phpEx;
}
}
closedir($dh);
}
foreach ($available_styles as $row) {
if (isset($user_settings[$user->data['user_id']]) && $user_settings[$user->data['user_id']]['blog_style'] == $row['value'] && isset($row['demo']) && $row['demo']) {
$default_demo = $row['demo'];
}
$template->assign_block_vars('blog_styles', array('VALUE' => $row['value'], 'SELECTED' => isset($user_settings[$user->data['user_id']]) && $user_settings[$user->data['user_id']]['blog_style'] == $row['value'] ? true : false, 'NAME' => $row['name'], 'BLOG_CSS' => isset($row['blog_css']) && $row['blog_css'] ? true : false, 'DEMO' => isset($row['demo']) && $row['demo'] ? $row['demo'] : ''));
}
}
$template->assign_vars(array('S_BLOG_INSTANT_REDIRECT' => isset($user_settings[$user->data['user_id']]) ? $user_settings[$user->data['user_id']]['instant_redirect'] : 0, 'S_SUBSCRIPTIONS' => $config['user_blog_subscription_enabled'] ? true : false, 'S_BLOG_STYLE' => isset($available_styles) && sizeof($available_styles) > 1 ? true : false, 'S_BLOG_CSS' => $auth->acl_get('u_blog_css') ? true : false, 'DEFAULT_DEMO' => isset($default_demo) ? $default_demo : $phpbb_root_path . 'images/spacer.gif', 'BLOG_CSS' => isset($user_settings[$user->data['user_id']]) ? $user_settings[$user->data['user_id']]['blog_css'] : ''));
}
break;
case 'ucp_blog_permissions':
if (!$config['user_blog_user_permissions']) {
$error[] = $user->lang['USER_PERMISSIONS_DISABLED'];
$template->assign_vars(array('PERMISSIONS_DISABLED' => true));
} else {
if ($submit) {
$sql_ary = array('perm_guest' => request_var('perm_guest', 1), 'perm_registered' => request_var('perm_registered', 2), 'perm_foe' => request_var('perm_foe', 0), 'perm_friend' => request_var('perm_friend', 2));
update_user_blog_settings($user->data['user_id'], $sql_ary, isset($_POST['resync']) ? true : false);
} else {
permission_settings_builder();
}
}
break;
case 'ucp_blog_title_description':
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
include $phpbb_root_path . 'blog/includes/functions_posting.' . $phpEx;
if (!function_exists('display_custom_bbcodes')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
$user->add_lang('posting');
$post_options = new post_options();
$post_options->set_status(true, true, true);
$post_options->set_in_template();
if ($submit || $preview) {
// see if they tried submitting a message or suject(if they hit preview or submit) put it in an array for consistency with the edit mode
$blog_title = utf8_normalize_nfc(request_var('title', '', true));
$blog_description = utf8_normalize_nfc(request_var('message', '', true));
// set up the message parser to parse BBCode, Smilies, etc
$message_parser = new parse_message();
$message_parser->message = $blog_description;
$message_parser->parse($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies, $post_options->img_status, $post_options->flash_status, $post_options->bbcode_status, $post_options->url_status);
} else {
if (isset($user_settings[$user->data['user_id']])) {
$blog_title = $user_settings[$user->data['user_id']]['title'];
$blog_description = $user_settings[$user->data['user_id']]['description'];
decode_message($blog_description, $user_settings[$user->data['user_id']]['description_bbcode_uid']);
} else {
$blog_title = $blog_description = '';
}
}
if (!$submit || sizeof($error)) {
if ($preview && !sizeof($error)) {
$preview_message = $message_parser->format_display($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies, false);
// output some data to the template parser
$template->assign_vars(array('S_DISPLAY_PREVIEW' => true, 'PREVIEW_SUBJECT' => censor_text($blog_title), 'PREVIEW_MESSAGE' => $preview_message, 'POST_DATE' => $user->format_date(time())));
}
// Generate smiley listing
generate_smilies('inline', false);
// Build custom bbcodes array
display_custom_bbcodes();
$template->assign_vars(array('S_PREVIEW_BUTTON' => true, 'TITLE' => $blog_title, 'MESSAGE' => $blog_description));
} else {
if ($submit) {
$sql_ary = array('user_id' => $user->data['user_id'], 'title' => $blog_title, 'description' => $message_parser->message, 'description_bbcode_bitfield' => $message_parser->bbcode_bitfield, 'description_bbcode_uid' => $message_parser->bbcode_uid);
unset($message_parser);
update_user_blog_settings($user->data['user_id'], $sql_ary);
}
}
break;
default:
$default = true;
$temp = compact('mode', 'error', 'default');
blog_plugins::plugin_do_ref('ucp_default', $temp);
// make sure you set default to false if you use your own page
extract($temp);
if ($default) {
trigger_error('NO_MODE');
}
}
blog_plugins::plugin_do('ucp_end');
if ($submit && !sizeof($error)) {
//$cache->destroy('_blog_settings_' . $user->data['user_id']);
meta_refresh(3, $this->u_action);
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('L_TITLE' => $user->lang[strtoupper($mode)], 'L_TITLE_EXPLAIN' => $user->lang[strtoupper($mode) . '_EXPLAIN'], 'ERROR' => sizeof($error) ? implode($error, '<br />') : false, 'MODE' => $mode, 'S_UCP_ACTION' => $this->u_action));
$this->tpl_name = 'blog/ucp_blog';
$this->page_title = strtoupper($mode);
}
示例3: main
//.........这里部分代码省略.........
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_RANK' => true, 'S_RANK_OPTIONS' => $s_rank_options));
break;
case 'sig':
include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$enable_bbcode = $config['allow_sig_bbcode'] ? request_var('enable_bbcode', $this->optionget($user_row, 'bbcode')) : false;
$enable_smilies = $config['allow_sig_smilies'] ? request_var('enable_smilies', $this->optionget($user_row, 'smilies')) : false;
$enable_urls = request_var('enable_urls', true);
$signature = request_var('signature', $user_row['user_sig'], true);
$preview = isset($_POST['preview']) ? true : false;
if ($submit || $preview) {
include_once $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
if (sizeof($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
if (!sizeof($error) && $submit) {
$sql_ary = array('user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
$db->sql_query($sql);
trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$signature_preview = '';
if ($preview) {
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
decode_message($signature, $user_row['user_sig_bbcode_uid']);
$template->assign_vars(array('S_SIGNATURE' => true, 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? 'checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies']));
break;
case 'attach':
$start = request_var('start', 0);
$deletemark = isset($_POST['delmarked']) ? true : false;
$marked = request_var('mark', array(0));
// Sort keys
$sort_key = request_var('sk', 'a');
$sort_dir = request_var('sd', 'd');
if ($deletemark && sizeof($marked)) {
if (confirm_box(true)) {
$sql = 'SELECT real_filename
FROM ' . ATTACHMENTS_TABLE . '
WHERE attach_id IN (' . implode(', ', $marked) . ')';
$result = $db->sql_query($sql);
$log_attachments = array();
while ($row = $db->sql_fetchrow($result)) {
$log_attachments[] = $row['real_filename'];
}
$db->sql_freeresult($result);
delete_attachments('attach', $marked);
$log = sizeof($log_attachments) == 1 ? 'ATTACHMENT_DELETED' : 'ATTACHMENTS_DELETED';
$message = sizeof($log_attachments) == 1 ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED'];
add_log('admin', $log, implode(', ', $log_attachments));
trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id));
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'deletemark' => true, 'mark' => $marked)));
}
}
示例4: isset
//.........这里部分代码省略.........
$enable_html = true ? !isset($_POST['disable_html']) : false;
$enable_bbcode = true ? !isset($_POST['disable_bbcode']) : false;
$enable_smilies = true ? !isset($_POST['disable_smilies']) : false;
$enable_urls = !isset($_POST['disable_magic_url']);
$signature = get_variable('signature', 'POST', $_CLASS['core_user']->data['user_sig']);
$signature_preview = '';
$sql_array = false;
if ($submit || $preview) {
require_once $site_file_root . 'includes/forums/message_parser.php';
if ($signature) {
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
if (!empty($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
}
if (empty($error) && $submit) {
if ($signature && !empty($message_parser->message)) {
$sql_array = array('user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield);
} else {
$sql_array = array('user_sig' => (string) '', 'user_sig_bbcode_uid' => (string) '', 'user_sig_bbcode_bitfield' => (int) 0);
}
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_array) . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
$_CLASS['core_db']->sql_query($sql);
$message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
trigger_error($message);
}
}
if ($preview && $signature) {
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
if ($signature) {
decode_message($signature, $_CLASS['core_user']->data['user_sig_bbcode_uid']);
}
$_CLASS['core_template']->assign_array(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_HTML_CHECKED' => $enable_html ? '' : 'checked="checked"', 'S_BBCODE_CHECKED' => $enable_bbcode ? '' : 'checked="checked"', 'S_SMILIES_CHECKED' => $enable_smilies ? '' : 'checked="checked"', 'S_MAGIC_URL_CHECKED' => $enable_urls ? '' : 'checked="checked"', 'HTML_STATUS' => true ? $_CLASS['core_user']->get_lang('HTML_IS_ON') : $_CLASS['core_user']->get_lang('HTML_IS_OFF'), 'BBCODE_STATUS' => true ? sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_ON'), '<a href="' . generate_link('Forums&file=faq&mode=bbcode') . '" target="_phpbbcode">', '</a>') : sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_OFF'), '<a href="' . generate_link('Forums&file=faq&mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => true ? $_CLASS['core_user']->get_lang('SMILIES_ARE_ON') : $_CLASS['core_user']->get_lang('SMILIES_ARE_OFF'), 'IMG_STATUS' => true ? $_CLASS['core_user']->get_lang('IMAGES_ARE_ON') : $_CLASS['core_user']->get_lang('IMAGES_ARE_OFF'), 'FLASH_STATUS' => true ? $_CLASS['core_user']->get_lang('FLASH_IS_ON') : $_CLASS['core_user']->get_lang('FLASH_IS_OFF'), 'L_SIGNATURE_EXPLAIN' => sprintf($_CLASS['core_user']->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_HTML_ALLOWED' => true, 'S_BBCODE_ALLOWED' => true, 'S_SMILIES_ALLOWED' => true));
break;
case 'avatar':
$display_gallery = isset($_POST['display_gallery']);
$folder = isset($_POST['category']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['category']) : false;
$delete = isset($_POST['delete']);
// Can we upload?
$can_upload = file_exists($config['avatar_path']) && is_writeable($config['avatar_path']) && @ini_get('file_uploads') ? true : false;
if ($submit) {
$gallery_avatar = isset($_POST['avatarselect']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['avatarselect']) : false;
if ($config['allow_avatar_local'] && $gallery_avatar) {
if (!file_exists($config['avatar_gallery_path'] . '/' . $gallery_avatar)) {
$error[] = 'BAD_AVATAR';
} else {
$type = AVATAR_GALLERY;
$filename = $gallery_avatar;
list($width, $height) = getimagesize($config['avatar_gallery_path'] . '/' . $gallery_avatar);
}
} else {
$data['uploadurl'] = get_variable('uploadurl', 'POST', false);
$data['remotelink'] = get_variable('remotelink', 'POST', '');
$data['width'] = get_variable('width', 'POST', '');
$data['height'] = get_variable('height', 'POST', '');
$data['user_id'] = $_CLASS['core_user']->data['user_id'];
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
list($type, $filename, $width, $height) = avatar_upload($data, $error);
} elseif ($data['remotelink'] && $config['allow_avatar_remote']) {
示例5: array
}
// Get submitted data
$comment_data = array('comment_subject' => utf8_normalize_nfc(request_var('comment_subject', '', true)), 'comment_message' => utf8_normalize_nfc(request_var('comment_message', '', true)), 'enable_bbcode' => isset($_POST['disable_bbcode']) ? 0 : 1, 'enable_smilies' => isset($_POST['disable_smilies']) ? 0 : 1, 'enable_magic_url' => isset($_POST['disable_magic_url']) ? 0 : 1);
// Run checks
if (isset($_POST['preview']) || isset($_POST['submit'])) {
$message_parser = new parse_message();
$message_parser->message =& $comment_data['comment_message'];
$message_md5 = md5($message_parser->message);
$message_parser->parse($comment_data['enable_bbcode'], $config['allow_post_links'] ? $comment_data['enable_magic_url'] : false, $comment_data['enable_smilies'], $auth->acl_get('f_img', $report['forum_id']), $auth->acl_get('f_flash', $report['forum_id']), true, $config['allow_post_links']);
if (sizeof($message_parser->warn_msg)) {
$error = $message_parser->warn_msg;
}
}
// Preview comment
if (isset($_POST['preview']) && !empty($comment_data['comment_message'])) {
$template->assign_vars(array('PREVIEW_TEXT' => $message_parser->format_display($comment_data['enable_bbcode'], $comment_data['enable_magic_url'], $comment_data['enable_smilies'], false), 'S_PREVIEW' => true));
}
// Post comment
if (isset($_POST['submit'])) {
if (!check_form_key('add_comment')) {
trigger_error('FORM_INVALID');
}
$poll = false;
$data = array('forum_id' => $report['forum_id'], 'topic_id' => $report['topic_id'], 'topic_title' => $report['report_title'], 'icon_id' => 0, 'post_time' => time(), 'message' => $message_parser->message, 'message_md5' => $message_md5, 'bbcode_uid' => $message_parser->bbcode_uid, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'enable_bbcode' => $comment_data['enable_bbcode'], 'enable_smilies' => $comment_data['enable_smilies'], 'enable_urls' => $comment_data['enable_magic_url'], 'enable_sig' => 0, 'post_edit_locked' => 0, 'enable_indexing' => $report['enable_indexing'], 'forum_name' => $report['project_title'], 'notify' => false, 'notify_set' => false);
submit_post('reply', $comment_data['comment_subject'], '', $report['topic_type'], $poll, $data);
// Send out notifications
$notif_users = get_subscribed_users($report['forum_id'], $report['topic_id']);
send_notification($notif_users, 'bug_comment_added', array('REPORT_ID' => $report['report_id'], 'REPORT_TITLE' => $report['report_title'], 'PROJECT_TITLE' => $report['project_title'], 'U_REPORT' => generate_board_url() . '/' . $url_rewriter->rewrite("bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}"), 'U_COMMENT' => generate_board_url() . '/' . $url_rewriter->rewrite("bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}") . '#comment-' . $data['post_id'], 'PERFORMER' => $user->data['username']));
$redirect_url = append_sid("{$phpbb_root_path}bugs.{$phpEx}", "mode=report&project={$project_name}&report_id={$report_id}#comment-{$data['post_id']}");
meta_refresh(3, $redirect_url);
$message = sprintf($user->lang['COMMENT_ADDED'], '<a href="' . $redirect_url . '">', '</a>');
示例6: compose_pm
//.........这里部分代码省略.........
if (!sizeof($address_list)) {
$error[] = $user->lang['NO_RECIPIENT'];
}
}
// Store message, sync counters
if (!sizeof($error) && $submit) {
$pm_data = array('msg_id' => (int) $msg_id, 'from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'reply_from_root_level' => isset($post['root_level']) ? (int) $post['root_level'] : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, '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, 'address_list' => $address_list);
// ((!$message_subject) ? $subject : $message_subject)
$msg_id = submit_pm($action, $subject, $pm_data);
$return_message_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=view&p=' . $msg_id);
$inbox_folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=inbox');
$outbox_folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=outbox');
$folder_url = '';
if ($folder_id > 0 && isset($user_folders[$folder_id])) {
$folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&folder=' . $folder_id);
}
$return_box_url = $action === 'post' || $action === 'edit' ? $outbox_folder_url : $inbox_folder_url;
$return_box_lang = $action === 'post' || $action === 'edit' ? 'PM_OUTBOX' : 'PM_INBOX';
$save_message = $action === 'edit' ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED'];
$message = $save_message . '<br /><br />' . $user->lang('VIEW_PRIVATE_MESSAGE', '<a href="' . $return_message_url . '">', '</a>');
$last_click_type = 'CLICK_RETURN_FOLDER';
if ($folder_url) {
$message .= '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $folder_url . '">', '</a>', $user_folders[$folder_id]['folder_name']);
$last_click_type = 'CLICK_GOTO_FOLDER';
}
$message .= '<br /><br />' . sprintf($user->lang[$last_click_type], '<a href="' . $return_box_url . '">', '</a>', $user->lang[$return_box_lang]);
meta_refresh(3, $return_message_url);
trigger_error($message);
}
$message_subject = $subject;
}
// Preview
if (!sizeof($error) && $preview) {
$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
$preview_signature = $user->data['user_sig'];
$preview_signature_uid = $user->data['user_sig_bbcode_uid'];
$preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield'];
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature) {
$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
$parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']);
$preview_signature = $parse_sig->message;
unset($parse_sig);
} else {
$preview_signature = '';
}
// Attachment Preview
if (sizeof($message_parser->attachment_data)) {
$template->assign_var('S_HAS_ATTACHMENTS', true);
$update_count = array();
$attachment_data = $message_parser->attachment_data;
parse_attachments(false, $preview_message, $attachment_data, $update_count, true);
foreach ($attachment_data as $i => $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
unset($attachment_data);
}
$preview_subject = censor_text($subject);
if (!sizeof($error)) {
$template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
}
unset($message_text);
}
// Decode text for message display
示例7: main
//.........这里部分代码省略.........
if (!$auth->acl_get('u_sig')) {
trigger_error('NO_AUTH_SIGNATURE');
}
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$enable_bbcode = $config['allow_sig_bbcode'] ? request_var('enable_bbcode', $user->optionget('bbcode')) : false;
$enable_smilies = $config['allow_sig_smilies'] ? request_var('enable_smilies', $user->optionget('smilies')) : false;
$enable_urls = request_var('enable_urls', true);
$signature = request_var('signature', (string) $user->data['user_sig'], true);
if ($submit || $preview) {
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
if (!sizeof($error)) {
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, true, 'sig');
if (sizeof($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
if (!sizeof($error) && $submit) {
$sql_ary = array('user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$signature_preview = '';
if ($preview) {
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
decode_message($signature, $user->data['user_sig_bbcode_uid']);
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? 'checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '" onclick="target=\'_phpbbcode\';">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false));
// Build custom bbcodes array
$sql = 'SELECT bbcode_id, bbcode_tag
FROM ' . BBCODES_TABLE . '
WHERE display_on_posting = 1';
$result = $db->sql_query($sql);
$i = 0;
while ($row = $db->sql_fetchrow($result)) {
$template->assign_block_vars('custom_tags', array('BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => 22 + $i * 2, 'BBCODE_TAG' => $row['bbcode_tag']));
$i++;
}
$db->sql_freeresult($result);
break;
case 'avatar':
$display_gallery = isset($_POST['display_gallery']) ? true : false;
$delete = isset($_POST['delete']) ? true : false;
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
// Can we upload?
$can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
if ($submit) {
$var_ary = array('uploadurl' => (string) '', 'remotelink' => (string) '', 'width' => (string) '', 'height' => (string) '');
foreach ($var_ary as $var => $default) {
$data[$var] = request_var($var, $default);
}
$var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
$error = validate_data($data, $var_ary);
if (!sizeof($error)) {
$data['user_id'] = $user->data['user_id'];
示例8:
//$parser->parse(true, true, true);
//$o_m = $parser->format_display(true, true, true, false);
//$uid = $bitfield = $options = '';
//$allow_bbcode = $allow_urls = $allow_smilies = true;
//generate_text_for_storage($text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
//if ($bitfield)
////{
// $bbcode->bbcode_second_pass($text, $uid, $bitfield);
//}
//$text = bbcode_nl2br($text);
//$text = smiley_text($text);
// Parse and display new post text
if ($user->data['user_id'] != 1) {
$parser = new parse_message(utf8_normalize_nfc($text));
$parser->parse(true, true, true);
$content = $parser->format_display(true, true, true, false);
}
//else
//{
//$content = generate_text_for_display($text, $uid, $bitfield, 7);
//}
//$o_m = preg_replace(array('#<object(.*?)object>#is',
// '#<embed(.*?)embed>#is',
// '#<object(.*?)embed>#is',
// '#<embed(.*?)object>#is',
// '#<script(.*?)script>#is',
// '#<video(.*?)video>#is',
// '#<audio(.*?)audio>#is',
// '#<source(.*?)source>#is',
// '#<iframe(.*?)iframe>#is'),
// '<img src="'. $live_image_path . '/mm_bbcode.png" alt="" />',
示例9: getAliasSig
function getAliasSig($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $allowBBcode, $allowsiglinks, $allowsigsmiles)
{
if ($preview_signature) {
$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
//$parse_sig->format_display($allowBBcode, $allowsiglinks, $allowsigsmiles);
$parse_sig->format_display(1, 0, 0);
$preview_signature = $parse_sig->message;
unset($parse_sig);
} else {
$preview_signature = 'empty';
}
return $preview_signature;
}
示例10: compose_pm
//.........这里部分代码省略.........
$last_post_time = $_CLASS['core_user']->data['user_last_post_time'];
if ($last_post_time) {
if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
$error[] = $_CLASS['core_user']->lang['FLOOD_ERROR'];
}
}
}
// Subject defined
if (!$subject && !($remove_u || $remove_g || $add_to || $add_bcc)) {
$error[] = $_CLASS['core_user']->lang['EMPTY_SUBJECT'];
}
if (empty($address_list)) {
$error[] = $_CLASS['core_user']->lang['NO_RECIPIENT'];
}
if (!empty($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
// Store message, sync counters
if (empty($error) && $submit) {
$pm_data = array('msg_id' => (int) $msg_id, 'reply_from_root_level' => isset($root_level) ? (int) $root_level : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_html' => (bool) $enable_html, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'message_md5' => (int) $message_md5, 'bbcode_bitfield' => (int) $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, 'address_list' => $address_list);
unset($message_parser);
// ((!$message_subject) ? $subject : $message_subject)
$msg_id = submit_pm($action, $subject, $pm_data, $update_message);
$return_message_url = generate_link('Control_Panel&i=pm&mode=view_messages&action=view_message&p=' . $msg_id);
$return_folder_url = generate_link('Control_Panel&i=pm&folder=outbox');
$_CLASS['core_display']->meta_refresh(3, $return_message_url);
$message = $_CLASS['core_user']->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['VIEW_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($_CLASS['core_user']->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $_CLASS['core_user']->lang['PM_OUTBOX']);
trigger_error($message);
}
$message_subject = stripslashes($subject);
}
if (empty($error) && $preview) {
$post_time = $action == 'edit' ? $post_time : $current_time;
$preview_message = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
$preview_signature = $_CLASS['core_user']->data['user_sig'];
$preview_signature_uid = $_CLASS['core_user']->data['user_sig_bbcode_uid'];
$preview_signature_bitfield = $_CLASS['core_user']->data['user_sig_bbcode_bitfield'];
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature) {
$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
$parse_sig->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
$preview_signature = $parse_sig->message;
unset($parse_sig);
} else {
$preview_signature = '';
}
// Attachment Preview
if (!empty($message_parser->attachment_data)) {
require $site_file_root . 'includes/forums/functions_display.php';
$extensions = $update_count = array();
$_CLASS['core_template']->assign('S_HAS_ATTACHMENTS', true);
display_attachments(0, 'attachment', $message_parser->attachment_data, $update_count, true);
}
$preview_subject = censor_text($subject);
if (empty($error)) {
$_CLASS['core_template']->assign(array('POST_DATE' => $_CLASS['core_user']->format_date($post_time), 'PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
}
unset($message_text);
}
// Decode text for message display
$bbcode_uid = ($action == 'quote' || $action == 'forward') && !$preview && !$refresh && empty($error) ? $bbcode_uid : $message_parser->bbcode_uid;
$message_parser->decode_message($bbcode_uid);
if ($action == 'quote' && !$preview && !$refresh) {
$message_parser->message = '[quote="' . $quote_username . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
示例11: edit_article
/**
* Edit an article
*
* @param string $article URL of the article
* @return object
*/
public function edit_article($article)
{
// @TODO
$this->option['bbcode'] = $this->option['url'] = $this->option['img'] = $this->option['flash'] = $this->option['quote'] = $this->option['smilies'] = true;
// If no auth to edit, display error message
if (!$this->auth->acl_get('u_wiki_edit')) {
trigger_error('NO_ARTICLE');
}
// Setup message parser
$this->message_parser = $this->setup_parser();
// Get data for article
$this->data = $this->get_article_data($article);
// Article is a redirect and no auth to edit redirect
if (!empty($this->data['article_redirect']) && !$this->auth->acl_get('u_wiki_set_redirect')) {
trigger_error('NOT_AUTHORISED');
}
$this->user->add_lang('posting');
$preview = $this->request->is_set_post('preview');
$submit = $this->request->is_set_post('submit');
$error = array();
if ($preview || $submit) {
$this->data['article_title'] = $this->request->variable('title', '', true);
$this->data['article_text'] = $this->request->variable('message', '', true);
$this->data['article_description'] = $this->request->variable('article_description', '', true);
$this->data['article_edit_reason'] = $this->request->variable('edit_reason', '', true);
$this->data['article_sources'] = $this->request->variable('sources', '', true);
$this->data['article_topic_id'] = $this->auth->acl_get('u_wiki_edit_topic') ? $this->request->variable('topic_id', '', true) : $this->data['article_topic_id'];
$this->data['article_approved'] = $this->auth->acl_get('u_wiki_set_active') ? $this->request->variable('set_active', 0) : 0;
$this->data['article_sticky'] = $this->auth->acl_get('u_wiki_set_sticky') ? $this->request->variable('set_sticky', 0) : $this->data['article_sticky'];
$this->data['article_redirect'] = $this->auth->acl_get('u_wiki_set_redirect') ? $this->request->variable('article_redirect', '', true) : $this->data['article_redirect'];
$this->data['article_time_created'] = empty($this->data['article_time_created']) ? time() : $this->data['article_time_created'];
// Validate user input
$validate_array = array('article_title' => array('string', false, 1, 255), 'article_text' => array('string', false, $this->config['min_post_chars'], $this->config['max_post_chars']), 'article_edit_reason' => array('string', true, 0, 255), 'article_redirect' => array('string', true, 0, 255), 'article_description' => array('string', true, 0, 255), 'article_sources' => array('string', true, 0, 255));
if (!function_exists('validate_data')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$error = validate_data($this->data, $validate_array);
// Validate sources URL
$sources_array = explode("\n", $this->data['article_sources']);
foreach ($sources_array as $source) {
if (!empty($source) && !filter_var($source, FILTER_VALIDATE_URL)) {
$error[] = $this->user->lang['INVALID_SOURCE_URL'];
}
}
$this->message_parser->message = $this->data['article_text'];
}
if (sizeof($error)) {
$this->template->assign_vars(array('ERROR' => implode('<br />', $error)));
$this->display_edit_form(false);
} else {
if ($preview) {
$this->message_parser->parse($this->option['bbcode'], $this->option['url'], $this->option['smilies'], $this->option['img'], $this->option['flash'], $this->option['quote']);
$this->message_parser->format_display($this->option['bbcode'], $this->option['url'], $this->option['smilies']);
foreach ($sources_array as $source) {
if (!empty($source)) {
$this->template->assign_block_vars('article_sources', array('SOURCE' => $source));
}
}
$this->display_edit_form(true);
} else {
if ($submit) {
$this->message_parser->parse($this->option['bbcode'], $this->option['url'], $this->option['smilies'], $this->option['img'], $this->option['flash'], $this->option['quote']);
$sql_data = array('article_title' => $this->data['article_title'], 'article_url' => $article, 'article_text' => $this->message_parser->message, 'bbcode_uid' => $this->message_parser->bbcode_uid, 'bbcode_bitfield' => $this->message_parser->bbcode_bitfield, 'article_approved' => (int) $this->data['article_approved'], 'article_user_id' => (int) $this->user->data['user_id'], 'article_last_edit' => time(), 'article_time_created' => $this->data['article_time_created'], 'article_edit_reason' => $this->data['article_edit_reason'], 'article_topic_id' => (int) $this->data['article_topic_id'], 'article_sources' => $this->data['article_sources'], 'article_sticky' => (int) $this->data['article_sticky'], 'article_views' => (int) $this->data['article_views'], 'article_redirect' => $this->data['article_redirect'], 'article_description' => $this->data['article_description'], 'article_toc' => '');
$sql = 'INSERT INTO ' . $this->article_table . '
' . $this->db->sql_build_array('INSERT', $sql_data);
$this->db->sql_query($sql);
$article_id = $this->db->sql_nextid();
if ($this->auth->acl_get('u_wiki_set_active') && $this->data['article_approved'] != 0) {
$this->set_active_version($article_id);
} else {
$notify_data = array('article_id' => $article_id, 'article_title' => $this->data['article_title'], 'article_url' => $article, 'user_id' => $this->user->data['user_id']);
$this->notification_manager->add_notifications('tas2580.wiki.notification.type.articke_edit', $notify_data);
}
$msg = $this->data['article_approved'] != 0 ? $this->user->lang['EDIT_ARTICLE_SUCCESS'] : $this->user->lang['EDIT_ARTICLE_SUCCESS_INACTIVE'];
$back_url = empty($article) ? $this->helper->route('tas2580_wiki_index', array()) : $this->helper->route('tas2580_wiki_article', array('article' => $article));
trigger_error($msg . '<br /><br /><a href="' . $back_url . '">' . $this->user->lang['BACK_TO_ARTICLE'] . '</a>');
} else {
$this->message_parser->message = $this->data['article_text'];
$this->message_parser->decode_message($this->data['bbcode_uid']);
$this->display_edit_form(false);
}
}
}
return $this->helper->render('article_edit.html', $this->user->lang['EDIT_WIKI']);
}
示例12: compose_pm
//.........这里部分代码省略.........
'reply_from_msg_id' => (int) $msg_id,
'icon_id' => (int) $icon_id,
'enable_sig' => (bool) $enable_sig,
'enable_bbcode' => (bool) $enable_bbcode,
'enable_smilies' => (bool) $enable_smilies,
'enable_urls' => (bool) $enable_urls,
'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,
'address_list' => $address_list
);
unset($message_parser);
// ((!$message_subject) ? $subject : $message_subject)
$msg_id = submit_pm($action, $subject, $pm_data);
$return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id);
$return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox');
meta_refresh(3, $return_message_url);
$message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']);
trigger_error($message);
}
$message_subject = $subject;
}
// Preview
if (!sizeof($error) && $preview)
{
$user->add_lang('viewtopic');
$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
$preview_signature = $user->data['user_sig'];
$preview_signature_uid = $user->data['user_sig_bbcode_uid'];
$preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield'];
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature)
{
$parse_sig = new parse_message($preview_signature);
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
$parse_sig->format_display($enable_bbcode, $enable_urls, $enable_smilies);
$preview_signature = $parse_sig->message;
unset($parse_sig);
}
else
{
$preview_signature = '';
}
// Attachment Preview
if (sizeof($message_parser->attachment_data))
{
$template->assign_var('S_HAS_ATTACHMENTS', true);
$update_count = array();
$attachment_data = $message_parser->attachment_data;
parse_attachments(false, $preview_message, $attachment_data, $update_count, true);
foreach ($attachment_data as $i => $attachment)
示例13: compact
}
$temp = compact('blog_subject', 'blog_text', 'error');
blog_plugins::plugin_do_ref('blog_add_after_setup', $temp);
extract($temp);
unset($temp);
// if they did not submit or they have an error
if (!$submit || sizeof($error)) {
// if they are trying to preview the message and do not have an error
if ($preview && !sizeof($error)) {
$preview_message = $message_parser->format_display($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies, false);
// Poll Preview
if (!empty($poll)) {
$parse_poll = new parse_message($poll_title);
$parse_poll->bbcode_uid = $message_parser->bbcode_uid;
$parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield;
$parse_poll->format_display($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies);
if ($poll_length) {
$poll_end = $poll_length * 86400 + time();
}
$template->assign_vars(array('S_HAS_POLL_OPTIONS' => sizeof($poll_options), 'S_IS_MULTI_CHOICE' => $poll_max_options > 1 ? true : false, 'POLL_QUESTION' => $parse_poll->message, 'L_POLL_LENGTH' => $poll_length ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_end)) : '', 'L_MAX_VOTES' => $poll_max_options == 1 ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $poll_max_options)));
$parse_poll->message = implode("\n", $poll_options);
$parse_poll->format_display($post_options->enable_bbcode, $post_options->enable_magic_url, $post_options->enable_smilies);
$preview_poll_options = explode('<br />', $parse_poll->message);
unset($parse_poll);
foreach ($preview_poll_options as $key => $option) {
$template->assign_block_vars('poll_option', array('POLL_OPTION_CAPTION' => $option, 'POLL_OPTION_ID' => $key + 1));
}
unset($preview_poll_options);
}
// Attachments
if (sizeof($blog_attachment->attachment_data)) {
示例14: unset
$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;
// Not sure about parameters for bbcode/smilies/urls... in signatures
$parse_sig->format_display($config['allow_html'], $config['allow_bbcode'], true, $config['allow_smilies']);
$preview_signature = $parse_sig->message;
unset($parse_sig);
} else {
$preview_signature = '';
}
$preview_subject = censor_text($subject);
// Poll Preview
if (($mode == 'post' || $mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $_CLASS['auth']->acl_get('m_edit', $forum_id))) && $_CLASS['auth']->acl_get('f_poll', $forum_id)) {
$parse_poll = new parse_message($poll_title);
$parse_poll->bbcode_uid = $message_parser->bbcode_uid;
$parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield;
$parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
$_CLASS['core_template']->assign_array(array('S_HAS_POLL_OPTIONS' => sizeof($poll_options), 'S_IS_MULTI_CHOICE' => $poll_max_options > 1 ? true : false, 'POLL_QUESTION' => $parse_poll->message, 'L_POLL_LENGTH' => $poll_length ? sprintf($_CLASS['core_user']->lang['POLL_RUN_TILL'], $_CLASS['core_user']->format_date($poll_length + $poll_start)) : '', 'L_MAX_VOTES' => $poll_max_options == 1 ? $_CLASS['core_user']->lang['MAX_OPTION_SELECT'] : sprintf($_CLASS['core_user']->lang['MAX_OPTIONS_SELECT'], $poll_max_options)));
$parse_poll->message = implode("\n", $poll_options);
$parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
$preview_poll_options = explode('<br />', $parse_poll->message);
unset($parse_poll);
foreach ($preview_poll_options as $option) {
$_CLASS['core_template']->assign_vars_array('poll_option', array('POLL_OPTION_CAPTION' => $option));
}
unset($preview_poll_options);
}
// Attachment Preview
if (sizeof($message_parser->attachment_data)) {
require $site_file_root . 'includes/forums/functions_display.php';
$extensions = $update_count = array();
$_CLASS['core_template']->assign('S_HAS_ATTACHMENTS', true);
示例15: array
$sql_array = array('user_sig' => (string) $message_parser->message, 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield);
} else {
$sql_array = array('user_sig' => (string) '', 'user_sig_bbcode_uid' => (string) '', 'user_sig_bbcode_bitfield' => (int) 0);
}
$sql = 'UPDATE ' . CORE_USERS_TABLE . '
SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_array) . '
WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
$_CLASS['core_db']->sql_query($sql);
$message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . generate_link($this->link) . '">', '</a>');
trigger_error($message);
}
}
$signature_preview = '';
if ($preview && $signature) {
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
if ($signature) {
decode_message($signature, $_CLASS['core_user']->data['user_sig_bbcode_uid']);
}
$_CLASS['core_template']->assign_array(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_HTML_CHECKED' => $enable_html ? '' : 'checked="checked"', 'S_BBCODE_CHECKED' => $enable_bbcode ? '' : 'checked="checked"', 'S_SMILIES_CHECKED' => $enable_smilies ? '' : 'checked="checked"', 'S_MAGIC_URL_CHECKED' => $enable_urls ? '' : 'checked="checked"', 'HTML_STATUS' => true ? $_CLASS['core_user']->get_lang('HTML_IS_ON') : $_CLASS['core_user']->get_lang('HTML_IS_OFF'), 'BBCODE_STATUS' => true ? sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_ON'), '<a href="' . generate_link('Forums&file=faq&mode=bbcode') . '" target="_phpbbcode">', '</a>') : sprintf($_CLASS['core_user']->get_lang('BBCODE_IS_OFF'), '<a href="' . generate_link('Forums&file=faq&mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => true ? $_CLASS['core_user']->get_lang('SMILIES_ARE_ON') : $_CLASS['core_user']->get_lang('SMILIES_ARE_OFF'), 'IMG_STATUS' => true ? $_CLASS['core_user']->get_lang('IMAGES_ARE_ON') : $_CLASS['core_user']->get_lang('IMAGES_ARE_OFF'), 'FLASH_STATUS' => true ? $_CLASS['core_user']->get_lang('FLASH_IS_ON') : $_CLASS['core_user']->get_lang('FLASH_IS_OFF'), 'URL_STATUS' => $config['allow_sig_links'] ? $_CLASS['core_user']->lang['URL_IS_ON'] : $_CLASS['core_user']->lang['URL_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($_CLASS['core_user']->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_HTML_ALLOWED' => true, 'S_BBCODE_ALLOWED' => true, 'S_SMILIES_ALLOWED' => true));
break;
case 'avatar':
$display_gallery = isset($_POST['display_gallery']);
$folder = isset($_POST['category']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['category']) : false;
$delete = isset($_POST['delete']);
// Can we upload?
$can_upload = @ini_get('file_uploads') && file_exists($_CORE_CONFIG['global']['path_avatar_upload']) && is_writeable($_CORE_CONFIG['global']['path_avatar_upload']);
if ($submit) {
require_once SITE_FILE_ROOT . 'includes/functions_user.php';