示例#1
0
    trigger_error('BLOG_EDIT_LOCKED');
}
// Setup the page header and sent the title of the page that will go into the browser header
page_header($user->lang['DELETE_BLOG']);
// Generate the breadcrumbs
generate_blog_breadcrumbs($user->lang['DELETE_BLOG']);
if (blog_data::$blog[$blog_id]['blog_deleted'] != 0 && !$auth->acl_get('a_blogdelete')) {
    trigger_error('BLOG_ALREADY_DELETED');
}
$display_vars = array();
if ($auth->acl_get('a_blogdelete') && blog_data::$blog[$blog_id]['blog_deleted'] == 0) {
    $display_vars = array('legend1' => $user->lang['HARD_DELETE'], 'hard_delete' => array('lang' => 'HARD_DELETE', 'validate' => 'bool', 'type' => 'checkbox', 'default' => false, 'explain' => true));
}
blog_plugins::plugin_do_ref('blog_delete', $display_vars);
include "{$phpbb_root_path}blog/includes/functions_confirm.{$phpEx}";
$settings = blog_confirm('DELETE_BLOG', 'DELETE_BLOG_CONFIRM', $display_vars, 'yes/no');
if (is_array($settings)) {
    blog_plugins::plugin_do('blog_delete_confirm');
    // if it has already been soft deleted, and we want to hard delete it
    if ((isset($settings['hard_delete']) && $settings['hard_delete'] || blog_data::$blog[$blog_id]['blog_deleted'] != 0) && $auth->acl_get('a_blogdelete')) {
        // They selected the hard delete checkbox...so we must do a few things.
        if (blog_data::$blog[$blog_id]['blog_deleted'] == 0) {
            // Remove the search index
            $blog_search->index_remove($blog_id);
            // Update the blog_count for the user
            $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count - 1 WHERE user_id = ' . intval($user_id) . ' AND blog_count > 0';
            $db->sql_query($sql);
            set_config('num_blogs', --$config['num_blogs'], true);
            set_config('num_blog_replies', $config['num_blog_replies'] - blog_data::$blog[$blog_id]['blog_reply_count'], true);
            // Update the blog_count for all the categories it is in.
            put_blogs_in_cats($blog_id, array(), true, 'soft_delete');
示例#2
0
// check to see if editing this message is locked, or if the one editing it has mod powers
if (blog_data::$reply[$reply_id]['reply_edit_locked'] && !$auth->acl_get('m_blogreplyedit')) {
    trigger_error('REPLY_EDIT_LOCKED');
}
// Setup the page header and sent the title of the page that will go into the browser header
page_header($user->lang['DELETE_REPLY']);
// Generate the breadcrumbs
generate_blog_breadcrumbs($user->lang['DELETE_REPLY']);
blog_plugins::plugin_do('reply_delete');
$display_vars = array();
if ($auth->acl_get('a_blogdelete') && blog_data::$reply[$reply_id]['reply_deleted'] == 0) {
    $display_vars = array('legend1' => $user->lang['HARD_DELETE'], 'hard_delete' => array('lang' => 'HARD_DELETE', 'validate' => 'bool', 'type' => 'checkbox', 'default' => false, 'explain' => true));
}
blog_plugins::plugin_do_ref('blog_delete', $display_vars);
include "{$phpbb_root_path}blog/includes/functions_confirm.{$phpEx}";
$settings = blog_confirm('DELETE_REPLY', 'DELETE_REPLY_CONFIRM', $display_vars, 'yes/no');
if (is_array($settings)) {
    blog_plugins::plugin_do('reply_delete_confirm');
    // if it has already been soft deleted
    if ((isset($settings['hard_delete']) && $settings['hard_delete'] || blog_data::$reply[$reply_id]['reply_deleted'] != 0) && $auth->acl_get('a_blogreplydelete')) {
        // If it has not been soft deleted we need to do a few more things...
        if (blog_data::$reply[$reply_id]['reply_deleted'] == 0) {
            // Remove the search index
            $blog_search->index_remove($blog_id, $reply_id);
            // update the reply count for the blog
            $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count - 1 WHERE blog_id = ' . intval($blog_id) . ' AND blog_reply_count > 0';
            $db->sql_query($sql);
            set_config('num_blog_replies', --$config['num_blog_replies'], true);
        }
        // Delete the Attachments
        $blog_attachment->get_attachment_data(false, $reply_id);
示例#3
0
generate_blog_breadcrumbs($user->lang['SUBSCRIBE']);
if ($subscribed) {
    trigger_error('ALREADY_SUBSCRIBED');
}
if (!$user_id && !$blog_id) {
    trigger_error($user->lang['BLOG_USER_NOT_PROVIDED']);
}
$subscription_types = get_blog_subscription_types();
$display_vars = array('legend1' => 'SUBSCRIBE');
foreach ($subscription_types as $type => $name) {
    $display_vars[$type] = array('lang' => $name, 'validate' => 'bool', 'type' => 'checkbox', 'default' => false, 'explain' => false);
}
// Do not add subscription types here.  Add them with the function_get_subscription_types hook.
blog_plugins::plugin_do_ref('subscribe', $display_vars);
include "{$phpbb_root_path}blog/includes/functions_confirm.{$phpEx}";
$settings = blog_confirm('SUBSCRIBE_BLOG_TITLE', 'SUBSCRIBE_BLOG_CONFIRM', $display_vars);
if (is_array($settings)) {
    blog_plugins::plugin_do('subscribe_confirm');
    //$cache->destroy("_blog_subscription_{$user->data['user_id']}");
    foreach ($settings as $mode => $yn) {
        if ($yn && array_key_exists($mode, $display_vars)) {
            $sql_data = array('sub_user_id' => $user->data['user_id'], 'sub_type' => (int) $mode, 'blog_id' => (int) $blog_id, 'user_id' => (int) $user_id);
            blog_plugins::plugin_do_ref('subscription_add', $sql_data);
            $sql = 'INSERT INTO ' . BLOGS_SUBSCRIPTION_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data);
            $db->sql_query($sql);
        }
    }
    $message = $user->lang['SUBSCRIPTION_ADDED'] . '<br /><br />';
    if ($blog_id) {
        $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
        $redirect = $blog_urls['view_blog'];