本文整理汇总了PHP中parse_message::set_plupload方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::set_plupload方法的具体用法?PHP parse_message::set_plupload怎么用?PHP parse_message::set_plupload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse_message
的用法示例。
在下文中一共展示了parse_message::set_plupload方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: compose_pm
//.........这里部分代码省略.........
$check_value = 0;
} else {
$check_value = ($post['enable_bbcode'] + 1 << 8) + ($post['enable_smilies'] + 1 << 4) + ($enable_urls + 1 << 2) + ($post['enable_sig'] + 1 << 1);
}
}
} else {
$message_attachment = 0;
$message_text = $message_subject = '';
if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post') {
$address_list['u'][$to_user_id] = 'to';
} else {
if ($to_group_id && $action == 'post') {
$address_list['g'][$to_group_id] = 'to';
}
}
$check_value = 0;
}
if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) {
trigger_error('NO_AUTH_GROUP_MESSAGE');
}
if ($action == 'edit' && !$refresh && !$preview && !$submit) {
if (!($message_time > time() - $config['pm_edit_time'] * 60 || !$config['pm_edit_time'])) {
trigger_error('CANNOT_EDIT_MESSAGE_TIME');
}
}
if ($action == 'post') {
$template->assign_var('S_NEW_MESSAGE', true);
}
if (!isset($icon_id)) {
$icon_id = 0;
}
$message_parser = new parse_message();
$plupload = $phpbb_container->get('plupload');
$message_parser->set_plupload($plupload);
$message_parser->message = $action == 'reply' ? '' : $message_text;
unset($message_text);
$s_action = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i={$id}&mode={$mode}&action={$action}", true, $user->session_id);
$s_action .= ($folder_id ? "&f={$folder_id}" : '') . ($msg_id ? "&p={$msg_id}" : '');
// Delete triggered ?
if ($action == 'delete') {
// Folder id has been determined by the SQL Statement
// $folder_id = request_var('f', PRIVMSGS_NO_BOX);
// Do we need to confirm ?
if (confirm_box(true)) {
delete_pm($user->data['user_id'], $msg_id, $folder_id);
// jump to next message in "history"? nope, not for the moment. But able to be included later.
$meta_info = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&folder={$folder_id}");
$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));
}
// Get maximum number of allowed recipients
$sql = 'SELECT MAX(g.group_max_recipients) as max_recipients
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
AND ug.group_id = g.group_id';
$result = $db->sql_query($sql);
$max_recipients = (int) $db->sql_fetchfield('max_recipients');
示例3: while
$sql = 'SELECT poll_option_text
FROM ' . POLL_OPTIONS_TABLE . "\n\t\tWHERE topic_id = {$topic_id}\n\t\tORDER 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);
}
if ($mode == 'edit') {
$original_poll_data = array('poll_title' => $post_data['poll_title'], 'poll_length' => $post_data['poll_length'], 'poll_max_options' => $post_data['poll_max_options'], 'poll_option_text' => implode("\n", $post_data['poll_options']), 'poll_start' => $post_data['poll_start'], 'poll_last_vote' => $post_data['poll_last_vote'], 'poll_vote_change' => $post_data['poll_vote_change']);
}
$orig_poll_options_size = sizeof($post_data['poll_options']);
$message_parser = new parse_message();
$plupload = $phpbb_container->get('plupload');
$mimetype_guesser = $phpbb_container->get('mimetype.guesser');
$message_parser->set_plupload($plupload);
$message_parser->set_mimetype_guesser($mimetype_guesser);
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.
示例4: 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) : '[]'));
}