/** * @param bool $bAdmin * @param string $sAuthAccountHash = '' * * @return array */ public function AppData($bAdmin, $sAuthAccountHash = '') { if (0 < \strlen($sAuthAccountHash) && \preg_match('/[^_\\-\\.a-zA-Z0-9]/', $sAuthAccountHash)) { $sAuthAccountHash = ''; } $oAccount = null; $oConfig = $this->Config(); $oPremProvider = $this->PremProvider(); $aResult = array('Version' => APP_VERSION, 'Auth' => false, 'AccountHash' => '', 'WebPath' => \RainLoop\Utils::WebPath(), 'WebVersionPath' => \RainLoop\Utils::WebVersionPath(), 'AccountSignMe' => false, 'AuthAccountHash' => '', 'MailToEmail' => '', 'Email' => '', 'DevEmail' => '', 'DevPassword' => '', 'Title' => 'RainLoop Webmail', 'LoadingDescription' => 'RainLoop', 'LoadingDescriptionEsc' => 'RainLoop', 'FaviconUrl' => '', 'LoginDescription' => '', 'LoginPowered' => true, 'LoginLogo' => '', 'LoginBackground' => '', 'LoginCss' => '', 'UserLogo' => '', 'UserLogoTitle' => '', 'UserLogoMessage' => '', 'UserCss' => '', 'WelcomePageUrl' => '', 'WelcomePageDisplay' => 'none', 'IncludeCss' => '', 'IncludeBackground' => '', 'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '', 'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false), 'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true), 'AllowHtmlEditorSourceButton' => (bool) $oConfig->Get('labs', 'allow_html_editor_source_button', false), 'AllowHtmlEditorBitiButtons' => (bool) $oConfig->Get('labs', 'allow_html_editor_biti_buttons', false), 'AllowCtrlEnterOnCompose' => (bool) $oConfig->Get('labs', 'allow_ctrl_enter_on_compose', false), 'UseRsaEncryption' => (bool) $oConfig->Get('security', 'use_rsa_encryption', false), 'RsaPublicKey' => '', 'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''), 'CustomLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''), 'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''), 'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true), 'DetermineUserDomain' => (bool) $oConfig->Get('login', 'determine_user_domain', false), 'UseLoginWelcomePage' => (bool) $oConfig->Get('login', 'welcome_page', false), 'ForgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')), 'RegistrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')), 'ContactsIsAllowed' => false, 'ChangePasswordIsAllowed' => false, 'RequireTwoFactor' => false, 'JsHash' => \md5(\RainLoop\Utils::GetConnectionToken()), 'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false), 'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true), 'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false), 'MaterialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true), 'FolderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50), 'StartupUrl' => \trim(\ltrim(\trim($oConfig->Get('labs', 'startup_url', '')), '#/')), 'FaviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true), 'Filtered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')), 'Community' => true, 'PremType' => false, 'Admin' => array(), 'Capa' => array(), 'AttachmentsActions' => array(), 'Plugins' => array()); if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENTS_ACTIONS)) { if (!!\class_exists('ZipArchive')) { $aResult['AttachmentsActions'][] = 'zip'; } if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('OCP\\Files')) { $aResult['AttachmentsActions'][] = 'owncloud'; } if ($oConfig->Get('social', 'dropbox_enable', false) && 0 < \strlen(\trim($oConfig->Get('social', 'dropbox_api_key', '')))) { $aResult['AttachmentsActions'][] = 'dropbox'; } } $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', '')); if ($aResult['UseRsaEncryption'] && \file_exists(APP_PRIVATE_DATA . 'rsa/public') && \file_exists(APP_PRIVATE_DATA . 'rsa/private')) { $aResult['RsaPublicKey'] = \file_get_contents(APP_PRIVATE_DATA . 'rsa/public'); $aResult['RsaPublicKey'] = $aResult['RsaPublicKey'] ? $aResult['RsaPublicKey'] : ''; if (false === \strpos($aResult['RsaPublicKey'], 'PUBLIC KEY')) { $aResult['RsaPublicKey'] = ''; } } if (0 === \strlen($aResult['RsaPublicKey'])) { $aResult['UseRsaEncryption'] = false; } if (0 < \strlen($sAuthAccountHash)) { $aResult['AuthAccountHash'] = $sAuthAccountHash; } $aResult['Title'] = $oConfig->Get('webmail', 'title', ''); $aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', ''); $aResult['FaviconUrl'] = $oConfig->Get('webmail', 'favicon_url', ''); if ($oPremProvider) { $oPremProvider->PopulateAppData($aResult); } if ('' !== $aResult['LoadingDescription'] && 'RainLoop' !== $aResult['LoadingDescription']) { $aResult['LoadingDescriptionEsc'] = @\htmlspecialchars($aResult['LoadingDescription'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'); } $oSettings = null; if (!$bAdmin) { $oAccount = $this->getAccountFromToken(false); if ($oAccount instanceof \RainLoop\Model\Account) { $aResult['IncludeCss'] = $aResult['UserCss']; $oAddressBookProvider = $this->AddressBookProvider($oAccount); $aResult['Auth'] = true; $aResult['Email'] = $oAccount->Email(); $aResult['IncLogin'] = $oAccount->IncLogin(); $aResult['OutLogin'] = $oAccount->OutLogin(); $aResult['AccountHash'] = $oAccount->Hash(); $aResult['AccountSignMe'] = $oAccount->SignMe(); $aResult['ChangePasswordIsAllowed'] = $this->ChangePasswordProvider()->PasswordChangePossibility($oAccount); $aResult['ContactsIsAllowed'] = $oAddressBookProvider->IsActive(); $aResult['ContactsSharingIsAllowed'] = $oAddressBookProvider->IsSharingAllowed(); $aResult['ContactsSyncIsAllowed'] = (bool) $oConfig->Get('contacts', 'allow_sync', false); $aResult['ContactsSyncInterval'] = (int) $oConfig->Get('contacts', 'sync_interval', 20); $aResult['EnableContactsSync'] = false; $aResult['ContactsSyncUrl'] = ''; $aResult['ContactsSyncUser'] = ''; $aResult['ContactsSyncPassword'] = ''; if ($aResult['ContactsIsAllowed'] && $aResult['ContactsSyncIsAllowed']) { $mData = $this->getContactsSyncData($oAccount); if (\is_array($mData)) { $aResult['EnableContactsSync'] = isset($mData['Enable']) ? !!$mData['Enable'] : false; $aResult['ContactsSyncUrl'] = isset($mData['Url']) ? \trim($mData['Url']) : ''; $aResult['ContactsSyncUser'] = isset($mData['User']) ? \trim($mData['User']) : ''; $aResult['ContactsSyncPassword'] = APP_DUMMY; } } if ($aResult['AccountSignMe']) { $sToken = \RainLoop\Utils::GetCookie(self::AUTH_MAILTO_TOKEN_KEY, null); if (null !== $sToken) { \RainLoop\Utils::ClearCookie(self::AUTH_MAILTO_TOKEN_KEY); $mMailToData = \RainLoop\Utils::DecodeKeyValuesQ($sToken); if (\is_array($mMailToData) && !empty($mMailToData['MailTo']) && 'MailTo' === $mMailToData['MailTo'] && !empty($mMailToData['To'])) { $aResult['MailToEmail'] = $mMailToData['To']; } } } $oSettings = $this->SettingsProvider()->Load($oAccount); if (!$oAccount->IsAdditionalAccount() && !empty($aResult['WelcomePageUrl']) && ('once' === $aResult['WelcomePageDisplay'] || 'always' === $aResult['WelcomePageDisplay'])) { if ('once' === $aResult['WelcomePageDisplay']) { if ($aResult['WelcomePageUrl'] === $oSettings->GetConf('LastWelcomePage', '')) { $aResult['WelcomePageUrl'] = ''; $aResult['WelcomePageDisplay'] = ''; } } } else { $aResult['WelcomePageUrl'] = ''; $aResult['WelcomePageDisplay'] = ''; } if (!empty($aResult['StartupUrl'])) { $aResult['StartupUrl'] = $this->compileLogParams($aResult['StartupUrl'], $oAccount, true); } if (!empty($aResult['UserIframeMessage'])) { $aResult['UserIframeMessage'] = $this->compileLogParams($aResult['UserIframeMessage'], $oAccount, true); } } else { $oAccount = null; $aResult['IncludeBackground'] = $aResult['LoginBackground']; $aResult['IncludeCss'] = $aResult['LoginCss']; $aResult['DevEmail'] = $oConfig->Get('labs', 'dev_email', ''); $aResult['DevPassword'] = $oConfig->Get('labs', 'dev_password', ''); $aResult['WelcomePageUrl'] = ''; $aResult['WelcomePageDisplay'] = ''; $aResult['StartupUrl'] = ''; } $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true); $aResult['AllowGoogleSocialAuthFast'] = (bool) $oConfig->Get('social', 'google_enable_auth_fast', true); $aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true); $aResult['AllowGoogleSocialPreview'] = (bool) $oConfig->Get('social', 'google_enable_preview', true); $aResult['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', '')); $aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', '')); if (!$aResult['AllowGoogleSocial'] || $aResult['AllowGoogleSocial'] && ('' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', '')))) { $aResult['AllowGoogleSocialAuth'] = false; $aResult['AllowGoogleSocialAuthFast'] = false; $aResult['AllowGoogleSocialDrive'] = false; $aResult['GoogleClientID'] = ''; $aResult['GoogleApiKey'] = ''; } if (!$aResult['AllowGoogleSocial']) { $aResult['AllowGoogleSocialPreview'] = false; } if ($aResult['AllowGoogleSocial'] && !$aResult['AllowGoogleSocialAuth'] && !$aResult['AllowGoogleSocialAuthFast'] && !$aResult['AllowGoogleSocialDrive'] && !$aResult['AllowGoogleSocialPreview']) { $aResult['AllowGoogleSocial'] = false; } $aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false); if ($aResult['AllowFacebookSocial'] && ('' === \trim($oConfig->Get('social', 'fb_app_id', '')) || '' === \trim($oConfig->Get('social', 'fb_app_secret', '')))) { $aResult['AllowFacebookSocial'] = false; } $aResult['AllowTwitterSocial'] = (bool) $oConfig->Get('social', 'twitter_enable', false); if ($aResult['AllowTwitterSocial'] && ('' === \trim($oConfig->Get('social', 'twitter_consumer_key', '')) || '' === \trim($oConfig->Get('social', 'twitter_consumer_secret', '')))) { $aResult['AllowTwitterSocial'] = false; } $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', '')); if (!$aResult['AllowDropboxSocial']) { $aResult['DropboxApiKey'] = ''; } else { if (0 === strlen($aResult['DropboxApiKey'])) { $aResult['AllowDropboxSocial'] = false; } } $aResult['Capa'] = $this->Capa(false, $oAccount); if ($aResult['Auth'] && !$aResult['RequireTwoFactor']) { if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::TWO_FACTOR, $oAccount) && $this->GetCapa(false, \RainLoop\Enumerations\Capa::TWO_FACTOR_FORCE, $oAccount) && $this->TwoFactorAuthProvider()->IsActive()) { $aData = $this->getTwoFactorInfo($oAccount, true); $aResult['RequireTwoFactor'] = !$aData || !isset($aData['User'], $aData['IsSet'], $aData['Enable']) || !($aData['IsSet'] && $aData['Enable']); } } } else { $aResult['Auth'] = $this->IsAdminLoggined(false); if ($aResult['Auth']) { $aResult['AdminDomain'] = APP_SITE; $aResult['AdminLogin'] = (string) $oConfig->Get('security', 'admin_login', ''); $aResult['UseTokenProtection'] = (bool) $oConfig->Get('security', 'csrf_protection', true); $aResult['EnabledPlugins'] = (bool) $oConfig->Get('plugins', 'enable', false); $aResult['VerifySslCertificate'] = (bool) $oConfig->Get('ssl', 'verify_certificate', false); $aResult['AllowSelfSigned'] = (bool) $oConfig->Get('ssl', 'allow_self_signed', true); $aDrivers = \class_exists('PDO') ? \PDO::getAvailableDrivers() : null; $aResult['MySqlIsSupported'] = \is_array($aDrivers) ? \in_array('mysql', $aDrivers) : false; $aResult['SQLiteIsSupported'] = \is_array($aDrivers) ? \in_array('sqlite', $aDrivers) : false; $aResult['PostgreSqlIsSupported'] = \is_array($aDrivers) ? \in_array('pgsql', $aDrivers) : false; $aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false); $aResult['ContactsSharing'] = (bool) $oConfig->Get('contacts', 'allow_sharing', false); $aResult['ContactsSync'] = (bool) $oConfig->Get('contacts', 'allow_sync', false); $aResult['ContactsPdoType'] = (string) $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite'))); $aResult['ContactsPdoDsn'] = (string) $oConfig->Get('contacts', 'pdo_dsn', ''); $aResult['ContactsPdoType'] = (string) $oConfig->Get('contacts', 'type', ''); $aResult['ContactsPdoUser'] = (string) $oConfig->Get('contacts', 'pdo_user', ''); $aResult['ContactsPdoPassword'] = (string) APP_DUMMY; $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true); $aResult['AllowGoogleSocialAuthFast'] = (bool) $oConfig->Get('social', 'google_enable_auth_fast', true); $aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true); $aResult['AllowGoogleSocialPreview'] = (bool) $oConfig->Get('social', 'google_enable_preview', true); $aResult['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', ''); $aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', ''); $aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', ''); $aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false); $aResult['FacebookAppID'] = (string) $oConfig->Get('social', 'fb_app_id', ''); $aResult['FacebookAppSecret'] = (string) $oConfig->Get('social', 'fb_app_secret', ''); $aResult['AllowTwitterSocial'] = (bool) $oConfig->Get('social', 'twitter_enable', false); $aResult['TwitterConsumerKey'] = (string) $oConfig->Get('social', 'twitter_consumer_key', ''); $aResult['TwitterConsumerSecret'] = (string) $oConfig->Get('social', 'twitter_consumer_secret', ''); $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['DropboxApiKey'] = (string) $oConfig->Get('social', 'dropbox_api_key', ''); $aResult['SubscriptionEnabled'] = (bool) \MailSo\Base\Utils::ValidateDomain($aResult['AdminDomain']); // || \MailSo\Base\Utils::ValidateIP($aResult['AdminDomain']); $aResult['WeakPassword'] = (bool) $oConfig->ValidatePassword('12345'); $aResult['CoreAccess'] = (bool) $this->rainLoopCoreAccess(); $aResult['PhpUploadSizes'] = array('upload_max_filesize' => \ini_get('upload_max_filesize'), 'post_max_size' => \ini_get('post_max_size')); } $aResult['Capa'] = $this->Capa(true); } $aResult['SupportedFacebookSocial'] = (bool) \version_compare(PHP_VERSION, '5.4.0', '>='); if (!$aResult['SupportedFacebookSocial']) { $aResult['AllowFacebookSocial'] = false; $aResult['FacebookAppID'] = ''; $aResult['FacebookAppSecret'] = ''; } $aResult['ProjectHash'] = \md5($aResult['AccountHash'] . APP_VERSION . $this->Plugins()->Hash()); $sLanguage = $oConfig->Get('webmail', 'language', 'en'); $sLanguageAdmin = $oConfig->Get('webmail', 'language_admin', 'en'); $sTheme = $oConfig->Get('webmail', 'theme', 'Default'); $aResult['Themes'] = $this->GetThemes(); $aResult['Languages'] = $this->GetLanguages(false); $aResult['LanguagesAdmin'] = $this->GetLanguages(true); $aResult['AllowLanguagesOnSettings'] = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true); $aResult['AllowLanguagesOnLogin'] = (bool) $oConfig->Get('login', 'allow_languages_on_login', true); $aResult['AttachmentLimit'] = (int) $oConfig->Get('webmail', 'attachment_size_limit', 10) * 1024 * 1024; $aResult['SignMe'] = (string) $oConfig->Get('login', 'sign_me_auto', \RainLoop\Enumerations\SignMeType::DEFAILT_OFF); $aResult['UseLocalProxyForExternalImages'] = (bool) $oConfig->Get('labs', 'use_local_proxy_for_external_images', false); // user $aResult['ShowImages'] = (bool) $oConfig->Get('defaults', 'show_images', false); $aResult['MPP'] = (int) $oConfig->Get('webmail', 'messages_per_page', 25); $aResult['SoundNotification'] = false; $aResult['DesktopNotifications'] = false; $aResult['Layout'] = (int) $oConfig->Get('defaults', 'view_layout', \RainLoop\Enumerations\Layout::SIDE_PREVIEW); $aResult['EditorDefaultType'] = (string) $oConfig->Get('defaults', 'view_editor_type', ''); $aResult['UseCheckboxesInList'] = (bool) $oConfig->Get('defaults', 'view_use_checkboxes', true); $aResult['AutoLogout'] = (int) $oConfig->Get('defaults', 'autologout', 30); $aResult['UseThreads'] = (bool) $oConfig->Get('defaults', 'mail_use_threads', false); $aResult['ReplySameFolder'] = (bool) $oConfig->Get('defaults', 'mail_reply_same_folder', false); $aResult['ContactsAutosave'] = (bool) $oConfig->Get('defaults', 'contacts_autosave', true); $aResult['EnableTwoFactor'] = false; $aResult['ParentEmail'] = ''; $aResult['InterfaceAnimation'] = true; $aResult['UserBackgroundName'] = ''; $aResult['UserBackgroundHash'] = ''; if (!$bAdmin && $oAccount instanceof \RainLoop\Model\Account) { $aResult['ParentEmail'] = $oAccount->ParentEmail(); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); if ($oSettingsLocal instanceof \RainLoop\Settings) { // if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::FOLDERS, $oAccount)) $aResult['SentFolder'] = (string) $oSettingsLocal->GetConf('SentFolder', ''); $aResult['DraftFolder'] = (string) $oSettingsLocal->GetConf('DraftFolder', ''); $aResult['SpamFolder'] = (string) $oSettingsLocal->GetConf('SpamFolder', ''); $aResult['TrashFolder'] = (string) $oSettingsLocal->GetConf('TrashFolder', ''); $aResult['ArchiveFolder'] = (string) $oSettingsLocal->GetConf('ArchiveFolder', ''); $aResult['NullFolder'] = (string) $oSettingsLocal->GetConf('NullFolder', ''); } if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::SETTINGS, $oAccount)) { if ($oSettings instanceof \RainLoop\Settings) { if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) { $sLanguage = (string) $oSettings->GetConf('Language', $sLanguage); } $aResult['EditorDefaultType'] = (string) $oSettings->GetConf('EditorDefaultType', $aResult['EditorDefaultType']); $aResult['ShowImages'] = (bool) $oSettings->GetConf('ShowImages', $aResult['ShowImages']); $aResult['ContactsAutosave'] = (bool) $oSettings->GetConf('ContactsAutosave', $aResult['ContactsAutosave']); $aResult['MPP'] = (int) $oSettings->GetConf('MPP', $aResult['MPP']); $aResult['SoundNotification'] = (bool) $oSettings->GetConf('SoundNotification', $aResult['SoundNotification']); $aResult['DesktopNotifications'] = (bool) $oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']); $aResult['UseCheckboxesInList'] = (bool) $oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']); $aResult['AutoLogout'] = (int) $oSettings->GetConf('AutoLogout', $aResult['AutoLogout']); $aResult['Layout'] = (int) $oSettings->GetConf('Layout', $aResult['Layout']); if (!$this->GetCapa(false, \RainLoop\Enumerations\Capa::AUTOLOGOUT, $oAccount)) { $aResult['AutoLogout'] = 0; } if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::USER_BACKGROUND, $oAccount)) { $aResult['UserBackgroundName'] = (string) $oSettings->GetConf('UserBackgroundName', $aResult['UserBackgroundName']); $aResult['UserBackgroundHash'] = (string) $oSettings->GetConf('UserBackgroundHash', $aResult['UserBackgroundHash']); // if (!empty($aResult['UserBackgroundName']) && !empty($aResult['UserBackgroundHash'])) // { // $aResult['IncludeBackground'] = './?/Raw/&q[]=/{{USER}}/UserBackground/&q[]=/'. // $aResult['UserBackgroundHash'].'/'; // } } $aResult['EnableTwoFactor'] = (bool) $oSettings->GetConf('EnableTwoFactor', $aResult['EnableTwoFactor']); } if ($oSettingsLocal instanceof \RainLoop\Settings) { $aResult['UseThreads'] = (bool) $oSettingsLocal->GetConf('UseThreads', $aResult['UseThreads']); $aResult['ReplySameFolder'] = (bool) $oSettingsLocal->GetConf('ReplySameFolder', $aResult['ReplySameFolder']); if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::THEMES, $oAccount)) { $sTheme = (string) $oSettingsLocal->GetConf('Theme', $sTheme); } } } } $sStaticCache = \md5(APP_VERSION . $this->Plugins()->Hash()); $sTheme = $this->ValidateTheme($sTheme); $sNewThemeLink = './?/Css/0/' . ($bAdmin ? 'Admin' : 'User') . '/-/' . $sTheme . '/-/' . $sStaticCache . '/Hash/-/'; if (!$aResult['Auth']) { if (!$bAdmin) { if ($oConfig->Get('login', 'allow_languages_on_login', true) && $oConfig->Get('login', 'determine_user_language', true)) { $sLanguage = $this->ValidateLanguage($this->detectUserLanguage($bAdmin), $sLanguage, false); } } } $sPluginsLink = ''; if (0 < $this->Plugins()->Count() && $this->Plugins()->HaveJs($bAdmin)) { $sPluginsLink = './?/Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $sStaticCache . '/'; } $aResult['Theme'] = $sTheme; $aResult['NewThemeLink'] = $sNewThemeLink; $aResult['Language'] = $this->ValidateLanguage($sLanguage, '', false); $aResult['LanguageAdmin'] = $this->ValidateLanguage($sLanguageAdmin, '', true); $aResult['UserLanguageRaw'] = $this->detectUserLanguage($bAdmin); $aResult['UserLanguage'] = $this->ValidateLanguage($aResult['UserLanguageRaw'], '', false, true); $aResult['UserLanguageAdmin'] = $this->ValidateLanguage($aResult['UserLanguageRaw'], '', true, true); $aResult['LangLink'] = './?/Lang/0/' . ($bAdmin ? 'Admin' : 'App') . '/' . ($bAdmin ? $aResult['LanguageAdmin'] : $aResult['Language']) . '/' . $sStaticCache . '/'; $aResult['TemplatesLink'] = './?/Templates/0/' . ($bAdmin ? 'Admin' : 'App') . '/' . $sStaticCache . '/'; $aResult['PluginsLink'] = $sPluginsLink; $aResult['EditorDefaultType'] = \in_array($aResult['EditorDefaultType'], array('Plain', 'Html', 'HtmlForced', 'PlainForced')) ? $aResult['EditorDefaultType'] : 'Plain'; // IDN $aResult['Email'] = \MailSo\Base\Utils::IdnToUtf8($aResult['Email']); $aResult['ParentEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['ParentEmail']); $aResult['MailToEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['MailToEmail']); $aResult['DevEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['DevEmail']); $this->Plugins()->InitAppData($bAdmin, $aResult, $oAccount); return $aResult; }
/** * @return string */ public function ServiceAjax() { @\ob_start(); $aResponseItem = null; $oException = null; $sAction = $this->oHttp->GetPost('Action', null); if (empty($sAction) && $this->oHttp->IsGet() && !empty($this->aPaths[2])) { $sAction = $this->aPaths[2]; } try { if ($this->oHttp->IsPost() && !in_array($sAction, array('JsInfo', 'JsError')) && $this->Config()->Get('security', 'csrf_protection', false) && $this->oHttp->GetPost('XToken', '') !== \RainLoop\Utils::GetCsrfToken()) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::InvalidToken); } else { if (!empty($sAction)) { $sMethodName = 'Do' . $sAction; $this->Logger()->Write('Action: ' . $sMethodName, \MailSo\Log\Enumerations\Type::NOTE, 'AJAX'); $aPost = $this->oHttp->GetPostAsArray(); if (\is_array($aPost) && 0 < \count($aPost)) { $this->oActions->SetActionParams($aPost, $sMethodName); switch ($sMethodName) { case 'DoLogin': case 'DoAdminLogin': case 'DoAccountAdd': $this->Logger()->AddSecret($this->oActions->GetActionParam('Password', '')); break; case 'DoChangePassword': $this->Logger()->AddSecret($this->oActions->GetActionParam('PrevPassword', '')); $this->Logger()->AddSecret($this->oActions->GetActionParam('NewPassword', '')); break; } $this->Logger()->Write(\MailSo\Base\Utils::Php2js($aPost, $this->Logger()), \MailSo\Log\Enumerations\Type::INFO, 'POST', true); } else { if (3 < \count($this->aPaths) && $this->oHttp->IsGet()) { $this->oActions->SetActionParams(array('RawKey' => empty($this->aPaths[3]) ? '' : $this->aPaths[3]), $sMethodName); } } if (\method_exists($this->oActions, $sMethodName) && \is_callable(array($this->oActions, $sMethodName))) { $this->Plugins()->RunHook('ajax.action-pre-call', array($sAction)); $aResponseItem = \call_user_func(array($this->oActions, $sMethodName)); $this->Plugins()->RunHook('ajax.action-post-call', array($sAction, &$aResponseItem)); } else { if ($this->Plugins()->HasAdditionalAjax($sMethodName)) { $this->Plugins()->RunHook('ajax.action-pre-call', array($sAction)); $aResponseItem = $this->Plugins()->RunAdditionalAjax($sMethodName); $this->Plugins()->RunHook('ajax.action-post-call', array($sAction, &$aResponseItem)); } } } } if (!\is_array($aResponseItem)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::UnknownError); } } catch (\Exception $oException) { $aResponseItem = $this->oActions->ExceptionResponse(empty($sAction) ? 'Unknown' : $sAction, $oException); if (\is_array($aResponseItem) && 'Folders' === $sAction && $oException instanceof \RainLoop\Exceptions\ClientException) { $aResponseItem['ClearAuth'] = true; } } if (\is_array($aResponseItem)) { $aResponseItem['Time'] = (int) ((\microtime(true) - APP_START) * 1000); } $this->Plugins()->RunHook('filter.ajax-response', array($sAction, &$aResponseItem)); @\header('Content-Type: application/json; charset=utf-8'); $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, $this->Logger()); $sObResult = @\ob_get_clean(); if ($this->Logger()->IsEnabled()) { if (0 < \strlen($sObResult)) { $this->Logger()->Write($sObResult, \MailSo\Log\Enumerations\Type::ERROR, 'OB-DATA'); } if ($oException) { $this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR); } $iLimit = (int) $this->Config()->Get('labs', 'log_ajax_response_write_limit', 0); $this->Logger()->Write(0 < $iLimit && $iLimit < \strlen($sResult) ? \substr($sResult, 0, $iLimit) . '...' : $sResult, \MailSo\Log\Enumerations\Type::INFO, 'AJAX'); } return $sResult; }
/** * @param bool $bAdmin * @param string $sAuthAccountHash = '' * * @return array */ public function AppData($bAdmin, $sAuthAccountHash = '') { if (0 < \strlen($sAuthAccountHash) && \preg_match('/[^_\\-\\.a-zA-Z0-9]/', $sAuthAccountHash)) { $sAuthAccountHash = ''; } $oAccount = null; $oConfig = $this->Config(); $aResult = array('Version' => APP_VERSION, 'Auth' => false, 'AccountHash' => '', 'StaticPrefix' => 'rainloop/v/' . APP_VERSION . '/static/', 'AccountSignMe' => false, 'AuthAccountHash' => '', 'MailToEmail' => '', 'Email' => '', 'DevEmail' => '', 'DevPassword' => '', 'Title' => 'RainLoop Webmail', 'LoadingDescription' => 'RainLoop', 'LoginLogo' => '', 'LoginDescription' => '', 'LoginCss' => '', 'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '', 'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false), 'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true), 'AllowHtmlEditorSourceButton' => (bool) $oConfig->Get('labs', 'allow_html_editor_source_button', false), 'UseRsaEncryption' => (bool) $oConfig->Get('security', 'use_rsa_encryption', false), 'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''), 'CustomLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''), 'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''), 'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true), 'DetermineUserDomain' => (bool) $oConfig->Get('login', 'determine_user_domain', false), 'ContactsIsAllowed' => false, 'ChangePasswordIsAllowed' => false, 'JsHash' => \md5(\RainLoop\Utils::GetConnectionToken()), 'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false), 'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true), 'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false), 'Capa' => array(), 'Plugins' => array()); if (0 < \strlen($sAuthAccountHash)) { $aResult['AuthAccountHash'] = $sAuthAccountHash; } if ($this->GetCapa(true, \RainLoop\Enumerations\Capa::PREM)) { $aResult['Title'] = $oConfig->Get('webmail', 'title', ''); $aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', ''); $aResult['LoginLogo'] = $oConfig->Get('branding', 'login_logo', ''); $aResult['LoginDescription'] = $oConfig->Get('branding', 'login_desc', ''); $aResult['LoginCss'] = $oConfig->Get('branding', 'login_css', ''); } $oSettings = null; if (!$bAdmin) { $oAccount = $this->getAccountFromToken(false); if ($oAccount instanceof \RainLoop\Account) { $oAddressBookProvider = $this->AddressBookProvider($oAccount); $aResult['Auth'] = true; $aResult['Email'] = $oAccount->Email(); $aResult['IncLogin'] = $oAccount->IncLogin(); $aResult['OutLogin'] = $oAccount->OutLogin(); $aResult['AccountHash'] = $oAccount->Hash(); $aResult['AccountSignMe'] = $oAccount->SignMe(); $aResult['ChangePasswordIsAllowed'] = $this->ChangePasswordProvider()->PasswordChangePossibility($oAccount); $aResult['ContactsIsAllowed'] = $oAddressBookProvider->IsActive(); $aResult['ContactsSharingIsAllowed'] = $oAddressBookProvider->IsSharingAllowed(); $aResult['ContactsSyncIsAllowed'] = (bool) $oConfig->Get('contacts', 'allow_sync', false); $aResult['ContactsSyncInterval'] = (int) $oConfig->Get('contacts', 'sync_interval', 20); $aResult['EnableContactsSync'] = false; $aResult['ContactsSyncUrl'] = ''; $aResult['ContactsSyncUser'] = ''; $aResult['ContactsSyncPassword'] = ''; if ($aResult['ContactsIsAllowed'] && $aResult['ContactsSyncIsAllowed']) { $mData = $this->getContactsSyncData($oAccount); if (\is_array($mData)) { $aResult['EnableContactsSync'] = isset($mData['Enable']) ? !!$mData['Enable'] : false; $aResult['ContactsSyncUrl'] = isset($mData['Url']) ? \trim($mData['Url']) : ''; $aResult['ContactsSyncUser'] = isset($mData['User']) ? \trim($mData['User']) : ''; $aResult['ContactsSyncPassword'] = APP_DUMMY; } } if ($aResult['AccountSignMe']) { $sToken = \RainLoop\Utils::GetCookie(self::AUTH_MAILTO_TOKEN_KEY, null); if (null !== $sToken) { \RainLoop\Utils::ClearCookie(self::AUTH_MAILTO_TOKEN_KEY); $mMailToData = \RainLoop\Utils::DecodeKeyValues($sToken); if (\is_array($mMailToData) && !empty($mMailToData['MailTo']) && 'MailTo' === $mMailToData['MailTo'] && !empty($mMailToData['To'])) { $aResult['MailToEmail'] = $mMailToData['To']; } } } $oSettings = $this->SettingsProvider()->Load($oAccount); } else { $oAccount = null; $aResult['DevEmail'] = $oConfig->Get('labs', 'dev_email', ''); $aResult['DevPassword'] = $oConfig->Get('labs', 'dev_password', ''); } $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $aResult['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', '')); $aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', '')); if ($aResult['AllowGoogleSocial'] && ('' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', '')))) { $aResult['AllowGoogleSocial'] = false; $aResult['GoogleClientID'] = ''; $aResult['GoogleApiKey'] = ''; } $aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false); if ($aResult['AllowFacebookSocial'] && ('' === \trim($oConfig->Get('social', 'fb_app_id', '')) || '' === \trim($oConfig->Get('social', 'fb_app_secret', '')))) { $aResult['AllowFacebookSocial'] = false; } $aResult['AllowTwitterSocial'] = (bool) $oConfig->Get('social', 'twitter_enable', false); if ($aResult['AllowTwitterSocial'] && ('' === \trim($oConfig->Get('social', 'twitter_consumer_key', '')) || '' === \trim($oConfig->Get('social', 'twitter_consumer_secret', '')))) { $aResult['AllowTwitterSocial'] = false; } $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', '')); if (!$aResult['AllowDropboxSocial']) { $aResult['DropboxApiKey'] = ''; } else { if (0 === strlen($aResult['DropboxApiKey'])) { $aResult['AllowDropboxSocial'] = false; } } $aResult['Capa'] = $this->Capa(false, $oAccount); } else { $aResult['Auth'] = $this->IsAdminLoggined(false); if ($aResult['Auth']) { $aResult['AdminLogin'] = $oConfig->Get('security', 'admin_login', ''); $aResult['AdminDomain'] = APP_SITE; $aResult['UseTokenProtection'] = (bool) $oConfig->Get('security', 'csrf_protection', true); $aResult['EnabledPlugins'] = (bool) $oConfig->Get('plugins', 'enable', false); $aDrivers = \class_exists('PDO') ? \PDO::getAvailableDrivers() : array(); $aResult['MySqlIsSupported'] = \is_array($aDrivers) ? \in_array('mysql', $aDrivers) : false; $aResult['SQLiteIsSupported'] = \is_array($aDrivers) ? \in_array('sqlite', $aDrivers) : false; $aResult['PostgreSqlIsSupported'] = \is_array($aDrivers) ? \in_array('pgsql', $aDrivers) : false; $aResult['ContactsEnable'] = (bool) $oConfig->Get('contacts', 'enable', false); $aResult['ContactsSharing'] = (bool) $oConfig->Get('contacts', 'allow_sharing', false); $aResult['ContactsSync'] = (bool) $oConfig->Get('contacts', 'allow_sync', false); $aResult['ContactsPdoType'] = $this->ValidateContactPdoType(\trim($this->Config()->Get('contacts', 'type', 'sqlite'))); $aResult['ContactsPdoDsn'] = (string) $oConfig->Get('contacts', 'pdo_dsn', ''); $aResult['ContactsPdoType'] = (string) $oConfig->Get('contacts', 'type', ''); $aResult['ContactsPdoUser'] = (string) $oConfig->Get('contacts', 'pdo_user', ''); $aResult['ContactsPdoPassword'] = APP_DUMMY; $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $aResult['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', ''); $aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', ''); $aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', ''); $aResult['AllowFacebookSocial'] = (bool) $oConfig->Get('social', 'fb_enable', false); $aResult['FacebookAppID'] = (string) $oConfig->Get('social', 'fb_app_id', ''); $aResult['FacebookAppSecret'] = (string) $oConfig->Get('social', 'fb_app_secret', ''); $aResult['AllowTwitterSocial'] = (bool) $oConfig->Get('social', 'twitter_enable', false); $aResult['TwitterConsumerKey'] = (string) $oConfig->Get('social', 'twitter_consumer_key', ''); $aResult['TwitterConsumerSecret'] = (string) $oConfig->Get('social', 'twitter_consumer_secret', ''); $aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false); $aResult['DropboxApiKey'] = (string) $oConfig->Get('social', 'dropbox_api_key', ''); $aResult['SubscriptionEnabled'] = \MailSo\Base\Utils::ValidateDomain($aResult['AdminDomain']); $aResult['WeakPassword'] = $oConfig->ValidatePassword('12345'); $aResult['CoreAccess'] = $this->rainLoopCoreAccess(); $aResult['PhpUploadSizes'] = array('upload_max_filesize' => \ini_get('upload_max_filesize'), 'post_max_size' => \ini_get('post_max_size')); } $aResult['Capa'] = $this->Capa(true); } $aResult['SupportedFacebookSocial'] = (bool) \version_compare(PHP_VERSION, '5.4.0', '>='); if (!$aResult['SupportedFacebookSocial']) { $aResult['AllowFacebookSocial'] = false; $aResult['FacebookAppID'] = ''; $aResult['FacebookAppSecret'] = ''; } $aResult['ProjectHash'] = \md5($aResult['AccountHash'] . APP_VERSION . $this->Plugins()->Hash()); $sLanguage = $oConfig->Get('webmail', 'language', 'en'); $sTheme = $oConfig->Get('webmail', 'theme', 'Default'); $aResult['Themes'] = $this->GetThemes(); $aResult['Languages'] = $this->GetLanguages(); $aResult['AllowLanguagesOnSettings'] = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true); $aResult['AllowLanguagesOnLogin'] = (bool) $oConfig->Get('login', 'allow_languages_on_login', true); $aResult['AttachmentLimit'] = (int) $oConfig->Get('webmail', 'attachment_size_limit', 10) * 1024 * 1024; $aResult['SignMe'] = (string) $oConfig->Get('login', 'sign_me_auto', \RainLoop\Enumerations\SignMeType::DEFAILT_OFF); $aResult['UseLocalProxyForExternalImages'] = (bool) $oConfig->Get('labs', 'use_local_proxy_for_external_images', false); // user $aResult['EditorDefaultType'] = (string) $oConfig->Get('webmail', 'editor_default_type', ''); $aResult['ShowImages'] = (bool) $oConfig->Get('webmail', 'show_images', false); $aResult['ContactsAutosave'] = true; $aResult['MPP'] = (int) $oConfig->Get('webmail', 'messages_per_page', 25); $aResult['DesktopNotifications'] = false; $aResult['UseThreads'] = false; $aResult['ReplySameFolder'] = false; $aResult['Layout'] = \RainLoop\Enumerations\Layout::SIDE_PREVIEW; $aResult['UseCheckboxesInList'] = true; $aResult['DefaultIdentityID'] = ''; $aResult['DisplayName'] = ''; $aResult['ReplyTo'] = ''; $aResult['Signature'] = ''; $aResult['SignatureToAll'] = false; $aResult['EnableTwoFactor'] = false; $aResult['ParentEmail'] = ''; $aResult['InterfaceAnimation'] = \RainLoop\Enumerations\InterfaceAnimation::NORMAL; if (!$bAdmin && $oSettings instanceof \RainLoop\Settings) { if ($oConfig->Get('webmail', 'allow_languages_on_settings', true)) { $sLanguage = $oSettings->GetConf('Language', $sLanguage); } if ($oConfig->Get('webmail', 'allow_themes', true)) { $sTheme = $oSettings->GetConf('Theme', $sTheme); } $aResult['SentFolder'] = $oSettings->GetConf('SentFolder', ''); $aResult['DraftFolder'] = $oSettings->GetConf('DraftFolder', ''); $aResult['SpamFolder'] = $oSettings->GetConf('SpamFolder', ''); $aResult['TrashFolder'] = $oSettings->GetConf('TrashFolder', ''); $aResult['ArchiveFolder'] = $oSettings->GetConf('ArchiveFolder', ''); $aResult['NullFolder'] = $oSettings->GetConf('NullFolder', ''); $aResult['EditorDefaultType'] = $oSettings->GetConf('EditorDefaultType', $aResult['EditorDefaultType']); $aResult['ShowImages'] = (bool) $oSettings->GetConf('ShowImages', $aResult['ShowImages']); $aResult['ContactsAutosave'] = (bool) $oSettings->GetConf('ContactsAutosave', $aResult['ContactsAutosave']); $aResult['MPP'] = (int) $oSettings->GetConf('MPP', $aResult['MPP']); $aResult['DesktopNotifications'] = (bool) $oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']); $aResult['UseThreads'] = (bool) $oSettings->GetConf('UseThreads', $aResult['UseThreads']); $aResult['ReplySameFolder'] = (bool) $oSettings->GetConf('ReplySameFolder', $aResult['ReplySameFolder']); $aResult['Layout'] = (int) $oSettings->GetConf('Layout', $aResult['Layout']); $aResult['UseCheckboxesInList'] = (bool) $oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']); $aResult['InterfaceAnimation'] = (string) $oSettings->GetConf('InterfaceAnimation', $aResult['InterfaceAnimation']); $aResult['DefaultIdentityID'] = $oSettings->GetConf('DefaultIdentityID', $oAccount ? $oAccount->Email() : $aResult['DefaultIdentityID']); $aResult['DisplayName'] = $oSettings->GetConf('DisplayName', $aResult['DisplayName']); $aResult['ReplyTo'] = $oSettings->GetConf('ReplyTo', $aResult['ReplyTo']); $aResult['Signature'] = $oSettings->GetConf('Signature', $aResult['Signature']); $aResult['SignatureToAll'] = !!$oSettings->GetConf('SignatureToAll', $aResult['SignatureToAll']); $aResult['EnableTwoFactor'] = !!$oSettings->GetConf('EnableTwoFactor', $aResult['EnableTwoFactor']); $aResult['ParentEmail'] = $oAccount->ParentEmail(); } $aResult['InterfaceAnimation'] = \RainLoop\Enumerations\InterfaceAnimation::NONE === $aResult['InterfaceAnimation'] ? $aResult['InterfaceAnimation'] : \RainLoop\Enumerations\InterfaceAnimation::NORMAL; if (0 < \strlen($aResult['ParentEmail'])) { $aResult['AllowGoogleSocial'] = false; $aResult['AllowFacebookSocial'] = false; $aResult['AllowTwitterSocial'] = false; } $sStaticCache = \md5(APP_VERSION . $this->Plugins()->Hash()); $sTheme = $this->ValidateTheme($sTheme); $sNewThemeLink = './?/Css/0/' . ($bAdmin ? 'Admin' : 'User') . '/-/' . ($bAdmin ? 'Default' : $sTheme) . '/-/' . $sStaticCache . '/'; $bUserLanguage = false; if (!$bAdmin && !$aResult['Auth'] && !empty($_COOKIE['rllang']) && $oConfig->Get('webmail', 'allow_languages_on_login', true)) { $sLanguage = $_COOKIE['rllang']; } else { if (!$bAdmin && !$aResult['Auth']) { $sUserLanguage = ''; if (!$bAdmin && !$aResult['Auth'] && $oConfig->Get('login', 'determine_user_language', true)) { $sUserLanguage = $this->detectUserLanguage(); } $sLanguage = $this->ValidateLanguage($sLanguage); if (0 < \strlen($sUserLanguage) && $sLanguage !== $sUserLanguage) { $sLanguage = $sUserLanguage; $bUserLanguage = true; } } } $sPluginsLink = ''; if (0 < $this->Plugins()->Count()) { $sPluginsLink = './?/Plugins/0/' . ($bAdmin ? 'Admin' : 'User') . '/' . $sStaticCache . '/'; } $aResult['Theme'] = $sTheme; $aResult['NewThemeLink'] = $sNewThemeLink; $aResult['Language'] = $this->ValidateLanguage($sLanguage); $aResult['UserLanguage'] = $bUserLanguage; $aResult['LangLink'] = './?/Lang/0/' . ($bAdmin ? 'en' : $aResult['Language']) . '/' . $sStaticCache . '/'; $aResult['TemplatesLink'] = './?/Templates/0/' . ($bAdmin ? 'Admin' : 'App') . '/' . $sStaticCache . '/'; $aResult['PluginsLink'] = $sPluginsLink; $aResult['EditorDefaultType'] = 'Html' === $aResult['EditorDefaultType'] ? 'Html' : 'Plain'; // IDN $aResult['Email'] = \MailSo\Base\Utils::IdnToUtf8($aResult['Email']); $aResult['ParentEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['ParentEmail']); $aResult['MailToEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['MailToEmail']); $aResult['DevEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['DevEmail']); $this->Plugins()->InitAppData($bAdmin, $aResult, $oAccount); return $aResult; }