当前位置: 首页>>代码示例>>PHP>>正文


PHP bb_safe_redirect函数代码示例

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


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

示例1: bb_manage_user_fields


//.........这里部分代码省略.........
        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)) {
                            bb_send_pass($user['ID'], $user_pass);
                        }
                        do_action('bb_update_user', $user['ID'], $user_pass);
                    }
                    break;
            }
            // Redirect
            if (isset($goback) && !empty($goback)) {
                bb_safe_redirect($goback);
            }
            // Error handler
        } else {
            bb_admin_notice($create_user_errors);
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == 'edit') {
        if (isset($_GET['user_id']) && is_numeric($_GET['user_id'])) {
            $disabled = true;
            // Get the user
            if (empty($edit_user)) {
                $edit_user = bb_get_user(bb_get_user_id($_GET['user_id']));
            }
            // Instantiate required vars
            $user_login = $edit_user->user_login;
            $user_meta['first_name'] = $edit_user->first_name;
            $user_meta['last_name'] = $edit_user->last_name;
            $user_display_name = $edit_user->display_name;
            $user_email = $edit_user->user_email;
            $user_url = $edit_user->user_url;
            $user_meta['from'] = $edit_user->from;
            $user_meta['occ'] = $edit_user->occ;
            $user_meta['interest'] = $edit_user->interest;
            $user_role = array_search('true', $edit_user->capabilities);
            $user_meta['throttle'] = $edit_user->throttle;
            // Keymasters can't demote themselves
            if ($edit_user->ID == bb_get_current_user_info('id') && $can_keep_gate || isset($edit_user->capabilities) && is_array($edit_user->capabilities) && array_key_exists('keymaster', $edit_user->capabilities) && !$can_keep_gate) {
                $user_roles = array('keymaster' => $user_roles['keymaster']);
            } elseif (!$can_keep_gate) {
                unset($user_roles['keymaster']);
            }
        }
    }
    // Load password strength checker
    nxt_enqueue_script('password-strength-meter');
    nxt_enqueue_script('profile-edit');
    // Generate a few PW hints
    $some_pass_hints = '';
    for ($l = 3; $l != 0; $l--) {
        $some_pass_hints .= '<p>' . bb_generate_password() . '</p>';
    }
    // Create  the user fields
    $user_fields = array('user_login' => array('title' => __('Username'), 'note' => __('Required! Unique identifier for new user.'), 'value' => $user_login, 'disabled' => $disabled), 'first_name' => array('title' => __('First Name'), 'value' => $user_meta['first_name']), 'last_name' => array('title' => __('Last Name'), 'value' => $user_meta['last_name']), 'display_name' => array('title' => __('Display Name'), 'value' => $user_display_name), 'user_email' => array('title' => __('Email'), 'note' => __('Required! Will be used for notifications and profile settings changes.'), 'value' => $user_email), 'user_url' => array('title' => __('Website'), 'class' => array('long', 'code'), 'note' => __('The full URL of user\'s homepage or blog.'), 'value' => $user_url), 'from' => array('title' => __('Location'), 'class' => array('long'), 'value' => $user_meta['from']), 'occ' => array('title' => __('Occupation'), 'class' => array('long'), 'value' => $user_meta['occ']), 'interest' => array('title' => __('Interests'), 'class' => array('long'), 'value' => $user_meta['interest']), 'userrole' => array('title' => __('User Role'), 'type' => 'select', 'options' => $user_roles, 'note' => __('Allow user the above privileges.'), 'value' => $user_role), 'pass1' => array('title' => __('New Password'), 'type' => 'password', 'class' => array('short', 'text', 'code'), 'note' => __('Hints: ') . $some_pass_hints, 'value' => $user_pass1), 'pass2' => array('title' => __('Repeat New Password'), 'type' => 'password', 'class' => array('short', 'text', 'code'), 'note' => __('If you ignore hints, remember: the password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'), 'value' => $user_pass2), 'email_pass' => array('title' => '', 'type' => 'checkbox', 'options' => array('1' => array('label' => __('Email the new password.'), 'attributes' => array('checked' => true)))), 'pass-strength-fake-input' => array('title' => __('Password Strength'), 'type' => 'hidden'));
    return apply_filters('bb_manage_user_fields', $user_fields);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:101,代码来源:functions.bb-admin.php

