• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bb_check_admin_referer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中bb_check_admin_referer函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_check_admin_referer函数的具体用法?PHP bb_check_admin_referer怎么用?PHP bb_check_admin_referer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bb_check_admin_referer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: em_options

/**
 * Makes a settings page for the plugin
 * 
 * @uses bb_option_form_element() to generate the page
 */
function em_options()
{
    global $em_plugopts;
    if ($_POST['em_opts_submit'] == 1) {
        /* Settings have been received, now save them! */
        bb_check_admin_referer('em-save-chk');
        /* Security Check */
        /* Checks on options, and then save them */
        $em_plugopts['link-tags'] = intval($_POST['link-tags']) == 1 ? 1 : 0;
        $em_plugopts['link-users'] = intval($_POST['link-users']) == 1 ? 1 : 0;
        $em_plugopts['link-user-to'] = $_POST['link-user-to'] == 'website' ? 'website' : 'profile';
        $em_plugopts['reply-link'] = intval($_POST['reply-link']) == 1 ? 1 : 0;
        $em_plugopts['reply-text'] = esc_attr($_POST['reply-text']);
        bb_update_option(EM_OPTIONS, $em_plugopts);
        bb_admin_notice(__('The options were successfully saved!', 'easy-mentions'));
    }
    if ($ver = em_update_check()) {
        /* Check for Updates and if available, then notify */
        bb_admin_notice(sprintf(__('New version (%1$s) of Easy Mentions is available! Please download the latest version from <a href="%2$s">here</a>.', 'easy-mentions'), $ver, 'http://bbpress.org/plugins/topic/easy-mentions/'));
    }
    /* Options in an array to be printed */
    $options = array('link-tags' => array('title' => __('Link the Tags?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-tags'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the tags to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>#tag</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-users' => array('title' => __('Link the Users?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-users'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the users to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>@user</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-user-to' => array('title' => __('Link the user to profile or website?', 'easy-mentions'), 'type' => 'radio', 'value' => $em_plugopts['link-user-to'] == 'website' ? 'website' : 'profile', 'note' => __('If you selected the website option and the user\'s website does not exist, then the user will be linked to his or her profile page.', 'easy-mentions'), 'options' => array('profile' => __('Profile', 'easy-mentions'), 'website' => __('Website', 'easy-mentions'))), 'reply-link' => array('title' => __('Add a reply link below each post?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['reply-link'] == 1 ? '1' : '0', 'note' => sprintf(__('Before checking this option, please verify that there is a post form below the topic on each page. (<a href="%s">Help</a>)', 'easy-mentions'), 'http://bbpress.org/plugins/topic/easy-mentions/faq/'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'reply-text' => array('title' => __('Reply Text', 'easy-mentions'), 'class' => array('long'), 'value' => $em_plugopts['reply-text'] ? stripslashes($em_plugopts['reply-text']) : '<em>Replying to @%%USERNAME%%\'s <a href="%%POSTLINK%%">post</a>:</em>', 'after' => '<div style="clear:both;"></div>' . sprintf(__('Some HTML is allowed. The following keys can also be used:%1$s - Post\'s author\'s name%2$s - Post\'s link', 'after-the-deadline'), '<br /><strong>%%USERNAME%%</strong>', '<br /><strong>%%POSTLINK%%</strong>') . '<br />'));
    if ($em_plugopts['link-users'] != 1) {
        $options['link-user-to']['attributes'] = array('disabled' => 'disabled');
    }
    if ($em_plugopts['reply-link'] != 1) {
        $options['reply-text']['attributes'] = array('disabled' => 'disabled');
    }
    ?>
	
	<h2><?php 
    _e('Easy Mentions', 'easy-mentions');
    ?>
</h2>
	<?php 
    do_action('bb_admin_notices');
    ?>
	<form method="post" class="settings options">
		<fieldset>
			<?php 
    foreach ($options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		</fieldset>
		<fieldset class="submit">
			<?php 
    bb_nonce_field('em-save-chk');
    ?>
			<input type="hidden" name="em_opts_submit" value="1"></input>
			<input class="submit" type="submit" name="submit" value="Save Changes" />
		</fieldset>
		<p><?php 
    printf(__('Happy with the plugin? Why not <a href="%1$s">buy the author a cup of coffee or two</a> or get him something from his <a href="%2$s">wishlist</a>?', 'easy-mentions'), 'http://gaut.am/donate/EM/', 'http://gaut.am/wishlist/');
    ?>
</p>
	</form>
<?php 
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:64,代码来源:admin.php


示例2: wp_redirect

<?php

require 'admin-action.php';
$post_id = (int) $_GET['id'];
if (!bb_current_user_can('delete_post', $post_id)) {
    wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('delete-post_' . $post_id);
$status = (int) $_GET['status'];
$bb_post = bb_get_post($post_id);
$old_status = (int) $bb_post->post_status;
if (!$bb_post) {
    bb_die(__('There is a problem with that post, pardner.'));
}
if (0 == $status && 0 != $bb_post->post_status) {
    // We're undeleting
    add_filter('bb_delete_post', 'bb_topics_replied_on_undelete_post');
}
bb_delete_post($post_id, $status);
$message = '';
switch ($old_status) {
    case 0:
        switch ($status) {
            case 0:
                break;
            case 1:
                $message = 'deleted';
                break;
            default:
                $message = 'spammed';
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:delete-post.php


示例3: elseif

require BB_PATH . 'bb-admin/includes/functions.bb-upgrade.php';
$step = 'unrequired';
$forced = false;
if (isset($_POST['force']) && 1 == $_POST['force']) {
    $forced = true;
} elseif (isset($_GET['force']) && 1 == $_GET['force']) {
    $forced = true;
}
if (bb_get_option('bb_db_version') > bb_get_option_from_db('bb_db_version') || $forced) {
    $forced_input = '';
    if ($forced) {
        $forced_input = '<input type="hidden" name="force" value="1" />';
    }
    $step = 'required';
    if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
        bb_check_admin_referer('bbpress-upgrader');
        define('BB_UPGRADING', true);
        $bbdb->hide_errors();
        $messages = bb_upgrade_all();
        $bbdb->show_errors();
        $upgrade_log = array(__('Beginning upgrade&hellip;'));
        if (is_array($messages['messages'])) {
            $upgrade_log = array_merge($upgrade_log, $messages['messages']);
        }
        $upgrade_log[] = '>>> ' . __('Done');
        $error_log = array();
        if (is_array($messages['errors'])) {
            $error_log = $messages['errors'];
        }
        if (bb_get_option('bb_db_version') === bb_get_option_from_db('bb_db_version') && !count($error_log)) {
            $step = 'complete';
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:upgrade.php


示例4: bb_manage_user_fields

function bb_manage_user_fields($edit_user = '')
{
    global $nxt_roles, $nxt_users_object, $bbdb;
    // Cap checks
    $user_roles = $nxt_roles->role_names;
    $can_keep_gate = bb_current_user_can('keep_gate');
    if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
        bb_check_admin_referer('user-manage');
        // Instantiate required vars
        $_POST = stripslashes_deep($_POST);
        $create_user_errors = new nxt_Error();
        // User login
        $trimmed_user_login = str_replace(' ', '', $_POST['user_login']);
        $user_login = sanitize_user($_POST['user_login'], true);
        $user_meta['first_name'] = $_POST['first_name'];
        $user_meta['last_name'] = $_POST['last_name'];
        $user_display_name = $_POST['display_name'];
        $user_email = $_POST['user_email'];
        $user_url = $_POST['user_url'];
        $user_meta['from'] = $_POST['from'];
        $user_meta['occ'] = $_POST['occ'];
        $user_meta['interest'] = $_POST['interest'];
        $user_role = $_POST['userrole'];
        $user_meta['throttle'] = $_POST['throttle'];
        $user_pass1 = $_POST['pass1'];
        $user_pass2 = $_POST['pass2'];
        $user_status = 0;
        $user_pass = false;
        $user_url = $user_url ? bb_fix_link($user_url) : '';
        // Check user_login
        if (!isset($_GET['action']) && empty($user_login)) {
            $create_user_errors->add('user_login', __('Username is a required field.'));
        } else {
            if ($user_login !== $trimmed_user_login) {
                $create_user_errors->add('user_login', sprintf(__('%s is an invalid username. How\'s this one?'), esc_html($_POST['user_login'])));
                $user_login = $trimmed_user_login;
            }
        }
        // Check email
        if (isset($user_email) && empty($user_email)) {
            $create_user_errors->add('user_email', __('Email address is a required field.'));
        }
        // Password Sanity Check
        if ((!empty($user_pass1) || !empty($user_pass2)) && $user_pass1 !== $user_pass2) {
            $create_user_errors->add('pass', __('You must enter the same password twice.'));
        } elseif (!isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $create_user_errors->add('pass', __('You must enter a password.'));
        } elseif (isset($_GET['action']) && (empty($user_pass1) && empty($user_pass2))) {
            $user_pass = '';
        } else {
            $user_pass = $user_pass1;
        }
        // No errors
        if (!$create_user_errors->get_error_messages()) {
            // Create or udpate
            switch ($_POST['action']) {
                case 'create':
                    $goback = bb_get_uri('bb-admin/users.php', array('created' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
                            bb_send_pass($user['ID'], $user_pass);
                        }
                        do_action('bb_new_user', $user['ID'], $user_pass);
                    }
                    break;
                case 'update':
                    $goback = bb_get_uri('bb-admin/users.php', array('updated' => 'true'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
                    $user = $nxt_users_object->get_user($_GET['user_id'], array('output' => ARRAY_A));
                    bb_update_user($user['ID'], $user_email, $user_url, $user_display_name);
                    // Don't change PW if empty
                    if (!empty($user_pass)) {
                        bb_update_user_password($user['ID'], $user_pass);
                    }
                    // Error handler
                    if (is_nxt_error($user)) {
                        bb_admin_notice($user);
                        unset($goback);
                        // Update additional user data
                    } else {
                        // Update caps
                        bb_update_usermeta($user['ID'], $bbdb->prefix . 'capabilities', array($user_role => true));
                        // Update all user meta
                        foreach ($user_meta as $key => $value) {
                            bb_update_usermeta($user['ID'], $key, $value);
                        }
                        // Don't send email if empty
                        if (!empty($user_pass)) {
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:101,代码来源:functions.bb-admin.php


示例5: array

// Set some low capabilities if the current user has none
if (!isset($user->capabilities)) {
    $user->capabilities = array('inactive' => true);
}
// Store the profile info keys
$profile_info_keys = bb_get_profile_info_keys('profile-edit');
// Store additional keys if the current user has access to them
if (bb_current_user_can('edit_users')) {
    $profile_admin_keys = bb_get_profile_admin_keys('profile-edit');
    $assignable_caps = bb_get_assignable_caps();
}
// Instantiate the error object
$errors = new nxt_Error();
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
    $_POST = stripslashes_deep($_POST);
    bb_check_admin_referer('edit-profile_' . $user_id);
    // Fix the URL before sanitizing it
    $user_url = bb_fix_link($_POST['user_url']);
    // Sanitize the profile info keys and check for missing required data
    foreach ($profile_info_keys as $key => $label) {
        ${$key} = apply_filters('sanitize_profile_info', $_POST[$key], $key, $_POST[$key]);
        if (!${$key} && $label[0] == 1) {
            $errors->add($key, sprintf(__('%s is required.'), esc_html($label[1])));
            ${$key} = false;
        }
    }
    // Find out if we have a valid email address
    if (isset($user_email) && !($user_email = is_email($user_email))) {
        $errors->add('user_email', __('Invalid email address'), array('data' => $_POST['user_email']));
    }
    // Deal with errors for users who can edit others data
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:profile-edit.php


示例6: bb_ksd_configuration_page_process

function bb_ksd_configuration_page_process()
{
    if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update-akismet-settings') {
        bb_check_admin_referer('options-akismet-update');
        $goback = remove_query_arg(array('invalid-akismet', 'updated-akismet'), wp_get_referer());
        if (!isset($_POST['akismet_stats'])) {
            $_POST['akismet_stats'] = false;
        }
        if (true === (bool) $_POST['akismet_stats']) {
            bb_update_option('akismet_stats', 1);
        } else {
            bb_delete_option('akismet_stats');
        }
        if ($_POST['akismet_key']) {
            $value = stripslashes_deep(trim($_POST['akismet_key']));
            if ($value) {
                if (bb_akismet_verify_key($value)) {
                    bb_update_option('akismet_key', $value);
                } else {
                    $goback = add_query_arg('invalid-akismet', 'true', $goback);
                    bb_safe_redirect($goback);
                    exit;
                }
            } else {
                bb_delete_option('akismet_key');
            }
        } else {
            bb_delete_option('akismet_key');
        }
        $goback = add_query_arg('updated-akismet', 'true', $goback);
        bb_safe_redirect($goback);
        exit;
    }
    if (!empty($_GET['updated-akismet'])) {
        bb_admin_notice(__('<strong>Settings saved.</strong>'));
    }
    if (!empty($_GET['invalid-akismet'])) {
        bb_admin_notice(__('<strong>The key you attempted to enter is invalid. Reverting to previous setting.</strong>'), 'error');
    }
    global $bb_admin_body_class;
    $bb_admin_body_class = ' bb-admin-settings';
}
开发者ID:laiello,项目名称:cartonbank,代码行数:42,代码来源:akismet.php


示例7: bb_check_admin_referer

<?php

require_once 'admin.php';
$file_source = BB_PATH . 'bb-admin/includes/defaults.bb-htaccess.php';
$file_target = BB_PATH . '.htaccess';
include $file_source;
$file_source_rules = $_rules;
// This is a string
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update') {
    bb_check_admin_referer('options-permalinks-update');
    foreach ((array) $_POST as $option => $value) {
        if (!in_array($option, array('_wpnonce', '_wp_http_referer', 'action', 'submit'))) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    $mod_rewrite = (string) bb_get_option('mod_rewrite');
    $goback = remove_query_arg(array('updated', 'notapache', 'notmodrewrite'), wp_get_referer());
    // Make sure mod_rewrite is possible on the server
    if (!$is_apache) {
        bb_delete_option('mod_rewrite_writable');
        $goback = add_query_arg('notapache', 'true', $goback);
        bb_safe_redirect($goback);
        exit;
    } elseif ('0' !== $mod_rewrite && !apache_mod_loaded('mod_rewrite', true)) {
开发者ID:laiello,项目名称:cartonbank,代码行数:31,代码来源:options-permalinks.php


示例8: bb_die

        bb_die(__('You are not allowed to write new topics.'));
    }
    bb_check_admin_referer('create-topic');
    $topic = trim($_POST['topic']);
    $tags = trim($_POST['tags']);
    if ('' == $topic) {
        bb_die(__('Please enter a topic title'));
    }
    $args = array();
    if (isset($post_author)) {
        $args['topic_poster_name'] = $args['topic_last_poster_name'] = $post_author;
    }
    $topic_id = bb_new_topic($topic, $forum_id, $tags, $args);
} elseif (isset($_POST['topic_id'])) {
    $topic_id = (int) $_POST['topic_id'];
    bb_check_admin_referer('create-post_' . $topic_id);
}
if (bb_is_login_required() && !bb_current_user_can('write_post', $topic_id)) {
    bb_die(__('You are not allowed to post.  Are you logged in?'));
}
if (!topic_is_open($topic_id)) {
    bb_die(__('This topic has been closed'));
}
$post_data = array('post_text' => stripslashes($_POST['post_content']), 'topic_id' => $topic_id);
foreach (array('post_author', 'post_email', 'post_url') as $field) {
    if (!empty(${$field})) {
        $post_data[$field] = ${$field};
    }
}
$post_id = bb_insert_post($post_data);
$tags = trim($_POST['tags']);
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:bb-post.php


示例9: bb_check_admin_referer

<?php

require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
    $action = @$_POST['action'];
} else {
    $action = false;
}
if (in_array($action, array('update-users', 'update-options'))) {
    bb_check_admin_referer('options-wordpress-' . $action);
    // Deal with advanced user database checkbox when it isn't checked
    if (!isset($_POST['user_bbdb_advanced'])) {
        $_POST['user_bbdb_advanced'] = false;
    }
    foreach ((array) $_POST as $option => $value) {
        if (!in_array($option, array('_wpnonce', '_wp_http_referer', 'action', 'submit'))) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if (($option == 'wp_siteurl' || $option == 'wp_home') && !empty($value)) {
                $value = rtrim($value, " \t\n\r\v/") . '/';
            }
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    if ($action == 'update-users') {
        bb_apply_wp_role_map_to_orphans();
开发者ID:laiello,项目名称:cartonbank,代码行数:31,代码来源:options-wordpress.php


示例10: bb_check_admin_referer

<?php

require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
    bb_check_admin_referer('post-bulk');
    $post_ids = array_map('absint', $_POST['post']);
    $count = 0;
    $action = trim($_POST['action']);
    switch ($action) {
        case 'delete':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 1);
            }
            $query_vars = array('message' => 'deleted', 'count' => $count);
            break;
        case 'undelete':
            foreach ($post_ids as $post_id) {
                $count += (int) (bool) bb_delete_post($post_id, 0);
            }
            $query_vars = array('message' => 'undeleted', 'count' => $count);
            break;
        default:
            if ($action) {
                $query_vars = apply_filters("bulk_post__{$action}", array(), $post_ids, $action);
            }
            break;
    }
    bb_safe_redirect(add_query_arg($query_vars));
    exit;
}
if (!empty($_GET['message'])) {
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:posts.php


示例11: bb_die

<?php

require 'admin.php';
if (!bb_current_user_can('manage_tags')) {
    bb_die(__('You are not allowed to manage tags.'));
}
$old_id = (int) $_POST['id'];
$tag = $_POST['tag'];
bb_check_admin_referer('merge-tag_' . $old_id);
if (!($tag = bb_get_tag($tag))) {
    bb_die(__('The destination tag you specified could not be found.'));
}
if (!bb_get_tag($old_id)) {
    bb_die(__('The original tag could not be found.'));
}
if ($merged = bb_merge_tags($old_id, $tag->tag_id)) {
    bb_die(sprintf(__("Number of topics from which the old tag was removed: %d <br />\n"), $merged['old_count']) . sprintf(__("Number of topics to which the new tag was added: %d <br />\n"), $merged['diff_count']) . sprintf(__("Number of rows deleted from tags table:%d <br />\n"), $merged['destroyed']['tags']) . sprintf(__('<a href="%s">View Results of Merge</a>'), bb_get_tag_link()));
} else {
    bb_die(printf(__("Something odd happened when attempting to merge those tags.<br />\n<a href=\"%s\">Try Again?</a>"), nxt_get_referer()));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:20,代码来源:tag-merge.php


示例12: bb_die

<?php

if (!isset($_GET['doit']) || 'bb-subscribe' != $_GET['doit']) {
    // sanity check
    bb_die(__('What are you trying to do, exactly?'));
}
if (!bb_is_subscriptions_active()) {
    bb_die(__('You can not subscribe to topics.'));
}
if (!isset($_GET['topic_id'])) {
    bb_die(__('Missing topic ID!'));
}
bb_auth('logged_in');
$topic_id = (int) $_GET['topic_id'];
$topic = get_topic($topic_id);
if (!$topic) {
    bb_die(__('Topic not found! What are you subscribing to?'));
}
bb_check_admin_referer('toggle-subscribe_' . $topic_id);
// Okay, we should be covered now
if (in_array($_GET['and'], array('add', 'remove'))) {
    bb_subscription_management($topic->topic_id, $_GET['and']);
}
nxt_redirect(get_topic_link($topic_id, 1));
exit;
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:25,代码来源:action.subscribe.php


示例13: bb_check_admin_referer

<?php

require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update') {
    bb_check_admin_referer('options-writing-update');
    // Deal with xmlrpc checkbox when it isn't checked
    if (!isset($_POST['enable_xmlrpc'])) {
        $_POST['enable_xmlrpc'] = false;
    }
    foreach ((array) $_POST as $option => $value) {
        if (!in_array($option, array('_nxtnonce', '_nxt_http_referer', 'action', 'submit'))) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    $goback = add_query_arg('updated', 'true', nxt_get_referer());
    bb_safe_redirect($goback);
    exit;
}
if (!empty($_GET['updated'])) {
    bb_admin_notice(__('<strong>Settings saved.</strong>'));
}
$general_options = array('edit_lock' => array('title' => __('Lock post editing after'), 'class' => 'short', 'after' => __('minutes'), 'note' => __('A user can edit a post for this many minutes after submitting.')), 'throttle_time' => array('title' => __('Throttle time'), 'class' => 'short', 'after' => __('seconds'), 'note' => __('Users must wait this many seconds between posts. By default, moderators, administrators and keymasters are not throttled.')));
$remote_options = array('enable_xmlrpc' => array('title' => __('XML-RPC'), 'type' => 'checkbox', 'options' => array(1 => __('Enable the bbPress XML-RPC publishing protocol.'))));
$bb_admin_body_class = ' bb-admin-settings';
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:options-writing.php


示例14: bb_auth

<?php

require './bb-load.php';
bb_auth('logged_in');
$tag_id = (int) @$_GET['tag'];
$user_id = (int) @$_GET['user'];
$topic_id = (int) @$_GET['topic'];
bb_check_admin_referer('remove-tag_' . $tag_id . '|' . $topic_id);
$tag = bb_get_tag($tag_id);
$topic = get_topic($topic_id);
$user = bb_get_user($user_id);
if (!$tag || !$topic) {
    bb_die(__('Invalid tag or topic.'));
}
if (false !== bb_remove_topic_tag($tag_id, $user_id, $topic_id)) {
    if (!($redirect = wp_get_referer())) {
        $redirect = get_topic_link($topic_id);
    }
    bb_safe_redirect($redirect);
} else {
    bb_die(__('The tag was not removed.'));
}
exit;
开发者ID:laiello,项目名称:cartonbank,代码行数:23,代码来源:tag-remove.php


示例15: bb_check_admin_referer

<?php

require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
    bb_check_admin_referer('topic-bulk');
    $topic_ids = array_map('absint', $_POST['topic']);
    $affected = 0;
    $action = trim($_POST['action']);
    switch ($action) {
        case 'close':
            foreach ($topic_ids as $topic_id) {
                $affected += bb_close_topic($topic_id);
            }
            $query_vars = array('message' => 'closed', 'count' => $affected);
            break;
        case 'open':
            foreach ($topic_ids as $topic_id) {
                $affected += bb_open_topic($topic_id);
            }
            $query_vars = array('message' => 'opened', 'count' => $affected);
            break;
        case 'delete':
            foreach ($topic_ids as $topic_id) {
                $affected += (int) (bool) bb_delete_topic($topic_id, 1);
            }
            $query_vars = array('message' => 'deleted', 'count' => $affected);
            break;
        case 'undelete':
            foreach ($topic_ids as $topic_id) {
                $affected += (int) (bool) bb_delete_topic($topic_id, 0);
            }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:topics.php


示例16: absint

<?php

require_once 'admin-action.php';
$topic_id = absint($_POST['topic_id']);
$forum_id = absint($_POST['forum_id']);
if (!is_numeric($topic_id) || !is_numeric($forum_id)) {
    bb_die(__('Invalid topic or forum.'));
}
if (!bb_current_user_can('move_topic', $topic_id, $forum_id)) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('move-topic_' . $topic_id);
$topic = get_topic($topic_id);
$forum = bb_get_forum($forum_id);
if (!$topic || !$forum) {
    bb_die(__('Your topic or forum caused all manner of confusion'));
}
bb_move_topic($topic_id, $forum_id);
if (!($redirect = nxt_get_referer())) {
    $redirect = get_topic_link($topic_id);
}
bb_safe_redirect($redirect);
exit;
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:24,代码来源:topic-move.php


示例17: get_topic

<?php

require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
$super = isset($_GET['super']) && 1 == (int) $_GET['super'] ? 1 : 0;
if (!$topic) {
    bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('stick_topic', $topic_id)) {
    wp_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('stick-topic_' . $topic_id);
if (topic_is_sticky($topic_id)) {
    bb_unstick_topic($topic_id);
} else {
    bb_stick_topic($topic_id, $super);
}
if (!($redirect = wp_get_referer())) {
    $redirect = get_topic_link($topic_id);
}
bb_safe_redirect($redirect);
exit;
开发者ID:danielcoats,项目名称:schoolpress,代码行数:24,代码来源:sticky.php


示例18: bb_die

                bb_die($result);
            }
            // Overrides the ?message=error one above
            wp_redirect('plugins.php?plugin_request=' . $plugin_request . '&message=activate&plugin=' . urlencode($plugin));
            break;
        case 'deactivate':
            // Deactivation
            bb_check_admin_referer('deactivate-plugin_' . $plugin);
            // Remove the deactivated plugin
            bb_deactivate_plugins($plugin);
            // Redirect
            wp_redirect('plugins.php?plugin_request=' . $plugin_request . '&message=deactivate&plugin=' . urlencode($plugin));
            break;
        case 'scrape':
            // Scrape php errors from the plugin
            bb_check_admin_referer('scrape-plugin_' . $plugin);
            $valid_path = bb_validate_plugin($plugin);
            if (is_wp_error($valid_path)) {
                bb_die($valid_path);
            }
            // Pump up the errors and output them to screen
            error_reporting(E_ALL ^ E_NOTICE);
            @ini_set('display_errors', true);
            include $valid_path;
            break;
    }
    // Stop processing
    exit;
}
// Display notices
if (isset($_GET['message'])) {
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:plugins.php


示例19: bb_auth

<?php

require './bb-load.php';
bb_auth('logged_in');
$post_id = (int) $_POST['post_id'];
$bb_post = bb_get_post($post_id);
if (!$bb_post) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    die;
}
if (!bb_current_user_can('edit_post', $post_id)) {
    bb_die(__('Sorry, post is too old.'));
}
bb_check_admin_referer('edit-post_' . $post_id);
if (0 != $bb_post->post_status && 'all' == $_GET['view']) {
    // We're trying to edit a deleted post
    add_filter('bb_is_first_where', 'bb_no_where');
}
// Check possible anonymous user data
$post_author = $post_email = $post_url = '';
if (!bb_get_user(get_post_author_id($post_id))) {
    if (!($post_author = sanitize_user(trim($_POST['author'])))) {
        bb_die(__('Every post needs an author name!'));
    } elseif (!($post_email = sanitize_email(trim($_POST['email'])))) {
        bb_die(__('Every post needs a valid email address!'));
    }
    if (!empty($_POST['url'])) {
        $post_url = esc_url(trim($_POST['url']));
    }
}
// Loop through possible anonymous post data
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:bb-edit.php


示例20: bb_check_admin_referer

<?php

require_once 'admin.php';
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && $_POST['action'] == 'update') {
    bb_check_admin_referer('options-general-update');
    foreach ((array) $_POST as $option => $value) {
        if (!in_array($option, array('_wpnonce', '_wp_http_referer', 'action', 'submit'))) {
            $option = trim($option);
            $value = is_array($value) ? $value : trim($value);
            $value = stripslashes_deep($value);
            if ($option == 'uri' && !empty($value)) {
                $value = rtrim($value, " \t\n\r\v/") . '/';
            }
            if ($value) {
                bb_update_option($option, $value);
            } else {
                bb_delete_option($option);
            }
        }
    }
    $goback = add_query_arg('updated', 'true', wp_get_referer());
    bb_safe_redirect($goback);
    exit;
}
if (!empty($_GET['updated'])) {
    bb_admin_notice(__('<strong>Settings saved.</strong>'));
}
$general_options = array('name' => array('title' => __('Site title'), 'class' => 'long'), 'description' => array('title' => __('Tagline'), 'class' => 'long', 'note' => __('In a few words, explain what this site is about.')), 'uri' => array('title' => __('bbPress address (URL)'), 'class' => array('long', 'code'), 'note' => __('The full URL of your bbPress install.')), 'from_email' => array('title' => __('E-mail address'), 'note' => __('This address is used for admin purposes, like new user notification.')));
$time_options = array('gmt_offset' => array('title' => __('Time zone'), 'type' => 'select', 'options' => array('-12' => '-12:00', '-11.5' => '-11:30', '-11' => '-11:00', '-10.5' => '-10:30', '-10' => '-10:00', '-9.5' => '-9:30', '-9' => '-9:00', '-8.5' => '-8:30', '-8' => '-8:00', '-7.5' => '-7:30', '-7' => '-7:00', '-6.5' => '-6:30', '-6' => '-6:00', '-5.5' => '-5:30', '-5' => '-5:00', '-4.5' => '-4:30', '-4' => '-4:00', '-3.5' => '-3:30', '-3' => '-3:00', '-2.5' => '-2:30', '-2' => '-2:00', '-1.5' => '-1:30', '-1' => '-1:00', '-0.5' => '-0:30', '0' => '', '0.5' => '+0:30', '1' => '+1:00', '1.5' => '+1:30', '2' => '+2:00', '2.5' => '+2:30', '3' => '+3:00', '3.5' => '+3:30', '4' => '+4:00', '4.5' => '+4:30', '5' => '+5:00', '5.5' => '+5:30', '5.75' => '+5:45', '6' => '+6:00', '6.5' => '+6:30', '7' => '+7:00', '7.5' => '+7:30', '8' => '+8:00', '8.5' => '+8:30', '8.75' => '+8:45', '9' => '+9:00', '9.5' => '+9:30', '10' => '+10:00', '10.5' => '+10:30', '11' => '+11:00', '11.5' => '+11:30', '12' => '+12:00', '12.75' => '+12:45', '13' => '+13:00', '13.75' => '+13:45', '14' => '+14:00'), 'after' => __('hours')), 'datetime_format' => array('title' => __('Date and time format'), 'class' => 'short', 'value' => bb_get_datetime_formatstring_i18n(), 'after' => bb_datetime_format_i18n(bb_current_time()), 'note' => array(__('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>.'), __('Click "Save Changes" to update sample output.'))), 'date_format' => array('title' => __('Date format'), 'class' => 'short', 'value' => bb_get_datetime_formatstring_i18n('date'), 'after' => bb_datetime_format_i18n(bb_current_time(), 'date')));
if (!($gmt_offset = bb_get_option('gmt_offset'))) {
    $gmt_offset = 0;
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:options-general.php



注:本文中的bb_check_admin_referer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bb_code函数代码示例发布时间:2022-05-24
下一篇:
PHP bb_admin_notice函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap