本文整理汇总了PHP中sp_build_url函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_build_url函数的具体用法?PHP sp_build_url怎么用?PHP sp_build_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_build_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sp_do_sp_TopicLinkTag
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;
}
}
示例2: sp_do_sp_ForumLinkTag
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;
}
}
示例3: sp_featured_do_post_tool
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;
}
示例4: sp_do_sp_AddNewTopicLinkTag
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;
}
}
}
示例5: sp_render_edit_post_form
function sp_render_edit_post_form($args, $postid, $postcontent)
{
global $spVars, $spThisUser, $spThisTopic, $spGlobals;
$defs = array('tagClass' => 'spForm', 'hide' => 1, 'controlFieldset' => 'spEditorFieldset', 'controlInput' => 'spControl', 'controlSubmit' => 'spSubmit', 'controlOrder' => 'cancel|save', 'labelHeading' => sp_text('Edit Post'), 'labelSmileys' => sp_text('Smileys'), 'labelOptions' => sp_text('Options'), 'labelOptionTime' => sp_text('Edit post timestamp'), 'labelPostButton' => sp_text('Save Edited Post'), '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 Edited Post'), 'tipCancelButton' => sp_text('Cancel the Post Edits'));
$a = wp_parse_args($args, $defs);
extract($a, EXTR_SKIP);
# sanitize
$tagClass = esc_attr($tagClass);
$hide = (int) $hide;
$controlFieldset = esc_attr($controlFieldset);
$labelHeading = sp_filter_title_display($labelHeading);
include_once SF_PLUGIN_DIR . '/forum/content/forms/sp-form-components.php';
$toolbar = $spGlobals['display']['editor']['toolbar'];
$captchaValue = sp_get_option('captcha-value');
$out = '';
$out .= "<div id='spPostForm'>\n";
$out .= "<form class='{$tagClass}' action='" . sp_build_url($spThisTopic->forum_slug, $spThisTopic->topic_slug, $spThisTopic->display_page, $postid) . "' method='post' name='editpostform' onsubmit='return spjSetProcessFlag(this);'>\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";
$out .= "<input type='hidden' name='pid' value='{$postid}' />\n";
$out .= "<input type='hidden' name='captcha' value='{$captchaValue}' />\n";
$out .= "<div class='spEditor'>\n";
$out = apply_filters('sph_post_edit_top', $out, $postid, $a);
$out .= "<fieldset class='{$controlFieldset}'>\n";
$out .= "<legend>{$labelHeading}</legend>\n";
# Display the selected editor
$tout = '';
$tout .= '<div id="spEditorContent">' . "\n";
$tout .= sp_setup_editor(1, str_replace('&', '&', $postcontent));
$tout .= '</div>' . "\n";
$out .= apply_filters('sph_post_editor_content', $tout, $spThisTopic, $postid, $a);
# allow plugins to insert stuff before editor footer
$out = apply_filters('sph_post_before_editor_footer', $out, $spThisTopic, $postid, $a);
# define area above toolbar for plugins to add components
$section = apply_filters('sph_post_editor_edit_above_toolbar', '', $spThisTopic, $a);
if (!empty($section)) {
$tout = '';
$tout .= '<div class="spEditorSection">';
$tout .= $section;
$tout .= '</div>' . "\n";
$out .= apply_filters('sph_post_editor_edit_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'></div>\n";
# TOOLBAR
# define toolbar - submit buttons on right, plugin extensions on left
$toolbarRight = apply_filters('sph_post_editor_edit_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";
}
# let plugins add stuff at top of editor footer
$tout = '';
$tout = apply_filters('sph_post_edit_footer_top', $tout, $spThisTopic, $postid, $a);
# smileys and options
$tout = apply_filters('sp_post_editor_inline_footer', $tout, $spThisTopic, $a, 'inline');
# let plugins add stuff at top of editor footer
$tout = apply_filters('sph_post_edit_footer_bottom', $tout, $postid, $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_after_editor_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_edit_submit_top', $out, $spThisTopic, $a);
# let plugins add/remove the controls area
$tout = apply_filters('sp_post_editor_edit_inline_submit', '', $spThisTopic, $a, 'inline');
# let plugins add stuff at end of editor submit bottom
$out .= apply_filters('sph_post_edit_submit_bottom', $tout, $spThisTopic, $a);
$out .= '</div>' . "\n";
}
$out .= '</fieldset>' . "\n";
$out = apply_filters('sph_post_edit_bottom', $out, $postid, $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;
}
示例6: sp_ForumIndexAddIcon
function sp_ForumIndexAddIcon($args = '', $toolTip = '')
{
global $spThisForum, $spGlobals, $spThisUser;
$defs = array('tagId' => 'spForumIndexAddIcon%ID%', 'tagClass' => 'spIcon', 'icon' => 'sp_ForumStatusAdd.png', 'echo' => 1, 'get' => 0);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_ForumIndexAddIcon_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$icon = sanitize_file_name($icon);
$echo = (int) $echo;
$tagId = str_ireplace('%ID%', $spThisForum->forum_id, $tagId);
$out = '';
# add new topic icon
if (sp_get_auth('start_topics', $spThisForum->forum_id) && (!$spThisForum->forum_status && !$spGlobals['lockdown'] || $spThisUser->admin)) {
$url = sp_build_url($spThisForum->forum_slug, '', 1, 0) . sp_add_get() . 'new=topic';
$out .= "<a id='{$tagId}' class='{$tagClass} vtip' title='{$toolTip}' href='{$url}'>\n";
if (!empty($icon)) {
$out .= "<img src='" . sp_find_icon(SPTHEMEICONSURL, "{$icon}") . "' alt='' />\n";
}
$out .= "</a>\n";
$out = apply_filters('sph_ForumIndexAddIcon', $out, $a);
}
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例7: sp_topicview_query
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;
//.........这里部分代码省略.........
示例8: sp_forumview_build_subforums
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);
}
//.........这里部分代码省略.........
示例9: sp_listview_query
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;
//.........这里部分代码省略.........
示例10: sp_PostNewTopicButton
function sp_PostNewTopicButton($args = '', $label = '', $toolTip = '', $toolTipLock = '')
{
global $spThisTopic, $spGlobals, $spThisUser;
# can be empty if request is for a bogus topic slug
if (empty($spThisTopic)) {
return;
}
if (!sp_get_auth('start_topics', $spThisTopic->forum_id)) {
return;
}
$defs = array('tagId' => 'spPostNewTopicButton', 'tagClass' => 'spButton', 'icon' => 'sp_NewTopic.png', 'iconLock' => 'sp_ForumStatusLock.png', 'iconClass' => 'spIcon', 'iconStatusClass' => 'spIcon', 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_PostNewTopicButton_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);
$iconStatusClass = esc_attr($iconStatusClass);
$toolTip = esc_attr($toolTip);
$toolTipLock = esc_attr($toolTipLock);
$echo = (int) $echo;
# is the forum locked?
$out = '';
$lock = false;
if ($spGlobals['lockdown'] || $spThisTopic->forum_status) {
if (!empty($iconLock)) {
$out .= sp_paint_icon($tagClass . ' ' . $iconStatusClass, SPTHEMEICONSURL, sanitize_file_name($iconLock), $toolTipLock);
}
if (!$spThisUser->admin) {
$lock = true;
}
}
if (!$lock && sp_get_auth('start_topics', $spThisTopic->forum_id)) {
$url = sp_build_url($spThisTopic->forum_slug, '', 1, 0) . sp_add_get() . 'new=topic';
$out .= "<a href='{$url}' class='{$tagClass}' id='{$tagId}' title='{$toolTip}'>\n";
if (!empty($icon)) {
$out .= sp_paint_icon($iconClass, SPTHEMEICONSURL, $icon);
}
if (!empty($label)) {
$out .= sp_filter_title_display($label);
}
$out .= "</a>\n";
}
$out = apply_filters('sph_PostNewTopicButton', $out, $a);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例11: sp_topic_delete
function sp_topic_delete()
{
sp_delete_topic(sp_esc_int($_GET['killtopic']), sp_esc_int($_GET['killtopicforum']), false);
$view = sp_esc_str($_GET['view']);
if ($view == 'topic') {
$forumslug = spdb_table(SFFORUMS, 'forum_id=' . sp_esc_int($_GET['killtopicforum']), 'forum_slug');
$returnURL = sp_build_url($forumslug, '', 0);
echo $returnURL;
} else {
if ($_GET['count'] == 1) {
$forumslug = spdb_table(SFFORUMS, 'forum_id=' . sp_esc_int($_GET['killtopicforum']), 'forum_slug');
$page = sp_esc_int($_GET['page']);
if ($page == 1) {
$returnURL = sp_build_url($forumslug, '', 0);
} else {
$page = $page - 1;
$returnURL = sp_build_url($forumslug, '', $page);
}
echo $returnURL;
}
}
die;
}
示例12: sp_do_sp_ForumDropdownTag
function sp_do_sp_ForumDropdownTag($args = '')
{
#check if forum displayed
if (sp_abort_display_forum()) {
return;
}
$defs = array('tagId' => 'spForumDropdownTag', 'tagClass' => 'spLinkTag', 'selectClass' => 'spSelectTag', 'forumList' => 0, 'label' => __("Select forum", 'sp-ttags'), 'length' => 30, 'echo' => 1);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_ForumDropdownTag_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagId = esc_attr($tagId);
$tagClass = esc_attr($tagClass);
$selectClass = esc_attr($selectClass);
$forumList = esc_attr($forumList);
$label = sp_filter_title_display($label);
$length = (int) $length;
$echo = (int) $echo;
global $spThisUser;
sp_forum_api_support();
$forum_ids = array();
if ($forumList == 0) {
$forum_ids = sp_get_forum_memberships($spThisUser->ID);
} else {
$allforums = explode(',', $forumList);
foreach ($allforums as $thisforum) {
if (sp_can_view($thisforum, 'forum-title')) {
$forum_ids[] = $thisforum;
}
}
}
if (empty($forum_ids)) {
return;
}
# create where clause based on forums that current user can view
$where = "forum_id IN (" . implode(",", $forum_ids) . ")";
$spdb = new spdbComplex();
$spdb->table = SFFORUMS;
$spdb->fields = 'forum_slug, forum_name';
$spdb->join = array(SFGROUPS . ' ON ' . SFFORUMS . '.group_id = ' . SFGROUPS . '.group_id');
$spdb->where = $where;
$spdb->orderby = 'group_seq, forum_seq';
$forums = $spdb->select();
$out = "<div id='{$tagId}' class='{$tagClass}'>";
$out .= '<select name="forumselect" class="' . $selectClass . '" onChange="javascript:spjChangeForumURL(this)">' . "\n";
$out .= '<option>' . $label . '</option>' . "\n";
foreach ($forums as $forum) {
$out .= '<option value="' . sp_build_url($forum->forum_slug, '', 0, 0) . '"> ' . sp_create_name_extract(sp_filter_title_display($forum->forum_name), $length) . '</option>' . "\n";
}
$out .= '</select>' . "\n";
$out .= '</div>';
$out .= '<script type="text/javascript">';
$out .= 'function spjChangeForumURL(menuObj) {';
$out .= 'var i = menuObj.selectedIndex;';
$out .= 'if(i > 0) {';
$out .= 'if(menuObj.options[i].value != "#") {';
$out .= 'window.location = menuObj.options[i].value;';
$out .= '}}}';
$out .= '</script>';
$out = apply_filters('sph_ForumDropdownTag', $out);
if ($echo) {
echo $out;
} else {
return $out;
}
}
示例13: spa_forums_global_rss_form
function spa_forums_global_rss_form()
{
?>
<script type="text/javascript">
jQuery(document).ready(function() {
spjAjaxForm('sfnewglobalrss', 'sfreloadfd');
});
</script>
<?php
spa_paint_options_init();
$ahahURL = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=globalrss';
?>
<form action="<?php
echo $ahahURL;
?>
" method="post" id="sfnewglobalrss" name="sfnewglobalrss">
<?php
echo sp_create_nonce('forum-adminform_globalrss');
spa_paint_open_tab(spa_text('Forums') . ' - ' . spa_text('Global RSS Settings'), true);
spa_paint_open_panel();
spa_paint_open_fieldset(spa_text('Globally Enable/Disable RSS Feeds'), true, 'global-rss');
spa_paint_input(spa_text('Replacement external RSS URL for all RSS') . '<br />' . spa_text('Default') . ': <strong><small>' . sp_build_url('', '', 0, 0, 0, 1) . '</small></strong>', 'sfallrssurl', sp_get_option('sfallRSSurl'));
$base = SFHOMEURL . 'index.php?sp_ahah=forums-loader&sfnonce=' . wp_create_nonce('forum-ahah');
$target = 'sfallrss';
$image = SFADMINIMAGES;
$rss_count = spdb_count(SFFORUMS, 'forum_rss_private=0');
echo spa_text('Enabled Forum RSS feeds') . ': ' . $rss_count . ' ';
$rss_count = spdb_count(SFFORUMS, 'forum_rss_private=1');
echo spa_text('Disabled Forum RSS feeds') . ': ' . $rss_count . '<hr />';
?>
<input type="button" class="button-secondary" value="<?php
echo spa_text('Disable All RSS Feeds');
?>
" onclick="spjLoadForm('globalrssset', '<?php
echo $base;
?>
', '<?php
echo $target;
?>
', '<?php
echo $image;
?>
', '1', '1');" />
<input type="button" class="button-secondary" value="<?php
echo spa_text('Enable All RSS Feeds');
?>
" onclick="spjLoadForm('globalrssset', '<?php
echo $base;
?>
', '<?php
echo $target;
?>
', '<?php
echo $image;
?>
', '0', '1');" />
<div class="sfinline-form"> <!-- This row will hold ahah forms for the all rss -->
<div id="sfallrss"></div>
</div>
<?php
spa_paint_close_fieldset();
spa_paint_close_panel();
do_action('sph_forums_global_rss_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 Global RSS Settings');
?>
" />
</div>
</form>
<?php
spa_paint_close_tab();
?>
<div class="sfform-panel-spacer"></div>
<?php
}
示例14: sp_get_topic_newpost_url
function sp_get_topic_newpost_url($forumslug, $topicslug, $topicname, $postid, $postindex = 0)
{
$out = '<a href="' . sp_build_url($forumslug, $topicslug, 0, $postid, $postindex) . '">' . $topicname . '</a>' . "\n";
return $out;
}
示例15: get_bloginfo
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)) {
$atomLink = trailingslashit(sp_build_url($first->forum_slug, $first->topic_slug, 0, 0, 0, 1)) . user_trailingslashit($spThisUser->feedkey);
} else {
$atomLink = sp_build_url($first->forum_slug, $first->topic_slug, 0, 0, 0, 1);
}
break;
}
# init rss info with filters
$rssTitle = apply_filters('sph_feed_title', $rssTitle, $first);
$rssDescription = apply_filters('sph_feed_description', get_bloginfo('description'));
$rssGenerator = apply_filters('sph_feed_generator', sp_text('Simple:Press Version') . ' ' . SPVERSION);
# set up time for current user timezone
$tz = get_option('timezone_string');
if (empty($tz) || substr($tz, 0, 3) == 'UTC') {
$tz = 'UTC';
}
$tzUser = !empty($spThisUser->timezone_string) ? $spThisUser->timezone_string : $tz;
if (substr($tzUser, 0, 3) == 'UTC') {
$tzUser = 'UTC';