mirror of
https://github.com/e107inc/e107.git
synced 2025-08-17 03:54:09 +02:00
Core modifications to support Hybridauth 3
- MOD: Replaced e107::getPref('social_login') with SocialLoginConfigManager::getValidConfiguredProviderConfigs() - FIX: signup_shortcodes updated with new social login providers - MOD: e107::filter_request() code de-duplication: HTTP 400 exits - MOD: Deprecated e107::getHybridAuth() to discourage direct access to third-party dependency Hybridauth - FIX: Updated e_user_provider for Hybridauth 3 - FIX: e_user::tryProviderSession() and Hybridauth 3 - NEW: Dynamic auth provider support in social_adminarea - NEW: Database migration for social plugin's social_login pref
This commit is contained in:
@@ -20,8 +20,18 @@ class core_system_xup_controller extends eController
|
||||
{
|
||||
|
||||
var $backUrl = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var SocialLoginConfigManager
|
||||
*/
|
||||
private $social_login_config_manager;
|
||||
|
||||
public function __construct(eRequest $request, eResponse $response = null)
|
||||
{
|
||||
parent::__construct($request, $response);
|
||||
require_once(e_PLUGIN."social/SocialLoginConfigManager.php");
|
||||
$this->social_login_config_manager = new SocialLoginConfigManager(e107::getConfig());
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
//$back = 'system/xup/test';
|
||||
@@ -113,9 +123,11 @@ class core_system_xup_controller extends eController
|
||||
echo ' '.LAN_XUP_ERRM_11.' '.(e107::getUser()->isUser() && !empty($profileData) ? '<span class="label label-success">true</span>' : '<span class="label label-danger">false</span>');
|
||||
|
||||
|
||||
$testUrl = SITEURL."?route=system/xup/test";
|
||||
$providers = e107::getPref('social_login', array());
|
||||
|
||||
$testUrl = SITEURL."?route=system/xup/test";
|
||||
require_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
|
||||
$manager = new SocialLoginConfigManager(e107::getConfig());
|
||||
$providers = $manager->getValidConfiguredProviderConfigs();
|
||||
|
||||
foreach($providers as $key=>$var)
|
||||
{
|
||||
if($var['enabled'] == 1)
|
||||
|
@@ -75,26 +75,34 @@ class signup_shortcodes extends e_shortcode
|
||||
if(!empty($pref))
|
||||
{
|
||||
$text = "";
|
||||
$providers = e107::getPref('social_login');
|
||||
$manager = new SocialLoginConfigManager(e107::getConfig());
|
||||
$providers = $manager->getValidConfiguredProviderConfigs();
|
||||
|
||||
foreach($providers as $p=>$v)
|
||||
{
|
||||
$p = strtolower($p);
|
||||
if($v['enabled'] == 1)
|
||||
{
|
||||
|
||||
// $text .= "<a href='".e107::getUrl()->create('system/xup/login?provider='.$p.'&back='.base64_encode(e_REQUEST_URL))."'><img class='e-tip' title='Register using your {$p} account' src='".e_IMAGE_ABS."xup/{$p}.png' alt='' /></a>";
|
||||
|
||||
$ic = strtolower($p);
|
||||
|
||||
if($ic == 'live')
|
||||
|
||||
switch ($ic)
|
||||
{
|
||||
$ic = 'windows';
|
||||
case 'windowslive':
|
||||
$ic = 'windows';
|
||||
break;
|
||||
}
|
||||
|
||||
// 'signup' Creates a new XUP user if not found, otherwise it logs the person in.
|
||||
|
||||
$button = (defset('FONTAWESOME')) ? $tp->toGlyph('fa-'.$ic, array('size'=>$size, 'fw'=>true)) : "<img class='e-tip' title='".$tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p)."' src='".e_IMAGE_ABS."xup/{$p}.png' alt='' />";
|
||||
|
||||
// 'signup' Creates a new XUP user if not found, otherwise it logs the person in.
|
||||
|
||||
if (defset('FONTAWESOME') && in_array($ic, e107::getMedia()->getGlyphs()))
|
||||
$button = "<span title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p) . "'>" . $tp->toGlyph('fa-' . $ic, array('size' => $size, 'fw' => true)) . "</span>";
|
||||
elseif (is_file(e107::getFolder('images') . "xup/{$ic}.png"))
|
||||
$button = "<img class='e-tip' title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p) . "' src='" . e_IMAGE_ABS . "xup/{$ic}.png' alt='' />";
|
||||
else
|
||||
$button = "<span title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p) . "'>$p</span>";
|
||||
|
||||
$text .= " <a title='".$tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p)." ' role='button' class='signup-xup ".$class."' href='".e107::getUrl()->create('system/xup/signup?provider='.$p.'&back='.base64_encode(e_REQUEST_URL))."'>".$button."</a> ";
|
||||
}
|
||||
//TODO different icon options. see: http://zocial.smcllns.com/
|
||||
@@ -116,8 +124,9 @@ class signup_shortcodes extends e_shortcode
|
||||
if(!empty($pref))
|
||||
{
|
||||
$text = "";
|
||||
$providers = e107::pref('core', 'social_login');
|
||||
|
||||
$manager = new SocialLoginConfigManager(e107::getConfig());
|
||||
$providers = $manager->getValidConfiguredProviderConfigs();
|
||||
|
||||
$size = empty($parm['size']) ? '2x' : $parm['size'];
|
||||
$class = empty($parm['class']) ? 'btn btn-primary' : $parm['class'] ;
|
||||
|
||||
@@ -129,22 +138,25 @@ class signup_shortcodes extends e_shortcode
|
||||
|
||||
foreach($providers as $p=>$v)
|
||||
{
|
||||
|
||||
|
||||
$p = strtolower($p);
|
||||
if($v['enabled'] == 1)
|
||||
{
|
||||
$ic = strtolower($p);
|
||||
|
||||
if($ic == 'live')
|
||||
|
||||
switch ($ic)
|
||||
{
|
||||
$ic = 'windows';
|
||||
case 'windowslive':
|
||||
$ic = 'windows';
|
||||
break;
|
||||
}
|
||||
|
||||
$button = (defset('FONTAWESOME')) ? "<span title='".$tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_REG, $p)."'>".$tp->toGlyph('fa-'.$ic, array('size'=>$size, 'fw'=>true))."</span>" : "<img class='e-tip' title='".$tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_SIGNUP, $p)."' src='".e_IMAGE_ABS."xup/{$p}.png' alt='' />";
|
||||
|
||||
$text .= " <a class='signup-xup ".$class."' role='button' href='".e107::getUrl()->create('system/xup/signup?provider='.$p.'&back='.base64_encode(e_REQUEST_URL))."'>".$button."</a> ";
|
||||
}
|
||||
if (defset('FONTAWESOME') && in_array($ic, e107::getMedia()->getGlyphs()))
|
||||
$button = "<span title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_REG, $p) . "'>" . $tp->toGlyph('fa-' . $ic, array('size' => $size, 'fw' => true)) . "</span>";
|
||||
elseif (is_file(e107::getFolder('images') . "xup/{$ic}.png"))
|
||||
$button = "<img class='e-tip' title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_REG, $p) . "' src='" . e_IMAGE_ABS . "xup/{$ic}.png' alt='' />";
|
||||
else
|
||||
$button = "<span title='" . $tp->lanVars(LAN_PLUGIN_SOCIAL_XUP_REG, $p) . "'>$p</span>";
|
||||
$text .= " <a class='signup-xup " . $class . "' role='button' href='" . e107::getUrl()->create('system/xup/signup?provider=' . $p . '&back=' . base64_encode(e_REQUEST_URL)) . "'>" . $button . "</a> ";
|
||||
}
|
||||
//TODO different icon options. see: http://zocial.smcllns.com/
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user