当前位置: 首页>>代码示例>>PHP>>正文


PHP parse_message::parse_attachments方法代码示例

本文整理汇总了PHP中parse_message::parse_attachments方法的典型用法代码示例。如果您正苦于以下问题:PHP parse_message::parse_attachments方法的具体用法?PHP parse_message::parse_attachments怎么用?PHP parse_message::parse_attachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在parse_message的用法示例。


在下文中一共展示了parse_message::parse_attachments方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 }
 // If replying/quoting and last post id has changed
 // give user option to continue submit or return to post
 // notify and show user the post made between his request and the final submit
 if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_cur_post_id'] && $post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) {
     // Only do so if it is allowed forum-wide
     if ($post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) {
         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);
 // If editing and checksum has changed we know the post was edited while we're editing
 // Notify and show user the changed post
 if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) {
     $edit_post_message_checksum = request_var('edit_post_message_checksum', '');
     $edit_post_subject_checksum = request_var('edit_post_subject_checksum', '');
     // $post_data['post_checksum'] is the checksum of the post submitted in the meantime
     // $message_md5 is the checksum of the post we're about to submit
     // $edit_post_message_checksum is the checksum of the post we're editing
     // ...
     // We make sure nobody else made exactly the same change
     // we're about to submit by also checking $message_md5 != $post_data['post_checksum']
     if ($edit_post_message_checksum !== '' && $edit_post_message_checksum != $post_data['post_checksum'] && $message_md5 != $post_data['post_checksum'] || $edit_post_subject_checksum !== '' && $edit_post_subject_checksum != $post_data['post_subject_md5'] && md5($post_data['post_subject']) != $post_data['post_subject_md5']) {
         if (topic_review($topic_id, $forum_id, 'post_review_edit', $post_id)) {
开发者ID:PetsFundation,项目名称:Pets,代码行数:31,代码来源:posting.php

示例2: reply_post_func


//.........这里部分代码省略.........
        $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']);
    $post_data['topic_time_limit'] = request_var('topic_time_limit', (int) $post_data['topic_time_limit']);
    $post_data['icon_id'] = request_var('icon', 0);
    $post_data['enable_bbcode'] = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
    $post_data['enable_smilies'] = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
    $post_data['enable_urls'] = isset($_POST['disable_magic_url']) ? 0 : 1;
    $post_data['enable_sig'] = !$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig') ? false : ($user->data['is_registered'] ? true : false);
    if ($config['allow_topic_notify'] && $user->data['is_registered']) {
        $notify = !$post_data['notify_set'] ? $user->data['user_notify'] : $post_data['notify_set'] ? true : false;
    } else {
        $notify = false;
    }
    $post_data['poll_title'] = utf8_normalize_nfc(request_var('poll_title', '', true));
    $post_data['poll_length'] = request_var('poll_length', 0);
    $post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true));
    $post_data['poll_max_options'] = request_var('poll_max_options', 1);
    $post_data['poll_vote_change'] = $auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change']) ? 1 : 0;
    // Parse Attachments - before checksum is calculated
    $message_parser->parse_attachments('fileupload', 'reply', $forum_id, true, false, false);
    // Grab md5 'checksum' of new message
    $message_md5 = md5($message_parser->message);
    // Check checksum ... don't re-parse message if the same
    if (sizeof($message_parser->warn_msg)) {
        trigger_error(join("\n", $message_parser->warn_msg));
    }
    $message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
    if ($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                WHERE poster_ip = '" . $user->ip . "'\n                    AND 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'];
            }
            $db->sql_freeresult($result);
        }
        if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
            trigger_error('FLOOD_ERROR');
        }
    }
    // Validate username
    if ($post_data['username'] && !$user->data['is_registered']) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        if (($result = validate_username($post_data['username'], !empty($post_data['post_username']) ? $post_data['post_username'] : '')) !== false) {
            $user->add_lang('ucp');
            trigger_error($result . '_USERNAME');
        }
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:67,代码来源:reply_post.php

示例3: compose_pm


