social_login_config_manager = new social_login_config(e107::getConfig()); } public function init() { $this->backUrl = isset($_GET['back']) ? $_GET['back'] : null; } public function actionLogin() { $allow = true; $session = e107::getSession(); if($session->get('HAuthError')) { $allow = false; $session->set('HAuthError', null); } if($allow && vartrue($_GET['provider'])) { $provider = e107::getUserProvider($_GET['provider']); try { $provider->login($this->backUrl, true, false); // 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(true === $this->backUrl ? SITEURL : $this->backUrl); } public function actionTest() { require_once(e_PLUGIN . "social/includes/social_login_config.php"); $manager = new social_login_config(e107::getConfig()); if (!$manager->isFlagActive($manager::ENABLE_BIT_TEST_PAGE)) { e107::getRedirect()->redirect(SITEURL); return; } echo '

'.LAN_XUP_ERRM_07.'

'; if(getperms('0')) { echo e107::getMessage()->addError(LAN_XUP_ERRM_08)->render(); return; } if(isset($_GET['logout'])) { e107::getUser()->logout(); } $profileData = null; $provider = e107::getUser()->getProvider(); if($provider) { $profileData = $provider->getUserProfile(); if(!empty($profileData)) { print_a($profileData); } } echo ' '.LAN_XUP_ERRM_11.' '.(e107::getUser()->isUser() && !empty($profileData) ? 'true' : 'false'); $testUrl = SITEURL."?route=system/xup/test"; $providers = $manager->getSupportedConfiguredProviderConfigs(); foreach($providers as $key=>$var) { if($var['enabled'] == 1) { $testLoginUrl = e107::getUrl()->create('system/xup/login', [ 'provider' => $key, 'back' => $testUrl, ]); echo '

'.$key.'

'; echo '
'.e107::getParser()->lanVars(LAN_XUP_ERRM_10, array('x'=>$key)).'
'; } } echo '

'.LAN_XUP_ERRM_12.''; } }