本文整理汇总了PHP中spdb_select函数的典型用法代码示例。如果您正苦于以下问题:PHP spdb_select函数的具体用法?PHP spdb_select怎么用?PHP spdb_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spdb_select函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sp_cron_remove_users
function sp_cron_remove_users()
{
require_once ABSPATH . 'wp-admin/includes/user.php';
# make sure auto removal is enabled
$sfuser = sp_get_option('sfuserremoval');
if ($sfuser['sfuserremove']) {
# see if removing users with no posts
if ($sfuser['sfusernoposts']) {
$users = spdb_select('set', 'SELECT ' . SFUSERS . '.ID FROM ' . SFUSERS . '
JOIN ' . SFMEMBERS . ' on ' . SFUSERS . '.ID = ' . SFMEMBERS . '.user_id
LEFT JOIN ' . SFWPPOSTS . ' ON ' . SFUSERS . '.ID = ' . SFWPPOSTS . '.post_author
WHERE user_registered < DATE_SUB(NOW(), INTERVAL ' . $sfuser['sfuserperiod'] . ' DAY)
AND post_author IS NULL
AND posts < 1');
if ($users) {
foreach ($users as $user) {
wp_delete_user($user->ID);
}
}
}
# see if removing inactive users
if ($sfuser['sfuserinactive']) {
$users = spdb_table(SFMEMBERS, 'lastvisit < DATE_SUB(NOW(), INTERVAL ' . $sfuser['sfuserperiod'] . ' DAY)');
if ($users) {
foreach ($users as $user) {
wp_delete_user($user->user_id);
}
}
}
} else {
wp_clear_scheduled_hook('sph_cron_user');
}
do_action('sph_remove_users_cron');
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:34,代码来源:sp-site-cron.php
示例2: spa_get_log_data
function spa_get_log_data()
{
$sflog = array();
$sql = '
SELECT install_date, release_type, version, build, display_name
FROM ' . SFLOG . '
JOIN ' . SFMEMBERS . ' ON ' . SFLOG . '.user_id=' . SFMEMBERS . '.user_id
ORDER BY id DESC;';
$sflog = spdb_select('set', $sql, ARRAY_A);
return $sflog;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:11,代码来源:spa-toolbox-prepare.php
示例3: sp_rebuild_table_list
function sp_rebuild_table_list()
{
global $tables;
sp_delete_option('installed_tables');
$t = array();
foreach ($tables as $table => $data) {
$found = spdb_select('var', "SHOW TABLES LIKE '{$table}'");
if ($found) {
$t[] = $table;
}
}
sp_add_option('installed_tables', $t);
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:13,代码来源:sp-schema.php
示例4: sp_update_users_newposts
function sp_update_users_newposts()
{
global $spThisUser;
# Check the users checktime against the last post timestamp to see if we need to do this
$checkTime = spdb_zone_mysql_checkdate($spThisUser->checktime);
$postTime = sp_get_option('poststamp');
if (strtotime($checkTime) > strtotime($postTime) && !isset($_GET['mark-read'])) {
return;
}
# so there must have been a new post since the last page load for this user
$newPostList = $spThisUser->newposts;
if (empty($newPostList['topics'])) {
# clean it up to be on the safe side
unset($newPostList);
$newPostList = array();
$newPostList['topics'] = array();
$newPostList['forums'] = array();
}
# create new holding array and new checktime (now)
$addPostList = array();
$addPostList['topics'] = array();
$addPostList['forums'] = array();
sp_set_server_timezone();
$newCheckTime = sp_apply_timezone(time(), 'mysql');
# Use the current checktime for any new posts since users session began
$records = spdb_select('set', "SELECT DISTINCT topic_id, forum_id FROM " . SFPOSTS . "\n\t\t\t\t\t\t\t\t WHERE post_status = 0 AND post_date > '" . $checkTime . "' AND user_id != " . $spThisUser->ID . "\n\t\t\t\t\t\t\t\t ORDER BY post_id DESC LIMIT " . $spThisUser->unreadposts . ";", ARRAY_A);
if ($records) {
foreach ($records as $r) {
if (sp_get_auth('view_forum', $r['forum_id']) && !in_array($r['topic_id'], $newPostList['topics'])) {
$addPostList['topics'][] = $r['topic_id'];
$addPostList['forums'][] = $r['forum_id'];
}
}
}
$addPostList = apply_filters('sph_new_post_list', $addPostList, $newPostList);
# now merge the arrays and truncate if necessary
$newPostList['topics'] = array_merge($addPostList['topics'], $newPostList['topics']);
$newPostList['forums'] = array_merge($addPostList['forums'], $newPostList['forums']);
if (count($newPostList['topics']) > $spThisUser->unreadposts) {
array_splice($newPostList['topics'], $spThisUser->unreadposts);
array_splice($newPostList['forums'], $spThisUser->unreadposts);
}
# update sfmembers - do it here to ensure both are updated together
spdb_query("UPDATE " . SFMEMBERS . " SET newposts='" . serialize($newPostList) . "', checktime='" . $newCheckTime . "' WHERE user_id=" . $spThisUser->ID);
$spThisUser->newpostlist = true;
$spThisUser->checktime = $newCheckTime;
$spThisUser->newposts = $newPostList;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:48,代码来源:sp-db-newposts.php
示例5: sp_setup_globals
function sp_setup_globals()
{
global $spGlobals, $current_user, $spBootCache, $spMeta, $spDevice;
if ($spBootCache['globals'] == true) {
return;
}
# Main admin options
$spGlobals['admin'] = sp_get_option('sfadminsettings');
$spGlobals['lockdown'] = sp_get_option('sflockdown');
$spGlobals['editor'] = 0;
# Display array
$spGlobals['display'] = sp_get_option('sfdisplay');
# Current theme data
$spGlobals['theme'] = sp_get_current_sp_theme();
# if mobile device then force integrated editor toolbar to on
if ($spDevice == 'mobile' || $spDevice == 'tablet') {
$spGlobals['display']['editor']['toolbar'] = true;
if ($spDevice == 'mobile') {
$spGlobals['mobile-display'] = sp_get_option('sp_mobile_theme');
} else {
$spGlobals['mobile-display'] = sp_get_option('sp_tablet_theme');
}
}
# Load up sfmeta
$spMeta = spdb_table(SFMETA, 'autoload=1');
if (!empty($spMeta)) {
foreach ($spMeta as $s) {
if (!empty($s)) {
$spGlobals[$s->meta_type][$s->meta_key] = maybe_unserialize($s->meta_value);
}
}
}
# create topic/post cache if found to be missing!
if (!isset($spGlobals['topic_cache']['new']) || empty($spGlobals['topic_cache']['new'])) {
$spGlobals['topic_cache']['new'] = sp_rebuild_topic_cache();
}
# Pre-define a few others
$spGlobals['canonicalurl'] = false;
# set up array of disabled forums
$spGlobals['disabled_forums'] = spdb_select('col', 'SELECT forum_id FROM ' . SFFORUMS . ' WHERE forum_disabled=1', ARRAY_A);
$spBootCache['globals'] = true;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:42,代码来源:sp-api-globals.php
示例6: sp_rebuild_topic_cache
function sp_rebuild_topic_cache()
{
$size = sp_get_option('topic_cache');
if (!isset($size) || $size == 0) {
sp_add_option('topic_cache', 200);
}
$sql = "SELECT DISTINCTROW forum_id, topic_id, post_id, post_status\n\t\t\tFROM " . SFPOSTS . "\n\t\t\tORDER BY post_id DESC\n\t\t\tLIMIT {$size}";
$topics = spdb_select('set', $sql, ARRAY_N);
if ($topics) {
sp_add_sfmeta('topic_cache', 'new', $topics, true);
}
# Delete group level cache for good measure
spdb_query("DELETE FROM " . SFCACHE . " WHERE cache_id LIKE '%*group'");
return $topics;
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:15,代码来源:sp-api-cache.php
示例7: sp_topicview_query
//.........这里部分代码省略.........
}
$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;
# user calc_rows and nor post_count as - for example - some posts may be hiodden by choice.
$t[$tidx]->post_count = spdb_select('var', 'SELECT FOUND_ROWS()');
# Can the user create new topics or should we lock the forum?
$t[$tidx]->start_topics = sp_get_auth('start_topics', $r->forum_id);
$t[$tidx]->reply_topics = sp_get_auth('reply_topics', $r->forum_id);
$t[$tidx]->reply_own_topics = sp_get_auth('reply_own_topics', $r->forum_id);
# grab topic start info
$t[$tidx]->topic_starter = $r->topic_starter;
$totalPages = $r->post_count / $ppaged;
if (!is_int($totalPages)) {
$totalPages = intval($totalPages) + 1;
}
$t[$tidx]->total_pages = $totalPages;
if ($setSort xor $reverse) {
if ($cPage == 1) {
$lastpage = true;
}
} else {
if ($cPage == $totalPages) {
$lastpage = true;
}
}
$t[$tidx]->last_page = $lastpage;
$t[$tidx] = apply_filters('sph_topicview_topic_record', $t[$tidx], $r);
reset($records);
unset($r);
# now loop through the post records
$newPostFlag = false;
$firstPostPage = 1;
$pinned = 0;
# define post id and post user id arrays for plugins to use in combined filter
$p = array();
$u = array();
foreach ($records as $r) {
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:67,代码来源:sp-topic-view-class.php
示例8: sp_esc_int
}
if ($action == 'del_specialrank') {
$key = sp_esc_int($_GET['key']);
$specialRank = sp_get_sfmeta('special_rank', false, $key);
# remove members rank first
spdb_query('DELETE FROM ' . SFSPECIALRANKS . ' WHERE special_rank="' . $specialRank[0]['meta_key'] . '"');
# remove the forum rank
$sql = 'DELETE FROM ' . SFMETA . " WHERE meta_type='special_rank' AND meta_id='{$key}'";
spdb_query($sql);
}
if ($action == 'show') {
$key = sp_esc_int($_GET['key']);
$specialRank = sp_get_sfmeta('special_rank', false, $key);
$users = spdb_select('col', 'SELECT display_name
FROM ' . SFSPECIALRANKS . '
JOIN ' . SFMEMBERS . ' ON ' . SFSPECIALRANKS . '.user_id = ' . SFMEMBERS . '.user_id
WHERE special_rank = "' . $specialRank[0]['meta_key'] . '"
ORDER BY display_name');
echo '<fieldset class="sfsubfieldset">';
echo '<legend>' . spa_text('Special Rank Members') . '</legend>';
if ($users) {
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>';
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:spa-ahah-components.php
示例9: sp_listview_populate_newposts
function sp_listview_populate_newposts($topicIds)
{
global $spThisUser;
$newList = array();
# First filter topics by those in the users new post list
$newTopicIds = array();
foreach ($topicIds as $topic) {
if (sp_is_in_users_newposts($topic)) {
$newTopicIds[] = $topic;
}
}
if ($newTopicIds) {
# construct the query - need to add in sfwaiting for admins
$where = SFPOSTS . '.topic_id IN (' . implode(',', $newTopicIds) . ') AND (post_date > "' . spdb_zone_mysql_checkdate($spThisUser->lastvisit) . '")';
if ($spThisUser->admin || $spThisUser->moderator) {
$wPosts = spdb_select('col', 'SELECT post_id FROM ' . SFWAITING);
if ($wPosts) {
$where .= ' OR (' . SFPOSTS . '.post_id IN (' . implode(",", $wPosts) . '))';
}
}
$spdb = new spdbComplex();
$spdb->table = SFPOSTS;
$spdb->fields = SFPOSTS . '.topic_id, ' . SFPOSTS . '.post_id, post_index, ' . spdb_zone_datetime('post_date') . ',
guest_name, ' . SFPOSTS . '.user_id, display_name, post_count-post_index+1 AS new_post_count';
$spdb->left_join = array(SFMEMBERS . ' ON ' . SFMEMBERS . '.user_id = ' . SFPOSTS . '.user_id');
$spdb->join = array(SFTOPICS . ' ON ' . SFPOSTS . '.topic_id = ' . SFTOPICS . '.topic_id');
$spdb->where = $where;
$spdb->orderby = 'topic_id, post_id';
$spdb = apply_filters('sph_listview_newposts_query', $spdb, $this);
$postrecords = $spdb->select();
if ($postrecords) {
$cTopic = 0;
foreach ($postrecords as $p) {
if ($p->topic_id != $cTopic) {
$cTopic = $p->topic_id;
$newList[$cTopic] = new stdClass();
$newList[$cTopic]->topic_id = $cTopic;
$newList[$cTopic]->new_post_count = $p->new_post_count;
$newList[$cTopic]->new_post_post_id = $p->post_id;
$newList[$cTopic]->new_post_post_index = $p->post_index;
$newList[$cTopic]->new_post_post_date = $p->post_date;
$newList[$cTopic]->new_post_user_id = $p->user_id;
$newList[$cTopic]->new_post_display_name = sp_filter_name_display($p->display_name);
$newList[$cTopic]->new_post_guest_name = sp_filter_name_display($p->guest_name);
}
}
}
}
return $newList;
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:50,代码来源:sp-list-topic-class.php
示例10: sp_is_online
function sp_is_online($userid)
{
global $session_online;
if (!$userid) {
return false;
}
if (!isset($session_online)) {
$session_online = spdb_select('col', "SELECT trackuserid FROM " . SFTRACK);
}
if (in_array($userid, $session_online)) {
return true;
}
return false;
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:14,代码来源:sp-db-statistics.php
示例11: sp_UserGroupList
function sp_UserGroupList($args = '', $titleLabel = '', $userGroup = 0)
{
if (!$userGroup) {
return;
}
$defs = array('tagClass' => 'spUserGroupList', 'pTitleClass' => 'spUserGroupListTitle', 'spanClass' => 'spUserGroupListList', 'link_names' => 1, 'postCount' => 1, 'echo' => 1, 'get' => 0);
$a = wp_parse_args($args, $defs);
$a = apply_filters('sph_UserGroupList_args', $a);
extract($a, EXTR_SKIP);
# sanitize before use
$tagClass = esc_attr($tagClass);
$pTitleClass = esc_attr($pTitleClass);
$spanClass = esc_attr($spanClass);
$link_names = (int) $link_names;
$postCount = (int) $postCount;
$echo = (int) $echo;
$userGroup = (int) $userGroup;
$get = (int) $get;
if (!empty($titleLabel)) {
$titleLabel = sp_filter_title_display($titleLabel);
}
# get user group member list
$sql = "SELECT " . SFMEMBERSHIPS . ".user_id, display_name, posts\n\t\t\tFROM " . SFMEMBERSHIPS . "\n\t\t\tJOIN " . SFMEMBERS . " ON " . SFMEMBERS . ".user_id = " . SFMEMBERSHIPS . ".user_id\n\t\t\tWHERE " . SFMEMBERSHIPS . ".usergroup_id=" . $userGroup . "\n\t\t\tORDER BY display_name";
$members = spdb_select('set', $sql);
if ($get) {
return $members;
}
# render the members list
$out = "<div class='{$tagClass}'>";
$out .= "<p class='{$pTitleClass}'><span class='{$pTitleClass}'>{$titleLabel}</span>";
if ($members) {
$first = true;
$out .= "<span class='{$spanClass}'>";
foreach ($members as $member) {
$comma = !$first ? ', ' : '';
if ($member->posts < 0) {
$member->posts = 0;
}
$userPosts = $postCount ? ': ' . $member->posts : '';
$out .= sp_build_name_display($member->user_id, $comma . sp_filter_name_display($member->display_name) . $userPosts);
$first = false;
}
$out .= '</span>';
}
$out .= '</p>';
# finish it up
$out .= "</div>\n";
$out = apply_filters('sph_UserGroupList', $out, $a);
if ($echo) {
echo $out;
} else {
return $out;
}
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:54,代码来源:sp-common-view-functions.php
示例12: sp_rpx_get_wpuid_by_identifier
function sp_rpx_get_wpuid_by_identifier($identifier)
{
$sql = 'SELECT user_id FROM ' . SFUSERMETA . " WHERE meta_key = 'rpx_identifier' AND meta_value = '{$identifier}'";
$r = spdb_select('var', $sql);
if ($r) {
return $r;
} else {
return null;
}
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:10,代码来源:sp-rpx.php
示例13: spa_save_housekeeping_data
function spa_save_housekeeping_data()
{
check_admin_referer('forum-adminform_housekeeping', 'forum-adminform_housekeeping');
$mess = '';
if (isset($_POST['rebuild-fidx'])) {
$forumid = $_POST['forum_id'];
if (is_numeric($forumid)) {
$topics = spdb_table(SFTOPICS, "forum_id={$forumid}");
if ($topics) {
include_once SF_PLUGIN_DIR . '/forum/database/sp-db-management.php';
foreach ($topics as $topic) {
sp_build_post_index($topic->topic_id);
}
# after reubuilding post indexes, rebuild the forum indexes
sp_build_forum_index($forumid);
do_action('sph_toolbox_housekeeping_forum_index');
$mess = spa_text('Forum indexes rebuilt');
} else {
$mess = spa_text('Forum index rebuild failed - no topics in selected forum');
}
} else {
$mess = spa_text('Forum index rebuild failed - no forum selected');
}
}
if (isset($_POST['transient-cleanup'])) {
include_once SF_PLUGIN_DIR . '/forum/database/sp-db-management.php';
sp_transient_cleanup();
do_action('sph_toolbox_housekeeping_transient');
$mess = spa_text('WP transients cleaned');
}
if (isset($_POST['clean-newposts'])) {
$days = isset($_POST['sfdays']) ? max(sp_esc_int($_POST['sfdays']), 0) : 30;
$users = spdb_select('col', "SELECT user_id FROM " . SFMEMBERS . " WHERE lastvisit < DATE_SUB(CURDATE(), INTERVAL " . $days . " DAY)");
if ($users) {
foreach ($users as $user) {
spdb_query('UPDATE ' . SFMEMBERS . " SET newposts='a:1:{i:0;i:0;}' WHERE user_id={$user}");
}
}
do_action('sph_toolbox_housekeeping_newpost');
$mess = spa_text('New posts lists cleaned');
}
if (isset($_POST['postcount-cleanup'])) {
spdb_query('UPDATE ' . SFMEMBERS . ' SET posts = (SELECT COUNT(*) FROM ' . SFPOSTS . ' WHERE ' . SFPOSTS . '.user_id = ' . SFMEMBERS . '.user_id)');
# force stats to update
do_action('sph_stats_cron');
do_action('sph_toolbox_housekeeping_postcount');
$mess = spa_text('User post counts calculated');
}
if (isset($_POST['reset-tabs'])) {
# clear out current tabs
$tabs = sp_get_sfmeta('profile', 'tabs');
sp_delete_sfmeta($tabs[0]['meta_id']);
# start adding new ones
spa_new_profile_setup();
do_action('sph_toolbox_housekeeping_profile_tabs');
$mess = spa_text('Profile tabs reset');
}
if (isset($_POST['reset-auths'])) {
sp_reset_auths();
do_action('sph_toolbox_housekeeping_auths');
$mess = spa_text('Auths caches cleaned');
}
if (isset($_POST['reset-plugin-data'])) {
sp_reset_member_plugindata();
do_action('sph_toolbox_housekeeping_plugindata');
$mess = spa_text('Users Plugin Data reset');
}
if (isset($_POST['reset-combinedcss'])) {
sp_clear_combined_css('all');
sp_clear_combined_css('mobile');
sp_clear_combined_css('tablet');
do_action('sph_toolbox_housekeeping_ccombined_css');
$mess = spa_text('Combined CSS cache file removed');
}
if (isset($_POST['reset-combinedjs'])) {
sp_clear_combined_scripts('desktop');
sp_clear_combined_scripts('mobile');
sp_clear_combined_scripts('tablet');
do_action('sph_toolbox_housekeeping_combined_js');
$mess = spa_text('Combined scripts cache files removed');
}
if (isset($_POST['flushcache'])) {
sp_flush_cache('all');
do_action('sph_toolbox_housekeeping_flush_cache');
$mess = spa_text('General cache flushed');
}
do_action('sph_toolbox_housekeeping_save');
return $mess;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:89,代码来源:spa-toolbox-save.php
示例14: sp_test_table_create
function sp_test_table_create()
{
# make sure we can create database tables
$sql = '
CREATE TABLE sfCheckCreate (
id int(4) NOT NULL,
item varchar(15) default NULL,
PRIMARY KEY (id)
) ' . spdb_charset();
spdb_query($sql);
$success = spdb_select('var', 'SHOW TABLES LIKE "sfCheckCreate"');
if ($success == false) {
return false;
} else {
spdb_query('DROP TABLE sfCheckCreate');
return true;
}
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:18,代码来源:sp-load-install.php
示例15: die
$LastChangedDate: 2013-03-02 17:15:32 +0000 (Sat, 02 Mar 2013) $
$Rev: 9944 $
*/
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
die('Access denied - you cannot directly call this file');
}
spa_admin_ahah_support();
check_admin_referer('forum-adminform_mapusers', 'forum-adminform_mapusers');
global $wp_roles;
$startSQL = sp_esc_int($_GET['startNum']);
$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;
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:spa-ahah-map-users.php
示例16: spa_get_members_info
function spa_get_members_info($userid)
{
$data = sp_get_member_row($userid);
if (empty($data)) {
return '';
}
$first = spdb_select('row', '
SELECT ' . SFPOSTS . '.forum_id, forum_name, forum_slug, ' . SFPOSTS . '.topic_id, topic_name, topic_slug, post_date
FROM ' . SFPOSTS . '
JOIN ' . SFTOPICS . ' ON ' . SFTOPICS . '.topic_id = ' . SFPOSTS . '.topic_id
JOIN ' . SFFORUMS . ' ON ' . SFFORUMS . '.forum_id = ' . SFPOSTS . '.forum_id
WHERE ' . SFPOSTS . ".user_id={$userid}\n\t\t\tORDER BY post_date ASC\n\t\t\tLIMIT 1");
if ($first) {
$url = '<a href="' . sp_build_url($first->forum_slug, $first->topic_slug, 1, 0) . '">' . sp_filter_title_display($first->topic_name) . '</a>';
$data['first'] = sp_filter_title_display($first->forum_name) . '<br />' . $url . '<br />' . sp_date('d', $first->post_date);
} else {
$data['first'] = spa_text('No Posts');
}
$last = spdb_select('row', '
SELECT ' . SFPOSTS . '.forum_id, forum_name, forum_slug, ' . SFPOSTS . '.topic_id, topic_name, topic_slug, post_date
FROM ' . SFPOSTS . '
JOIN ' . SFTOPICS . ' ON ' . SFTOPICS . '.topic_id = ' . SFPOSTS . '.topic_id
JOIN ' . SFFORUMS . ' ON ' . SFFORUMS . '.forum_id = ' . SFPOSTS . '.forum_id
WHERE ' . SFPOSTS . ".user_id={$userid}\n\t\t\tORDER BY post_date DESC\n\t\t\tLIMIT 1");
if ($last) {
$url = '<a href="' . sp_build_url($last->forum_slug, $last->topic_slug, 1, 0) . '">' . sp_filter_title_display($last->topic_name) . '</a>';
$data['last'] = sp_filter_title_display($last->forum_name) . '<br />' . $url . '<br />' . sp_date('d', $last->post_date);
} else {
$data['last'] = spa_text('No posts');
}
if ($data['admin']) {
$user_memberships = 'Admin';
$status = 'Admin';
$start = 0;
} else {
if ($data['moderator']) {
$status = 'Moderator';
$start = 1;
} else {
$status = 'User';
$start = 1;
}
}
$memberships = spdb_table(SFMEMBERSHIPS, "user_id={$userid}", '', '', '', ARRAY_A);
if ($memberships) {
foreach ($memberships as $membership) {
$name = spdb_table(SFUSERGROUPS, 'usergroup_id=' . $membership['usergroup_id'], 'usergroup_name');
if ($start) {
$user_memberships = $name;
$start = 0;
} else {
$user_memberships .= ', ' . $name;
}
}
} else {
if ($start) {
$user_memberships = 'No Memberships';
}
}
$data['memberships'] = $user_memberships;
$rank = sp_get_user_forum_rank($status, $userid, $data['posts']);
$data['rank'] = $rank[0]['name'];
$user = get_userdata($userid);
$data['login'] = $user->user_login;
return $data;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:66,代码来源:spa-users-members-form.php
示例17: spa_permissions_edit_permission_form
function spa_permissions_edit_permission_form($role_id)
{
global $spGlobals;
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#rolerow-<?php
echo $role_id;
?>
').addClass('inForm');
spjAjaxForm('sfroleedit<?php
echo $role_id;
?>
', 'sfreloadpb');
jQuery(function(jQuery){vtip();})
});
</script>
<?php
# Get correct tooltips file
$lang = spa_get_language_code();
if (empty($lang)) {
$lang = 'en';
}
$ttpath = SPHELP . 'admin/tooltips/admin-permissions-tips-' . $lang . '.php';
if (file_exists($ttpath) == false) {
$ttpath = SPHELP . 'admin/tooltips/admin-permissions-tips-en.php';
}
if (file_exists($ttpath)) {
include_once $ttpath;
}
$role = spa_get_role_row($role_id);
spa_paint_options_init();
$ahahURL = SFHOMEURL . 'index.php?sp_ahah=permissions-loader&sfnonce=' . wp_create_nonce('forum-ahah') . '&saveform=editperm';
?>
<form action="<?php
echo $ahahURL;
?>
" method="post" id="sfroleedit<?php
echo $role->role_id;
?>
" name="sfroleedit<?php
echo $role->role_id;
?>
">
<?php
echo sp_create_nonce('forum-adminform_roleedit');
spa_paint_open_tab(spa_text('Permissions') . ' - ' . spa_text('Manage Permissions'), true);
spa_paint_open_panel();
spa_paint_open_fieldset(spa_text('Edit Permission'), 'true', 'edit-master-permission-set');
?>
<input type="hidden" name="role_id" value="<?php
echo $role->role_id;
?>
" />
<?php
spa_paint_input(spa_text('Permission Set Name'), 'role_name', sp_filter_title_display($role->role_name), false, true);
spa_paint_input(spa_text('Permission Set Description'), 'role_desc', sp_filter_title_display($role->role_desc), false, true);
?>
<br /><p><strong><?php
spa_etext("Permission Set Actions");
?>
:</strong></p>
<?php
echo '<p><img src="' . SFADMINIMAGES . 'sp_GuestPerm.png" alt="" width="16" height="16" align="top" />';
echo '<small> ' . spa_text('Note: Action settings displaying this icon will be ignored for Guest Users') . '</small><br />';
echo '<img src="' . SFADMINIMAGES . 'sp_GlobalPerm.png" alt="" width="16" height="16" align="top" />';
echo '<small> ' . spa_text('Note: Action settings displaying this icon require enabling to use') . '</small><br />';
echo '<img src="' . SFADMINIMAGES . 'sp_Warning.png" alt="" width="16" height="16" align="top" />';
echo '<small> ' . spa_text('Note: Action settings displaying this icon should be used with great care') . '</small></p>';
sp_build_site_auths_cache();
$sql = 'SELECT auth_id, auth_name, auth_cat, authcat_name, warning FROM ' . SFAUTHS . '
JOIN ' . SFAUTHCATS . ' ON ' . SFAUTHS . '.auth_cat = ' . SFAUTHCATS . '.authcat_id
WHERE active = 1
ORDER BY auth_cat, auth_id';
$authlist = spdb_select('set', $sql);
$role_auths = maybe_unserialize($role->role_auths);
$firstitem = true;
$category = '';
?>
<!-- OPEN OUTER CONTAINER DIV -->
<div class="outershell" style="width: 100%;">
<?php
foreach ($authlist as $a) {
if ($category != $a->authcat_name) {
$category = $a->authcat_name;
if (!$firstitem) {
?>
<!-- CLOSE DOWN THE ENDS -->
</table></div>
<?php
}
?>
<!-- OPEN NEW INNER DIV -->
<div class="innershell">
<!-- NEW INNER DETAIL TABLE -->
<table width="100%" border="0">
<tr><td colspan="2" class="permhead"><?php
spa_etext($category);
?>
</td></tr>
//.........这里部分代码省略.........
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:101,代码来源:spa-permissions-edit-permission-form.php
示例18: sp_searchview_query
function sp_searchview_query($searchType, $searchInclude)
{
global $spVars, $spThisUser;
# some defaults
$useLimit = true;
$TABLE = '';
$JOIN = '';
$FIELDS = SFPOSTS . '.topic_id';
$WHERE = '';
$ORDERBY = SFPOSTS . '.topic_id DESC';
# (WHERE) Post content search criteria
if ($searchType == 1 || $searchType == 2 || $searchType == 3) {
$useLimit = false;
# Standard forum search
if ($searchInclude == 1) {
# Include = 1 - posts
$WHERE = $this->searchTerm;
$TABLE = SFPOSTS;
} elseif ($searchInclude == 2) {
# Include = 2 - titles
$WHERE = $this->searchTerm;
$TABLE = SFTOPICS;
$FIELDS = SFTOPICS . '.topic_id';
$ORDERBY = SFTOPICS . '.topic_id DESC';
} elseif ($searchInclude == 3) {
# Include = 3 - posts and titles
$WHERE = $this->searchTerm;
$TABLE = SFPOSTS;
$JOIN = array(SFTOPICS . ' ON ' . SFPOSTS . '.topic_id = ' . SFTOPICS . '.topic_id');
} else {
# Plugns can set an alternate TABLE and MATCH statement based on the 'Include' parameter
$TABLE = apply_filters('sph_search_type_table', SFTOPICS, $searchType, $searchInclude);
$WHERE = apply_filters('sph_search_include_where', '', $this->searchTerm, $searchType, $searchInclude);
}
} elseif ($searchType == 4) {
# Member 'posted in'
$WHERE = "user_id={$this->searchTerm}";
$TABLE = SFPOSTS;
} elseif ($searchType == 5) {
# Member 'started'
$WHERE = "user_id={$this->searchTerm} AND post_index=1";
$TABLE = SFPOSTS;
} else {
# Plugns can set an alternate TABLE and WHERE clause based on the 'Type' parameter
$TABLE = apply_filters('sph_search_type_table', SFTOPICS, $searchType, $searchInclude);
$WHERE = apply_filters('sph_search_type_where', '', $this->searchTerm, $searchType, $searchInclude);
}
# check if the WHERE clause is empty - probably comes from a legacy url
if (empty($WHERE)) {
sp_notify(1, sp_text('Unable to complete this search request'));
return;
}
# Query
$spdb = new spdbComplex();
$spdb->table = $TABLE;
$spdb->fields = $FIELDS;
if (!empty($JOIN)) {
$spdb->join = $JOIN;
}
$spdb->distinct = true;
$spdb->found_rows = true;
$spdb->where = $WHERE . ' AND ' . $TABLE . '.' . $this->forumWhere;
$spdb->orderby = $ORDERBY;
if ($useLimit) {
$spdb->limits = $this->limit;
}
# Plugins can alter the final SQL
$spdb = apply_filters('sph_search_query', $spdb, $this->searchTerm, $searchType, $searchInclude, $this);
if (!empty($spThisUser->inspect['q_spSearchView'])) {
$spdb->inspect = 'q_spSearchView';
$spdb->show = true;
}
$records = $spdb->select('col');
$spVars['searchresults'] = spdb_select('var', 'SELECT FOUND_ROWS()');
$this->searchCount = $spVars['searchresults'];
$this->searchInclude = $searchInclude;
$this->searchType = $searchType;
return $records;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:79,代码来源:sp-search-view-class.php
示例19: define
#
# CORE
# Loaded by core - globally required by back end/admin for all pages
#
# ==========================================================================================
global $wpdb, $spPaths, $spMobile, $spDevice;
if (!defined('SFBLOGID')) {
define('SFBLOGID', $wpdb->blogid);
}
# Charset
if (!defined('SFCHARSET')) {
define('SFCHARSET', get_bloginfo('charset'));
}
# Storage Locations
if (is_multisite() && !get_site_option('ms_files_rewriting')) {
$sp_install_version = spdb_select('var', 'SELECT version FROM ' . SFLOG . ' LIMIT 1');
if (empty($sp_install_version) || $sp_install_version < 5.6) {
if (!defined('SF_STORE_DIR')) {
define('SF_STORE_DIR', WP_CONTENT_DIR);
}
if (!defined('SF_STORE_URL')) {
define('SF_STORE_URL', content_url());
}
} else {
$uploads = sp_get_upload_info();
if (!defined('SF_STORE_DIR')) {
define('SF_STORE_DIR', $uploads['basedir']);
}
if (!defined('SF_STORE_URL')) {
define('SF_STORE_URL', $uploads['baseurl']);
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:31,代码来源:sp-site-constants.php
示例20: sp_perform_install
//.........这里部分代码省略.........
$theme['color'] = 'silver';
sp_add_option('sp_current_theme', $theme);
$theme = array();
$theme['active'] = false;
$theme['theme'] = 'default';
$theme['style'] = 'default.php';
$theme['color'] = 'silver';
$theme['usetemplate'] = false;
$theme['pagetemplate'] = '';
$theme['notitle'] = true;
sp_add_option('sp_mobile_theme', $theme);
sp_add_option('sp_tablet_theme', $theme);
sp_add_option('account-name', '');
sp_add_option('display-name', '');
sp_add_option('guest-name', '');
# Create smileys Record
sp_build_base_smileys();
# set up daily transient clean up cron
wp_schedule_event(time(), 'daily', 'sph_transient_cleanup_cron');
# profile tabs
spa_new_profile_setup();
# build the list of moderators per forum
sp_update_forum_moderators();
# set up hourly stats generation
sp_add_option('sp_stats_interval', 3600);
wp_schedule_
|
请发表评论