function checkUser() { if ($_REQUEST['code']) { $redirect_uri = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'taobao', 'do' => "bind")); $url = 'https://oauth.taobao.com/token'; $field = 'grant_type=authorization_code&client_id=' . TAOBAO_KEY . '&code=' . $_REQUEST['code'] . '&client_secret=' . TAOBAO_SECRET . '&redirect_uri=' . urlencode($redirect_uri); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $field); $result = curl_exec($ch); $res = json_decode($result, TRUE); if ($res['taobao_user_id']) { $_SESSION['taobao']['access_token']['oauth_token'] = $res['access_token']; $_SESSION['taobao']['access_token']['oauth_token_secret'] = $res['refresh_token']; $_SESSION['taobao']['isSync'] = 1; $_SESSION['taobao']['uid'] = $res['taobao_user_id']; $_SESSION['taobao']['uname'] = $res['taobao_user_nick']; $_SESSION['taobao']['userface'] = ''; $_SESSION['open_platform_type'] = 'taobao'; return $res; } else { return false; } } else { return false; } }
private function getCallback($type = '', $callbackurl = '') { if (!$callbackurl) { $callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $type)); } return urlencode($callbackurl); }
public function getUrl($call_back = null) { if (empty($this->_sina_akey) || empty($this->_sina_skey)) { return false; } if (is_null($call_back)) { $call_back = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'sina', 'do' => 'bind')); } $this->loginUrl = $this->_oauth->getAuthorizeURL($call_back); return $this->loginUrl; }
private function getCallback($site = '', $type = 'bind', $callbackurl = '') { if (!$callbackurl) { if ($type == 'bind') { $callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $site, 'do' => "bind")); } else { $callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $site)); } } return urlencode($callbackurl); }
public function getUrl($call_back = null) { if (empty($this->_douban_key) || empty($this->_douban_secret)) { return false; } if (is_null($call_back)) { $call_back = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'douban', 'do' => "bind")); } if (empty($this->_authorize_url)) { $client = new DoubanOAuth($this->_douban_key, $this->_douban_secret); $request_token = $client->getRequestToken(); $this->_authorize_url = $client->getAuthorizeURL($request_token) . '&oauth_callback=' . urlencode($call_back); } $_SESSION['douban']['request_token'] = $request_token; return $this->_authorize_url; }
function checkUser() { $redirect_uri = Addons::createAddonShow('Login', 'no_register_display', array('type' => 'facebook', 'do' => "bind")); $facebook = new FacebookAPI(array('appId' => FACEBOOK_KEY, 'secret' => FACEBOOK_SECRET)); $token = $facebook->getAccessTokenFromCode($_GET['code'], $redirect_uri); //dump($token); //exit; // if($user){ // $_SESSION['baidu']['access_token']['oauth_token'] = $access_token; // $_SESSION['baidu']['access_token']['oauth_token_secret'] = $refresh_token; // $_SESSION['baidu']['isSync'] = 0; // $_SESSION['baidu']['uid'] = $user['uid']; // $_SESSION['open_platform_type'] = 'baidu'; // return $user; // }else{ // return false; // } }
public function login_sync_other($param) { // Session::start(); $regInfo = $param['regInfo']; $platform_options = model('AddonData')->lget('login'); $data = self::$validLogin; $type = strtolower($param['type']); $platform = array(); $check = array(); foreach ($data[$type] as $v) { $check[] = !empty($platform_options[$v]); } if (count(array_filter($check)) == count($data[$type]) && in_array($type, $platform_options['open'])) { $this->_loadTypeLogin($type); $object = new $type(); $url = Addons::createAddonShow('Login', 'no_register_display', array('type' => $type)); $url = $object->getUrl($url); // if(!$url){ //dump($type.'-login-error:'.$object->getError()); //} redirect($url); } // Session::pause(); }
public function login_input_footer($param) { Session::start(); $regInfo = $param['regInfo']; $platform_options = model('AddonData')->lget('login'); $data = self::$validLogin; $platform = array(); foreach ($data as $plateformName => $value) { $check = array(); foreach ($value as $v) { $check[] = !empty($platform_options[$v]); } if (count(array_filter($check)) == count($value) && in_array($plateformName, $platform_options['open'])) { $this->_loadTypeLogin($plateformName); $object = new $plateformName(); $url = Addons::createAddonShow('Login', 'no_register_display', array('type' => $plateformName)); $platform[$plateformName] = $object->getUrl($url); } } if ($regInfo['register_type'] == 'open' && !empty($platform)) { $html = "<div class='frm alC lh35' style='border-top:1px solid #C9C9C9; margin: 10px 0 0;'>"; $html .= "<div class='tit'>你也可以通过站外账号进行登录!"; $html .= "</div>"; foreach ($platform as $key => $vo) { $url = $vo; $image = $this->htmlPath . "/html/image/btn_{$key}.gif"; $html .= sprintf("<a href='%s'><img src='%s' style='cursor: pointer;margin:0 2px' /></a>", $url, $image); } $html .= "</div>"; echo $html; } Session::pause(); }
private function getCallback($type = '', $do = 'login') { $callbackurl = Addons::createAddonShow('Login', 'no_register_display', array('type' => $type, 'do' => $do)); return urlencode($callbackurl); }