function sp_NoForumMessage($args = '', $deniedMessage = '', $definedMessage = '') { global $spForumView; $defs = array('tagId' => 'spNoForumMessage', 'tagClass' => 'spMessage', 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_NoForumMessage_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $echo = (int) $echo; $get = (int) $get; # is Access denied if ($spForumView->forumViewStatus == 'no access') { $m = sp_filter_title_display($deniedMessage); } elseif ($spForumView->forumViewStatus == 'no data') { $m = sp_filter_title_display($definedMessage); } elseif ($spForumView->forumViewStatus == 'sneak peek') { $sflogin = sp_get_option('sflogin'); if (!empty($sflogin['sfsneakredirect'])) { sp_redirect(apply_filters('sph_sneak_redirect', $sflogin['sfsneakredirect'])); } else { $sneakpeek = sp_get_sfmeta('sneakpeek', 'message'); $m = $sneakpeek ? sp_filter_text_display($sneakpeek[0]['meta_value']) : ''; } } else { return; } if ($get) { return $m; } $out = "<div id='{$tagId}' class='{$tagClass}'>{$m}</div>\n"; $out = apply_filters('sph_NoForumMessage', $out, $a); if ($echo) { echo $out; } else { return $out; } }
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; } }
function sp_topic_sort_order() { global $spThisUser, $spGlobals; $topicid = sp_esc_int($_GET['topicid']); if (!$spThisUser->admin) { sp_etext('Access denied - you do not have permission'); die; } # make sure we have valid forum $thistopic = spdb_table(SFTOPICS, "topic_id={$topicid}", 'row'); $thisforum = spdb_table(SFFORUMS, "forum_id={$thistopic->forum_id}", 'row'); if (empty($thistopic)) { die; } # if already reversed remove flag or reverse if not $key = false; if (isset($spGlobals['sort_order']['topic'])) { $key = array_search($topicid, (array) $spGlobals['sort_order']['topic']); } if ($key === false) { $spGlobals['sort_order']['topic'][] = $topicid; } else { unset($spGlobals['sort_order']['topic'][$key]); $spGlobals['sort_order']['topic'] = array_keys($spGlobals['sort_order']['topic']); } sp_add_sfmeta('sort_order', 'topic', $spGlobals['sort_order']['topic'], 1); sp_redirect(sp_build_url($thisforum->forum_slug, $thistopic->topic_slug, 1)); die; }
function sp_ahah_handler($wp) { # only process our ahah requests if (array_key_exists('sp_ahah', $wp->query_vars)) { header('Content-Type: text/html; charset=' . get_option('blog_charset')); # verify proper ahah nonce $check = check_ajax_referer('forum-ahah', 'sfnonce', false); if (!$check) { echo '<div class="spMessage">'; echo '<p>' . sp_text('Access denied - ajax nonce check failed') . '</p>'; global $spThisUser; if (empty($spThisUser->ID)) { echo '<p>' . sp_text('Do you need to log in?') . ' (<a href="' . site_url('wp-login.php', 'login_post') . '">' . sp_text('Log in') . '</a>)</p>'; echo '</div>'; $sflogin = sp_get_option('sflogin'); $redirect = !empty($sflogin['sfloginurl']) && empty($redirect) ? $sflogin['sfloginurl'] : ''; $args = array('action' => 'login', 'redirect_to' => $redirect); $login_url = add_query_arg($args, esc_url(wp_login_url())); sp_redirect($login_url); } echo '</div>'; die; } # process the request switch ($wp->query_vars['sp_ahah']) { case 'newpostpopup': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-newpostpopup.php'; break; case 'acknowledge': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-acknowledge.php'; break; case 'manage-forum': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-manage.php'; break; case 'admintoollinks': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-admintoollinks.php'; break; case 'admintools': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-admintools.php'; break; case 'autoupdate': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-autoupdate.php'; break; case 'permissions': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-permissions.php'; break; case 'quote': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-quote.php'; break; case 'remove-notice': include SF_PLUGIN_DIR . '/forum/content/ahah/sp-ahah-notice.php'; break; case 'multiselect': include SF_PLUGIN_DIR . '/admin/library/ahah/spa-ahah-multiselect.php'; break; case 'profile': include SF_PLUGIN_DIR . '/forum/profile/ahah/sp-ahah-profile.php'; break; case 'profile-save': include SF_PLUGIN_DIR . '/forum/profile/ahah/sp-ahah-profile-save.php'; break; case 'post': include SF_PLUGIN_DIR . '/forum/library/sp-post.php'; break; case 'search': include SF_PLUGIN_DIR . '/forum/library/sp-search.php'; break; case 'help': include SF_PLUGIN_DIR . '/admin/library/ahah/spa-ahah-help.php'; break; case 'admins-loader': include SF_PLUGIN_DIR . '/admin/panel-admins/ahah/spa-ahah-admins-loader.php'; break; case 'components-loader': include SF_PLUGIN_DIR . '/admin/panel-components/ahah/spa-ahah-components-loader.php'; break; case 'forums-loader': include SF_PLUGIN_DIR . '/admin/panel-forums/ahah/spa-ahah-forums-loader.php'; break; case 'options-loader': include SF_PLUGIN_DIR . '/admin/panel-options/ahah/spa-ahah-options-loader.php'; break; case 'permissions-loader': include SF_PLUGIN_DIR . '/admin/panel-permissions/ahah/spa-ahah-permissions-loader.php'; break; case 'profiles-loader': include SF_PLUGIN_DIR . '/admin/panel-profiles/ahah/spa-ahah-profiles-loader.php'; break; case 'toolbox-loader': include SF_PLUGIN_DIR . '/admin/panel-toolbox/ahah/spa-ahah-toolbox-loader.php'; break; case 'integration-loader': include SF_PLUGIN_DIR . '/admin/panel-integration/ahah/spa-ahah-integration-loader.php'; break; case 'plugins-loader': include SF_PLUGIN_DIR . '/admin/panel-plugins/ahah/spa-ahah-plugins-loader.php'; break; case 'themes-loader': include SF_PLUGIN_DIR . '/admin/panel-themes/ahah/spa-ahah-themes-loader.php'; break; case 'integration-perm': include SF_PLUGIN_DIR . '/admin/panel-integration/ahah/spa-ahah-integration-perm.php'; break; case 'integration-langs': include SF_PLUGIN_DIR . '/admin/panel-integration/ahah/spa-ahah-integration-langs.php'; break; case 'usergroups-loader': include SF_PLUGIN_DIR . '/admin/panel-usergroups/ahah/spa-ahah-usergroups-loader.php'; break; case 'users-loader': include SF_PLUGIN_DIR . '/admin/panel-users/ahah/spa-ahah-users-loader.php'; break; case 'components': include SF_PLUGIN_DIR . '/admin/panel-components/ahah/spa-ahah-components.php'; break; case 'forums': include SF_PLUGIN_DIR . '/admin/panel-forums/ahah/spa-ahah-forums.php'; break; case 'profiles': include SF_PLUGIN_DIR . '/admin/panel-profiles/ahah/spa-ahah-profiles.php'; break; case 'users': include SF_PLUGIN_DIR . '/admin/panel-users/ahah/spa-ahah-users.php'; break; case 'usergroups': include SF_PLUGIN_DIR . '/admin/panel-usergroups/ahah/spa-ahah-usergroups.php'; break; case 'usermapping': include SF_PLUGIN_DIR . '/admin/panel-usergroups/ahah/spa-ahah-map-users.php'; break; case 'memberships': include SF_PLUGIN_DIR . '/admin/panel-usergroups/ahah/spa-ahah-memberships.php'; break; case 'troubleshooting': include SF_PLUGIN_DIR . '/admin/help/spa-ahah-troubleshooting.php'; break; case 'upgrade': include SPBOOT . 'install/sp-upgrade.php'; break; case 'install': include SPBOOT . 'install/sp-install.php'; break; case 'uploader': include SF_PLUGIN_DIR . '/admin/resources/jscript/ajaxupload/sf-uploader.php'; break; case 'remove-news': include SF_PLUGIN_DIR . '/admin/library/ahah/spa-ahah-general.php'; break; case 'install-log': include SF_PLUGIN_DIR . '/admin/panel-toolbox/ahah/spa-ahah-install-log.php'; break; case 'plugin-tip': include SF_PLUGIN_DIR . '/admin/panel-plugins/ahah/spa-ahah-plugins-help.php'; break; case 'permission-tip': include SF_PLUGIN_DIR . '/admin/panel-permissions/ahah/spa-ahah-permissions-help.php'; break; case 'usergroup-tip': include SF_PLUGIN_DIR . '/admin/panel-usergroups/ahah/spa-ahah-usergroups-help.php'; break; # unknown handler type - must be plugin page, so fire plugin specific handler action # unknown handler type - must be plugin page, so fire plugin specific handler action default: do_action('sph_ahah_handler_' . $wp->query_vars['sp_ahah']); break; } } }