當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sp_get_sfmeta函數代碼示例

本文整理匯總了PHP中sp_get_sfmeta函數的典型用法代碼示例。如果您正苦於以下問題:PHP sp_get_sfmeta函數的具體用法?PHP sp_get_sfmeta怎麽用?PHP sp_get_sfmeta使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了sp_get_sfmeta函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sp_admin_bar_do_upgrade_check

function sp_admin_bar_do_upgrade_check()
{
    if (!sp_is_plugin_active('admin-bar/sp-admin-bar-plugin.php')) {
        return;
    }
    $options = sp_get_option('spAdminBar');
    $db = $options['dbversion'];
    if (empty($db)) {
        $db = 0;
    }
    # quick bail check
    if ($db == SPABDBVERSION) {
        return;
    }
    # apply upgrades as needed
    if ($db < 1) {
        # empty since plugin did not used db on initial release
    }
    if ($db < 2) {
        # set autoload flag to true for autoupdates
        $meta = sp_get_sfmeta('autoupdate', 'admin');
        if (!empty($meta[0])) {
            sp_update_sfmeta('autoupdate', 'admin', $meta[0]['meta_value'], $meta[0]['meta_id'], 1);
        }
    }
    if ($db < 3) {
        # permission for bypassing akismet checks
        sp_add_auth('bypass_akismet', __('Can bypass akismet check on posts', 'spab'), 1, 0, 0, 0, 3);
        sp_activate_auth('bypass_akismet');
    }
    # save data
    $options['dbversion'] = SPABDBVERSION;
    sp_update_option('spAdminBar', $options);
}
開發者ID:bself,項目名稱:nuimage-wp,代碼行數:34,代碼來源:sp-admin-bar-upgrade.php

示例2: sp_admin_bar_do_deactivate

function sp_admin_bar_do_deactivate()
{
    global $spGlobals;
    # remove the auth
    sp_deactivate_auth('bypass_akismet');
    # remove our auto update stuff
    $up = sp_get_sfmeta('autoupdate', 'admin');
    if ($up) {
        sp_delete_sfmeta($up[0]['meta_id']);
    }
}
開發者ID:bself,項目名稱:nuimage-wp,代碼行數:11,代碼來源:sp-admin-bar-uninstall.php

示例3: spa_get_mapping_data

function spa_get_mapping_data()
{
    # get default usergroups
    $sfoptions = array();
    $value = sp_get_sfmeta('default usergroup', 'sfmembers');
    $sfoptions['sfdefgroup'] = $value[0]['meta_value'];
    $value = sp_get_sfmeta('default usergroup', 'sfguests');
    $sfoptions['sfguestsgroup'] = $value[0]['meta_value'];
    $sfmemberopts = sp_get_option('sfmemberopts');
    $sfoptions['sfsinglemembership'] = $sfmemberopts['sfsinglemembership'];
    return $sfoptions;
}
開發者ID:brooklyntri,項目名稱:btc-plugins,代碼行數:12,代碼來源:spa-usergroups-prepare.php

示例4: spa_themes_css_form

function spa_themes_css_form()
{
    $css = '';
    $id = 0;
    # get current theme
    $curTheme = sp_get_option('sp_current_theme');
    $rec = sp_get_sfmeta('css', $curTheme['theme']);
    if ($rec) {
        $css = $rec[0]['meta_value'];
        $id = $rec[0]['meta_id'];
    }
    ?>
<script type="text/javascript">
jQuery(document).ready(function() {
	spjAjaxForm('speditcss', '');
});
</script>
<?php 
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=themes-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=css';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="speditcss" name="speditcss">
	<?php 
    echo sp_create_nonce('forum-adminform_css-editor');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('CSS Editor') . ' - ' . spa_text('Custom Simple:Press Theme CSS'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('CSS Editor'), true, 'css-editor');
    echo '<div>';
    echo '<textarea rows="25" name="spnewcontent" id="spnewcontent" tabindex="1">' . $css . '</textarea>';
    echo '<input type="hidden" name="metaId" value="' . $id . '" />';
    echo '</div>';
    spa_paint_close_fieldset();
    spa_paint_close_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 CSS');
    ?>
" />
    	</div>
<?php 
    spa_paint_close_tab();
    echo '</form>';
}
開發者ID:ashanrupasinghe,項目名稱:govforuminstalledlocal,代碼行數:48,代碼來源:spa-themes-css-form.php

示例5: sp_featured_admin_options_form

