Ejemplo n.º 1
0
 /**
  * @param bool $bAdmin = true
  *
  * @return string
  */
 private function localAppData($bAdmin = false)
 {
     @\header('Content-Type: application/javascript; charset=utf-8');
     $this->oHttp->ServerNoCache();
     $sAuthAccountHash = '';
     if (!$bAdmin && 0 === \strlen($this->oActions->GetSpecAuthLogoutTokenWithDeletion())) {
         $sAuthAccountHash = $this->oActions->GetSpecAuthTokenWithDeletion();
         if (empty($sAuthAccountHash)) {
             $sAuthAccountHash = $this->oActions->GetSpecAuthToken();
         }
         if (empty($sAuthAccountHash)) {
             $oAccount = $this->oActions->GetAccountFromSignMeToken();
             if ($oAccount) {
                 try {
                     $this->oActions->CheckMailConnection($oAccount);
                     $this->oActions->AuthToken($oAccount);
                     $sAuthAccountHash = $this->oActions->GetSpecAuthToken();
                 } catch (\Exception $oException) {
                     $oException = null;
                     $this->oActions->ClearSignMeData($oAccount);
                 }
             }
         }
         $this->oActions->SetSpecAuthToken($sAuthAccountHash);
     }
     $sResult = $this->compileAppData($this->oActions->AppData($bAdmin, $sAuthAccountHash), false);
     $this->Logger()->Write($sResult, \MailSo\Log\Enumerations\Type::INFO, 'APPDATA');
     return $sResult;
 }
Ejemplo n.º 2
0
 /**
  * @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;
 }