/**
  * @param \RainLoop\Actions $oActions
  */
 public function __construct(\RainLoop\Actions $oActions)
 {
     $this->oLogger = null;
     $this->oActions = $oActions;
     $this->aPlugins = array();
     $this->aHooks = array();
     $this->aJs = array();
     $this->aAdminJs = array();
     $this->aTemplates = array();
     $this->aAdminTemplates = array();
     $this->aAjaxFilters = array();
     $this->aAdditionalAjax = array();
     $this->aProcessTemplate = array();
     $this->bIsEnabled = (bool) $this->oActions->Config()->Get('plugins', 'enable', false);
     if ($this->bIsEnabled) {
         $sList = \strtolower($this->oActions->Config()->Get('plugins', 'enabled_list', ''));
         if (0 < \strlen($sList)) {
             $aList = \explode(',', $sList);
             $aList = \array_map('trim', $aList);
             foreach ($aList as $sName) {
                 if (0 < \strlen($sName)) {
                     $oPlugin = $this->CreatePluginByName($sName);
                     if ($oPlugin) {
                         $oPlugin->InitStep('step1');
                         $oPlugin->Init();
                         $oPlugin->InitStep('step2');
                         $this->aPlugins[] = $oPlugin;
                         $oPlugin->InitStep('spep3');
                     }
                 }
             }
         }
         $this->RunHook('api.bootstrap.plugins');
     }
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 public function ServiceExternalSso()
 {
     $sResult = '';
     $bLogout = true;
     $sKey = $this->oActions->Config()->Get('labs', 'external_sso_key', '');
     if ($this->oActions->Config()->Get('labs', 'allow_external_sso', false) && !empty($sKey) && $sKey === \trim($this->oHttp->GetRequest('SsoKey', ''))) {
         $sEmail = \trim($this->oHttp->GetRequest('Email', ''));
         $sPassword = $this->oHttp->GetRequest('Password', '');
         $sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword);
         $bLogout = 0 === \strlen($sResult);
         switch (\strtolower($this->oHttp->GetRequest('Output', 'Plain'))) {
             case 'plain':
                 @\header('Content-Type: text/plain');
                 break;
             case 'json':
                 @\header('Content-Type: application/json; charset=utf-8');
                 $sResult = \MailSo\Base\Utils::Php2js(array('Action' => 'ExternalSso', 'Result' => $sResult), $this->Logger());
                 break;
         }
     }
     if ($bLogout) {
         $this->oActions->SetAuthLogoutToken();
     }
     return $sResult;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 /**
  * @param bool $bAdmin = false
  *
  * @return array
  */
 private function indexTemplateParameters($bAdmin = false)
 {
     $sLanguage = 'en';
     $sTheme = 'Default';
     list($sLanguage, $sTheme) = $this->oActions->GetLanguageAndTheme($bAdmin);
     $bAppJsDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_js', false);
     $bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
     $sStaticPrefix = \RainLoop\Utils::WebStaticPath();
     $aData = array('Language' => $sLanguage, 'Theme' => $sTheme, 'FaviconIcoLink' => $sStaticPrefix . 'favicon.ico', 'FaviconPngLink' => $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sStaticPrefix . 'apple-touch-icon.png', 'AppCssLink' => $sStaticPrefix . 'css/app' . ($bAppCssDebug ? '' : '.min') . '.css', 'BootJsLink' => $sStaticPrefix . 'js/min/boot.js', 'ComponentsJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . 'components.js', 'LibJsLink' => $sStaticPrefix . 'js/min/libs.js', 'EditorJsLink' => $sStaticPrefix . 'ckeditor/ckeditor.js', 'OpenPgpJsLink' => $sStaticPrefix . 'js/min/openpgp.min.js', 'AppJsCommonLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . 'common.js', 'AppJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . ($bAdmin ? 'admin' : 'app') . '.js');
     $aTemplateParameters = array('{{BaseAppDataScriptLink}}' => $bAdmin ? './?/AdminAppData/' : './?/AppData/', '{{BaseAppFaviconIcoFile}}' => $aData['FaviconIcoLink'], '{{BaseAppFaviconPngFile}}' => $aData['FaviconPngLink'], '{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'], '{{BaseAppMainCssLink}}' => $aData['AppCssLink'], '{{BaseAppBootScriptLink}}' => $aData['BootJsLink'], '{{BaseAppComponentsScriptLink}}' => $aData['ComponentsJsLink'], '{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'], '{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'], '{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'], '{{BaseAppMainCommonScriptLink}}' => $aData['AppJsCommonLink'], '{{BaseAppMainScriptLink}}' => $aData['AppJsLink'], '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr');
     $aTemplateParameters['{{BaseHash}}'] = \md5(\implode('~', array($bAdmin ? '1' : '0', \md5($this->oActions->Config()->Get('cache', 'index', '')), $this->oActions->Plugins()->Hash(), \RainLoop\Utils::WebVersionPath(), APP_VERSION)) . \implode('~', $aTemplateParameters));
     return $aTemplateParameters;
 }