function sp_featured_admin_options_form()
{
    $meta = sp_get_sfmeta('featured', 'topics');
    $topics = implode(',', $meta[0]['meta_value']);
    $meta = sp_get_sfmeta('featured', 'posts');
    $posts = implode(',', $meta[0]['meta_value']);
    spa_paint_options_init();
    spa_paint_open_tab(__('Featured Topics and Posts Plugin', 'sp-featured'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(__('Featured Topics and Posts Options', 'sp-featured'), true, 'featured-lists');
    spa_paint_input(__('List of featured topic IDs', 'sp-featured'), 'topic_list', sp_filter_title_display($topics));
    spa_paint_input(__('List of featured post IDs', 'sp-featured'), 'post_list', sp_filter_title_display($posts));
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    spa_paint_close_container();
}
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:16,代碼來源:sp-featured-admin-options.php

示例6: sp_featured_do_install

function sp_featured_do_install()
{
    $options = sp_get_option('featured');
    if (empty($options)) {
        $options['dbversion'] = SPFEATUREDDBVERSION;
        sp_update_option('featured', $options);
    }
    # set up our sfmeta if needed
    $check = sp_get_sfmeta('featured', 'topics');
    if (empty($check)) {
        sp_add_sfmeta('featured', 'topics', array(), true);
    }
    $check = sp_get_sfmeta('featured', 'posts');
    if (empty($check)) {
        sp_add_sfmeta('featured', 'posts', array(), true);
    }
}
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:17,代碼來源:sp-featured-install.php

示例7: sp_rebuild_user_auths

function sp_rebuild_user_auths($userid)
{
    global $spGlobals;
    $user_auths = array();
    $user_auths['global'] = array();
    if (sp_is_forum_admin($userid)) {
        # forum admins get full auths
        $forums = spdb_table(SFFORUMS);
        if ($forums) {
            foreach ($forums as $forum) {
                foreach ($spGlobals['auths_map'] as $auth) {
                    if ($spGlobals['auths'][$auth]->admin_negate) {
                        $user_auths[$forum->forum_id][$auth] = 0;
                        $user_auths['global'][$auth] = 0;
                    } else {
                        $user_auths[$forum->forum_id][$auth] = 1;
                        $user_auths['global'][$auth] = 1;
                    }
                }
            }
        }
    } else {
        $memberships = sp_get_user_memberships($userid);
        if (empty($memberships)) {
            $value = sp_get_sfmeta('default usergroup', 'sfguests');
            $memberships[0]['usergroup_id'] = $value[0]['meta_value'];
        }
        # no memberships means no permissions
        if (empty($memberships)) {
            return;
        }
        # get the roles
        $roles_data = spdb_table(SFROLES, 0);
        foreach ($roles_data as $role) {
            $roles[$role->role_id] = unserialize($role->role_auths);
        }
        # now build auths for user
        foreach ($memberships as $membership) {
            # get the permissions for the membership
            $permissions = spdb_table(SFPERMISSIONS, 'usergroup_id=' . $membership['usergroup_id']);
            if ($permissions) {
                foreach ($permissions as $permission) {
                    if (!isset($user_auths[$permission->forum_id])) {
                        $user_auths[$permission->forum_id] = $roles[$permission->permission_role];
                    } else {
                        foreach (array_keys($roles[$permission->permission_role]) as $auth_id) {
                            if (!isset($user_auths[$permission->forum_id][$auth_id])) {
                                $user_auths[$permission->forum_id][$auth_id] = $roles[$permission->permission_role][$auth_id];
                            } else {
                                $user_auths[$permission->forum_id][$auth_id] |= $roles[$permission->permission_role][$auth_id];
                            }
                        }
                    }
                    foreach ($roles[$permission->permission_role] as $auth_id => $auth) {
                        if (empty($user_auths['global'][$auth_id])) {
                            $user_auths['global'][$auth_id] = $auth;
                        } else {
                            $user_auths['global'][$auth_id] |= $auth;
                        }
                    }
                }
            }
        }
    }
    # now save the user auths
    if (!empty($user_auths)) {
        if (!empty($userid)) {
            sp_update_member_item($userid, 'auths', $user_auths);
        } else {
            sp_update_option('sf_guest_auths', $user_auths);
        }
    }
    return $user_auths;
}
開發者ID:ashanrupasinghe,項目名稱:govforuminstalledlocal,代碼行數:74,代碼來源:sp-api-auths.php

示例8: __construct


//.........這裏部分代碼省略.........
         $this->ID = 0;
         $this->guest = true;
         $this->member = 0;
         $this->admin = false;
         $this->moderator = false;
         $this->display_name = 'guest';
         $this->guest_name = '';
         $this->guest_email = '';
         $this->usertype = 'Guest';
         $this->offmember = sp_check_unlogged_user();
         $this->timezone = 0;
         $this->timezone_string = '';
         $this->posts = 0;
         $this->avatar = '';
         $this->user_email = '';
         $this->auths = sp_get_option('sf_guest_auths');
         $this->memberships = sp_get_option('sf_guest_memberships');
         # plugins can add iterms for guests...
         if (!$small) {
             do_action_ref_array('sph_user_class_guest', array(&$this));
         } else {
             do_action_ref_array('sph_user_class_guest_small', array(&$this));
         }
     }
     # Only perform this last section if forum is operational
     if ($spStatus == 'ok') {
         # Ranking
         $this->rank = sp_get_user_forum_rank($this->usertype, $id, $this->posts);
         $this->special_rank = $this->member ? sp_get_user_special_ranks($id) : array();
         # if no memberships rebuild them and save
         if (empty($this->memberships)) {
             $memberships = array();
             if (!empty($id)) {
                 if (!$this->admin) {
                     # get the usergroup memberships for the user and save in sfmembers table
                     $memberships = sp_get_user_memberships($id);
                     sp_update_member_item($id, 'memberships', $memberships);
                 }
             } else {
                 # user is a guest or unassigned member so get the global permissions from the guest usergroup and save as option
                 $value = sp_get_sfmeta('default usergroup', 'sfguests');
                 $memberships[] = spdb_table(SFUSERGROUPS, 'usergroup_id=' . $value[0]['meta_value'], 'row', '', '', ARRAY_A);
                 sp_update_option('sf_guest_memberships', $memberships);
             }
             # put in the data
             $this->memberships = $memberships;
         }
         # if no auths rebuild them and save
         if (empty($this->auths)) {
             $this->auths = sp_rebuild_user_auths($id);
         }
     }
     $this->ip = sp_get_ip();
     $this->trackid = -1;
     # Things to do if user is current user
     if ($current) {
         # Set up editor type
         $spGlobals['editor'] = 0;
         # for a user...
         if ($this->member && !empty($this->editor)) {
             $spGlobals['editor'] = $this->editor;
         }
         # and if not defined or is for a guest...
         if ($spGlobals['editor'] == 0) {
             $defeditor = sp_get_option('speditor');
             if (!empty($defeditor)) {
                 $spGlobals['editor'] = $defeditor;
             }
         }
         # final check to ensure selected editor type is indeed available
         if ($spGlobals['editor'] == 0 || $spGlobals['editor'] == 1 && !defined('RICHTEXT') || $spGlobals['editor'] == 2 && !defined('HTML') || $spGlobals['editor'] == 3 && !defined('BBCODE')) {
             $spGlobals['editor'] = PLAINTEXT;
             if (defined('BBCODE')) {
                 $spGlobals['editor'] = BBCODE;
             }
             if (defined('HTML')) {
                 $spGlobals['editor'] = HTML;
             }
             if (defined('RICHTEXT')) {
                 $spGlobals['editor'] = RICHTEXT;
             }
         }
         # Grab any notices present
         if ($this->guest && !empty($this->guest_email)) {
             $this->user_notices = spdb_table(SFNOTICES, "guest_email='" . $this->guest_email . "'", '', $order = 'notice_id');
         } elseif ($this->member && !empty($this->user_email)) {
             $this->user_notices = spdb_table(SFNOTICES, "user_id=" . $this->ID, '', $order = 'notice_id');
         }
         # plugins can add iterms for the current user (so no small allowed here)
         do_action_ref_array('sph_current_user_class', array(&$this));
     }
     # Finally filter the data for display
     foreach ($includeList as $item => $filter) {
         if (property_exists($this, $item)) {
             $this->{$item} = spUser_filter_item($this->{$item}, $filter);
         }
     }
     # allow plugins to add items to user class - regardless small or otherwise, current or otherwise
     do_action_ref_array('sph_user_class', array(&$this));
 }
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:101,代碼來源:sp-api-class-user.php

