mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 03:40:37 +02:00
hybridAuth work - still some issues.
This commit is contained in:
79
index.php
79
index.php
@@ -58,6 +58,85 @@
|
||||
}
|
||||
$response->sendMeta();
|
||||
|
||||
|
||||
|
||||
// -------------- Experimental -----------------
|
||||
|
||||
unset($_SESSION['E:SOCIAL']);
|
||||
|
||||
if(!isset($_SESSION['E:SOCIAL']) && e107::getPref('social_login_active', false) && (e_ADMIN_AREA !== true))
|
||||
{
|
||||
require_once(e_HANDLER."hybridauth/Hybrid/Auth.php");
|
||||
|
||||
$config = array(
|
||||
"base_url" => SITEURL.$HANDLERS_DIRECTORY."hybridauth/",
|
||||
"providers" => e107::getPref('social_login', array())
|
||||
);
|
||||
|
||||
print_a($config);
|
||||
// $params = array("hauth_return_to" => e_SELF);
|
||||
|
||||
$hybridauth = new Hybrid_Auth($config);
|
||||
|
||||
$prov = (!isset($config['providers'][$_GET['provider']])) ? "Facebook" : $_GET['provider'];
|
||||
|
||||
|
||||
$adapter = $hybridauth->authenticate( $prov);
|
||||
$user_profile = $adapter->getUserProfile();
|
||||
|
||||
$prov_id = $prov."_".$user_profile->identifier;
|
||||
|
||||
if($user_profile->identifier >0)
|
||||
{
|
||||
if (!$sql->db_Select("user", "*", "user_xup = '".$prov_id."' ")) // New User
|
||||
{
|
||||
$user_join = time();
|
||||
$user_pass = md5($user_profile->identifier.$user_join);
|
||||
$user_loginname = "xup_".$user_profile->identifier;
|
||||
|
||||
$insert = array(
|
||||
'user_name' => $user_profile->displayName,
|
||||
'user_email' => $user_profile->email,
|
||||
'user_loginname' => $user_loginname,
|
||||
'user_password' => $user_pass,
|
||||
'user_login' => $user_profile->displayName,
|
||||
'user_join' => $user_join,
|
||||
'user_xup' => $prov_id
|
||||
);
|
||||
|
||||
if($newid = $sql->db_Insert('user',$insert,true))
|
||||
{
|
||||
e107::getEvent()->trigger('usersup', $insert);
|
||||
if(!USERID)
|
||||
{
|
||||
require_once(e_HANDLER.'login.php');
|
||||
$usr = new userlogin($user_loginname, $user_pass, 'signup', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Existing User.
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// echo "CHECKING";
|
||||
$_SESSION['E:SOCIAL'] = (array) $user_profile;
|
||||
echo "USERNAME=".USERNAME;
|
||||
echo "<br />USEREMAIL=".USEREMAIL;
|
||||
echo "<br />USERIMAGE=".USERIMAGE;
|
||||
// print_a($_SESSION['E:SOCIAL']);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
include_once(HEADERF);
|
||||
eFront::instance()->getResponse()->send('default', false, true);
|
||||
include_once(FOOTERF);
|
||||
|
Reference in New Issue
Block a user