function sp_ProfilePermissionsForum($thisForum, $userid) { global $thisAlt; # Start the 'forum' section $out = "<div class='spGroupForumSection {$thisAlt}'>"; # Column 1 of the forum row $out .= '<div class="spColumnSection spProfilePermissionIcon">'; $icon = !empty($thisForum->forum_icon) ? SFCUSTOMURL . $thisForum->forum_icon : sp_find_icon(SPTHEMEICONSURL, 'sp_ForumIcon.png'); $out .= "<img class='spRowIcon' src='{$icon}' alt='' />"; $out .= '</div>'; # Column 2 of the forum row $out .= '<div class="spColumnSection spProfilePermissionForum">'; $out .= "<div class='spRowName'>" . $thisForum->forum_name . "</div>"; $desc = !empty($thisForum->forum_desc) ? $thisForum->forum_desc : ''; $out .= "<div class='spRowName'>" . $desc . "</div>"; $out .= '</div>'; # Column 3 of the forum row $site = SFHOMEURL . "index.php?sp_ahah=permissions&sfnonce=" . wp_create_nonce('forum-ahah') . "&forum=" . $thisForum->forum_id . '&userid=' . $userid; $img = SFCOMMONIMAGES . '/working.gif'; $out .= '<div class="spColumnSection spProfilePermissionButton">'; $out .= '<a rel="nofollow" href="javascript:void(null)" onclick="spjLoadTool(\'' . $site . '\', \'perm' . $thisForum->forum_id . '\', \'' . $img . '\');">'; $out .= '<input type="submit" class="spSubmit" value="' . sp_text('View') . '" />'; $out .= '</a>'; $out .= '</div>'; $out .= sp_InsertBreak('echo=0'); $out .= '</div>'; # hidden area for the permissions for this forum $out .= '<div id="perm' . $thisForum->forum_id . '" class="spHiddenSection spProfilePermission"></div>'; $thisAlt = $thisAlt == 'spOdd' ? 'spEven' : 'spOdd'; return $out; }
function sp_featured_do_post_tool($out, $forum, $topic, $post, $page, $postnum) { global $spThisUser, $spGlobals; if ($spThisUser->admin || $spThisUser->moderator) { $out .= '<div class="spTopicToolsFeatured">'; $out .= '<img class="spIcon" src="' . sp_find_icon(SPFEATUREDIMAGES, 'sp_ToolsFeaturedAdd.png') . '" alt="" title="" />'; $featured = in_array($post['post_id'], $spGlobals['featured']['posts']); $featuretext = $featured ? __('Unfeature this post', 'sp-featured') : __('Feature this post', 'sp-featured'); $featureaction = $featured ? 'remove' : 'add'; $out .= '<a href="javascript:document.featurepost' . $post['post_id'] . '.submit();">' . $featuretext . '</a>'; $out .= '<form action="' . sp_build_url($forum['forum_slug'], $topic['topic_slug'], $page, 0) . '" method="post" name="featurepost' . $post['post_id'] . '">'; $out .= '<input type="hidden" name="featurepost" value="' . $post['post_id'] . '" />'; $out .= "<input type='hidden' name='featurepostaction' value='{$featureaction}' />"; $out .= '</form>'; $out .= '</div>'; } return $out; }
function sp_MemberListPageLinks($args = '', $label = '', $toolTip = '') { if (!sp_get_auth('view_members_list')) { return; } global $spMembersList; $defs = array('tagId' => 'spMemberPageLinks', 'tagClass' => 'spPageLinks', 'prevIcon' => 'sp_ArrowLeft.png', 'nextIcon' => 'sp_ArrowRight.png', 'iconClass' => 'spIcon', 'pageLinkClass' => 'spPageLinks', 'curPageClass' => 'spCurrent', 'showLinks' => 4, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_MemberListPageLinks_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); if (!empty($prevIcon)) { $prevIcon = sp_find_icon(SPTHEMEICONSURL, sanitize_file_name($prevIcon)); } if (!empty($nextIcon)) { $nextIcon = sp_find_icon(SPTHEMEICONSURL, sanitize_file_name($nextIcon)); } $iconClass = esc_attr($iconClass); $pageLinkClass = esc_attr($pageLinkClass); $curPageClass = esc_attr($curPageClass); $showLinks = (int) $showLinks; $label = sp_filter_title_display($label); $toolTip = esc_attr($toolTip); $echo = (int) $echo; global $spVars; $curToolTip = str_ireplace('%PAGE%', $spVars['page'], $toolTip); if (isset($_POST['allmembers'])) { $search = ''; $ug = ''; } else { if (isset($_GET['page'])) { $spVars['page'] = sp_esc_int($_GET['page']); } $search = !empty($_POST['msearch']) ? sp_esc_str($_POST['msearch']) : ''; $search = !empty($_GET['msearch']) ? sp_esc_str($_GET['msearch']) : $search; $ug = !empty($_POST['ug']) ? sp_esc_int($_POST['ug']) : ''; $ug = !empty($_GET['ug']) ? sp_esc_int($_GET['ug']) : $ug; } $out = "<div id='{$tagId}' class='{$tagClass}'>"; $totalPages = $spMembersList->totalMemberCount / $spMembersList->membersNumber; if (!is_int($totalPages)) { $totalPages = intval($totalPages) + 1; } $out .= "<span class='{$pageLinkClass}'>{$label}</span>"; $out .= sp_page_prev($spVars['page'], $showLinks, SPMEMBERLIST, $pageLinkClass, $iconClass, $prevIcon, $nextIcon, $toolTip, $search, $ug); $url = SPMEMBERLIST; if ($spVars['page'] > 1) { $url = user_trailingslashit(trailingslashit($url) . 'page-' . $spVars['page']); } if (!empty($search)) { $param['msearch'] = $search; $url = add_query_arg($param, $url); $url = sp_filter_wp_ampersand($url); } if (!empty($ug)) { $param['ug'] = $ug; $url = add_query_arg($param, $url); $url = sp_filter_wp_ampersand($url); } $out .= "<a href='{$url}' class='{$pageLinkClass} {$curPageClass} vtip' title='{$curToolTip}'>" . $spVars['page'] . '</a>'; $out .= sp_page_next($spVars['page'], $totalPages, $showLinks, SPMEMBERLIST, $pageLinkClass, $iconClass, $prevIcon, $nextIcon, $toolTip, $search, $ug); $out .= "</div>\n"; $out = apply_filters('sph_MemberListPageLinks', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function sp_render_common_tools($forum, $topic, $post = 0, $page = 0) { global $spThisUser; $out = ''; if (sp_get_auth('lock_topics', $forum['forum_id'])) { $out .= '<div class="spForumToolsLock">'; $locktext = $topic['topic_status'] ? sp_text('Unlock this topic') : sp_text('Lock this topic'); $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsLock.png') . '" alt="" title="" />'; $ajaxUrl = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=lock-topic&topic=' . $topic['topic_id']; $out .= "<a href='javascript:void(null)' onclick='spjLockTopic(\"{$ajaxUrl}\");'>{$locktext}</a>"; $out .= '</div>'; } if (sp_get_auth('pin_topics', $forum['forum_id'])) { $out .= '<div class="spForumToolsPin">'; $pintext = $topic['topic_pinned'] ? sp_text('Unpin this topic') : sp_text('Pin this topic'); $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsPin.png') . '" alt="" title="" />'; $ajaxUrl = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=pin-topic&topic=' . $topic['topic_id']; $out .= "<a href='javascript:void(null)' onclick='spjPinTopic(\"{$ajaxUrl}\");'>{$pintext}</a>"; $out .= '</div>'; } if (sp_get_auth('pin_topics', $forum['forum_id']) && $topic['topic_pinned']) { $out .= '<div class="spForumToolsPin">'; $pintext = sp_text('Promote this pinned topic'); $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsPin.png') . '" alt="" title="" />'; $site = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=order-pins&topicid=' . $topic['topic_id'] . '&forumid=' . $forum['forum_id'] . '&userid=' . $topic['user_id']; $title = sp_text('Order Pinned Topics'); $out .= '<a rel="nofollow" href="javascript:void(null)" onclick="spjDialogAjax(this, \'' . $site . '\', \'' . esc_js($title) . '\', 400, 0, \'center\');">' . $title . '</a>'; $out .= '</div>'; } if (sp_get_auth('edit_own_topic_titles', $forum['forum_id']) && $topic['user_id'] == $spThisUser->ID || sp_get_auth('edit_any_topic_titles', $forum['forum_id'])) { $out .= '<div class="spForumToolsEdit">'; $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsEdit.png') . '" alt="" title="" />'; $site = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=edit-title&topicid=' . $topic['topic_id'] . '&forumid=' . $forum['forum_id'] . '&userid=' . $topic['user_id']; $title = sp_text('Edit topic title'); $out .= '<a rel="nofollow" href="javascript:void(null)" onclick="spjDialogAjax(this, \'' . $site . '\', \'' . esc_js($title) . '\', 400, 0, \'center\');">' . $title . '</a>'; $out .= '</div>'; } if (sp_get_auth('delete_topics', $forum['forum_id'])) { $out .= '<div class="spForumToolsDelete">'; $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsDelete.png') . '" alt="" title="" />'; $msg = esc_js(sp_text('Are you sure you want to delete this topic?')); $view = !empty($post) ? 'topic' : 'forum'; $ajaxUrl = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=delete-topic&killtopic=' . $topic['topic_id'] . '&killtopicforum=' . $forum['forum_id'] . '&page=' . $page . "&view={$view}"; $out .= "<a href='javascript:void(null)' onclick='spjDeleteTopic(\"{$ajaxUrl}\", {$topic['topic_id']}, {$forum['forum_id']});'>"; $out .= sp_text('Delete this topic'); $out .= '</a>'; } if (sp_get_auth('move_topics', $forum['forum_id'])) { $out .= '<div class="spForumToolsMove">'; $out .= '<img class="spIcon" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_ToolsMove.png') . '" alt="" title="" />'; $site = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=move-topic&topicid=' . $topic['topic_id'] . '&forumid=' . $forum['forum_id']; $title = sp_text('Move this topic'); $out .= '<a rel="nofollow" href="javascript:void(null)" onclick="spjDialogAjax(this, \'' . $site . '\', \'' . esc_js($title) . '\', 400, 0, \'center\');">' . $title . '</a>'; $out .= '</div>'; } $out = apply_filters('sph_add_common_tools', $out, $forum, $topic, $post, $page); return $out; }
global $spGlobals; $curcol = 1; $category = ''; foreach ($authlist as $a) { $auth_id = $a->auth_id; $auth_name = $a->auth_name; if ($category != $a->authcat_name) { $category = $a->authcat_name; $curcol = 1; echo '<div class="spAuthCat">' . spa_text($category) . '</div>'; } echo '<div class="spColumnSection">'; if (sp_get_auth($auth_name, $forumid, $userid)) { echo '<img src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_PermissionYes.png') . '" /> ' . spa_text($spGlobals['auths'][$auth_id]->auth_desc); } else { echo '<img src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_PermissionNo.png') . '" /> ' . spa_text($spGlobals['auths'][$auth_id]->auth_desc); } echo '</div>'; $curcol++; if ($curcol > 2) { $curcol = 1; } } echo '<p><a href="javascript:void(null)" onclick="spjClearIt(\'perm' . $forumid . '\'); spjSetProfileDataHeight();">'; echo '<input type="button" id="spClosePerms" class="spSubmit" value="' . sp_text('Close') . '" />'; echo '</a></p>'; ?> <script type="text/javascript"> jQuery(document).ready(function() { baseHeight = Math.max(jQuery("#spProfileData").outerHeight(true) + 10, jQuery("#spProfileMenu").outerHeight(true)); jQuery("#spProfileContent").height(baseHeight + jQuery("#spProfileHeader").outerHeight(true));
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 = sp_find_icon(SPTHEMEICONSURL, 'sp_ForumIcon.png'); } else { $icon = esc_url(SFCUSTOMURL . $forum->forum_icon); if (!file_exists(SFCUSTOMDIR . $forum->forum_icon)) { $icon = sp_find_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%"><img src="<?php echo $icon; ?> " alt="" title="" /> <?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'); ?> " /> <span class='row-title'><strong><?php echo sp_filter_title_display($forum->forum_name); ?> </strong></span><span><br />(<?php echo spa_text('Subforum of') . ': ' . $parentname . ')'; ?> <span><br /><?php echo sp_filter_text_display($forum->forum_desc); ?> </span> <?php } else { ?> <?php if ($forum->forum_disabled) { echo '<img class="sfalignright" src="' . SFADMINIMAGES . 'sp_NoWrite.png" alt="" title="' . spa_text('Forum is disabled') . '" /> '; } ?> <span class='row-title'><strong><?php echo sp_filter_title_display($forum->forum_name); ?> </strong></span><span><br /><?php echo sp_filter_text_display($forum->forum_desc); ?> </span> <?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>'; } ?> </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_AddButton($args = '', $label = '', $toolTip = '', $perm = '', $buttonID = '') { global $spThisUser; $defs = array('tagId' => $buttonID, 'tagClass' => 'spButton', 'link' => sp_url(), 'icon' => '', 'iconClass' => 'spIcon', 'mobileMenu' => 0, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_AddButton_args', $a); extract($a, EXTR_SKIP); # verify optional 'simple' permission check if (!empty($perm) && !sp_get_auth($perm)) { return; } # allow for complex permission checking $auth = apply_filters('sph_add_button_auth_check', true, $buttonID, $a); if (!$auth) { return; } # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $link = esc_url($link); $icon = sanitize_file_name($icon); $iconClass = esc_attr($iconClass); $mobileMenu = (int) $mobileMenu; $echo = (int) $echo; $toolTip = esc_attr($toolTip); if (!$mobileMenu) { $out = "<a class='{$tagClass} vtip' id='{$tagId}' title='{$toolTip}' href='{$link}'>"; if (!empty($icon)) { $out .= "<img class='{$iconClass}' src='" . sp_find_icon(SPTHEMEICONSURL, $icon) . "' alt=''/>"; } if (!empty($label)) { $out .= sp_filter_title_display($label); } $out .= "</a>\n"; } else { $out = "<li class='{$tagClass}' id='{$tagId}'><a href='{$link}'>" . sp_filter_title_display($label) . "</a></li>\n"; } $out = apply_filters('sph_AddButton', $out, $a); if ($echo) { echo $out; } else { return $out; } }
<?php /* Simple:Press Forum RSS Feeds $LastChangedDate: 2014-07-12 08:17:18 -0700 (Sat, 12 Jul 2014) $ $Rev: 11731 $ */ if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('Access denied - you cannot directly call this file'); } global $spVars, $spThisUser, $spPostList, $spThisPostList; # check installed version is correct if (sp_get_system_status() != 'ok') { $out .= '<img style="style="vertical-align:bottom;border:none;"" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_Information.png') . '" alt="" />' . "\n"; $out .= ' ' . sp_text('The forum is temporarily unavailable while being upgraded to a new version'); echo $out; } # are we doing feed keys? If so reset user to that f the passed feedkey - else leave as guest $rssopt = sp_get_option('sfrss'); if (isset($rssopt['sfrssfeedkey']) && $rssopt['sfrssfeedkey']) { # get the user requesting feed $feedkey = $spVars['feedkey']; $userid = spdb_table(SFMEMBERS, "feedkey='{$feedkey}'", 'user_id'); $spThisUser = sp_get_user($userid, true); } # = Support Functions =========================== function sp_rss_filter($text) { echo convert_chars(ent2ncr($text)); }
function sp_ForumIndexSubForums($args = '', $label = '', $toolTip = '') { global $spThisForum, $spThisForumSubs; if (empty($spThisForumSubs)) { return; } $defs = array('tagId' => 'spForumIndexSubForums%ID%', 'tagClass' => 'spInRowSubForums', 'labelClass' => 'spInRowLabel', 'linkClass' => 'spInRowSubForumlink', 'icon' => 'sp_SubForumIcon.png', 'unreadIcon' => 'sp_SubForumIcon.png', 'iconClass' => 'spIconSmall', 'iconWidth' => 20, 'topicCount' => 1, 'allNested' => 1, 'stack' => 0, 'truncate' => 0, 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ForumIndexSubForums_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $labelClass = esc_attr($labelClass); $linkClass = esc_attr($linkClass); $icon = sanitize_file_name($icon); $unreadIcon = sanitize_file_name($unreadIcon); $iconClass = esc_attr($iconClass); $iconWidth = (int) $iconWidth; $topicCount = (int) $topicCount; $allNested = (int) $allNested; $stack = (int) $stack; $truncate = (int) $truncate; $echo = (int) $echo; $get = (int) $get; $toolTip = esc_attr($toolTip); $thisTagId = str_ireplace('%ID%', $spThisForum->forum_id, $tagId); if ($get) { return $spThisForumSubs; } $out = "<div id='{$thisTagId}' class='{$tagClass}'>\n"; if ($stack) { $out .= "<ul class='{$labelClass}'><li>" . sp_filter_title_display($label) . "<ul>"; } else { $out .= "<span class='{$labelClass}'>" . sp_filter_title_display($label) . "</span>\n"; } foreach ($spThisForumSubs as $sub) { # Check if a custom icon $path = SPTHEMEICONSDIR; $url = SPTHEMEICONSURL; if ($sub->unread) { $fIcon = sanitize_file_name($unreadIcon); if (!empty($sub->forum_icon_new)) { $fIcon = sanitize_file_name($sub->forum_icon_new); $path = SFCUSTOMDIR; $url = SFCUSTOMURL; } } else { $fIcon = sanitize_file_name($icon); if (!empty($sub->forum_icon)) { $fIcon = sanitize_file_name($sub->forum_icon); $path = SFCUSTOMDIR; $url = SFCUSTOMURL; } } if (!file_exists($path . $fIcon)) { $fIcon = sp_find_icon(SPTHEMEICONSURL, sanitize_file_name($icon)); } else { $fIcon = sp_find_icon($url, $fIcon); } if ($sub->parent == $spThisForum->forum_id || $allNested == true) { $thisToolTip = str_ireplace('%NAME%', htmlspecialchars($sub->forum_name, ENT_QUOTES, SFCHARSET), $toolTip); if ($stack) { $out .= "<li>"; } $out .= "<img src='" . $fIcon . "' class='{$iconClass}' width='" . $iconWidth . "' alt=''/>\n"; $thisTagId = str_ireplace('%ID%', $sub->forum_id, $tagId); $out .= "<a href='{$sub->forum_permalink}' id='{$thisTagId}' class='{$linkClass} vtip' title='{$thisToolTip}'>" . sp_truncate($sub->forum_name, $truncate) . "</a>\n"; if ($topicCount) { $out .= " ({$sub->topic_count})\n"; } if ($stack) { $out .= "</li>"; } } } if ($stack) { $out .= "</ul></li></ul>"; } $out .= "</div>\n"; $out = apply_filters('sph_ForumIndexSubForums', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function sp_do_sp_AdminModeratorOnlineTag($args = '') { #check if forum displayed if (sp_abort_display_forum()) { return; } $defs = array('tagId' => 'spAdminModeratorOnlineTag', 'tagClass' => 'spListTag', 'moderator' => 1, 'custom' => 1, 'customClass' => 'spAdminMessageTag', 'listTags' => 1, 'listClass' => 'spListItemTag', 'onToolTip' => __('Online', 'sp-ttags'), 'onIcon' => 'sp_UserOnlineSmall.png', 'offIcon' => 'sp_UserOfflineSmall.png', 'offToolTip' => __('Offline', 'sp-ttags'), 'useAvatar' => 0, 'avatarSize' => 25, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_AdminModeratorOnlineTag_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $moderator = (int) $moderator; $custom = (int) $custom; $customClass = esc_attr($customClass); $listTags = (int) $listTags; $listClass = esc_attr($listClass); $onToolTip = sp_filter_title_display($onToolTip); $offToolTip = sp_filter_title_display($offToolTip); $onIcon = sp_filter_filename_save($onIcon); $offIcon = sp_filter_filename_save($offIcon); $useAvatar = (int) $useAvatar; $avatarSize = (int) $avatarSize; $echo = (int) $echo; sp_forum_api_support(); $where = 'admin=1'; if ($moderator) { $where .= ' OR moderator = 1'; } $spdb = new spdbComplex(); $spdb->table = SFMEMBERS; $spdb->fields = 'user_id AS ID, user_email, ' . SFMEMBERS . '.display_name, admin, user_options, admin_options, ' . SFTRACK . '.id AS online'; $spdb->left_join = array(SFTRACK . ' ON ' . SFMEMBERS . '.user_id = ' . SFTRACK . '.trackuserid', SFUSERS . ' ON ' . SFMEMBERS . '.user_id = ' . SFUSERS . '.ID'); $spdb->where = $where; $spdb->orderby = 'online DESC'; $admins = $spdb->select(); $out = ''; if ($admins) { $out .= $listTags ? "<ul id='{$tagId}' class='{$tagClass}'>" : "<div id='{$tagId}' class='{$tagClass}'>"; foreach ($admins as $admin) { $noAvatar = ''; $msg = ''; $userOpts = unserialize($admin->user_options); if (!$userOpts['hidestatus']) { $userName = sp_build_name_display($admin->ID, sp_filter_name_display($admin->display_name)); $icon = $admin->online ? $onIcon : $offIcon; $tip = $admin->online ? $onToolTip : $offToolTip; if (!$useAvatar) { $noAvatar .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, "{$icon}") . "' alt='' title='{$tip}' />"; } if (!$admin->online && $custom) { $userOpts = unserialize($admin->admin_options); if (isset($userOpts['offline_message'])) { $msg = sp_filter_text_display($userOpts['offline_message']); if ($msg != '') { $msg = "<div class='{$customClass}'>{$msg}</div>"; } } } # begin loop display if ($listTags ? $out .= "<li class='{$listClass}'>" : ($out .= "<div class='{$listClass}'>")) { } # Avatar or Icon if ($useAvatar) { $admin->avatar = ''; $out .= sp_UserAvatar("tagClass=spAvatar&imgClass=spAvatar&size={$avatarSize}&context=user&echo=0", $admin); } else { $out .= $noAvatar; } # User name and current online status $out .= "<span class='spOnlineAdmin'><span class='spOnlineUser'>{$userName}</span> is <span class='admin{$tip}'>{$tip}</span>"; # display offline message is set $out .= $msg; $out .= '</span>'; # end loop display if ($listTags ? $out .= '<div style="clear:both;"></div></li>' : ($out .= '</div><div style="clear:both;"></div>')) { } } } $out .= $listTags ? '</ul>' : '</div>'; } $out = apply_filters('sph_AdminModeratorOnlineTag', $out); if ($echo) { echo $out; } else { return $out; } }
function sp_format_display_image($match) { global $spPaths, $spVars; preg_match('/width\\s*=\\s*"([^"]*)"|width\\s*=\\s*\'([^\']*)\'/i', $match[0], $width); $out = ''; $local = false; $sfimage = array(); $sfimage = sp_get_option('sfimage'); # is any of this needed? if ($sfimage['enlarge'] == false && $sfimage['process'] == false) { return $match[0]; } $thumb = $sfimage['thumbsize']; if (empty($thumb) || $thumb < 100) { $thumb = 100; } preg_match('/title\\s*=\\s*"([^"]*)"|title\\s*=\\s*\'([^\']*)\'/i', $match[0], $title); preg_match('/alt\\s*=\\s*"([^"]*)"|alt\\s*=\\s*\'([^\']*)\'/i', $match[0], $alt); preg_match('/width\\s*=\\s*"([^"]*)"|width\\s*=\\s*\'([^\']*)\'/i', $match[0], $width); preg_match('/height\\s*=\\s*"([^"]*)"|height\\s*=\\s*\'([^\']*)\'/i', $match[0], $height); preg_match('/src\\s*=\\s*"([^"]*)"|src\\s*=\\s*\'([^\']*)\'/i', $match[0], $src); preg_match('/style\\s*=\\s*"([^"]*)"|style\\s*=\\s*\'([^\']*)\'/i', $match[0], $style); preg_match('/class\\s*=\\s*"([^"]*)"|class\\s*=\\s*\'([^\']*)\'/i', $match[0], $class); if (isset($class[1]) && strpos($class[1], 'wp-image') === 0) { return $match[0]; } # is this a smiley? if (strpos($src[1], 'plugins/emotions') || strpos($src[1], 'images/smilies') || strpos($src[1], $spPaths['smileys'])) { return str_replace('img src', 'img class="spSmiley" src', $match[0]); } if (empty($style[1])) { if ($sfimage['style'] == 'left' || $sfimage['style'] == 'right') { $style[1] = 'float: ' . $sfimage['style']; } else { $style[1] = 'vertical-align: ' . $sfimage['style']; } } # Might be inherited image with wp standard alignleft and alignright in use if (isset($class[1])) { if (strpos($class[1], 'alignleft') !== false) { $style[1] = 'float: left'; } else { if (strpos($class[1], 'alignright') !== false) { $style[1] = 'float: right'; } else { if (strpos($class[1], 'aligncenter') !== false) { $style[1] = 'margin: 0 auto'; } } } } $iclass = ''; $mclass = 'sfmouseother'; $mstyle = ''; switch ($style[1]) { case 'float: left': $iclass = 'sfimageleft'; $mclass = 'sfmouseleft'; break; case 'float: right': $iclass = 'sfimageright'; $mclass = 'sfmouseright'; break; case 'margin: 0 auto': $iclass = 'sfimagecenter'; # mouse icon not possible with center unless we can work it out $mclass = 'na'; if ($spVars['postwidth'] > 0) { $p = abs($spVars['postwidth'] / 2) + abs($thumb / 2) - 40; $mstyle = " style='margin-left:" . $p . "px; margin-top:-40px;'"; } break; case 'vertical-align: baseline': $iclass = 'sfimagebaseline'; break; case 'vertical-align: top': $iclass = 'sfimagetop'; break; case 'vertical-align: middle': $iclass = 'sfimagemiddle'; break; case 'vertical-align: bottom': $iclass = 'sfimagebottom'; break; case 'vertical-align: text-top': $iclass = 'sfimagetexttop'; break; case 'vertical-align: text-bottom': $iclass = 'sfimagetextbottom'; break; } # figure out whether its relative path (same server) or a url $parsed = parse_url($src[1]); if (is_array($parsed) && array_key_exists('scheme', $parsed)) { $srcfile = $src[1]; # url, so leave it alone } else { $srcfile = $_SERVER['DOCUMENT_ROOT'] . $src[1]; # relative path, so add DOCUMENT_ROOT to path $local = true; } if (empty($width[1])) { $size = sp_get_image_size($srcfile, true); if ($size) { if ($size[0]) { $width[1] = $size[0]; $height[1] = $size[1]; } else { $width[1] = 0; $height[1] = 0; } } elseif (ini_get('allow_url_fopen') == true && $size == false) { return '[' . sp_text('Image Can Not Be Found') . ']'; } } if (isset($src[1])) { $thissrc = 'src="' . $src[1] . '" '; } else { $thissrc = ''; } if (isset($title[1])) { $thistitle = 'title="' . $title[1] . '" '; } else { $thistitle = ''; } if (isset($alt[1])) { $thisalt = 'alt="' . $alt[1] . '" '; } else { $thisalt = ''; } if ((int) $width[1] > (int) $thumb) { # is width > thumb size $thiswidth = 'width="' . $thumb . '" '; $anchor = true; } else { if (!empty($width[1]) && $width > 0) { # width is smaller than thumb, so use the width { $thiswidth = 'width="' . $width[1] . '" '; $mclass = ''; $anchor = false; } else { # couldn't determine width, so don't output it $thiswidth = ''; $mclass = ''; $anchor = false; } } if (!empty($iclass)) { $thisformat = ' class="' . $iclass . '" '; } else { $thisformat = ' style="' . $style[1] . '" '; } if ($anchor) { $w = !empty($width) && $width[1] ? $width[1] : 'auto'; $h = !empty($height) && $height[1] ? $height[1] : 'auto'; # Use popup or not? if ($sfimage['enlarge'] == true) { $out = '<a href="javascript:void(null)" class="vtip" title="' . sp_text('Click image to enlarge') . '" onclick="spjPopupImage(\'' . $src[1] . '\', \'' . $w . '\', \'' . $h . '\', \'' . $sfimage['constrain'] . '\');" >'; $out = apply_filters('sph_display_image_popup', $out, $src[1]); } else { $out = '<a href="' . $src[1] . '" ' . $thistitle . '>'; } } # Is the path to the image in the standard uploads folder? # If so can we make use fo the file manager thumbs? if ($local) { $pos = strrpos($src[1], '/'); if ($pos !== false) { $left = substr($src[1], 0, $pos + 1); $right = substr($src[1], $pos + 1); $testsrc = untrailingslashit($_SERVER['DOCUMENT_ROOT']) . $left . '_thumbs/_' . $right; if (file_exists($testsrc)) { $thissrc = 'src="' . $left . '_thumbs/_' . $right . '"'; $thiswidth = ''; } } } $out .= '<img ' . $thissrc . $thiswidth . $thisformat . $thistitle . $thisalt . '/>'; if ($mclass) { $mouse = '<img src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_Mouse.png') . '" class="' . $iclass . ' ' . $mclass . '" alt="" ' . $mstyle . '/>'; $out .= apply_filters('sph_display_image_mouse', $mouse); } if ($anchor) { $out .= '</a>'; } if ($sfimage['forceclear']) { $out .= '<div style="clear:both"></div>'; } return $out; }
function sp_SearchPageLinks($args = '', $label = '', $toolTip = '') { global $spSearchView, $spVars; $items_per_page = $spSearchView->searchShow; if (!$items_per_page) { $items_per_page = 30; } if ($items_per_page >= $spSearchView->searchCount) { return ''; } $defs = array('tagClass' => 'spPageLinks', 'prevIcon' => 'sp_ArrowLeft.png', 'nextIcon' => 'sp_ArrowRight.png', 'iconClass' => 'spIcon', 'pageLinkClass' => 'spPageLinks', 'curPageClass' => 'spCurrent', 'showLinks' => 4, 'echo' => 1); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_SearchPageLinks_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagClass = esc_attr($tagClass); if (!empty($prevIcon)) { $prevIcon = sp_find_icon(SPTHEMEICONSURL, sanitize_file_name($prevIcon)); } if (!empty($nextIcon)) { $nextIcon = sp_find_icon(SPTHEMEICONSURL, sanitize_file_name($nextIcon)); } $iconClass = esc_attr($iconClass); $pageLinkClass = esc_attr($pageLinkClass); $curPageClass = esc_attr($curPageClass); $showLinks = (int) $showLinks; $label = sp_filter_title_display($label); $toolTip = esc_attr($toolTip); $echo = (int) $echo; $curToolTip = str_ireplace('%PAGE%', $spVars['searchpage'], $toolTip); $out = "<div class='{$tagClass}'>"; $totalPages = $spSearchView->searchCount / $items_per_page; if (!is_int($totalPages)) { $totalPages = intval($totalPages) + 1; } $out .= "<span class='{$pageLinkClass}'>{$label}</span>"; $out .= sp_page_prev($spVars['searchpage'], $showLinks, $spSearchView->searchPermalink, $pageLinkClass, $iconClass, $prevIcon, $nextIcon, $toolTip, $spVars['searchpage']); $url = $spSearchView->searchPermalink; if ($spVars['searchpage'] > 1) { $url = user_trailingslashit(trailingslashit($spSearchView->searchPermalink) . '&search=' . $spVars['searchpage']); } $out .= "<a href='{$url}' class='{$pageLinkClass} {$curPageClass} vtip' title='{$curToolTip}'>" . $spVars['searchpage'] . '</a>'; $out .= sp_page_next($spVars['searchpage'], $totalPages, $showLinks, $spSearchView->searchPermalink, $pageLinkClass, $iconClass, $prevIcon, $nextIcon, $toolTip, $spVars['searchpage']); $out .= "</div>\n"; $out = apply_filters('sph_SearchPageLinks', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function spa_dashboard_forum() { global $spGlobals, $spThisUser, $spStatus; $out = ''; # check we have an installed version if ($spStatus != 'ok') { $out .= '<div style="border: 1px solid #eeeeee; padding: 10px; font-weight: bold;">' . "\n"; $out .= '<p><img style="vertical-align:bottom;border:none;" src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_Information.png') . '" alt="" />' . "\n"; $out .= ' ' . sprintf(spa_text('The forum is temporarily unavailable while awaiting %s'), $spStatus) . '</p>'; if ($spThisUser->admin) { $out .= ' <a style="text-decoration: underline;" href="' . SFADMINUPGRADE . '">' . spa_text('Perform Upgrade') . '</a>'; } $out .= '</div>'; echo $out; return; } $out .= '<div id="sf-dashboard">'; echo $out; do_action('sph_dashboard_start'); if ($spGlobals['admin']['sfdashboardstats']) { include_once SF_PLUGIN_DIR . '/forum/content/sp-common-view-functions.php'; include_once SF_PLUGIN_DIR . '/forum/content/sp-template-control.php'; echo '<br /><table class="sfdashtable">'; echo '<tr>'; echo '<td>'; sp_OnlineStats('link_names=0', '<b>' . spa_text('Most Users Ever Online') . ': </b>', '<b>' . spa_text('Currently Online') . ': </b>', '<b>' . spa_text('Currently Browsing this Page') . ': </b>', spa_text('Guest(s)')); echo '</td>'; echo '<td>'; sp_ForumStats('', '<b>' . spa_text('Forum Stats') . ': </b>', spa_text('Groups') . ': ', spa_text('Forums') . ': ', spa_text('Topics') . ': ', spa_text('Posts') . ': '); echo '</td>'; echo '<td>'; sp_MembershipStats('', '<b>' . spa_text('Member Stats') . ': </b>', spa_text('There are %COUNT% Members'), spa_text('There have been %COUNT% Guest Posters'), spa_text('There are %COUNT% Moderators'), spa_text('There are %COUNT% Admins')); echo '</td>'; echo '<td>'; sp_TopPostersStats('link_names=0', '<b>' . spa_text('Top Posters') . ': </b>'); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="4">'; sp_NewMembers('link_names=0', '<b>' . spa_text('Newest Members') . ': </b>'); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="4">'; sp_ModsList('link_names=0', '<b>' . spa_text('Moderators') . ': </b>'); echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="4">'; sp_AdminsList('link_names=0', '<b>' . spa_text('Administrators') . ': </b>'); echo '</td>'; echo '</tr></table><br />'; } do_action('sph_dashboard_end'); $out = ''; $out .= '<p><br /><a href="' . sp_url() . '">' . spa_text('Go To Forum') . '</a></p>'; $out .= '</div>'; echo $out; }
function sp_post_editor_default_buttons($out, $spThisTopic, $a, $toolbar) { global $spGlobals, $spVars, $spThisUser, $spDevice; extract($a, EXTR_SKIP); # sanitize $labelSmileys = sp_filter_title_display($labelSmileys); $labelOptions = sp_filter_title_display($labelOptions); $tipSmileysButton = esc_attr($tipSmileysButton); $tipOptionsButton = esc_attr($tipOptionsButton); # 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) || $spThisUser->admin || $spThisUser->moderator) { $display['options'] = true; } $display = apply_filters('sph_post_editor_display_options', $display); if ($display['smileys']) { if ($spDevice == 'mobile' && array_key_exists('iconMobileSmileys', $a) && !empty($a['iconMobileSmileys'])) { # display mobile icon $out .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, "{$iconMobileSmileys}") . "' class='spIcon' id='spSmileysButton' onclick='spjOpenEditorBox(\"spSmileysBox\");' />"; } else { # display default button $out .= "<input type='button' class='spSubmit spLeft vtip' title='{$tipSmileysButton}' id='spSmileysButton' value='{$labelSmileys}' onclick='spjOpenEditorBox(\"spSmileysBox\");' />"; } } if ($display['options']) { if ($spDevice == 'mobile' && array_key_exists('iconMobileOptions', $a) && !empty($a['iconMobileOptions'])) { # display mobile icon $out .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, "{$iconMobileOptions}") . "' class='spIcon' id='spOptionsButton' onclick='spjOpenEditorBox(\"spOptionsBox\");' />"; } else { # display default button $out .= "<input type='button' class='spSubmit spLeft vtip' title='{$tipOptionsButton}' id='spOptionsButton' value='{$labelOptions}' onclick='spjOpenEditorBox(\"spOptionsBox\");' />"; } } return $out; }
function sp_forum_unavailable() { global $current_user; $out = ''; $out .= '<div id="spMainContainer">'; $out .= '<div class="spMessage">'; $out .= '<p><img src="' . sp_find_icon(SPTHEMEICONSURL, 'sp_Information.png') . '" alt="" /></p>'; $out .= '<p>' . sp_text('Sorry, the forum is temporarily unavailable while it is being upgraded to a new version.') . '</p>'; if (sp_is_forum_admin($current_user->ID)) { $out .= '<a href="' . SFADMINUPGRADE . '">' . sp_text('Click here to perform the upgrade') . '</a>'; } $out .= '</div>'; $out .= '</div>'; $out = apply_filters('sph_forum_unavailable', $out); return $out; }
function sp_ListFirstPost($args = '', $label = '') { global $spThisListTopic; $defs = array('tagId' => 'spListFirstPost%ID%', 'tagClass' => 'spListPostLink', 'labelClass' => 'spListLabel', 'linkClass' => 'spLink', 'iconClass' => 'spIcon', 'icon' => 'sp_ArrowRight.png', 'tip' => 1, 'niceDate' => 1, 'date' => 0, 'time' => 0, 'user' => 1, 'truncateUser' => 0, 'break' => 0, 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_ListFirstPost_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $labelClass = esc_attr($labelClass); $linkClass = esc_attr($linkClass); $iconClass = esc_attr($iconClass); $tip = (int) $tip; $niceDate = (int) $niceDate; $date = (int) $date; $time = (int) $time; $user = (int) $user; $truncateUser = (int) $truncateUser; $break = (int) $break; $icon = sanitize_file_name($icon); $echo = (int) $echo; $get = (int) $get; $tagId = str_ireplace('%ID%', $spThisListTopic->topic_id, $tagId); if ($tip && !empty($spThisListTopic->first_post_tip)) { $title = "title='{$spThisListTopic->first_post_tip}'"; $linkClass .= ' vtip'; } else { $title = ''; } $sp = ' '; $out = "<div id='{$tagId}' class='{$tagClass}'>\n"; $out .= "<span class='{$labelClass}'>" . sp_filter_title_display($label) . " \n"; # Link to post $out .= "<a class='{$linkClass}' {$title} href='{$spThisListTopic->first_post_permalink}'>\n"; $out .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, $icon) . "' class='{$iconClass}' alt=''/>\n"; $out .= "</a></span>\n"; # user $poster = sp_build_name_display($spThisListTopic->first_user_id, sp_truncate($spThisListTopic->first_display_name, $truncateUser)); if (empty($poster)) { $poster = sp_truncate($spThisListTopic->first_guest_name, $truncateUser); } if ($user) { $out .= "<span class='{$labelClass}'>{$poster}</span>\n"; } if ($get) { $getData = new stdClass(); $getData->permalink = $spThisListTopic->first_post_permalink; $getData->topic_name = $spThisListTopic->topic_name; $getData->post_date = $spThisListTopic->first_post_date; $getData->tooltip = $spThisListTopic->first_post_tip; $getData->user = $poster; return $getData; } if ($break) { $sp = "<br />"; } # date/time if ($niceDate) { $out .= "<span class='{$labelClass}'>" . $sp . sp_nicedate($spThisListTopic->first_post_date) . "</span>\n"; } else { if ($date) { $out .= "<span class='{$labelClass}'>" . $sp . sp_date('d', $spThisListTopic->first_post_date); if ($time) { $out .= '-' . sp_date('t', $spThisListTopic->first_post_date); } $out .= "</span>\n"; } } $out .= "</div>\n"; $out = apply_filters('sph_ListFirstPost', $out, $a); if ($echo) { echo $out; } else { return $out; } }
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_render_add_post_form($args) { global $spVars, $spThisUser, $spThisTopic, $spGuestCookie, $spGlobals; 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', 'labelHeading' => sp_text('Add Reply'), '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'), '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 Reply'), '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 Post'), 'tipCancelButton' => sp_text('Cancel the New Post')); $a = wp_parse_args($args, $defs); extract($a, EXTR_SKIP); # sanitize $hide = (int) $hide; $tagClass = esc_attr($tagClass); $controlFieldset = esc_attr($controlFieldset); $controlInput = esc_attr($controlInput); $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); # Check for a failure package in case this is a redirect $f = sp_get_cache('post'); if (isset($f['guestname']) ? $guestnameval = esc_attr(stripslashes($f['guestname'])) : ($guestnameval = $spGuestCookie->guest_name)) { } if (isset($f['guestemail']) ? $guestemailval = esc_attr(stripslashes($f['guestemail'])) : ($guestemailval = $spGuestCookie->guest_email)) { } if (isset($f['postitem']) ? $postitemval = stripslashes($f['postitem']) : ($postitemval = '')) { } if (isset($f['message']) ? $failmessage = stripslashes($f['message']) : ($failmessage = '')) { } $out = ''; # Grab above editor message if there is one $postmsg = sp_get_option('sfpostmsg'); 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='addpost' name='addpost' onsubmit='return spjValidatePostForm(this, {$spThisUser->guest}, 0, \"" . sp_find_icon(SPTHEMEICONSURL, 'sp_Success.png') . "\");'>\n"; $out .= sp_create_nonce('forum-userform_addpost'); $out .= '<div class="spEditor">' . "\n"; $out = apply_filters('sph_post_editor_top', $out, $spThisTopic, $a); $out .= "<fieldset class='{$controlFieldset}'>\n"; $out .= "<legend>{$labelHeading}: " . $spThisTopic->topic_name . "</legend>\n"; $out .= "<input type='hidden' name='action' value='post' />\n"; $out .= "<input type='hidden' name='forumid' value='{$spThisTopic->forum_id}' />\n"; $out .= "<input type='hidden' name='forumslug' value='{$spThisTopic->forum_slug}' />\n"; $out .= "<input type='hidden' name='topicid' value='{$spThisTopic->topic_id}' />\n"; $out .= "<input type='hidden' name='topicslug' value='{$spThisTopic->topic_slug}' />\n"; # plugins can add before the header $out = apply_filters('sph_post_before_editor_header', $out, $spThisTopic, $a); $tout = ''; $close = false; if (!empty($postmsg['sfpostmsgpost']) || $spThisUser->guest || !sp_get_auth('bypass_moderation', $spThisTopic->forum_id) || !sp_get_auth('bypass_moderation_once', $spThisTopic->forum_id)) { $tout .= '<div class="spEditorSection">'; $close = true; } # let plugins add stuff at top of editor header $tout = apply_filters('sph_post_editor_header_top', $tout, $spThisTopic, $a); if (!empty($postmsg['sfpostmsgpost'])) { $tout .= '<div class="spEditorMessage">' . sp_filter_text_display($postmsg['sfpostmsgtext']) . '</div>' . "\n"; } if ($spThisUser->guest) { $tout .= '<div class="spEditorSectionLeft">' . "\n"; $tout .= "<div class='spEditorTitle'>{$labelGuestName}:\n"; $tout .= "<input type='text' tabindex='100' class='{$controlInput}' name='guestname' id='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' id='guestemail' value='{$guestemailval}' /></div>\n"; $tout .= '</div>' . "\n"; } $tout .= '<div class="spClear"></div>' . "\n"; } if (!sp_get_auth('bypass_moderation', $spThisTopic->forum_id)) { $tout .= "<p class='spLabelSmall'>{$labelModerateAll}</p>\n"; } elseif (!sp_get_auth('bypass_moderation_once', $spThisTopic->forum_id)) { $tout .= "<p class='spLabelSmall'>{$labelModerateOnce}</p>\n"; } # let plugins add stuff at bottom of editor header $tout = apply_filters('sph_post_editor_header_bottom', $tout, $spThisTopic, $a); if ($close) { $tout .= '</div>' . "\n"; } # allow plugins to filter just the header $out .= apply_filters('sph_post_editor_header', $tout, $spThisTopic, $a); # 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_post_editor_content', $tout, $spThisTopic, $a); # define area above toolbar for plugins to add components $section = apply_filters('sph_post_editor_above_toolbar', '', $spThisTopic, $a); if (!empty($section)) { $tout = ''; $tout .= '<div class="spEditorSection">'; $tout .= $section; $tout .= '</div>' . "\n"; $out .= apply_filters('sph_post_editor_above_toolbar_end', $tout, $spThisTopic, $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_post_editor_toolbar_submit', '', $spThisTopic, $a, 'toolbar'); $toolbarLeft = apply_filters('sph_post_editor_toolbar_buttons', '', $spThisTopic, $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_post_editor_toolbar', $tout, $spThisTopic, $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_post_editor_footer_top', $tout, $spThisTopic, $a); # smileys and options $tout = apply_filters('sp_post_editor_inline_footer', $tout, $spThisTopic, $a, 'inline'); # let plugins add stuff at end of editor footer $tout = apply_filters('sph_post_editor_footer_bottom', $tout, $spThisTopic, $a); # plugins can remove or adjust whole footer $out .= apply_filters('sph_post_editor_footer', $tout, $spThisTopic, $a); # allow plugins to insert stuff after editor footer $out = apply_filters('sph_post_editor_after_footer', $out, $spThisTopic, $a); # START SUBMIT SECTION # define submit section of no toolbar in use if (!$toolbar) { $out .= '<div class="spEditorSubmit">' . "\n"; $out = apply_filters('sph_post_editor_submit_top', $out, $spThisTopic, $a); # let plugins add/remove the controls area $tout = apply_filters('sp_post_editor_inline_submit', '', $spThisTopic, $a, 'inline'); # let plugins add stuff at end of editor submit bottom $out .= apply_filters('sph_post_editor_submit_bottom', $tout, $spThisTopic, $a); $out .= '</div>' . "\n"; } # close it up $out .= '</fieldset>' . "\n"; $out = apply_filters('sph_post_editor_bottom', $out, $spThisTopic, $a); $out .= '</div>' . "\n"; $out .= '</form>' . "\n"; $out .= '</div>' . "\n"; # let plugins add stuff beneath the editor $out = apply_filters('sph_post_editor_beneath', $out, $spThisTopic, $a); 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_forum_footer() { global $spVars, $spGlobals, $spThisUser, $spMobile, $spDevice; do_action('sph_footer_start'); # wait for page load and run JS inits ?> <script type='text/javascript'> var jspf = jQuery.noConflict(); jspf(document).ready(function() { <?php # Quicklinks selects ?> jspf("#spQuickLinksForumSelect, #spQuickLinksTopicSelect").msDropDown(); jspf('#spQuickLinksForum').show(); jspf('#spQuickLinksTopic').show(); <?php # Checkboxes/radio buttons and tooltips if (defined('SP_USE_PRETTY_CBOX') && SP_USE_PRETTY_CBOX == true || !defined('SP_USE_PRETTY_CBOX')) { ?> jspf("input[type=checkbox],input[type=radio]").prettyCheckboxes(); <?php } ?> <?php if (!$spMobile) { ?> jspf(function(jspf){vtip();}) <?php } ?> <?php # Sets cookies with content and paragraph widths $docookie = false; if ($spVars['pageview'] == 'topic') { $docookie = true; } if ($docookie && sp_get_option('sfpostwrap')) { ?> var c = jspf(".spPostContentSection").width(); if (c) { jspf.cookie('post_width_<?php echo $spDevice; ?> ', c, { path: '/' }); } <?php } ?> <?php # pre-load 'wait' image ?> waitImage = new Image(32,32); waitImage.src = '<?php echo sp_find_icon(SPFIMAGES, 'sp_Wait.png'); ?> '; successImage = new Image(32,32); successImage.src = '<?php echo sp_find_icon(SPFIMAGES, 'sp_Success.png'); ?> '; failureImage = new Image(32,32); failureImage.src = '<?php echo sp_find_icon(SPFIMAGES, 'sp_Failure.png'); ?> '; <?php # check if this is a redirect from a failed save if ($spVars['pageview'] == 'topic' || $spVars['pageview'] == 'forum') { ?> if (jspf('#spPostNotifications').html() != null) { if (jspf('#spPostNotifications').html() != '') { jspf('#spPostNotifications').show(); spjOpenEditor('spPostForm', 'post'); } } <?php } # turn on auto update of required $sfauto = array(); $sfauto = sp_get_option('sfauto'); if ($sfauto['sfautoupdate']) { $timer = $sfauto['sfautotime'] * 1000; $autoup = $spGlobals['autoupdate']; $arg = ''; foreach ($autoup as $up) { $list = implode($up, ','); $list .= '&sfnonce=' . wp_create_nonce('forum-ahah'); if ($arg != '') { $arg .= '%'; } $arg .= $list; } ?> spjAutoUpdate("<?php echo $arg; ?> ", "<?php echo $timer; ?> "); <?php } ?> <?php ?> }); </script> <?php do_action('sph_footer_end'); }