本文整理汇总了PHP中sp_text函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_text函数的具体用法?PHP sp_text怎么用?PHP sp_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sp_construct_database_error
function sp_construct_database_error($sql, $sqlerror)
{
global $spStatus, $spGlobals, $wpdb;
if ($spGlobals['record-errors'] == false) {
return;
}
if (spdb_connection() == false) {
return;
}
$mess = '';
$trace = debug_backtrace();
$traceitem = $trace[2];
$mess .= 'file: ' . $traceitem['file'] . '<br />';
$mess .= 'line: ' . $traceitem['line'] . '<br />';
$mess .= 'function: ' . $traceitem['function'] . '<br />';
$mess .= "error: {$sqlerror}<br /><br />";
$mess .= $sql;
$keyCheck = substr(E_ERROR . $traceitem['line'] . substr($traceitem['file'], -30, 30), 0, 45);
# write out error to our toolbox log if it doesn't exist already
$e = spdb_table(SFERRORLOG, 'keycheck="' . $keyCheck . '" AND error_type="database"', 'error_count');
if (empty($e) || $e == 0) {
@sp_write_error('database', $mess, E_ERROR, $keyCheck);
} else {
@sp_update_error($keyCheck, $e);
}
# create display message
include_once SPAPI . 'sp-api-cache.php';
sp_notify(SPFAILURE, sp_text('Invalid database query'));
}
示例2: sp_email_notifications
function sp_email_notifications($newpost)
{
global $spGlobals, $spThisUser, $spVars;
$out = '';
$email_status = array();
$eol = "\r\n";
$tab = "\t";
# create the email address list for admin nptifications
$admins_email = array();
$admins = spdb_table(SFMEMBERS, 'admin = 1 OR moderator = 1');
if ($admins) {
foreach ($admins as $admin) {
if ($admin->user_id != $newpost['userid']) {
$admin_opts = unserialize($admin->admin_options);
if ($admin_opts['sfnotify'] && sp_get_auth('moderate_posts', $newpost['forumid'], $admin->user_id)) {
$email = spdb_table(SFUSERS, "ID = " . $admin->user_id, 'user_email');
$admins_email[$admin->user_id] = $email;
}
}
}
}
$admins_email = apply_filters('sph_admin_email_addresses', $admins_email);
# send the emails
if (!empty($admins_email)) {
# clean up the content for the plain text email - go get it from database so not in 'save' mode
$post_content = spdb_table(SFPOSTS, 'post_id=' . $newpost['postid'], 'post_content');
$post_content = sp_filter_email_content($post_content);
# create message body
$msg = sp_text('New forum post on your site') . ': ' . get_option('blogname') . $eol . $eol;
$msg .= sp_text('From') . ': ' . $tab . $newpost['postername'] . ' [' . $newpost['posteremail'] . ']' . ', ' . sp_text('Poster IP') . ': ' . $newpost['posterip'] . $eol . $eol;
$msg .= sp_text('Group') . ':' . $tab . sp_filter_title_display($newpost['groupname']) . $eol;
$msg .= sp_text('Forum') . ':' . $tab . sp_filter_title_display($newpost['forumname']) . $eol;
$msg .= sp_text('Topic') . ':' . $tab . sp_filter_title_display($newpost['topicname']) . $eol;
$msg .= urldecode($newpost['url']) . $eol;
$msg .= sp_text('Post') . ':' . $eol . $post_content . $eol . $eol;
foreach ($admins_email as $id => $email) {
$newmsg = apply_filters('sph_admin_email', $msg, $newpost, $id, 'admin');
$replyto = apply_filters('sph_email_replyto', '', $newpost);
$subject = sp_text('Forum Post') . ' - ' . get_option('blogname') . ': [' . sp_filter_title_display($newpost['topicname']) . ']';
$subject = apply_filters('sph_email_subject', $subject, $newpost);
sp_send_email($email, $subject, $newmsg, $replyto);
}
$out = '- ' . sp_text('Notified: Administrators/Moderators');
}
$out = apply_filters('sph_new_post_notifications', $out, $newpost);
return $out;
}
示例3: sp_ProfilePermissionsForum
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) ? sp_paint_custom_icon('spRowIcon', SFCUSTOMURL . $thisForum->forum_icon) : sp_paint_icon('spRowIcon', SPTHEMEICONSURL, 'sp_ForumIcon.png');
$out .= $icon;
$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;
}
示例4: die
Ahah call for acknowledgements
$LastChangedDate: 2014-06-14 17:34:16 -0700 (Sat, 14 Jun 2014) $
$Rev: 11559 $
*/
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
die('Access denied - you cannot directly call this file');
}
sp_forum_api_support();
$theme = sp_get_current_sp_theme();
$out = '';
$out .= '<div id="spAbout">';
$out .= '<img src="' . SFCOMMONIMAGES . 'sp-small-logo.png" alt="" title="" /><br />';
$out .= '<p>© 2006-' . date('Y') . ' ' . sp_text('by') . ' <a href="http://www.yellowswordfish.com"><b>Andy Staines</b></a> ' . sp_text('and') . ' <a href="http://cruisetalk.org/"><b>Steve Klasen</b></a></p>';
$out .= '<p><a href="http://twitter.com/simpleforum">' . sp_text('Follow us On Twitter') . '</a></p>';
$out .= '<hr />';
$out .= '<p>';
$ack = array(sp_text('printThis by Jason Day') . ': <a href="https://github.com/jasonday/printThis">printThis</a>', sp_text('Math Spam Protection based on code by Michael Woehrer') . ': <a href="http://sw-guide.de/">Software Guide</a>', sp_text('Calendar Date Picker by TengYong Ng') . ': <a href="http://www.rainforestnet.com">Rain Forest Net</a>', sp_text('Image Uploader by Andrew Valums') . ': <a href="http://valums.com/ajax-upload/">Ajax upload</a>', sp_text('Checkbox and Radio Button transformations by') . ': <a href="http://www.no-margin-for-errors.com/">Stephane Caron</a>', sp_text('SPF RPX implementation uses code and ideas from RPX') . ': <a href="http://rpxwiki.com/WordpressPlugin">Brian Ellin</a>', sp_text('Popup Tooltips by the Vertigo Project') . ': <a href="http://www.vertigo-project.com/">Vertigo Project</a>', sp_text('Table Drag and Drop') . ': <a href="http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/">Isocra Consulting</a>', sp_text('Mobile Device Detection based on code by Brett Jankord') . ': <a href="http://www.brettjankord.com/2012/01/16/categorizr-a-modern-device-detection-script/">Categorizr</a>', sp_text('CSS and JS Concatenation based on code by Ronen Yacobi') . ': <a href="http://http://yacobi.info/">CSS And Script File Aggregation</a>');
$ack = apply_filters('sph_acknowledgements', $ack);
foreach ($ack as $a) {
$out .= $a . '<br />';
}
$out .= '</p>';
$out .= '<hr />';
$out .= '<p>' . sp_text('Our thanks to all the people who have aided, abetted, coded, suggested and helped test this plugin') . '</p><br />';
$out .= sp_text('This forum is using the') . ' <strong>' . $theme['theme'] . '</strong> ' . sp_text('theme') . '<br />';
if (!empty($theme['parent'])) {
$out .= sp_text('a child theme of the') . ' <strong>' . $theme['parent'] . '</strong> ' . sp_text('theme') . '<br />';
}
$out .= '</div>';
echo $out;
die;
示例5: sp_groupview_query
//.........这里部分代码省略.........
if ($spThisUser->member && isset($spThisUser->newposts['forums'])) {
$c = 0;
if ($spThisUser->newposts['forums']) {
foreach ($spThisUser->newposts['forums'] as $fnp) {
if ($fnp == $fidx) {
$c++;
}
}
}
$g[$gidx]->forums[$fidx]->unread = $c;
}
if (empty($r->children)) {
$cparent = 0;
} else {
$cparent = $fidx;
$sidx = 0;
}
# Build post id array for collecting stats at the end
if (!empty($thisPostid)) {
$p[$fidx] = $thisPostid;
}
$g[$gidx]->forums[$fidx] = apply_filters('sph_groupview_forum_records', $g[$gidx]->forums[$fidx], $r);
}
# Build special Group level flag on whether to show group RSS button or not (based on any forum in group having RSS access
if (sp_get_auth('view_forum', $r->forum_id) && !$r->forum_rss_private) {
$g[$gidx]->group_rss_active = 1;
}
}
}
}
}
if ($this->includeStats == true) {
# Go grab the forum stats and data
if (!empty($p)) {
$stats = $this->sp_groupview_stats_query($p);
if ($stats) {
foreach ($g as $gr) {
foreach ($gr->forums as $f) {
if (!empty($stats[$f->forum_id])) {
$s = $stats[$f->forum_id];
$f->topic_id = $s->topic_id;
$f->topic_name = sp_filter_title_display($s->topic_name);
$f->topic_slug = $s->topic_slug;
$f->post_id = $s->post_id;
$f->post_permalink = sp_build_url($f->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index);
$f->post_date = $s->post_date;
$f->post_status = $s->post_status;
$f->post_index = $s->post_index;
# see if we can display the tooltip
if (sp_can_view($f->forum_id, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) {
$f->post_tip = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status);
} else {
$f->post_tip = '';
}
$f->user_id = $s->user_id;
$f->display_name = sp_filter_name_display($s->display_name);
$f->guest_name = sp_filter_name_display($s->guest_name);
}
# do we need to record a possible subforum substitute topic?
$fsub = $f->forum_id_sub;
if ($fsub != 0 && !empty($stats[$fsub])) {
$s = $stats[$fsub];
$f->topic_id_sub = $s->topic_id;
$f->topic_name_sub = sp_filter_title_display($s->topic_name);
$f->topic_slug_sub = $s->topic_slug;
$f->post_id_sub = $s->post_id;
$f->post_permalink_sub = sp_build_url($f->subforums[$fsub]->forum_slug, $s->topic_slug, 0, $s->post_id, $s->post_index);
$f->post_date_sub = $s->post_date;
$f->post_status_sub = $s->post_status;
$f->post_index_sub = $s->post_index;
# see if we can display the tooltip
if (sp_can_view($fsub, 'post-content', $spThisUser->ID, $s->user_id, $s->topic_id, $s->post_id)) {
$f->post_tip_sub = $s->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($s->post_content, $s->post_status);
} else {
$f->post_tip_sub = '';
}
$f->user_id_sub = $s->user_id;
$f->display_name_sub = sp_filter_name_display($s->display_name);
$f->guest_name_sub = sp_filter_name_display($s->guest_name);
}
$f = apply_filters('sph_groupview_stats_records', $f, $s);
}
}
unset($stats);
}
}
}
# Do we need to re-order IDs based on passed in IDs
if ($groupids && $idOrder) {
$n = array();
foreach ($groupids as $gid) {
if (array_key_exists($gid, $g)) {
$n[$gid] = $g[$gid];
}
}
$g = $n;
unset($n);
}
return $g;
}
示例6: while
while (false !== ($file = readdir($dlist))) {
if ($file != "." && $file != "..") {
echo '<img class="spAvatarPool" src="' . esc_url(SFAVATARPOOLURL . '/' . $file) . '" alt="" onclick="spjSelAvatar(\'' . $file . '\', \'' . esc_js("<p class=\\'spCenter\\'>" . sp_text('Avatar selected. Please save pool avatar') . "</p>") . '\'); return jQuery(\'#dialog\').dialog(\'close\');" /> ';
}
}
echo '</p>';
closedir($dlist);
die;
}
if (isset($_GET['poolremove']) && ($spThisUser->ID == $userid || $spThisUser->admin)) {
if (empty($userid)) {
die;
}
$avatar = sp_get_member_item($userid, 'avatar');
$avatar['pool'] = '';
sp_update_member_item($userid, 'avatar', $avatar);
echo '<strong>' . sp_text('No pool avatar currently selected') . '</strong>';
$ahahURL = SFHOMEURL . 'index.php?sp_ahah=profile&sfnonce=' . wp_create_nonce('forum-ahah') . "&action=update-display-avatar&user={$userid}";
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#spProfileDisplayAvatar').load('<?php
echo $ahahURL;
?>
');
})
</script>
<?php
die;
}
die;
示例7: 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);
}
//.........这里部分代码省略.........
示例8: spdb_show_result
function spdb_show_result($sql, $inspect)
{
spdebug_styles(true);
echo '<div class="spdebug">';
echo sp_text('Inspect Query') . ': <strong>' . $inspect . '</strong><br><hr>';
echo '<pre><code>';
$k = array("\t", "\n", 'SELECT ', ' DISTINCT ', 'FROM ', 'LEFT JOIN ', 'RIGHT JOIN ', ' JOIN ', 'WHERE ', 'ORDER BY ', 'LIMIT ', ' ON ', ' IN ', ' DESC ', ' ASC ', ' DESC, ', ' ASC, ', ' AS ', ' OR ', ' AND ', ' LIKE ');
$r = array('', '', "\n<b>SELECT</b> ", ' <b>DISTINCT</b> ', "\n<b>FROM</b> ", "\n<b>LEFT JOIN</b> ", "\n<b>RIGHT JOIN</b> ", " \n<b>JOIN</b> ", "\n<b>WHERE</b> ", "\n<b>ORDER BY</b> ", "\n<b>LIMIT</b> ", ' <b>ON</b> ', ' <b>IN</b> ', ' <b>DESC</b> ', ' <b>ASC</b> ', ' <b>DESC</b>, ', ' <b>ASC</b>, ', ' <b>AS</b> ', ' <b>OR</b> ', ' <b>AND</b> ', ' <b>LIKE</b> ');
$sql = str_replace($k, $r, $sql);
echo $sql;
echo '</code></pre>';
echo '</div>';
}
示例9: sp_text
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Your Timezone') . ': </p>';
$tout .= '</div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tout .= '<p class="spProfileLabel">' . $spProfileUser->timezone_string . '</p>';
$tout .= '<p><small>' . sp_text('Local Time') . ': ' . sp_date('d', date(SFDATES)) . ' ' . sp_date('t', date(SFTIMES)) . '</small></p>';
$tout .= '<p><small>' . sp_text('Change your timezone on options - display') . '</small></p>';
$tout .= '</div>';
$out .= apply_filters('sph_ProfileUserTimezone', $tout, $userid, $thisSlug);
$out = apply_filters('sph_ProfileOverviewFormBottom', $out, $userid);
$out = apply_filters('sph_ProfileFormBottom', $out, $userid, $thisSlug);
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol"></div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tout .= '<form action="' . SFHOMEURL . 'index.php?sp_ahah=search&sfnonce=' . wp_create_nonce('forum-ahah') . '" method="post" id="searchposts" name="searchposts">';
$tout .= '<input type="hidden" class="sfhiddeninput" name="searchoption" id="searchoption" value="2" />';
$tout .= '<input type="hidden" class="sfhiddeninput" name="userid" id="userid" value="' . $userid . '" />';
$tout .= '<div class="spProfileFormSubmit">';
$tout .= '<input type="submit" class="spSubmit" name="membersearch" value="' . sp_text('List Topics You Have Posted To') . '" />';
$tout .= '<input type="submit" class="spSubmit" name="memberstarted" value="' . sp_text('List Topics You Started') . '" />';
$tout .= '</div>';
$tout .= '</form>';
$tout .= '</div>';
$out .= apply_filters('sph_ProfileUserTopicsPosted', $tout, $userid, $thisSlug);
$out .= "</div>\n";
$out = apply_filters('sph_ProfileOverviewForm', $out, $userid);
$out .= sp_InsertBreak('echo=0');
echo $out;
示例10: sp_PostForumToolButton
function sp_PostForumToolButton($args = '', $label = '', $toolTip = '')
{
global $spThisTopic, $spThisPost, $spThisPostUser, $spThisUser, $spGuestCookie, $spGlobals;
if ($spGlobals['lockdown'] == true && $spThisUser->admin == false) {
return;
}
$show = false;
if ($spThisUser->admin || $spThisUser->moderator) {
$show = true;
} else {
$edit_days = sp_get_option('editpostdays');
$post_date = strtotime(sp_date('d', $spThisPost->post_date));
$date_diff = floor((time() - $post_date) / (60 * 60 * 24));
if (sp_get_auth('view_email', $spThisTopic->forum_id) || sp_get_auth('pin_posts', $spThisTopic->forum_id) || sp_get_auth('edit_any_post', $spThisTopic->forum_id) || sp_get_auth('edit_own_posts_forever', $spThisTopic->forum_id) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID || sp_get_auth('edit_own_posts_forever', $spThisTopic->forum_id) && $spThisUser->guest && $spThisPost->guest_email == $spGuestCookie->guest_email || sp_get_auth('edit_own_posts_reply', $spThisTopic->forum_id) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID && $spThisPost->last_post || sp_get_auth('edit_own_posts_reply', $spThisTopic->forum_id) && $spThisUser->guest && $spThisPost->guest_email == $spGuestCookie->guest_email && $spThisPost->last_post || sp_get_auth('edit_own_posts_for_time', $spThisTopic->forum_id) && $spThisUser->member && $spThisPostUser->ID == $spThisUser->ID && $date_diff <= $edit_days || sp_get_auth('move_posts', $spThisTopic->forum_id) || sp_get_auth('reassign_posts', $spThisTopic->forum_id) || sp_get_auth('delete_any_post', $spThisTopic->forum_id) || sp_get_auth('delete_own_posts', $spThisTopic->forum_id) && $spThisPostUser->user_id == $spThisUser->ID || sp_get_auth('moderate_posts', $spThisTopic->forum_id) && $spThisPost->post_status != 0) {
$show = true;
}
}
$show = apply_filters('sph_forum_tools_topic_show', $show);
if (!$show) {
return;
}
$defs = array('tagId' => 'spForumToolButton%ID%', 'tagClass' => 'spToolsButton', 'icon' => 'sp_ForumTools.png', 'iconClass' => 'spIcon', 'hide' => 1, 'containerClass' => 'spTopicPostSection');
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_PostForumToolButton_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%', $spThisPost->post_id, $tagId);
$addStyle = '';
if ($hide) {
$addStyle = " style='display: none;' ";
}
$last = $spThisPost->last_post ? 1 : 0;
$site = SFHOMEURL . 'index.php?sp_ahah=admintoollinks&sfnonce=' . wp_create_nonce('forum-ahah') . "&action=posttools&post={$spThisPost->post_id}&page={$spThisTopic->display_page}&postnum={$spThisPost->post_index}&name=" . urlencode($spThisPostUser->display_name) . "&forum={$spThisTopic->forum_id}&last={$last}";
$out = "<a class='{$tagClass}' id='{$tagId}' title='{$toolTip}' rel='nofollow' href='javascript:void(null)' {$addStyle} ";
$title = esc_js(sp_text('Forum Tools'));
$out .= "onclick='spjDialogAjax(this, \"" . $site . "\", \"" . $title . "\", 350, 0, 0);' >";
if (!empty($icon)) {
$out .= sp_paint_icon($iconClass, SPTHEMEICONSURL, $icon);
}
if (!empty($label)) {
$out .= $label;
}
$out .= "</a>\n";
$out = apply_filters('sph_PostForumToolButton', $out, $a);
echo $out;
# Add script to hover admin buttons - just once
if ($spThisTopic->tools_flag && $hide) {
?>
<script type='text/javascript'>
/* <![CDATA[ */
var sptb = {
toolclass : '.<?php
echo $containerClass;
?>
'
};
/* ]]> */
</script>
<?php
add_action('wp_footer', 'spjs_AddPostToolsHover');
$spThisTopic->tools_flag = false;
}
}
示例11: die
/*
Simple:Press
general ahah routines
$LastChangedDate: 2015-08-12 07:21:39 -0700 (Wed, 12 Aug 2015) $
$Rev: 13286 $
*/
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
die('Access denied - you cannot directly call this file');
}
sp_forum_api_support();
# get out of here if no action specified
if (empty($_GET['action'])) {
die;
}
$action = sp_esc_str($_GET['action']);
if ($action == 'page-popup') {
sp_text('Jump to page:');
$permalink = trailingslashit(sp_esc_str($_GET['url']));
$max = sp_esc_str($_GET['max']);
$out = '<div id="spMainContainer">';
$out .= '<form action="' . sp_url() . '" method="post" id ="pagejump" name="pagejump">' . "\n";
$out .= '<input type="hidden" id="url" name="url" value="' . $permalink . '" />' . "\n";
$out .= '<input type="hidden" id="max" name="max" value="' . $max . '" />' . "\n";
$out .= '<label>' . sp_text('Enter page you want to go to:') . '</label>';
$out .= '<input class="spSubmit" type="text" id="page" name="page" value="" />' . "\n";
$out .= '<div style="text-align:center"><p><input type="submit" class="spButton" name="pagejump" value="' . sp_text('Go') . '" onclick="spjPageJump(); return false;" /></p></div>';
$out .= '</form></div>' . "\n";
echo apply_filters('sph_jump_page', $out);
}
die;
示例12: sp_notify_user
function sp_notify_user()
{
global $spThisUser;
$thisPost = sp_esc_int($_GET['pid']);
if (empty($thisPost)) {
die;
}
if (!$spThisUser->admin && !$spThisUser->moderator) {
if (!is_user_logged_in()) {
sp_etext('Access denied - are you logged in?');
} else {
sp_etext('Access denied - you do not have permission');
}
die;
}
$site = SFHOMEURL . 'index.php?sp_ahah=admintools&sfnonce=' . wp_create_nonce('forum-ahah') . '&action=notify-search&rand=' . rand();
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#sp_notify_user').autocomplete({
source : '<?php
echo $site;
?>
',
disabled : false,
delay : 200,
minLength: 1,
});
});
</script>
<div id="spMainContainer" class="spForumToolsPopup">
<div class="spForumToolsHeader">
<div class="spForumToolsHeaderTitle"><?php
echo sp_text('Notify user of this post');
?>
</div>
</div>
<form action="<?php
echo sp_permalink_from_postid($thisPost);
?>
" method="post" name="notifyuserform">
<div class="spCenter">
<input type="hidden" name="postid" value="<?php
echo $thisPost;
?>
" />
<label class='spLabel' for='sp_notify_user'><?php
sp_etext('User to notify');
?>
: </label>
<input type='text' id='sp_notify_user' class='spControl' name='sp_notify_user' />
<p class="spLabelSmall"><?php
sp_etext("Start typing a member's name above and it will auto-complete");
?>
</p>
<label class='spLabel' for='sp_notify_user'><?php
sp_etext('Message');
?>
: </label>
<input type='text' id='message' class='spControl' name='message' />
<input type="submit" class="spSubmit" name="notifyuser" value="<?php
sp_etext('Notify');
?>
" />
<input type="button" class="spSubmit" name="cancel" value="<?php
sp_etext('Cancel');
?>
" onclick="jQuery('#dialog').dialog('close');" />
</div>
</form>
</div>
<?php
}
示例13: sp_postlistview_query
function sp_postlistview_query($where, $order, $count, $view, $type)
{
global $spGlobals, $spThisUser;
# If no WHERE clause then return empty
if (empty($where)) {
return;
}
# build list of forums user can view
$fids = sp_user_visible_forums($view);
if (!empty($fids)) {
$fids = implode(',', $fids);
$where .= ' AND ' . SFPOSTS . ".forum_id IN ({$fids})";
}
# Check order
if (empty($order)) {
$order = SFPOSTS . '.post_id DESC';
}
$spdb = new spdbComplex();
$spdb->table = SFPOSTS;
$spdb->fields = SFPOSTS . '.post_id, post_content, ' . spdb_zone_datetime('post_date') . ', ' . SFPOSTS . '.topic_id, ' . SFPOSTS . '.forum_id,
' . SFPOSTS . '.user_id, guest_name, post_status, post_index, forum_name, forum_slug, forum_disabled, ' . SFFORUMS . '.group_id, group_name,
topic_name, topic_slug, ' . SFTOPICS . '.post_count, topic_opened, display_name';
$spdb->join = array(SFFORUMS . ' ON ' . SFFORUMS . '.forum_id = ' . SFPOSTS . '.forum_id', SFGROUPS . ' ON ' . SFGROUPS . '.group_id = ' . SFFORUMS . '.group_id', SFTOPICS . ' ON ' . SFTOPICS . '.topic_id = ' . SFPOSTS . '.topic_id');
$spdb->left_join = array(SFMEMBERS . ' ON ' . SFMEMBERS . '.user_id = ' . SFPOSTS . '.user_id');
$spdb->where = $where;
$spdb->orderby = $order;
if ($count) {
$spdb->limits = $count;
}
$spdb = apply_filters('sph_post_list_query', $spdb, $this, $type);
if (!empty($spThisUser->inspect['q_spPostListView'])) {
$spdb->inspect = 'spPostListView';
$spdb->show = true;
}
$records = $spdb->select();
# Now check authorisations and clean up the object
$list = array();
# 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
$porder = 'ASC';
# default
if ($spGlobals['display']['posts']['sortdesc']) {
$porder = 'DESC';
}
# global override
if ($records) {
$listPos = 1;
foreach ($records as $r) {
if (sp_can_view($r->forum_id, 'forum-title')) {
if ($r->post_status == 0 || sp_get_auth('moderate_posts', $r->forum_id)) {
$p = $r->post_id;
$list[$p] = $r;
# Now apply any necessary filters and data changes
$list[$p]->post_content = sp_filter_content_display($r->post_content);
$list[$p]->post_content_raw = $r->post_content;
$list[$p]->forum_name = sp_filter_title_display($r->forum_name);
$list[$p]->forum_disabled = $r->forum_disabled;
$list[$p]->forum_permalink = sp_build_url($r->forum_slug, '', 1, 0);
$list[$p]->topic_permalink = sp_build_url($r->forum_slug, $r->topic_slug, 1, 0);
$list[$p]->topic_name = sp_filter_title_display($r->topic_name);
$list[$p]->topic_opened = $r->topic_opened;
$list[$p]->group_name = sp_filter_title_display($r->group_name);
if (sp_can_view($r->forum_id, 'post-content', $spThisUser->ID, $r->user_id, $r->topic_id, $r->post_id)) {
$list[$p]->post_tip = $r->post_status ? sp_text('Post awaiting moderation') : sp_filter_tooltip_display($r->post_content, $r->post_status);
} else {
$list[$p]->post_tip = '';
}
# Ensure display name is populated
if (empty($r->display_name)) {
$list[$p]->display_name = $list[$p]->guest_name;
}
$list[$p]->display_name = sp_filter_name_display($list[$p]->display_name);
# determine the page for the post permalink
if ($porder == 'ASC') {
$page = $r->post_index / $ppaged;
if (!is_int($page)) {
$page = intval($page + 1);
}
} else {
$page = $r->post_count - $r->post_index;
$page = $page / $ppaged;
$page = intval($page + 1);
}
$list[$p]->post_permalink = sp_build_url($r->forum_slug, $r->topic_slug, $page, $r->post_id, $r->post_index);
$list[$p]->list_position = $listPos;
$list[$p] = apply_filters('sph_post_list_record', $list[$p], $r, $type);
}
}
$listPos++;
}
}
return $list;
}
示例14: sp_build_forum_index
function sp_build_forum_index($forumid, $returnmsg = false)
{
if (!$forumid) {
return '';
}
# get the topic count for this forum
$topiccount = spdb_count(SFTOPICS, "forum_id={$forumid}");
# get the post count and post count held
$postcount = spdb_sum(SFTOPICS, 'post_count', "forum_id={$forumid}");
$postcountheld = spdb_sum(SFTOPICS, 'post_count_held', "forum_id={$forumid}");
# get the last post id and last post held id that appeared in a topic within this forum
$postid = spdb_table(SFPOSTS, "forum_id={$forumid}", 'post_id', 'post_id DESC', '1');
$postidheld = spdb_table(SFPOSTS, "forum_id={$forumid} AND post_status=0", 'post_id', 'post_id DESC', '1');
if (!$topiccount) {
$topiccount = 0;
}
if (!$postcount) {
$postcount = 0;
}
if (!isset($postid)) {
$postid = 'NULL';
}
if (!$postcountheld) {
$postcountheld = 0;
}
if (!isset($postidheld)) {
$postidheld = 'NULL';
}
# update forum record
spdb_query('UPDATE ' . SFFORUMS . " SET\n\t\t\t\tpost_id={$postid},\n\t\t\t\tpost_id_held={$postidheld},\n\t\t\t\tpost_count={$postcount},\n\t\t\t\tpost_count_held={$postcountheld},\n\t\t\t\ttopic_count={$topiccount}\n\t\t\t\tWHERE forum_id={$forumid}");
if ($returnmsg) {
sp_notify(SPSUCCESS, sp_text('Verification complete'));
}
}
示例15: sp_render_forum
function sp_render_forum($content)
{
global $spIsForum, $spContentLoaded, $spVars, $spGlobals, $spThisUser, $spStatus;
# make sure we are at least in the html body before outputting any content
if (!sp_get_option('sfwpheadbypass') && !did_action('wp_head')) {
return '';
}
if ($spIsForum && !post_password_required(get_post(sp_get_option('sfpage')))) {
# Limit forum display to within the wp loop?
if (sp_get_option('sfinloop') && !in_the_loop()) {
return $content;
}
# Has forum content already been loaded and are we limiting?
if (!sp_get_option('sfmultiplecontent') && $spContentLoaded) {
return $content;
}
$spContentLoaded = true;
sp_set_server_timezone();
# offer a way for forum display to be short circuited but always show for admins unless an upgrade
$message = sp_abort_display_forum();
$content .= $message;
if (!empty($message) && (!$spThisUser->admin || $spStatus != 'ok')) {
return $content;
}
# process query arg actions
# check for edit operation. Need tp check for '_x' in case using mobile as buttin is an image
if (isset($_POST['editpost']) || isset($_POST['editpost_x'])) {
sp_save_edited_post();
}
if (isset($_POST['edittopic'])) {
sp_save_edited_topic();
}
if (isset($_POST['ordertopicpins'])) {
sp_promote_pinned_topic();
}
if (isset($_POST['makepostreassign'])) {
sp_reassign_post();
}
if (isset($_POST['approvepost'])) {
sp_approve_post(false, sp_esc_int($_POST['approvepost']), $spVars['topicid']);
}
if (isset($_POST['unapprovepost'])) {
sp_unapprove_post(sp_esc_int($_POST['unapprovepost']));
}
if (isset($_POST['doqueue'])) {
sp_remove_waiting_queue();
}
if (isset($_POST['notifyuser'])) {
sp_post_notification(sp_esc_str($_POST['sp_notify_user']), sp_esc_str($_POST['message']), sp_esc_int($_POST['postid']));
}
# move a topic and redirect to that topic
if (isset($_POST['maketopicmove'])) {
if (empty($_POST['forumid'])) {
sp_notify(1, sp_text('Destination forum not selected'));
return;
}
sp_move_topic();
$forumslug = spdb_table(SFFORUMS, 'forum_id=' . sp_esc_int(sp_esc_int($_POST['forumid'])), 'forum_slug');
$topicslug = spdb_table(SFTOPICS, 'topic_id=' . sp_esc_int(sp_esc_int($_POST['currenttopicid'])), 'topic_slug');
$returnURL = sp_build_url($forumslug, $topicslug, 0);
sp_redirect($returnURL);
}
# move a post and redirect to the post
if (isset($_POST['makepostmove1']) || isset($_POST['makepostmove2']) || isset($_POST['makepostmove3'])) {
sp_move_post();
if (isset($_POST['makepostmove1'])) {
$returnURL = sp_permalink_from_postid(sp_esc_int($_POST['postid']));
sp_redirect($returnURL);
}
}
# cancel a post move
if (isset($_POST['cancelpostmove'])) {
$meta = sp_get_sfmeta('post_move', 'post_move');
if ($meta) {
$id = $meta[0]['meta_id'];
sp_delete_sfmeta($id);
unset($spGlobals['post_move']);
}
}
# rebuild the forum and post indexes
if (isset($_POST['rebuildforum']) || isset($_POST['rebuildtopic'])) {
sp_build_post_index(sp_esc_int($_POST['topicid']), true);
sp_build_forum_index(sp_esc_int($_POST['forumid']), false);
}
# Set display mode if topic view (for editing posts)
if ($spVars['pageview'] == 'topic' && isset($_POST['postedit'])) {
$spVars['displaymode'] = 'edit';
$spVars['postedit'] = $_POST['postedit'];
} else {
$spVars['displaymode'] = 'posts';
}
# clean cache of timed our records
sp_clean_cache();
#--Scratch Pad Area---Please Leave Here---------
#--End Scratch Pad Area-------------------------
# let other plugins check for posted actions
do_action('sph_setup_forum');
# do we use output buffering?
$ob = sp_get_option('sfuseob');
if ($ob) {
//.........这里部分代码省略.........