コード例 #1
0
ファイル: edit.php プロジェクト: EXreaction/User-Blog-Mod
    }
    // 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')) {
        $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count - 1 WHERE user_id = ' . $user->data['user_id'];
        $db->sql_query($sql);
        set_config('num_blogs', --$config['num_blogs'], true);
        inform_approve_report('blog_approve', $blog_id);
    }
    handle_blog_cache('edit_blog', $user_id);
    $message = (!$sql_data['blog_approved'] ? $user->lang['BLOG_NEED_APPROVE'] . '<br /><br />' : $user->lang['BLOG_EDIT_SUCCESS']) . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br /><br />';
    if ($user->data['user_id'] == $user_id) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>');
    }
    blog_meta_refresh(3, $blog_urls['view_blog']);
    trigger_error($message);
}
コード例 #2
0
ファイル: undelete.php プロジェクト: EXreaction/User-Blog-Mod
generate_blog_breadcrumbs($user->lang['UNDELETE_REPLY']);
// if someone is trying to un-delete a reply and the reply is not deleted
if (blog_data::$reply[$reply_id]['reply_deleted'] == 0) {
    trigger_error('REPLY_NOT_DELETED');
}
blog_plugins::plugin_do('reply_undelete');
if (confirm_box(true)) {
    blog_plugins::plugin_do('reply_undelete_confirm');
    $blog_search->index('add', $blog_id, $reply_id, blog_data::$reply[$reply_id]['reply_text'], blog_data::$reply[$reply_id]['reply_subject'], blog_data::$reply[$reply_id]['user_id']);
    $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . ' SET reply_deleted = 0, reply_deleted_time = 0 WHERE reply_id = ' . intval($reply_id);
    $db->sql_query($sql);
    $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count + 1 WHERE blog_id = ' . intval($blog_id);
    $db->sql_query($sql);
    set_config('num_blog_replies', ++$config['num_blog_replies'], true);
    handle_blog_cache('undelete_reply', $user_id);
    blog_meta_refresh(3, $blog_urls['view_reply']);
    $message = $user->lang['REPLY_UNDELETED'] . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />';
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
    if ($user_id == $user->data['user_id']) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    trigger_error($message);
} else {
    confirm_box(false, 'UNDELETE_REPLY');
}
blog_meta_refresh(0, $blog_urls['view_reply']);
コード例 #3
0
ファイル: update.php プロジェクト: EXreaction/User-Blog-Mod
        case '0.9.1':
        case '1.0.0':
            set_config('user_blog_links_output_block', 1);
        case '1.0.1':
            $db->sql_query('UPDATE ' . BLOGS_TABLE . ' SET poll_max_options = 1 WHERE poll_max_options < 1');
        case '1.0.2':
        case '1.0.3':
            $style_ids = array();
            $result = $db->sql_query('SELECT style_id FROM ' . STYLES_TABLE);
            while ($row = $db->sql_fetchrow($result)) {
                $style_ids[] = $row['style_id'];
            }
            $db->sql_freeresult($result);
            $db->sql_query('UPDATE ' . BLOGS_USERS_TABLE . ' SET blog_style = ' . $style_ids[0] . ' WHERE ' . $db->sql_in_set('blog_style', $style_ids, true));
            set_config('user_blog_message_from', 2);
        case '1.0.4':
        case '1.0.5':
        case '1.0.6':
        case '1.0.7':
            set_config('user_blog_version', '1.0.7');
    }
    // clear the cache
    $cache->purge();
    $user->add_lang('mods/blog/umil');
    $message = sprintf($user->lang['SUCCESSFULLY_UPDATED_UMIL_RETURN'], '<a href="' . append_sid("{$phpbb_root_path}blog/database.{$phpEx}") . '">', '</a>');
    trigger_error($message);
} else {
    confirm_box(false, 'UPDATE_INSTRUCTIONS');
}
blog_meta_refresh(0, append_sid("{$phpbb_root_path}blog.{$phpEx}"), true);
コード例 #4
0
ファイル: delete.php プロジェクト: EXreaction/User-Blog-Mod
        put_blogs_in_cats($blog_id, array(), true, 'soft_delete');
        // Remove the search index
        $blog_search->index_remove($blog_id);
        // soft delete the blog
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_deleted = ' . $user->data['user_id'] . ', blog_deleted_time = ' . time() . ' WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        // 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_real_reply_count'], true);
        // Update the blog_count for all the categories it is in.
        $sql = 'SELECT category_id FROM ' . BLOGS_IN_CATEGORIES_TABLE . ' WHERE blog_id = ' . intval($blog_id);
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $sql = 'UPDATE ' . BLOGS_CATEGORIES_TABLE . ' SET blog_count = blog_count - 1 WHERE category_id = ' . $row['category_id'] . ' AND blog_count > 0';
            $db->sql_query($sql);
        }
        $db->sql_freeresult($result);
    }
    handle_blog_cache('delete_blog', $user_id);
    blog_meta_refresh(3, $blog_urls['view_user']);
    $message = $user->lang['BLOG_DELETED'];
    if ($user->data['user_id'] == $user_id) {
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', $username, '</a>');
        $message .= '<br />' . sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    trigger_error($message);
}
コード例 #5
0
    if ($user_id != 0) {
        if (!$subscribed) {
            trigger_error('NOT_SUBSCRIBED');
        }
        if (confirm_box(true)) {
            blog_plugins::plugin_do('unsubscribe_user_confirm');
            $sql = 'DELETE FROM ' . BLOGS_SUBSCRIPTION_TABLE . '
			WHERE sub_user_id = ' . $user->data['user_id'] . '
				AND user_id = ' . intval($user_id);
            $db->sql_query($sql);
            //$cache->destroy("_blog_subscription_{$user_id}");
            $template->assign_vars(array('S_WATCH_FORUM_TITLE' => $user->lang['SUBSCRIBE_USER'], 'S_WATCH_FORUM_LINK' => $blog_urls['subscribe'], 'S_WATCHING_FORUM' => false));
            $message = $user->lang['SUBSCRIPTION_REMOVED'] . '<br /><br />';
            if ($user_id == $user->data['user_id']) {
                $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
            } else {
                $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
                $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
            }
            blog_meta_refresh(3, $blog_urls['view_user']);
            trigger_error($message);
        } else {
            blog_plugins::plugin_do('unsubscribe_user');
            confirm_box(false, 'UNSUBSCRIBE_USER');
        }
    } else {
        trigger_error($user->lang['BLOG_USER_NOT_PROVIDED']);
    }
}
blog_meta_refresh(0, $blog_urls['main']);
コード例 #6
0
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'];
    } else {
        $redirect = $blog_urls['view_user'];
    }
    if ($user_id == $user->data['user_id']) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    blog_plugins::plugin_do('subscribe_user_confirm_end');
    blog_meta_refresh(3, $redirect);
    trigger_error($message);
}