function sp_filter_tooltip_display($content, $status) { global $spThisUser; #save unedited content $original = $content; # can the current user view this post? if (!$spThisUser->moderator && $status == 1) { $content = sp_text('Post Awaiting Approval by Forum Administrator'); } else { $content = addslashes($content); $content = sp_filter_save_nohtml($content); # remove shortcodes to prevent messing up tooltip $content = strip_shortcodes($content); $length = apply_filters('sph_tooltip_length_chars', 300); if (strlen($content) > $length) { $pos = strpos($content, ' ', $length); if ($pos === false) { $pos = $length; } $content = substr($content, 0, $pos) . '...'; } $content = htmlspecialchars($content, ENT_QUOTES, SFCHARSET); $content = str_replace('&', '&', $content); } $content = apply_filters('sph_display_tooltip_filter', $content, $original, $status); return $content; }
function sp_populate_support_vars() { global $spVars; # Populate the rest of spVars if (empty($spVars['page'])) { $spVars['page'] = 1; } if (!empty($spVars['forumslug']) && $spVars['forumslug'] != 'all') { $record = spdb_table(SFFORUMS, "forum_slug='" . $spVars['forumslug'] . "'", 'row'); if ($record) { $spVars['groupid'] = $record->group_id; $spVars['forumid'] = $record->forum_id; if (empty($spVars['groupid'])) { $spVars['groupid'] = 0; } if (empty($spVars['forumid'])) { $spVars['forumid'] = 0; } $spVars['forumname'] = $record->forum_name; $spVars['forumdesc'] = $record->forum_desc; $spVars['featureimage'] = $record->feature_image; # Is it a subforum? if (!empty($record->parent)) { $forumparent = $record->parent; while ($forumparent > 0) { $parent = spdb_table(SFFORUMS, "forum_id={$forumparent}", 'row'); if ($parent) { $spVars['parentforumid'][] = $forumparent; $spVars['parentforumslug'][] = $parent->forum_slug; $spVars['parentforumname'][] = $parent->forum_name; $forumparent = $parent->parent; } else { $forumparent = true; } } } $spVars = apply_filters('sph_spvars_forum', $spVars, $record); } else { $header = apply_filters('sph_404', 404); status_header($header); } } if (!empty($spVars['topicslug'])) { $record = spdb_table(SFTOPICS, "topic_slug='" . $spVars['topicslug'] . "'", 'row'); if ($record) { $spVars['topicid'] = $record->topic_id; if (empty($spVars['topicid'])) { $spVars['topicid'] = 0; } if ($record) { $spVars['topicname'] = $record->topic_name; } # verify forum slug matches forum slug based on topic and do canonical redirect if doesnt match (moved?) $forum = spdb_table(SFFORUMS, "forum_id='" . $record->forum_id . "'", 'row'); if ($forum->forum_slug != $spVars['forumslug']) { $url = sp_build_url($forum->forum_slug, $spVars['topicslug'], $spVars['page'], 0); wp_redirect(esc_url($url), 301); } $spVars = apply_filters('sph_spvars_topic', $spVars, $record); } else { $header = apply_filters('sph_404', 404); status_header($header); } } # Add Search Vars if (isset($_GET['search'])) { if ($_GET['search'] != '') { $spVars['searchpage'] = intval($_GET['search']); } $spVars['searchpage'] = sp_esc_int($spVars['searchpage']); if (isset($_GET['type']) ? $spVars['searchtype'] = intval($_GET['type']) : ($spVars['searchtype'] = 1)) { } $spVars['searchtype'] = sp_esc_int($spVars['searchtype']); if ($spVars['searchtype'] == 0 || empty($spVars['searchtype'])) { $spVars['searchtype'] = 1; } if (isset($_GET['include']) ? $spVars['searchinclude'] = intval($_GET['include']) : ($spVars['searchinclude'] = 1)) { } $spVars['searchinclude'] = sp_esc_int($spVars['searchinclude']); if ($spVars['searchinclude'] == 0 || empty($spVars['searchinclude'])) { $spVars['searchinclude'] = 1; } if (isset($_GET['value']) ? $spVars['searchvalue'] = sp_filter_save_nohtml(urldecode($_GET['value'])) : ($spVars['searchvalue'] = '')) { } $spVars['searchvalue'] = sp_filter_table_prefix($spVars['searchvalue']); $spVars['newsearch'] = isset($_GET['new']) ? true : false; if (empty($spVars['searchvalue']) || $spVars['searchvalue'] == '') { $spVars['searchpage'] = 0; $spVars['searchtype'] = 0; $spVars['searchinclude'] = 0; sp_notify(SPFAILURE, sp_text('Invalid search query')); wp_redirect(sp_url()); } } else { $spVars['searchpage'] = 0; } $spVars['searchresults'] = 0; $spVars = apply_filters('sph_support_vars', $spVars); }
function spa_save_css_data() { $css = ''; $curTheme = sp_get_option('sp_current_theme'); $css = esc_attr($_POST['spnewcontent']); $css = sp_filter_save_nohtml($css); if ($_POST['metaId'] == 0) { sp_add_sfmeta('css', $curTheme['theme'], $css, true); } else { sp_update_sfmeta('css', $curTheme['theme'], $css, $_POST['metaId'], true); } $msg = spa_text('Custom theme CSS updated'); return $msg; }