Skip to content

New 3rd-party PHP dependency manager for e107 core #4099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7269c80
Initialized composer.json
Deltik Nov 6, 2018
2a69227
Exclude Composer files in GitHub sync for e107 v2
Deltik Feb 14, 2020
f8d0b62
Forward compatibility with Composer autoloading
Deltik Dec 23, 2018
7484d52
composer.json: Enforce compatibility with lowest supported PHP version
Deltik Feb 13, 2020
adcd373
Documented migration plan to Composer dependencies
Deltik Feb 14, 2020
46c75ae
Updated Hybridauth from v2.9.6 to v3.1.1
Deltik Feb 14, 2020
91bfc1d
Core modifications to support Hybridauth 3
Deltik Feb 17, 2020
5edcee8
PHP bug 66773 workaround in Hybridauth
Deltik Feb 17, 2020
0bacc59
Prevent error if 'social_login' pref is not an array
Deltik Feb 19, 2020
a91fa2c
Don't duplicate Hybridauth config in e107::getHybridAuth()
Deltik Feb 19, 2020
dc66b50
Factory for e_user_provider
Deltik Feb 19, 2020
c260152
Redirect improvements for social logins
Deltik Feb 19, 2020
bc4ade5
Disable system/xup/test by default
Deltik Feb 19, 2020
616add5
Code deduplication in signup_shortcodes for XUP login
Deltik Feb 19, 2020
379a963
New API to detect if social login is enabled site-wide
Deltik Feb 22, 2020
f03e60d
New API to get fields of each social login provider
Deltik Feb 23, 2020
daa31be
Allow blank email addresses with social signup
Deltik Feb 23, 2020
be84cf7
New interface for varied social login configuration fields
Deltik Feb 24, 2020
639943e
Correct user_xup changed value in Steam social login provider
Deltik Feb 25, 2020
7bae4a0
More useful error message when user_name and user_xup conflict
Deltik Feb 25, 2020
8c072e2
social_setup upgrade renamed providers from HybridAuth 2 to Hybridauth 3
Deltik Feb 25, 2020
ae6340c
Removed route system/xup/signup
Deltik Feb 26, 2020
28aad3c
More accurate callback URL in e107_plugins/social/admin_config.php help
Deltik Feb 26, 2020
5646635
Better error message for logins from unconnected social login providers
Deltik Feb 26, 2020
4d7ce7e
Dynamically generated API documentation links for social_ui
Deltik Feb 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Ignore PhpStorm IDE files
# Ignore IDE files
.idea
.project
composer.phar

# Ignore third-party files
phpDocumentor.phar
# Uncomment the following line for e107 v3. See ./e107_handlers/vendor/README.md for details.
#e107_handlers/vendor/