示例9: spa_check_warnings

function spa_check_warnings()
{
    global $spGlobals;
    # not perfect but we can use this call tyo perform any minor
    # cleanups that may be necessary... so
    # drop any existing temp members table...
    spdb_query('DROP TABLE IF EXISTS sftempmembers');
    $mess = '';
    # check if sp core, plugins or themes update available
    $update = false;
    $update_msg = '';
    $up = get_site_transient('update_plugins');
    if (!empty($up->response)) {
        foreach ($up->response as $plugin) {
            if ($plugin->slug == 'simple-press') {
                $msg = apply_filters('sph_core_update_notice', spa_text('There is a Simple:Press core update available.'));
                if (!empty($msg)) {
                    $update = true;
                    $update_msg .= $msg . '<br />';
                }
                break;
            }
        }
    }
    $up = get_site_transient('sp_update_plugins');
    if (!empty($up)) {
        $msg = apply_filters('sph_plugins_update_notice', spa_text('There is one or more Simple:Press plugin updates available'));
        if (!empty($msg)) {
            $update = true;
            $update_msg .= $msg . '<br />';
        }
    }
    $up = get_site_transient('sp_update_themes');
    if (!empty($up)) {
        $msg = apply_filters('sph_themes_update_notice', spa_text('There is one or more Simple:Press theme updates available'));
        if (!empty($msg)) {
            $update = true;
            $update_msg .= $msg . '<br />';
        }
    }
    if ($update) {
        if (is_main_site()) {
            $mess .= apply_filters('sph_updates_notice', spa_message($update_msg . '<a href="' . self_admin_url('update-core.php') . '">' . spa_text('Click here to view any updates.') . '</a>'));
        } else {
            $mess .= apply_filters('sph_updates_notice', spa_message(spa_text('There are some Simple:Press updates avaialable. You may want to notify the network site admin.')));
        }
    }
    # output warning if no SPF admins are defined
    $a = $spGlobals['forum-admins'];
    if (empty($a)) {
        $mess .= spa_message(spa_text('Warning - There are no SPF admins defined!	 All WP admins now have SP backend access'), 'error');
    }
    # Check if	desktop, tablet and mobile themes are selected and available
    $cur = sp_get_option('sp_current_theme');
    if (empty($cur)) {
        $mess .= spa_message(spa_text('No main theme has been selected and SP will be unable to display correctly. Please select a theme from the Themes panel'), 'error');
    } else {
        $nostylesheet = !file_exists(SPTHEMEBASEDIR . $cur['theme'] . '/styles/' . $cur['style']);
        $nooverlay = !empty($cur['color']) && !file_exists(SPTHEMEBASEDIR . $cur['theme'] . '/styles/overlays/' . $cur['color'] . '.php');
        $nopoverlay = !empty($cur['color']) && !empty($cur['parent']) && !file_exists(SPTHEMEBASEDIR . $cur['parent'] . '/styles/overlays/' . $cur['color'] . '.php');
        if ($nostylesheet || $nooverlay && $nopoverlay) {
            $mess .= spa_message(spa_text('Either the theme CSS file and/or color Overlay file from the selected theme is missing'), 'error');
        }
    }
    $mobile = sp_get_option('sp_mobile_theme');
    if (!empty($mobile) && $mobile['active']) {
        $nostylesheet = !file_exists(SPTHEMEBASEDIR . $mobile['theme'] . '/styles/' . $mobile['style']);
        $nooverlay = !empty($mobile['color']) && !file_exists(SPTHEMEBASEDIR . $mobile['theme'] . '/styles/overlays/' . $mobile['color'] . '.php');
        $nopoverlay = !empty($mobile['color']) && !empty($mobile['parent']) && !file_exists(SPTHEMEBASEDIR . $mobile['parent'] . '/styles/overlays/' . $mobile['color'] . '.php');
        if ($nostylesheet || $nooverlay && $nopoverlay) {
            $mess .= spa_message(spa_text('Either the mobile theme CSS file and/or color Overlay file from the selected mobile theme is missing'), 'error');
        }
    }
    $tablet = sp_get_option('sp_tablet_theme');
    if (!empty($tablet) && $tablet['active']) {
        $nostylesheet = !file_exists(SPTHEMEBASEDIR . $tablet['theme'] . '/styles/' . $tablet['style']);
        $nooverlay = !empty($tablet['color']) && !file_exists(SPTHEMEBASEDIR . $tablet['theme'] . '/styles/overlays/' . $tablet['color'] . '.php');
        $nopoverlay = !empty($tablet['color']) && !empty($tablet['parent']) && !file_exists(SPTHEMEBASEDIR . $tablet['parent'] . '/styles/overlays/' . $tablet['color'] . '.php');
        if ($nostylesheet || $nooverlay && $nopoverlay) {
            $mess .= spa_message(spa_text('Either the tablet theme CSS file and/or color Overlay file from the selected tablet theme is missing'), 'error');
        }
    }
    # check for missing default members user group
    $value = sp_get_sfmeta('default usergroup', 'sfmembers');
    $ugid = spdb_table(SFUSERGROUPS, "usergroup_id={$value[0]['meta_value']}", 'usergroup_id');
    if (empty($ugid)) {
        $mess .= spa_message(spa_text('Warning - The default user group for new members is undefined!	Please visit the SP usergroups admin page, map users to usergroups tab and set the default user group'), 'error');
    }
    # check for missing default guest user group
    $value = sp_get_sfmeta('default usergroup', 'sfguests');
    $ugid = spdb_table(SFUSERGROUPS, "usergroup_id={$value[0]['meta_value']}", 'usergroup_id');
    if (empty($ugid)) {
        $mess .= spa_message(spa_text('Warning - The default user group for guests is undefined!  Please visit the SP usergroups admin page, map users to usergroups tab and set the default user group'), 'error');
    }
    # check for unreachable forums because of permissions
    $done = 0;
    $usergroups = spdb_table(SFUSERGROUPS);
    if ($usergroups) {
        $has_members = false;
        foreach ($usergroups as $usergroup) {
//.........這裏部分代碼省略.........
開發者ID:brooklyntri,項目名稱:btc-plugins,代碼行數:101,代碼來源:spa-admin-framework.php

示例10: sp_topicview_query


//.........這裏部分代碼省略.........
                    $t[$tidx]->posts[$pidx]->first_post_on_page = $firstPostPage;
                    $t[$tidx]->posts[$pidx]->editmode = 0;
                    $t[$tidx]->posts[$pidx]->post_content = sp_filter_content_display($r->post_content);
                    $t[$tidx]->posts[$pidx]->first_pinned = 0;
                    $t[$tidx]->posts[$pidx]->last_pinned = 0;
                    $t[$tidx]->posts[$pidx]->postUser = new stdClass();
                    $t[$tidx]->posts[$pidx]->postUser = clone sp_get_user($r->user_id, $cUser, $cSmall);
                    # populate the user guest name and email in case the poster is a guest
                    if ($r->user_id == 0) {
                        $t[$tidx]->posts[$pidx]->postUser->guest_name = $t[$tidx]->posts[$pidx]->guest_name;
                        $t[$tidx]->posts[$pidx]->postUser->guest_email = $t[$tidx]->posts[$pidx]->guest_email;
                        $t[$tidx]->posts[$pidx]->postUser->display_name = $t[$tidx]->posts[$pidx]->guest_name;
                        $t[$tidx]->posts[$pidx]->postUser->ip = $t[$tidx]->posts[$pidx]->poster_ip;
                    }
                    # pinned status
                    if ($firstPostPage == 1 && $r->post_pinned) {
                        $t[$tidx]->posts[$pidx]->first_pinned = true;
                        $pinned = $pidx;
                    }
                    if ($firstPostPage == 0 && $pinned > 0 && $r->post_pinned == false) {
                        $t[$tidx]->posts[$pinned]->last_pinned = true;
                    } elseif ($r->post_pinned) {
                        $pinned = $pidx;
                    }
                    $firstPostPage = 0;
                    # Is this a new post for the current user?
                    if ($spThisUser->guest) {
                        $newPostFlag = false;
                    } else {
                        if ($maybeNewPost && strtotime($r->post_date) > strtotime($spThisUser->lastvisit)) {
                            $newPostFlag = true;
                        }
                        if (isset($r->new_post)) {
                            $newPostFlag = true;
                        }
                    }
                    $t[$tidx]->posts[$pidx]->new_post = $newPostFlag;
                    # do we need to hide an admin post?
                    if (!sp_get_auth('view_admin_posts', $r->forum_id) && sp_is_forum_admin($r->user_id)) {
                        $adminview = sp_get_sfmeta('adminview', 'message');
                        if ($adminview) {
                            $t[$tidx]->posts[$pidx]->post_content = '<div class="spMessage">';
                            $t[$tidx]->posts[$pidx]->post_content .= sp_filter_text_display($adminview[0]['meta_value']);
                            $t[$tidx]->posts[$pidx]->post_content .= '</div>';
                        } else {
                            $t[$tidx]->posts[$pidx]->post_content = '';
                        }
                    }
                    # do we need to hide an others posts?
                    if (sp_get_auth('view_own_admin_posts', $r->forum_id) && !sp_is_forum_admin($r->user_id) && !sp_is_forum_mod($r->user_id) && $spThisUser->ID != $r->user_id) {
                        $userview = sp_get_sfmeta('userview', 'message');
                        if ($userview) {
                            $t[$tidx]->posts[$pidx]->post_content = '<div class="spMessage">';
                            $t[$tidx]->posts[$pidx]->post_content .= sp_filter_text_display($userview[0]['meta_value']);
                            $t[$tidx]->posts[$pidx]->post_content .= '</div>';
                        } else {
                            $t[$tidx]->posts[$pidx]->post_content = '';
                        }
                    }
                    # Is this post to be edited?
                    if ($spVars['displaymode'] == 'edit' && $spVars['postedit'] == $r->post_id) {
                        $t[$tidx]->editmode = 1;
                        $t[$tidx]->editpost_id = $r->post_id;
                        $t[$tidx]->editpost_content = sp_filter_content_edit($r->post_content);
                        $t[$tidx]->posts[$pidx]->editmode = 1;
                    }
                    # Add edit history
                    if (!empty($r->post_edit) && is_serialized($r->post_edit)) {
                        $edits = unserialize($r->post_edit);
                        $eidx = 0;
                        foreach ($edits as $e) {
                            $t[$tidx]->posts[$pidx]->edits[$eidx] = new stdClass();
                            $t[$tidx]->posts[$pidx]->edits[$eidx]->by = $e['by'];
                            $t[$tidx]->posts[$pidx]->edits[$eidx]->at = $e['at'];
                            $eidx++;
                        }
                    }
                    if (!in_array($r->user_id, $u)) {
                        $u[] = $r->user_id;
                    }
                    $t[$tidx]->posts[$pidx] = apply_filters('sph_topicview_post_records', $t[$tidx]->posts[$pidx], $r);
                }
                # index of post IDs with position in listing
                $t[$tidx]->post_keys = $p;
                $t[$tidx]->posts[$pidx]->last_post = $lastpage;
                $t[$tidx]->posts[$pidx]->last_post_on_page = 1;
                # save last post on page id
                $t[$tidx]->last_post_id = $r->post_id;
                # allow plugins to add more data to combined topic/post data structure
                $t[$tidx] = apply_filters('sph_topicview_combined_data', $t[$tidx], $p, $u);
                unset($records);
            } else {
                # check for view forum lists but not topic lists
                if (sp_can_view($r->forum_id, 'forum-title')) {
                    $this->topicViewStatus = 'sneak peek';
                }
            }
        }
        return $t;
    }
