function spa_get_seo_data() { $sfcomps = array(); # browser title $sfseo = sp_get_option('sfseo'); $sfcomps['sfseo_overwrite'] = $sfseo['sfseo_overwrite']; $sfcomps['sfseo_blogname'] = $sfseo['sfseo_blogname']; $sfcomps['sfseo_pagename'] = $sfseo['sfseo_pagename']; $sfcomps['sfseo_homepage'] = $sfseo['sfseo_homepage']; $sfcomps['sfseo_topic'] = $sfseo['sfseo_topic']; $sfcomps['sfseo_forum'] = $sfseo['sfseo_forum']; $sfcomps['sfseo_noforum'] = $sfseo['sfseo_noforum']; $sfcomps['sfseo_page'] = $sfseo['sfseo_page']; $sfcomps['sfseo_sep'] = $sfseo['sfseo_sep']; $sfcomps['sfseo_og'] = $sfseo['sfseo_og']; $sfcomps['seo_og_attachment'] = $sfseo['seo_og_attachment']; $sfcomps['seo_og_type'] = empty($sfseo['seo_og_type']) ? 'website' : $sfseo['seo_og_type']; # meta tags $sfmetatags = array(); $sfmetatags = sp_get_option('sfmetatags'); $sfcomps['sfdescr'] = sp_filter_title_display($sfmetatags['sfdescr']); $sfcomps['sfdescruse'] = $sfmetatags['sfdescruse']; $sfcomps['sfusekeywords'] = sp_filter_title_display($sfmetatags['sfusekeywords']); $sfcomps['sfkeywords'] = isset($sfmetatags['sfkeywords']) ? $sfmetatags['sfkeywords'] : 0; return $sfcomps; }
function sp_do_sp_ProfileLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } global $spThisUser; sp_forum_api_support(); if ($spThisUser->ID == 0 && $spThisUser->ID == '') { return; } $defs = array('linkText' => __('Your Profile', 'sp-ttags'), 'beforeLink' => '', 'afterLink' => '', 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ProfileLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $linkText = sp_filter_title_display($linkText); $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $echo = (int) $echo; if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } $out = ''; $out .= "<span>{$beforeLink}<a href='" . sp_url('profile') . "'>{$linkText}</a>{$afterLink}</span>\n"; if ($echo) { echo $out; } else { return $out; } }
function sp_AdminLinksTag($args = '', $label = '', $toolTip = '') { global $spThisUser, $spDevice; # bail if not admin or moderator if (!$spThisUser->admin) { return; } # is this admin showing the admin bar? if (!isset($spThisUser->sfadminbar) || $spThisUser->sfadminbar == false) { return; } $defs = array('tagId' => 'spAdminLinks', 'tagClass' => 'spAdminLinks', 'icon' => 'sp_AdminLinks.png', 'iconClass' => 'spAdminLinks'); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_AdminLinks_args', $a); extract($a, EXTR_SKIP); $p = $spDevice == 'mobile' && current_theme_supports('sp-theme-responsive') ? SPABIMAGESMOB : SPABIMAGES; # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $iconClass = esc_attr($iconClass); $icon = sp_paint_icon($iconClass, $p, sanitize_file_name($icon)); $toolTip = esc_attr($toolTip); $label = sp_filter_title_display($label); $site = SFHOMEURL . "index.php?sp_ahah=admin-bar-links&sfnonce=" . wp_create_nonce('forum-ahah') . "&action=manage"; $out = "<a class='{$tagClass}' id='{$tagId}' title='{$toolTip}' rel='nofollow' href='javascript:void(null)' onclick='spjDialogAjax(this, \"{$site}\", \"{$label}\", 250, 0, 0);'>"; if (!empty($icon)) { $out .= $icon; } if (!empty($label)) { $out .= $label; } $out .= "</a>\n"; $out = apply_filters('sph_AdminLinks', $out, $a); echo $out; }
function sp_do_sp_ForumHomeLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('beforeLink' => '', 'afterLink' => '', 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ForumHomeLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $echo = (int) $echo; if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } $pid = sp_get_option('sfpage'); $title = spdb_table(SFWPPOSTS, "ID={$pid}", 'post_title'); $out .= '<span>' . $beforeLink . '<a href="' . get_permalink($pid) . '">' . $title . '</a>' . $afterLink . '</span>'; $out = apply_filters('sph_ForumHomeLinkTag', $out); if ($echo) { echo $out; } else { return $out; } }
function sp_do_sp_GroupLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('groupId' => '', 'linkText' => '%GROUPNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_GroupLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $groupId = (int) $groupId; $linkText = esc_attr($linkText); $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $listTags = (int) $listTags; $echo = (int) $echo; if (empty($groupId)) { return ''; } sp_forum_api_support(); if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } # check user has access to at kleast ine forum in group $canview = false; $forums = spdb_table(SFFORUMS, "group_id={$groupId}"); if ($forums) { foreach ($forums as $forum) { if (sp_can_view($forum->forum_id, 'forum-title')) { $canview = true; } } } if ($forums && $canview) { $grouprec = spdb_table(SFGROUPS, "group_id={$groupId}", 'row'); $out = ''; $linkText = str_replace("%GROUPNAME%", sp_filter_title_display($grouprec->group_name), $linkText); if (empty($linkText)) { $linkText = sp_filter_title_display($grouprec->group_name); } if ($listTags) { $out .= '<li>'; } $out .= '<span>' . $beforeLink . '<a href="' . add_query_arg(array('group' => $groupId), sp_url()) . '">' . $linkText . '</a>' . $afterLink . '</span>'; if ($listTags) { $out .= '</li>'; } } $out = apply_filters('sph_GroupLinkTag', $out); if ($echo) { echo $out; } else { return $out; } }
function sp_do_sp_TopicLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('topicId' => '', 'linkText' => '%TOPICNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_TopicLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $topicId = (int) $topicId; $linkText = esc_attr($linkText); $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $listTags = (int) $listTags; $echo = (int) $echo; if (empty($topicId)) { return ''; } sp_forum_api_support(); if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } $spdb = new spdbComplex(); $spdb->table = SFTOPICS; $spdb->fields = SFTOPICS . '.topic_id, ' . SFTOPICS . '.forum_id, topic_slug, topic_name, forum_name, forum_slug'; $spdb->join = array(SFFORUMS . ' ON ' . SFTOPICS . '.forum_id = ' . SFFORUMS . '.forum_id'); $spdb->where = SFTOPICS . '.topic_id=' . $topicId; $thistopic = $spdb->select(); $out = ''; if ($thistopic) { if (sp_can_view($thistopic[0]->forum_id, 'topic-title')) { $out = ''; $linkText = str_replace("%TOPICNAME%", sp_filter_title_display($thistopic[0]->topic_name), $linkText); if (empty($linkText)) { $linkText = sp_filter_title_display($thistopic[0]->topic_name); } if ($listTags) { $out .= '<li>'; } $out .= '<span>' . $beforeLink . '<a href="' . sp_build_url($thistopic[0]->forum_slug, $thistopic[0]->topic_slug, 0, 0) . '">' . $linkText . '</a>' . $afterLink . '</span>'; if ($listTags) { $out .= '</li>'; } } } else { $out = sprintf(__('Topic %s not found', 'sp-ttags'), $topicId); } $out = apply_filters('sph_TopicLinkTag', $out); if ($echo) { echo $out; } else { return $out; } }
function sp_do_sp_UserGroupsTag($userid, $args = '', $noMembershipLabel = '', $adminLabel = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } global $spPaths; $defs = array('tagClass' => 'spUserGroupsTag', 'stacked' => 1, 'showTitle' => 1, 'showBadge' => 1, 'echo' => 1); $a = wp_parse_args($args, $defs); extract($a, EXTR_SKIP); $tagClass = esc_attr($tagClass); $stacked = (int) $stacked; $showTitle = (int) $showTitle; $showBadge = (int) $showBadge; $echo = (int) $echo; $thisUser = sp_get_user($userid); $show = false; $tout = "<span class='{$tagClass}'>"; if (!empty($thisUser->memberships)) { $first = true; $split = $stacked ? '<br />' : ', '; foreach ($thisUser->memberships as $membership) { if (!$first) { $tout .= $split; } if ($showTitle) { $show = true; $tout .= $membership['usergroup_name']; } if ($showBadge && !empty($membership['usergroup_badge'])) { $show = true; if ($showTitle) { $tout .= '<br />'; } $tout .= "<img src='" . SF_STORE_URL . '/' . $spPaths['ranks'] . '/' . $membership['usergroup_badge'] . "' alt='' />"; } $first = false; } } else { if ($thisUser->admin) { if ($showTitle) { $show = true; $tout .= sp_filter_title_display($adminLabel); } } else { $show = true; $tout .= sp_filter_title_display($noMembershipLabel); } } $tout .= "</span>\n"; $out = $show ? $tout : ''; if ($echo) { echo $out; } else { return $out; } }
function sp_do_sp_ForumLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('forumId' => '', 'linkText' => '%FORUMNAME%', 'beforeLink' => '', 'afterLink' => '', 'listTags' => 0, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ForumLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $forumId = (int) $forumId; $linkText = esc_attr($linkText); $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $listTags = (int) $listTags; $echo = (int) $echo; if (empty($forumId)) { return ''; } sp_forum_api_support(); if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } if (sp_can_view($forumId, 'forum-title')) { $forumrec = spdb_table(SFFORUMS, "forum_id={$forumId}", 'row'); if ($forumrec) { $out = ''; $linkText = str_replace("%FORUMNAME%", sp_filter_title_display($forumrec->forum_name), $linkText); if (empty($linkText)) { $linkText = sp_filter_title_display($forumrec->forum_name); } if ($listTags) { $out .= '<li>'; } $out .= '<span>' . $beforeLink . '<a href="' . sp_build_url($forumrec->forum_slug, '', 0, 0) . '">' . $linkText . '</a>' . $afterLink . '</span>'; if ($listTags) { $out .= '</li>'; } } else { $out = sprintf(__('Forum %s not found', 'sp-ttags'), $forumId); } } $out = apply_filters('sph_ForumLinkTag', $out); if ($echo) { echo $out; } else { return $out; } }
function sp_featured_admin_options_form() { $meta = sp_get_sfmeta('featured', 'topics'); $topics = implode(',', $meta[0]['meta_value']); $meta = sp_get_sfmeta('featured', 'posts'); $posts = implode(',', $meta[0]['meta_value']); spa_paint_options_init(); spa_paint_open_tab(__('Featured Topics and Posts Plugin', 'sp-featured'), true); spa_paint_open_panel(); spa_paint_open_fieldset(__('Featured Topics and Posts Options', 'sp-featured'), true, 'featured-lists'); spa_paint_input(__('List of featured topic IDs', 'sp-featured'), 'topic_list', sp_filter_title_display($topics)); spa_paint_input(__('List of featured post IDs', 'sp-featured'), 'post_list', sp_filter_title_display($posts)); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); }
function sp_email_notifications($newpost) { global $spGlobals, $spThisUser, $spVars; $out = ''; $email_status = array(); $eol = "\r\n"; $tab = "\t"; # create the email address list for admin nptifications $admins_email = array(); $admins = spdb_table(SFMEMBERS, 'admin = 1 OR moderator = 1'); if ($admins) { foreach ($admins as $admin) { if ($admin->user_id != $newpost['userid']) { $admin_opts = unserialize($admin->admin_options); if ($admin_opts['sfnotify'] && sp_get_auth('moderate_posts', $newpost['forumid'], $admin->user_id)) { $email = spdb_table(SFUSERS, "ID = " . $admin->user_id, 'user_email'); $admins_email[$admin->user_id] = $email; } } } } $admins_email = apply_filters('sph_admin_email_addresses', $admins_email); # send the emails if (!empty($admins_email)) { # clean up the content for the plain text email - go get it from database so not in 'save' mode $post_content = spdb_table(SFPOSTS, 'post_id=' . $newpost['postid'], 'post_content'); $post_content = sp_filter_email_content($post_content); # create message body $msg = sp_text('New forum post on your site') . ': ' . get_option('blogname') . $eol . $eol; $msg .= sp_text('From') . ': ' . $tab . $newpost['postername'] . ' [' . $newpost['posteremail'] . ']' . ', ' . sp_text('Poster IP') . ': ' . $newpost['posterip'] . $eol . $eol; $msg .= sp_text('Group') . ':' . $tab . sp_filter_title_display($newpost['groupname']) . $eol; $msg .= sp_text('Forum') . ':' . $tab . sp_filter_title_display($newpost['forumname']) . $eol; $msg .= sp_text('Topic') . ':' . $tab . sp_filter_title_display($newpost['topicname']) . $eol; $msg .= urldecode($newpost['url']) . $eol; $msg .= sp_text('Post') . ':' . $eol . $post_content . $eol . $eol; foreach ($admins_email as $id => $email) { $newmsg = apply_filters('sph_admin_email', $msg, $newpost, $id, 'admin'); $replyto = apply_filters('sph_email_replyto', '', $newpost); $subject = sp_text('Forum Post') . ' - ' . get_option('blogname') . ': [' . sp_filter_title_display($newpost['topicname']) . ']'; $subject = apply_filters('sph_email_subject', $subject, $newpost); sp_send_email($email, $subject, $newmsg, $replyto); } $out = '- ' . sp_text('Notified: Administrators/Moderators'); } $out = apply_filters('sph_new_post_notifications', $out, $newpost); return $out; }
function sp_do_sp_AddNewTopicLinkTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('tagId' => 'spAddNewTopicLinkTag', 'tagClass' => 'spLinkTag', 'forumId' => '', 'linkText' => '%FORUMNAME%', 'beforeLink' => __('Add new topic in the ', 'sp-ttags'), 'afterLink' => __(' forum', 'sp-ttags'), 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_AddNewTopicLinkTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $forumId = (int) $forumId; $linkText = esc_attr($linkText); $beforeLink = sp_filter_title_display($beforeLink); $afterLink = sp_filter_title_display($afterLink); $echo = (int) $echo; if (!$forumId) { return; } if (!empty($beforeLink)) { $beforeLink = trim($beforeLink) . ' '; } if (!empty($afterLink)) { $afterLink = ' ' . trim($afterLink); } sp_forum_api_support(); if (sp_get_auth('start_topics', $forumId)) { $forum = spdb_table(SFFORUMS, "forum_id={$forumId}", 'row'); $linkText = str_replace("%FORUMNAME%", sp_filter_title_display($forum->forum_name), $linkText); $url = sp_build_url($forum->forum_slug, '', 0, 0); $url = sp_get_sfqurl($url) . 'new=topic'; $out = "<span id='{$tagId}' class='{$tagClass}'>"; $out .= $beforeLink . '<a href="' . $url . '">' . $linkText . '</a>' . $afterLink; $out .= '</span>'; $out = apply_filters('sph_AddNewTopicLinkTag', $out); if ($echo) { echo $out; } else { return $out; } } }
function spa_display_permission_select($cur_perm = 0, $showSelect = true) { ?> <?php $roles = sp_get_all_roles(); ?> <p><?php spa_etext('Select permission set'); ?> : <?php if ($showSelect) { ?> <select style="width:165px" class='sfacontrol' name='role'> <?php } $out = ''; if ($cur_perm == 0) { $out = '<option value="-1">' . spa_text('Select permission set') . '</option>'; } foreach ($roles as $role) { $selected = ''; if ($cur_perm == $role->role_id) { $selected = 'selected = "selected" '; } $out .= '<option ' . $selected . 'value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n"; } echo $out; if ($showSelect) { ?> </select></p> <?php } }
function spa_usergroups_edit_usergroup_form($usergroup_id) { global $spPaths; ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#usergrouprow-<?php echo $usergroup_id; ?> ').addClass('inForm'); spjAjaxForm('sfusergroupedit<?php echo $usergroup_id; ?> ', 'sfreloadub'); }); </script> <?php $usergroup = spa_get_usergroups_row($usergroup_id); spa_paint_options_init(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=editusergroup'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfusergroupedit<?php echo $usergroup->usergroup_id; ?> " name="sfusergroupedit<?php echo $usergroup->usergroup_id; ?> "> <?php echo sp_create_nonce('forum-adminform_usergroupedit'); spa_paint_open_tab(spa_text('User Groups') . ' - ' . spa_text('Manage User Groups'), true); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Edit User Group'), 'true', 'edit-user-group'); ?> <input type="hidden" name="usergroup_id" value="<?php echo $usergroup->usergroup_id; ?> " /> <input type="hidden" name="ugroup_name" value="<?php echo sp_filter_title_display($usergroup->usergroup_name); ?> " /> <input type="hidden" name="ugroup_desc" value="<?php echo sp_filter_title_display($usergroup->usergroup_desc); ?> " /> <input type="hidden" name="ugroup_join" value="<?php echo $usergroup->usergroup_join; ?> " /> <input type="hidden" name="ugroup_ismod" value="<?php echo $usergroup->usergroup_is_moderator; ?> " /> <?php spa_paint_input(spa_text('User Group Name'), 'usergroup_name', sp_filter_title_display($usergroup->usergroup_name), false, true); spa_paint_input(spa_text('User Group Description'), 'usergroup_desc', sp_filter_title_display($usergroup->usergroup_desc), false, true); spa_paint_select_start(spa_text('Select Badge'), 'usergroup_badge', 'usergroup_badge'); spa_select_icon_dropdown('usergroup_badge', spa_text('Select Badge'), SF_STORE_DIR . '/' . $spPaths['ranks'] . '/', $usergroup->usergroup_badge, false); spa_paint_select_end('<small>(' . spa_text('Upload badges on the Components - Forum Ranks admin panel') . ')</small>'); spa_paint_checkbox(spa_text('Allow members to join usergroup'), 'usergroup_join', $usergroup->usergroup_join, false, false, false, '<small>' . spa_text('(Indicates that members are allowed to choose to join this usergroup on their profile page)') . '</small>'); spa_paint_checkbox(spa_text('Is moderator'), 'usergroup_is_moderator', $usergroup->usergroup_is_moderator, false, false, false, '<small>' . spa_text('(Indicates that members of this usergroup are considered Moderators)') . '</small>'); spa_paint_close_fieldset(); spa_paint_close_panel(); do_action('sph_usergroup_edit_panel'); spa_paint_close_container(); ?> <div class="sfform-submit-bar"> <input type="submit" class="button-primary" id="sfusergroupedit<?php echo $usergroup->usergroup_id; ?> " name="sfusergroupedit<?php echo $usergroup->usergroup_id; ?> " value="<?php spa_etext('Update User Group'); ?> " /> <input type="button" class="button-primary" onclick="javascript:jQuery('#usergroup-<?php echo $usergroup->usergroup_id; ?> ').html('');jQuery('#usergrouprow-<?php echo $usergroup_id; ?> ').removeClass('inForm');" id="sfusergroupedit<?php echo $usergroup->usergroup_id; ?> " name="editusergroupcancel<?php echo $usergroup->usergroup_id; ?> " value="<?php spa_etext('Cancel'); ?> " /> </div> </form> <?php spa_paint_close_tab(); ?> <div class="sfform-panel-spacer"></div> <?php }
function sp_groupview_query($groupids = '', $idOrder = false) { global $spThisUser; # can we get the results from the cache? $records = array(); if (empty($spThisUser->inspect['q_spGroupView'])) { $records = sp_get_cache('group'); } if (!$records) { $WHERE = ''; if (!empty($groupids)) { $gcount = count($groupids); $done = 0; foreach ($groupids as $id) { $WHERE .= '(' . SFGROUPS . ".group_id={$id})"; $done++; if ($done < $gcount) { $WHERE .= ' OR '; } } } $this->groupViewStatus = empty($groupids) ? 'no data' : 'no access'; # retrieve group and forum records $spdb = new spdbComplex(); $spdb->table = SFGROUPS; $spdb->fields = SFGROUPS . '.group_id, group_name, group_desc, group_rss, group_icon, group_message, forum_id, forum_name, forum_slug, forum_desc, forum_status, forum_disabled, forum_icon, forum_icon_new, forum_icon_locked, forum_rss_private, post_id, post_id_held, topic_count, post_count, post_count_held, parent, children'; $spdb->join = array(SFFORUMS . ' ON ' . SFGROUPS . '.group_id = ' . SFFORUMS . '.group_id'); $spdb->where = $WHERE; $spdb->orderby = 'group_seq, forum_seq'; $spdb = apply_filters('sph_groupview_query', $spdb, $this); if (!empty($spThisUser->inspect['q_spGroupView'])) { $spdb->inspect = 'spGroupView'; $spdb->show = true; $spThisUser->inspect['q_spGroupView'] = false; } $records = $spdb->select(); if ($records) { sp_add_cache('group', $records); } } $g = ''; if ($records) { # Set status initially to 'no access' in case current user can view no forums $this->groupViewStatus = 'no access'; $gidx = 0; $fidx = 0; $sidx = 0; $cparent = 0; $subPostId = 0; # define array to collect data $p = array(); $g = array(); foreach ($records as $r) { $groupid = $r->group_id; $forumid = $r->forum_id; if (sp_can_view($forumid, 'forum-title')) { if ($gidx == 0 || $g[$gidx]->group_id != $groupid) { # reset status to 'data' $this->groupViewStatus = 'data'; $gidx = $groupid; $fidx = 0; $g[$gidx] = new stdClass(); $g[$gidx]->group_id = $r->group_id; $g[$gidx]->group_name = sp_filter_title_display($r->group_name); $g[$gidx]->group_desc = sp_filter_title_display($r->group_desc); $g[$gidx]->group_rss = esc_url($r->group_rss); $g[$gidx]->group_icon = sanitize_file_name($r->group_icon); $g[$gidx]->group_message = sp_filter_text_display($r->group_message); $g[$gidx]->group_rss_active = 0; $g[$gidx] = apply_filters('sph_groupview_group_records', $g[$gidx], $r); } if (isset($r->forum_id)) { # Is this a subform? if ($r->parent != 0) { $sidx = $r->forum_id; $g[$gidx]->forums[$cparent]->subforums[$sidx] = new stdClass(); $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_id = $r->forum_id; $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_name = sp_filter_title_display($r->forum_name); $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_slug = $r->forum_slug; $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_icon = sanitize_file_name($r->forum_icon); $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_icon_new = sanitize_file_name($r->forum_icon_new); $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_icon_locked = sanitize_file_name($r->forum_icon_locked); $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_disabled = $r->forum_disabled; $g[$gidx]->forums[$cparent]->subforums[$sidx]->forum_permalink = sp_build_url($r->forum_slug, '', 1, 0); $g[$gidx]->forums[$cparent]->subforums[$sidx]->topic_count = $r->topic_count; $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_count = $r->post_count; $g[$gidx]->forums[$cparent]->subforums[$sidx]->parent = $r->parent; $g[$gidx]->forums[$cparent]->subforums[$sidx]->children = $r->children; $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_id = $r->post_id; $g[$gidx]->forums[$cparent]->subforums[$sidx]->unread = 0; # check if we can look at posts in moderation - if not swap for 'held' values if (!sp_get_auth('moderate_posts', $r->forum_id)) { $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_count = $r->post_count_held; $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_id = $r->post_id_held; } # See if any forums are in the current users newpost list if ($spThisUser->member && isset($spThisUser->newposts['forums'])) { $c = 0; if ($spThisUser->newposts['forums']) { foreach ($spThisUser->newposts['forums'] as $fnp) { if ($fnp == $sidx) { $c++; } } } # set the subforum unread count $g[$gidx]->forums[$cparent]->subforums[$sidx]->unread = $c; } # Update top parent counts with subforum counts $g[$gidx]->forums[$cparent]->topic_count_sub += $g[$gidx]->forums[$cparent]->subforums[$sidx]->topic_count; $g[$gidx]->forums[$cparent]->post_count_sub += $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_count; # and what about the most recent post? Is this in a subforum? if ($g[$gidx]->forums[$cparent]->subforums[$sidx]->post_id > $g[$gidx]->forums[$cparent]->post_id && $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_id > $subPostId) { # store the alternative forum id in case we need to display the topic data for this one if inc. subs $g[$gidx]->forums[$cparent]->forum_id_sub = $r->forum_id; # add the last post in subforum to the list for stats retrieval $subPostId = $g[$gidx]->forums[$cparent]->subforums[$sidx]->post_id; $p[$r->forum_id] = $subPostId; } } else { # it's a top level forum $subPostId = 0; $fidx = $forumid; $g[$gidx]->forums[$fidx] = new stdClass(); $g[$gidx]->forums[$fidx]->forum_id = $r->forum_id; $g[$gidx]->forums[$fidx]->forum_id_sub = 0; $g[$gidx]->forums[$fidx]->forum_name = sp_filter_title_display($r->forum_name); $g[$gidx]->forums[$fidx]->forum_slug = $r->forum_slug; $g[$gidx]->forums[$fidx]->forum_permalink = sp_build_url($r->forum_slug, '', 1, 0); $g[$gidx]->forums[$fidx]->forum_desc = sp_filter_title_display($r->forum_desc); $g[$gidx]->forums[$fidx]->forum_status = $r->forum_status; $g[$gidx]->forums[$fidx]->forum_disabled = $r->forum_disabled; $g[$gidx]->forums[$fidx]->forum_icon = sanitize_file_name($r->forum_icon); $g[$gidx]->forums[$fidx]->forum_icon_new = sanitize_file_name($r->forum_icon_new); $g[$gidx]->forums[$fidx]->forum_icon_locked = sanitize_file_name($r->forum_icon_locked); $g[$gidx]->forums[$fidx]->forum_rss_private = $r->forum_rss_private; $g[$gidx]->forums[$fidx]->post_id = $r->post_id; $g[$gidx]->forums[$fidx]->topic_count = $r->topic_count; $g[$gidx]->forums[$fidx]->topic_count_sub = $r->topic_count; $g[$gidx]->forums[$fidx]->post_count = $r->post_count; $g[$gidx]->forums[$fidx]->post_count_sub = $r->post_count; $g[$gidx]->forums[$fidx]->parent = $r->parent; $g[$gidx]->forums[$fidx]->children = $r->children; $g[$gidx]->forums[$fidx]->unread = 0; if (empty($g[$gidx]->forums[$fidx]->post_id)) { $g[$gidx]->forums[$fidx]->post_id = 0; } # Can the user create new topics or should we lock the forum? $g[$gidx]->forums[$fidx]->start_topics = sp_get_auth('start_topics', $r->forum_id); # check if we can look at posts in moderation - if not swap for 'held' values if (!sp_get_auth('moderate_posts', $r->forum_id)) { $g[$gidx]->forums[$fidx]->post_id = $r->post_id_held; $g[$gidx]->forums[$fidx]->post_count = $r->post_count_held; $g[$gidx]->forums[$fidx]->post_count_sub = $r->post_count_held; $thisPostid = $r->post_id_held; } else { $thisPostid = $r->post_id; } # See if any forums are in the current users newpost list if ($spThisUser->member && isset($spThisUser->newposts['forums'])) { $c = 0; if ($spThisUser->newposts['forums']) { foreach ($spThisUser->newposts['forums'] as $fnp) { if ($fnp == $fidx) { $c++; } } } $g[$gidx]->forums[$fidx]->unread = $c; } if (empty($r->children)) { $cparent = 0; } else { $cparent = $fidx; $sidx = 0; } # Build post id array for collecting stats at the end if (!empty($thisPostid)) { $p[$fidx] = $thisPostid; } $g[$gidx]->forums[$fidx] = apply_filters('sph_groupview_forum_records', $g[$gidx]->forums[$fidx], $r); } # Build special Group level flag on whether to show group RSS button or not (based on any forum in group having RSS access if (sp_get_auth('view_forum', $r->forum_id) && !$r->forum_rss_private) { $g[$gidx]->group_rss_active = 1; } } } } } if ($this->includeStats == true) { # Go grab the forum stats and data if (!empty($p)) { $stats = $this->sp_groupview_stats_query($p); if ($stats) { foreach ($g as $gr) { foreach ($gr->forums as $f) { if (!empty($stats[$f->forum_id])) { $s = $stats[$f->forum_id]; $f->topic_id = $s->topic_id; $f->topic_name = sp_filter_title_display($s->topic_name); $f->topic_slug = $s->topic_slug; $f->post_id = $s->post_id; $f->post_permalink = sp_build_url($f->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index); $f->post_date = $s->post_date; $f->post_status = $s->post_status; $f->post_index = $s->post_index; # see if we can display the tooltip if (sp_can_view($f->forum_id, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) { $f->post_tip = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status); } else { $f->post_tip = ''; } $f->user_id = $s->user_id; $f->display_name = sp_filter_name_display($s->display_name); $f->guest_name = sp_filter_name_display($s->guest_name); } # do we need to record a possible subforum substitute topic? $fsub = $f->forum_id_sub; if ($fsub != 0 && !empty($stats[$fsub])) { $s = $stats[$fsub]; $f->topic_id_sub = $s->topic_id; $f->topic_name_sub = sp_filter_title_display($s->topic_name); $f->topic_slug_sub = $s->topic_slug; $f->post_id_sub = $s->post_id; $f->post_permalink_sub = sp_build_url($f->subforums[$fsub]->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index); $f->post_date_sub = $s->post_date; $f->post_status_sub = $s->post_status; $f->post_index_sub = $s->post_index; # see if we can display the tooltip if (sp_can_view($fsub, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) { $f->post_tip_sub = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status); } else { $f->post_tip_sub = ''; } $f->user_id_sub = $s->user_id; $f->display_name_sub = sp_filter_name_display($s->display_name); $f->guest_name_sub = sp_filter_name_display($s->guest_name); } $f = apply_filters('sph_groupview_stats_records', $f, $s); } } unset($stats); } } } # Do we need to re-order IDs based on passed in IDs if ($groupids && $idOrder) { $n = array(); foreach ($groupids as $gid) { if (array_key_exists($gid, $g)) { $n[$gid] = $g[$gid]; } } $g = $n; unset($n); } return $g; }
function sp_topicview_query($topicid = 0, $cPage = 1, $forumid = 0) { global $spGlobals, $spThisUser, $spVars; # do we have a valid topic id if ($topicid == 0) { $this->topicViewStatus = 'no data'; return; } else { $WHERE = SFTOPICS . '.topic_id=' . $topicid; } # default to no access $this->topicViewStatus = 'no access'; # some setup vars $startlimit = 0; $lastpage = 0; # how many posts per page? $ppaged = $spGlobals['display']['posts']['perpage']; if (!$ppaged) { $ppaged = 10; } # setup where we are in the post list (paging) if ($cPage != 1) { $startlimit = ($cPage - 1) * $ppaged; } $LIMIT = $startlimit . ', ' . $ppaged; # Set up order by $setSort = false; $reverse = false; $setSort = $spGlobals['display']['posts']['sortdesc']; if (isset($spGlobals['sort_order']['topic'])) { $reverse = array_search($topicid, (array) $spGlobals['sort_order']['topic']) !== false ? true : false; } if (isset($spThisUser->postDESC) && $spThisUser->postDESC) { $reverse = !$reverse; } if ($setSort xor $reverse) { $ORDER = 'post_pinned DESC, ' . SFPOSTS . ".post_id DESC"; } else { $ORDER = 'post_pinned DESC, ' . SFPOSTS . ".post_id ASC"; } # add newpost/sfwaiting support for admins $waitCheck = ', NULL AS new_post'; if ($spThisUser->admin || $spThisUser->moderator) { $waitCheck = ', ' . SFWAITING . '.post_count AS new_post'; } # Discover if this topic is in users new post list $maybeNewPost = false; if ($spThisUser->member && sp_is_in_users_newposts($topicid)) { $maybeNewPost = true; } # retrieve topic and post records $spdb = new spdbComplex(); $spdb->table = SFTOPICS; $spdb->found_rows = true; $spdb->fields = 'group_id, ' . SFTOPICS . '.topic_id, ' . SFTOPICS . '.forum_id, topic_name, topic_slug, topic_status, topic_pinned, topic_icon, topic_opened, ' . SFTOPICS . '.post_count, forum_name, forum_slug, forum_status, forum_disabled, forum_rss_private, ' . SFPOSTS . '.post_id, ' . spdb_zone_datetime('post_date') . ', ' . SFPOSTS . '.user_id, ' . SFTOPICS . '.user_id AS topic_starter, guest_name, guest_email, post_status, post_pinned, post_index, post_edit, poster_ip, source, post_content' . $waitCheck; $spdb->join = array(SFPOSTS . ' ON ' . SFTOPICS . '.topic_id=' . SFPOSTS . '.topic_id', SFFORUMS . ' ON ' . SFTOPICS . '.forum_id=' . SFFORUMS . '.forum_id'); if ($spThisUser->admin || $spThisUser->moderator) { $spdb->left_join = array(SFWAITING . ' ON ' . SFPOSTS . '.post_id=' . SFWAITING . '.post_id'); } $spdb->where = $WHERE; $spdb->orderby = $ORDER; $spdb->limits = $LIMIT; $spdb = apply_filters('sph_topicview_query', $spdb, $this); if (!empty($spThisUser->inspect['q_spTopicView'])) { $spdb->inspect = 'spTopicView'; $spdb->show = true; } $records = $spdb->select(); $t = array(); if ($records) { $tidx = $topicid; $pidx = 0; $r = current($records); if (sp_get_auth('view_forum', $r->forum_id)) { $this->topicViewStatus = 'data'; # construct the parent topic object $t[$tidx] = new stdClass(); $t[$tidx]->topic_id = $r->topic_id; $t[$tidx]->forum_id = $r->forum_id; $t[$tidx]->group_id = $r->group_id; $t[$tidx]->forum_name = sp_filter_title_display($r->forum_name); $t[$tidx]->topic_name = sp_filter_title_display($r->topic_name); $t[$tidx]->topic_slug = $r->topic_slug; $t[$tidx]->topic_opened = $r->topic_opened; $t[$tidx]->forum_status = $r->forum_status; $t[$tidx]->topic_pinned = $r->topic_pinned; $t[$tidx]->forum_disabled = $r->forum_disabled; $t[$tidx]->forum_slug = $r->forum_slug; $t[$tidx]->forum_rss_private = $r->forum_rss_private; $t[$tidx]->topic_permalink = sp_build_url($r->forum_slug, $r->topic_slug, 1, 0); $t[$tidx]->topic_status = $r->topic_status; $t[$tidx]->topic_icon = sanitize_file_name($r->topic_icon); $t[$tidx]->rss = ''; $t[$tidx]->editmode = 0; $t[$tidx]->tools_flag = 1; $t[$tidx]->display_page = $this->topicPage; $t[$tidx]->posts_per_page = $ppaged; $t[$tidx]->unread = 0; # user calc_rows and nor post_count as - for example - some posts may be hiodden by choice. $t[$tidx]->post_count = spdb_select('var', 'SELECT FOUND_ROWS()'); # Can the user create new topics or should we lock the forum? $t[$tidx]->start_topics = sp_get_auth('start_topics', $r->forum_id); $t[$tidx]->reply_topics = sp_get_auth('reply_topics', $r->forum_id); $t[$tidx]->reply_own_topics = sp_get_auth('reply_own_topics', $r->forum_id); # grab topic start info $t[$tidx]->topic_starter = $r->topic_starter; $totalPages = $r->post_count / $ppaged; if (!is_int($totalPages)) { $totalPages = intval($totalPages) + 1; } $t[$tidx]->total_pages = $totalPages; if ($setSort xor $reverse) { if ($cPage == 1) { $lastpage = true; } } else { if ($cPage == $totalPages) { $lastpage = true; } } $t[$tidx]->last_page = $lastpage; $t[$tidx] = apply_filters('sph_topicview_topic_record', $t[$tidx], $r); reset($records); unset($r); # now loop through the post records $newPostFlag = false; $firstPostPage = 1; $pinned = 0; # define post id and post user id arrays for plugins to use in combined filter $p = array(); $u = array(); foreach ($records as $r) { $pidx = $r->post_id; $p[] = $pidx; # prepare for user object $cUser = $spThisUser->ID == $r->user_id; $cSmall = !$cUser; $t[$tidx]->posts[$pidx] = new stdClass(); $t[$tidx]->posts[$pidx]->post_id = $r->post_id; $t[$tidx]->posts[$pidx]->post_date = $r->post_date; $t[$tidx]->posts[$pidx]->user_id = $r->user_id; $t[$tidx]->posts[$pidx]->guest_name = sp_filter_name_display($r->guest_name); $t[$tidx]->posts[$pidx]->guest_email = sp_filter_email_display($r->guest_email); $t[$tidx]->posts[$pidx]->post_status = $r->post_status; $t[$tidx]->posts[$pidx]->post_pinned = $r->post_pinned; $t[$tidx]->posts[$pidx]->post_index = $r->post_index; $t[$tidx]->posts[$pidx]->poster_ip = $r->poster_ip; $t[$tidx]->posts[$pidx]->source = $r->source; $t[$tidx]->posts[$pidx]->post_permalink = sp_build_url($r->forum_slug, $r->topic_slug, $cPage, $r->post_id); $t[$tidx]->posts[$pidx]->edits = ''; $t[$tidx]->posts[$pidx]->last_post = 0; $t[$tidx]->posts[$pidx]->last_post_on_page = 0; $t[$tidx]->posts[$pidx]->first_post_on_page = $firstPostPage; $t[$tidx]->posts[$pidx]->editmode = 0; $t[$tidx]->posts[$pidx]->post_content = sp_filter_content_display($r->post_content); $t[$tidx]->posts[$pidx]->first_pinned = 0; $t[$tidx]->posts[$pidx]->last_pinned = 0; $t[$tidx]->posts[$pidx]->postUser = new stdClass(); $t[$tidx]->posts[$pidx]->postUser = clone sp_get_user($r->user_id, $cUser, $cSmall); # populate the user guest name and email in case the poster is a guest if ($r->user_id == 0) { $t[$tidx]->posts[$pidx]->postUser->guest_name = $t[$tidx]->posts[$pidx]->guest_name; $t[$tidx]->posts[$pidx]->postUser->guest_email = $t[$tidx]->posts[$pidx]->guest_email; $t[$tidx]->posts[$pidx]->postUser->display_name = $t[$tidx]->posts[$pidx]->guest_name; $t[$tidx]->posts[$pidx]->postUser->ip = $t[$tidx]->posts[$pidx]->poster_ip; } # pinned status if ($firstPostPage == 1 && $r->post_pinned) { $t[$tidx]->posts[$pidx]->first_pinned = true; $pinned = $pidx; } if ($firstPostPage == 0 && $pinned > 0 && $r->post_pinned == false) { $t[$tidx]->posts[$pinned]->last_pinned = true; } elseif ($r->post_pinned) { $pinned = $pidx; } $firstPostPage = 0; # Is this a new post for the current user? if ($spThisUser->guest) { $newPostFlag = false; } else { if ($maybeNewPost && strtotime($r->post_date) > strtotime($spThisUser->lastvisit)) { $newPostFlag = true; } if (isset($r->new_post)) { $newPostFlag = true; } } $t[$tidx]->posts[$pidx]->new_post = $newPostFlag; # do we need to hide an admin post? if (!sp_get_auth('view_admin_posts', $r->forum_id) && sp_is_forum_admin($r->user_id)) { $adminview = sp_get_sfmeta('adminview', 'message'); if ($adminview) { $t[$tidx]->posts[$pidx]->post_content = '<div class="spMessage">'; $t[$tidx]->posts[$pidx]->post_content .= sp_filter_text_display($adminview[0]['meta_value']); $t[$tidx]->posts[$pidx]->post_content .= '</div>'; } else { $t[$tidx]->posts[$pidx]->post_content = ''; } } # do we need to hide an others posts? if (sp_get_auth('view_own_admin_posts', $r->forum_id) && !sp_is_forum_admin($r->user_id) && !sp_is_forum_mod($r->user_id) && $spThisUser->ID != $r->user_id) { $userview = sp_get_sfmeta('userview', 'message'); if ($userview) { $t[$tidx]->posts[$pidx]->post_content = '<div class="spMessage">'; $t[$tidx]->posts[$pidx]->post_content .= sp_filter_text_display($userview[0]['meta_value']); $t[$tidx]->posts[$pidx]->post_content .= '</div>'; } else { $t[$tidx]->posts[$pidx]->post_content = ''; } } # Is this post to be edited? if ($spVars['displaymode'] == 'edit' && $spVars['postedit'] == $r->post_id) { $t[$tidx]->editmode = 1; $t[$tidx]->editpost_id = $r->post_id; $t[$tidx]->editpost_content = sp_filter_content_edit($r->post_content); $t[$tidx]->posts[$pidx]->editmode = 1; } # Add edit history if (!empty($r->post_edit) && is_serialized($r->post_edit)) { $edits = unserialize($r->post_edit); $eidx = 0; foreach ($edits as $e) { $t[$tidx]->posts[$pidx]->edits[$eidx] = new stdClass(); $t[$tidx]->posts[$pidx]->edits[$eidx]->by = $e['by']; $t[$tidx]->posts[$pidx]->edits[$eidx]->at = $e['at']; $eidx++; } } if (!in_array($r->user_id, $u)) { $u[] = $r->user_id; } $t[$tidx]->posts[$pidx] = apply_filters('sph_topicview_post_records', $t[$tidx]->posts[$pidx], $r); } # index of post IDs with position in listing $t[$tidx]->post_keys = $p; $t[$tidx]->posts[$pidx]->last_post = $lastpage; $t[$tidx]->posts[$pidx]->last_post_on_page = 1; # save last post on page id $t[$tidx]->last_post_id = $r->post_id; # allow plugins to add more data to combined topic/post data structure $t[$tidx] = apply_filters('sph_topicview_combined_data', $t[$tidx], $p, $u); unset($records); } else { # check for view forum lists but not topic lists if (sp_can_view($r->forum_id, 'forum-title')) { $this->topicViewStatus = 'sneak peek'; } } } return $t; }
function sp_forumview_build_subforums($forumid, $f, $fidx, $subs) { global $spThisUser; ksort($subs); foreach ($subs as $sub) { if (sp_can_view($sub->forum_id, 'topic-title')) { $f[$fidx]->subforums[$sub->forum_id] = new stdClass(); $f[$fidx]->subforums[$sub->forum_id]->top_parent = $fidx; $f[$fidx]->subforums[$sub->forum_id]->top_sub_parent = $sub->topSubParent; $f[$fidx]->subforums[$sub->forum_id]->forum_id = $sub->forum_id; $f[$fidx]->subforums[$sub->forum_id]->forum_id_sub = 0; $f[$fidx]->subforums[$sub->forum_id]->forum_name = sp_filter_title_display($sub->forum_name); $f[$fidx]->subforums[$sub->forum_id]->forum_permalink = sp_build_url($sub->forum_slug, '', 1, 0); $f[$fidx]->subforums[$sub->forum_id]->forum_slug = $sub->forum_slug; $f[$fidx]->subforums[$sub->forum_id]->forum_desc = sp_filter_title_display($sub->forum_desc); $f[$fidx]->subforums[$sub->forum_id]->forum_status = $sub->forum_status; $f[$fidx]->subforums[$sub->forum_id]->forum_disabled = $sub->forum_disabled; $f[$fidx]->subforums[$sub->forum_id]->forum_icon = sanitize_file_name($sub->forum_icon); $f[$fidx]->subforums[$sub->forum_id]->forum_icon_new = sanitize_file_name($sub->forum_icon_new); $f[$fidx]->subforums[$sub->forum_id]->topic_icon = sanitize_file_name($sub->topic_icon); $f[$fidx]->subforums[$sub->forum_id]->topic_icon_new = sanitize_file_name($sub->topic_icon_new); $f[$fidx]->subforums[$sub->forum_id]->topic_icon_locked = sanitize_file_name($sub->topic_icon_locked); $f[$fidx]->subforums[$sub->forum_id]->topic_icon_pinned = sanitize_file_name($sub->topic_icon_pinned); $f[$fidx]->subforums[$sub->forum_id]->forum_rss_private = $sub->forum_rss_private; $f[$fidx]->subforums[$sub->forum_id]->post_id = $sub->post_id; $f[$fidx]->subforums[$sub->forum_id]->post_id_held = $sub->post_id_held; $f[$fidx]->subforums[$sub->forum_id]->topic_count = $sub->topic_count; $f[$fidx]->subforums[$sub->forum_id]->topic_count_sub = $sub->topic_count; $f[$fidx]->subforums[$sub->forum_id]->post_count = $sub->post_count; $f[$fidx]->subforums[$sub->forum_id]->post_count_sub = $sub->post_count; $f[$fidx]->subforums[$sub->forum_id]->post_count_held = $sub->post_count_held; $f[$fidx]->subforums[$sub->forum_id]->parent = $sub->parent; $f[$fidx]->subforums[$sub->forum_id]->children = $sub->children; $f[$fidx]->subforums[$sub->forum_id]->unread = 0; # Can the user create new topics or should we lock the forum? $f[$fidx]->subforums[$sub->forum_id]->start_topics = sp_get_auth('start_topics', $sub->forum_id); # See if any forums are in the current users newpost list if ($spThisUser->member) { $c = 0; if ($spThisUser->newposts && $spThisUser->newposts['forums']) { foreach ($spThisUser->newposts['forums'] as $fnp) { if ($fnp == $sub->forum_id) { $c++; } } } $f[$fidx]->subforums[$sub->forum_id]->unread = $c; } # check if we can look at posts in moderation - if not swap for 'held' values if (!sp_get_auth('moderate_posts', $sub->forum_id)) { $f[$fidx]->subforums[$sub->forum_id]->post_id = $sub->post_id_held; $f[$fidx]->subforums[$sub->forum_id]->post_count = $sub->post_count_held; $f[$fidx]->subforums[$sub->forum_id]->post_count_sub = $sub->post_count_held; $thisPostid = $sub->post_id_held; } else { $thisPostid = $sub->post_id; } # Build post id array for collecting stats at the end if (!empty($thisPostid)) { $p[$sub->forum_id] = $thisPostid; } # if this subforum has a parent that is differemt to the main forum being dislayed in the view # then it has to be a nested subforum so do we need to merge the numbers? if ($sub->parent != $forumid) { $f[$fidx]->subforums[$sub->parent]->topic_count_sub += $f[$fidx]->subforums[$sub->forum_id]->topic_count; $f[$fidx]->subforums[$sub->parent]->post_count_sub += $f[$fidx]->subforums[$sub->forum_id]->post_count; # and what about the most recent post? Is this in a nested subforum? if ($f[$fidx]->subforums[$sub->forum_id]->post_id > $f[$fidx]->subforums[$sub->parent]->post_id) { # store the alternative forum id in case we need to display the topic data for this one if inc. subs $f[$fidx]->subforums[$sub->parent]->forum_id_sub = $sub->forum_id; } } } } # Go grab the sub forum stats and data if (!empty($p)) { $stats = $this->sp_subforumview_stats_query($p); if ($stats) { $s = ''; foreach ($subs as $sub) { if (!empty($stats[$sub->forum_id])) { $s = $stats[$sub->forum_id]; $f[$fidx]->subforums[$sub->forum_id]->topic_id = $s->topic_id; $f[$fidx]->subforums[$sub->forum_id]->topic_name = sp_filter_title_display($s->topic_name); $f[$fidx]->subforums[$sub->forum_id]->topic_slug = $s->topic_slug; $f[$fidx]->subforums[$sub->forum_id]->post_id = $s->post_id; $f[$fidx]->subforums[$sub->forum_id]->post_permalink = sp_build_url($f[$fidx]->subforums[$sub->forum_id]->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index); $f[$fidx]->subforums[$sub->forum_id]->post_date = $s->post_date; $f[$fidx]->subforums[$sub->forum_id]->post_status = $s->post_status; $f[$fidx]->subforums[$sub->forum_id]->post_index = $s->post_index; # see if we can display the tooltip if (sp_can_view($sub->forum_id, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) { $f[$fidx]->subforums[$sub->forum_id]->post_tip = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status); } else { $f[$fidx]->subforums[$sub->forum_id]->post_tip = ''; } $f[$fidx]->subforums[$sub->forum_id]->user_id = $s->user_id; $f[$fidx]->subforums[$sub->forum_id]->display_name = sp_filter_name_display($s->display_name); $f[$fidx]->subforums[$sub->forum_id]->guest_name = sp_filter_name_display($s->guest_name); } # do we need to record a possible subforum substitute topic? $fsub = isset($f[$fidx]->subforums[$sub->forum_id]->forum_id_sub) ? $f[$fidx]->subforums[$sub->forum_id]->forum_id_sub : 0; if ($fsub != 0 && !empty($stats[$fsub])) { $s = $stats[$fsub]; $f[$fidx]->subforums[$sub->forum_id]->topic_id_sub = $s->topic_id; $f[$fidx]->subforums[$sub->forum_id]->topic_name_sub = sp_filter_title_display($s->topic_name); $f[$fidx]->subforums[$sub->forum_id]->topic_slug_sub = $s->topic_slug; $f[$fidx]->subforums[$sub->forum_id]->post_id_sub = $s->post_id; $f[$fidx]->subforums[$sub->forum_id]->post_permalink_sub = sp_build_url($f[$fidx]->subforums[$fsub]->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index); $f[$fidx]->subforums[$sub->forum_id]->post_date_sub = $s->post_date; $f[$fidx]->subforums[$sub->forum_id]->post_status_sub = $s->post_status; $f[$fidx]->subforums[$sub->forum_id]->post_index_sub = $s->post_index; # see if we can display the tooltip if (sp_can_view($fsub, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) { $f[$fidx]->subforums[$sub->forum_id]->post_tip_sub = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status); } else { $f[$fidx]->subforums[$sub->forum_id]->post_tip_sub = ''; } $f[$fidx]->subforums[$sub->forum_id]->user_id_sub = $s->user_id; $f[$fidx]->subforums[$sub->forum_id]->display_name_sub = sp_filter_name_display($s->display_name); $f[$fidx]->subforums[$sub->forum_id]->guest_name_sub = sp_filter_name_display($s->guest_name); } # allow plugins to add more data to combined subforum/post data structure $f[$fidx]->subforums[$sub->forum_id] = apply_filters('sph_forumview_subforum_records', $f[$fidx]->subforums[$sub->forum_id], $s); } } unset($subs); unset($stats); } return $f; }
function spa_forums_edit_forum_form($forum_id) { ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#forumrow-<?php echo $forum_id; ?> ').addClass('inForm'); spjAjaxForm('sfforumedit<?php echo $forum_id; ?> ', 'sfreloadfb'); }); </script> <?php global $spPaths, $tab; $forum = spdb_table(SFFORUMS, "forum_id={$forum_id}", 'row'); spa_paint_options_init(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=editforum'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfforumedit<?php echo $forum->forum_id; ?> " name="sfforumedit<?php echo $forum->forum_id; ?> "> <?php echo sp_create_nonce('forum-adminform_forumedit'); spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), true); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Forum Details'), false); $subforum = $forum->parent ? true : false; echo "<input type='hidden' name='cgroup_id' value='{$forum->group_id}' />"; echo "<input type='hidden' name='cparent' value='{$forum->parent}' />"; echo "<input type='hidden' name='cchildren' value='{$forum->children}' />"; if (!$subforum && empty($forum->children)) { $mess = sp_text('This is a top-level forum with no sub-forums and on this panel you can change the forum Group it is a member of. If changed it will be moved to the target Forum Group.'); } elseif (!$subforum && !empty($forum->children)) { $mess = sp_text('This is a top level forum with designated sub-forums and on this panel you can change the forum Group it is a member of. If changed it will be moved, along with the sub-forums, to the target Forum Group.'); } elseif ($subforum && empty($forum->children)) { $mess = sp_text('This is a sub-forum and on this panel you can change the forum parent it belongs to. If changed it will be moved to become a sub-forum of the target Forum.'); } else { $mess = sp_text('This is a sub-forum and also a parent to other sub-forums and on this panel you can change the forum parent it belongs to. If changed it will be moved, along with the sub-forums, to the target Forum.'); } echo '<div class="sfoptionerror spaceabove">'; echo "<p><b>{$mess}</b></br>"; echo sp_text('For more flexible Group/Forum ordering and sub-forum promotion and demotion, please use the drag and drop interface on the Order Groups and Forums admin panel from the Forums Menu - or the Order Forums panel at Group level.') . '</p>'; echo '</div>'; # Top level forum... $style = $subforum ? ' style="display:none"' : ' style="display:block"'; echo "<div {$style}>"; spa_paint_select_start(spa_text('The group this forum belongs to'), 'group_id', ''); echo spa_create_group_select($forum->group_id); spa_paint_select_end(); echo '</div>'; # sub-forum... $style = $subforum ? ' style="display:block"' : ' style="display:none"'; echo "<div {$style}>"; spa_paint_select_start(spa_text('Parent forum this subforum belongs to'), 'parent', ''); echo spa_create_forum_select($forum->parent); spa_paint_select_end(); echo '</div>'; spa_paint_input(spa_text('Forum name'), 'forum_name', sp_filter_title_display($forum->forum_name), false, true); echo '<input type="hidden" name="forum_id" value="' . $forum->forum_id . '" />'; $target = 'cforum_slug'; $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&sfnonce=' . wp_create_nonce('forum-ahah'); echo "<div class='sp-form-row'>\n"; echo "<div class='wp-core-ui sflabel sp-label-40'>" . spa_text('Forum slug') . ':</div>'; echo '<input type="text" class="wp-core-ui sp-input-60" tabindex="' . $tab . '" name="cforum_slug" id="cforum_slug" value="' . esc_attr($forum->forum_slug) . '" onchange="spjSetForumSlug(this, \'' . $ahahURL . '\', \'' . $target . '\', \'edit\');" />'; echo '<div class="clearboth"></div>'; echo '</div>'; $tab++; spa_paint_input(spa_text('Description'), 'forum_desc', sp_filter_text_edit($forum->forum_desc), false, true); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Forum Options'), false); $target = 'cforum_slug'; $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums&sfnonce=' . wp_create_nonce('forum-ahah'); spa_paint_checkbox(spa_text('Locked'), 'forum_status', $forum->forum_status); spa_paint_checkbox(spa_text('Disable forum RSS feed so feed will not be generated'), 'forum_private', $forum->forum_rss_private); spa_paint_select_start(sprintf(spa_text('Featured Image for this forum %s(200px x 200px recommended)'), '<br>'), 'feature_image', ''); spa_select_icon_dropdown('feature_image', spa_text('Select Feature Image'), SF_STORE_DIR . '/' . $spPaths['forum-images'] . '/', $forum->feature_image, false); spa_paint_select_end(); echo '<div class="sfoptionerror spaceabove">'; echo '<p><b>' . sp_text('Custom Icon Ordering') . '</b></br>'; echo sp_text('When using custom forum or topic icons and multiple conditions exist, the following precedence is used:') . '</p>'; echo sp_text('Locked') . '<br />'; echo sp_text('Pinned') . '<br />'; echo sp_text('Unread') . '<br />'; echo sp_text('Custom') . '<br />'; echo sp_text('Theme Default') . '<br />'; echo '</div>'; spa_paint_select_start(spa_text('Custom forum icon'), 'forum_icon', ''); spa_select_icon_dropdown('forum_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom forum icon when new posts'), 'forum_icon_new', ''); spa_select_icon_dropdown('forum_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon_new, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom forum icon when locked'), 'forum_icon_locked', ''); spa_select_icon_dropdown('forum_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->forum_icon_locked, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom topic icon'), 'topic_icon', ''); spa_select_icon_dropdown('topic_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom topic icon when new posts'), 'topic_icon_new', ''); spa_select_icon_dropdown('topic_icon_new', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_new, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom topic icon when locked'), 'topic_icon_locked', ''); spa_select_icon_dropdown('topic_icon_locked', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_locked, false); spa_paint_select_end(); spa_paint_select_start(spa_text('Custom topic icon when pinned'), 'topic_icon_pinned', ''); spa_select_icon_dropdown('topic_icon_pinned', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $forum->topic_icon_pinned, false); spa_paint_select_end(); spa_paint_input(spa_text('Replacement external RSS URL') . '<br />' . spa_text('Default') . ': <strong>' . sp_build_url($forum->forum_slug, '', 0, 0, 0, 1) . '</strong>', 'forum_rss', sp_filter_url_display($forum->forum_rss), false, true); spa_paint_input(spa_text('Custom meta keywords (SEO option must be enabled)'), 'forum_keywords', '', false, true); spa_paint_wide_textarea('Special forum message to be displayed above forums', 'forum_message', sp_filter_text_edit($forum->forum_message)); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Extended Forum Options'), false); # As added by plugins do_action('sph_forum_edit_forum_options', $forum); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); ?> <div class="sfform-submit-bar"> <input type="submit" class="button-primary" id="sfforumedit<?php echo $forum->forum_id; ?> " name="sfforumedit<?php echo $forum->forum_id; ?> " value="<?php spa_etext('Update Forum'); ?> " /> <input type="button" class="button-primary" onclick="javascript:jQuery('#forum-<?php echo $forum->forum_id; ?> ').html('');jQuery('#forumrow-<?php echo $forum_id; ?> ').removeClass('inForm');" id="sfforumedit<?php echo $forum->forum_id; ?> " name="editforumcancel<?php echo $forum->forum_id; ?> " value="<?php spa_etext('Cancel'); ?> " /> </div> <?php spa_paint_close_tab(); ?> </form> <div class="sfform-panel-spacer"></div> <?php }
function sp_get_metakeywords() { global $spVars; $keywords = ''; $sfmetatags = sp_get_option('sfmetatags'); $sfmetatags['sfkeywords'] = isset($sfmetatags['sfkeywords']) ? $sfmetatags['sfkeywords'] : ''; if (!empty($sfmetatags['sfusekeywords'])) { if ($sfmetatags['sfusekeywords'] == 3) { if ($spVars['pageview'] == 'forum' || $spVars['pageview'] == 'topic') { $keywords = sp_filter_title_display(spdb_table(SFFORUMS, 'forum_id=' . $spVars['forumid'], 'keywords')); } else { $keywords = stripslashes($sfmetatags['sfkeywords']); } } else { if ($sfmetatags['sfusekeywords'] == 2) { $keywords = stripslashes($sfmetatags['sfkeywords']); } } } return apply_filters('sph_meta_keywords', $keywords); }
function spa_paint_group_forums($groupid, $parent, $parentname, $level) { $space = '<img class="subArrow" src="' . SFADMINIMAGES . 'sp_SubforumLevel.png" alt="" />'; $forums = spa_get_group_forums_by_parent($groupid, $parent); $noMembers = array(); if ($forums) { $noMembers = spa_forums_check_memberships($forums); foreach ($forums as $forum) { $subforum = $forum->parent; $haschild = ''; if ($forum->children) { $childlist = array(unserialize($forum->children)); if (count($childlist) > 0) { $haschild = $childlist; } } if (empty($forum->forum_icon)) { $icon = SPTHEMEICONSURL . 'sp_ForumIcon.png'; } else { $icon = esc_url(SFCUSTOMURL . $forum->forum_icon); if (!file_exists(SFCUSTOMDIR . $forum->forum_icon)) { $icon = SPTHEMEICONSURL . 'sp_ForumIcon.png'; } } $rowClass = in_array($forum->forum_id, $noMembers) ? ' class="spWarningBG"' : ''; ?> <tr id="forumrow-<?php echo $forum->forum_id; ?> " <?php echo $rowClass; ?> > <!-- display forum information for each forum --> <td style="text-align:center;width:2%"><?php echo $forum->forum_id; ?> </td> <td style="text-align:center;padding:8px 0px;width:5%"><?php echo '<img src="' . $icon . '" alt="" title="' . spa_text('Current forum icon') . '" />'; ?> <?php if ($haschild) { ?> <br /><img class="parentArrow" src="<?php echo SFADMINIMAGES . 'sp_HasChild.png'; ?> " alt="" title="<?php spa_etext('Parent Forum'); ?> " /> <?php } ?> </td> <td> <div class="sp-half-row-left"> <?php if ($forum->forum_status) { echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_LockedBig.png" alt="" />'; } if ($subforum) { ?> <?php if ($forum->forum_disabled) { echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_NoWrite.png" alt="" title="' . spa_text('Subforum is disabled') . '" /> '; } ?> <?php echo str_repeat($space, $level - 1); ?> <img class="subArrow" src="<?php echo SFADMINIMAGES . 'sp_Subforum.png'; ?> " alt="" title="<?php spa_etext('Subforum'); ?> " /> <div class='row-title'><strong><?php echo sp_filter_title_display($forum->forum_name); ?> </strong></div><div>(<?php echo spa_text('Subforum of') . ': ' . $parentname . ')'; ?> </div><div><?php echo sp_filter_text_display($forum->forum_desc); ?> </div> <?php } else { ?> <?php if ($forum->forum_disabled) { echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_NoWrite.png" alt="" title="' . spa_text('Forum is disabled') . '" /> '; } ?> <div class='row-title'><strong><?php echo sp_filter_title_display($forum->forum_name); ?> </strong></div><div><?php echo sp_filter_text_display($forum->forum_desc); ?> </div> <?php } if (in_array($forum->forum_id, $noMembers)) { echo '<p><b>' . spa_text('Warning - There are no usergroups with members that have permission to use this forum') . '</b></p>'; } sp_display_item_stats(SFTOPICS, 'forum_id', $forum->forum_id, spa_text('Topics')); echo ' | '; sp_display_item_stats(SFPOSTS, 'forum_id', $forum->forum_id, spa_text('Posts')); ?> </div> <div class="sp-half-row-right"> <?php $base = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah'); $target = "forum-{$forum->forum_id}"; $image = SFADMINIMAGES; ?> <input id="sfreloadpb<?php echo $forum->forum_id; ?> " type="button" class="button-secondary" value="<?php echo sp_splice(spa_text('Forum Permissions'), 0); ?> " onclick="spjLoadForm('forumperm', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $forum->forum_id; ?> ');" /> <input type="button" class="button-secondary" value="<?php echo sp_splice(spa_text('Edit Forum'), 0); ?> " onclick="spjLoadForm('editforum', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $forum->forum_id; ?> ');" /> <input type="button" class="button-secondary" value="<?php echo sp_splice(spa_text('Delete Forum'), 0); ?> " onclick="spjLoadForm('deleteforum', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $forum->forum_id; ?> ');" /> <?php if ($forum->forum_disabled) { ?> <input type="button" class="button-secondary" value="<?php echo sp_splice(spa_text('Enable Forum'), 0); ?> " onclick="spjLoadForm('enableforum', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $forum->forum_id; ?> ');" /> <?php } else { ?> <input type="button" class="button-secondary" value="<?php echo sp_splice(spa_text('Disable Forum'), 0); ?> " onclick="spjLoadForm('disableforum', '<?php echo $base; ?> ', '<?php echo $target; ?> ', '<?php echo $image; ?> ', '<?php echo $forum->forum_id; ?> ');" /> <?php } ?> </div> </td> </tr> <tr class="sfinline-form"> <!-- This row will hold ahah forms for the current forum --> <td colspan="3" style="padding: 0 10px 0 0;border-bottom:1px solid #dddddd"> <div id="forum-<?php echo $forum->forum_id; ?> "></div> </td> </tr> <?php if ($haschild) { $newlevel = $level + 1; spa_paint_group_forums($groupid, $forum->forum_id, $forum->forum_name, $newlevel); } } } }
function sp_MemberListUsergroupSelect($args = '') { global $spMembersList; if (empty($spMembersList->userGroups)) { return; } if (!sp_get_auth('view_members_list')) { return; } global $spMembersList; $defs = array('tagId' => 'spUsergroupSelect', 'tagClass' => 'spUsergroupSelect', 'selectClass' => 'spControl', 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_MemberListUsergroupSelect_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $selectClass = esc_attr($selectClass); $echo = (int) $echo; $search = !empty($_POST['msearch']) && !isset($_POST['allmembers']) ? '&msearch=' . sp_esc_str($_POST['msearch']) : ''; $search = !empty($_GET['msearch']) ? '&msearch=' . sp_esc_str($_GET['msearch']) : $search; $ug = !empty($_POST['ug']) && !isset($_POST['allmembers']) ? sp_esc_int($_POST['ug']) : ''; $ug = !empty($_GET['ug']) ? sp_esc_int($_GET['ug']) : $ug; $out = "<div id='{$tagId}' class='{$tagClass}'>"; $out .= "<select class='{$selectClass}' name='sp_usergroup_select' onchange='javascript:spjChangeURL(this)'>"; $out .= "<option value='#'>" . sp_text('Select Specific Usergroup') . "</option>"; foreach ($spMembersList->userGroups as $usergroup) { $selected = $usergroup['usergroup_id'] == $ug ? "selected='selected'" : ''; $out .= "<option {$selected} value='" . sp_get_sfqurl(sp_url('members')) . 'ug=' . $usergroup['usergroup_id'] . $search . "'>" . sp_filter_title_display($usergroup['usergroup_name']) . '</option>'; } if (!empty($ug)) { $out .= "<option value='" . sp_get_sfqurl(sp_url('members')) . $search . "'>" . sp_text('Reset to Default Usergroups') . "</option>"; } $out .= '</select>'; $out .= "</div>\n"; $out = apply_filters('sph_MemberListUsergroupSelect', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function sp_post_editor_smileys_options($out, $spThisTopic, $a, $toolbar) { global $spGlobals, $spVars, $spThisUser; extract($a, EXTR_SKIP); # sanitize $controlInput = esc_attr($controlInput); $labelSmileys = sp_filter_title_display($labelSmileys); $labelOptions = sp_filter_title_display($labelOptions); $labelOptionTime = sp_filter_title_display($labelOptionTime); $smileysBox = ''; $optionsBox = ''; # work out what we need to display $display = array(); $display['smileys'] = false; $display['options'] = false; if (sp_get_auth('can_use_smileys', $spThisTopic->forum_id)) { $display['smileys'] = true; } if ((sp_get_auth('lock_topics', $spThisTopic->forum_id) || sp_get_auth('pin_posts', $spThisTopic->forum_id)) && $spVars['displaymode'] != 'edit' || $spThisUser->admin || $spThisUser->moderator) { $display['options'] = true; } $display = apply_filters('sph_post_editor_display_options', $display); # Now start the displays $class = $toolbar == 'toolbar' ? ' spInlineSection' : ''; if ($display['smileys'] || $display['options']) { $out .= sp_InsertBreak('echo=0') . "<div>\n"; } # Smileys if ($display['smileys']) { $smileysBox = apply_filters('sph_post_smileys_display', $smileysBox, $spThisTopic, $a); if ($display['options'] && $toolbar == 'inline') { $smileysBox .= "<div id='spSmileysBox' class='spEditorSection spEditorSectionLeft{$class}'>\n"; } else { $smileysBox .= "<div id='spSmileysBox' class='spEditorSection{$class}'>\n"; } $smileysBox .= "<div class='spEditorHeading'>{$labelSmileys}\n"; $smileysBox = apply_filters('sph_post_smileys_header_add', $smileysBox, $spThisTopic, $a); $smileysBox .= '</div>'; $smileysBox .= '<div class="spEditorSmileys">' . "\n"; $smileysBox .= sp_render_smileys(); $smileysBox .= '</div>'; $smileysBox = apply_filters('sph_post_smileys_add', $smileysBox, $spThisTopic, $a); if ($toolbar == 'toolbar') { $smileysBox .= sp_InsertBreak('direction=both&spacer=6px&echo=0'); } $smileysBox .= '</div>' . "\n"; } # Options if ($display['options']) { $optionsBox = apply_filters('sph_post_options_display', $optionsBox, $spThisTopic, $a); if ($display['smileys'] && $toolbar == 'inline') { $optionsBox .= "<div id='spOptionsBox' class='spEditorSection spEditorSectionRight{$class}'>\n"; } else { $optionsBox .= "<div id='spOptionsBox' class='spEditorSection{$class}'>\n"; } $optionsBox .= "<div class='spEditorHeading'>{$labelOptions}\n"; $optionsBox = apply_filters('sph_post_options_header_add', $optionsBox, $spThisTopic, $a); $optionsBox .= '</div>'; if ($spVars['displaymode'] != 'edit') { $labelOptionLock = sp_filter_title_display($labelOptionLock); $labelOptionPin = sp_filter_title_display($labelOptionPin); if (sp_get_auth('lock_topics', $spThisTopic->forum_id)) { $optionsBox .= "<input type='checkbox' class='{$controlInput}' name='topiclock' id='sftopiclock' tabindex='110' />\n"; $optionsBox .= "<label class='spLabel spCheckbox' for='sftopiclock'>{$labelOptionLock}</label>\n"; $optionsBox .= "<br />\n"; } if (sp_get_auth('pin_topics', $spThisTopic->forum_id)) { $optionsBox .= "<input type='checkbox' class='{$controlInput}' name='postpin' id='sfpostpin' tabindex='111' />\n"; $optionsBox .= "<label class='spLabel spCheckbox' for='sfpostpin'>{$labelOptionPin}</label>\n"; $optionsBox .= "<br />\n"; } } if ($spThisUser->admin) { $optionsBox .= "<input type='checkbox' class='{$controlInput}' tabindex='112' id='sfeditTimestamp' name='editTimestamp' onchange='spjToggleLayer(\"spHiddenTimestamp\");'/>\n"; $optionsBox .= "<label class='spLabel spCheckbox' for='sfeditTimestamp'>{$labelOptionTime}</label>\n"; $optionsBox .= "<br />\n"; } if ($spThisUser->admin) { global $wp_locale, $month, $spThisPost; $time_adj = time() + get_option('gmt_offset') * 3600; $dd = gmdate('d', $time_adj); $mm = gmdate('m', $time_adj); $yy = gmdate('Y', $time_adj); $hh = gmdate('H', $time_adj); $mn = gmdate('i', $time_adj); $ss = gmdate('s', $time_adj); $optionsBox .= '<div id="spHiddenTimestamp">' . "\n"; $optionsBox .= "<select class='{$controlInput}' tabindex='114' name='tsMonth' onchange='editTimestamp.checked=true'>\n"; for ($i = 1; $i < 13; $i = $i + 1) { $optionsBox .= "\t\t\t<option value=\"{$i}\""; if ($i == $mm) { $optionsBox .= " selected='selected'"; } if (class_exists('WP_Locale')) { $optionsBox .= '>' . $wp_locale->get_month($i) . '</option>'; } else { $optionsBox .= '>' . $month[$i] . '</option>'; } } $optionsBox .= '</select> '; $optionsBox .= "<input class='{$controlInput}' tabindex='115' type='text' id='tsDay' name='tsDay' value='{$dd}' size='2' maxlength='2'/> \n"; $optionsBox .= "<input class='{$controlInput}' tabindex='116' type='text' id='tsYear' name='tsYear' value='{$yy}' size='4' maxlength='5'/> @\n"; $optionsBox .= "<input class='{$controlInput}' tabindex='117' type='text' id='tsHour' name='tsHour' value='{$hh}' size='2' maxlength='2'/> :\n"; $optionsBox .= "<input class='{$controlInput}' tabindex='118' type='text' id='tsMinute' name='tsMinute' value='{$mn}' size='2' maxlength='2'/> \n"; $optionsBox .= "<input class='{$controlInput}' tabindex='119' type='hidden' id='tsSecond' name='tsSecond' value='{$ss}' /> \n"; $optionsBox .= "</div>"; } if ($spVars['displaymode'] == 'edit') { $optionsBox = apply_filters('sph_post_edit_options_add', $optionsBox, $spThisTopic, $a); } else { $optionsBox = apply_filters('sph_post_options_add', $optionsBox, $spThisTopic, $a); } if ($toolbar == 'toolbar') { $optionsBox .= sp_InsertBreak('direction=both&spacer=6px&echo=0'); } else { $optionsBox .= sp_InsertBreak('echo=0'); } $optionsBox .= '</div>' . "\n"; } if ($display['smileys'] || $display['options']) { $out .= $smileysBox . $optionsBox; $out .= sp_InsertBreak('echo=0'); $out .= '</div>'; } return $out; }
function sp_do_sp_UnansweredPostsTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('tagId' => 'spUnansweredPostsTag', 'tagClass' => 'spListTag', 'listId' => 'spListItemTag%ID%', 'listClass' => 'spListItemTag', 'linkClass' => 'spLinkTag', 'textClass' => 'spTextTag', 'avatarClass' => 'spAvatarTag', 'listTags' => 1, 'forumIds' => '', 'limit' => 5, 'itemOrder' => 'FTUD', 'linkScope' => 'forum', 'beforeForum' => __('Forum: ', 'sp-ttags'), 'afterForum' => '<br />', 'beforeTopic' => __('Topic: ', 'sp-ttags'), 'afterTopic' => '<br />', 'beforeUser' => __('By: ', 'sp-ttags'), 'afterUser' => '', 'beforeDate' => ' -', 'afterDate' => '', 'avatarSize' => 25, 'niceDate' => 1, 'postTip' => 1, 'truncate' => 0, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_UnansweredPostsTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $listClass = esc_attr($listClass); $listId = esc_attr($listId); $linkClass = esc_attr($linkClass); $textClass = esc_attr($textClass); $avatarClass = esc_attr($avatarClass); $listTags = (int) $listTags; $forumIds = esc_attr($forumIds); $limit = (int) $limit; $itemOrder = esc_attr($itemOrder); $linkScope = esc_attr($linkScope); $beforeForum = sp_filter_title_display($beforeForum); $afterForum = sp_filter_title_display($afterForum); $beforeTopic = sp_filter_title_display($beforeTopic); $afterTopic = sp_filter_title_display($afterTopic); $beforeUser = sp_filter_title_display($beforeUser); $afterUser = sp_filter_title_display($afterUser); $beforeDate = sp_filter_title_display($beforeDate); $afterDate = sp_filter_title_display($afterDate); $avatarSize = (int) $avatarSize; $niceDate = (int) $niceDate; $postTip = (int) $postTip; $truncate = (int) $truncate; $echo = (int) $echo; sp_forum_api_support(); global $spPostList, $spThisPostList; $where = SFTOPICS . '.post_count=1'; # do we have forum ids specified? $where .= !empty($forumIds) ? ' AND ' . SFPOSTS . '.forum_id IN (' . $forumIds . ')' : ''; $spPostList = new spPostList($where, SFPOSTS . '.post_id DESC', $limit); if (empty($spPostList)) { return; } if (!empty($beforeForum)) { $beforeForum = trim($beforeForum) . ' '; } if (!empty($beforeTopic)) { $beforeTopic = trim($beforeTopic) . ' '; } if (!empty($beforeUser)) { $beforeUser = trim($beforeUser) . ' '; } if (!empty($beforeDate)) { $beforeDate = trim($beforeDate) . ' '; } if (!empty($afterForum)) { $afterForum = ' ' . trim($afterForum); } if (!empty($afterTopic)) { $afterTopic = ' ' . trim($afterTopic); } if (!empty($afterUser)) { $afterUser = '******' . trim($afterUser); } if (!empty($afterDate)) { $afterDate = ' ' . trim($afterDate); } $fLink = $tLink = $aLink = false; if ($linkScope == 'forum') { $fLink = $tLink = true; } if ($linkScope == 'all') { $aLink = true; } # Start building dislay $out = $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>"; # start the loop if (sp_has_postlist()) { while (sp_loop_postlist()) { sp_the_postlist(); $thisId = str_ireplace('%ID%', $spThisPostList->topic_id, $listId); $out .= $listTags ? "<li id='{$thisId}' class='{$listClass}'>" : "<div id='{$thisId}' class='{$listClass}'>"; $title = $postTip ? "title='{$spThisPostList->post_tip}'" : ''; if ($aLink) { $out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>"; } for ($x = 0; $x < strlen($itemOrder); $x++) { switch (substr($itemOrder, $x, 1)) { case 'F': # Forum $out .= $beforeForum; if ($fLink) { $out .= "<a class='{$linkClass}' href='{$spThisPostList->forum_permalink}'>"; } $out .= sp_truncate($spThisPostList->forum_name, $truncate); if ($fLink) { $out .= '</a>'; } $out .= $afterForum; break; case 'T': # Topic $out .= $beforeTopic; if ($tLink) { $out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>"; } $out .= sp_truncate($spThisPostList->topic_name, $truncate); if ($tLink) { $out .= '</a>'; } $out .= $afterTopic; break; case 'A': # Avatar $spx = $avatarSize + 10 . 'px'; $out .= sp_UserAvatar("tagClass={$avatarClass}&size={$avatarSize}&link=none&context=user&echo=0", $spThisPostList); break; case 'U': # user $out .= "<span class='{$textClass}'>{$spThisPostList->display_name}{$afterUser}</span>"; break; case 'D': # date if ($niceDate) { $out .= "<span class='{$textClass}'>" . $beforeDate . sp_nicedate($spThisPostList->post_date) . "{$afterDate}</span>\n"; } else { $out .= "<span class='{$textClass}'>" . $beforeDate . sp_date('d', $spThisPostList->post_date) . "{$afterDate}</span>\n"; } break; default: # Invalid code $out .= '<br />' . __('Invalid Tag Code Found', 'sp-ttags') . '<br />'; break; } } if ($aLink) { $out .= '</a>'; } $out .= $listTags ? '</li>' : '</div>'; } } $out .= $listTags ? '</ul>' : '</div>'; $out = apply_filters('sph_UnansweredPostsTag', $out); if ($echo) { echo $out; } else { return $out; } }
function spa_profiles_options_form() { ?> <script type="text/javascript"> spjAjaxForm('sfoptionsform', ''); </script> <?php $sfoptions = spa_get_options_data(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=profiles-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=options'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfoptionsform" name="sfoptions"> <?php echo sp_create_nonce('forum-adminform_options'); spa_paint_options_init(); #== PROFILE OPTIONS Tab ============================================================ spa_paint_open_tab(spa_text('Profiles') . ' - ' . spa_text('Profile Options')); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Display Name Format'), true, 'display-name-format'); spa_paint_checkbox(spa_text('Let member choose display name'), 'nameformat', $sfoptions['nameformat']); spa_paint_select_start(spa_text('Display name format if member cannot choose') . '<br />' . spa_text('(ignored if member allowed to choose)'), 'fixeddisplayformat', 'fixeddisplayformat'); echo spa_display_name_format_options($sfoptions['fixeddisplayformat']); spa_paint_select_end(); echo '<tr><td colspan="2"><br /><div class="sfoptionerror">'; spa_etext('Warning: If you change the display name format, it may take some time on a large number of users to update them to the new format. Please be patient.'); echo '</div><br />'; echo '</td></tr>'; spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Personal Photos'), true, 'personal-photos'); spa_paint_input(spa_text('Maximum number of photos allowed'), 'photosmax', $sfoptions['photosmax'], false, false); spa_paint_input(spa_text('Maximum pixel width of photo display'), 'photoswidth', $sfoptions['photoswidth'], false, false); spa_paint_input(spa_text('Maximum pixel height of photo display'), 'photosheight', $sfoptions['photosheight'], false, false); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Signature Image Size'), true, 'sig-images'); echo '<tr><td colspan="2"> <u>' . spa_text('If you are allowing signature images (zero = not limited)') . ':</u></td></tr>'; spa_paint_input(spa_text('Maximum signature width (pixels)'), 'sfsigwidth', $sfoptions['sfsigwidth']); spa_paint_input(spa_text('Maximum signature height (pixels)'), 'sfsigheight', $sfoptions['sfsigheight']); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('First Forum Visit'), true, 'first-forum-visit'); spa_paint_checkbox(spa_text('Display profile form on login'), 'firstvisit', $sfoptions['firstvisit']); $show_password_fields = apply_filters('show_password_fields', true); if ($show_password_fields) { spa_paint_checkbox(spa_text('Force password change'), 'forcepw', $sfoptions['forcepw']); } spa_paint_close_fieldset(); spa_paint_close_panel(); do_action('sph_profiles_options_left_panel'); spa_paint_tab_right_cell(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Display Profile Mode'), true, 'display-profile-mode'); $values = array(spa_text('Popup window'), spa_text('Forum profile page'), spa_text('BuddyPress profile'), spa_text('WordPress author page'), spa_text('Other page'), spa_text('Mingle profile')); spa_paint_radiogroup(spa_text('Display profile information in'), 'displaymode', $values, $sfoptions['displaymode'], false, true); spa_paint_input(spa_text('URL for Other page'), 'displaypage', sp_filter_url_display($sfoptions['displaypage']), false, true); spa_paint_input(spa_text('Query String Variable Name'), 'displayquery', sp_filter_title_display($sfoptions['displayquery']), false, true); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Profile Entry Form Mode'), true, 'profile-entry-form-mode'); $values = array(spa_text('Forum profile form'), spa_text('WordPress profile form'), spa_text('BuddyPress profile'), spa_text('Other form'), spa_text('Mingle profile')); spa_paint_radiogroup(spa_text('Enter profile information In'), 'formmode', $values, $sfoptions['formmode'], false, true); spa_paint_input(spa_text('URL for Other page'), 'formpage', sp_filter_url_display($sfoptions['formpage']), false, true); spa_paint_input(spa_text('Query string variable name'), 'formquery', sp_filter_title_display($sfoptions['formquery']), false, true); spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Profile Overview Message'), true, 'profile-message'); $submessage = spa_text('Text you enter here will be displayed to the User on their profile overview page'); spa_paint_wide_textarea(spa_text('Profile overview message'), 'sfprofiletext', sp_filter_text_edit($sfoptions['sfprofiletext']), $submessage); spa_paint_close_fieldset(); spa_paint_close_panel(); do_action('sph_profiles_options_right_panel'); spa_paint_close_container(); ?> <div class="sfform-submit-bar"> <input type="submit" class="button-primary" id="saveit" name="saveit" value="<?php spa_etext('Update Profile Options'); ?> " /> </div> </form> <?php spa_paint_close_tab(); }
function sp_listview_query($topicIds, $count, $group, $forumIds, $firstPost, $popup) { global $spThisUser, $spGlobals; # If no topic ids and no count then nothjing to do - return empty if (empty($topicIds) && $count == 0) { return; } # set popup flag for new posts $this->popup = $popup; # Do we have enough topic ids to satisfy count? if (empty($topicIds) || $count != 0 && count($topicIds) < $count) { $topicIds = $this->sp_listview_populate_topicids($topicIds, $forumIds, $count); } # Do we havwe too many topic ids? if ($topicIds && ($count != 0 && count($topicIds) > $count)) { $topicIds = array_slice($topicIds, 0, $count, true); } if (empty($topicIds)) { return; } # Construct the main WHERE clause and then main query $where = SFTOPICS . '.topic_id IN (' . implode(',', $topicIds) . ')'; if ($group) { $orderby = 'group_seq, forum_seq, ' . SFTOPICS . '.post_id DESC'; } else { $orderby = SFTOPICS . '.post_id DESC'; } $spdb = new spdbComplex(); $spdb->table = SFTOPICS; $spdb->fields = SFTOPICS . '.forum_id, forum_name, forum_slug, forum_disabled, ' . SFTOPICS . '.topic_id, topic_name, topic_slug, topic_icon, topic_icon_new, ' . SFTOPICS . '.post_count, ' . SFTOPICS . '.post_id, post_status, post_index, ' . spdb_zone_datetime('post_date') . ', guest_name, ' . SFPOSTS . '.user_id, post_content, display_name'; $spdb->join = array(SFFORUMS . ' ON ' . SFFORUMS . '.forum_id = ' . SFTOPICS . '.forum_id', SFGROUPS . ' ON ' . SFGROUPS . '.group_id = ' . SFFORUMS . '.group_id', SFPOSTS . ' ON ' . SFPOSTS . '.post_id = ' . SFTOPICS . '.post_id'); $spdb->left_join = array(SFMEMBERS . ' ON ' . SFMEMBERS . '.user_id = ' . SFPOSTS . '.user_id'); $spdb->where = $where; $spdb->orderby = $orderby; $spdb = apply_filters('sph_topic_list_query', $spdb, $this); $records = $spdb->select(); # add filters where required plus extra data # And the new array $list = array(); if ($records) { # check if all forum ids are the same $x = current($records); $f = $x->forum_id; $single = 1; foreach ($records as $r) { if ($r->forum_id != $f) { $single = 0; } } reset($records); $new = ''; $first = ''; # Now we can grab the supplementary post records where there may be new posts... if ($spThisUser->member) { $new = $this->sp_listview_populate_newposts($topicIds); } # go and grab the first post info if desired if ($firstPost) { $first = $this->sp_listview_populate_firstposts($topicIds); } # Some values we need # How many topics to a page? $ppaged = $spGlobals['display']['posts']['perpage']; if (empty($ppaged) || $ppaged == 0) { $ppaged = 20; } # establish topic sort order $order = 'ASC'; # default if ($spGlobals['display']['posts']['sortdesc']) { $order = 'DESC'; } # global override $listPos = 1; foreach ($records as $r) { $show = true; # can the user see this forum? if (!sp_can_view($r->forum_id, 'topic-title')) { $show = false; } # if in moderattion can this user approve posts? if ($r->post_status != 0 && !sp_get_auth('moderate_posts', $r->forum_id)) { $show = false; } if ($show) { $t = $r->topic_id; $list[$t] = new stdClass(); $list[$t]->forum_id = $r->forum_id; $list[$t]->forum_name = sp_filter_title_display($r->forum_name); $list[$t]->forum_disabled = $r->forum_disabled; $list[$t]->forum_permalink = sp_build_url($r->forum_slug, '', 1, 0); $list[$t]->topic_id = $r->topic_id; $list[$t]->topic_name = sp_filter_title_display($r->topic_name); $list[$t]->topic_permalink = sp_build_url($r->forum_slug, $r->topic_slug, 1, 0); $list[$t]->topic_icon = sanitize_file_name($r->topic_icon); $list[$t]->topic_icon_new = sanitize_file_name($r->topic_icon_new); $list[$t]->post_count = $r->post_count; $list[$t]->post_id = $r->post_id; $list[$t]->post_status = $r->post_status; $list[$t]->post_date = $r->post_date; $list[$t]->user_id = $r->user_id; $list[$t]->guest_name = sp_filter_name_display($r->guest_name); $list[$t]->display_name = sp_filter_name_display($r->display_name); if (sp_can_view($r->forum_id, 'post-content', $spThisUser->ID, $r->user_id)) { $list[$t]->post_tip = $r->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($r->post_content, $r->post_status); } else { $list[$t]->post_tip = ''; } $list[$t]->list_position = $listPos; if (empty($r->display_name)) { $list[$t]->display_name = $list[$t]->guest_name; } # Lastly determine the page for the post permalink if ($order == 'ASC') { $page = $r->post_index / $ppaged; if (!is_int($page)) { $page = intval($page + 1); } } else { $page = $r->post_count - $r->post_index; $page = $page / $ppaged; $page = intval($page + 1); } $r->page = $page; $list[$t]->post_permalink = sp_build_url($r->forum_slug, $r->topic_slug, $r->page, $r->post_id, $r->post_index); $list[$t]->single_forum = $single; # add in any new post details if they exist if (!empty($new) && array_key_exists($t, $new)) { $list[$t]->new_post_count = $new[$t]->new_post_count; $list[$t]->new_post_post_id = $new[$t]->new_post_post_id; $list[$t]->new_post_post_index = $new[$t]->new_post_post_index; $list[$t]->new_post_post_date = $new[$t]->new_post_post_date; $list[$t]->new_post_user_id = $new[$t]->new_post_user_id; $list[$t]->new_post_display_name = $new[$t]->new_post_display_name; $list[$t]->new_post_guest_name = $new[$t]->new_post_guest_name; $list[$t]->new_post_permalink = sp_build_url($r->forum_slug, $r->topic_slug, 0, $new[$t]->new_post_post_id, $new[$t]->new_post_post_index); if (empty($new[$t]->new_post_display_name)) { $list[$t]->new_post_display_name = $new[$t]->new_post_guest_name; } } # add the first post info if desired if ($firstPost) { $list[$t]->first_post_permalink = sp_build_url($r->forum_slug, $r->topic_slug, 0, $first[$t]->post_id, 1); $list[$t]->first_post_date = $first[$t]->post_date; $list[$t]->first_user_id = $first[$t]->user_id; $list[$t]->first_guest_name = sp_filter_name_display($first[$t]->guest_name); $list[$t]->first_display_name = sp_filter_name_display($first[$t]->display_name); if (sp_can_view($r->forum_id, 'post-content', $spThisUser->ID, $first[$t]->user_id)) { $list[$t]->first_post_tip = $first[$t]->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($first[$t]->post_content, $first[$t]->post_status); } else { $list[$t]->first_post_tip = ''; } if (empty($list[$t]->first_display_name)) { $list[$t]->first_display_name = $list[$t]->first_guest_name; } } $list[$t] = apply_filters('sph_topic_list_record', $list[$t], $r); $listPos++; } } unset($records); unset($new); unset($first); } return $list; }
function spUser_filter_item($item, $filter) { if (is_array($item)) { return $item; } switch ($filter) { case 'title': $item = sp_filter_title_display($item); break; case 'email': $item = sp_filter_email_display($item); break; case 'url': $item = sp_filter_url_display($item); break; case 'text': $item = sp_filter_text_display($item); break; case 'name': $item = sp_filter_name_display($item); break; case 'signature': $item = sp_filter_signature_display($item); break; } return $item; }
function sp_render_inline_search_form($args) { global $spVars, $spThisUser, $spGlobals, $spDevice; extract($args, EXTR_SKIP); # sanitize before use $searchInclude = !empty($spVars['searchinclude']) ? $spVars['searchinclude'] : (int) $searchIncludeDef; $searchScope = $spVars['forumid'] == 'all' || empty($spVars['forumid']) && (int) $searchScope == 2 ? 2 : 1; $submitId2 = esc_attr($submitId2); $submitClass2 = esc_attr($submitClass2); $icon = sanitize_file_name($icon); $iconClass = esc_attr($iconClass); if (!empty($submitLabel)) { $submitLabel = sp_filter_title_display($submitLabel); } if (!empty($toolTip)) { $toolTip = esc_attr($toolTip); } if (!empty($labelLegend)) { $labelLegend = sp_filter_title_display($labelLegend); } if (!empty($labelScope)) { $labelScope = sp_filter_title_display($labelScope); } if (!empty($labelCurrent)) { $labelCurrent = sp_filter_title_display($labelCurrent); } if (!empty($labelAll)) { $labelAll = sp_filter_title_display($labelAll); } if (!empty($labelMatch)) { $labelMatch = sp_filter_title_display($labelMatch); } if (!empty($labelMatchAny)) { $labelMatchAny = sp_filter_title_display($labelMatchAny); } if (!empty($labelMatchAll)) { $labelMatchAll = sp_filter_title_display($labelMatchAll); } if (!empty($labelMatchPhrase)) { $labelMatchPhrase = sp_filter_title_display($labelMatchPhrase); } if (!empty($labelOptions)) { $labelOptions = sp_filter_title_display($labelOptions); } if (!empty($labelPostTitles)) { $labelPostTitles = sp_filter_title_display($labelPostTitles); } if (!empty($labelPostsOnly)) { $labelPostsOnly = sp_filter_title_display($labelPostsOnly); } if (!empty($labelTitlesOnly)) { $labelTitlesOnly = sp_filter_title_display($labelTitlesOnly); } if (!empty($labelWildcards)) { $labelWildcards = sp_filter_title_display($labelWildcards); } if (!empty($labelMatchAnyChars)) { $labelMatchAnyChars = sp_filter_title_display($labelMatchAnyChars); } if (!empty($labelMatchOneChar)) { $labelMatchOneChar = sp_filter_title_display($labelMatchOneChar); } if (!empty($labelMinLength)) { $labelMinLength = sp_filter_title_display($labelMinLength); } if (!empty($labelMemberSearch)) { $labelMemberSearch = sp_filter_title_display($labelMemberSearch); } if (!empty($labelTopicsPosted)) { $labelTopicsPosted = sp_filter_title_display($labelTopicsPosted); } if (!empty($labelTopicsStarted)) { $labelTopicsStarted = sp_filter_title_display($labelTopicsStarted); } $br = defined('SP_USE_PRETTY_CBOX') && SP_USE_PRETTY_CBOX == true ? '' : '<br />'; # all or current forum? $out = ''; $out .= '<fieldset class="spSearchFormAdvanced">'; $out .= '<legend>' . $labelLegend . '</legend>'; $out .= '<div class="spSearchSection spSearchSectionForm">'; $out = apply_filters('sph_SearchFormTop', $out); $out .= '<div class="spRadioSection spLeft">'; $tout = ''; $tout .= '<p class="spSearchForumScope">— ' . $labelScope . ' —</p>'; if (!empty($spVars['forumid']) && $spVars['forumid'] != 'all') { $tout .= '<input type="hidden" name="forumslug" value="' . esc_attr($spVars['forumslug']) . '" />'; $tout .= '<input type="hidden" name="forumid" value="' . esc_attr($spVars['forumid']) . '" />'; $tout .= '<input type="radio" id="sfradio1" name="searchoption" value="1"' . ($searchScope == 1 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio1">' . $labelCurrent . '</label>' . $br; } $tout .= '<input type="radio" id="sfradio2" name="searchoption" value="2"' . ($searchScope == 2 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio2">' . $labelAll . '</label>' . $br; $out .= apply_filters('sph_SearchFormForumScope', $tout); $out .= '</div>'; # search type? $tout = ''; $tout .= '<div class="spRadioSection spLeft">'; $tout .= '<p class="spSearchMatch">— ' . $labelMatch . ' —</p>'; $tout .= '<input type="radio" id="sfradio3" name="searchtype" value="1"' . ($spVars['searchtype'] == 1 || empty($spVars['searchtype']) ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio3">' . $labelMatchAny . '</label>' . $br; $tout .= '<input type="radio" id="sfradio4" name="searchtype" value="2"' . ($spVars['searchtype'] == 2 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio4">' . $labelMatchAll . '</label>' . $br; $tout .= '<input type="radio" id="sfradio5" name="searchtype" value="3"' . ($spVars['searchtype'] == 3 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio5">' . $labelMatchPhrase . '</label>' . $br; $out .= apply_filters('sph_SearchFormMatch', $tout); $out .= '</div>'; if ($spDevice == 'mobile') { $out .= sp_InsertBreak('echo=0&spacer=12px'); } # topic title? $tout = ''; $tout .= '<div class="spRadioSection spLeft">'; $tout .= '<p class="spSearchOptions">— ' . $labelOptions . ' —</p>'; $tout .= '<input type="radio" id="sfradio6" name="encompass" value="1"' . ($searchInclude == 1 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio6">' . $labelPostsOnly . '</label>' . $br; $tout .= '<input type="radio" id="sfradio7" name="encompass" value="2"' . ($searchInclude == 2 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio7">' . $labelTitlesOnly . '</label>' . $br; $tout .= '<input type="radio" id="sfradio8" name="encompass" value="3"' . ($searchInclude == 3 ? ' checked="checked"' : '') . ' /> <label class="spLabel spRadio" for="sfradio8">' . $labelPostTitles . '</label>' . $br; $out .= apply_filters('sph_SearchFormOptions', $tout); $out .= '</div>'; $out .= '<p class="spLeft spSearchDetails">' . sprintf($labelMinLength, '<b>' . $spGlobals['mysql']['search']['min'] . '</b>', '<b>' . $spGlobals['mysql']['search']['max'] . '</b>') . "</p>"; $out .= '</div>'; $tout = '<div class="spSearchFormSubmit">'; $tout .= "<a rel='nofollow' id='{$submitId2}' class='{$submitClass2} vtip' title='{$toolTip}' onclick='spjValidateSearch(this, \"{$submitId2}\", \"link\", {$spGlobals['mysql']['search']['min']});'>"; if (!empty($icon)) { $tout .= "<img class='{$iconClass}' src='" . sp_find_icon(SPTHEMEICONSURL, $icon) . "' alt=''/>"; } $tout .= "{$submitLabel}</a>"; $tout .= '</div>'; $out .= apply_filters('sph_SearchFormSubmit', $tout); $out .= '</fieldset>'; $out .= sp_InsertBreak('echo=0'); $tout = ''; if ($spThisUser->member) { $tout .= '<fieldset class="spSearchMember">'; $tout .= '<legend>' . $labelMemberSearch . '</legend>'; $tout .= '<div class="spSearchSection spSearchSectionUser">'; $tout .= '<img src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_Search.png') . '" alt="" />'; $tout .= '<input type="hidden" name="userid" value="' . $spThisUser->ID . '" />'; $tout .= '<input type="submit" class="spSubmit" name="membersearch" value="' . $labelTopicsPosted . '" />'; $tout .= '<input type="submit" class="spSubmit" name="memberstarted" value="' . $labelTopicsStarted . '" />'; $tout .= '</div>'; $tout .= '</fieldset>'; } $out .= apply_filters('sph_SearchFormMember', $tout); $out = apply_filters('sph_SearchFormBottom', $out); return $out; }
function sp_NoForumsInGroupMessage($args = '', $definedMessage = '') { global $spForumView; $defs = array('tagId' => 'spNoForumsInGroupMessage', 'tagClass' => 'spMessage', 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_NoForumsInGroupMessage_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $echo = (int) $echo; $get = (int) $get; if ($get) { return sp_filter_title_display($definedMessage); } $out = "<div id='{$tagId}' class='{$tagClass}'>" . sp_filter_title_display($definedMessage) . "</div>\n"; $out = apply_filters('sph_NoForumsInGroupMessage', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function sp_ProfileShowEmail($args = '', $label = '') { global $spProfileUser, $spThisUser; if (!sp_get_auth('view_profiles')) { return; } $defs = array('tagClass' => 'spProfileShowLink', 'leftClass' => 'spColumnSection spProfileLeftCol', 'middleClass' => 'spColumnSection spProfileSpacerCol', 'rightClass' => 'spColumnSection spProfileRightCol', 'adminOnly' => 1, 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ProfileShowLink_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagClass = esc_attr($tagClass); $leftClass = esc_attr($leftClass); $middleClass = esc_attr($middleClass); $rightClass = esc_attr($rightClass); $adminOnly = (int) $adminOnly; # this should really be bypass permission or let anyone view $label = sp_filter_title_display($label); $echo = (int) $echo; $get = (int) $get; if ($get) { return $spProfileUser->user_email; } if (sp_get_auth('view_email') || !$adminOnly) { $out = ''; $out .= "<div class='{$leftClass}'>"; $out .= "<p class='{$tagClass}'>{$label}:</p>"; $out .= '</div>'; $out .= "<div class='{$middleClass}'></div>"; $out .= "<div class='{$rightClass}'>"; $out .= "<p class='{$tagClass}'>{$spProfileUser->user_email}</p>"; $out .= "</div>\n"; $out = apply_filters('sph_ProfileShowEmail', $out, $spProfileUser, $a); if ($echo) { echo $out; } else { return $out; } } }
function sp_TopicForumToolButton($args = '', $label = '', $toolTip = '') { global $spThisForum, $spThisTopic, $spThisUser, $spGlobals; if ($spGlobals['lockdown'] == true && $spThisUser->admin == false) { return; } $show = false; if ($spThisUser->admin || $spThisUser->moderator) { $show = true; } else { if (sp_get_auth('lock_topics', $spThisForum->forum_id) || sp_get_auth('pin_topics', $spThisForum->forum_id) || sp_get_auth('edit_any_topic_titles', $spThisForum->forum_id) || sp_get_auth('delete_topics', $spThisForum->forum_id) || sp_get_auth('move_topics', $spThisForum->forum_id) || sp_get_auth('edit_own_topic_titles', $spThisForum->forum_id) && $spThisTopic->first_user_id == $spThisUser->ID) { $show = true; } } $show = apply_filters('sph_forum_tools_forum_show', $show); if (!$show) { return; } $defs = array('tagId' => 'spForumToolButton%ID%', 'tagClass' => 'spToolsButton', 'icon' => 'sp_ForumTools.png', 'iconClass' => 'spIcon', 'hide' => 1, 'containerClass' => 'spForumTopicSection'); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_TopicForumToolButton_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $icon = sanitize_file_name($icon); $iconClass = esc_attr($iconClass); $containerClass = esc_attr($containerClass); $hide = (int) $hide; $toolTip = esc_attr($toolTip); $label = sp_filter_title_display($label); $tagId = str_ireplace('%ID%', $spThisTopic->topic_id, $tagId); $addStyle = ''; if ($hide) { $addStyle = " style='display:none;' "; } $site = SFHOMEURL . 'index.php?sp_ahah=admintoollinks&sfnonce=' . wp_create_nonce('forum-ahah') . "&action=topictools&topic={$spThisTopic->topic_id}&forum={$spThisForum->forum_id}&page={$spThisForum->display_page}"; $out = "<a class='{$tagClass} vtip' id='{$tagId}' title='{$toolTip}' rel='nofollow' href='javascript:void(null)' {$addStyle} "; $title = esc_js(sp_text('Forum Tools')); $out .= "onclick='spjDialogAjax(this, \"{$site}\", \"{$title}\", 250, 0, 0);' >"; if (!empty($icon)) { $out .= "<img class='{$iconClass}' src='" . sp_find_icon(SPTHEMEICONSURL, $icon) . "' alt=''/>"; } if (!empty($label)) { $out .= $label; } $out .= "</a>\n"; $out = apply_filters('sph_TopicForumToolButton', $out, $a); echo $out; # Add script to hover admin buttons - just once if ($spThisForum->tools_flag && $hide) { ?> <script type='text/javascript'> /* <![CDATA[ */ var sptb = { toolclass : '.<?php echo $containerClass; ?> ' }; /* ]]> */ </script> <?php add_action('wp_footer', 'spjs_AddTopicToolsHover'); $spThisForum->tools_flag = false; } }
function sp_render_add_topic_form($args) { global $spVars, $spGlobals, $spThisForum, $spThisUser, $spGuestCookie; include_once SF_PLUGIN_DIR . '/forum/content/forms/sp-form-components.php'; $toolbar = $spGlobals['display']['editor']['toolbar']; $defs = array('tagClass' => 'spForm', 'hide' => 1, 'controlFieldset' => 'spEditorFieldset', 'controlInput' => 'spControl', 'controlSubmit' => 'spSubmit', 'controlOrder' => 'cancel|save', 'maxTitleLength' => 200, 'labelHeading' => sp_text('Add Topic'), 'labelGuestName' => sp_text('Guest name (required)'), 'labelGuestEmail' => sp_text('Guest email (required)'), 'labelModerateAll' => sp_text('NOTE: new posts are subject to administrator approval before being displayed'), 'labelModerateOnce' => sp_text('NOTE: first posts are subject to administrator approval before being displayed'), 'labelTopicName' => sp_text('Topic name'), 'labelSmileys' => sp_text('Smileys'), 'labelOptions' => sp_text('Options'), 'labelOptionLock' => sp_text('Lock this topic'), 'labelOptionPin' => sp_text('Pin this post'), 'labelOptionTime' => sp_text('Edit post timestamp'), 'labelMath' => sp_text('Math Required'), 'labelMathSum' => sp_text('What is the sum of'), 'labelPostButtonReady' => sp_text('Submit Topic'), 'labelPostButtonMath' => sp_text('Do Math To Save'), 'labelPostCancel' => sp_text('Cancel'), 'tipSmileysButton' => sp_text('Open/Close to Add a Smiley'), 'tipOptionsButton' => sp_text('Open/Close to select Posting Options'), 'tipSubmitButton' => sp_text('Save the New Topic'), 'tipCancelButton' => sp_text('Cancel the New Topic')); $a = wp_parse_args($args, $defs); extract($a, EXTR_SKIP); # sanitize $tagClass = esc_attr($tagClass); $hide = (int) $hide; $controlFieldset = esc_attr($controlFieldset); $controlInput = esc_attr($controlInput); $maxTitleLength = (int) $maxTitleLength; $labelHeading = sp_filter_title_display($labelHeading); $labelGuestName = sp_filter_title_display($labelGuestName); $labelGuestEmail = sp_filter_title_display($labelGuestEmail); $labelModerateAll = sp_filter_title_display($labelModerateAll); $labelModerateOnce = sp_filter_title_display($labelModerateOnce); $labelTopicName = sp_filter_title_display($labelTopicName); # Check for a failure package in case this is a redirect $f = sp_get_cache('post'); if (isset($f['guestname']) ? $guestnameval = $f['guestname'] : ($guestnameval = $spGuestCookie->guest_name)) { } if (isset($f['guestemail']) ? $guestemailval = $f['guestemail'] : ($guestemailval = $spGuestCookie->guest_email)) { } if (isset($f['newtopicname']) ? $topicnameval = $f['newtopicname'] : ($topicnameval = '')) { } if (isset($f['postitem']) ? $postitemval = $f['postitem'] : ($postitemval = '')) { } if (isset($f['message']) ? $failmessage = $f['message'] : ($failmessage = '')) { } $captchaValue = sp_get_option('captcha-value'); $out = ''; # Grab above editor message if there is one $postmsg = sp_get_option('sfpostmsg'); # Grab in-editor message if one $inEdMsg = sp_filter_text_display(sp_get_option('sfeditormsg')); if ($hide ? $hide = ' style="display:none;"' : ($hide = '')) { } $out .= '<div id="spPostForm"' . $hide . '>' . "\n"; $out .= "<form class='{$tagClass}' action='" . SFHOMEURL . "index.php?sp_ahah=post&sfnonce=" . wp_create_nonce('forum-ahah') . "' method='post' id='addtopic' name='addtopic' onsubmit='return spjValidatePostForm(this, {$spThisUser->guest}, 1, \"" . sp_paint_file_icon(SPTHEMEICONSURL, 'sp_Success.png') . "\");'>\n"; $out .= sp_create_nonce('forum-userform_addtopic'); $out .= '<div class="spEditor">' . "\n"; $out = apply_filters('sph_topic_editor_top', $out, $spThisForum); $out .= "<fieldset class='{$controlFieldset}'>\n"; $out .= "<legend>{$labelHeading}: " . $spThisForum->forum_name . "</legend>\n"; $out .= "<input type='hidden' name='action' value='topic' />\n"; $out .= "<input type='hidden' name='forumid' value='{$spThisForum->forum_id}' />\n"; $out .= "<input type='hidden' name='forumslug' value='{$spThisForum->forum_slug}' />\n"; $out .= "<input type='hidden' name='captcha' value='{$captchaValue}' />\n"; # input field that plugins can use $out .= "<input type='hidden' id='spEditorCustomValue' name='spEditorCustomValue' value='' />\n"; # plugins can add before the header $out = apply_filters('sph_topic_before_editor_header', $out, $spThisForum, $a); $tout = ''; $tout .= '<div class="spEditorSection">'; # let plugins add stuff at top of editor header $tout = apply_filters('sph_topic_editor_header_top', $tout, $spThisForum, $a); if (!empty($postmsg['sfpostmsgtopic'])) { $tout .= '<div class="spEditorMessage">' . sp_filter_text_display($postmsg['sfpostmsgtext']) . '</div>' . "\n"; } # create an empty div to allow plugins to add something $tout .= '<div id="spEditorCustomDiv"></div>'; if ($spThisUser->guest) { $tout .= '<div class="spEditorSectionLeft">' . "\n"; $tout .= "<div class='spEditorTitle'>{$labelGuestName}:\n"; $tout .= "<input type='text' tabindex='100' class='{$controlInput}' name='guestname' value='{$guestnameval}' /></div>\n"; $tout .= '</div>' . "\n"; $sfguests = sp_get_option('sfguests'); if ($sfguests['reqemail']) { $tout .= '<div class="spEditorSectionRight">' . "\n"; $tout .= "<div class='spEditorTitle'>{$labelGuestEmail}:\n"; $tout .= "<input type='text' tabindex='101' class='{$controlInput}' name='guestemail' value='{$guestemailval}' /></div>\n"; $tout .= '</div>' . "\n"; } $tout .= '<div class="spClear"></div>' . "\n"; } if (!sp_get_auth('bypass_moderation', $spThisForum->forum_id)) { $tout .= "<p class='spLabelSmall'>{$labelModerateAll}</p>\n"; } elseif (!sp_get_auth('bypass_moderation_once', $spThisForum->forum_id)) { $tout .= "<p class='spLabelSmall'>{$labelModerateOnce}</p>\n"; } $tout2 = ''; $tout2 .= "<div class='spEditorTitle'>{$labelTopicName}: \n"; $tout2 .= "<input id='spTopicTitle' type='text' tabindex='102' class='{$controlInput}' maxlength='{$maxTitleLength}' name='newtopicname' value='{$topicnameval}'/>\n"; $tout2 = apply_filters('sph_topic_editor_name', $tout2, $a); $tout2 .= '</div>' . "\n"; $tout .= apply_filters('sph_topic_editor_title', $tout2, $spThisForum, $a); # let plugins add stuff at bottom of editor header $tout = apply_filters('sph_topic_editor_header_bottom', $tout, $spThisForum, $a); $tout .= '</div>' . "\n"; # allow plugins to filter just the header $out .= apply_filters('sph_topic_editor_header', $tout, $spThisForum, $a); # do we have content? Or just add any inline message if (empty($postitemval)) { $postitemval = $inEdMsg; } # Display the selected editor $tout = ''; $tout .= '<div id="spEditorContent">' . "\n"; $tout .= sp_setup_editor(103, $postitemval); $tout .= '</div>' . "\n"; # allow plugins to filter the editor content $out .= apply_filters('sph_topic_editor_content', $tout, $spThisForum, $a); # define area above toolbar for plugins to add components $section = apply_filters('sph_topic_editor_above_toolbar', '', $spThisForum, $a); if (!empty($section)) { $tout = ''; $tout .= '<div class="spEditorSection">'; $tout .= $section; $tout .= '</div>' . "\n"; $out .= apply_filters('sph_topic_editor_above_toolbar_end', $tout, $spThisForum, $a); } # DEFINE NEW FAILURE AREA HERE # define validation failure notice area $out .= "<div class='spClear'></div>\n"; $out .= "<div id='spPostNotifications'>{$failmessage}</div>\n"; # TOOLBAR # define toolbar - submit buttons on right, plugin extensions on left $toolbarRight = apply_filters('sph_topic_editor_toolbar_submit', '', $spThisForum, $a, 'toolbar'); $toolbarLeft = apply_filters('sph_topic_editor_toolbar_buttons', '', $spThisForum, $a, 'toolbar'); if (!empty($toolbarRight) || !empty($toolbarLeft)) { # Submit section $tout = ''; $tout .= '<div class="spEditorSection spEditorToolbar">'; $tout .= $toolbarRight; # toolbar for plugins to add buttons $tout .= $toolbarLeft; $out .= apply_filters('sph_topic_editor_toolbar', $tout, $spThisForum, $a, 'toolbar'); $out .= '<div style="clear:both"></div>'; $out .= '</div>' . "\n"; } # START SMILEYS/OPTIONS # let plugins add stuff at top of editor footer $tout = ''; $tout = apply_filters('sph_topic_editor_footer_top', $tout, $spThisForum, $a); # smileys and options $tout = apply_filters('sp_topic_editor_inline_footer', $tout, $spThisForum, $a, 'inline'); # let plugins add stuff at end of editor footer $tout = apply_filters('sph_topic_editor_footer_bottom', $tout, $spThisForum, $a); # plugins can remove or adjust whole footer $out .= apply_filters('sph_topic_editor_footer', $tout, $spThisForum, $a); # allow plugins to insert stuff after editor footer $out = apply_filters('sph_topic_editor_after_footer', $out, $spThisForum, $a); # START SUBMIT SECTION # define submit section of no toolbar in use if (!$toolbar) { $out .= '<div class="spEditorSubmit">' . "\n"; $out = apply_filters('sph_topic_editor_submit_top', $out, $spThisForum, $a); # let plugins add/remove the controls area $tout = apply_filters('sp_topic_editor_inline_submit', '', $spThisForum, $a, 'inline'); # let plugins add stuff at end of editor submit bottom $out .= apply_filters('sph_topic_editor_submit_bottom', $tout, $spThisForum, $a); $out .= '</div>' . "\n"; } # close it up $out .= '</fieldset>' . "\n"; $out = apply_filters('sph_topic_editor_bottom', $out, $spThisForum, $a); $out .= '</div>' . "\n"; $out .= '</form>' . "\n"; $out .= '</div>' . "\n"; # let plugins add stuff beneath the editor $out = apply_filters('sph_topic_editor_beneath', $out, $spThisForum, $a); return $out; }