本文整理汇总了PHP中parse_message::decode_message方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::decode_message方法的具体用法?PHP parse_message::decode_message怎么用?PHP parse_message::decode_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse_message
的用法示例。
在下文中一共展示了parse_message::decode_message方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$template->assign_var('S_HAS_ATTACHMENTS', true);
$update_count = array();
$attachment_data = $message_parser->attachment_data;
parse_attachments($forum_id, $preview_message, $attachment_data, $update_count, true);
foreach ($attachment_data as $i => $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
unset($attachment_data);
}
if (!sizeof($error)) {
$template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
}
}
// Decode text for message display
$post_data['bbcode_uid'] = $mode == 'quote' && !$preview && !$refresh && !sizeof($error) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);
if ($mode == 'quote' && !$submit && !$preview && !$refresh) {
if ($config['allow_bbcode']) {
$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
} else {
$offset = 0;
$quote_string = "> ";
$message = censor_text(trim($message_parser->message));
// see if we are nesting. It's easily tricked but should work for one level of nesting
if (strpos($message, ">") !== false) {
$offset = 10;
}
$message = utf8_wordwrap($message, 75 + $offset, "\n");
$message = $quote_string . $message;
$message = str_replace("\n", "\n" . $quote_string, $message);
$message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
示例2: compose_pm
//.........这里部分代码省略.........
* @var int topic_id Topic ID of the quoted post
* @var int to_user_id Users the message is sent to
* @var int to_group_id Groups the message is sent to
* @var bool submit Whether the user is sending the PM or not
* @var bool preview Whether the user is previewing the PM or not
* @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies
* @var bool delete If deleting message
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.0-RC5
*/
$vars = array('sql', 'post', 'msg_id', 'visibility_const', 'topic_id', 'to_user_id', 'to_group_id', 'submit', 'preview', 'action', 'delete', 'reply_to_all');
extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars)));
// Passworded forum?
if ($post['forum_id']) {
$sql = 'SELECT forum_id, forum_name, forum_password
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $post['forum_id'];
$result = $db->sql_query($sql);
$forum_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!empty($forum_data['forum_password'])) {
login_forum_box($forum_data);
}
}
}
$msg_id = (int) $post['msg_id'];
$folder_id = isset($post['folder_id']) ? $post['folder_id'] : 0;
$message_text = isset($post['message_text']) ? $post['message_text'] : '';
if ((!$post['author_id'] || $post['author_id'] == ANONYMOUS && $action != 'delete') && $msg_id) {
trigger_error('NO_AUTHOR');
}
if ($action == 'quotepost') {
// Decode text for message display
decode_message($message_text, $post['bbcode_uid']);
}
if ($action != 'delete') {
$enable_urls = $post['enable_magic_url'];
$enable_sig = isset($post['enable_sig']) ? $post['enable_sig'] : 0;
$message_attachment = isset($post['message_attachment']) ? $post['message_attachment'] : 0;
$message_subject = $post['message_subject'];
$message_time = $post['message_time'];
$bbcode_uid = $post['bbcode_uid'];
$quote_username = isset($post['quote_username']) ? $post['quote_username'] : '';
$icon_id = isset($post['icon_id']) ? $post['icon_id'] : 0;
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) {
// Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all"
if ($action == 'quotepost' || !$reply_to_all) {
$address_list = array('u' => array($post['author_id'] => 'to'));
} else {
// We try to include every previously listed member from the TO Header - Reply to all
$address_list = rebuild_header(array('to' => $post['to_address']));
// Add the author (if he is already listed then this is no shame (it will be overwritten))
$address_list['u'][$post['author_id']] = 'to';
// Now, make sure the user itself is not listed. ;)
if (isset($address_list['u'][$user->data['user_id']])) {
unset($address_list['u'][$user->data['user_id']]);
}
}
} else {
if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview) {
// Rebuild TO and BCC Header
$address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address']));
}
}
if ($action == 'quotepost') {
$check_value = 0;
示例3: prepare_text_for_merge
public function prepare_text_for_merge(&$data)
{
// Create message parser instance
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$text = isset($data['post_text']) ? $data['post_text'] : $data['message'];
$message_parser->message = $text;
// Decode message text properly
$message_parser->decode_message($data['bbcode_uid']);
$text = html_entity_decode($message_parser->message, ENT_COMPAT, 'UTF-8');
return $text;
}
示例4: edit
//.........这里部分代码省略.........
$message_parser = new \parse_message();
$message_parser->message = utf8_normalize_nfc($image_desc);
if ($message_parser->message) {
$message_parser->parse(true, true, true, true, false, true, true, true);
}
$sql_ary = array('image_name' => $image_name, 'image_name_clean' => utf8_clean_string($image_name), 'image_desc' => $message_parser->message, 'image_desc_uid' => $message_parser->bbcode_uid, 'image_desc_bitfield' => $message_parser->bbcode_bitfield, 'image_allow_comments' => $this->request->variable('allow_comments', 0));
$errors = array();
if (empty($sql_ary['image_name_clean'])) {
$errors[] = $user->lang['MISSING_IMAGE_NAME'];
}
if (!$this->gallery_config->get('allow_comments') || !$this->gallery_config->get('comment_user_control')) {
unset($sql_ary['image_allow_comments']);
}
$change_image_count = false;
if ($this->gallery_auth->acl_check('m_edit', $album_id, $album_data['album_user_id'])) {
$user_data = $this->image->get_new_author_info($this->request->variable('change_author', '', true));
if ($user_data) {
$sql_ary = array_merge($sql_ary, array('image_user_id' => $user_data['user_id'], 'image_username' => $user_data['username'], 'image_username_clean' => utf8_clean_string($user_data['username']), 'image_user_colour' => $user_data['user_colour']));
if ($image_data['image_status'] != $this->image->get_status_unaproved()) {
$change_image_count = true;
}
} else {
if ($this->request->variable('change_author', '', true)) {
$errors[] = $user->lang['INVALID_USERNAME'];
}
}
}
$move_to_personal = $this->request->variable('move_to_personal', 0);
if ($move_to_personal) {
$personal_album_id = 0;
if ($user->data['user_id'] != $image_data['image_user_id']) {
$image_user = new \phpbbgallery\core\user($db, $image_data['image_user_id']);
$personal_album_id = $image_user->get_data('personal_album_id');
// The User has no personal album, moderators can created that without the need of permissions
if (!$personal_album_id) {
$personal_album_id = $this->album->generate_personal_album($image_data['image_username'], $image_data['image_user_id'], $image_data['image_user_colour'], $image_user);
}
} else {
$personal_album_id = $this->user->get_data('personal_album_id');
if (!$personal_album_id && $this->gallery_auth->acl_check('i_upload', $this->gallery_auth->get_own_album())) {
$personal_album_id = $this->album->generate_personal_album($image_data['image_username'], $image_data['image_user_id'], $image_data['image_user_colour'], phpbb_gallery::$user);
}
}
if ($personal_album_id) {
$sql_ary['image_album_id'] = $personal_album_id;
}
}
$rotate = $this->request->variable('rotate', array(0));
$rotate = isset($rotate[0]) ? $rotate[0] : 0;
if ($this->gallery_config->get('allow_rotate') && $rotate > 0 && $rotate % 90 == 0) {
$image_tools = new \phpbbgallery\core\file\file();
$image_tools->set_image_options($this->gallery_config->get('max_filesize'), $this->gallery_config->get('max_height'), $this->gallery_config->get('max_width'));
$image_tools->set_image_data($this->url->path('upload') . $image_data['image_filename']);
// Rotate the image
$image_tools->rotate_image($rotate, $this->gallery_config->get('allow_rotate'));
if ($image_tools->rotated) {
$image_tools->write_image($image_tools->image_source, $this->gallery_config->get('jpg_quality'), true);
}
@unlink($this->url->path('thumbnail') . $image_data['image_filename']);
@unlink($this->url->path('medium') . $image_data['image_filename']);
}
$error = implode('<br />', $errors);
if (!$error) {
$sql = 'UPDATE ' . $this->table_images . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE image_id = ' . $image_id;
$this->db->sql_query($sql);
$this->album->update_info($album_data['album_id']);
if ($move_to_personal && $personal_album_id) {
$this->album->update_info($personal_album_id);
}
if ($change_image_count) {
$new_user = new phpbb_gallery_user($db, $user_data['user_id'], false);
$new_user->update_images(1);
$old_user = new phpbb_gallery_user($db, $image_data['image_user_id'], false);
$old_user->update_images(-1);
}
if ($this->user->data['user_id'] != $image_data['image_user_id']) {
$this->gallery_log->add_log('moderator', 'edit', $image_data['image_album_id'], $image_id, array('LOG_GALLERY_EDITED', $image_name));
}
$message = $this->user->lang['IMAGES_UPDATED_SUCCESSFULLY'];
$message .= '<br /><br />' . sprintf($this->user->lang['CLICK_RETURN_IMAGE'], '<a href="' . $image_backlink . '">', '</a>');
$message .= '<br /><br />' . sprintf($this->user->lang['CLICK_RETURN_ALBUM'], '<a href="' . $album_backlink . '">', '</a>');
$this->url->meta_refresh(3, $image_backlink);
trigger_error($message);
}
$disp_image_data = array_merge($disp_image_data, $sql_ary);
}
if (!class_exists('bbcode')) {
include $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext;
}
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$message_parser->message = $disp_image_data['image_desc'];
$message_parser->decode_message($disp_image_data['image_desc_uid']);
$page_title = $disp_image_data['image_name'];
$this->template->assign_block_vars('image', array('U_IMAGE' => $this->image->generate_link('thumbnail', 'plugin', $image_id, $image_data['image_name'], $album_id), 'IMAGE_NAME' => $disp_image_data['image_name'], 'IMAGE_DESC' => $message_parser->message));
$this->template->assign_vars(array('L_DESCRIPTION_LENGTH' => $this->user->lang('DESCRIPTION_LENGTH', $this->gallery_config->get('description_length')), 'S_EDIT' => true, 'S_ALBUM_ACTION' => $this->helper->route('phpbbgallery_image_edit', array('image_id' => $image_id)), 'ERROR' => isset($error) ? $error : '', 'U_VIEW_IMAGE' => $this->helper->route('phpbbgallery_image', array('image_id' => $image_id)), 'IMAGE_NAME' => $image_data['image_name'], 'S_CHANGE_AUTHOR' => $this->gallery_auth->acl_check('m_edit', $album_id, $album_data['album_user_id']), 'U_FIND_USERNAME' => $this->url->append_sid('phpbb', 'memberlist', 'mode=searchuser&form=postform&field=change_author&select_single=true'), 'S_COMMENTS_ENABLED' => $this->gallery_config->get('allow_comments') && $this->gallery_config->get('comment_user_control'), 'S_ALLOW_COMMENTS' => $image_data['image_allow_comments'], 'NUM_IMAGES' => 1, 'S_ALLOW_ROTATE' => $this->gallery_config->get('allow_rotate') && function_exists('imagerotate'), 'S_MOVE_MODERATOR' => $this->user->data['user_id'] != $image_data['image_user_id'] ? true : false));
return $this->helper->render('gallery/posting_body.html', $page_title);
}
示例5: array
}
$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>');
trigger_error($message);
}
// Display forms
add_form_key('add_comment');
if (isset($message_parser)) {
$comment_data['comment_message'] = $message_parser->decode_message($message_parser->bbcode_uid, false);
}
$report['bbcode_options'] = ($report['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($report['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($report['enable_magic_url'] ? OPTION_FLAG_LINKS : 0);
$template->assign_vars(array('COMMENT_SUBJECT' => $comment_data['comment_subject'], 'COMMENT_MESSAGE' => $comment_data['comment_message'], 'S_BBCODE_CHECKED' => $comment_data['enable_bbcode'] ? '' : ' checked="checked"', 'S_SMILIES_CHECKED' => $comment_data['enable_smilies'] ? '' : ' checked="checked"', 'S_MAGIC_URL_CHECKED' => $comment_data['enable_magic_url'] ? '' : ' checked="checked"', 'S_BBCODE_ALLOWED' => $auth->acl_get('f_bbcode', $report['forum_id']), 'S_SMILIES_ALLOWED' => $auth->acl_get('f_smilies', $report['forum_id']), 'S_LINKS_ALLOWED' => $config['allow_post_links'] ? true : false, 'ERROR' => isset($error) && sizeof($error) ? implode('<br />', $error) : false, 'S_PREVIEW_BOLD' => !empty($error) || !isset($_POST['preview']) ? true : false, 'REPORT_TITLE' => $report['report_title'], 'REPORT_TEXT' => generate_text_for_display($report['report_desc'], $report['bbcode_uid'], $report['bbcode_bitfield'], $report['bbcode_options']), 'REPORT_ID' => $report['report_id'], 'PROJECT_TITLE' => $report['project_title'], 'REPORT_COMPONENT' => $report['component_title'], 'REPORT_STATUS' => $report['status_title'], 'REPORT_VERSION' => $report['version_title'], 'ASSIGNED' => $report['assigned_id'] == 0 ? $user->lang['UNASSIGNED'] : get_username_string('username', $report['assigned_id'], $report['assigned_name'], $report['assigned_colour']), 'ASSIGNED_COLOUR' => $report['assigned_id'] == 0 ? $user->lang['UNASSIGNED'] : get_username_string('colour', $report['assigned_id'], $report['assigned_name'], $report['assigned_colour']), 'ASSIGNED_FULL' => $report['assigned_id'] == 0 ? $user->lang['UNASSIGNED'] : get_username_string('full', $report['assigned_id'], $report['assigned_name'], $report['assigned_colour']), 'REPORTED' => get_username_string('username', $report['topic_poster'], $report['topic_first_poster_name'], $report['topic_first_poster_colour']), 'REPORTED_COLOUR' => get_username_string('colour', $report['topic_poster'], $report['topic_first_poster_name'], $report['topic_first_poster_colour']), 'REPORTED_FULL' => get_username_string('full', $report['topic_poster'], $report['topic_first_poster_name'], $report['topic_first_poster_colour']), 'REPORT_TIME' => $user->format_date($report['topic_time']), 'S_IS_CLOSED' => $report['report_closed'] == 1, 'U_BUG_TRACKER' => append_sid("{$phpbb_root_path}bugs.{$phpEx}"), 'U_RETURN' => append_sid("{$phpbb_root_path}bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}"), 'U_SUBSCRIBE' => append_sid("{$phpbb_root_path}bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}&action=subscribe"), 'U_UNSUBSCRIBE' => append_sid("{$phpbb_root_path}bugs.{$phpEx}", "mode=report&project={$report['project_name']}&report_id={$report_id}&action=unsubscribe"), 'S_IS_SUBSCRIBED' => $is_subscribed, 'S_IS_LOCKED' => $report['topic_status'] == ITEM_LOCKED, 'S_DISPLAY_SUBSCRIBE_INFO' => $is_subscribed || $auth->acl_get('f_subscribe', $report['forum_id'])));
// Display the page
site_header($user->lang['BUG_TRACKER'] . ' - ' . $report['report_title'], 'bugs', array(array('bugs.' . $phpEx, 'BUG_TRACKER'), array("bugs.{$phpEx}?mode=project&project={$report['project_name']}", $report['project_title']), array("{$phpbb_root_path}bugs.{$phpEx}?mode=report&project={$report['project_name']}&report_id={$report_id}", sprintf($user->lang['BUG_NO'], $report_id)), array("bugs.{$phpEx}?mode=reply&project={$report['project_name']}&report_id={$report_id}", 'ADD_COMMENT')));
$template->set_filenames(array('body' => 'bugs_comment_add.html'));
site_footer();
} else {
/**
* Query projects
*/
$sql = $db->sql_build_query('SELECT', array('SELECT' => 'p.*, f.forum_desc AS project_description, f.forum_desc_uid, f.forum_desc_bitfield, f.forum_desc_options', 'FROM' => array(BUGS_PROJECTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'p.forum_id = f.forum_id')), 'ORDER_BY' => 'f.left_id ASC'));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if ($auth->acl_get('f_c_see', $row['forum_id'])) {
示例6:
</tr>
<?php
}
?>
<tr>
<td class="row1"><b><?php
echo $_CLASS['core_user']->lang['FORUM_RULES'];
?>
: </b><br /><span class="gensmall"><?php
echo $_CLASS['core_user']->lang['FORUM_RULES_EXPLAIN'];
?>
</span></td>
<td class="row2"><table cellspacing="2" cellpadding="0" border="0"><tr><td colspan="6"><textarea class="post" rows="4" cols="70" name="forum_rules">
<?php
if ($forum_rules) {
$message_parser->decode_message();
echo $message_parser->message;
}
?>
</textarea></td></tr><tr>
<td width="10"><input type="checkbox" name="parse_bbcode"<?php
echo $bbcode_checked;
?>
/></td><td><?php
echo $_CLASS['core_user']->lang['PARSE_BBCODE'];
?>
</td><td width="10"><input type="checkbox" name="parse_smilies"<?php
echo $smilies_checked;
?>
/></td><td><?php
echo $_CLASS['core_user']->lang['PARSE_SMILIES'];
示例7: get_raw_post_func
function get_raw_post_func($xmlrpc_params)
{
global $db, $auth, $user, $config, $template, $cache, $phpEx, $phpbb_root_path, $phpbb_home;
$user->setup('posting');
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$params = php_xmlrpc_decode($xmlrpc_params);
// get post id from parameters
$post_id = intval($params[0]);
$post_data = array();
$sql = 'SELECT p.*, t.*, f.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f\n WHERE p.post_id = {$post_id}\n AND t.topic_id = p.topic_id\n AND (f.forum_id = t.forum_id OR (t.topic_type = " . POST_GLOBAL . ' AND f.forum_type = ' . FORUM_POST . '))';
$result = $db->sql_query_limit($sql, 1);
$post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$post_data) {
trigger_error('NO_POST');
}
// Use post_row values in favor of submitted ones...
$forum_id = (int) $post_data['forum_id'];
$topic_id = (int) $post_data['topic_id'];
$post_id = (int) $post_id;
// Need to login to passworded forum first?
if ($post_data['forum_password'] && !check_forum_password($forum_id)) {
trigger_error('LOGIN_FORUM');
}
// Is the user able to read within this forum?
if (!$auth->acl_get('f_read', $forum_id)) {
trigger_error('USER_CANNOT_READ');
}
// Permission to do the action asked?
if (!($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id))) {
trigger_error('USER_CANNOT_EDIT');
}
// Forum/Topic locked?
if (($post_data['forum_status'] == ITEM_LOCKED || isset($post_data['topic_status']) && $post_data['topic_status'] == ITEM_LOCKED) && !$auth->acl_get('m_edit', $forum_id)) {
trigger_error($post_data['forum_status'] == ITEM_LOCKED ? 'FORUM_LOCKED' : 'TOPIC_LOCKED');
}
// Can we edit this post ... if we're a moderator with rights then always yes
// else it depends on editing times, lock status and if we're the correct user
if (!$auth->acl_get('m_edit', $forum_id)) {
if ($user->data['user_id'] != $post_data['poster_id']) {
trigger_error('USER_CANNOT_EDIT');
}
if (!($post_data['post_time'] > time() - $config['edit_time'] * 60 || !$config['edit_time'])) {
trigger_error('CANNOT_EDIT_TIME');
}
if ($post_data['post_edit_locked']) {
trigger_error('CANNOT_EDIT_POST_LOCKED');
}
}
$message_parser = new parse_message();
if (isset($post_data['post_text'])) {
$message_parser->message =& $post_data['post_text'];
unset($post_data['post_text']);
}
// Do we want to edit our post ?
if ($post_data['bbcode_uid']) {
$message_parser->bbcode_uid = $post_data['bbcode_uid'];
}
// Decode text for message display
$message_parser->decode_message($post_data['bbcode_uid']);
$post_data['post_text'] = $message_parser->message;
return new xmlrpcresp(new xmlrpcval(array('post_id' => new xmlrpcval($post_id), 'post_title' => new xmlrpcval(html_entity_decode(strip_tags($post_data['post_subject'])), 'base64'), 'post_content' => new xmlrpcval(html_entity_decode($post_data['post_text']), 'base64')), 'struct'));
}
示例8: 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']);
}
示例9: explode
function generate_text($profile_row, $preview = false)
{
global $_CLASS, $site_file_root;
$value = $this->get_var('', $profile_row, $profile_row['lang_default_value'], $preview);
if ($preview == false) {
include_once $site_file_root . 'includes/forums/message_parser.php';
include_once $site_file_root . 'includes/forums/functions_posting.php';
$message_parser = new parse_message();
$message_parser->message = $value;
$message_parser->decode_message($_CLASS['core_user']->profile_fields[str_replace('pf_', '', $profile_row['field_ident']) . '_bbcode_uid']);
$value = $message_parser->message;
}
$field_length = explode('|', $profile_row['field_length']);
$profile_row['field_rows'] = $field_length[0];
$profile_row['field_cols'] = $field_length[1];
$this->set_tpl_vars($profile_row, $value);
return $this->get_cp_html();
}
示例10: get_quote_post_func
function get_quote_post_func($xmlrpc_params)
{
global $db, $auth, $user, $phpEx, $phpbb_root_path;
$user->setup('posting');
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$params = php_xmlrpc_decode($xmlrpc_params);
$post_ids = explode('-', $params[0]);
$quote_messages = array();
foreach ($post_ids as $post_id) {
// get post id from parameters
$post_id = intval($post_id);
$post_data = array();
// We need to know some basic information in all cases before we do anything.
if (!$post_id) {
trigger_error('NO_POST');
}
$sql = 'SELECT t.*, p.*, f.*, u.username
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . TOPICS_TABLE . ' t ON (p.topic_id = t.topic_id)
LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id OR (t.topic_type = ' . POST_GLOBAL . ' AND f.forum_type = ' . FORUM_POST . '))
LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)' . "\r\r\n WHERE p.post_id = {$post_id}";
$result = $db->sql_query_limit($sql, 1);
$post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$post_data) {
trigger_error('NO_POST');
}
// Use post_row values in favor of submitted ones...
$forum_id = (int) $post_data['forum_id'];
$topic_id = (int) $post_data['topic_id'];
$post_id = (int) $post_data['post_id'];
// Need to login to passworded forum first?
if ($post_data['forum_password'] && !check_forum_password($forum_id)) {
trigger_error('LOGIN_FORUM');
}
// Is the user able to read within this forum?
if (!$auth->acl_get('f_read', $forum_id)) {
trigger_error('USER_CANNOT_READ');
}
if (!$auth->acl_get('f_reply', $forum_id)) {
trigger_error('USER_CANNOT_REPLY');
}
// Is the user able to post within this forum?
if ($post_data['forum_type'] != FORUM_POST) {
trigger_error('USER_CANNOT_FORUM_POST');
}
// Forum/Topic locked?
if (($post_data['forum_status'] == ITEM_LOCKED || isset($post_data['topic_status']) && $post_data['topic_status'] == ITEM_LOCKED) && !$auth->acl_get('m_edit', $forum_id)) {
trigger_error($post_data['forum_status'] == ITEM_LOCKED ? 'FORUM_LOCKED' : 'TOPIC_LOCKED');
}
// Determine some vars
if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) {
$post_data['quote_username'] = !empty($post_data['post_username']) ? $post_data['post_username'] : $user->lang['GUEST'];
} else {
$post_data['quote_username'] = isset($post_data['username']) ? $post_data['username'] : '';
}
$message_parser = new parse_message();
if (isset($post_data['post_text'])) {
$message_parser->message = $post_data['post_text'];
$message_parser->decode_message($post_data['bbcode_uid']);
$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]";
//$post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']);
$quote_messages[] = $message_parser->message;
}
}
return new xmlrpcresp(new xmlrpcval(array('post_id' => new xmlrpcval($params[0]), 'post_title' => new xmlrpcval('', 'base64'), 'post_content' => new xmlrpcval(html_entity_decode(implode("\n", $quote_messages)), 'base64')), 'struct'));
}
示例11: sprintf
}
$sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE image_id = ' . $image_id;
$db->sql_query($sql);
if ($move_to_personal && $personal_album_id) {
phpbb_gallery_album::update_info($album_data['album_id']);
phpbb_gallery_album::update_info($personal_album_id);
}
if ($user->data['user_id'] != $image_data['image_user_id']) {
add_log('gallery', $image_data['image_album_id'], $image_id, 'LOG_GALLERY_EDITED', $image_name);
}
}
$message_parser = new parse_message();
$message_parser->message = $image_data['image_desc'];
$message_parser->decode_message($image_data['image_desc_uid']);
$template->assign_vars(array('IMAGE_NAME' => $image_data['image_name'], 'MESSAGE' => $message_parser->message, 'L_DESCRIPTION_LENGTH' => sprintf($user->lang['DESCRIPTION_LENGTH'], phpbb_gallery_config::get('description_length')), 'U_IMAGE' => $image_id ? phpbb_gallery_url::append_sid('image', "album_id={$album_id}&image_id={$image_id}") : '', 'U_VIEW_IMAGE' => $image_id ? phpbb_gallery_url::append_sid('image_page', "album_id={$album_id}&image_id={$image_id}") : '', 'IMAGE_RSZ_WIDTH' => phpbb_gallery_config::get('medium_width'), 'IMAGE_RSZ_HEIGHT' => phpbb_gallery_config::get('medium_height'), 'S_IMAGE' => true, 'S_EDIT' => true, 'S_ALLOW_ROTATE' => phpbb_gallery_config::get('allow_rotate') && function_exists('imagerotate'), 'S_MOVE_PERSONAL' => phpbb_gallery::$auth->acl_check('i_upload', phpbb_gallery_auth::OWN_ALBUM) || phpbb_gallery::$user->get_data('personal_album_id') || $user->data['user_id'] != $image_data['image_user_id'] ? true : false, 'S_MOVE_MODERATOR' => $user->data['user_id'] != $image_data['image_user_id'] ? true : false, 'S_ALBUM_ACTION' => phpbb_gallery_url::append_sid('posting', "mode=image&submode=edit&album_id={$album_id}&image_id={$image_id}")));
$message = $user->lang['IMAGES_UPDATED_SUCCESSFULLY'] . '<br />';
$page_title = $user->lang['EDIT_IMAGE'];
}
break;
case 'report':
if ($submode == 'report') {
if ($submit) {
if (!check_form_key('gallery')) {
trigger_error('FORM_INVALID');
}
$report_message = request_var('message', '', true);
$error = '';
if ($report_message == '') {
$error = $user->lang['MISSING_REPORT_REASON'];
示例12: post
//.........这里部分代码省略.........
meta_refresh(3, $redirect_url);
$message = $mode == 'edit' ? 'POST_EDITED' : 'POST_STORED';
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}
}
}
// Preview
if (!sizeof($error) && $preview) {
$post_data['post_time'] = $mode == 'edit' ? $post_data['post_time'] : $current_time;
$preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false);
$preview_signature = $mode == 'edit' ? $post_data['user_sig'] : $user->data['user_sig'];
$preview_signature_uid = $mode == 'edit' ? $post_data['user_sig_bbcode_uid'] : $user->data['user_sig_bbcode_uid'];
$preview_signature_bitfield = $mode == 'edit' ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield'];
// Signature
if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('u_gb_sig')) {
$parse_sig = new parse_message($preview_signature);
$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_sig_bbcode'], true, $config['allow_sig_smilies']);
$preview_signature = $parse_sig->message;
unset($parse_sig);
} else {
$preview_signature = '';
}
$preview_subject = censor_text($post_data['post_subject']);
if (!sizeof($error)) {
$template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
}
}
// Decode text for message display
$post_data['bbcode_uid'] = $mode == 'quote' && !$preview && !$refresh && !sizeof($error) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);
if ($mode == 'quote' && !$submit && !$preview && !$refresh) {
if ($config['allow_bbcode']) {
$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
} else {
$offset = 0;
$quote_string = "> ";
$message = censor_text(trim($message_parser->message));
// see if we are nesting. It's easily tricked but should work for one level of nesting
if (strpos($message, ">") !== false) {
$offset = 10;
}
$message = utf8_wordwrap($message, 75 + $offset, "\n");
$message = $quote_string . $message;
$message = str_replace("\n", "\n" . $quote_string, $message);
$message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n";
}
}
if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) {
$post_data['post_subject'] = (strpos($post_data['post_subject'], 'Re: ') !== 0 ? 'Re: ' : '') . censor_text($post_data['post_subject']);
}
$post_data['post_text'] = $message_parser->message;
// MAIN POSTING PAGE BEGINS HERE
// Generate smiley listing
generate_smilies('inline', 0);
// Do show topic type selection only in first post.
$topic_type_toggle = false;
$s_topic_icons = false;
if ($post_data['enable_icons'] && $auth->acl_get('u_gb_icons')) {
$s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']);
}
$bbcode_checked = isset($post_data['enable_bbcode']) ? !$post_data['enable_bbcode'] : ($config['allow_bbcode'] ? !$user->optionget('bbcode') : 1);
$smilies_checked = isset($post_data['enable_smilies']) ? !$post_data['enable_smilies'] : ($config['allow_smilies'] ? !$user->optionget('smilies') : 1);