//.........这里部分代码省略.........
			FROM ' . DRAFTS_TABLE . "\n\t\t\tWHERE draft_id = {$draft_id}\n\t\t\t\tAND topic_id = 0\n\t\t\t\tAND forum_id = 0\n\t\t\t\tAND user_id = " . $user->data['user_id'];
        $result = $db->sql_query_limit($sql, 1);
        if ($row = $db->sql_fetchrow($result)) {
            $message_parser->message = $row['draft_message'];
            $message_subject = $row['draft_subject'];
            $template->assign_var('S_DRAFT_LOADED', true);
        } else {
            $draft_id = 0;
        }
        $db->sql_freeresult($result);
    }
    // Load Drafts
    if ($load && $drafts) {
        load_drafts(0, 0, $id, $action, $msg_id);
    }
    if ($submit || $preview || $refresh) {
        if (($submit || $preview) && !check_form_key('ucp_pm_compose')) {
            $error[] = $user->lang['FORM_INVALID'];
        }
        $subject = utf8_normalize_nfc(request_var('subject', '', true));
        $message_parser->message = utf8_normalize_nfc(request_var('message', '', true));
        $icon_id = request_var('icon', 0);
        $enable_bbcode = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
        $enable_smilies = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
        $enable_urls = isset($_POST['disable_magic_url']) ? 0 : 1;
        $enable_sig = !$config['allow_sig'] || !$config['allow_sig_pm'] ? false : (isset($_POST['attach_sig']) ? true : false);
        if ($submit) {
            $status_switch = ($enable_bbcode + 1 << 8) + ($enable_smilies + 1 << 4) + ($enable_urls + 1 << 2) + ($enable_sig + 1 << 1);
            $status_switch = $status_switch != $check_value;
        } else {
            $status_switch = 1;
        }
        // Parse Attachments - before checksum is calculated
        $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
        if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) {
            $error[] = implode('<br />', $message_parser->warn_msg);
            $message_parser->warn_msg = array();
        }
        // Parse message
        $message_parser->parse($enable_bbcode, $config['allow_post_links'] ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);
        // On a refresh we do not care about message parsing errors
        if (sizeof($message_parser->warn_msg) && !$refresh) {
            $error[] = implode('<br />', $message_parser->warn_msg);
        }
        if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) {
            // Flood check
            $last_post_time = $user->data['user_lastpost_time'];
            if ($last_post_time) {
                if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
                    $error[] = $user->lang['FLOOD_ERROR'];
                }
            }
        }
        // Subject defined
        if ($submit) {
            if (utf8_clean_string($subject) === '') {
                $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT'];
            }
            if (!sizeof($address_list)) {
                $error[] = $user->lang['NO_RECIPIENT'];
            }
        }
        // Store message, sync counters
        if (!sizeof($error) && $submit) {
            $pm_data = array('msg_id' => (int) $msg_id, 'from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'reply_from_root_level' => isset($post['root_level']) ? (int) $post['root_level'] : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'address_list' => $address_list);
            // ((!$message_subject) ? $subject : $message_subject)
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:ucp_pm_compose.php

示例4: save_raw_post_func


//.........这里部分代码省略.........
    $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;
    $solved_captcha = false;
    $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);
    $post_data['post_subject'] = utf8_normalize_nfc($post_title);
    $message_parser->message = utf8_normalize_nfc(htmlspecialchars($post_content));
    $post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
    $post_data['post_edit_reason'] = !empty($_POST['edit_reason']) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';
    $post_data['orig_topic_type'] = $post_data['topic_type'];
    $post_data['topic_type'] = request_var('topic_type', $mode != 'post' ? (int) $post_data['topic_type'] : POST_NORMAL);
    $post_data['topic_time_limit'] = request_var('topic_time_limit', $mode != 'post' ? (int) $post_data['topic_time_limit'] : 0);
    $post_data['icon_id'] = request_var('icon', 0);
    $post_data['enable_bbcode'] = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
    $post_data['enable_smilies'] = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
    $post_data['enable_urls'] = isset($_POST['disable_magic_url']) ? 0 : 1;
    $post_data['enable_sig'] = !$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig') ? false : ($user->data['is_registered'] ? true : false);
    if ($config['allow_topic_notify'] && $user->data['is_registered']) {
        $notify = isset($_POST['notify']) ? true : false;
    } else {
        $notify = false;
    }
    $topic_lock = isset($_POST['lock_topic']) ? true : $post_data['topic_status'];
    $post_lock = isset($_POST['lock_post']) ? true : $post_data['post_edit_locked'];
    $poll_delete = isset($_POST['poll_delete']) ? true : false;
    $status_switch = ($post_data['enable_bbcode'] + 1 << 8) + ($post_data['enable_smilies'] + 1 << 4) + ($post_data['enable_urls'] + 1 << 2) + ($post_data['enable_sig'] + 1 << 1);
    $status_switch = $status_switch != $check_value;
    //$post_data['poll_title']        = utf8_normalize_nfc(request_var('poll_title', '', true));
    //$post_data['poll_length']        = request_var('poll_length', 0);
    //$post_data['poll_option_text']    = utf8_normalize_nfc(request_var('poll_option_text', '', true));
    $post_data['poll_option_text'] = implode("\n", $post_data['poll_options']);
    //$post_data['poll_max_options']    = request_var('poll_max_options', 1);
    //$post_data['poll_vote_change']    = ($auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
    // 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 || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN ? true : false;
    // Parse message
    if ($update_message) {
        if (sizeof($message_parser->warn_msg)) {
            trigger_error(join("\n", $message_parser->warn_msg));
        }
        $message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
    } else {
        $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield'];
    }
    // Validate username
    if ($post_data['username'] && !$user->data['is_registered'] || $mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username']) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        if (($result = validate_username($post_data['username'], !empty($post_data['post_username']) ? $post_data['post_username'] : '')) !== false) {
            $user->add_lang('ucp');
            trigger_error($result . '_USERNAME');
        }
    }
    // Parse subject
    if (utf8_clean_string($post_data['post_subject']) === '' && $post_data['topic_first_post_id'] == $post_id) {
        trigger_error('EMPTY_SUBJECT');
    }
    $post_data['poll_last_vote'] = isset($post_data['poll_last_vote']) ? $post_data['poll_last_vote'] : 0;
    if ($post_data['poll_option_text'] && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id)) {
        $poll = array('poll_title' => $post_data['poll_title'], 'poll_length' => $post_data['poll_length'], 'poll_max_options' => $post_data['poll_max_options'], 'poll_option_text' => $post_data['poll_option_text'], 'poll_start' => $post_data['poll_start'], 'poll_last_vote' => $post_data['poll_last_vote'], 'poll_vote_change' => $post_data['poll_vote_change'], 'enable_bbcode' => $post_data['enable_bbcode'], 'enable_urls' => $post_data['enable_urls'], 'enable_smilies' => $post_data['enable_smilies'], 'img_status' => $img_status);
        $message_parser->parse_poll($poll);
        $post_data['poll_options'] = isset($poll['poll_options']) ? $poll['poll_options'] : '';
        $post_data['poll_title'] = isset($poll['poll_title']) ? $poll['poll_title'] : '';
    } else {
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:67,代码来源:save_raw_post.php

示例5: new_topic_func


//.........这里部分代码省略.........
    $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;
    $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', POST_NORMAL);
    $post_data['topic_time_limit'] = request_var('topic_time_limit', 0);
    $post_data['icon_id'] = request_var('icon', 0);
    $post_data['enable_bbcode'] = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
    $post_data['enable_smilies'] = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
    $post_data['enable_urls'] = isset($_POST['disable_magic_url']) ? 0 : 1;
    $post_data['enable_sig'] = !$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig') ? false : ($user->data['is_registered'] ? true : false);
    $topic_lock = isset($_POST['lock_topic']) ? true : false;
    $post_lock = isset($_POST['lock_post']) ? true : false;
    $poll_delete = isset($_POST['poll_delete']) ? true : false;
    $status_switch = ($post_data['enable_bbcode'] + 1 << 8) + ($post_data['enable_smilies'] + 1 << 4) + ($post_data['enable_urls'] + 1 << 2) + ($post_data['enable_sig'] + 1 << 1);
    $status_switch = $status_switch != $check_value;
    $post_data['poll_title'] = utf8_normalize_nfc(request_var('poll_title', '', true));
    $post_data['poll_length'] = request_var('poll_length', 0);
    $post_data['poll_option_text'] = utf8_normalize_nfc(request_var('poll_option_text', '', true));
    $post_data['poll_max_options'] = request_var('poll_max_options', 1);
    $post_data['poll_vote_change'] = $auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change']) ? 1 : 0;
    // Parse Attachments - before checksum is calculated
    $message_parser->parse_attachments('fileupload', 'post', $forum_id, true, false, false);
    // Grab md5 'checksum' of new message
    $message_md5 = md5($message_parser->message);
    if (sizeof($message_parser->warn_msg)) {
        trigger_error(join("\n", $message_parser->warn_msg));
    }
    $message_parser->parse($post_data['enable_bbcode'], $config['allow_post_links'] ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
    if ($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 . "\r\r\n                WHERE poster_ip = '" . $user->ip . "'\r\r\n                    AND 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'];
            }
            $db->sql_freeresult($result);
        }
        if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
            trigger_error('FLOOD_ERROR');
        }
    }
    // Validate username
    if ($post_data['username'] && !$user->data['is_registered']) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
        if (($result = validate_username($post_data['username'], !empty($post_data['post_username']) ? $post_data['post_username'] : '')) !== false) {
            $user->add_lang('ucp');
            trigger_error($result . '_USERNAME');
        }
    }
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:67,代码来源:new_topic.php