示例2: get_topic

<?php

require 'admin-action.php';
$topic_id = (int) $_GET['id'];
$topic = get_topic($topic_id);
if (!$topic) {
    bb_die(__('There is a problem with that topic, pardner.'));
}
if (!bb_current_user_can('close_topic', $topic_id)) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    exit;
}
bb_check_admin_referer('close-topic_' . $topic_id);
if (topic_is_open($topic_id)) {
    bb_close_topic($topic_id);
    $message = 'closed';
} else {
    bb_open_topic($topic_id);
    $message = 'opened';
}
if ($sendto = nxt_get_referer()) {
    $sendto = remove_query_arg('message', $sendto);
    $sendto = add_query_arg('message', $message, $sendto);
} else {
    $sendto = get_topic_link($topic_id);
}
bb_safe_redirect($sendto);
exit;
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:28,代码来源:topic-toggle.php

示例3: bb_ssl_redirect

bb_ssl_redirect();
bb_auth();
if (bb_get_option('bb_db_version') > bb_get_option_from_db('bb_db_version')) {
    bb_safe_redirect('upgrade.php');
    die;
}
require_once BB_PATH . 'bb-admin/includes/functions.bb-admin.php';
$bb_admin_page = bb_find_filename($_SERVER['PHP_SELF']);
$_check_callback = false;
if ($bb_admin_page == 'admin-base.php') {
    $bb_admin_page = (string) @$_GET['plugin'];
    $_check_callback = true;
}
wp_enqueue_script('common');
bb_user_settings();
if (isset($_GET['foldmenu'])) {
    if ($_GET['foldmenu']) {
        bb_update_user_setting('fm', 'f');
    } else {
        bb_delete_user_setting('fm');
    }
    bb_safe_redirect(remove_query_arg('foldmenu', stripslashes($_SERVER['REQUEST_URI'])));
    die;
}
bb_admin_menu_generator();
bb_get_current_admin_menu();
if ($_check_callback) {
    if (empty($bb_registered_plugin_callbacks) || empty($bb_admin_page) || !in_array($bb_admin_page, $bb_registered_plugin_callbacks)) {
        unset($bb_admin_page);
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:admin.php

示例4: bb_die

            bb_die(__('No forums to update!'));
        }
        if ((int) $_POST['forum_id'] && isset($_POST['forum_name']) && '' !== $_POST['forum_name']) {
            bb_update_forum($_POST);
        }
        foreach (array('action', 'id') as $arg) {
            $sent_from = remove_query_arg($arg, $sent_from);
        }
        bb_safe_redirect(add_query_arg('message', 'updated', $sent_from));
        exit;
        break;
    case 'delete':
        bb_check_admin_referer('delete-forums');
        $forum_id = (int) $_POST['forum_id'];
        $move_topics_forum = (int) $_POST['move_topics_forum'];
        if (!bb_current_user_can('delete_forum', $forum_id)) {
            bb_die(__("You don't have the authority to kill off the forums."));
        }
        if (isset($_POST['move_topics']) && $_POST['move_topics'] != 'delete') {
            bb_move_forum_topics($forum_id, $move_topics_forum);
        }
        if (!bb_delete_forum($forum_id)) {
            bb_die(__('Error occured while trying to delete forum'));
        }
        foreach (array('action', 'id') as $arg) {
            $sent_from = remove_query_arg($arg, $sent_from);
        }
        bb_safe_redirect(add_query_arg('message', 'deleted', $sent_from));
        exit;
        break;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:bb-forum.php

示例5: 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

示例6: bb_ssl_redirect

/**
 * Forces redirection to an SSL page when required
 *
 * @since 1.0
 *
 * @return void
 */
function bb_ssl_redirect()
{
    $page = bb_get_location();
    do_action('bb_ssl_redirect');
    if (BB_IS_ADMIN) {
        if (!force_ssl_admin()) {
            return;
        }
    } else {
        switch ($page) {
            case 'login-page':
            case 'register-page':
                if (!force_ssl_login()) {
                    return;
                }
                break;
            case 'profile-page':
                global $self;
                if ($self == 'profile-edit.php') {
                    if (!force_ssl_login()) {
                        return;
                    }
                } else {
                    return;
                }
                break;
            default:
                return;
                break;
        }
    }
    if (is_ssl()) {
        return;
    }
    $uri_ssl = parse_url(bb_get_option('uri_ssl'));
    $uri = $uri_ssl['scheme'] . '://' . $uri_ssl['host'] . $_SERVER['REQUEST_URI'];
    bb_safe_redirect($uri);
    exit;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:46,代码来源:functions.bb-core.php

示例7: 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

示例8: stripslashes_deep

            $value = stripslashes_deep($value);
            if (($option == 'nxt_siteurl' || $option == 'nxt_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_nxt_role_map_to_orphans();
    }
    $goback = add_query_arg('updated', $action, nxt_get_referer());
    bb_safe_redirect($goback);
    exit;
}
switch (@$_GET['updated']) {
    case 'update-users':
        bb_admin_notice(__('<strong>User role mapping saved.</strong>'));
        break;
    case 'update-options':
        bb_admin_notice(__('<strong>User integration settings saved.</strong>'));
        break;
}
$bb_role_names[''] = _c('none|no bbPress role');
$bb_role_names = array_merge($bb_role_names, array_map(create_function('$a', 'return sprintf( _c( "bbPress %s|bbPress role" ), $a );'), $nxt_roles->get_names()));
$nxtRoles = array('administrator' => __('NXTClass Administrator'), 'editor' => __('NXTClass Editor'), 'author' => __('NXTClass Author'), 'contributor' => __('NXTClass Contributor'), 'subscriber' => __('NXTClass Subscriber'));
$nxtRoles = apply_filters('role_map_nxt_roles', $nxtRoles);
$cookie_options = array('nxt_siteurl' => array('title' => __('NXTClass address (URL)'), 'class' => 'long', 'note' => __('This value should exactly match the <strong>NXTClass address (URL)</strong> setting in your NXTClass general settings.')), 'nxt_home' => array('title' => __('Blog address (URL)'), 'class' => 'long', 'note' => __('This value should exactly match the <strong>Blog address (URL)</strong> setting in your NXTClass general settings.')), 'bb_auth_salt' => array('title' => __('NXTClass "auth" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "auth_salt" in your NXTClass site. Look for the option labeled "auth_salt" in <a href="#" id="getAuthSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>.')), 'bb_secure_auth_salt' => array('title' => __('NXTClass "secure auth" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "secure_auth_salt" in your NXTClass site. Look for the option labeled "secure_auth_salt" in <a href="#" id="getSecureAuthSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>. Sometimes this value is not set in NXTClass, in that case you can leave this setting blank as well.')), 'bb_logged_in_salt' => array('title' => __('NXTClass "logged in" cookie salt'), 'note' => __('This must match the value of the NXTClass setting named "logged_in_salt" in your NXTClass site. Look for the option labeled "logged_in_salt" in <a href="#" id="getLoggedInSaltOption" onclick="window.open(this.href); return false;">this NXTClass admin page</a>.')));
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:options-nxtclass.php

示例9: array

            }
            $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'])) {
    $message_count = isset($_GET['count']) ? (int) $_GET['count'] : 1;
    switch ((string) $_GET['message']) {
        case 'undeleted':
            bb_admin_notice(sprintf(_n('<strong>Post undeleted.</strong>', '<strong>%s posts undeleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'deleted':
            bb_admin_notice(sprintf(_n('<strong>Post deleted.</strong>', '<strong>%s posts deleted.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'spammed':
            bb_admin_notice(sprintf(_n('<strong>Post spammed.</strong>', '<strong>%s posts spammed.</strong>', $message_count), bb_number_format_i18n($message_count)));
            break;
        case 'unspammed-normal':
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:posts.php

示例10: bb_get_forums

<?php

require_once 'admin.php';
$forums = bb_get_forums();
$forums_count = $forums ? count($forums) : 0;
if (isset($_GET['action']) && 'delete' == $_GET['action']) {
    $forum_to_delete = (int) $_GET['id'];
    $deleted_forum = bb_get_forum($forum_to_delete);
    if (!$deleted_forum || $forums_count < 2 || !bb_current_user_can('delete_forum', $forum_to_delete)) {
        bb_safe_redirect(add_query_arg(array('action' => false, 'id' => false)));
        exit;
    }
}
if (isset($_GET['message'])) {
    switch ($_GET['message']) {
        case 'updated':
            bb_admin_notice(__('<strong>Forum Updated.</strong>'));
            break;
        case 'deleted':
            bb_admin_notice(sprintf(__('<strong>Forum deleted.</strong>  You should <a href="%s">recount your site information</a>.'), bb_get_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)));
            break;
    }
}
if (!isset($_GET['action'])) {
    nxt_enqueue_script('admin-forums');
} elseif ('delete' == @$_GET['action']) {
    bb_admin_notice(sprintf(__('Are you sure you want to delete the "<strong>%s</strong>" forum?'), $deleted_forum->forum_name));
}
$bb_admin_body_class = ' bb-admin-forums';
bb_get_admin_header();
?>
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:forums.php

示例11: oip_login_success

function oip_login_success($uID = false, $oip_redir = false)
{
    if (!$uID) {
        return false;
    } else {
        if (is_object($uID)) {
            $uID = (int) $uID->ID;
        }
        //echo "loading userID" . $uID;
        wp_set_auth_cookie($uID, 0);
        bb_update_usermeta($uID, 'openid_debug', $_GET);
        if ($_GET['openid_op_endpoint']) {
            bb_update_usermeta($uID, 'oip_openid_url', $_GET['openid_op_endpoint']);
        }
    }
    //update_user_meta	//if user tries with a new openid provider and we get the same email address, we should add it to the user's profile
    //do_action('oip_register_success');
    if ($oip_redir) {
        bb_safe_redirect($oip_redir);
        exit;
    } else {
        bb_safe_redirect(bb_get_option('uri'));
        exit;
    }
    exit;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:26,代码来源:openidplus.php

示例12: bb_li_connect

function bb_li_connect()
{
    global $wp_users_object, $li_attr;
    //li authorization
    if (!$_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
        try_li_connect();
    }
    $me = get_li_profile();
    if (!$me) {
        bb_die("Linkedin Connect failed");
        exit;
    }
    $li_id = trim($me->{$li_attr}['id']);
    //bb_die($li_id);
    if (!$li_id) {
        bb_die("LinkedIn Connect failed, no user id found.");
        exit;
    }
    // Check if the user has already connected before
    $user_id = li_get_userid_by_linkedin_id($li_id);
    if (!$user_id) {
        // User did not exist yet, lets create the local account
        // First order of business is to find a unused usable account name
        for ($i = 1;; $i++) {
            $user_login = strtolower(sanitize_user(li_get_user_displayname($me), true));
            $user_login = str_replace(' ', '_', $user_login);
            $user_login = str_replace('__', '_', $user_login);
            if (strlen($user_login) < 2) {
                $user_login = "user";
            }
            if (strlen($user_login) > 50 - strlen($i)) {
                $user_login = substr($user_login, 0, 50 - strlen($i));
            }
            if ($i > 1) {
                $user_login .= $i;
            }
            // A very rare potential race condition exists here, if two users with the same name
            // happen to register at the same time. One of them would fail, and have to retry.
            if (bb_get_user($user_login, array('by' => 'login')) === false) {
                break;
            }
        }
        $user_nicename = $user_login;
        $user_email = $user_login . "@none.local";
        $user_url = trim($me->{$li_attr}['public-profile-url']);
        $user_url = $user_url ? bb_fix_link($user_url) : '';
        $user_status = 0;
        $user_pass = bb_generate_password();
        // User may have given permission to use his/her real email. Lets use it if so.
        /*if (isset($me['email']) && $me['email'] != '' && is_email($me['email'])) {
        			$user_email = trim($me['email']);
        			if (bb_get_user($user_email, array ('by' => 'email')) !== false) {
        				// Uh oh. A user with this email already exists. This does not work out for us.
        				bb_die("Error: an user account with the email address '$user_email' already exists.");
        			}	
        		}*/
        $user = $wp_users_object->new_user(compact('user_login', 'user_email', 'user_url', 'user_nicename', 'user_status', 'user_pass'));
        if (!$user || is_wp_error($user)) {
            bb_die("Creating new user failed");
            exit;
        }
        $user_id = $user['ID'];
        //bb_die($user_id);
        bb_update_usermeta($user_id, $bbdb->prefix . 'capabilities', array('member' => true));
        bb_update_usermeta($user_id, 'linkedin_id', $li_id);
        bb_update_usermeta($user_id, 'prompt_email', '1');
        // will prompt user for email until set false. 1=true 0=false
        bb_update_usermeta($user_id, 'li_avatar', trim($me->{$li_attr}['picture-url']));
        // user avatar
        bb_update_user($user_id, $user_email, $user_url, li_get_user_displayname($me));
        bb_update_usermeta($user_id, 'first_name', trim($me->{$li_attr}['first-name']));
        bb_update_usermeta($user_id, 'last_name', trim($me->{$li_attr}['last-name']));
        bb_update_usermeta($user_id, 'occ', trim($me->{$li_attr}['headline']));
        bb_update_usermeta($user_id, 'interest', trim($me->{$li_attr}['industry']));
        do_action('bb_new_user', $user_id, $user_pass);
        do_action('register_user', $user_id);
    } else {
        bb_update_usermeta($user_id, 'prompt_email', '1');
        bb_update_usermeta($user_id, 'li_avatar', trim($me->{$li_attr}['picture-url']));
        if (!bb_get_option('li_allow_useredit')) {
            // enforce first name, last name and display name if the users are not allowed to change them
            bb_update_user($user_id, bb_get_user_email($user_id), get_user_link($user_id), li_get_user_displayname($me));
            bb_update_usermeta($user_id, 'first_name', trim($me->{$li_attr}['first-name']));
            bb_update_usermeta($user_id, 'last_name', trim($me->{$li_attr}['last-name']));
            bb_update_usermeta($user_id, 'occ', trim($me->{$li_attr}['headline']));
            bb_update_usermeta($user_id, 'interest', trim($me->{$li_attr}['industry']));
        }
    }
    bb_set_auth_cookie($user_id, true);
    do_action('bb_user_login', $user_id);
    $redirect_url = $_REQUEST['li_bb_connect'];
    if (strpos($redirect_url, bb_get_option('uri')) !== 0) {
        $redirect_url = bb_get_option('uri');
    }
    bb_safe_redirect($redirect_url);
    exit;
}
开发者ID:nma,项目名称:linkedin-connect,代码行数:97,代码来源:connect.php

示例13: dirname

if (!function_exists('add_action')) {
    @(include_once dirname(dirname(dirname(__FILE__))) . '/bb-load.php' or exit);
    if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' && isset($_POST['nonce']) && bb_verify_nonce($_POST['nonce'], 'nospamuser-nonce-' . $_SERVER['REMOTE_ADDR'])) {
        $settings = bb_get_option('nospamuser-settings');
        if ($settings['recaptcha_mode'] == 'aggressive') {
            exit;
        }
        if (!function_exists('recaptcha_check_answer')) {
            // Compatibility with anything else that uses reCAPTCHA
            require_once dirname(__FILE__) . '/recaptchalib.php';
        }
        $resp = recaptcha_check_answer($settings['recaptcha_priv'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
        if ($resp->is_valid) {
            setcookie('nospamuser-override', bb_create_nonce('nospamuser-override-' . $_SERVER['REMOTE_ADDR']), bb_nonce_tick() * apply_filters('bb_nonce_life', 86400) / 2);
        }
        bb_safe_redirect(bb_get_uri('register.php', null, BB_URI_CONTEXT_BB_USER_FORMS + BB_URI_CONTEXT_HEADER));
    }
    exit;
}
function nospamuser_install()
{
    bb_update_option('nospamuser-settings', wp_parse_args(bb_get_option('nospamuser-settings'), array('days' => 30, 'min_occur' => 5, 'max_occur' => 10, 'api_key' => '', 'recaptcha_mode' => 'aggressive', 'recapthca_pub' => '', 'recaptcha_priv' => '', 'stats_public' => 0)));
}
bb_register_plugin_activation_hook(__FILE__, 'nospamuser_install');
function nospamuser_admin_parse()
{
    bb_check_admin_referer('nospamuser-admin');
    $settings = bb_get_option('nospamuser-settings');
    $success = array();
    $error = array();
    if ($_POST['days'] != $settings['days']) {
开发者ID:achorg,项目名称:DH-Answers,代码行数:31,代码来源:bb-nospamuser.php

示例14: bb_check_admin_referer

    }
    $fav = (int) $_GET['fav'];
    $topic_id = (int) $_GET['topic_id'];
    bb_check_admin_referer('toggle-favorite_' . $topic_id);
    $topic = get_topic($topic_id);
    if (!$topic || 0 != $topic->topic_status) {
        exit;
    }
    if ($fav) {
        bb_add_user_favorite($user_id, $topic_id);
    } else {
        bb_remove_user_favorite($user_id, $topic_id);
    }
    $ref = wp_get_referer();
    if (false !== strpos($ref, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT))) {
        bb_safe_redirect($ref);
    } else {
        wp_redirect(get_topic_link($topic_id));
    }
    exit;
}
if (!bb_is_profile()) {
    $sendto = get_profile_tab_link($user->ID, 'favorites');
    wp_redirect($sendto);
    exit;
}
if ($topics = get_user_favorites($user->ID, true)) {
    bb_cache_last_posts($topics);
}
$favorites_total = isset($user->favorites) ? count(explode(',', $user->favorites)) : 0;
bb_load_template('favorites.php', array('favorites_total', 'self'));
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:favorites.php

示例15: bb_anon_settings_page_process

function bb_anon_settings_page_process()
{
    if (isset($_POST['bb_anon_submit_options'])) {
        $anon_id = bb_get_option('bb_anon_user_id');
        $user = new BP_User($anon_id);
        if ($_POST['bb_anon_write_topics'] == Y) {
            bb_update_option('bb_anon_write_topics', "Y");
            //$user->add_cap('write_topics');
        } else {
            bb_update_option('bb_anon_write_topics', "N");
            //$user->remove_cap('write_topics');
        }
        $goback = add_query_arg('bb-anon-options-updated', 'true', wp_get_referer());
        bb_safe_redirect($goback);
    }
    if (isset($_GET['bb-anon-options-updated'])) {
        bb_admin_notice(__('Options Updated.'));
    }
}
开发者ID:voxpelli,项目名称:bb-anonymous-posting,代码行数:19,代码来源:bb-anonymous-posting.php


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