Ejemplo n.º 1
0
function social_connect_verify_signature($data, $signature, $redirect_to)
{
    $generated_signature = social_connect_generate_signature($data);
    if ($generated_signature != $signature) {
        wp_safe_redirect($redirect_to);
        exit;
    }
}
Ejemplo n.º 2
0
<?php

require_once dirname(dirname(__FILE__)) . '/constants.php';
require_once dirname(__FILE__) . '/facebook.php';
require_once dirname(dirname(__FILE__)) . '/utils.php';
$client_id = get_option('social_connect_facebook_api_key');
$secret_key = get_option('social_connect_facebook_secret_key');
if (isset($_GET['code'])) {
    $code = $_GET['code'];
    parse_str(sc_http_get_contents("https://graph.facebook.com/oauth/access_token?" . 'client_id=' . $client_id . '&redirect_uri=' . home_url('index.php?social-connect=facebook-callback') . '&client_secret=' . $secret_key . '&code=' . urlencode($code)));
    $signature = social_connect_generate_signature($access_token);
    do_action('social_connect_before_register_facebook', $code, $signature, $access_token);
    ?>
	<html>
		<head>
			<script>
				function init() {
					window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'facebook',
						'social_connect_signature' : '<?php 
    echo $signature;
    ?>
',
						'social_connect_access_token' : '<?php 
    echo $access_token;
    ?>
'});

					window.close();
				}
			</script>
		</head>
Ejemplo n.º 3
0
require_once dirname(dirname(__FILE__)) . '/utils.php';
try {
    if (!isset($_GET['openid_mode']) || $_GET['openid_mode'] == 'cancel') {
        $openid = new LightOpenID();
        $openid->identity = urldecode($_GET['openid_url']);
        $openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
        header('Location: ' . $openid->authUrl());
    } else {
        $openid = new LightOpenID();
        if ($openid->validate()) {
            $open_id = $openid->identity;
            $attributes = $openid->getAttributes();
            $email = $attributes['contact/email'];
            $first_name = $attributes['namePerson/first'];
            $last_name = $attributes['namePerson/last'];
            $signature = social_connect_generate_signature($open_id);
            do_action('social_connect_before_register_openid', $open_id, $signature);
            ?>
<html>
<head>
<script>
function init() {
  window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'openid', 
    'social_connect_openid_identity' : '<?php 
            echo $open_id;
            ?>
',
    'social_connect_signature' : '<?php 
            echo $signature;
            ?>
',
Ejemplo n.º 4
0
    $opts = array('http' => array('method' => 'GET', 'header' => $header));
    $context = stream_context_create($opts);
    $xml = file_get_contents("https://livecontacts.services.live.com/users/@L@" . $consenttoken->getLocationID() . "/rest/livecontacts", false, $context);
    if ($xml) {
        $oSimpleXML = new SimpleXMLElement($xml);
        $contactsArray = array();
        $i = 0;
        $owner = $oSimpleXML->Owner;
        $liveid = $owner->WindowsLiveID;
        $email = $owner->Emails->Email->Address;
        if (trim($email) == "") {
            $email = $liveid;
        }
        $first_name = $owner->Profiles->Personal->FirstName;
        $last_name = $owner->Profiles->Personal->LastName;
        $signature = social_connect_generate_signature($liveid);
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function init() {
  window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'liveid', 
    'social_connect_signature' : '<?php 
echo $signature;
?>
',
    'social_connect_liveid_identity' : '<?php 
echo $liveid;
Ejemplo n.º 5
0
require_once dirname(dirname(__FILE__)) . '/utils.php';
try {
    if (!isset($_GET['openid_mode']) || $_GET['openid_mode'] == 'cancel') {
        $openid = new LightOpenID();
        $openid->identity = 'me.yahoo.com';
        $openid->required = array('namePerson', 'namePerson/friendly', 'contact/email');
        header('Location: ' . $openid->authUrl());
    } else {
        $openid = new LightOpenID();
        if ($openid->validate()) {
            $yahoo_id = $openid->identity;
            $attributes = $openid->getAttributes();
            $email = $attributes['contact/email'];
            $name = $attributes['namePerson'];
            $username = $attributes['namePerson/friendly'];
            $signature = social_connect_generate_signature($yahoo_id);
            ?>
<html>
<head>
<script>
function init() {
  window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'yahoo', 
    'social_connect_openid_identity' : '<?php 
            echo $yahoo_id;
            ?>
',
    'social_connect_signature' : '<?php 
            echo $signature;
            ?>
',
    'social_connect_email' : '<?php 
Ejemplo n.º 6
0
require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/wp-load.php';
require_once dirname(__FILE__) . '/EpiCurl.php';
require_once dirname(__FILE__) . '/EpiOAuth.php';
require_once dirname(__FILE__) . '/EpiTwitter.php';
require_once dirname(dirname(__FILE__)) . '/utils.php';
$consumer_key = get_option('social_connect_twitter_consumer_key');
$consumer_secret = get_option('social_connect_twitter_consumer_secret');
$twitter_api = new EpiTwitter($consumer_key, $consumer_secret);
$twitter_api->setToken($_GET['oauth_token']);
$token = $twitter_api->getAccessToken();
$twitter_api->setToken($token->oauth_token, $token->oauth_token_secret);
$user = $twitter_api->get_accountVerify_credentials();
$name = $user->name;
$screen_name = $user->screen_name;
$twitter_id = $user->id;
$signature = social_connect_generate_signature($twitter_id);
?>

<html>
<head>
<script>
function init() {
  window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'twitter', 
    'social_connect_signature' : '<?php 
echo $signature;
?>
',
    'social_connect_twitter_identity' : '<?php 
echo $twitter_id;
?>
',
Ejemplo n.º 7
0
				<p><?php 
        _e('You have cancelled this login. Please close this window and try again.', 'social-connect');
        ?>
</p>
			</body>
		</html>
		<?php 
    } else {
        $openid = new LightOpenID();
        $openid->returnUrl = home_url('index.php?social-connect=wordpress');
        if ($openid->validate()) {
            $wordpress_id = $openid->identity;
            $attributes = $openid->getAttributes();
            $email = isset($attributes['contact/email']) ? $attributes['contact/email'] : '';
            $name = isset($attributes['namePerson']) ? $attributes['namePerson'] : '';
            $signature = social_connect_generate_signature($wordpress_id);
            if ($email == '') {
                ?>
				<html>
					<body>
						<p><?php 
                _e('You need to share your email address when prompted at wordpress.com. Please close this window and try again.', 'social-connect');
                ?>
</p>
					</body>
				</html>
				<?php 
                die;
            }
            do_action('social_connect_before_register_wordpress', $wordpress_id, $signature);
            ?>
Ejemplo n.º 8
0
    }
    if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {
        $client->setAccessToken($_SESSION['access_token']);
    } elseif (isset($code)) {
        $client->authenticate($_GET['code']);
        $_SESSION['access_token'] = $client->getAccessToken();
    }
    $token = json_decode($client->getAccessToken());
    $google_oauthV2 = new Google_Service_Oauth2($client);
    $user = $google_oauthV2->userinfo->get();
    $google_id = $user['id'];
    $email = $user['email'];
    $first_name = $user['givenName'];
    $last_name = $user['familyName'];
    $profile_url = $user['link'];
    $signature = social_connect_generate_signature($google_id);
    ?>
	<html>
	<head>
		<script>
			function init() {
				window.opener.wp_social_connect({'action' : 'social_connect', 'social_connect_provider' : 'google-plus',
					'social_connect_signature' : '<?php 
    echo $signature;
    ?>
',
					'social_connect_google_id' : '<?php 
    echo $google_id;
    ?>
',
					'social_connect_email' : '<?php