示例6: displayform

    /**
     * Display the form
     *
     * @access public
     */
    public function displayform()
    {
        $nru_group_id = $this->applicationform->getnruid();
        if ($this->user->data['is_bot'] || $this->user->data['user_id'] == ANONYMOUS || !$this->config['appform_nru'] && $nru_group_id === (int) $this->user->data['group_id']) {
            throw new http_exception(401, 'NOT_AUTHORISED');
        }
        $this->user->add_lang('posting');
        $this->user->add_lang_ext('rmcgirr83/applicationform', 'application');
        $attachment_allowed = $this->config['allow_attachments'] && $this->config['appform_attach'] ? true : false;
        $attachment_req = $this->config['appform_attach_req'];
        add_form_key('applicationform');
        $data = array('name' => $this->request->variable('name', '', true), 'why' => $this->request->variable('why', '', true), 'position' => $this->request->variable('position', '', true));
        if ($this->request->is_set_post('submit')) {
            $error = array();
            // Test if form key is valid
            if (!check_form_key('applicationform')) {
                $error[] = $this->user->lang['FORM_INVALID'];
            }
            $message_parser = new \parse_message();
            $message_parser->parse_attachments('fileupload', 'post', $this->config['appform_forum_id'], true, false, false);
            $error = array();
            // Test if form key is valid
            if (!check_form_key('applicationform')) {
                $error[] = $this->user->lang['FORM_INVALID'];
            }
            if ($data['name'] === '' || $data['why'] === '') {
                $error[] = $this->user->lang['APP_NOT_COMPLETELY_FILLED'];
            }
            if (empty($message_parser->attachment_data) && $attachment_req && $attachment_allowed) {
                $error[] = $this->user->lang['APPLICATION_REQUIRES_ATTACHMENT'];
            }
            // Setting the variables we need to submit the post to the forum where all the applications come in
            $message = censor_text(trim('[quote] ' . $data['why'] . '[/quote]'));
            $subject = sprintf($this->user->lang['APPLICATION_SUBJECT'], $this->user->data['username']);
            $url = generate_board_url() . '/memberlist.' . $this->php_ext . '?mode=viewprofile&u=' . $this->user->data['user_id'];
            $color = $this->user->data['user_colour'];
            $user_name = $this->user->data['is_registered'] ? '[url=' . $url . '][color=#' . $color . ']' . $this->user->data['username'] . '[/color][/url]' : $data['username'];
            $apply_post = sprintf($this->user->lang['APPLICATION_MESSAGE'], $user_name, $this->request->variable('name', '', true), $data['position'], $message);
            $message_parser->message = $apply_post;
            $message_md5 = md5($message_parser->message);
            if (sizeof($message_parser->warn_msg)) {
                $error[] = implode('<br />', $message_parser->warn_msg);
            }
            $message_parser->parse(true, true, true, true, false, true, true);
            // no errors, let's proceed
            if (!sizeof($error)) {
                $sql = 'SELECT forum_name
					FROM ' . FORUMS_TABLE . '
					WHERE forum_id = ' . (int) $this->config['appform_forum_id'];
                $result = $this->db->sql_query($sql);
                $forum_name = $this->db->sql_fetchfield('forum_name');
                $this->db->sql_freeresult($result);
                $data = array('forum_id' => $this->config['appform_forum_id'], 'icon_id' => false, 'poster_id' => $this->user->data['user_id'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $message_parser->message, 'message_md5' => $message_md5, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'poster_ip' => $this->user->ip, 'post_edit_locked' => 0, 'topic_title' => $subject, 'notify_set' => false, 'notify' => true, 'post_time' => time(), 'forum_name' => $forum_name, 'enable_indexing' => true, 'force_approved_state' => true, 'force_visibility' => true);
                $poll = array();
                if ($this->topicdescription !== null) {
                    $data['topic_desc'] = '';
                }
                // Submit the post!
                submit_post('post', $subject, $this->user->data['username'], POST_NORMAL, $poll, $data);
                $message = $this->user->lang['APPLICATION_SEND'];
                $message = $message . '<br /><br />' . sprintf($this->user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$this->root_path}index.{$this->php_ext}") . '">', '</a>');
                trigger_error($message);
            }
        }
        $form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' ? '' : ' enctype="multipart/form-data"';
        $this->template->assign_vars(array('REALNAME' => isset($data['name']) ? $data['name'] : '', 'APPLICATION_POSITIONS' => $this->display_positions(explode("\n", $this->config['appform_positions']), $data['position']), 'WHY' => isset($data['why']) ? $data['why'] : '', 'S_FORM_ENCTYPE' => $form_enctype, 'S_ERROR' => isset($error) && sizeof($error) ? implode('<br />', $error) : '', 'S_ATTACH_BOX' => $attachment_allowed && $form_enctype ? true : false, 'S_ATTACH_REQ' => $attachment_req));
        // Send all data to the template file
        return $this->helper->render('appform_body.html', $this->user->lang('APPLICATION_PAGETITLE'));
    }
开发者ID:rmcgirr83,项目名称:phpBB-3.1-applicationform,代码行数:74,代码来源:main_controller.php

示例7: 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);
}
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:69,代码来源:remove_attachment.php

