本文整理汇总了PHP中spdb_query函数的典型用法代码示例。如果您正苦于以下问题:PHP spdb_query函数的具体用法?PHP spdb_query怎么用?PHP spdb_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spdb_query函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sp_rebuild_schema
function sp_rebuild_schema($start, $end)
{
global $tables, $wpdb;
# prepare the one exception!
$opTable = $wpdb->prefix . 'sfoptions';
$opKey = 'option_id';
$t = sp_get_option('installed_tables');
for ($x = $start; $x < $end + 1; $x++) {
if ($t[$x]) {
# get list of indexes
$data = $wpdb->get_results("SHOW INDEXES FROM {$t[$x]}");
if ($data) {
foreach ($data as $item) {
if ($item->Key_name != 'PRIMARY' && ($t[$x] != $opTable && $item->Key_name != $opKey)) {
# remove current index
spdb_query('ALTER TABLE ' . $t[$x] . " DROP INDEX {$item->Key_name}");
}
}
}
# grab list of table actions
$actions = $tables[$t[$x]];
if ($actions) {
foreach ($actions as $sql) {
# add back index
spdb_query($sql);
}
}
}
}
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:30,代码来源:sp-schema.php
示例2: 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
示例3: sp_admin_bar_do_uninstall
function sp_admin_bar_do_uninstall()
{
global $spGlobals;
sp_delete_option('spAdminBar');
sp_delete_option('spAkismet');
# remove the auth
if (!empty($spGlobals['auths_map']['bypass_akismet'])) {
sp_delete_auth('bypass_akismet');
}
# remove our auto update stuff
$up = sp_get_sfmeta('autoupdate', 'admin');
if ($up) {
sp_delete_sfmeta($up[0]['meta_id']);
}
# empty out the sfwaiting table
spdb_query('TRUNCATE ' . SFWAITING);
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:17,代码来源:sp-admin-bar-uninstall.php
示例4: 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
示例5: 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
示例6: spa_update_specialrank
function spa_update_specialrank($id)
{
check_admin_referer('special-rank-update', 'special-rank-update');
# save special forum ranks
if (!empty($_POST['specialrankdesc'])) {
$desc = $_POST['specialrankdesc'];
$badge = $_POST['specialrankbadge'];
$rank = sp_get_sfmeta('special_rank', false, $id);
$rank[0]['meta_value']['badge'] = sp_filter_filename_save($badge[$id]);
sp_update_sfmeta('special_rank', sp_filter_title_save(trim($desc[$id])), $rank[0]['meta_value'], $id, 1);
if ($_POST['currentname'][$id] != $desc[$id]) {
spdb_query("UPDATE " . SFSPECIALRANKS . "\n\t\t\t\t\t\tSET special_rank = '" . $desc[$id] . "'\n\t\t\t\t\t\tWHERE special_rank = '" . $_POST['currentname'][$id] . "'");
}
}
do_action('sph_component_srank_update_save');
$mess = spa_text('Special ranks updated');
return $mess;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:18,代码来源:spa-components-save.php
示例7: sp_delete_notice
function sp_delete_notice($col, $data)
{
$sql = 'DELETE FROM ' . SFNOTICES . ' WHERE ';
if (is_numeric($data)) {
$sql .= "{$col} = {$data}";
} else {
$sql .= "{$col} = '{$data}'";
}
spdb_query($sql);
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:10,代码来源:sp-api-notifications.php
示例8: sp_esc_int
global $spPaths;
$action = $_GET['action'];
if ($action == 'del_rank') {
$key = sp_esc_int($_GET['key']);
# remove the forum rank
$sql = 'DELETE FROM ' . SFMETA . " WHERE meta_type='forum_rank' AND meta_id='{$key}'";
spdb_query($sql);
}
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>';
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:spa-ahah-components.php
示例9: sp_update_post_urls
function sp_update_post_urls($old, $new)
{
global $wpdb;
if (empty($old) || empty($new)) {
return;
}
$posts = spdb_table(SFPOSTS, 'post_content LIKE "%/' . esc_sql($wpdb->esc_like($old)) . '%"', '');
if (!empty($posts)) {
foreach ($posts as $p) {
$pc = str_replace('/' . $old, '/' . $new, sp_filter_content_edit($p->post_content));
$pc = sp_filter_content_save($pc, 'edit');
spdb_query('UPDATE ' . SFPOSTS . " SET post_content = '{$pc}' WHERE post_id=" . $p->post_id);
}
}
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:15,代码来源:sp-api-permalinks.php
示例10: spa_update_parent_group
function spa_update_parent_group($currentGroupId, $newGroupId, $forumParent)
{
$forums = spdb_table(SFFORUMS, "group_id={$currentGroupId} AND parent={$forumParent}");
if ($forums) {
foreach ($forums as $forum) {
# update the old group ID to new one
$sql = 'UPDATE ' . SFFORUMS . " SET group_id={$newGroupId} WHERE forum_id={$forum->forum_id}";
spdb_query($sql);
if ($forum->children) {
$childlist = array(unserialize($forum->children));
if (count($childlist) > 0) {
spa_update_parent_group($currentGroupId, $newGroupId, $forum->forum_id);
}
}
}
}
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:17,代码来源:spa-forums-save.php
示例11: insert
function insert()
{
if (empty($this->table) || empty($this->fields) || empty($this->data) || !is_array($this->data) || !is_array($this->fields)) {
return false;
}
$table = $this->table;
$values = array();
foreach ($this->data as $val) {
if (!is_numeric($val)) {
$val = "'" . $val . "'";
}
$values[] = $val;
}
$sql = "INSERT INTO {$table} (" . implode(', ', $this->fields) . ') VALUES (' . implode(', ', $values) . ')';
if ($this->show) {
spdb_show_result($sql, $this->inspect);
}
$result = spdb_query($sql);
return $result;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:20,代码来源:sp-api-wpdb.php
示例12: sp_rpx_create_wp_user
function sp_rpx_create_wp_user($auth_info)
{
$p = $auth_info['profile'];
$rid = $p['identifier'];
$provider_name = $p['providerName'];
$username = $p['preferredUsername'];
if (!$username || sp_rpx_username_taken($username)) {
$username = sp_rpx_get_user_login_name($rid);
}
$last_name = null;
$first_name = null;
if (!empty($p['name'])) {
$first_name = $p['name']['givenName'];
$last_name = $p['name']['familyName'];
}
$email = '[email protected]';
if (!empty($p['email'])) {
$email = sp_filter_email_save($p['email']);
}
$userdata = array('user_pass' => wp_generate_password(), 'user_login' => $username, 'display_name' => sp_filter_name_save($p['displayName']), 'user_url' => $p['url'], 'user_email' => $email, 'first_name' => $first_name, 'last_name' => $last_name, 'nickname' => $p['displayName']);
# try to create new user
$wpuid = wp_insert_user($userdata);
if ($wpuid && !is_wp_error($wpuid)) {
update_user_meta($wpuid, 'rpx_identifier', $rid);
# remove temp email?
if ($email == '[email protected]') {
spdb_query('UPDATE ' . SFUSERS . " SET user_email='' WHERE ID={$wpuid}");
}
}
return $wpuid;
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:31,代码来源:sp-rpx.php
示例13: 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
$usergroups = spdb_table(SFUSERGROUPS);
if ($usergroups) {
$has_members = false;
foreach ($usergroups as $usergroup) {
$members = spdb_table(SFMEMBERSHIPS, "usergroup_id={$usergroup->usergroup_id}", 'row', '', '1');
//.........这里部分代码省略.........
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:101,代码来源:spa-admin-framework.php
示例14: 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
示例15: die
<?php
/*
Simple:Press
Remove a user notice in demand
$LastChangedDate: 2012-11-19 14:00:20 -0800 (Mon, 19 Nov 2012) $
$Rev: 9330 $
*/
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
die('Access denied - you cannot directly call this file');
}
sp_forum_api_support();
if (isset($_GET['notice'])) {
$id = (int) $_GET['notice'];
if ($id) {
spdb_query('DELETE FROM ' . SFNOTICES . " WHERE notice_id={$id}");
}
}
die;
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:19,代码来源:sp-ahah-notice.php
示例16: spa_deactivate_plugin
function spa_deactivate_plugin()
{
$uninstall = sp_get_option('sfuninstall');
if ($uninstall) {
# uninstall - remove all data
# remove any admin capabilities
$admins = spdb_table(SFMEMBERS, 'admin=1');
foreach ($admins as $admin) {
$user = new WP_User($admin->user_id);
$user->remove_cap('SPF Manage Options');
$user->remove_cap('SPF Manage Forums');
$user->remove_cap('SPF Manage User Groups');
$user->remove_cap('SPF Manage Permissions');
$user->remove_cap('SPF Manage Tags');
$user->remove_cap('SPF Manage Components');
$user->remove_cap('SPF Manage Admins');
$user->remove_cap('SPF Manage Profiles');
$user->remove_cap('SPF Manage Users');
$user->remove_cap('SPF Manage Toolbox');
$user->remove_cap('SPF Manage Plugins');
$user->remove_cap('SPF Manage Themes');
$user->remove_cap('SPF Manage Integration');
$user->remove_cap('SPF Manage Configuration');
# no longer used but some may still have it
}
# remove any installed tables
$tables = sp_get_option('installed_tables');
if ($tables) {
foreach ($tables as $table) {
spdb_query("DROP TABLE IF EXISTS {$table}");
}
}
# since we have removed our tables, need to turn off error logging to prevent onslaught of errors
global $spGlobals;
$spGlobals['record-errors'] = false;
# Remove the Page record
$sfpage = sp_get_option('sfpage');
if (!empty($sfpage)) {
spdb_query('DELETE FROM ' . SFWPPOSTS . ' WHERE ID=' . sp_get_option('sfpage'));
}
# remove widget data
delete_option('widget_spf');
delete_option('widget_sforum');
# remove any wp options we might have set
delete_option('sfInstallID');
delete_option('sp_storage1');
delete_option('sp_storage2');
# Now remove user meta data
$optionlist = array('sfadmin', 'location', 'msn', 'skype', 'icq', 'facebook', 'myspace', 'twitter', 'linkedin', 'youtube', 'googleplus', 'sfuse_quicktags', 'signature', 'sigimage');
foreach ($optionlist as $option) {
spdb_query('DELETE FROM ' . SFUSERMETA . " WHERE meta_key='{$option}';");
}
# send our uninstall action
do_action('sph_uninstalled', $admins);
# remove storage locations if so directed
if (sp_get_option('removestorage')) {
# let's remove our directories and storage
global $spPaths;
if (!empty($spPaths)) {
foreach ($spPaths as $storage => $path) {
# lets not remove plugins and themes
if ($storage != 'plugins' && $storage != 'themes') {
sp_remove_dir(SF_STORE_DIR . '/' . $path);
}
}
}
# remove the languages folder if it exists
# note the sp-resources dire may not exist - but its our default. if user creates other parent dir for languages, we wont know about it
sp_remove_dir(SF_STORE_DIR . '/sp-resources/forum-language');
}
}
# remove the combined css and js cache files
sp_clear_combined_css('all');
sp_clear_combined_css('mobile');
sp_clear_combined_css('tablet');
# remove cron jobs for deactivaton or uninstall
wp_clear_scheduled_hook('spf_cron_pm');
# left here for 5.0 who doesnt upgrade
wp_clear_scheduled_hook('spf_cron_sitemap');
# left here for 5.0 who doesnt upgrade
wp_clear_scheduled_hook('sph_cron_user');
wp_clear_scheduled_hook('sph_transient_cleanup_cron');
wp_clear_scheduled_hook('sph_stats_cron');
wp_clear_scheduled_hook('sph_news_cron');
# send deactivated action
if (!$uninstall) {
do_action('sph_deactivated');
}
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:89,代码来源:spa-admin-global-functions.php
示例17: spa_save_usergroups_delete_usergroup
function spa_save_usergroups_delete_usergroup()
{
check_admin_referer('forum-adminform_usergroupdelete', 'forum-adminform_usergroupdelete');
$usergroup_id = sp_esc_int($_POST['usergroup_id']);
# dont allow updates to the default user groups
$usergroup = spa_get_usergroups_row($usergroup_id);
if ($usergroup->usergroup_locked) {
$mess = spa_text('Sorry, the default User Groups cannot be deleted');
return $mess;
}
# remove all memberships for this user group
spdb_query("DELETE FROM " . SFMEMBERSHIPS . " WHERE usergroup_id=" . $usergroup_id);
# remove any permission sets using this user group
$permissions = spdb_table(SFPERMISSIONS, "usergroup_id={$usergroup_id}");
if ($permissions) {
foreach ($permissions as $permission) {
spa_remove_permission_data($permission->permission_id);
}
}
# remove any group default permissions using this user group
spdb_query("DELETE FROM " . SFDEFPERMISSIONS . " WHERE usergroup_id=" . $usergroup_id);
# remove the user group
spdb_query("DELETE FROM " . SFMEMBERSHIPS . " WHERE usergroup_id=" . $usergroup_id);
$success = spdb_query("DELETE FROM " . SFUSERGROUPS . " WHERE usergroup_id=" . $usergroup_id);
if ($success == false) {
$mess = spa_text('User group delete failed');
} else {
$mess = spa_text('User group deleted');
# reset auths and memberships for everyone
sp_reset_memberships();
sp_reset_auths();
do_action('sph_usergroup_del', $usergroup_id);
}
return $mess;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:35,代码来源:spa-usergroups-save.php
示例18: sp_track_logout
function sp_track_logout()
{
global $current_user;
sp_set_last_visited($current_user->ID);
spdb_query("DELETE FROM " . SFTRACK . " WHERE trackuserid=" . $current_user->ID);
# clear the users search cache
sp_delete_cache('search');
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:8,代码来源:sp-db-statistics.php
示例19: sp_UpdateProfile
//.........这里部分代码省略.........
if (!empty($pass1) || !empty($pass2)) {
if ($pass1 != $pass2) {
$message['type'] = 'error';
$message['text'] = sp_text('Please enter the same password in the two password fields');
return $message;
} else {
# update the password
$user = new stdClass();
$user->ID = (int) $thisUser;
$user->user_pass = $pass1;
wp_update_user(get_object_vars($user));
if (isset($spThisUser->sp_change_pw) && $spThisUser->sp_change_pw) {
delete_user_meta($spThisUser->ID, 'sp_change_pw');
}
}
}
# now check the email is valid and unique
$update = apply_filters('sph_ProfileUserEmailUpdate', true);
if ($update) {
$curEmail = sp_filter_email_save($_POST['curemail']);
$email = sp_filter_email_save($_POST['email']);
if ($email != $curEmail) {
if (empty($email)) {
$message['type'] = 'error';
$message['text'] = sp_text('Please enter a valid email address');
return $message;
} elseif (($owner_id = email_exists($email)) && $owner_id != $thisUser) {
$message['type'] = 'error';
$message['text'] = sp_text('The email address is already registered. Please choose another one');
return $message;
}
# save new email address
$sql = 'UPDATE ' . SFUSERS . " SET user_email='{$email}' WHERE ID=" . $thisUser;
spdb_query($sql);
}
}
# fire action for plugins
$message = apply_filters('sph_UpdateProfileSettings', $message, $thisUser);
# output profile save status
if (empty($message)) {
$message['type'] = 'success';
$message['text'] = sp_text('Account settings updated');
}
break;
case 'edit-profile':
# update profile settings
# validate any username change
$update = apply_filters('sph_ProfileUserDisplayNameUpdate', true);
if ($update) {
$spProfile = sp_get_option('sfprofile');
if ($spProfile['nameformat'] || $spThisUser->admin) {
$display_name = !empty($_POST['display_name']) ? trim($_POST['display_name']) : spdb_table(SFUSERS, "ID={$thisUser}", 'user_login');
$display_name = sp_filter_name_save($display_name);
# make sure display name isnt already used
if ($_POST['oldname'] != $display_name) {
$records = spdb_table(SFMEMBERS, "display_name='{$display_name}'");
if ($records) {
foreach ($records as $record) {
if ($record->user_id != $thisUser) {
$message['type'] = 'error';
$message['text'] = $display_name . ' ' . sp_text('is already in use - please choose a different display name');
return $message;
}
}
}
# validate display name
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:67,代码来源:sp-ahah-profile-save.php
示例20: sp_perform_install
function sp_perform_install($phase, $subphase = 0)
{
global $current_user, $spVars;
switch ($phase) {
case 1:
# create an array of installed tables to save for uninstall. plugins will add theirs to be sure we get good cleanup
$tables = array();
# sfauthcats table def
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFAUTHCATS . ' (
authcat_id tinyint(4) NOT NULL auto_increment,
authcat_name varchar(50) NOT NULL,
authcat_slug varchar(50) NOT NULL,
authcat_desc tinytext,
PRIMARY KEY (authcat_id),
KEY authcat_slug_idx (authcat_slug)
) ' . spdb_charset();
spdb_query($sql);
$tables[] = SFAUTHCATS;
# sfauths table def
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFAUTHS . " (\n\t\t\t\t\tauth_id bigint(20) NOT NULL auto_increment,\n\t\t\t\t\tauth_name varchar(50) NOT NULL,\n\t\t\t\t\tauth_desc text,\n\t\t\t\t\tactive smallint(1) NOT NULL default '0',\n\t\t\t\t\tignored smallint(1) NOT NULL default '0',\n\t\t\t\t\tenabling smallint(1) NOT NULL default '0',\n\t\t\t\t\tadmin_negate smallint(1) NOT NULL default '0',\n\t\t\t\t\tauth_cat bigint(20) NOT NULL default '1',\n\t\t\t\t\twarning tinytext,\n\t\t\t\t\tPRIMARY KEY\t (auth_id),\n\t\t\t\t\tKEY auth_name_idx (auth_name)\n\t\t\t\t) " . spdb_charset();
spdb_query($sql);
$tables[] = SFAUTHS;
# the cache table (5.4.2)
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFCACHE . " (\n\t\t\t\t\tcache_id varchar(40) NOT NULL DEFAULT '',\n\t\t\t\t\tcache_out bigint(6) DEFAULT NULL,\n\t\t\t\t\tcache mediumtext,\n\t\t\t\t\tPRIMARY KEY (cache_id)\n\t\t\t\t) " . spdb_charset();
spdb_query($sql);
$tables[] = SFCACHE;
# sfdefpermissions table def
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFDEFPERMISSIONS . " (\n\t\t\t\t\tpermission_id bigint(20) NOT NULL auto_increment,\n\t\t\t\t\tgroup_id bigint(20) NOT NULL default '0',\n\t\t\t\t\tusergroup_id bigint(20) NOT NULL default '0',\n\t\t\t\t\tpermission_role bigint(20) NOT NULL default '0',\n\t\t\t\t\tPRIMARY KEY\t (permission_id),\n\t\t\t\t\tKEY group_id_idx (group_id),\n\t\t\t\t\tKEY usergroup_id_idx (usergroup_id),\n\t\t\t\t\tKEY permission_role_idx (permission_role)\n\t\t\t\t) " . spdb_charset();
spdb_query($sql);
$tables[] = SFDEFPERMISSIONS;
# error log table
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFERRORLOG . " (\n\t\t\t\t\tid bigint(20) NOT NULL auto_increment,\n\t\t\t\t\terror_date datetime NOT NULL,\n\t\t\t\t\terror_type varchar(10) NOT NULL,\n\t\t\t\t\terror_cat varchar(13) NOT NULL default 'spaErrOther',\n\t\t\t\t\tkeycheck varchar(45),\n\t\t\t\t\terror_count smallint(6),\n\t\t\t\t\terror_text text,\n\t\t\t\t\tPRIMARY KEY (id)\n\t\t\t\t) " . spdb_charset();
spdb_query($sql);
$tables[] = SFERRORLOG;
# sfforums table def
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFFORUMS . " (\n\t\t\t\t\tforum_id bigint(20) NOT NULL auto_increment,\n\t\t\t\t\tforum_name varchar(200) NOT NULL,\n\t\t\t\t\tgroup_id bigint(20) NOT NULL,\n\t\t\t\t\tforum_seq int(4) default NULL,\n\t\t\t\t\tforum_desc text default NULL,\n\t\t\t\t\tforum_status int(4) NOT NULL default '0',\n\t\t\t\t\tforum_disabled smallint(1) NOT NULL default '0',\n\t\t\t\t\tforum_slug varchar(200) NOT NULL,\n\t\t\t\t\tforum_rss text default NULL,\n\t\t\t\t\tforum_icon varchar(50) default NULL,\n\t\t\t\t\tforum_icon_new varchar(50) default NULL,\n\t\t\t\t\tforum_icon_locked varchar(50) default NULL,\n\t\t\t\t\ttopic_icon varchar(50) default NULL,\n\t\t\t\t\ttopic_icon_new varchar(50) default NULL,\n\t\t\t\t\ttopic_icon_locked varchar(50) default NULL,\n\t\t\t\t\ttopic_icon_pinned varchar(50) default NULL,\n\t\t\t\t\tpost_id bigint(20) default NULL,\n\t\t\t\t\tpost_id_held bigint(20) default NULL,\n\t\t\t\t\ttopic_count mediumint(8) default '0',\n\t\t\t\t\tpost_count mediumint(8) default '0',\n\t\t\t\t\tpost_count_held mediumint(8) default '0',\n\t\t\t\t\tforum_rss_private smallint(1) NOT NULL default '0',\n\t\t\t\t\tparent bigint(20) NOT NULL default '0',\n\t\t\t\t\tchildren text default NULL,\n\t\t\t\t\tforum_message text,\n\t\t\t\t\tkeywords varchar(256) default NULL,\n\t\t\t\t\tPRIMARY KEY\t (forum_id),\n\t\t\t\t\tKEY group_id_idx (group_id),\n\t\t\t\t\tKEY forum_slug_idx (forum_slug),\n\t\t\t\t\tKEY post_id_idx (post_id)\n\t\t\t\t) " . spdb_charset();
spdb_query($sql);
$tables[] = SFFORUMS;
# sfgroups table def
$sql = '
CREATE TABLE IF NOT EXISTS ' . SFGROUPS . ' (
group_id bigint(20) NOT NULL auto_increment,
group_name
|
请发表评论