Beispiel #1
0
            $attachment_data = $blog_attachment->attachment_data;
            $blog_attachment->parse_attachments_for_view($preview_message, $attachment_data, $update_count, true);
            if (sizeof($attachment_data)) {
                foreach ($attachment_data as $row) {
                    $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $row));
                }
            }
            unset($attachment_data);
        }
        blog_plugins::plugin_do_ref('reply_add_preview', $preview_message);
        // output some data to the template parser
        $template->assign_vars(array('S_DISPLAY_PREVIEW' => true, 'PREVIEW_SUBJECT' => censor_text($reply_subject), 'PREVIEW_MESSAGE' => $preview_message, 'POST_DATE' => $user->format_date(time())));
    }
    blog_plugins::plugin_do('reply_add_after_preview');
    // handles the basic data we need to output for posting
    handle_basic_posting_data(false, 'reply');
    // Assign some variables to the template parser
    $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'MESSAGE' => $reply_text, 'SUBJECT' => $reply_subject, 'L_MESSAGE_BODY_EXPLAIN' => intval($config['max_post_chars']) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', 'L_POST_A' => $user->lang['POST_A_NEW_REPLY']));
    $template->set_filenames(array('body' => 'blog/blog_posting_layout.html'));
} else {
    // insert array, not all of these really need to be inserted, since some are what the fields are as default, but I want it this way. :P
    $sql_data = array('blog_id' => $blog_id, 'user_id' => $user->data['user_id'], 'user_ip' => $user->data['user_ip'], 'reply_time' => time(), 'reply_subject' => $reply_subject, 'reply_text' => $message_parser->message, 'reply_checksum' => md5($message_parser->message), 'reply_approved' => $auth->acl_get('u_blogreplynoapprove') ? 1 : 0, 'enable_bbcode' => $post_options->enable_bbcode, 'enable_smilies' => $post_options->enable_smilies, 'enable_magic_url' => $post_options->enable_magic_url, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'reply_edit_reason' => '', 'reply_attachment' => sizeof($blog_attachment->attachment_data) ? 1 : 0);
    blog_plugins::plugin_do_ref('reply_add_sql', $sql_data);
    $sql = 'INSERT INTO ' . BLOGS_REPLY_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data);
    $db->sql_query($sql);
    $reply_id = $db->sql_nextid();
    $blog_search->index('add', $blog_id, $reply_id, $message_parser->message, $reply_subject, $user->data['user_id']);
    // update the URLS to include the new reply_id
    generate_blog_urls();
    $blog_attachment->update_attachment_data(false, $reply_id);
    blog_plugins::plugin_do_arg('reply_add_after_sql', $reply_id);
