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


PHP oauth_client_class::Initialize方法代码示例

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


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

示例1: Initialize

 function Initialize()
 {
     if (!isset($this->file) || !isset($this->file['name'])) {
         return $this->SetError('it was not specified a valid token storage file name');
     }
     if (!parent::Initialize()) {
         return false;
     }
     return true;
 }
开发者ID:olivercieliszak,项目名称:orw,代码行数:10,代码来源:file_oauth_client.php

示例2: dirname

 *
 */
require 'http.php';
require 'oauth_client.php';
$client = new oauth_client_class();
$client->debug = 1;
$client->debug_http = 1;
$client->server = 'Yahoo';
$client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/login_with_yahoo.php';
$client->client_id = '';
$application_line = __LINE__;
$client->client_secret = '';
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
    die('Please go to Yahoo Apps page https://developer.apps.yahoo.com/wsregapp/ , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $client->redirect_uri) . ' Make sure you enable the ' . 'necessary permissions to execute the API calls your application needs.';
}
if ($success = $client->Initialize()) {
    if ($success = $client->Process()) {
        if (strlen($client->access_token)) {
            $success = $client->CallAPI('http://query.yahooapis.com/v1/yql', 'GET', array('q' => 'select * from social.profile where guid=me', 'format' => 'json'), array('FailOnAccessError' => true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if ($client->exit) {
    exit;
}
if ($success) {
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
开发者ID:Julien-SIMON,项目名称:GobelinsLab,代码行数:31,代码来源:login_with_yahoo.php

示例3: the_champ_connect

/**
 * Check querystring variables
 */
function the_champ_connect()
{
    global $theChampLoginOptions;
    // verify email
    if (isset($_GET['SuperSocializerKey']) && ($verificationKey = trim(esc_attr($_GET['SuperSocializerKey']))) != '') {
        $users = get_users('meta_key=thechamp_key&meta_value=' . $verificationKey);
        if (count($users) > 0 && isset($users[0]->ID)) {
            delete_user_meta($users[0]->ID, 'thechamp_key');
            // update password and send email
            $password = wp_generate_password();
            wp_update_user(array('ID' => $users[0]->ID, 'user_pass' => $password));
            the_champ_password_email($users[0]->ID, $password);
            wp_redirect(home_url() . '?SuperSocializerVerified=1');
            die;
        }
    }
    // Instagram auth
    if (isset($_GET['SuperSocializerInstaToken']) && $_GET['SuperSocializerInstaToken'] != '') {
        $instaAuthUrl = 'https://api.instagram.com/v1/users/self?access_token=' . trim(esc_attr($_GET['SuperSocializerInstaToken']));
        $response = wp_remote_get($instaAuthUrl, array('timeout' => 15));
        if (!is_wp_error($response) && isset($response['response']['code']) && 200 === $response['response']['code']) {
            $body = json_decode(wp_remote_retrieve_body($response));
            if (is_object($body->data) && isset($body->data) && isset($body->data->id)) {
                $redirection = isset($_GET['super_socializer_redirect_to']) && $_GET['super_socializer_redirect_to'] != '' ? esc_attr($_GET['super_socializer_redirect_to']) : '';
                $response = the_champ_user_auth($body->data, 'instagram', $redirection);
                if (is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')) {
                    $redirectTo = esc_attr(the_champ_get_login_redirection_url($redirection, true));
                } elseif (isset($response['message']) && $response['message'] == 'linked') {
                    $redirectTo = $redirection . (strpos($redirection, '?') !== false ? '&' : '?') . 'linked=1';
                } elseif (isset($response['message']) && $response['message'] == 'not linked') {
                    $redirectTo = $redirection . (strpos($redirection, '?') !== false ? '&' : '?') . 'linked=0';
                } elseif (isset($response['url']) && $response['url'] != '') {
                    $redirectTo = $response['url'];
                } else {
                    $redirectTo = esc_attr(the_champ_get_login_redirection_url($redirection));
                }
                the_champ_close_login_popup($redirectTo);
            }
        }
    }
    // send request to Xing
    if (isset($_GET['SuperSocializerAuth']) && $_GET['SuperSocializerAuth'] == 'Xing') {
        session_start();
        if (!isset($_GET['oauth_token']) && isset($_SESSION['OAUTH_ACCESS_TOKEN'])) {
            unset($_SESSION['OAUTH_ACCESS_TOKEN']);
        }
        if (isset($theChampLoginOptions['xing_ck']) && $theChampLoginOptions['xing_ck'] != '' && isset($theChampLoginOptions['xing_cs']) && $theChampLoginOptions['xing_cs'] != '') {
            $xingClient = new oauth_client_class();
            $xingClient->debug = 0;
            $xingClient->debug_http = 1;
            $xingClient->server = 'XING';
            $xingClient->redirect_uri = site_url() . '/index.php?SuperSocializerAuth=Xing&super_socializer_redirect_to=' . esc_attr(str_replace(array('http://', 'https://'), '', urldecode($_GET['super_socializer_redirect_to'])));
            $xingClient->client_id = $theChampLoginOptions['xing_ck'];
            $xingClient->client_secret = $theChampLoginOptions['xing_cs'];
            if ($success = $xingClient->Initialize()) {
                if ($success = $xingClient->Process()) {
                    if (strlen($xingClient->access_token)) {
                        $success = $xingClient->CallAPI('https://api.xing.com/v1/users/me', 'GET', array(), array('FailOnAccessError' => true), $xingResponse);
                    }
                }
                $success = $xingClient->Finalize($success);
            }
            if ($xingClient->exit) {
                die('exit');
            }
            if ($success) {
                if (isset($xingResponse->users) && is_array($xingResponse->users) && isset($xingResponse->users[0]->id)) {
                    $xingRedirect = the_champ_get_http() . esc_attr($_GET['super_socializer_redirect_to']);
                    $response = the_champ_user_auth($xingResponse->users[0], 'xing', $xingRedirect);
                    if (is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')) {
                        $redirectTo = esc_attr(the_champ_get_login_redirection_url($xingRedirect, true));
                    } elseif (isset($response['message']) && $response['message'] == 'linked') {
                        $redirectTo = $xingRedirect . (strpos($xingRedirect, '?') !== false ? '&' : '?') . 'linked=1';
                    } elseif (isset($response['message']) && $response['message'] == 'not linked') {
                        $redirectTo = $xingRedirect . (strpos($xingRedirect, '?') !== false ? '&' : '?') . 'linked=0';
                    } elseif (isset($response['url']) && $response['url'] != '') {
                        $redirectTo = $response['url'];
                    } else {
                        $redirectTo = esc_attr(the_champ_get_login_redirection_url($xingRedirect));
                    }
                    the_champ_close_login_popup($redirectTo);
                }
            } else {
                echo 'Error:' . $xingClient->error;
                die;
            }
        }
    }
    // send request to twitter
    if (isset($_GET['SuperSocializerAuth']) && $_GET['SuperSocializerAuth'] == 'Twitter') {
        if (isset($theChampLoginOptions['twitter_key']) && $theChampLoginOptions['twitter_key'] != '' && isset($theChampLoginOptions['twitter_secret']) && $theChampLoginOptions['twitter_secret'] != '') {
            /* Build TwitterOAuth object with client credentials. */
            $connection = new TwitterOAuth($theChampLoginOptions['twitter_key'], $theChampLoginOptions['twitter_secret']);
            /* Get temporary credentials. */
            $requestToken = $connection->getRequestToken(site_url() . '/index.php');
            if ($connection->http_code == 200) {
                // generate unique ID
//.........这里部分代码省略.........
开发者ID:vanlong200880,项目名称:uni,代码行数:101,代码来源:super_socializer.php

示例4: pumpio_connect

function pumpio_connect(&$a)
{
    // Start a session.  This is necessary to hold on to  a few keys the callback script will also need
    session_start();
    // Define the needed keys
    $consumer_key = get_pconfig(local_user(), 'pumpio', 'consumer_key');
    $consumer_secret = get_pconfig(local_user(), 'pumpio', 'consumer_secret');
    $hostname = get_pconfig(local_user(), 'pumpio', 'host');
    if (($consumer_key == "" or $consumer_secret == "") and $hostname != "") {
        logger("pumpio_connect: register client");
        $clientdata = pumpio_registerclient($a, $hostname);
        set_pconfig(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id);
        set_pconfig(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
        $consumer_key = get_pconfig(local_user(), 'pumpio', 'consumer_key');
        $consumer_secret = get_pconfig(local_user(), 'pumpio', 'consumer_secret');
        logger("pumpio_connect: ckey: " . $consumer_key . " csecrect: " . $consumer_secret, LOGGER_DEBUG);
    }
    if ($consumer_key == "" or $consumer_secret == "") {
        logger("pumpio_connect: " . sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
        $o .= sprintf(t("Unable to register the client at the pump.io server '%s'."), $hostname);
        return $o;
    }
    // The callback URL is the script that gets called after the user authenticates with pumpio
    $callback_url = $a->get_baseurl() . "/pumpio/connect";
    // Let's begin.  First we need a Request Token.  The request token is required to send the user
    // to pumpio's login page.
    // Create a new instance of the TumblrOAuth library.  For this step, all we need to give the library is our
    // Consumer Key and Consumer Secret
    $client = new oauth_client_class();
    $client->debug = 1;
    $client->server = '';
    $client->oauth_version = '1.0a';
    $client->request_token_url = 'https://' . $hostname . '/oauth/request_token';
    $client->dialog_url = 'https://' . $hostname . '/oauth/authorize';
    $client->access_token_url = 'https://' . $hostname . '/oauth/access_token';
    $client->url_parameters = false;
    $client->authorization_header = true;
    $client->redirect_uri = $callback_url;
    $client->client_id = $consumer_key;
    $client->client_secret = $consumer_secret;
    if ($success = $client->Initialize()) {
        if ($success = $client->Process()) {
            if (strlen($client->access_token)) {
                logger("pumpio_connect: otoken: " . $client->access_token . " osecrect: " . $client->access_token_secret, LOGGER_DEBUG);
                set_pconfig(local_user(), "pumpio", "oauth_token", $client->access_token);
                set_pconfig(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
            }
        }
        $success = $client->Finalize($success);
    }
    if ($client->exit) {
        $o = 'Could not connect to pumpio. Refresh the page or try again later.';
    }
    if ($success) {
        logger("pumpio_connect: authenticated");
        $o .= t("You are now authenticated to pumpio.");
        $o .= '<br /><a href="' . $a->get_baseurl() . '/settings/connectors">' . t("return to the connector page") . '</a>';
    } else {
        logger("pumpio_connect: could not connect");
        $o = 'Could not connect to pumpio. Refresh the page or try again later.';
    }
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:63,代码来源:pumpio.php

示例5: Dropbox

 public static function Dropbox($oTenant)
 {
     $bResult = false;
     $oUser = null;
     $bDropboxAllow = $oTenant->SocialDropboxAllow;
     $sDropboxId = $oTenant->SocialDropboxKey;
     $sDropboxSecret = $oTenant->SocialDropboxSecret;
     $sRedirectUrl = rtrim(\MailSo\Base\Http::SingletonInstance()->GetFullUrl(), '\\/ ') . '/?dropbox';
     if (!strpos($sRedirectUrl, '://localhost')) {
         $sRedirectUrl = str_replace('http:', 'https:', $sRedirectUrl);
     }
     if ($bDropboxAllow) {
         require PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/http.php';
         require PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/oauth_client.php';
         $oClient = new \oauth_client_class();
         $oClient->debug = self::$Debug;
         $oClient->debug_http = self::$Debug;
         $oClient->server = 'Dropbox2';
         $oClient->redirect_uri = $sRedirectUrl;
         $oClient->client_id = $sDropboxId;
         $application_line = __LINE__;
         $oClient->client_secret = $sDropboxSecret;
         $oClient->configuration_file = PSEVEN_APP_ROOT_PATH . 'libraries/OAuthClient/' . $oClient->configuration_file;
         if (strlen($oClient->client_id) == 0 || strlen($oClient->client_secret) == 0) {
             $bResult = false;
             exit('Please go to Dropbox Apps page https://www.dropbox.com/developers/apps , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $oClient->redirect_uri) . ' Make sure this URL is ' . 'not in a private network and accessible to the Dropbox site.';
         }
         if ($success = $oClient->Initialize()) {
             if ($success = $oClient->Process()) {
                 if (strlen($oClient->access_token)) {
                     $success = $oClient->CallAPI('https://api.dropbox.com/1/account/info', 'GET', array(), array('FailOnAccessError' => true), $oUser);
                 }
             }
             $success = $oClient->Finalize($success);
         }
         if ($oClient->exit) {
             $bResult = false;
             exit;
         }
         if ($success && $oUser) {
             // if you need re-ask user for permission
             //$oClient->ResetAccessToken();
             $aSocial = array('type' => 'dropbox', 'id' => $oUser->uid, 'name' => $oUser->display_name, 'email' => isset($oUser->email) ? $oUser->email : '', 'access_token' => $oClient->access_token);
             \CApi::Log('social_user_dropbox');
             \CApi::LogObject($oUser);
             $bResult = $aSocial;
         } else {
             $bResult = false;
             $oClient->ResetAccessToken();
             self::_socialError($oClient->error, 'dropbox');
         }
     }
     return $bResult;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:54,代码来源:social.php

示例6: elseif

 
             if(strlen($linkedin_login_client->authorization_error)) {
                 $linkedin_login_client->error = $linkedin_login_client->authorization_error;
                 $success = false;
             } elseif(strlen($linkedin_login_client->access_token)) {
                 $success = $linkedin_login_client->CallAPI(
                'https://apis.live.net/v5.0/me',
                'GET', array(), array('FailOnAccessError'=>true), $user);
             }
 
         }
 
         $success = $linkedin_login_client->Finalize($success);
     }
 */
 if ($success = $linkedin_login_client->Initialize()) {
     if ($success = $linkedin_login_client->Process()) {
         if (strlen($linkedin_login_client->authorization_error)) {
             $linkedin_login_client->error = $linkedin_login_client->authorization_error;
             $success = false;
         } elseif (strlen($linkedin_login_client->access_token)) {
             $success = $linkedin_login_client->CallAPI('https://api.linkedin.com/v1/people/~', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $user);
             /*
              * Use this if you just want to get the LinkedIn user email address
              */
             $success = $linkedin_login_client->CallAPI('https://api.linkedin.com/v1/people/~/email-address', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $linkedin_email);
         }
     }
     $success = $linkedin_login_client->Finalize($success);
 }
 cw_log_add('linkedin_login', array($linkedin_email, $user, $success));
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:30,代码来源:login_with_linkedin.php

示例7: service_social_login_naver

 public static function service_social_login_naver()
 {
     if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver') {
         update_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP'], 'service-social-login-naver');
     }
     if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver' || isset($_GET['code']) && get_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP']) == 'service-social-login-naver') {
         require 'home-social-login/http.php';
         require 'home-social-login/oauth_client.php';
         $client = new oauth_client_class();
         $client->debug = FALSE;
         $client->debug_http = TRUE;
         $client->server = 'Naver';
         $client->redirect_uri = site_url() . '/index.php';
         $client->client_id = get_option(wskl_get_option_name('naver_client_id'));
         $client->client_secret = get_option(wskl_get_option_name('naver_client_secret'));
         if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
             wskl_sym__alert('네이버 연동키값을 확인해 주세요.');
         }
         if ($login == 'Y') {
             unset($_SESSION['OAUTH_STATE']);
             $client->ResetAccessToken();
         }
         /* API permissions
          */
         if ($success = $client->Initialize()) {
             if ($success = $client->Process()) {
                 if (strlen($client->access_token)) {
                     $success = $client->CallAPI('https://apis.naver.com/nidlogin/nid/getUserProfile.xml', 'POST', array('mode' => 'userinfo'), array('FailOnAccessError' => TRUE), $user);
                 }
             }
             $success = $client->Finalize($success);
         }
         if ($client->exit) {
             exit;
         }
         if ($success) {
             $xml = simplexml_load_string($user);
             if ($xml->result->resultcode == '00') {
                 $client->GetAccessToken($AccessToken);
                 $mb_gubun = 'naver';
                 $mb_id = $xml->response->enc_id;
                 $mb_name = $xml->response->nickname;
                 $mb_nick = $xml->response->nickname;
                 $mb_email = $xml->response->email;
                 $token_value = $AccessToken['value'];
                 $token_refresh = $AccessToken['refresh'];
                 $token_secret = '';
                 //$client->ResetAccessToken();
                 if (!trim($mb_id) || !trim($token_value)) {
                     wskl_sym__alert("정보가 제대로 넘어오지 않아 오류가 발생했습니다.");
                 }
                 $token_array = urlencode(static::encryptIt($mb_gubun . '|' . substr(str_replace('|', '', $mb_id), 0, 18) . '|' . $mb_name . '|' . $mb_nick . '|' . $mb_email));
                 $redirect_url = '/?sym-api=process-social-login&token=' . $token_array;
                 wp_redirect($redirect_url);
                 exit;
             } else {
                 $error = htmlspecialchars($xml->result->resultcode);
                 alert_close($error);
             }
         } else {
             $error = htmlspecialchars($client->error);
             alert_close($error);
         }
     }
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:65,代码来源:class-social-login.php

示例8: pumpio_connect

function pumpio_connect($a)
{
    // Define the needed keys
    $consumer_key = get_pconfig(local_channel(), 'pumpio', 'consumer_key');
    $consumer_secret = get_pconfig(local_channel(), 'pumpio', 'consumer_secret');
    $hostname = get_pconfig(local_channel(), 'pumpio', 'host');
    if (($consumer_key == "" || $consumer_secret == "") && $hostname != "") {
        $clientdata = pumpio_registerclient($a, $hostname);
        set_pconfig(local_channel(), 'pumpio', 'consumer_key', $clientdata['client_id']);
        set_pconfig(local_channel(), 'pumpio', 'consumer_secret', $clientdata['client_secret']);
        $consumer_key = get_pconfig(local_channel(), 'pumpio', 'consumer_key');
        $consumer_secret = get_pconfig(local_channel(), 'pumpio', 'consumer_secret');
    }
    if ($consumer_key == "" || $consumer_secret == "") {
        return;
    }
    // The callback URL is the script that gets called after the user authenticates with pumpio
    $callback_url = z_root() . '/pumpio/connect';
    // Let's begin.  First we need a Request Token.  The request token is required to send the user
    // to pumpio's login page.
    // Create a new instance of the TumblrOAuth library.  For this step, all we need to give the library is our
    // Consumer Key and Consumer Secret
    $client = new oauth_client_class();
    $client->debug = 1;
    $client->server = '';
    $client->oauth_version = '1.0a';
    $client->request_token_url = 'https://' . $hostname . '/oauth/request_token';
    $client->dialog_url = 'https://' . $hostname . '/oauth/authorize';
    $client->access_token_url = 'https://' . $hostname . '/oauth/access_token';
    $client->url_parameters = false;
    $client->authorization_header = true;
    $client->redirect_uri = $callback_url;
    $client->client_id = $consumer_key;
    $client->client_secret = $consumer_secret;
    if ($success = $client->Initialize()) {
        if ($success = $client->Process()) {
            if (strlen($client->access_token)) {
                set_pconfig(local_channel(), "pumpio", "oauth_token", $client->access_token);
                set_pconfig(local_channel(), "pumpio", "oauth_token_secret", $client->access_token_secret);
            }
        }
        $success = $client->Finalize($success);
    }
    if ($client->exit) {
        $o = 'Could not connect to pumpio. Refresh the page or try again later.';
    }
    if ($success) {
        $o .= t('You are now authenticated to pumpio.');
        $o .= '<br /><a href="' . z_root() . '/settings/featured">' . t('return to the featured settings page') . '</a>';
    }
    return $o;
}
开发者ID:royalterra,项目名称:hubzilla-addons,代码行数:52,代码来源:pumpio.php

示例9: linkedin

 function linkedin()
 {
     require APPPATH . "libraries/linkedin/http.php";
     require APPPATH . "libraries/linkedin/oauth_client.php";
     $client = new oauth_client_class();
     $client->server = 'LinkedIn';
     $client->redirect_uri = site_url('social/linkedin');
     $client->client_id = LINKEDIN_CLIENT_ID;
     $application_line = __LINE__;
     $client->client_secret = LINKEDIN_CLIENT_SECRET;
     if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
         die('Please go to LinkedIn Apps page https://www.linkedin.com/secure/developer?newapp= , ' . 'create an application, and in the line ' . $application_line . ' set the client_id to Consumer key and client_secret with Consumer secret. ' . 'The Callback URL must be ' . $client->redirect_uri) . ' Make sure you enable the ' . 'necessary permissions to execute the API calls your application needs.';
     }
     if ($success = $client->Initialize()) {
         if ($success = $client->Process()) {
             if (strlen($client->access_token)) {
                 $success = $client->CallAPI('https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,public-profile-url,headline,location,industry,summary,picture-url,positions,phone-numbers,primary-twitter-account)', 'GET', array('format' => 'json'), array('FailOnAccessError' => true), $lUser);
             }
         }
         $success = $client->Finalize($success);
     }
     if (strlen($client->authorization_error)) {
         $client->error = $client->authorization_error;
         $success = false;
     }
     if ($client->exit) {
         exit;
     }
     if ($success) {
         $linkedinUser = json_decode(json_encode($lUser), true);
         if (!empty($linkedinUser)) {
             $exists = $this->User_model->check_email($linkedinUser['emailAddress']);
             if ($exists['rc']) {
                 // user exists and login him/her to the system
                 $user_id = $exists['data']['id'];
                 if ($exists['data']['gravatar_url'] == "") {
                     if (isset($linkedinUser['pictureUrl'])) {
                         $default = base_url() . "resources/images/avatar.jpg";
                         $size = 40;
                         $grav_url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($linkedinUser['emailAddress']))) . "?d=" . urlencode($default) . "&s=" . $size;
                         $user_data = array('updated_on' => time(), 'gravatar_url' => isset($grav_url) ? $grav_url : "");
                         $response = $this->User_model->update_gravatar_url($user_data, $user_id);
                         $dir = FCPATH . "uploads/profile_images/" . $user_id . "/";
                         if ($exists['data']['profile_image'] == "" || !file_exists($dir . $exists['data']['profile_image'])) {
                             $url = $linkedinUser['pictureUrl'];
                             $this->add_picture($user_id, $url, 'linkedin.jpg');
                         }
                     }
                 }
                 $user_data = array('user_id' => $user_id, 'email' => $exists['data']['email']);
                 $result = $this->set_login_session_data($user_data);
                 if ($this->session->userdata("user_id")) {
                     redirect("user/dashboard");
                     exit;
                 }
             } else {
                 // register the user in the system and log him/her in
                 if (isset($linkedinUser['pictureUrl'])) {
                     $default = base_url() . "resources/images/avatar.jpg";
                     $size = 40;
                     $email = trim($linkedinUser['emailAddress']);
                     // "MyEmailAddress@example.com"
                     $email = strtolower($email);
                     // "myemailaddress@example.com"
                     $email = md5($email);
                     $grav_url = "http://www.gravatar.com/avatar/" . $email . "";
                 }
                 $hash = md5(microtime() . rand());
                 $user_data = array('name' => $linkedinUser['firstName'] . " " . $linkedinUser['lastName'], 'email' => $linkedinUser['emailAddress'], 'created_on' => time(), 'gravatar_url' => isset($grav_url) ? $grav_url : "", 'account_type' => LINKEDIN_ACCOUNT, "password" => $hash);
                 $response = $this->User_model->add_user_from_social_login($user_data);
                 $session_data["user_id"] = $response["data"];
                 $session_data["email"] = $user_data["email"];
                 $url = $linkedinUser['pictureUrl'];
                 $result_add_pic = $this->add_picture($response["data"], $url, 'linkedin.jpg');
                 $result = $this->set_login_session_data($session_data);
                 if ($this->session->userdata("user_id")) {
                     redirect("user/dashboard");
                     exit;
                 }
             }
         } else {
             $this->session->set_flashdata('error_message', 'Authentication error occured! Please try again.');
             redirect('login');
         }
     } else {
         $this->session->set_flashdata('error_message', 'Authentication error occured! Please try again.');
         redirect('login');
     }
 }
开发者ID:gorgeousdreams,项目名称:Codeigniter-datatech,代码行数:89,代码来源:Social.php

示例10: the_champ_connect


//.........这里部分代码省略.........
            if ($xml && isset($xml->steamID64) && $xml->steamID64) {
                $steamRedirect = esc_url($_GET['SuperSocializerSteamAuth']);
                $response = the_champ_user_auth($xml, 'steam', $steamRedirect);
                if (is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')) {
                    $redirectTo = esc_attr(the_champ_get_login_redirection_url($steamRedirect, true));
                } elseif (isset($response['message']) && $response['message'] == 'linked') {
                    $redirectTo = $steamRedirect . (strpos($steamRedirect, '?') !== false ? '&' : '?') . 'linked=1';
                } elseif (isset($response['message']) && $response['message'] == 'not linked') {
                    $redirectTo = $steamRedirect . (strpos($steamRedirect, '?') !== false ? '&' : '?') . 'linked=0';
                } elseif (isset($response['url']) && $response['url'] != '') {
                    $redirectTo = $response['url'];
                } else {
                    $redirectTo = esc_attr(the_champ_get_login_redirection_url($steamRedirect));
                }
                the_champ_close_login_popup($redirectTo);
            }
        }
        die;
    }
    // send request to Xing
    if (isset($_GET['SuperSocializerAuth']) && $_GET['SuperSocializerAuth'] == 'Xing') {
        session_start();
        if (!isset($_GET['oauth_token']) && isset($_SESSION['OAUTH_ACCESS_TOKEN'])) {
            unset($_SESSION['OAUTH_ACCESS_TOKEN']);
        }
        if (isset($theChampLoginOptions['xing_ck']) && $theChampLoginOptions['xing_ck'] != '' && isset($theChampLoginOptions['xing_cs']) && $theChampLoginOptions['xing_cs'] != '') {
            $xingClient = new oauth_client_class();
            $xingClient->debug = 0;
            $xingClient->debug_http = 1;
            $xingClient->server = 'XING';
            $xingClient->redirect_uri = site_url() . '/index.php?SuperSocializerAuth=Xing&super_socializer_redirect_to=' . esc_attr(str_replace(array('http://', 'https://'), '', urldecode($_GET['super_socializer_redirect_to'])));
            $xingClient->client_id = $theChampLoginOptions['xing_ck'];
            $xingClient->client_secret = $theChampLoginOptions['xing_cs'];
            if ($success = $xingClient->Initialize()) {
                if ($success = $xingClient->Process()) {
                    if (strlen($xingClient->access_token)) {
                        $success = $xingClient->CallAPI('https://api.xing.com/v1/users/me', 'GET', array(), array('FailOnAccessError' => true), $xingResponse);
                    }
                }
                $success = $xingClient->Finalize($success);
            }
            if ($xingClient->exit) {
                die('exit');
            }
            if ($success) {
                if (isset($xingResponse->users) && is_array($xingResponse->users) && isset($xingResponse->users[0]->id)) {
                    $xingRedirect = the_champ_get_http() . esc_attr($_GET['super_socializer_redirect_to']);
                    $response = the_champ_user_auth($xingResponse->users[0], 'xing', $xingRedirect);
                    if (is_array($response) && isset($response['message']) && $response['message'] == 'register' && (!isset($response['url']) || $response['url'] == '')) {
                        $redirectTo = esc_attr(the_champ_get_login_redirection_url($xingRedirect, true));
                    } elseif (isset($response['message']) && $response['message'] == 'linked') {
                        $redirectTo = $xingRedirect . (strpos($xingRedirect, '?') !== false ? '&' : '?') . 'linked=1';
                    } elseif (isset($response['message']) && $response['message'] == 'not linked') {
                        $redirectTo = $xingRedirect . (strpos($xingRedirect, '?') !== false ? '&' : '?') . 'linked=0';
                    } elseif (isset($response['url']) && $response['url'] != '') {
                        $redirectTo = $response['url'];
                    } else {
                        $redirectTo = esc_attr(the_champ_get_login_redirection_url($xingRedirect));
                    }
                    the_champ_close_login_popup($redirectTo);
                }
            } else {
                echo 'Error:' . $xingClient->error;
                die;
            }
        }
开发者ID:roman-kulish,项目名称:hromada,代码行数:67,代码来源:super_socializer.php

示例11: elseif

if (empty($customer_id)) {
    $mslive_redirect_url = $http_location . '/index.php?target=mslive_login';
    //include mslive api files
    cw_include('addons/mslive_login/include/lib/http.php');
    cw_include('addons/mslive_login/include/lib/oauth_client.php');
    $mslive_login_client = new oauth_client_class();
    $mslive_login_client->server = 'Microsoft';
    $mslive_login_client->debug = 0;
    $mslive_login_client->redirect_uri = $mslive_redirect_url;
    $mslive_login_client->client_id = $config['mslive_login']['mslive_login_consumer_key'];
    $application_line = __LINE__;
    $mslive_login_client->client_secret = $config['mslive_login']['mslive_login_consumer_secret'];
    $mslive_login_info =& cw_session_register('mslive_login_info');
    $mslive_login_client->scope = 'wl.basic wl.emails wl.birthday';
    if ($success = $mslive_login_client->Initialize()) {
        if ($success = $mslive_login_client->Process()) {
            if (strlen($mslive_login_client->authorization_error)) {
                $mslive_login_client->error = $mslive_login_client->authorization_error;
                $success = false;
            } elseif (strlen($mslive_login_client->access_token)) {
                $success = $mslive_login_client->CallAPI('https://apis.live.net/v5.0/me', 'GET', array(), array('FailOnAccessError' => true), $user);
            }
        }
        $success = $mslive_login_client->Finalize($success);
    }
    if ($success) {
        //For logged in user, get details from mslive using access token
        $mslive_user_id = $user->id;
        $mslive_uname = $user->name;
        $mslive_user_firstname = $user->first_name;
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:30,代码来源:mslive_login.php


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