開發者ID:ashanrupasinghe,項目名稱:govforuminstalledlocal,代碼行數:101,代碼來源:sp-topic-view-class.php

示例11: sp_filter_name_display

        echo '<ul class="memberlist">';
        for ($x = 0; $x < count($users); $x++) {
            echo '<li>' . sp_filter_name_display($users[$x]) . '</li>';
        }
        echo '</ul>';
    } else {
        spa_etext('No users with this special rank');
    }
    echo '</fieldset>';
}
if ($action == 'delsmiley') {
    $file = sp_esc_str($_GET['file']);
    $path = SF_STORE_DIR . '/' . $spPaths['smileys'] . '/' . $file;
    @unlink($path);
    # load smiles from sfmeta
    $meta = sp_get_sfmeta('smileys', 'smileys');
    # now cycle through to remove this entry and resave
    if (!empty($meta[0]['meta_value'])) {
        $newsmileys = array();
        foreach ($meta[0]['meta_value'] as $name => $info) {
            if ($info[0] != $file) {
                $newsmileys[$name][0] = sp_filter_title_save($info[0]);
                $newsmileys[$name][1] = sp_filter_name_save($info[1]);
                $newsmileys[$name][2] = sp_filter_name_save($info[2]);
                $newsmileys[$name][3] = $info[3];
                $newsmileys[$name][4] = $info[4];
            }
        }
        sp_update_sfmeta('smileys', 'smileys', $newsmileys, $meta[0]['meta_id'], true);
    }
    echo '1';
開發者ID:brooklyntri,項目名稱:btc-plugins,代碼行數:31,代碼來源:spa-ahah-components.php

示例12: sp_esc_int

$batchSQL = sp_esc_int($_GET['batchNum']);
$where = ' WHERE admin=0';
if ($_GET['ignoremods']) {
    $where .= ' AND moderator=0';
}
$users = spdb_select('col', 'SELECT user_id FROM ' . SFMEMBERS . $where . ' ORDER BY user_id LIMIT ' . $startSQL . ', ' . $batchSQL);
if ($users) {
    $value = sp_get_sfmeta('default usergroup', 'sfmembers');
    $defaultUG = $value[0]['meta_value'];
    foreach ($users as $thisUser) {
        if ($_GET['mapoption'] == 2) {
            spdb_query('DELETE FROM ' . SFMEMBERSHIPS . ' WHERE user_id=' . $thisUser);
        }
        $user = new WP_User($thisUser);
        if (!empty($user->roles) && is_array($user->roles)) {
            foreach ($user->roles as $role) {
                $value = sp_get_sfmeta('default usergroup', $role);
                if (!empty($value)) {
                    $ug = $value[0]['meta_value'];
                } else {
                    $ug = $defaultUG;
                }
                sp_add_membership($ug, $thisUser);
            }
        }
    }
    # clean up
    sp_reset_memberships();
    sp_reset_auths();
}
die;
開發者ID:brooklyntri,項目名稱:btc-plugins,代碼行數:31,代碼來源:spa-ahah-map-users.php

示例13: sp_get_forum_memberships

function sp_get_forum_memberships()
{
    global $spThisUser;
    if ($spThisUser->admin) {
        $sql = 'SELECT forum_id FROM ' . SFFORUMS;
    } else {
        if ($spThisUser->guest) {
            $value = sp_get_sfmeta('default usergroup', 'sfguests');
            $sql = 'SELECT forum_id FROM ' . SFPERMISSIONS . " WHERE usergroup_id={$value[0]['meta_value']}";
        } else {
            $sql = 'SELECT forum_id
				FROM ' . SFPERMISSIONS . '
				JOIN ' . SFMEMBERSHIPS . ' ON ' . SFPERMISSIONS . '.usergroup_id = ' . SFMEMBERSHIPS . '.usergroup_id
				WHERE user_id=' . $spThisUser->ID;
        }
    }
    $forums = spdb_select('set', $sql);
    $fids = array();
    if ($forums) {
        foreach ($forums as $thisForum) {
            if (sp_get_auth('view_forum', $thisForum->forum_id) || sp_get_auth('view_forum_lists', $thisForum->forum_id) || sp_get_auth('view_forum_topic_lists', $thisForum->forum_id)) {
                $fids[] = $thisForum->forum_id;
            }
        }
    }
    return $fids;
}
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:27,代碼來源:sp-api-users.php

示例14: spa_usergroups_map_users

function spa_usergroups_map_users()
{
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
    	jQuery('#sfmapsettingsform').ajaxForm({
    		target: '#sfmsgspot',
    		success: function() {
    			jQuery('#sfreloadmu').click();
    			jQuery('#sfmsgspot').fadeIn();
    			jQuery('#sfmsgspot').fadeOut(6000);
    		}
    	});
    	jQuery('#sfmapusersform').ajaxForm({
    		target: '#sfmsgspot',
    	});
    });
