function sp_forum_api_support()
{
    include_once SPBOOT . 'sp-load-core.php';
    sp_set_server_timezone();
    sp_load_current_user();
    include_once SPBOOT . 'sp-load-site.php';
    include_once SPBOOT . 'sp-load-forum.php';
    sp_get_track_id();
}
function sp_destroy_users_newposts($forumid = '')
{
    global $spThisUser;
    if (empty($forumid) || empty($spThisUser->newposts['topics'])) {
        $newPostList = array();
        $newPostList['topics'] = array();
        $newPostList['forums'] = array();
        $spThisUser->newposts = '';
    } else {
        $newPostList = $spThisUser->newposts;
        foreach ($spThisUser->newposts['forums'] as $index => $forum) {
            if ($forum == $forumid) {
                unset($newPostList['topics'][$index]);
                unset($newPostList['forums'][$index]);
            }
        }
        $newPostList['topics'] = array_values($newPostList['topics']);
        $newPostList['forums'] = array_values($newPostList['forums']);
        $spThisUser->newposts = $newPostList;
    }
    sp_update_member_item($spThisUser->ID, 'newposts', $newPostList);
    sp_update_member_item($spThisUser->ID, 'checktime', 0);
    sp_set_server_timezone();
    $spThisUser->checktime = sp_apply_timezone(time(), 'mysql');
}
Ejemplo n.º 3
0
function sp_render_forum($content)
{
    global $spIsForum, $spContentLoaded, $spVars, $spGlobals, $spThisUser, $spStatus;
    # make sure we are at least in the html body before outputting any content
    if (!sp_get_option('sfwpheadbypass') && !did_action('wp_head')) {
        return '';
    }
    if ($spIsForum && !post_password_required(get_post(sp_get_option('sfpage')))) {
        # Limit forum display to within the wp loop?
        if (sp_get_option('sfinloop') && !in_the_loop()) {
            return $content;
        }
        # Has forum content already been loaded and are we limiting?
        if (!sp_get_option('sfmultiplecontent') && $spContentLoaded) {
            return $content;
        }
        $spContentLoaded = true;
        sp_set_server_timezone();
        # offer a way for forum display to be short circuited but always show for admins unless an upgrade
        $message = sp_abort_display_forum();
        $content .= $message;
        if (!empty($message) && (!$spThisUser->admin || $spStatus != 'ok')) {
            return $content;
        }
        # process query arg actions
        # check for edit operation. Need tp check for '_x' in case using mobile as buttin is an image
        if (isset($_POST['editpost']) || isset($_POST['editpost_x'])) {
            sp_save_edited_post();
        }
        if (isset($_POST['edittopic'])) {
            sp_save_edited_topic();
        }
        if (isset($_POST['ordertopicpins'])) {
            sp_promote_pinned_topic();
        }
        if (isset($_POST['makepostreassign'])) {
            sp_reassign_post();
        }
        if (isset($_POST['approvepost'])) {
            sp_approve_post(false, sp_esc_int($_POST['approvepost']), $spVars['topicid']);
        }
        if (isset($_POST['unapprovepost'])) {
            sp_unapprove_post(sp_esc_int($_POST['unapprovepost']));
        }
        if (isset($_POST['doqueue'])) {
            sp_remove_waiting_queue();
        }
        if (isset($_POST['notifyuser'])) {
            sp_post_notification(sp_esc_str($_POST['sp_notify_user']), sp_esc_str($_POST['message']), sp_esc_int($_POST['postid']));
        }
        # move a topic and redirect to that topic
        if (isset($_POST['maketopicmove'])) {
            if (empty($_POST['forumid'])) {
                sp_notify(1, sp_text('Destination forum not selected'));
                return;
            }
            sp_move_topic();
            $forumslug = spdb_table(SFFORUMS, 'forum_id=' . sp_esc_int(sp_esc_int($_POST['forumid'])), 'forum_slug');
            $topicslug = spdb_table(SFTOPICS, 'topic_id=' . sp_esc_int(sp_esc_int($_POST['currenttopicid'])), 'topic_slug');
            $returnURL = sp_build_url($forumslug, $topicslug, 0);
            sp_redirect($returnURL);
        }
        # move a post and redirect to the post
        if (isset($_POST['makepostmove1']) || isset($_POST['makepostmove2']) || isset($_POST['makepostmove3'])) {
            sp_move_post();
            if (isset($_POST['makepostmove1'])) {
                $returnURL = sp_permalink_from_postid(sp_esc_int($_POST['postid']));
                sp_redirect($returnURL);
            }
        }
        # cancel a post move
        if (isset($_POST['cancelpostmove'])) {
            $meta = sp_get_sfmeta('post_move', 'post_move');
            if ($meta) {
                $id = $meta[0]['meta_id'];
                sp_delete_sfmeta($id);
                unset($spGlobals['post_move']);
            }
        }
        # rebuild the forum and post indexes
        if (isset($_POST['rebuildforum']) || isset($_POST['rebuildtopic'])) {
            sp_build_post_index(sp_esc_int($_POST['topicid']), true);
            sp_build_forum_index(sp_esc_int($_POST['forumid']), false);
        }
        # Set display mode if topic view (for editing posts)
        if ($spVars['pageview'] == 'topic' && isset($_POST['postedit'])) {
            $spVars['displaymode'] = 'edit';
            $spVars['postedit'] = $_POST['postedit'];
        } else {
            $spVars['displaymode'] = 'posts';
        }
        # clean cache of timed our records
        sp_clean_cache();
        #--Scratch Pad Area---Please Leave Here---------
        #--End Scratch Pad Area-------------------------
        # let other plugins check for posted actions
        do_action('sph_setup_forum');
        # do we use output buffering?
        $ob = sp_get_option('sfuseob');
        if ($ob) {
            ob_start();
        }
        # set up some stuff before wp page content
        $content .= sp_display_banner();
        $content = apply_filters('sph_before_wp_page_content', $content);
        # run any other wp filters on page content but exclude ours
        if (!$ob) {
            remove_filter('the_content', 'sp_render_forum', 1);
            $content = apply_filters('the_content', $content);
            $content = wpautop($content);
            add_filter('the_content', 'sp_render_forum', 1);
        }
        # set up some stuff after wp page content
        $content = apply_filters('sph_after_wp_page_content', $content);
        $content .= '<div id="dialogcontainer" style="display:none;"></div>';
        $content .= sp_js_check();
        # echo any wp page content
        echo $content;
        # now add our content
        do_action('sph_before_template_processing');
        sp_process_template();
        do_action('sph_after_template_processing');
        # Return if using output buffering
        if ($ob) {
            $forum = ob_get_contents();
            ob_end_clean();
            return $forum;
        }
    }
    # not returning any content since we output it already unless password needed
    if (post_password_required(get_post(sp_get_option('sfpage')))) {
        return $content;
    }
}
Ejemplo n.º 4
0
function sp_update_member_item($userid, $itemname, $itemdata)
{
    global $wpdb, $spThisUser, $current_user;
    $userid = (int) $userid;
    # hive off for cache updating if current user
    $itemdata = "'" . maybe_serialize($itemdata) . "'";
    # set 'lastvisit' or 'checktime' to 'now'
    if ($itemname == 'lastvisit' || $itemname == 'checktime') {
        sp_set_server_timezone();
        $itemdata = "'" . sp_apply_timezone(time(), 'mysql', $userid) . "'";
    }
    $sql = 'UPDATE ' . SFMEMBERS . " SET {$itemname} = {$itemdata} WHERE user_id={$userid}";
    $sql = apply_filters('sph_memberdata_update_query', $sql, $itemname, $itemdata, $userid);
    $updateditem = $wpdb->query($sql);
    # allow plugins to add data
    do_action('sph_memberdata_update', $userid, $itemname, $itemdata);
    return $updateditem;
}
Ejemplo n.º 5
0
function sp_destroy_users_newposts()
{
    global $spThisUser;
    $newPostList = array();
    $newPostList['topics'] = array();
    $newPostList['forums'] = array();
    sp_update_member_item($spThisUser->ID, 'newposts', $newPostList);
    sp_update_member_item($spThisUser->ID, 'checktime', 0);
    sp_set_server_timezone();
    $spThisUser->checktime = sp_apply_timezone(time(), 'mysql');
    $spThisUser->newposts = '';
}