本文整理汇总了PHP中sp_update_option函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_update_option函数的具体用法?PHP sp_update_option怎么用?PHP sp_update_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_update_option函数的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);
}
示例2: sp_admin_bar_admin_options_save
function sp_admin_bar_admin_options_save()
{
$options = '';
$options['dashboardposts'] = isset($_POST['dashboardposts']);
sp_update_option('spAdminBar', $options);
sp_update_option('spAkismet', sp_esc_int($_POST['spAkismet']));
return __('Admin bar options updated!', 'spab');
}
示例3: sp_captcha_admin_options_save
function sp_captcha_admin_options_save()
{
$captcha = array();
$captcha['registration'] = isset($_POST['registration']);
sp_update_option('spCaptcha', $captcha);
do_action('sph_captcha_uploads_save');
return __('Captcha options updated!', 'sp-cap');
}
示例4: sp_captcha_do_install
function sp_captcha_do_install()
{
$captcha = sp_get_option('spCaptcha');
if (empty($captcha)) {
$captcha['registration'] = true;
$captcha['dbversion'] = SPCAPTCHADBVERSION;
sp_update_option('spCaptcha', $captcha);
}
# add a new permission into the auths table
sp_add_auth('bypass_captcha', __('Can bypass the post captcha check', 'sp-cap'), 1, 0, 0, 0, 6);
sp_activate_auth('bypass_captcha');
}
示例5: spa_save_admins_global_options_data
function spa_save_admins_global_options_data()
{
check_admin_referer('global-admin_options', 'global-admin_options');
# admin settings group
$sfadminsettings = array();
$sfadminsettings['sfdashboardstats'] = isset($_POST['sfdashboardstats']);
$sfadminsettings['sfadminapprove'] = isset($_POST['sfadminapprove']);
$sfadminsettings['sfmoderapprove'] = isset($_POST['sfmoderapprove']);
$sfadminsettings['editnotice'] = isset($_POST['editnotice']);
$sfadminsettings['movenotice'] = isset($_POST['movenotice']);
sp_update_option('sfadminsettings', $sfadminsettings);
do_action('sph_admin_global_options_save');
$mess = spa_text('Admin global options updated');
return $mess;
}
示例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);
}
}
示例7: sp_admin_bar_do_install
function sp_admin_bar_do_install()
{
global $spThisUser;
$oldOptions = sp_get_option('sfadminsettings');
$newOptions = sp_get_option('spAdminBar');
if (!isset($oldOptions['sfqueue']) && empty($newOptions)) {
$newOptions = array();
$newOptions['dashboardposts'] = false;
$newOptions['dbversion'] = SPABDBVERSION;
sp_add_option('spAdminBar', $newOptions);
$options = sp_get_member_item($spThisUser->ID, 'admin_options');
$options['sfadminbar'] = true;
sp_update_member_item($spThisUser->ID, 'admin_options', $options);
} else {
if (empty($newOptions)) {
$newOptions = array();
$newOptions['dashboardposts'] = $oldOptions['sfdashboardposts'];
$newOptions['dbversion'] = SPABDBVERSION;
sp_add_option('spAdminBar', $newOptions);
$options = sp_get_member_item($spThisUser->ID, 'admin_options');
$options['sfadminbar'] = true;
sp_update_member_item($spThisUser->ID, 'admin_options', $options);
unset($oldOptions['sfqueue']);
unset($oldOptions['sfmodasadmin']);
unset($oldOptions['sfshowmodposts']);
unset($oldOptions['sfbaronly']);
unset($oldOptions['sfdashboardposts']);
sp_update_option('sfadminsettings', $oldOptions);
}
}
# 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');
# create new Akismet setting
$akismet = sp_get_option('spAkismet');
if (empty($akismet)) {
sp_add_option('spAkismet', 1);
}
# get auto update running
$autoup = array('spabupdate', 'sp_ahah=admin-bar-update&target=newposts');
sp_add_sfmeta('autoupdate', 'admin', $autoup, 1);
}
示例8: sp_featured_do_upgrade_check
function sp_featured_do_upgrade_check()
{
if (!sp_is_plugin_active('featured/sp-featured-plugin.php')) {
return;
}
$options = sp_get_option('featured');
$db = $options['dbversion'];
if (empty($db)) {
$db = 0;
}
# quick bail check
if ($db == SPFEATUREDDBVERSION) {
return;
}
# apply upgrades as needed
# db version upgrades
# save data
$options['dbversion'] = SPFEATUREDDBVERSION;
sp_update_option('featured', $options);
}
示例9: sp_cron_generate_stats
function sp_cron_generate_stats()
{
$counts = sp_get_stats_counts();
sp_update_option('spForumStats', $counts);
$stats = sp_get_membership_stats();
sp_update_option('spMembershipStats', $stats);
$spControls = sp_get_option('sfcontrols');
$topPosters = sp_get_top_poster_stats((int) $spControls['showtopcount']);
sp_update_option('spPosterStats', $topPosters);
$mods = sp_get_moderator_stats();
sp_update_option('spModStats', $mods);
$admins = sp_get_admin_stats();
sp_update_option('spAdminStats', $admins);
do_action('sph_stats_cron_run');
}
示例10: spa_permalink_changed
function spa_permalink_changed($old, $new)
{
global $wp_rewrite;
if (empty($new)) {
$perm = user_trailingslashit(SFSITEURL) . '?page_id=' . sp_get_option('sfpage');
sp_update_option('sfpermalink', $perm);
} else {
$perm = user_trailingslashit(SFSITEURL . sp_get_option('sfslug'));
sp_update_option('sfpermalink', $perm);
$wp_rewrite->flush_rules();
}
sp_update_permalink();
}
示例11: saveData
function saveData()
{
global $spVars, $spGlobals;
$this->abort = false;
$this->newpost['action'] = $this->action;
# make the entire class object available for modification before saving
# warning: note the passing by reference. other end could wreak havoc
do_action_ref_array('sph_new_post_pre_save', array(&$this));
# Write the topic if needed
if ($this->action == 'topic') {
$this->newpost = apply_filters('sph_new_topic_pre_data_saved', $this->newpost);
$spdb = new spdbComplex();
$spdb->table = SFTOPICS;
$spdb->fields = array('topic_name', 'topic_slug', 'topic_date', 'forum_id', 'topic_status', 'topic_pinned', 'user_id');
$spdb->data = array($this->newpost['topicname'], $this->newpost['topicslug'], $this->newpost['postdate'], $this->newpost['forumid'], $this->newpost['topicstatus'], $this->newpost['topicpinned'], $this->newpost['userid']);
$spdb = apply_filters('sph_new_topic_data', $spdb);
$this->newpost['db'] = $spdb->insert();
if ($this->newpost['db'] == true) {
$this->newpost['topicid'] = $spVars['insertid'];
$this->newpost = apply_filters('sph_new_topic_data_saved', $this->newpost);
} else {
$this->abort = true;
$this->message = sp_text('Unable to save new topic record');
return;
}
# failsafe: check the topic slug and if empty use the topic id
if (empty($this->newpost['topicslug'])) {
$this->newpost['topicslug'] = 'topic-' . $this->newpost['topicid'];
spdb_query('UPDATE ' . SFTOPICS . " SET topic_slug='" . $this->newpost['topicslug'] . "' WHERE topic_id=" . $this->newpost['topicid']);
}
}
# Write the post
# Double check forum id is correct - it has been known for a topic to have just been moved!
$this->newpost['forumid'] = spdb_table(SFTOPICS, 'topic_id=' . $this->newpost['topicid'], 'forum_id');
# Get post count in topic to enable post index setting
$index = spdb_count(SFPOSTS, 'topic_id = ' . $this->newpost['topicid']);
$index++;
$this->newpost['postindex'] = $index;
# if topic lock set in post reply update topic (post only)
if ($this->action == 'post' && $this->newpost['topicstatus']) {
spdb_query('UPDATE ' . SFTOPICS . ' SET topic_status=1 WHERE topic_id=' . $this->newpost['topicid']);
}
$this->newpost = apply_filters('sph_new_post_pre_data_saved', $this->newpost);
$spdb = new spdbComplex();
$spdb->table = SFPOSTS;
$spdb->fields = array('post_content', 'post_date', 'topic_id', 'forum_id', 'user_id', 'guest_name', 'guest_email', 'post_pinned', 'post_index', 'post_status', 'poster_ip', 'source');
$spdb->data = array($this->newpost['postcontent'], $this->newpost['postdate'], $this->newpost['topicid'], $this->newpost['forumid'], $this->newpost['userid'], $this->newpost['guestname'], $this->newpost['guestemail'], $this->newpost['postpinned'], $this->newpost['postindex'], $this->newpost['poststatus'], $this->newpost['posterip'], $this->newpost['source']);
$spdb = apply_filters('sph_new_post_data', $spdb);
$this->newpost['db'] = $spdb->insert();
if ($this->newpost['db'] == true) {
$this->newpost['postid'] = $spVars['insertid'];
$this->newpost = apply_filters('sph_new_post_data_saved', $this->newpost);
} else {
$this->abort = true;
$this->message = sp_text('Unable to save new post message');
return;
}
# Update the timestamp of the last post
sp_update_option('poststamp', $this->newpost['postdate']);
$this->returnURL = sp_build_url($this->newpost['forumslug'], $this->newpost['topicslug'], 0, $this->newpost['postid']);
if ($this->newpost['poststatus']) {
$this->newpost['submsg'] .= ' - ' . sp_text('placed in moderation') . ' ';
}
# Now for all that post-save processing required
if ($this->guest) {
$sfguests = sp_get_option('sfguests');
if ($sfguests['storecookie']) {
sp_write_guest_cookie($this->newpost['guestname'], $this->newpost['guestemail']);
}
} else {
$postcount = sp_get_member_item($this->newpost['userid'], 'posts');
$postcount++;
sp_update_member_item($this->newpost['userid'], 'posts', $postcount);
# see if postcount qualifies member for new user group membership
# get rankings information
if (!$this->admin) {
# ignore for admins as they dont belong to user groups
global $spGlobals;
if (!empty($spGlobals['forum_rank'])) {
$index = 0;
foreach ($spGlobals['forum_rank'] as $x => $info) {
$rankdata['title'][$index] = $x;
$rankdata['posts'][$index] = $info['posts'];
$rankdata['usergroup'][$index] = $info['usergroup'];
$index++;
}
# sort rankings
array_multisort($rankdata['posts'], SORT_ASC, $rankdata['title'], $rankdata['usergroup']);
# check for new ranking
for ($x = 0; $x < count($rankdata['posts']); $x++) {
if ($postcount <= $rankdata['posts'][$x] && !empty($rankdata['usergroup'][$x])) {
# if a user group is tied to forum rank add member to the user group
if ($rankdata['usergroup'][$x] != 'none') {
sp_add_membership($rankdata['usergroup'][$x], $this->newpost['userid']);
}
break;
# only update highest rank
}
}
}
//.........这里部分代码省略.........
示例12: sp_perform_install
//.........这里部分代码省略.........
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_event(time(), 'hourly', 'sph_stats_cron');
# set up weekly news processing
wp_schedule_event(time(), 'sp_news_interval', 'sph_news_cron');
sp_add_sfmeta('news', 'news', array('id' => -999.999, 'show' => 0, 'news' => esc_sql(spa_text('Latest Simple Press News will be shown here'))));
# create initial last post time stamp
sp_add_option('poststamp', current_time('mysql'));
# setup mysql search sfmeta values (5.2.0)
$s = array();
$v = spdb_select('row', "SHOW VARIABLES LIKE 'ft_min_word_len'");
empty($v->Value) ? $s['min'] = 4 : ($s['min'] = $v->Value);
$v = spdb_select('row', "SHOW VARIABLES LIKE 'ft_max_word_len'");
empty($v->Value) ? $s['max'] = 84 : ($s['max'] = $v->Value);
sp_add_sfmeta('mysql', 'search', $s, true);
# combined css and js cache fles
sp_add_option('combinecss', false);
sp_add_option('combinejs', false);
sp_add_option('post_count_delete', false);
$spError = array();
$spError['spErrorLogOff'] = false;
$spError['spNoticesOff'] = false;
sp_update_option('spErrorOptions', $spError);
# new posts/topic cached array
sp_add_sfmeta('topic_cache', 'new', '', true);
sp_add_option('topic_cache', 200);
sp_add_option('floodcontrol', 10);
sp_add_option('captcha-value', time());
sp_add_option('editpostdays', 7);
sp_create_inspectors();
echo '<h5>' . spa_text('Phase') . ' - ' . $phase . ' - ';
spa_etext('Default forum options created') . '</h5>';
break;
case 6:
# Create sp-resources folder for the current install - does not include themes, plugins or languages
$perms = fileperms(SF_STORE_DIR);
$owners = stat(SF_STORE_DIR);
if ($perms === false) {
$perms = 0755;
}
$basepath = '';
if (is_multisite()) {
# construct multisite storage directory structure and create if necessary
$basepath .= 'blogs.dir/' . SFBLOGID;
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
@mkdir(SF_STORE_DIR . '/' . $basepath, $perms);
}
$basepath .= '/files';
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
@mkdir(SF_STORE_DIR . '/' . $basepath, $perms);
}
$basepath .= '/';
}
$basepath .= 'sp-resources';
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
示例13: 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;
}
示例14: sp_update_recent_members
function sp_update_recent_members()
{
$newuserlist = sp_get_option('spRecentMembers');
if (is_array($newuserlist)) {
for ($x = 0; $x < count($newuserlist); $x++) {
$newuserlist[$x]['name'] = sp_get_member_item($newuserlist[$x]['id'], 'display_name');
}
}
sp_update_option('spRecentMembers', $newuserlist);
}
示例15: sp_create_forum_image_location
function sp_create_forum_image_location()
{
# storage location
$basepath = '';
$perms = fileperms(SF_STORE_DIR);
$owners = stat(SF_STORE_DIR);
if ($perms === false) {
$perms = 0755;
}
if (is_multisite()) {
# construct multisite storage directory structure and create if necessary
$basepath .= 'blogs.dir/' . SFBLOGID;
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
@mkdir(SF_STORE_DIR . '/' . $basepath, $perms);
}
$basepath .= '/files';
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
@mkdir(SF_STORE_DIR . '/' . $basepath, $perms);
}
$basepath .= '/';
}
$basepath .= 'sp-resources';
if (!file_exists(SF_STORE_DIR . '/' . $basepath)) {
@mkdir(SF_STORE_DIR . '/' . $basepath, $perms);
}
if (file_exists(SF_STORE_DIR . '/' . $basepath)) {
# Is the ownership correct?
$newowners = stat(SF_STORE_DIR . '/' . $basepath);
if ($newowners['uid'] != $owners['uid'] || $newowners['gid'] != $owners['gid']) {
@chown(SF_STORE_DIR . '/' . $basepath, $owners['uid']);
@chgrp(SF_STORE_DIR . '/' . $basepath, $owners['gid']);
}
}
$newpath = SF_STORE_DIR . '/' . $basepath . '/forum-feature-images';
if (!file_exists($newpath)) {
$sfconfig = sp_get_option('sfconfig');
$sfconfig['forum-images'] = $basepath . '/forum-feature-images';
sp_update_option('sfconfig', $sfconfig);
@mkdir($newpath, $perms);
}
}