</script>
<?php 
    global $wp_roles;
    $sfoptions = spa_get_mapping_data();
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mapsettings';
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmapsettingsform" name="sfmapsettingsform">
	<?php 
    echo sp_create_nonce('forum-adminform_mapusers');
    spa_paint_options_init();
    spa_paint_open_tab(spa_text('User Groups') . ' - ' . spa_text('User Mapping Settings'), true);
    spa_paint_open_panel();
    spa_paint_open_fieldset(spa_text('User Memberships'), true, 'user-memberships');
    echo '<tr><td colspan="2"><br /><div class="sfoptionerror">';
    spa_etext('Warning: Use caution when setting the single usergroup membership option below. It should primarily be used in conjunction with a membership plugin (such as Wishlist) where strict usergroup membership is required.  Please note that auto usergroup membership by WP role or by forum rank may conflict or overwrite any manual usergroup memberships (such as moderator) you may set if you have single usergroup membership set');
    echo '</div><br />';
    echo '</td></tr>';
    spa_paint_checkbox(spa_text('Users are limited to single usergroup membership'), 'sfsinglemembership', $sfoptions['sfsinglemembership']);
    echo '<tr><td colspan="2"><p class="subhead">' . spa_text('Default usergroup membership') . ':</p></td></tr>';
    spa_paint_select_start(spa_text('Default usergroup for guests'), 'sfguestsgroup', 'sfguestsgroup');
    echo spa_create_usergroup_select($sfoptions['sfguestsgroup']);
    spa_paint_select_end();
    spa_paint_select_start(spa_text('Default usergroup for new members'), 'sfdefgroup', 'sfdefgroup');
    echo spa_create_usergroup_select($sfoptions['sfdefgroup']);
    spa_paint_select_end();
    $roles = array_keys($wp_roles->role_names);
    if ($roles) {
        echo '<tr><td colspan="2"><p class="subhead">' . spa_text('Usergroup memberships based on WP role') . ':</p></td></tr>';
        $sfoptions['role'] = array();
        foreach ($roles as $index => $role) {
            $value = sp_get_sfmeta('default usergroup', $role);
            if ($value) {
                $group = $value[0]['meta_value'];
            } else {
                $group = $sfoptions['sfdefgroup'];
            }
            echo '<input type="hidden" class="sfhiddeninput" name="sfoldrole[' . $index . ']" value="' . $group . '" />';
            spa_paint_select_start(spa_text('Default usergroup for') . ' ' . $role, "sfrole[{$index}]", 'sfguestsgroup');
            echo spa_create_usergroup_select($group);
            spa_paint_select_end();
        }
    }
    spa_paint_close_fieldset();
    spa_paint_close_panel();
    do_action('sph_usergroups_mapping_settings_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 Mapping Settings');
    ?>
