本文整理汇总了PHP中parse_message::get_submitted_attachment_data方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::get_submitted_attachment_data方法的具体用法?PHP parse_message::get_submitted_attachment_data怎么用?PHP parse_message::get_submitted_attachment_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse_message
的用法示例。
在下文中一共展示了parse_message::get_submitted_attachment_data方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewtopic_modify_data
/**
* Show bbcodes and smilies in the quickreply
* Template data for Ajax submit
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_data($event)
{
$forum_id = $event['forum_id'];
$topic_data = $event['topic_data'];
$post_list = $event['post_list'];
$topic_id = $topic_data['topic_id'];
$s_quick_reply = false;
if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
// Quick reply enabled forum
$s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
}
if (!$this->user->data['is_registered'] && $s_quick_reply) {
add_form_key('posting');
$s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
$s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
$s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
$s_notify = false;
$qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
// Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
!$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
!$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
!$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
$s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
$s_notify ? $qr_hidden_fields['notify'] = 1 : true;
$topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
$this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
if ($this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Ajaxify viewtopic data
if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Fix issues if the inserted post is not the first.
if ($this->qr_insert && !$this->qr_first) {
$this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
}
$page_title = $event['page_title'];
$this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
// Output the page
page_header($page_title, false, $forum_id);
page_footer(false, false, false);
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
}
if ($s_quick_reply) {
include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
$quote_status = true;
// Build custom bbcodes array
if ($bbcode_status) {
display_custom_bbcodes();
}
// Generate smiley listing
if ($smilies_status) {
generate_smilies('inline', $forum_id);
}
// Show attachment box for adding attachments if true
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
$allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
$attachment_data = false;
if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
$this->user->add_lang('posting');
}
if ($this->config['qr_attach'] && $allowed) {
$this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$message_parser->set_plupload($this->plupload);
$message_parser->set_mimetype_guesser($this->mimetype_guesser);
$message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
示例2: unset
$message_parser = new parse_message();
if (isset($post_data['post_text'])) {
$message_parser->message =& $post_data['post_text'];
unset($post_data['post_text']);
}
// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);
foreach ($uninit as $var_name => $default_value) {
if (!isset($post_data[$var_name])) {
$post_data[$var_name] = $default_value;
}
}
unset($uninit);
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data($post_data['poster_id']);
if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') {
// Do not change to SELECT *
$sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename
FROM ' . ATTACHMENTS_TABLE . "\n\t\tWHERE post_msg_id = {$post_id}\n\t\t\tAND in_message = 0\n\t\t\tAND is_orphan = 0\n\t\tORDER BY filetime DESC";
$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
}
if ($post_data['poster_id'] == ANONYMOUS) {
$post_data['username'] = $mode == 'quote' || $mode == 'edit' ? trim($post_data['post_username']) : '';
} else {
$post_data['username'] = $mode == 'quote' || $mode == 'edit' ? trim($post_data['username']) : '';
}
$post_data['enable_urls'] = $post_data['enable_magic_url'];
if ($mode != 'edit') {
示例3: compose_pm
//.........这里部分代码省略.........
$max_recipients = !$max_recipients ? $config['pm_max_recipients'] : $max_recipients;
// If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients
if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all) {
// We try to include every previously listed member from the TO Header
$list = rebuild_header(array('to' => $post['to_address']));
// Can be an empty array too ;)
$list = !empty($list['u']) ? $list['u'] : array();
$list[$post['author_id']] = 'to';
if (isset($list[$user->data['user_id']])) {
unset($list[$user->data['user_id']]);
}
$max_recipients = $max_recipients < sizeof($list) ? sizeof($list) : $max_recipients;
unset($list);
}
// Handle User/Group adding/removing
handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);
// Check mass pm to group permission
if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) {
$address_list = array();
$error[] = $user->lang['NO_AUTH_GROUP_MESSAGE'];
}
// Check mass pm to users permission
if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) {
$address_list = get_recipients($address_list, 1);
$error[] = $user->lang('TOO_MANY_RECIPIENTS', 1);
}
// Check for too many recipients
if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) {
$address_list = get_recipients($address_list, $max_recipients);
$error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients);
}
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data();
if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') {
// Do not change to SELECT *
$sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize
FROM ' . ATTACHMENTS_TABLE . "\n\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\tAND in_message = 1\n\t\t\t\tAND is_orphan = 0\n\t\t\tORDER BY filetime DESC";
$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
}
if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) {
$enable_sig = $config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig');
$enable_smilies = $config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies');
$enable_bbcode = $config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode');
$enable_urls = true;
}
$enable_magic_url = $drafts = false;
// User own some drafts?
if ($auth->acl_get('u_savedrafts') && $action != 'delete') {
$sql = 'SELECT draft_id
FROM ' . DRAFTS_TABLE . '
WHERE forum_id = 0
AND topic_id = 0
AND user_id = ' . $user->data['user_id'] . ($draft_id ? " AND draft_id <> {$draft_id}" : '');
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row) {
$drafts = true;
}
}
if ($action == 'edit') {
$message_parser->bbcode_uid = $bbcode_uid;
}
示例4: reply_post_func
//.........这里部分代码省略.........
trigger_error($post_data['forum_status'] == ITEM_LOCKED ? 'FORUM_LOCKED' : 'TOPIC_LOCKED');
}
$subject = (strpos($subject, 'Re: ') !== 0 ? 'Re: ' : '') . ($subject ? $subject : censor_text($post_data['topic_title']));
$post_data['post_edit_locked'] = isset($post_data['post_edit_locked']) ? (int) $post_data['post_edit_locked'] : 0;
$post_data['post_subject'] = isset($post_data['topic_title']) ? $post_data['topic_title'] : '';
$post_data['topic_time_limit'] = isset($post_data['topic_time_limit']) ? $post_data['topic_time_limit'] ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit'] : 0;
$post_data['poll_length'] = !empty($post_data['poll_length']) ? (int) $post_data['poll_length'] / 86400 : 0;
$post_data['poll_start'] = !empty($post_data['poll_start']) ? (int) $post_data['poll_start'] : 0;
$post_data['icon_id'] = 0;
$post_data['poll_options'] = array();
// Get Poll Data
if ($post_data['poll_start']) {
$sql = 'SELECT poll_option_text
FROM ' . POLL_OPTIONS_TABLE . "\n WHERE topic_id = {$topic_id}\n ORDER BY poll_option_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$post_data['poll_options'][] = trim($row['poll_option_text']);
}
$db->sql_freeresult($result);
}
$orig_poll_options_size = sizeof($post_data['poll_options']);
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$message_parser = new parse_message();
// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);
foreach ($uninit as $var_name => $default_value) {
if (!isset($post_data[$var_name])) {
$post_data[$var_name] = $default_value;
}
}
unset($uninit);
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data($post_data['poster_id']);
$post_data['username'] = '';
$post_data['enable_urls'] = $post_data['enable_magic_url'];
$post_data['enable_sig'] = $config['allow_sig'] && $user->optionget('attachsig') ? true : false;
$post_data['enable_smilies'] = $config['allow_smilies'] && $user->optionget('smilies') ? true : false;
$post_data['enable_bbcode'] = $config['allow_bbcode'] && $user->optionget('bbcode') ? true : false;
$post_data['enable_urls'] = true;
$post_data['enable_magic_url'] = $post_data['drafts'] = false;
$check_value = ($post_data['enable_bbcode'] + 1 << 8) + ($post_data['enable_smilies'] + 1 << 4) + ($post_data['enable_urls'] + 1 << 2) + ($post_data['enable_sig'] + 1 << 1);
// Check if user is watching this topic
if ($config['allow_topic_notify'] && $user->data['is_registered']) {
$sql = 'SELECT topic_id
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id . '
AND user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
$post_data['notify_set'] = (int) $db->sql_fetchfield('topic_id');
$db->sql_freeresult($result);
}
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash'] ? true : false;
$quote_status = $auth->acl_get('f_reply', $forum_id) ? true : false;
$post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);
$post_data['post_subject'] = utf8_normalize_nfc($subject);
$message_parser->message = utf8_normalize_nfc(htmlspecialchars($text_body));
$post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
$post_data['post_edit_reason'] = '';
$post_data['orig_topic_type'] = $post_data['topic_type'];
$post_data['topic_type'] = request_var('topic_type', (int) $post_data['topic_type']);
示例5: new_topic_func
function new_topic_func($xmlrpc_params)
{
global $db, $auth, $user, $config, $phpbb_root_path, $phpEx, $mobiquo_config;
$user->setup('posting');
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_POST');
}
$params = php_xmlrpc_decode($xmlrpc_params);
// get parameters
$forum_id = isset($params[0]) ? intval($params[0]) : '';
$subject = isset($params[1]) ? $params[1] : '';
$text_body = isset($params[2]) ? $params[2] : '';
require_once 'include/emoji.php';
$text_body = emoji_unified_to_names($text_body);
$_POST['attachment_data'] = isset($params[5]) && $params[5] ? unserialize(base64_decode($params[5])) : array();
if (!$forum_id) {
trigger_error('NO_FORUM');
}
if (utf8_clean_string($subject) === '') {
trigger_error('EMPTY_SUBJECT');
}
if (utf8_clean_string($text_body) === '') {
trigger_error('TOO_FEW_CHARS');
}
$post_data = array();
$current_time = time();
$sql = 'SELECT * FROM ' . FORUMS_TABLE . " WHERE forum_id = {$forum_id}";
$result = $db->sql_query($sql);
$post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$post_data) {
trigger_error('NO_FORUM');
}
// Need to login to passworded forum first?
if ($post_data['forum_password'] && !check_forum_password($forum_id)) {
trigger_error('LOGIN_FORUM');
}
// Check permissions
if ($user->data['is_bot']) {
trigger_error('NOT_AUTHORISED');
}
// Is the user able to read and post within this forum?
if (!$auth->acl_get('f_read', $forum_id)) {
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('USER_CANNOT_READ');
}
trigger_error('LOGIN_EXPLAIN_POST');
}
if (!$auth->acl_get('f_post', $forum_id)) {
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('USER_CANNOT_POST');
}
trigger_error('LOGIN_EXPLAIN_POST');
}
// 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 && !$auth->acl_get('m_edit', $forum_id)) {
trigger_error('FORUM_LOCKED');
}
$post_data['quote_username'] = '';
$post_data['post_edit_locked'] = 0;
$post_data['post_subject'] = '';
$post_data['topic_time_limit'] = 0;
$post_data['poll_length'] = 0;
$post_data['poll_start'] = 0;
$post_data['icon_id'] = 0;
$post_data['poll_options'] = array();
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$message_parser = new parse_message();
// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);
foreach ($uninit as $var_name => $default_value) {
if (!isset($post_data[$var_name])) {
$post_data[$var_name] = $default_value;
}
}
unset($uninit);
if ($config['allow_topic_notify'] && $user->data['is_registered']) {
$notify = $user->data['user_notify'] ? true : false;
} else {
$notify = false;
}
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data($post_data['poster_id']);
$post_data['username'] = '';
$post_data['enable_urls'] = $post_data['enable_magic_url'];
$post_data['enable_sig'] = $config['allow_sig'] && $user->optionget('attachsig') ? true : false;
$post_data['enable_smilies'] = $config['allow_smilies'] && $user->optionget('smilies') ? true : false;
$post_data['enable_bbcode'] = $config['allow_bbcode'] && $user->optionget('bbcode') ? true : false;
$post_data['enable_urls'] = true;
$post_data['enable_magic_url'] = $post_data['drafts'] = false;
$check_value = ($post_data['enable_bbcode'] + 1 << 8) + ($post_data['enable_smilies'] + 1 << 4) + ($post_data['enable_urls'] + 1 << 2) + ($post_data['enable_sig'] + 1 << 1);
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $auth->acl_get('f_img', $forum_id) ? true : false;
//.........这里部分代码省略.........
示例6: while
if ($poll_start) {
$sql = 'SELECT poll_option_text
FROM ' . FORUMS_POLL_OPTIONS_TABLE . "\n\t\tWHERE topic_id = {$topic_id}\n\t\tORDER BY poll_option_id";
$result = $_CLASS['core_db']->query($sql);
while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
$poll_options[] = trim($row['poll_option_text']);
}
$_CLASS['core_db']->free_result($result);
}
$orig_poll_options_size = sizeof($poll_options);
$message_parser = new parse_message();
if (isset($post_text)) {
$message_parser->message = $post_text;
unset($post_text);
}
$message_parser->get_submitted_attachment_data();
// Set uninitialized variables
$uninit = array('post_attachment' => 0, 'poster_id' => 0, 'enable_magic_url' => 0, 'topic_status' => ITEM_UNLOCKED, 'topic_type' => POST_NORMAL, 'subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '');
foreach ($uninit as $var_name => $default_value) {
if (!isset($posting_data[$var_name])) {
$posting_data[$var_name] = $default_value;
}
}
unset($uninit, $var_name, $default_value);
if ($posting_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') {
$sql = 'SELECT attach_id, physical_filename, comment, real_filename, extension, mimetype, filesize, filetime, thumbnail
FROM ' . FORUMS_ATTACHMENTS_TABLE . "\n\t\tWHERE post_msg_id = {$post_id}\n\t\t\tAND in_message = 0\n\t\tORDER BY filetime " . (!$config['display_order'] ? 'DESC' : 'ASC');
$result = $_CLASS['core_db']->query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $_CLASS['core_db']->fetch_row_assocset($result));
$_CLASS['core_db']->free_result($result);
}
示例7: save_raw_post_func
function save_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);
$submit = true;
$preview = false;
$refresh = false;
$mode = 'edit';
// get post information from parameters
$post_id = intval($params[0]);
$post_title = $params[1];
$post_content = $params[2];
$GLOBALS['return_html'] = isset($params[3]) ? $params[3] : false;
$post_data = array();
$sql = 'SELECT p.*, t.*, 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 (t.forum_id = f.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_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');
}
}
// 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'] : '';
}
$post_data['post_edit_locked'] = isset($post_data['post_edit_locked']) ? (int) $post_data['post_edit_locked'] : 0;
$post_data['post_subject'] = in_array($mode, array('quote', 'edit')) ? $post_data['post_subject'] : (isset($post_data['topic_title']) ? $post_data['topic_title'] : '');
$post_data['topic_time_limit'] = isset($post_data['topic_time_limit']) ? $post_data['topic_time_limit'] ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit'] : 0;
$post_data['poll_length'] = !empty($post_data['poll_length']) ? (int) $post_data['poll_length'] / 86400 : 0;
$post_data['poll_start'] = !empty($post_data['poll_start']) ? (int) $post_data['poll_start'] : 0;
$post_data['icon_id'] = !isset($post_data['icon_id']) || in_array($mode, array('quote', 'reply')) ? 0 : (int) $post_data['icon_id'];
$post_data['poll_options'] = array();
// Get Poll Data
if ($post_data['poll_start']) {
$sql = 'SELECT poll_option_text
FROM ' . POLL_OPTIONS_TABLE . "\r\r\n WHERE topic_id = {$topic_id}\r\r\n ORDER BY poll_option_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$post_data['poll_options'][] = trim($row['poll_option_text']);
}
$db->sql_freeresult($result);
}
$orig_poll_options_size = sizeof($post_data['poll_options']);
$message_parser = new parse_message();
if (isset($post_data['post_text'])) {
$message_parser->message =& $post_data['post_text'];
unset($post_data['post_text']);
}
// Set some default variables
$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0);
foreach ($uninit as $var_name => $default_value) {
if (!isset($post_data[$var_name])) {
$post_data[$var_name] = $default_value;
}
}
unset($uninit);
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data($post_data['poster_id']);
//.........这里部分代码省略.........
示例8: remove_attachment_func
function remove_attachment_func($xmlrpc_params)
{
global $db, $auth, $user, $config, $phpbb_root_path, $phpEx;
$user->setup('posting');
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_POST');
}
$params = php_xmlrpc_decode($xmlrpc_params);
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
// get parameters
$attachment_id = isset($params[0]) ? intval($params[0]) : trigger_error('Attachment not exists');
$forum_id = isset($params[1]) ? intval($params[1]) : trigger_error('NO_FORUM');
$group_id = isset($params[2]) ? $params[2] : '';
$post_id = isset($params[3]) ? intval($params[3]) : '';
$_POST['attachment_data'] = $group_id ? unserialize(base64_decode($group_id)) : array();
// Forum does not exist
if (!$forum_id) {
trigger_error('NO_FORUM');
}
$sql = "SELECT f.* FROM " . FORUMS_TABLE . " f WHERE f.forum_id = {$forum_id}";
$result = $db->sql_query($sql);
$forum_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$forum_data) {
trigger_error('NO_FORUM');
}
if ($forum_data['forum_password'] && !check_forum_password($forum_id)) {
trigger_error('LOGIN_FORUM');
}
if (!$auth->acl_gets('f_read', $forum_id)) {
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('USER_CANNOT_READ');
}
trigger_error('LOGIN_EXPLAIN_POST');
}
// Is the user able to post within this forum?
if ($forum_data['forum_type'] != FORUM_POST) {
trigger_error('USER_CANNOT_FORUM_POST');
}
// Check permissions
if ($user->data['is_bot'] || !$auth->acl_get('f_attach', $forum_id) || !$auth->acl_get('u_attach') || !$config['allow_attachments'] || @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off') {
trigger_error('NOT_AUTHORISED');
}
if (!$auth->acl_get('f_post', $forum_id) && !$auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$auth->acl_get('f_reply', $forum_id)) {
trigger_error('USER_CANNOT_POST');
}
global $warn_msg;
$position = '';
foreach ($_POST['attachment_data'] as $pos => $data) {
if ($data['attach_id'] == $attachment_id) {
$position = $pos;
break;
}
}
if ($position === '') {
$warn_msg = 'Attachment not exists';
} else {
$_POST['delete_file'][$position] = 'Delete file';
$_REQUEST['delete_file'][$position] = 'Delete file';
$message_parser = new parse_message();
$message_parser->get_submitted_attachment_data();
$message_parser->parse_attachments('fileupload', 'post', $forum_id, false, false, true);
$group_id = base64_encode(serialize($message_parser->attachment_data));
$warn_msg = join("\n", $message_parser->warn_msg);
}
$xmlrpc_result = new xmlrpcval(array('result' => new xmlrpcval($warn_msg ? false : true, 'boolean'), 'result_text' => new xmlrpcval(strip_tags($warn_msg), 'base64'), 'group_id' => new xmlrpcval($group_id)), 'struct');
return new xmlrpcresp($xmlrpc_result);
}
示例9: compose_pm
//.........这里部分代码省略.........
require_once $site_file_root . 'includes/forums/message_parser.php';
$message_parser = new parse_message();
$message_subject = isset($message_subject) ? $message_subject : '';
$message_parser->message = $action == 'reply' ? '' : (isset($message_text) ? $message_text : '');
unset($message_text);
$s_action = "Control_Panel&i={$id}&mode={$mode}&action={$action}";
$s_action .= $msg_id ? "&p={$msg_id}" : '';
$s_action .= $quote_post ? "&q=1" : '';
// Delete triggered ?
if ($action == 'delete') {
// Folder id has been determined by the SQL Statement
// $folder_id = request_var('f', PRIVMSGS_NO_BOX);
$s_hidden_fields = '<input type="hidden" name="p" value="' . $msg_id . '" /><input type="hidden" name="f" value="' . $folder_id . '" /><input type="hidden" name="action" value="delete" />';
// Do we need to confirm ?
if (confirm_box(true)) {
delete_pm($_CLASS['core_user']->data['user_id'], $msg_id, $folder_id);
// TODO - jump to next message in "history"?
$meta_info = generate_link('Control_Panel&i=pm&folder=' . $folder_id);
$message = $_CLASS['core_user']->lang['MESSAGE_DELETED'];
meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
} else {
confirm_box(false, 'DELETE_MESSAGE', $s_hidden_fields);
}
}
// Handle User/Group adding/removing
handle_message_list_actions($address_list, $remove_u, $remove_g, $add_to, $add_bcc);
// Check for too many recipients
if (!$config['allow_mass_pm'] && num_recipients($address_list) > 1) {
$address_list = get_recipient_pos($address_list, 1);
$error[] = $_CLASS['core_user']->lang['TOO_MANY_RECIPIENTS'];
}
$message_parser->get_submitted_attachment_data();
if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') {
$sql = 'SELECT attach_id, physical_filename, comment, real_filename, extension, mimetype, filesize, filetime, thumbnail
FROM ' . FORUMS_ATTACHMENTS_TABLE . "\n\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime " . (!$config['display_order'] ? 'DESC' : 'ASC');
$result = $_CLASS['core_db']->query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $_CLASS['core_db']->fetch_row_assocset($result));
$_CLASS['core_db']->free_result($result);
}
if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) {
$enable_sig = $config['allow_sig'] && $_CLASS['auth']->acl_get('u_sig') && $_CLASS['core_user']->optionget('attachsig');
$enable_smilies = $config['allow_smilies'] && $_CLASS['auth']->acl_get('u_pm_smilies') && $_CLASS['core_user']->optionget('smilies');
$enable_bbcode = $config['allow_bbcode'] && $_CLASS['auth']->acl_get('u_pm_bbcode') && $_CLASS['core_user']->optionget('bbcode');
$enable_urls = true;
}
$enable_magic_url = $drafts = false;
// User own some drafts?
if ($_CLASS['auth']->acl_get('u_savedrafts') && $action != 'delete') {
$sql = 'SELECT draft_id
FROM ' . FORUMS_DRAFTS_TABLE . '
WHERE (forum_id = 0 AND topic_id = 0)
AND user_id = ' . $_CLASS['core_user']->data['user_id'] . ($draft_id ? " AND draft_id <> {$draft_id}" : '');
$result = $_CLASS['core_db']->query_limit($sql, 1);
if ($_CLASS['core_db']->fetch_row_assoc($result)) {
$drafts = true;
}
$_CLASS['core_db']->free_result($result);
}
if ($action == 'edit' || $action == 'forward') {
$message_parser->bbcode_uid = $bbcode_uid;
}
$config['auth_bbcode_pm'] = true;
$html_status = $config['allow_html'] && $config['auth_html_pm'] && $_CLASS['auth']->acl_get('u_pm_html');
$bbcode_status = $config['allow_bbcode'] && $config['auth_bbcode_pm'] && $_CLASS['auth']->acl_get('u_pm_bbcode');
示例10: compose_pm
//.........这里部分代码省略.........
$message = $user->lang['MESSAGE_DELETED'];
meta_refresh(3, $meta_info);
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
trigger_error($message);
}
else
{
$s_hidden_fields = array(
'p' => $msg_id,
'f' => $folder_id,
'action' => 'delete'
);
// "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose"
confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields));
}
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id));
}
// Handle User/Group adding/removing
handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);
// Check for too many recipients
if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1)
{
$address_list = get_recipient_pos($address_list, 1);
$error[] = $user->lang['TOO_MANY_RECIPIENTS'];
}
// Always check if the submitted attachment data is valid and belongs to the user.
// Further down (especially in submit_post()) we do not check this again.
$message_parser->get_submitted_attachment_data();
if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit')
{
// Do not change to SELECT *
$sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename
FROM ' . ATTACHMENTS_TABLE . "
WHERE post_msg_id = $msg_id
AND in_message = 1
AND is_orphan = 0
ORDER BY filetime DESC";
$result = $db->sql_query($sql);
$message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
}
if (!in_array($action, array('quote', 'edit', 'delete', 'forward')))
{
$enable_sig = ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig'));
$enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies'));
$enable_bbcode = ($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode'));
$enable_urls = true;
}
$enable_magic_url = $drafts = false;
// User own some drafts?
if ($auth->acl_get('u_savedrafts') && $action != 'delete')
{
$sql = 'SELECT draft_id
FROM ' . DRAFTS_TABLE . '
WHERE forum_id = 0
AND topic_id = 0
示例11: handle_attachments
/**
* Parse and display attachments
*
* @param int $forum_id Forum ID
* @param int $topic_id Topic ID
* @param bool $show_attach_box Whether we need to display the attachment box
*/
public function handle_attachments($forum_id, $topic_id, $show_attach_box)
{
if (!class_exists('parse_message')) {
include $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
}
$message_parser = new \parse_message();
$message_parser->set_plupload($this->plupload);
$message_parser->set_mimetype_guesser($this->mimetype_guesser);
$message_parser->get_submitted_attachment_data($this->user->data['user_id']);
$attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
posting_gen_inline_attachments($attachment_data);
$max_files = $this->auth->acl_get('a_') || $this->auth->acl_get('m_', $forum_id) ? 0 : (int) $this->config['max_attachments'];
$s_action = append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}");
$this->plupload->configure($this->cache, $this->template, $s_action, $forum_id, $max_files);
posting_gen_attachment_entry($attachment_data, $filename_data, $show_attach_box);
$this->template->assign_vars(array('S_QR_SHOW_ATTACH_BOX' => $this->config['qr_attach'] && $show_attach_box, 'S_ATTACH_DATA' => $attachment_data ? json_encode($attachment_data) : '[]'));
}