/** * @param int $iErrNo * @param string $sErrStr * @param string $sErrFile * @param int $iErrLine * * @return bool */ public function LogPhpErrorHandler($iErrNo, $sErrStr, $sErrFile, $iErrLine) { $iType = \MailSo\Log\Enumerations\Type::NOTICE; switch ($iErrNo) { case E_USER_ERROR: $iType = \MailSo\Log\Enumerations\Type::ERROR; break; case E_USER_WARNING: $iType = \MailSo\Log\Enumerations\Type::WARNING; break; } $this->oActions->Logger()->Write($sErrFile . ' [line:' . $iErrLine . ', code:' . $iErrNo . ']', $iType, 'PHP'); $this->oActions->Logger()->Write('Error: ' . $sErrStr, $iType, 'PHP'); return !!(\MailSo\Log\Enumerations\Type::NOTICE === $iType && \RainLoop\Service::$__HIDE_ERROR_NOTICES); }
/** * @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 ServiceExternalLogin() { $this->oHttp->ServerNoCache(); $oException = null; $oAccount = null; $bLogout = true; if ($this->oActions->Config()->Get('labs', 'allow_external_login', false)) { $sEmail = \trim($this->oHttp->GetRequest('Email', '')); $sPassword = $this->oHttp->GetRequest('Password', ''); try { $oAccount = $this->oActions->LoginProcess($sEmail, $sPassword); $this->oActions->AuthToken($oAccount); $bLogout = !$oAccount instanceof \RainLoop\Model\Account; } catch (\Exception $oException) { $this->oActions->Logger()->WriteException($oException); } if ($bLogout) { $this->oActions->SetAuthLogoutToken(); } } switch (\strtolower($this->oHttp->GetRequest('Output', 'Redirect'))) { case 'json': @\header('Content-Type: application/json; charset=utf-8'); $aResult = array('Action' => 'ExternalLogin', 'Result' => $oAccount instanceof \RainLoop\Model\Account ? true : false, 'ErrorCode' => 0); if (!$aResult['Result']) { if ($oException instanceof \RainLoop\Exceptions\ClientException) { $aResult['ErrorCode'] = $oException->getCode(); } else { $aResult['ErrorCode'] = \RainLoop\Notifications::AuthError; } } return \MailSo\Base\Utils::Php2js($aResult, $this->Logger()); case 'redirect': default: $this->oActions->Location('./'); break; } return ''; }