示例8: compose_pm


//.........这里部分代码省略.........
    if ($draft_id && $_CLASS['auth']->acl_get('u_savedrafts')) {
        $sql = 'SELECT draft_subject, draft_message 
			FROM ' . FORUMS_DRAFTS_TABLE . " \n\t\t\tWHERE draft_id = {$draft_id}\n\t\t\t\tAND topic_id = 0\n\t\t\t\tAND forum_id = 0\n\t\t\t\tAND user_id = " . $_CLASS['core_user']->data['user_id'];
        $result = $_CLASS['core_db']->query_limit($sql, 1);
        if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
            $_REQUEST['subject'] = $row['draft_subject'];
            $_REQUEST['message'] = $row['draft_message'];
            $refresh = true;
            $_CLASS['core_template']->assign('S_DRAFT_LOADED', true);
        } else {
            $draft_id = 0;
        }
    }
    // Load Drafts
    if ($load && $drafts) {
        load_drafts(0, 0, $id);
    }
    if ($submit || $preview || $refresh) {
        $subject = mb_strtolower(get_variable('subject', 'POST', ''));
        $message_parser->message = request_var('message', '', true);
        $icon_id = request_var('icon', 0);
        $enable_html = !$html_status || isset($_POST['disable_html']) ? false : true;
        $enable_bbcode = !$bbcode_status || isset($_POST['disable_bbcode']) ? false : true;
        $enable_smilies = !$smilies_status || isset($_POST['disable_smilies']) ? false : true;
        $enable_urls = isset($_POST['disable_magic_url']) ? 0 : 1;
        $enable_sig = !$config['allow_sig'] ? false : (isset($_POST['attach_sig']) ? true : false);
        if ($submit) {
            $status_switch = ($enable_html + 1 << 16) + ($enable_bbcode + 1 << 8) + ($enable_smilies + 1 << 4) + ($enable_urls + 1 << 2) + ($enable_sig + 1 << 1);
            $status_switch = $status_switch != $check_value;
        } else {
            $status_switch = 1;
        }
        // Parse Attachments - before checksum is calculated
        $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
        // Grab md5 'checksum' of new message
        $message_md5 = md5($message_parser->message);
        // Check checksum ... don't re-parse message if the same
        $update_message = $action != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview ? true : false;
        if ($update_message) {
            $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true);
        } else {
            $message_parser->bbcode_bitfield = $bbcode_bitfield;
        }
        if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$_CLASS['auth']->acl_get('u_ignoreflood')) {
            // Flood check
            $last_post_time = $_CLASS['core_user']->data['user_last_post_time'];
            if ($last_post_time) {
                if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
                    $error[] = $_CLASS['core_user']->lang['FLOOD_ERROR'];
                }
            }
        }
        // Subject defined
        if (!$subject && !($remove_u || $remove_g || $add_to || $add_bcc)) {
            $error[] = $_CLASS['core_user']->lang['EMPTY_SUBJECT'];
        }
        if (empty($address_list)) {
            $error[] = $_CLASS['core_user']->lang['NO_RECIPIENT'];
        }
        if (!empty($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) {
            $error[] = implode('<br />', $message_parser->warn_msg);
        }
        // Store message, sync counters
        if (empty($error) && $submit) {
            $pm_data = array('msg_id' => (int) $msg_id, 'reply_from_root_level' => isset($root_level) ? (int) $root_level : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_html' => (bool) $enable_html, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'message_md5' => (int) $message_md5, 'bbcode_bitfield' => (int) $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'address_list' => $address_list);
            unset($message_parser);
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:67,代码来源:ucp_pm_compose.php

示例9: compose_pm


//.........这里部分代码省略.........
	// Load Drafts
	if ($load && $drafts)
	{
		load_drafts(0, 0, $id);
	}

	if ($submit || $preview || $refresh)
	{
		if (!check_form_key('ucp_pm_compose'))
		{
			$error[] = $user->lang['FORM_INVALID'];
		}
		$subject = utf8_normalize_nfc(request_var('subject', '', true));
		$message_parser->message = utf8_normalize_nfc(request_var('message', '', true));

		$icon_id			= request_var('icon', 0);

		$enable_bbcode 		= (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true;
		$enable_smilies		= (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true;
		$enable_urls 		= (isset($_POST['disable_magic_url'])) ? 0 : 1;
		$enable_sig			= (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false);

		if ($submit)
		{
			$status_switch	= (($enable_bbcode+1) << 8) + (($enable_smilies+1) << 4) + (($enable_urls+1) << 2) + (($enable_sig+1) << 1);
			$status_switch = ($status_switch != $check_value);
		}
		else
		{
			$status_switch = 1;
		}

		// Parse Attachments - before checksum is calculated
		$message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);

		if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc))
		{
			$error[] = implode('<br />', $message_parser->warn_msg);
			$message_parser->warn_msg = array();
		}

		// Parse message
		$message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);

		// On a refresh we do not care about message parsing errors
		if (sizeof($message_parser->warn_msg) && !$refresh)
		{
			$error[] = implode('<br />', $message_parser->warn_msg);
		}

		if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood'))
		{
			// Flood check
			$last_post_time = $user->data['user_lastpost_time'];

			if ($last_post_time)
			{
				if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval']))
				{
					$error[] = $user->lang['FLOOD_ERROR'];
				}
			}
		}

		// Subject defined
		if ($submit)
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:ucp_pm_compose.php

示例10: isset

    if (!$auth->acl_gets('f_read', $forum_id)) {
        trigger_error('USER_CANNOT_READ');
    }
    if ($forum_data['forum_password'] && !check_forum_password($forum_id)) {
        trigger_error('LOGIN_FORUM');
    }
    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');
    }
    $_POST['add_file'] = 'Add the file';
    $message_parser = new parse_message();
    $message_parser->get_submitted_attachment_data();
    $message_parser->parse_attachments('fileupload', 'post', $forum_id, false, false, true);
    $attachment_id = isset($message_parser->attachment_data[$new_attach_position]) ? $message_parser->attachment_data[0]['attach_id'] : '';
    $group_id = base64_encode(serialize($message_parser->attachment_data));
    $warn_msg = join("\n", $message_parser->warn_msg);
} elseif ($_POST['method_name'] == 'upload_avatar') {
    require $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup('ucp');
    $user->add_lang('posting');
    header('Mobiquo_is_login:' . ($user->data['is_registered'] ? 'true' : 'false'));
    $status = true;
    $error = array();
    if (!$user->data['is_registered']) {
        trigger_error('LOGIN_EXPLAIN_POST');
    } else {
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:31,代码来源:upload.php


注:本文中的parse_message::parse_attachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。