本文整理汇总了PHP中parse_message::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::parse方法的具体用法?PHP parse_message::parse怎么用?PHP parse_message::parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parse_message
的用法示例。
在下文中一共展示了parse_message::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_image
/**
* Insert the image into the database
*/
public static function upload_image(&$image_data, $album_id)
{
global $user, $db;
$sql_ary = array('image_filename' => $image_data['filename'], 'image_name' => $image_data['image_name'], 'image_name_clean' => utf8_clean_string($image_data['image_name']), 'image_user_id' => $user->data['user_id'], 'image_user_colour' => $user->data['user_colour'], 'image_username' => $image_data['username'], 'image_username_clean' => utf8_clean_string($image_data['username']), 'image_user_ip' => $user->ip, 'image_time' => $image_data['image_time'], 'image_album_id' => $image_data['image_album_id'], 'image_status' => phpbb_gallery::$auth->acl_check('i_approve', $album_id) ? phpbb_gallery_image::STATUS_APPROVED : phpbb_gallery_image::STATUS_UNAPPROVED, 'filesize_upload' => $image_data['image_filesize'], 'image_contest' => $image_data['image_contest'], 'image_exif_data' => $image_data['image_exif_data'], 'image_has_exif' => $image_data['image_has_exif']);
$message_parser = new parse_message();
$message_parser->message = utf8_normalize_nfc($image_data['image_desc']);
if ($message_parser->message) {
$message_parser->parse(true, true, true, true, false, true, true, true);
$sql_ary['image_desc'] = $message_parser->message;
$sql_ary['image_desc_uid'] = $message_parser->bbcode_uid;
$sql_ary['image_desc_bitfield'] = $message_parser->bbcode_bitfield;
} else {
$sql_ary['image_desc'] = '';
$sql_ary['image_desc_uid'] = '';
$sql_ary['image_desc_bitfield'] = '';
}
$sql = 'INSERT INTO ' . GALLERY_IMAGES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
$image_id = $db->sql_nextid();
if (phpbb_gallery::$user->get_data('watch_own')) {
$sql_ary = array('image_id' => $image_id, 'user_id' => $user->data['user_id']);
$sql = 'INSERT INTO ' . GALLERY_WATCH_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
return array('image_id' => $image_id, 'image_name' => $image_data['image_name']);
}
示例2: test_parse_poll
/**
* @dataProvider get_test_polls
*/
public function test_parse_poll($poll, $expected, $warn_msg = array())
{
$this->prepare_s9e_services();
$message_parser = new parse_message('Me[i]s[/i]sage');
// Add some default values
$poll += array('poll_length' => 123, 'poll_start' => 123, 'poll_last_vote' => 123, 'poll_vote_change' => true, 'enable_bbcode' => true, 'enable_urls' => true, 'enable_smilies' => true, 'img_status' => true);
$message_parser->parse_poll($poll);
$this->assertSame($expected, array_intersect_key($poll, $expected));
$this->assertSame('<r>Me<I><s>[i]</s>s<e>[/i]</e></I>sage</r>', $message_parser->parse(true, true, true, true, true, true, true, false));
$this->assertSame($warn_msg, $message_parser->warn_msg);
}
示例3:
if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_cur_post_id'] && $post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) {
if (topic_review($topic_id, $forum_id, 'post_review', $post_data['topic_cur_post_id'])) {
$template->assign_var('S_POST_REVIEW', true);
}
$submit = false;
$refresh = true;
}
// Parse Attachments - before checksum is calculated
$message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh);
// Grab md5 'checksum' of new message
$message_md5 = md5($message_parser->message);
// Check checksum ... don't re-parse message if the same
$update_message = $mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch ? true : false;
// Parse message
if ($update_message) {
$message_parser->parse($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], $img_status, $flash_status, $quote_status);
} else {
$message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
}
if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('f_ignoreflood', $forum_id)) {
// Flood check
$last_post_time = 0;
if ($user->data['is_registered']) {
$last_post_time = $user->data['user_lastpost_time'];
} else {
$sql = 'SELECT post_time AS last_post_time
FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE poster_ip = '" . $user->ip . "'\n\t\t\t\t\tAND post_time > " . ($current_time - $config['flood_interval']);
$result = $db->sql_query_limit($sql, 1);
if ($row = $db->sql_fetchrow($result)) {
$last_post_time = $row['last_post_time'];
}
示例4: send_pm
/**
* Sends user(s) notification via PM
*
*/
private function send_pm($to_id)
{
global $phpbb_root_path, $phpEx, $user;
if (!class_exists('parse_message')) {
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
}
if (!function_exists('submit_pm')) {
include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
}
// Setup the PM message parser.
$message_parser = new parse_message();
$message_parser->message = $this->message_text;
$message_parser->parse(true, true, true, true, true, true, true);
// setup the PM data...
$pm_data = array('from_user_id' => 2, 'from_username' => 'Site Notifications', 'address_list' => array('u' => array($to_id => 'to')), 'icon_id' => 0, 'from_user_ip' => $user->ip, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => false, 'message' => $message_parser->message, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid);
// Send the PM to the founders.
submit_pm('post', $this->message_title, $pm_data, false);
}
示例5: array
$poll_option_text = $original_poll_text = '';
$poll_options = array();
foreach (blog_data::$blog[$blog_id]['poll_options'] as $row) {
$poll_option_text .= $row['poll_option_text'] . "\n";
$poll_options[] = $row['poll_option_text'];
}
decode_message($poll_option_text, blog_data::$blog[$blog_id]['bbcode_uid']);
$original_poll_text = $poll_option_text;
if ($submit || $preview || $refresh) {
$blog_subject = utf8_normalize_nfc(request_var('subject', '', true));
$blog_text = utf8_normalize_nfc(request_var('message', '', true));
$post_options->set_status(!isset($_POST['disable_bbcode']), !isset($_POST['disable_smilies']), !isset($_POST['disable_magic_url']));
// set up the message parser to parse BBCode, Smilies, etc
$message_parser = new parse_message();
$message_parser->message = $blog_text;
$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);
// Check the basic posting data
$error = handle_basic_posting_data(true, 'blog', 'edit');
// If they did not include a subject, give them the empty subject error
if ($blog_subject == '' && !$refresh) {
$error[] = $user->lang['EMPTY_SUBJECT'];
}
// Polls
$poll_title = utf8_normalize_nfc(request_var('poll_title', '', true));
$poll_length = request_var('poll_length', 0);
$poll_option_text = utf8_normalize_nfc(request_var('poll_option_text', '', true));
$poll_max_options = request_var('poll_max_options', 1);
$poll_vote_change = isset($_POST['poll_vote_change']) ? 1 : 0;
if ($poll_option_text && $auth->acl_get('u_blog_create_poll') && !isset($_POST['poll_delete'])) {
$poll = array('poll_title' => $poll_title, 'poll_length' => $poll_length, 'poll_max_options' => $poll_max_options, 'poll_option_text' => $poll_option_text, 'poll_start' => time(), 'poll_last_vote' => 0, 'poll_vote_change' => $poll_vote_change, 'enable_bbcode' => $post_options->enable_bbcode, 'enable_urls' => $post_options->enable_magic_url, 'enable_smilies' => $post_options->enable_smilies, 'img_status' => $post_options->img_status);
$message_parser->parse_poll($poll);
示例6: generate_text_for_storage
/**
* For parsing custom parsed text to be stored within the database.
* This function additionally returns the uid and bitfield that needs to be stored.
* Expects $text to be the value directly from request_var() and in it's non-parsed form
*
* @param string $text The text to be replaced with the parsed one
* @param string $uid The BBCode uid for this parse
* @param string $bitfield The BBCode bitfield for this parse
* @param int $flags The allow_bbcode, allow_urls and allow_smilies compiled into a single integer.
* @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed)
* @param bool $allow_urls If urls is allowed
* @param bool $allow_smilies If smilies are allowed
*
* @return array An array of string with the errors that occurred while parsing
*/
function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
{
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
/**
* Use this event to modify the text before it is prepared for storage
*
* @event core.modify_text_for_storage_before
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @var bool allow_bbcode Whether or not to parse BBCode
* @var bool allow_urls Whether or not to parse URLs
* @var bool allow_smilies Whether or not to parse Smilies
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags', 'allow_bbcode', 'allow_urls', 'allow_smilies');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars)));
$uid = $bitfield = '';
$flags = ($allow_bbcode ? OPTION_FLAG_BBCODE : 0) + ($allow_smilies ? OPTION_FLAG_SMILIES : 0) + ($allow_urls ? OPTION_FLAG_LINKS : 0);
if ($text === '') {
return;
}
if (!class_exists('parse_message')) {
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
}
$message_parser = new parse_message($text);
$message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies);
$text = $message_parser->message;
$uid = $message_parser->bbcode_uid;
// If the bbcode_bitfield is empty, there is no need for the uid to be stored.
if (!$message_parser->bbcode_bitfield) {
$uid = '';
}
$bitfield = $message_parser->bbcode_bitfield;
/**
* Use this event to modify the text after it is prepared for storage
*
* @event core.modify_text_for_storage_after
* @var string text The text to parse
* @var string uid The BBCode UID
* @var string bitfield The BBCode Bitfield
* @var int flags The BBCode Flags
* @since 3.1.0-a1
*/
$vars = array('text', 'uid', 'bitfield', 'flags');
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars)));
return $message_parser->warn_msg;
}
示例7: compose_pm
/**
* Compose private message
* Called from ucp_pm with mode == 'compose'
*/
function compose_pm($id, $mode, $action, $user_folders = array())
{
global $template, $db, $auth, $user, $cache;
global $phpbb_root_path, $phpEx, $config;
global $request, $phpbb_dispatcher, $phpbb_container;
// Damn php and globals - i know, this is horrible
// Needed for handle_message_list_actions()
global $refresh, $submit, $preview;
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
if (!$action) {
$action = 'post';
}
add_form_key('ucp_pm_compose');
// Grab only parameters needed here
$to_user_id = request_var('u', 0);
$to_group_id = request_var('g', 0);
$msg_id = request_var('p', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);
// Reply to all triggered (quote/reply)
$reply_to_all = request_var('reply_to_all', 0);
$address_list = $request->variable('address_list', array('' => array(0 => '')));
$submit = isset($_POST['post']) ? true : false;
$preview = isset($_POST['preview']) ? true : false;
$save = isset($_POST['save']) ? true : false;
$load = isset($_POST['load']) ? true : false;
$cancel = isset($_POST['cancel']) && !isset($_POST['save']) ? true : false;
$delete = isset($_POST['delete']) ? true : false;
$remove_u = isset($_REQUEST['remove_u']) ? true : false;
$remove_g = isset($_REQUEST['remove_g']) ? true : false;
$add_to = isset($_REQUEST['add_to']) ? true : false;
$add_bcc = isset($_REQUEST['add_bcc']) ? true : false;
$refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load || $remove_u || $remove_g || $add_to || $add_bcc;
$action = $delete && !$preview && !$refresh && $submit ? 'delete' : $action;
$select_single = $config['allow_mass_pm'] && $auth->acl_get('u_masspm') ? false : true;
$error = array();
$current_time = time();
// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || $current_time - $lastclick < 2 && $submit) {
if ($msg_id) {
redirect(append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=view&action=view_message&p=' . $msg_id));
}
redirect(append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm'));
}
// Since viewtopic.php language entries are used in several modes,
// we include the language file here
$user->add_lang('viewtopic');
/**
* Modify the default vars before composing a PM
*
* @event core.ucp_pm_compose_modify_data
* @var int msg_id post_id in the page request
* @var int to_user_id The id of whom the message is to
* @var int to_group_id The id of the group the message is to
* @var bool submit Whether the form has been submitted
* @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 Whether the user is deleting the PM
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.4-RC1
*/
$vars = array('msg_id', 'to_user_id', 'to_group_id', 'submit', 'preview', 'action', 'delete', 'reply_to_all');
extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_data', compact($vars)));
// Output PM_TO box if message composing
if ($action != 'edit') {
// Add groups to PM box
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) {
$sql = 'SELECT g.group_id, g.group_name, g.group_type
FROM ' . GROUPS_TABLE . ' g';
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) {
$sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')';
}
$sql .= $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') ? ' WHERE ' : ' AND ';
$sql .= 'g.group_receive_pm = 1
ORDER BY g.group_type DESC, g.group_name ASC';
$result = $db->sql_query($sql);
$group_options = '';
while ($row = $db->sql_fetchrow($result)) {
$group_options .= '<option' . ($row['group_type'] == GROUP_SPECIAL ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . ($row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
}
$template->assign_vars(array('S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => $config['allow_mass_pm'] && $auth->acl_get('u_masspm') ? true : false, 'S_GROUP_OPTIONS' => $config['allow_mass_pm'] && $auth->acl_get('u_masspm_group') ? $group_options : '', 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=searchuser&form=postform&field=username_list&select_single={$select_single}")));
}
$sql = '';
$folder_id = 0;
// What is all this following SQL for? Well, we need to know
// some basic information in all cases before we do anything.
//.........这里部分代码省略.........
示例8: array
if ($user->data['user_id'] != ANONYMOUS) {
$sql = 'SELECT notify_status FROM ' . TOPICS_WATCH_TABLE . " WHERE topic_id = {$report['topic_id']} AND user_id = {$user->data['user_id']}";
$result = $db->sql_query($sql);
$is_subscribed = $db->sql_fetchrow($result) != false;
$db->sql_freeresult($result);
} else {
$is_subscribed = false;
}
// 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);
示例9: reply_post_func
function reply_post_func($xmlrpc_params)
{
global $db, $auth, $user, $config, $phpbb_root_path, $phpEx, $mobiquo_config, $phpbb_home;
require_once 'include/emoji.php';
$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]) : '';
$topic_id = isset($params[1]) ? intval($params[1]) : '';
$subject = isset($params[2]) ? $params[2] : '';
$text_body = isset($params[3]) ? $params[3] : '';
$text_body = emoji_unified_to_names($text_body);
$attach_list = isset($params[4]) ? $params[4] : array();
$_POST['attachment_data'] = isset($params[5]) && $params[5] ? unserialize(base64_decode($params[5])) : array();
$GLOBALS['return_html'] = isset($params[6]) ? $params[6] : false;
if (!$topic_id) {
trigger_error('NO_TOPIC');
}
if (utf8_clean_string($text_body) === '') {
trigger_error('TOO_FEW_CHARS');
}
$post_data = array();
$current_time = time();
// get topic data
$sql = 'SELECT *
FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);
$post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// get forum data
$sql = 'SELECT *
FROM ' . FORUMS_TABLE . "\n WHERE forum_type = " . FORUM_POST . ($post_data['forum_id'] ? "\n AND forum_id = '{$post_data['forum_id']}' " : '');
$result = $db->sql_query_limit($sql, 1);
$forum_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$post_data = array_merge($post_data, $forum_data);
if (!$post_data) {
trigger_error('NO_TOPIC');
}
// Use post_row values in favor of submitted ones...
$forum_id = !empty($post_data['forum_id']) ? (int) $post_data['forum_id'] : (int) $forum_id;
$topic_id = !empty($post_data['topic_id']) ? (int) $post_data['topic_id'] : (int) $topic_id;
// 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 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');
}
// Permission to do the reply
if (!$auth->acl_get('f_reply', $forum_id)) {
if ($user->data['user_id'] != ANONYMOUS) {
trigger_error('USER_CANNOT_REPLY');
}
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 || 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');
}
$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) {
//.........这里部分代码省略.........
示例10: 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;
//.........这里部分代码省略.........
示例11: 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));
/*
//.........这里部分代码省略.........
示例12: 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']);
//.........这里部分代码省略.........
示例13: basename
/**
* Insert the warning into the database
*/
function add_warning($user_row, $warning, $warn_len, $warn_len_other, $warn_type = WARNING, $send_pm = true, $post_id = 0)
{
global $phpEx, $phpbb_root_path, $config, $phpbb_log;
global $template, $db, $user, $auth, $cache;
if (!in_array($warn_type, array(WARNING, BAN))) {
$warn_type = WARNING;
}
$warn_end = $this->get_warning_end($warn_len, $warn_len_other);
if ($send_pm) {
require $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
require $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$user_row['user_lang'] = file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.{$phpEx}") ? $user_row['user_lang'] : $config['default_lang'];
include $phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.{$phpEx}";
$message_parser = new \parse_message();
$message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
$message_parser->parse(true, true, true, false, false, true, true);
$pm_data = array('from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'enable_sig' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => false, 'icon_id' => 0, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'address_list' => array('u' => array($user_row['user_id'] => 'to')));
submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
}
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', time(), array('username' => $user_row['username']));
$log_id = $phpbb_log->add('user', $user->data['user_id'], $user_row['user_ip'], 'LOG_USER_WARNING_BODY', time(), array($warning, 'reportee_id' => $user_row['user_id']));
$sql_ary = array('user_id' => $user_row['user_id'], 'post_id' => $post_id, 'log_id' => $log_id, 'warning_time' => time(), 'warning_end' => (int) $warn_end, 'warning_type' => $warn_type, 'warning_status' => 1);
$db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_warnings = user_warnings + 1,
user_last_warning = ' . time() . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
$cache->destroy('sql', WARNINGS_TABLE);
// We add this to the mod log too for moderators to see that a specific user got warned.
$sql = 'SELECT forum_id, topic_id
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $post_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', time(), array('forum_id' => $row['forum_id'], 'topic_id' => $row['topic_id'], 'username' => $user_row['username']));
}
示例14: edit
public function edit($image_id)
{
//we cheat a little but we will make good later
global $phpbb_root_path, $phpEx;
$image_data = $this->image->get_image_data($image_id);
$album_id = $image_data['image_album_id'];
$album_data = $this->album->get_info($album_id);
$this->user->add_lang_ext('phpbbgallery/core', array('gallery'));
$this->display->generate_navigation($album_data);
add_form_key('gallery');
$submit = $this->request->variable('submit', false);
$image_backlink = append_sid('./gallery/image/' . $image_id);
$album_backlink = append_sid('./gallery/album/' . $image_data['image_album_id']);
$disp_image_data = $image_data;
$owner_id = $image_data['image_user_id'];
$album_loginlink = './ucp.php?mode=login';
$this->gallery_auth->load_user_premissions($this->user->data['user_id']);
if (!$this->gallery_auth->acl_check('i_edit', $album_id, $owner_id) || $image_data['image_status'] == \phpbbgallery\core\image\image::STATUS_ORPHAN) {
if (!$this->gallery_auth->acl_check('m_edit', $album_id, $owner_id)) {
$this->misc->not_authorised($album_backlink, $album_loginlink, 'LOGIN_EXPLAIN_UPLOAD');
}
}
if ($submit) {
if (!check_form_key('gallery')) {
trigger_error('FORM_INVALID');
}
$image_desc = $this->request->variable('message', array(''), true);
$image_desc = $image_desc[0];
$image_name = $this->request->variable('image_name', array(''), true);
$image_name = $image_name[0];
if (strlen($image_desc) > $this->gallery_config->get('description_length')) {
trigger_error($this->user->lang('DESC_TOO_LONG'));
}
// Create message parser instance
include_once $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$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) . '
//.........这里部分代码省略.........
示例15: array
$message = html_entity_decode_utf8($message);
//var_dump($message);echo"\n\n\n\n";
// Here we "request_var" the post
set_var($message, $message, 'string', true);
$message = utf8_normalize_nfc($message);
//var_dump($message);echo"\n\n\n\n";
// Restore the var
$message_parser->message =& $message;
//var_dump($message_parser->message);echo"\n\n\n\n";
/*
*Now we can handle the post as in the submit action
*/
// Define flags
$post_flags = array('enable_bbcode' => $config['allow_bbcode'] ? $post_data['enable_bbcode'] : false, 'enable_magic_url' => $config['allow_post_links'] ? $post_data['enable_magic_url'] : false, 'enable_smilies' => $post_data['enable_smilies'], 'img_status' => $config['allow_bbcode'] ? true : false, 'flash_status' => $config['allow_bbcode'] && $config['allow_post_flash'] ? true : false, 'enable_urls' => $config['allow_post_links']);
// Parse the post
$message_parser->parse($post_flags['enable_bbcode'], $post_flags['enable_magic_url'], $post_flags['enable_smilies'], $post_flags['img_status'], $post_flags['flash_status'], true, $post_flags['enable_urls']);
// Update the post data
$post_data = array_merge($post_data, $post_flags, array('message' => $message_parser->message, 'message_md5' => md5($message_parser->message), 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid));
// Make sure some required vars are set
$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' => 0, 'notify_set' => 0);
foreach ($uninit as $var_name => $default_value) {
if (!isset($post_data[$var_name])) {
$post_data[$var_name] = $default_value;
}
}
unset($uninit);
// Handle poll
$poll = array();
// DEBUG
echo '<pre>';
var_dump($message_parser);