Ejemplo n.º 5
0
 /**
  * @param bool $bAdmin
  *
  * @return array
  */
 private function startUpData($bAdmin)
 {
     $sLanguage = 'en';
     $sTheme = 'Default';
     if (!$bAdmin) {
         list($sLanguage, $sTheme) = $this->oActions->GetLanguageAndTheme();
     }
     $sLanguage = $this->oActions->ValidateLanguage($sLanguage);
     $sTheme = $this->oActions->ValidateTheme($sTheme);
     $bAppJsDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_js', false);
     $bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
     $sStaticPrefix = APP_WEB_STATIC_PATH;
     return array('Language' => $sLanguage, 'Theme' => $sTheme, 'Hash' => $this->generateIndexCacheHash($bAppJsDebug, $bAdmin), 'LoadingDescription' => $this->oActions->Config()->Get('webmail', 'loading_description', 'RainLoop'), 'FaviconIcoLink' => $sStaticPrefix . 'favicon.ico', 'FaviconPngLink' => $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sStaticPrefix . 'apple-touch-icon.png', 'AppCssLink' => $sStaticPrefix . 'css/app' . ($bAppCssDebug ? '' : '.min') . '.css', 'LibJsLink' => $sStaticPrefix . 'js/libs.js', 'EditorJsLink' => $sStaticPrefix . 'ckeditor/ckeditor.js', 'AppJsLink' => $sStaticPrefix . 'js/' . ($bAdmin ? 'admin' : 'app') . ($bAppJsDebug ? '' : '.min') . '.js');
 }
 /**
  * @param bool $bAdmin
  *
  * @return array
  */
 private function indexTemplateParameters($bAdmin)
 {
     $sLanguage = 'en';
     $sTheme = 'Default';
     if (!$bAdmin) {
         list($sLanguage, $sTheme) = $this->oActions->GetLanguageAndTheme();
     }
     $sLanguage = $this->oActions->ValidateLanguage($sLanguage);
     $sTheme = $this->oActions->ValidateTheme($sTheme);
     $bAppJsDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_js', false);
     $bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
     $sStaticPrefix = APP_WEB_STATIC_PATH;
     $aData = array('Language' => $sLanguage, 'Theme' => $sTheme, 'LoadingDescription' => $this->oActions->Config()->Get('webmail', 'loading_description', 'RainLoop'), 'FaviconIcoLink' => $sStaticPrefix . 'favicon.ico', 'FaviconPngLink' => $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sStaticPrefix . 'apple-touch-icon.png', 'AppCssLink' => $sStaticPrefix . 'css/app' . ($bAppCssDebug ? '' : '.min') . '.css', 'BootJsLink' => $sStaticPrefix . 'js/min/boot.js', 'LibJsLink' => $sStaticPrefix . 'js/min/libs.js', 'EditorJsLink' => $sStaticPrefix . 'ckeditor/ckeditor.js', 'OpenPgpJsLink' => $sStaticPrefix . 'js/min/openpgp.min.js', 'AppJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . ($bAdmin ? 'admin' : 'app') . '.js');
     $aTemplateParameters = array('{{BaseAppDataScriptLink}}' => $bAdmin ? './?/AdminAppData/' : './?/AppData/', '{{BaseAppFaviconIcoFile}}' => $aData['FaviconIcoLink'], '{{BaseAppFaviconPngFile}}' => $aData['FaviconPngLink'], '{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'], '{{BaseAppMainCssLink}}' => $aData['AppCssLink'], '{{BaseAppBootScriptLink}}' => $aData['BootJsLink'], '{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'], '{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'], '{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'], '{{BaseAppMainScriptLink}}' => $aData['AppJsLink'], '{{BaseAppLoadingDescription}}' => \htmlspecialchars($aData['LoadingDescription'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'), '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr');
     $aTemplateParameters['{{BaseHash}}'] = \md5(\implode('~', array(\md5($this->oActions->Config()->Get('cache', 'index', '')), $this->oActions->Plugins()->Hash(), APP_WEB_PATH, APP_VERSION)) . \implode('~', $aTemplateParameters));
     return $aTemplateParameters;
 }