示例#1
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
    $blog_search->index('edit', $blog_id, 0, $message_parser->message, $blog_subject, $user_id);
    // Update the attachments
    $blog_attachment->update_attachment_data($blog_id, 0, blog_data::$blog[$blog_id]['user_id']);
    blog_plugins::plugin_do_arg('blog_edit_after_sql', $blog_id);
    // Submit the poll
    if ($auth->acl_get('u_blog_create_poll')) {
        submit_blog_poll($poll, $blog_id, 'edit');
    }
    // Handle the subscriptions
    add_blog_subscriptions($blog_id, 'subscription_');
    // Insert into the categories list
    if (sizeof($category_ary) > 1 || isset($category_ary[0]) && $category_ary[0] != 0) {
        $category_list = get_blog_categories('category_id');
        foreach ($category_ary as $i => $cat_id) {
            if (!isset($category_list[$cat_id])) {
                unset($category_ary[$i]);
            }
        }
    }
    put_blogs_in_cats($blog_id, $category_ary, blog_data::$blog[$blog_id]['blog_approved'] == 1 || $auth->acl_get('u_blognoapprove') ? true : false);
    // If it needs reapproval...
    if (blog_data::$blog[$blog_id]['blog_approved'] == 0 && !$auth->acl_get('u_blognoapprove')) {
示例#2
0
    $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
    if ($auth->acl_get('u_blog_create_poll')) {
        submit_blog_poll($poll, $blog_id);
    }
    // Handle the subscriptions
    add_blog_subscriptions($blog_id, 'subscription_');
    // Insert into the categories list
    if (sizeof($category_ary) > 1 || isset($category_ary[0]) && $category_ary[0] != 0) {
        $category_list = get_blog_categories('category_id');
        foreach ($category_ary as $i => $cat_id) {
            if (!isset($category_list[$cat_id])) {
                unset($category_ary[$i]);
            }
        }
        put_blogs_in_cats($blog_id, $category_ary, $auth->acl_get('u_blognoapprove') ? true : false);
    }
    // regenerate the urls to include the blog_id
    generate_blog_urls();