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


PHP Social::wp39_verify_nonce方法代码示例

本文整理汇总了PHP中Social::wp39_verify_nonce方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::wp39_verify_nonce方法的具体用法?PHP Social::wp39_verify_nonce怎么用?PHP Social::wp39_verify_nonce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Social的用法示例。


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

示例1: verify_nonce

 protected function verify_nonce()
 {
     $nonce = $this->request->query('_wpnonce');
     if (!Social::wp39_verify_nonce($nonce, $this->request->action())) {
         Social::log('NONCE Failure', array(), null, true);
         wp_die('Oops, please try again.');
     }
 }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:8,代码来源:controller.php

示例2: action_authorized

 /**
  * Handles the authorized response.
  *
  * @return void
  */
 public function action_authorized()
 {
     // User ID on the request? Must be set before nonce comparison
     $user_id = stripslashes($this->request->query('user_id'));
     if ($user_id !== null) {
         wp_set_current_user($user_id);
     }
     $nonce = stripslashes($this->request->post('id'));
     $salt = stripslashes($this->request->query('salt'));
     if (Social::wp39_verify_nonce($nonce, $this->auth_nonce_key($salt)) === false) {
         Social::log('Failed to verify authentication nonce.');
         echo json_encode(array('result' => 'error', 'message' => 'Invalid nonce'));
         exit;
     }
     Social::log('Authorizing with nonce :nonce.', array('nonce' => $nonce));
     $response = stripslashes_deep($this->request->post('response'));
     $account = (object) array('keys' => (object) $response['keys'], 'user' => (object) $response['user']);
     $account->user = $this->social->kses($account->user);
     $class = 'Social_Service_' . $response['service'] . '_Account';
     $account = new $class($account);
     $service = $this->social->service($response['service'])->account($account);
     $is_personal = false;
     $is_admin = $this->request->query('is_admin');
     if ($is_admin == 'true') {
         $user_id = get_current_user_id();
         $personal = $this->request->query('personal');
         if ($personal === 'true') {
             $is_personal = true;
             $account->personal(true);
         } else {
             $account->universal(true);
         }
         $use_pages = $this->request->query('use_pages');
         if ($use_pages == 'true') {
             $account->use_pages($is_personal, true);
         }
     } else {
         $user_id = $service->create_user($account, $nonce);
         $account->personal(true);
         $is_personal = true;
         // Store avatar
         update_user_meta($user_id, 'social_avatar', $account->avatar());
         update_user_meta($user_id, 'show_admin_bar_front', 'false');
     }
     if ($user_id !== false) {
         Social::log('Saving account #:id.', array('id' => $account->id()));
         $service->save($is_personal);
         // Remove the service from the errors?
         $deauthed = get_option('social_deauthed');
         if (isset($deauthed[$response['service']][$account->id()])) {
             unset($deauthed[$response['service']][$account->id()]);
             update_option('social_deauthed', $deauthed);
             // Remove from the global broadcast content as well.
             $this->social->remove_from_default_accounts($response['service'], $account->id());
         }
         // 2.0 Upgrade
         if ($response['service'] == 'facebook') {
             delete_user_meta(get_current_user_id(), 'social_2.0_upgrade');
         }
         echo json_encode(array('result' => 'success', 'message' => 'User created'));
     } else {
         echo json_encode(array('result' => 'error', 'message' => 'Failed to create user'));
     }
     exit;
 }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:70,代码来源:auth.php


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