" />
	</div>
	</form>
	<?php 
    spa_paint_close_tab();
    ?>

	<div class="sfform-panel-spacer"></div>
<?php 
    $ahahURL = SFHOMEURL . 'index.php?sp_ahah=usergroups-loader&amp;sfnonce=' . wp_create_nonce('forum-ahah') . '&amp;saveform=mapusers';
    $uCount = spdb_count(SFMEMBERS);
    $url = SFHOMEURL . 'index.php?sp_ahah=usermapping&amp;sfnonce=' . wp_create_nonce('forum-ahah');
    $target = 'sfmsgspot';
    $smessage = esc_js(spa_text('Please Wait - Processing'));
    $emessage = $uCount . ' ' . esc_js(spa_text('Users mapped'));
    ?>
	<form action="<?php 
    echo $ahahURL;
    ?>
" method="post" id="sfmapusersform" name="sfmapusersform" onsubmit="spjBatch('sfmapusersform', '<?php 
    echo $url;
    ?>
', '<?php 
    echo $target;
    ?>
', '<?php 
    echo $smessage;
    ?>
', '<?php 
//.........這裏部分代碼省略.........
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:101,代碼來源:spa-usergroups-map-users.php

示例15: sp_do_sp_FeaturedPostsTag

function sp_do_sp_FeaturedPostsTag($args = '')
{
    #check if forum displayed
    if (sp_abort_display_forum()) {
        return;
    }
    $defs = array('tagId' => 'spFeaturedPostsTag', 'tagClass' => 'spListTag', 'listId' => 'spListItemTag%ID%', 'listClass' => 'spListItemTag', 'linkClass' => 'spLinkTag', 'textClass' => 'spTextTag', 'avatarClass' => 'spAvatarTag', 'listTags' => 1, 'postIds' => '', 'limit' => 5, 'itemOrder' => 'FTUD', 'linkScope' => 'forum', 'beforeForum' => __('Forum: ', 'sp-featured'), 'afterForum' => '<br />', 'beforeTopic' => __('Topic: ', 'sp-featured'), 'afterTopic' => '<br />', 'beforeUser' => __('By: ', 'sp-featured'), 'afterUser' => '', 'beforeDate' => '&nbsp;-', 'afterDate' => '<br />', 'avatarSize' => 25, 'niceDate' => 1, 'postTip' => 1, 'beforePost' => __('Post: ', 'sp-featured'), 'afterPost' => '<br />', 'echo' => 1);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_FeaturedPostsTag_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagId = esc_attr($tagId);
    $tagClass = esc_attr($tagClass);
    $listClass = esc_attr($listClass);
    $listId = esc_attr($listId);
    $linkClass = esc_attr($linkClass);
    $textClass = esc_attr($textClass);
    $avatarClass = esc_attr($avatarClass);
    $listTags = (int) $listTags;
    $postIds = esc_attr($postIds);
    $limit = (int) $limit;
    $itemOrder = esc_attr($itemOrder);
    $linkScope = esc_attr($linkScope);
    $beforeForum = sp_filter_title_display($beforeForum);
    $afterForum = sp_filter_title_display($afterForum);
    $beforeTopic = sp_filter_title_display($beforeTopic);
    $afterTopic = sp_filter_title_display($afterTopic);
    $beforeUser = sp_filter_title_display($beforeUser);
    $afterUser = sp_filter_title_display($afterUser);
    $beforeDate = sp_filter_title_display($beforeDate);
    $afterDate = sp_filter_title_display($afterDate);
    $avatarSize = (int) $avatarSize;
    $niceDate = (int) $niceDate;
    $postTip = (int) $postTip;
    $beforePost = sp_filter_title_display($beforePost);
    $afterPst = sp_filter_title_display($afterPost);
    $echo = (int) $echo;
    sp_forum_api_support();
    global $spPostList, $spThisPostList;
    # do we have post ids specified?
    if (empty($postIds)) {
        $posts = sp_get_sfmeta('featured', 'posts');
        $postIds = implode(',', $posts[0]['meta_value']);
    }
    $where = SFPOSTS . '.post_id IN (' . $postIds . ')';
    $spPostList = new spPostList($where, SFPOSTS . '.post_id DESC', $limit);
    if (empty($spPostList)) {
        return;
    }
    if (!empty($beforeForum)) {
        $beforeForum = trim($beforeForum) . ' ';
    }
    if (!empty($beforeTopic)) {
        $beforeTopic = trim($beforeTopic) . ' ';
    }
    if (!empty($beforeUser)) {
        $beforeUser = trim($beforeUser) . ' ';
    }
    if (!empty($beforeDate)) {
        $beforeDate = trim($beforeDate) . ' ';
    }
    if (!empty($afterForum)) {
        $afterForum = ' ' . trim($afterForum);
    }
    if (!empty($afterTopic)) {
        $afterTopic = ' ' . trim($afterTopic);
    }
    if (!empty($afterUser)) {
        $afterUser = ' ' . trim($afterUser);
    }
    if (!empty($afterDate)) {
        $afterDate = ' ' . trim($afterDate);
    }
    $fLink = $tLink = $aLink = false;
    if ($linkScope == 'forum') {
        $fLink = $tLink = true;
    }
    if ($linkScope == 'all') {
        $aLink = true;
    }
    # Start building dislay
    if ($listTags ? $out = "<ul id='{$tagId}' class='{$tagClass}'>" : ($out = "<div id='{$tagId}' class='{$tagClass}'>")) {
    }
    # start the loop
    if (sp_has_postlist()) {
        while (sp_loop_postlist()) {
            sp_the_postlist();
            $thisId = str_ireplace('%ID%', $spThisPostList->topic_id, $listId);
            if ($listTags ? $out .= "<li id='{$thisId}' class='{$listClass}'>" : ($out .= "<div id='{$thisId}' class='{$listClass}'>")) {
            }
            $title = $postTip ? "title='{$spThisPostList->post_tip}'" : '';
            if ($aLink) {
                $out .= "<a class='{$linkClass}' {$title} href='{$spThisPostList->post_permalink}'>";
            }
            for ($x = 0; $x < strlen($itemOrder); $x++) {
                switch (substr($itemOrder, $x, 1)) {
                    case 'F':
                        # Forum
                        $out .= $beforeForum;
                        if ($fLink) {
//.........這裏部分代碼省略.........
開發者ID:Bakerpedia,項目名稱:Developement_WPengine,代碼行數:101,代碼來源:sp-featured-posts-tag.php


注:本文中的sp_get_sfmeta函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。