/** * @param \RainLoop\Account|null $oAccount = null * * @return \RainLoop\Common\RainLoopFacebookRedirectLoginHelper|null */ public function FacebookConnector($oAccount = null) { $oFacebook = false; $oConfig = $this->oActions->Config(); $sAppID = \trim($oConfig->Get('social', 'fb_app_id', '')); if (\version_compare(PHP_VERSION, '5.4.0', '>=') && $oConfig->Get('social', 'fb_enable', false) && '' !== $sAppID && '' !== \trim($oConfig->Get('social', 'fb_app_secret', ''))) { \Facebook\FacebookSession::setDefaultApplication($sAppID, \trim($oConfig->Get('social', 'fb_app_secret', ''))); $sRedirectUrl = $this->oHttp->GetFullUrl() . '?SocialFacebook'; if (0 < \strlen($this->oActions->GetSpecAuthToken())) { $sRedirectUrl .= '&rlah=' . $this->oActions->GetSpecAuthToken(); } else { if ($this->oHttp->HasQuery('rlah')) { $this->oActions->SetSpecAuthToken($this->oHttp->GetQuery('rlah', '')); $sRedirectUrl .= '&rlah=' . $this->oActions->GetSpecAuthToken(); } } try { $oAccount = $this->oActions->GetAccount(); $oFacebook = new \RainLoop\Common\RainLoopFacebookRedirectLoginHelper($sRedirectUrl); $oFacebook->initRainLoopData(array('rlAppId' => $sAppID, 'rlAccount' => $oAccount, 'rlUserHash' => \RainLoop\Utils::GetConnectionToken(), 'rlStorageProvaider' => $this->oActions->StorageProvider())); } catch (\Exception $oException) { $this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR); } } return false === $oFacebook ? null : $oFacebook; }
/** * @return string */ public function ServiceChange() { $oAccount = $this->oActions->GetAccount(); if ($oAccount && $this->oActions->GetCapa(false, \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oAccount)) { $oAccountToLogin = null; $sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2])); if (!empty($sEmail)) { $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail); $aAccounts = $this->oActions->GetAccounts($oAccount); if (isset($aAccounts[$sEmail])) { $oAccountToLogin = $this->oActions->GetAccountFromCustomToken($aAccounts[$sEmail], false, false); } } if ($oAccountToLogin) { $this->oActions->AuthToken($oAccountToLogin); } } $this->oActions->Location('./'); return ''; }
/** * @return string */ public function ServiceChange() { if ($this->Config()->Get('webmail', 'allow_additional_accounts', true)) { $oAccountToLogin = null; $sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2])); if (!empty($sEmail)) { $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail); $oAccount = $this->oActions->GetAccount(); if ($oAccount) { $aAccounts = $this->oActions->GetAccounts($oAccount); if (isset($aAccounts[$sEmail])) { $oAccountToLogin = $this->oActions->GetAccountFromCustomToken($aAccounts[$sEmail], false, false); } } } if ($oAccountToLogin) { $this->oActions->AuthProcess($oAccountToLogin); } } $this->oActions->Location('./'); return ''; }
/** * @param string $sPluginName * @param array $aSettings * * @return bool */ public function SaveUserPluginSettings($sPluginName, $aSettings) { $oAccount = $this->oActions->GetAccount(); if ($oAccount && \is_array($aSettings)) { $oSettings = $this->oActions->SettingsProvider()->Load($oAccount); if ($oSettings) { $aData = $oSettings->GetConf('Plugins', array()); if (!\is_array($aData)) { $aData = array(); } $aPluginSettings = array(); if (isset($aData[$sPluginName]) && \is_array($aData[$sPluginName])) { $aPluginSettings = $aData[$sPluginName]; } foreach ($aSettings as $sKey => $mValue) { $aPluginSettings[$sKey] = $mValue; } $aData[$sPluginName] = $aPluginSettings; $oSettings->SetConf('Plugins', $aData); return $this->oActions->SettingsProvider()->Save($oAccount, $oSettings); } } return false; }