Beispiel #2
0
            $attachment_data = $blog_attachment->attachment_data;
            $blog_attachment->parse_attachments_for_view($preview_message, $attachment_data, $update_count, true);
            if (sizeof($attachment_data)) {
                foreach ($attachment_data as $row) {
                    $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $row));
                }
            }
            unset($attachment_data);
        }
        blog_plugins::plugin_do_ref('blog_edit_preview', $preview_message);
        // output some data to the template parser
        $template->assign_vars(array('S_DISPLAY_PREVIEW' => true, 'PREVIEW_SUBJECT' => censor_text($blog_subject), 'PREVIEW_MESSAGE' => $preview_message, 'POST_DATE' => $user->format_date(blog_data::$blog[$blog_id]['blog_time'])));
    }
    blog_plugins::plugin_do('blog_edit_after_preview');
    // handles the basic data we need to output for posting
    handle_basic_posting_data(false, 'blog', 'edit');
    // Assign some variables to the template parser
    $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'MESSAGE' => $blog_text, 'POLL_TITLE' => $poll_title, 'POLL_OPTIONS' => $poll_option_text ? $poll_option_text : '', 'POLL_MAX_OPTIONS' => $poll_max_options, 'POLL_LENGTH' => $poll_length, 'SUBJECT' => $blog_subject, 'VOTE_CHANGE_CHECKED' => $poll_vote_change ? 'checked="checked"' : '', 'L_MESSAGE_BODY_EXPLAIN' => intval($config['max_post_chars']) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', 'L_POST_A' => $user->lang['EDIT_A_BLOG'], 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_EXPLAIN'], $config['max_poll_options']), 'S_EDIT_REASON' => true, 'S_LOCK_POST_ALLOWED' => $auth->acl_get('m_bloglockedit') && $user->data['user_id'] != blog_data::$blog[$blog_id]['user_id'] ? true : false, 'S_POLL_DELETE' => $poll_title ? true : false, 'S_POLL_VOTE_CHANGE' => true));
    $template->set_filenames(array('body' => 'blog/blog_posting_layout.html'));
} else {
    // insert array
    $sql_data = array('user_ip' => $user->data['user_id'] == $user_id ? $user->data['user_ip'] : blog_data::$blog[$blog_id]['user_ip'], 'blog_subject' => $blog_subject, 'blog_text' => $message_parser->message, 'blog_checksum' => md5($message_parser->message), 'blog_approved' => blog_data::$blog[$blog_id]['blog_approved'] == 1 || $auth->acl_get('u_blognoapprove') ? 1 : 0, 'enable_bbcode' => $post_options->enable_bbcode, 'enable_smilies' => $post_options->enable_smilies, 'enable_magic_url' => $post_options->enable_magic_url, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'blog_edit_time' => time(), 'blog_edit_reason' => utf8_normalize_nfc(request_var('edit_reason', '', true)), 'blog_edit_user' => $user->data['user_id'], 'blog_edit_count' => blog_data::$blog[$blog_id]['blog_edit_count'] + 1, 'blog_edit_locked' => $auth->acl_get('m_bloglockedit') && $user->data['user_id'] != blog_data::$blog[$blog_id]['user_id'] ? request_var('lock_post', false) : false, 'perm_guest' => request_var('perm_guest', 1), 'perm_registered' => request_var('perm_registered', 2), 'perm_foe' => request_var('perm_foe', 0), 'perm_friend' => request_var('perm_friend', 2), 'blog_attachment' => sizeof($blog_attachment->attachment_data) ? 1 : 0, 'poll_title' => !empty($poll) ? $poll_title : '', 'poll_length' => !empty($poll) && $poll_length ? time() + $poll_length * 86400 : 0, 'poll_max_options' => !empty($poll) ? max($poll_max_options, 1) : 1, 'poll_vote_change' => !empty($poll) ? $poll_vote_change : 0);
    if ($original_poll_text != $poll_option_text) {
        $sql_data['poll_start'] = empty($poll) ? 0 : time();
    }
    blog_plugins::plugin_do_ref('blog_edit_sql', $sql_data);
    $sql = 'UPDATE ' . BLOGS_TABLE . '
		SET ' . $db->sql_build_array('UPDATE', $sql_data) . '
			WHERE blog_id = ' . intval($blog_id);
    $db->sql_query($sql);
    // Reindex the blog
Beispiel #3
0
            $attachment_data = $blog_attachment->attachment_data;
            $blog_attachment->parse_attachments_for_view($preview_message, $attachment_data, $update_count, true);
            if (sizeof($attachment_data)) {
                foreach ($attachment_data as $row) {
                    $template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $row));
                }
            }
            unset($attachment_data);
        }
        blog_plugins::plugin_do_ref('blog_add_preview', $preview_message);
        // output some data to the template parser
        $template->assign_vars(array('S_DISPLAY_PREVIEW' => true, 'PREVIEW_SUBJECT' => censor_text($blog_subject), 'PREVIEW_MESSAGE' => $preview_message, 'POST_DATE' => $user->format_date(time())));
    }
    blog_plugins::plugin_do('blog_add_after_preview');
    // handles the basic data we need to output for posting
    handle_basic_posting_data();
    // Assign some variables to the template parser
    $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'MESSAGE' => $blog_text, 'POLL_TITLE' => isset($poll_title) ? $poll_title : '', 'POLL_OPTIONS' => !empty($poll_options) ? implode("\n", $poll_options) : '', 'POLL_MAX_OPTIONS' => isset($poll_max_options) ? $poll_max_options : 1, 'POLL_LENGTH' => isset($poll_length) ? $poll_length : 0, 'SUBJECT' => $blog_subject, 'VOTE_CHANGE_CHECKED' => isset($poll_vote_change) && $poll_vote_change ? 'checked="checked"' : '', 'L_MESSAGE_BODY_EXPLAIN' => intval($config['max_post_chars']) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', 'L_POST_A' => $user->lang['POST_A_NEW_BLOG'], 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_EXPLAIN'], $config['max_poll_options']), 'S_POLL_VOTE_CHANGE' => true));
    $template->set_filenames(array('body' => 'blog/blog_posting_layout.html'));
} else {
    // insert array
    $sql_data = array('user_id' => $user->data['user_id'], 'user_ip' => $user->data['user_ip'], 'blog_time' => time(), 'blog_subject' => $blog_subject, 'blog_text' => $message_parser->message, 'blog_checksum' => md5($message_parser->message), 'blog_approved' => $auth->acl_get('u_blognoapprove') ? 1 : 0, 'enable_bbcode' => $post_options->enable_bbcode, 'enable_smilies' => $post_options->enable_smilies, 'enable_magic_url' => $post_options->enable_magic_url, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'blog_edit_reason' => '', 'perm_guest' => request_var('perm_guest', 1), 'perm_registered' => request_var('perm_registered', 2), 'perm_foe' => request_var('perm_foe', 0), 'perm_friend' => request_var('perm_friend', 2), 'blog_attachment' => sizeof($blog_attachment->attachment_data) ? 1 : 0, 'poll_title' => !empty($poll) ? $poll_title : '', 'poll_start' => !empty($poll) ? time() : 0, 'poll_length' => !empty($poll) && $poll_length ? time() + $poll_length * 86400 : 0, 'poll_max_options' => !empty($poll) ? max($poll_max_options, 1) : 1, 'poll_vote_change' => !empty($poll) ? $poll_vote_change : 0);
    blog_plugins::plugin_do_ref('blog_add_sql', $sql_data);
    $sql = 'INSERT INTO ' . BLOGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data);
    $db->sql_query($sql);
    $blog_id = $db->sql_nextid();
    // Index the blog
    $blog_search->index('add', $blog_id, 0, $message_parser->message, $blog_subject, $user->data['user_id']);
    // Update the attachments
    $blog_attachment->update_attachment_data($blog_id);
    // Submit the poll