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 sp_GroupHeaderRSSButton($args = '', $label = '', $toolTip = '') { global $spThisUser, $spThisGroup; if (!$spThisGroup->group_rss_active) { return; } $defs = array('tagId' => 'spGroupHeaderRSSButton%ID%', 'tagClass' => 'spLink', 'icon' => 'sp_Feed.png', 'iconClass' => 'spIcon', 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_GroupHeaderRSSButton_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); $toolTip = esc_attr($toolTip); $echo = (int) $echo; $get = (int) $get; $tagId = str_ireplace('%ID%', $spThisGroup->group_id, $tagId); # Get or construct rss url if (empty($spThisGroup->rss)) { $rssOpt = sp_get_option('sfrss'); if ($rssOpt['sfrssfeedkey'] && isset($spThisUser->feedkey)) { $rssUrl = sp_get_sfqurl(trailingslashit(sp_build_url('', '', 0, 0, 0, 1)) . user_trailingslashit($spThisUser->feedkey)) . 'group=' . $spThisGroup->group_id; } else { $sym = strpos(sp_url(), '?') ? '&' : '?'; $rssUrl = trailingslashit(sp_build_url('', '', 0, 0, 0, 1)) . sp_add_get() . "group={$spThisGroup->group_id}"; } } else { $rssUrl = $spThisGroup->rss; } if ($get) { return $rssUrl; } $out = "<a class='{$tagClass} vtip' id='{$tagId}' title='{$toolTip}' rel='nofollow' href='{$rssUrl}'>"; 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"; $out = apply_filters('sph_GroupHeaderRSSButton', $out, $a); if ($echo) { echo $out; } else { return $out; } }
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 spa_forums_edit_group_form($group_id) { ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('#grouprow-<?php echo $group_id; ?> ').addClass('inForm'); spjAjaxForm('sfgroupedit<?php echo $group_id; ?> ', 'sfreloadfb'); }); </script> <?php global $spPaths; $group = $group = spdb_table(SFGROUPS, "group_id={$group_id}", 'row'); spa_paint_options_init(); $ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=editgroup'; ?> <form action="<?php echo $ahahURL; ?> " method="post" id="sfgroupedit<?php echo $group->group_id; ?> " name="sfgroupedit<?php echo $group->group_id; ?> "> <?php echo sp_create_nonce('forum-adminform_groupedit'); spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Manage Groups and Forums'), false); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Edit Group'), 'true', 'edit-forum-group'); ?> <input type="hidden" name="group_id" value="<?php echo $group->group_id; ?> " /> <input type="hidden" name="cgroup_name" value="<?php echo sp_filter_title_display($group->group_name); ?> " /> <input type="hidden" name="cgroup_desc" value="<?php echo sp_filter_text_edit($group->group_desc); ?> " /> <input type="hidden" name="cgroup_seq" value="<?php echo $group->group_seq; ?> " /> <input type="hidden" name="cgroup_icon" value="<?php echo esc_attr($group->group_icon); ?> " /> <input type="hidden" name="cgroup_rss" value="<?php echo $group->group_rss; ?> " /> <input type="hidden" name="cgroup_message" value="<?php echo sp_filter_text_edit($group->group_message); ?> " /> <?php spa_paint_input(spa_text('Group Name'), 'group_name', sp_filter_title_display($group->group_name), false, true); spa_paint_input(spa_text('Description'), 'group_desc', sp_filter_text_edit($group->group_desc), false, true); spa_paint_select_start(spa_text('Select Custom Icon'), 'group_icon', ''); spa_select_icon_dropdown('group_icon', spa_text('Select Custom Icon'), SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/', $group->group_icon, false); spa_paint_select_end(); spa_paint_input(spa_text('Replacement external RSS URL') . '<br />' . spa_text('Default') . ': <strong>' . sp_get_sfqurl(sp_build_url('', '', 0, 0, 0, 1)) . 'group=' . $group->group_id . '</strong>', 'group_rss', sp_filter_url_display($group->group_rss), false, true); spa_paint_wide_textarea('Special group message to be displayed above forums', 'group_message', sp_filter_text_edit($group->group_message)); do_action('sph_forums_edit_group_panel'); spa_paint_close_fieldset(); echo '<div class="sfoptionerror spaceabove">'; echo sprintf(sp_text('To re-order your Groups, Forums and SubForums use the %s Order Groups and Forums %s option from the Forums Menu'), '<b>', '</b>'); echo '</div>'; spa_paint_close_panel(); spa_paint_tab_right_cell(); spa_paint_open_panel(); spa_paint_open_fieldset(spa_text('Default User Group Permissions'), false); echo '<strong>' . spa_text('Set default usergroup permission sets for this group') . '</strong><br />'; echo spa_text('Note - This will not will add or modify any current permissions. It is only a default setting for future forums created in this group. Existing default usergroup settings will be shown in the drop down menus'); # Permissions $usergroups = spa_get_usergroups_all(); $roles = sp_get_all_roles(); foreach ($usergroups as $usergroup) { echo '<input type="hidden" name="usergroup_id[]" value="' . $usergroup->usergroup_id . '" />'; spa_paint_select_start(sp_filter_title_display($usergroup->usergroup_name), 'role[]', ''); $defrole = spa_get_defpermissions_role($group->group_id, $usergroup->usergroup_id); if ($defrole == -1 || $defrole == '') { echo '<option value="-1">' . spa_text('Select permission set') . '</option>'; } foreach ($roles as $role) { $selected = ''; if ($defrole == $role->role_id) { $selected = 'selected="selected" '; } echo '<option ' . $selected . 'value="' . $role->role_id . '">' . sp_filter_title_display($role->role_name) . '</option>' . "\n"; } spa_paint_select_end(); } spa_paint_close_fieldset(); spa_paint_close_panel(); spa_paint_close_container(); ?> <div class="sfform-submit-bar"> <input type="submit" class="button-primary" id="groupedit<?php echo $group->group_id; ?> " name="groupedit<?php echo $group->group_id; ?> " value="<?php spa_etext('Update Group'); ?> " /> <input type="button" class="button-primary" onclick="javascript:jQuery('#group-<?php echo $group->group_id; ?> ').html('');jQuery('#grouprow-<?php echo $group_id; ?> ').removeClass('inForm');" id="sfgroupedit<?php echo $group->group_id; ?> " name="groupeditcancel<?php echo $group->group_id; ?> " value="<?php spa_etext('Cancel'); ?> " /> </div> </form> <?php spa_paint_close_tab(); ?> <div class="sfform-panel-spacer"></div> <?php }
function sp_UnreadPostsInfo($args = '', $label = '', $unreadToolTip = '', $markToolTip = '', $popupLabel = '') { global $spThisUser; if (!$spThisUser->member) { return; } # only valid for members $defs = array('tagId' => 'spUnreadPostsInfo', 'tagClass' => 'spUnreadPostsInfo', 'markId' => 'spMarkRead', 'unreadLinkId' => 'spUnreadPostsLink', 'unreadIcon' => 'sp_UnRead.png', 'markIcon' => 'sp_markRead.png', 'spanClass' => 'spLabel', 'iconClass' => 'spIcon', 'order' => 'TLM', 'popup' => 1, 'count' => 0, 'first' => 0, 'group' => 1, 'mobileMenu' => 0, 'echo' => 1, 'get' => 0); $a = wp_parse_args($args, $defs); $a = apply_filters('sph_UnreadPostsInfo_args', $a); extract($a, EXTR_SKIP); # sanitize before use $tagId = esc_attr($tagId); $tagClass = esc_attr($tagClass); $markId = esc_attr($markId); $unreadLinkId = esc_attr($unreadLinkId); $unreadIcon = sanitize_file_name($unreadIcon); $markIcon = sanitize_file_name($markIcon); $spanClass = esc_attr($spanClass); $iconClass = esc_attr($iconClass); $order = esc_attr($order); $popup = (int) $popup; $count = (int) $count; $first = (int) $first; $group = (int) $group; $mobileMenu = (int) $mobileMenu; $echo = (int) $echo; $get = (int) $get; if (!empty($unreadToolTip)) { $unreadToolTip = esc_attr($unreadToolTip); } if (!empty($markToolTip)) { $markToolTip = esc_attr($markToolTip); } if (!empty($popupLabel)) { $popupLabel = esc_attr($popupLabel); } else { $popupLabel = $unreadToolTip; # backwards compat for when $popupLabel didnt exist and $popuplabel was used } # Mark all as read global $spThisUser; $unreads = empty($spThisUser->newposts) ? 0 : count($spThisUser->newposts['topics']); $label = str_ireplace('%COUNT%', '<span id="spUnreadCount">' . $unreads . '</span>', $label); if (!empty($label)) { $label = sp_filter_title_display($label); } if ($get) { return $unreads; } $out = ''; $ajaxUrl = SFHOMEURL . 'index.php?sp_ahah=newpostpopup&sfnonce=' . wp_create_nonce('forum-ahah') . "&action=mark-read"; if ($mobileMenu) { # Run as page if ($unreads > 0) { $out .= "<li><a href='#{$markId}'>"; if (!empty($markToolTip)) { $out .= $markToolTip; } $out .= "</a>\n"; $out .= "<li class='{$tagClass}' id='{$tagId}'><a rel='nofollow' id='{$unreadLinkId}' href='" . sp_get_sfqurl(sp_url('newposts')) . "first={$first}&group={$group}" . "'>{$label}</a></li>\n"; } } else { $out .= "<div id='{$tagId}' class='{$tagClass}'>"; for ($x = 0; $x < strlen($order); $x++) { $item = substr($order, $x, 1); if ($item == 'T') { $out .= "<span class='{$spanClass}'>{$label}</span>"; } if ($unreads > 0 && $item != 'T') { if ($item == 'L') { if ($popup) { $site = SFHOMEURL . "index.php?sp_ahah=newpostpopup&action=all&first={$first}&group={$group}&count={$count}&sfnonce=" . wp_create_nonce('forum-ahah'); $out .= "<a rel='nofollow' id='{$unreadLinkId}' href='javascript:void(null)' onclick='spjDialogAjax(this, \"{$site}\", \"{$popupLabel}\", 700, 500, \"center\");'>"; } else { $out .= "<a rel='nofollow' id='{$unreadLinkId}' href='" . sp_get_sfqurl(sp_url('newposts')) . "first={$first}&group={$group}&count={$count}" . "'>"; } $out .= "<img class='{$iconClass} vtip' src='" . sp_find_icon(SPTHEMEICONSURL, "{$unreadIcon}") . "' title='{$unreadToolTip}' alt='' /></a>\n"; } if ($item == 'M') { $out .= "<a href='javascript:void(null)' onclick='spjMarkRead(\"{$ajaxUrl}\");'><img class='{$iconClass} vtip' src='" . sp_find_icon(SPTHEMEICONSURL, "{$markIcon}") . "' alt='' title='{$markToolTip}' /></a>"; } } } $out .= "</div>\n"; } $out = apply_filters('sph_UnreadPostsInfo', $out, $a); if ($echo) { echo $out; } else { return $out; } }
function sp_rpx_token_url() { $url = sp_url(); $token_url = sp_get_sfqurl($url) . 'rpx_response=1'; $sfrpx = sp_get_option('sfrpx'); if (!empty($sfrpx['sfrpxredirect'])) { $goback = $sfrpx['sfrpxredirect']; } else { if (strpos($_SERVER['REQUEST_URI'], 'wp-login.php') == false) { # if we're not at the login page, define a goback to the page we are on $goback = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } else { # otherwise, get the redirect or go to the admin page if (isset($_GET['redirect_to'])) { $goback = $_GET['redirect_to']; } else { $goback = $url; } } } return $token_url . '&goback=' . $goback; }
case 'all': $rssTitle = get_bloginfo('name') . ' - ' . sp_text('All Forums'); $rssLink = sp_url(); if (isset($rssopt['sfrssfeedkey']) && $rssopt['sfrssfeedkey'] && isset($spThisUser->feedkey)) { $atomLink = trailingslashit(sp_build_url('', '', 0, 0, 0, 1)) . user_trailingslashit($spThisUser->feedkey); } else { $atomLink = sp_build_url('', '', 0, 0, 0, 1); } break; case 'group': $rssTitle = get_bloginfo('name') . ' - ' . sp_text('Group') . ': ' . $first->group_name; $rssLink = add_query_arg(array('group' => $groupid), sp_url()); if (isset($rssopt['sfrssfeedkey']) && $rssopt['sfrssfeedkey'] && isset($spThisUser->feedkey)) { $atomLink = sp_get_sfqurl(trailingslashit(sp_build_url('', '', 0, 0, 0, 1)) . user_trailingslashit($spThisUser->feedkey)) . 'group=' . $groupid; } else { $atomLink = sp_get_sfqurl(sp_build_url('', '', 0, 0, 0, 1)) . 'group=' . $groupid; } break; case 'forum': $rssTitle = get_bloginfo('name') . ' - ' . sp_text('Forum') . ': ' . $first->forum_name; $rssLink = sp_build_url($first->forum_slug, '', 0, 0); if (isset($rssopt['sfrssfeedkey']) && $rssopt['sfrssfeedkey'] && isset($spThisUser->feedkey)) { $atomLink = trailingslashit(sp_build_url($first->forum_slug, '', 0, 0, 0, 1)) . user_trailingslashit($spThisUser->feedkey); } else { $atomLink = sp_build_url($first->forum_slug, '', 0, 0, 0, 1); } break; case 'topic': $rssTitle = get_bloginfo('name') . ' - ' . sp_text('Topic') . ': ' . $first->topic_name; $rssLink = sp_build_url($first->forum_slug, $first->topic_slug, 0, 0); if (isset($rssopt['sfrssfeedkey']) && $rssopt['sfrssfeedkey'] && isset($spThisUser->feedkey)) {