# Ignore user files
.htaccess
e107.htaccess
e107_config.php
e107_config_*.php
e107_media/*
e107_system/*
e107InstallLog.log
/.settings
e107_core/override
test/*
Expand All @@ -15,5 +25,3 @@ phpunit/
# Ignore Vim swap files
*.swp
*.swo
e107.htaccess
e107InstallLog.log
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "e107inc/e107",
"description": "e107 is a free (open-source) content management system which allows you to easily manage and publish your content online. Developers can save time in building websites and powerful online applications. Users can avoid programming completely! Blogs, Websites, Intranets - e107 does it all.",
"type": "project",
"keywords": ["e107", "cms"],
"homepage": "https://e107.org/",
"readme": "README.md",
"license": "GPL-3.0-or-later",
"support": {
"issues": "https://github.com/e107inc/e107/issues",
"forum": "https://e107help.org/",
"wiki": "https://github.com/e107inc/e107/wiki",
"irc": "https://gitter.im/e107inc/e107",
"source": "https://github.com/e107inc/e107"
},
"config": {
"platform": {
"php": "5.6"
},
"vendor-dir": "e107_handlers/vendor"
},
"require": {
"php": ">=5.6",
"hybridauth/hybridauth": "^3.1.1"
}
}
80 changes: 80 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 1 addition & 78 deletions e107_admin/core_image.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,84 +338,7 @@
),
$coredir['handlers'] =>
array (
'hybridauth' =>
array (
'Hybrid' =>
array (
'Providers' =>
array (
'AOL.php' => '363b16cae1ffd55db3ac5cc2f7e4733e',
'Facebook.php' => '4aee3d317fe69953e01bb46725d43f94',
'Foursquare.php' => '397589be7475ebaad8970ca4b6eb60fd',
'Github.php' => '2e2d5834cc8a82235c16e40aa00ce541',
'Google.php' => 'be4864960167e6b37de048b946c0d379',
'GoogleOpenID.php' => 'bb90e3e12d87f0726ff58c1f5569bc4e',
'LinkedIn.php' => '5523c4f074fe4e1861df527d73e49da4',
'Live.php' => '995b6de787eae81944909613e070bb4c',
'MySpace.php' => '0a0064690cfff91854cd21e89ee94949',
'OpenID.php' => 'cac0c4f546bf7cadd3e0e08045e9496e',
'Steam.php' => 'ed4d5df2401d5bda0310902950b5ae63',
'Twitter.php' => 'b75922ec5b73dac7048e60628b779723',
'Yahoo.php' => '54e31f108103ff5ae541d4b429d4eed2',
),
'resources' =>
array (
'config.php.tpl' => 'a98e1313d7f3cb3b09c66be1a173bbe5',
'index.html' => '2b328c302ed608451171b3db0f6b92b3',
'openid_policy.html' => 'adaae0d22f0b9003a44534a64081d02d',
'openid_realm.html' => 'e2930bae092b00340ee16362ec5ac729',
'openid_xrds.xml' => 'b46a8e43108e0eca7dca32acca4decac',
'windows_live_channel.html' => '479decb220963b4ebb8e0dedd2a399a0',
),
'thirdparty' =>
array (
'Facebook' =>
array (
'base_facebook.php' => '765cff749aa16cc4500f9bd81cbd21ab',
'facebook.php' => '6bf73e0998383aaf604c54bc7942b9ab',
'fb_ca_chain_bundle.crt' => '98ad487c6bcd023914be60299202eee0',
),
'LinkedIn' =>
array (
'LinkedIn.php' => '1cd8fcbb82418c7f81d0de47f02f59c7',
),
'OAuth' =>
array (
'OAuth.php' => '50bae8f493620f1fdfb2063b26ebe2a5',
'OAuth1Client.php' => 'e6992197dabf5e1bd7f4f4e3c7525ecd',
'OAuth2Client.php' => 'f7a5499ef47177ac1ca106e886382872',
),
'OpenID' =>
array (
'LightOpenID.php' => '9fa681804a627f14911e458e7a102299',
),
'WindowsLive' =>
array (
'OAuthWrapHandler.php' => '7080d96d73a963730a4b3d69c7a7083f',
),
'index.html' => '2b328c302ed608451171b3db0f6b92b3',
),
'Auth.php' => '8aaaec7085b894e0554ef19520f59f58',
'Endpoint.php' => 'be7e05c19af2a69d4db3e82a2cff5db2',
'Error.php' => 'd94721e20cb24b0730acc07fa8a95a14',
'Exception.php' => 'd49e817a88114c2dd431335530e9db74',
'Logger.php' => 'c5d7d3a272b8c57c83a8d33bbb0e5e7d',
'Provider_Adapter.php' => '9ba762f0f1e4ed0e2aa120ca30590ff2',
'Provider_Model.php' => '43641d00761ed128767cc4957e2198c4',
'Provider_Model_OAuth1.php' => '12aad5fd49338c606c754b398e7323dd',
'Provider_Model_OAuth2.php' => '83a61d2bd9a345c0b9bfc8ac411119c3',
'Provider_Model_OpenID.php' => '1c5133bc57c3d45aacb522b7b918b8b8',
'Storage.php' => '9c58abd4e46c9fecdf248db1022d2289',
'StorageInterface.php' => '7a52a9b9bdc3569a98a0e32fc630d424',
'User.php' => 'c219b2c31b17127f044e7d425dcd06db',
'User_Activity.php' => '4b8c29b5c442915664f864ee4e18ac6b',
'User_Contact.php' => 'b7f17423d61d42cb30b36a127f6e0e78',
'User_Profile.php' => '4165786a0cc8d26ae683eda0669bf635',
'index.html' => '2b328c302ed608451171b3db0f6b92b3',
),
'index.php' => '9e3830ed561ec508dc00344aebad5152',
),
'jsshrink' =>
'jsshrink' =>
array (
'Minifier.php' => '10226dbede9950509b846658cac86c28',
),
Expand Down
110 changes: 36 additions & 74 deletions e107_core/controllers/system/xup.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,24 @@ 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';
$this->backUrl = vartrue($_GET['back']) ? base64_decode($_GET['back']) : true;
$this->backUrl = isset($_GET['back']) ? $_GET['back'] : null;
}

public function actionSignup()
public function actionLogin()
{
$allow = true;
$session = e107::getSession();
Expand All @@ -40,11 +49,10 @@ public function actionSignup()

if($allow && vartrue($_GET['provider']))
{
require_once(e_HANDLER."user_handler.php");
$provider = new e_user_provider($_GET['provider']);
$provider = e107::getUserProvider($_GET['provider']);
try
{
$provider->signup($this->backUrl, true, false); // redirect to test page is expected, if true - redirect to SITEURL
$provider->login($this->backUrl, true, false); // redirect to test page is expected, if true - redirect to SITEURL
}
catch (Exception $e)
{
Expand All @@ -54,35 +62,18 @@ public function actionSignup()

e107::getRedirect()->redirect(true === $this->backUrl ? SITEURL : $this->backUrl);
}
public function actionLogin()

public function actionTest()
{
$allow = true;
$session = e107::getSession();
if($session->get('HAuthError'))
{
$allow = false;
$session->set('HAuthError', null);
}
require_once(e_PLUGIN . "social/SocialLoginConfigManager.php");
$manager = new SocialLoginConfigManager(e107::getConfig());

if($allow && vartrue($_GET['provider']))
if (!$manager->isFlagActive($manager::ENABLE_BIT_TEST_PAGE))
{
require_once(e_HANDLER."user_handler.php");
$provider = new e_user_provider($_GET['provider']);
try
{
$provider->login($this->backUrl); // redirect to test page is expected, if true - redirect to SITEURL
}
catch (Exception $e)
{
e107::getMessage()->addError('['.$e->getCode().']'.$e->getMessage(), 'default', true);
}
e107::getRedirect()->redirect(SITEURL);
return;
}
e107::getRedirect()->redirect(true === $this->backUrl ? SITEURL : $this->backUrl);
}

public function actionTest()
{

echo '<h3>'.LAN_XUP_ERRM_07.'</h3>';

if(getperms('0'))
Expand All @@ -91,7 +82,7 @@ public function actionTest()
return;
}

if(isset($_GET['lgt']))
if(isset($_GET['logout']))
{
e107::getUser()->logout();
}
Expand All @@ -113,52 +104,23 @@ public function actionTest()
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";
$providers = $manager->getValidConfiguredProviderConfigs();

foreach($providers as $key=>$var)
{
if($var['enabled'] == 1)
{
echo '<h3>'.$key.'</h3><ul>';
echo '<li><a class="btn btn-default btn-secondary" href="'.e107::getUrl()->create('system/xup/login?provider='.$key.'&back='.base64_encode($testUrl)).'">'.e107::getParser()->lanVars(LAN_XUP_ERRM_09, array('x'=>$key)).'</a></li>';
echo '<li><a class="btn btn-default btn-secondary" href="'.e107::getUrl()->create('system/xup/signup?provider='.$key.'&back='.base64_encode($testUrl)).'">'.e107::getParser()->lanVars(LAN_XUP_ERRM_10, array('x'=>$key)).'</a></li>';

echo "</ul>";
$testLoginUrl = e107::getUrl()->create('system/xup/login', [
'provider' => $key,
'back' => $testUrl,
]);

echo '<h4>'.$key.'</h4>';
echo '<div><a class="btn btn-default btn-secondary" href="'.$testLoginUrl.'">'.e107::getParser()->lanVars(LAN_XUP_ERRM_10, array('x'=>$key)).'</a></div>';
}

// print_a($var);
}

echo '<br /><br /><a class="btn btn-default btn-secondary" href="'.e107::getUrl()->create('system/xup/test?lgt').'">'.LAN_XUP_ERRM_12.'</a>';

/*
echo '<h3>Facebook</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Facebook').'">Test login with Facebook</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Facebook').'">Test signup with Facebook</a>';

echo '<h3>Twitter</h3>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/login?provider=Twitter').'">Test login with Twitter</a>';
echo '<br /><a href="'.e107::getUrl()->create('system/xup/signup?provider=Twitter').'">Test signup with Twitter</a>';

*/
}

public function actionEndpoint()
{
require_once( e_HANDLER."hybridauth/Hybrid/Auth.php" );
require_once( e_HANDLER."hybridauth/Hybrid/Endpoint.php" );
require_once( e_HANDLER."hybridauth/vendor/autoload.php");

try
{
Hybrid_Endpoint::process();
}
catch (Exception $e)
{
e107::getMessage()->addError('['.$e->getCode().']'.$e->getMessage(), 'default', true);
$session = e107::getSession();
$session->set('HAuthError', true);
}
echo '<br /><br /><a class="btn btn-default btn-secondary" href="'.e107::getUrl()->create('system/xup/test?logout=true').'">'.LAN_XUP_ERRM_12.'</a>';
}
}
Loading