/**
  *
  * @param \RainLoop\Model\Account $oAccount        	
  * @param string $sQuery        	
  * @param int $iLimit
  *        	= 20
  *        	
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $sQuery = \trim($sQuery);
     if ('' === $sQuery || !$oAccount) {
         return array();
     }
     $aResult = $this->ldapSearch($oAccount, $sQuery, $iLimit);
     $aResult = \RainLoop\Utils::RemoveSuggestionDuplicates($aResult);
     if ($iLimit < \count($aResult)) {
         $aResult = \array_slice($aResult, 0, $iLimit);
     }
     return $aResult;
 }
 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param string $sQuery
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $aResult = array();
     try {
         if (!$oAccount || !\RainLoop\Utils::IsOwnCloud() || !\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled() || !\class_exists('\\OCP\\User') || !\OCP\User::isLoggedIn()) {
             return $aResult;
         }
         $aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL'));
         //$this->oLogger->WriteDump($aSearchResult);
         $aPreResult = array();
         if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) {
             foreach ($aSearchResult as $aContact) {
                 if (0 >= $iLimit) {
                     break;
                 }
                 $sUid = empty($aContact['UID']) ? '' : $aContact['UID'];
                 if (!empty($sUid)) {
                     $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : '';
                     $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : '';
                     if (!\is_array($mEmails)) {
                         $mEmails = array($mEmails);
                     }
                     if (!isset($aPreResult[$sUid])) {
                         $aPreResult[$sUid] = array();
                     }
                     foreach ($mEmails as $sEmail) {
                         $sEmail = \trim($sEmail);
                         if (!empty($sEmail)) {
                             $iLimit--;
                             $aPreResult[$sUid][] = array($sEmail, $sFullName);
                         }
                     }
                 }
             }
             $aPreResult = \array_values($aPreResult);
             //				$this->oLogger->WriteDump($aPreResult);
             foreach ($aPreResult as $aData) {
                 foreach ($aData as $aSubData) {
                     $aResult[] = $aSubData;
                 }
             }
         }
         unset($aSearchResult, $aPreResult);
     } catch (\Exception $oException) {
         if ($this->oLogger) {
             $this->oLogger->WriteException($oException);
         }
     }
     return $aResult;
 }
 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param string $sQuery
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $iInputLimit = $iLimit;
     $aResult = array();
     $sQuery = \trim($sQuery);
     try {
         if ('' === $sQuery || !$oAccount || !\RainLoop\Utils::IsOwnCloudLoggedIn() || !\class_exists('OCP\\Contacts') || !\OCP\Contacts::isEnabled()) {
             return $aResult;
         }
         $aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL'));
         //$this->oLogger->WriteDump($aSearchResult);
         $aHashes = array();
         if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) {
             foreach ($aSearchResult as $aContact) {
                 if (0 >= $iLimit) {
                     break;
                 }
                 $sUid = empty($aContact['UID']) ? '' : $aContact['UID'];
                 if (!empty($sUid)) {
                     $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : '';
                     $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : '';
                     if (!\is_array($mEmails)) {
                         $mEmails = array($mEmails);
                     }
                     foreach ($mEmails as $sEmail) {
                         $sHash = '"' . $sFullName . '" <' . $sEmail . '>';
                         if (!isset($aHashes[$sHash])) {
                             $aHashes[$sHash] = true;
                             $aResult[] = array($sEmail, $sFullName);
                             $iLimit--;
                         }
                     }
                 }
             }
             $aResult = \array_slice($aResult, 0, $iInputLimit);
         }
         unset($aSearchResult, $aHashes);
     } catch (\Exception $oException) {
         if ($this->oLogger) {
             $this->oLogger->WriteException($oException);
         }
     }
     return $aResult;
 }
 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param string $sQuery
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $aSuggestions = array();
     if ($oAccount instanceof \RainLoop\Model\Account && $this->IsActive() && \is_array($this->aDrivers) && 0 < \strlen($sQuery)) {
         foreach ($this->aDrivers as $oDriver) {
             $aSubs = null;
             if ($oDriver) {
                 $aSubs = $oDriver->Process($oAccount, $sQuery, $iLimit);
                 if (\is_array($aSubs) && 0 < \count($aSubs)) {
                     $aSuggestions = \array_merge($aSuggestions, $aSubs);
                 }
             }
         }
     }
     $aResult = \RainLoop\Utils::RemoveSuggestionsdDuplicates($aSuggestions);
     if ($iLimit < \count($aResult)) {
         $aResult = \array_slice($aResult, 0, $iLimit);
     }
     return $aResult;
 }
 /**
  * @param string $sLang
  * @param array $sActionName
  *
  * @return \RainLoop\PluginsNext\Manager
  */
 public function ReadLang($sLang, &$aLang)
 {
     if ($this->bIsEnabled) {
         foreach ($this->aPlugins as $oPlugin) {
             if ($oPlugin->UseLangs()) {
                 $sPath = $oPlugin->Path();
                 \RainLoop\Utils::ReadAndAddLang($sPath . '/langs/en.ini', $aLang);
                 if ('en' !== $sLang) {
                     \RainLoop\Utils::ReadAndAddLang($sPath . '/langs/' . $sLang . '.ini', $aLang);
                 }
             }
         }
     }
     return $this;
 }
 /**
  * @param string $sLanguage
  * @param bool $bAdmin = false
  * @param bool $bWrapByScriptTag = true
  *
  * @return string
  */
 private function compileLanguage($sLanguage, $bAdmin = false, $bWrapByScriptTag = true)
 {
     $aResultLang = array();
     $sMoment = 'window.moment && window.moment.lang && window.moment.lang(\'en\');';
     $sMomentFileName = APP_VERSION_ROOT_PATH . 'app/localization/moment/' . $this->convertLanguageNameToMomentLanguageName($sLanguage) . '.js';
     if (\file_exists($sMomentFileName)) {
         $sMoment = \file_get_contents($sMomentFileName);
         $sMoment = \preg_replace('/\\/\\/[^\\n]+\\n/', '', $sMoment);
     }
     \RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH . 'app/localization/langs.yml', $aResultLang);
     \RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH . 'app/localization/' . ($bAdmin ? 'admin' : 'webmail') . '/_source.en.yml', $aResultLang);
     \RainLoop\Utils::ReadAndAddLang(APP_VERSION_ROOT_PATH . 'app/localization/' . ($bAdmin ? 'admin' : 'webmail') . '/' . $sLanguage . '.yml', $aResultLang);
     $this->Plugins()->ReadLang($sLanguage, $aResultLang);
     $sLangJs = '';
     $aLangKeys = \array_keys($aResultLang);
     foreach ($aLangKeys as $sKey) {
         $sString = isset($aResultLang[$sKey]) ? $aResultLang[$sKey] : $sKey;
         $sLangJs .= '"' . \str_replace('"', '\\"', \str_replace('\\', '\\\\', $sKey)) . '":' . '"' . \str_replace(array("\r", "\n", "\t"), array('\\r', '\\n', '\\t'), \str_replace('"', '\\"', \str_replace('\\', '\\\\', $sString))) . '",';
     }
     $sResult = empty($sLangJs) ? 'null' : '{' . \substr($sLangJs, 0, -1) . '}';
     return ($bWrapByScriptTag ? '<script data-cfasync="false">' : '') . 'window.rainloopI18N=' . $sResult . ';' . $sMoment . ($bWrapByScriptTag ? '</script>' : '');
 }
 public static function CustomBaseConvert($sNumberInput, $sFromBaseInput = '0123456789', $sToBaseInput = '0123456789')
 {
     if ($sFromBaseInput === $sToBaseInput) {
         return $sNumberInput;
     }
     $mFromBase = \str_split($sFromBaseInput, 1);
     $mToBase = \str_split($sToBaseInput, 1);
     $aNumber = \str_split($sNumberInput, 1);
     $iFromLen = \strlen($sFromBaseInput);
     $iToLen = \strlen($sToBaseInput);
     $numberLen = \strlen($sNumberInput);
     $mRetVal = '';
     if ($sToBaseInput === '0123456789') {
         $mRetVal = 0;
         for ($iIndex = 1; $iIndex <= $numberLen; $iIndex++) {
             $mRetVal = \bcadd($mRetVal, \bcmul(\array_search($aNumber[$iIndex - 1], $mFromBase), \bcpow($iFromLen, $numberLen - $iIndex)));
         }
         return $mRetVal;
     }
     if ($sFromBaseInput != '0123456789') {
         $sBase10 = \RainLoop\Utils::CustomBaseConvert($sNumberInput, $sFromBaseInput, '0123456789');
     } else {
         $sBase10 = $sNumberInput;
     }
     if ($sBase10 < \strlen($sToBaseInput)) {
         return $mToBase[$sBase10];
     }
     while ($sBase10 !== '0') {
         $mRetVal = $mToBase[\bcmod($sBase10, $iToLen)] . $mRetVal;
         $sBase10 = \bcdiv($sBase10, $iToLen, 0);
     }
     return $mRetVal;
 }
Exemple #8
0
 /**
  * @return string
  */
 public function GetAuthTokenQ()
 {
     return \RainLoop\Utils::EncodeKeyValuesQ(array('token', $this->sEmail, $this->sLogin, $this->sPassword, \RainLoop\Utils::Fingerprint(), $this->sSignMeToken, $this->sParentEmail, \RainLoop\Utils::GetShortToken(), $this->sProxyAuthUser, $this->sProxyAuthPassword, 0));
 }
 /**
  * @return bool
  */
 public function Load()
 {
     if (\file_exists($this->sFile) && \is_readable($this->sFile)) {
         if ($this->loadDataFromCache()) {
             return true;
         }
         $aData = \RainLoop\Utils::CustomParseIniFile($this->sFile, true);
         if (\is_array($aData) && 0 < \count($aData)) {
             foreach ($aData as $sSectionKey => $aSectionValue) {
                 if (\is_array($aSectionValue)) {
                     foreach ($aSectionValue as $sParamKey => $mParamValue) {
                         $this->Set($sSectionKey, $sParamKey, $mParamValue);
                     }
                 }
             }
             unset($aData);
             if (\file_exists($this->sAdditionalFile) && \is_readable($this->sAdditionalFile)) {
                 $aSubData = \RainLoop\Utils::CustomParseIniFile($this->sAdditionalFile, true);
                 if (\is_array($aSubData) && 0 < \count($aSubData)) {
                     foreach ($aSubData as $sSectionKey => $aSectionValue) {
                         if (\is_array($aSectionValue)) {
                             foreach ($aSectionValue as $sParamKey => $mParamValue) {
                                 $this->Set($sSectionKey, $sParamKey, $mParamValue);
                             }
                         }
                     }
                 }
                 unset($aSubData);
             }
             $this->storeDataToCache();
             return true;
         }
     }
     return false;
 }
 /**
  * @param mixed $mResponse
  * @param string $sParent
  * @param array $aParameters = array()
  *
  * @return mixed
  */
 protected function responseObject($mResponse, $sParent = '', $aParameters = array())
 {
     $mResult = $mResponse;
     if (\is_object($mResponse)) {
         $bHook = true;
         $self = $this;
         $sClassName = \get_class($mResponse);
         $bHasSimpleJsonFunc = \method_exists($mResponse, 'ToSimpleJSON');
         $bThumb = $this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENT_THUMBNAILS);
         $oAccountCache = null;
         $fGetAccount = function () use($self, &$oAccountCache) {
             if (null === $oAccountCache) {
                 $oAccount = $self->getAccountFromToken(false);
                 $oAccountCache = $oAccount;
             }
             return $oAccountCache;
         };
         $aCheckableFoldersCache = null;
         $fGetCheckableFolder = function () use($self, &$aCheckableFoldersCache) {
             if (null === $aCheckableFoldersCache) {
                 $oAccount = $self->getAccountFromToken(false);
                 $oSettingsLocal = $self->SettingsProvider(true)->Load($oAccount);
                 $sCheckable = $oSettingsLocal->GetConf('CheckableFolder', '[]');
                 $aCheckable = @\json_decode($sCheckable);
                 if (!\is_array($aCheckable)) {
                     $aCheckable = array();
                 }
                 $aCheckableFoldersCache = $aCheckable;
             }
             return $aCheckableFoldersCache;
         };
         if ($bHasSimpleJsonFunc) {
             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON(true));
         } else {
             if ('MailSo\\Mail\\Message' === $sClassName) {
                 $oAccount = \call_user_func($fGetAccount);
                 $iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
                 if (0 === $iDateTimeStampInUTC || !!$this->Config()->Get('labs', 'date_from_headers', false)) {
                     $iDateTimeStampInUTC = $mResponse->HeaderTimeStampInUTC();
                     if (0 === $iDateTimeStampInUTC) {
                         $iDateTimeStampInUTC = $mResponse->InternalTimeStampInUTC();
                     }
                 }
                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($mResponse->Subject())), 'MessageId' => $mResponse->MessageId(), 'Size' => $mResponse->Size(), 'DateTimeStampInUTC' => $iDateTimeStampInUTC, 'ReplyTo' => $this->responseObject($mResponse->ReplyTo(), $sParent, $aParameters), 'From' => $this->responseObject($mResponse->From(), $sParent, $aParameters), 'To' => $this->responseObject($mResponse->To(), $sParent, $aParameters), 'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters), 'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters), 'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters), 'DeliveredTo' => $this->responseObject($mResponse->DeliveredTo(), $sParent, $aParameters), 'Priority' => $mResponse->Priority(), 'Threads' => $mResponse->Threads(), 'Sensitivity' => $mResponse->Sensitivity(), 'ExternalProxy' => false, 'ReadReceipt' => ''));
                 $mResult['SubjectParts'] = $this->explodeSubject($mResult['Subject']);
                 $oAttachments = $mResponse->Attachments();
                 $iAttachmentsCount = $oAttachments ? $oAttachments->Count() : 0;
                 $mResult['HasAttachments'] = 0 < $iAttachmentsCount;
                 $mResult['AttachmentsSpecData'] = $mResult['HasAttachments'] ? $oAttachments->SpecData() : array();
                 $sSubject = $mResult['Subject'];
                 $mResult['Hash'] = \md5($mResult['Folder'] . $mResult['Uid']);
                 $mResult['RequestHash'] = \RainLoop\Utils::EncodeKeyValuesQ(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeType' => 'message/rfc822', 'FileName' => (0 === \strlen($sSubject) ? 'message-' . $mResult['Uid'] : \MailSo\Base\Utils::ClearXss($sSubject)) . '.eml'));
                 // Flags
                 $aFlags = $mResponse->FlagsLowerCase();
                 $mResult['IsSeen'] = \in_array('\\seen', $aFlags);
                 $mResult['IsFlagged'] = \in_array('\\flagged', $aFlags);
                 $mResult['IsAnswered'] = \in_array('\\answered', $aFlags);
                 $mResult['IsDeleted'] = \in_array('\\deleted', $aFlags);
                 $sForwardedFlag = $this->Config()->Get('labs', 'imap_forwarded_flag', '');
                 $sReadReceiptFlag = $this->Config()->Get('labs', 'imap_read_receipt_flag', '');
                 $mResult['IsForwarded'] = 0 < \strlen($sForwardedFlag) && \in_array(\strtolower($sForwardedFlag), $aFlags);
                 $mResult['IsReadReceipt'] = 0 < \strlen($sReadReceiptFlag) && \in_array(\strtolower($sReadReceiptFlag), $aFlags);
                 if (!$this->GetCapa(false, \RainLoop\Enumerations\Capa::COMPOSER, $oAccount)) {
                     $mResult['IsReadReceipt'] = true;
                 }
                 $mResult['TextPartIsTrimmed'] = false;
                 if ('Message' === $sParent) {
                     $oAttachments = $mResponse->Attachments();
                     $bHasExternals = false;
                     $mFoundedCIDs = array();
                     $aContentLocationUrls = array();
                     $mFoundedContentLocationUrls = array();
                     if ($oAttachments && 0 < $oAttachments->Count()) {
                         $aList =& $oAttachments->GetAsArray();
                         foreach ($aList as $oAttachment) {
                             if ($oAttachment) {
                                 $sContentLocation = $oAttachment->ContentLocation();
                                 if ($sContentLocation && 0 < \strlen($sContentLocation)) {
                                     $aContentLocationUrls[] = $oAttachment->ContentLocation();
                                 }
                             }
                         }
                     }
                     $sPlain = '';
                     $sHtml = \trim($mResponse->Html());
                     if (0 === \strlen($sHtml)) {
                         $sPlain = \trim($mResponse->Plain());
                     }
                     $mResult['DraftInfo'] = $mResponse->DraftInfo();
                     $mResult['InReplyTo'] = $mResponse->InReplyTo();
                     $mResult['References'] = $mResponse->References();
                     $fAdditionalDomReader = null;
                     if (0 < \strlen($sHtml) && $this->Config()->Get('labs', 'emogrifier', false)) {
                         if (!\class_exists('Pelago\\Emogrifier', false)) {
                             include_once APP_VERSION_ROOT_PATH . 'app/libraries/emogrifier/Emogrifier.php';
                         }
                         if (\class_exists('Pelago\\Emogrifier', false)) {
                             $fAdditionalDomReader = function ($oDom) {
                                 $oEmogrifier = new \Pelago\Emogrifier();
                                 $oEmogrifier->preserveEncoding = false;
                                 return $oEmogrifier->emogrify($oDom);
                             };
                         }
                     }
                     $fAdditionalExternalFilter = null;
                     if (!!$this->Config()->Get('labs', 'use_local_proxy_for_external_images', false)) {
                         $fAdditionalExternalFilter = function ($sUrl) {
                             return './?/ProxyExternal/' . \RainLoop\Utils::EncodeKeyValuesQ(array('Rnd' => \md5(\microtime(true)), 'Token' => \RainLoop\Utils::GetConnectionToken(), 'Url' => $sUrl)) . '/';
                         };
                     }
                     $sHtml = \preg_replace_callback('/(<pre[^>]*>)([\\s\\S\\r\\n\\t]*?)(<\\/pre>)/mi', function ($aMatches) {
                         return \preg_replace('/[\\r\\n]+/', '<br />', $aMatches[1] . \trim($aMatches[2]) . $aMatches[3]);
                     }, $sHtml);
                     $mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml($sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls, false, false, $fAdditionalExternalFilter, $fAdditionalDomReader, !!$this->Config()->Get('labs', 'try_to_detect_hidden_images', false));
                     $mResult['ExternalProxy'] = null !== $fAdditionalExternalFilter;
                     $mResult['Plain'] = $sPlain;
                     //					$mResult['Plain'] = 0 === \strlen($sPlain) ? '' : \MailSo\Base\HtmlUtils::ConvertPlainToHtml($sPlain);
                     $mResult['TextHash'] = \md5($mResult['Html'] . $mResult['Plain']);
                     $mResult['TextPartIsTrimmed'] = $mResponse->TextPartIsTrimmed();
                     $mResult['PgpSigned'] = $mResponse->PgpSigned();
                     $mResult['PgpEncrypted'] = $mResponse->PgpEncrypted();
                     $mResult['PgpSignature'] = $mResponse->PgpSignature();
                     unset($sHtml, $sPlain);
                     $mResult['HasExternals'] = $bHasExternals;
                     $mResult['HasInternals'] = \is_array($mFoundedCIDs) && 0 < \count($mFoundedCIDs) || \is_array($mFoundedContentLocationUrls) && 0 < \count($mFoundedContentLocationUrls);
                     $mResult['FoundedCIDs'] = $mFoundedCIDs;
                     $mResult['Attachments'] = $this->responseObject($oAttachments, $sParent, \array_merge($aParameters, array('FoundedCIDs' => $mFoundedCIDs, 'FoundedContentLocationUrls' => $mFoundedContentLocationUrls)));
                     $mResult['ReadReceipt'] = $mResponse->ReadReceipt();
                     if (0 < \strlen($mResult['ReadReceipt']) && !$mResult['IsReadReceipt']) {
                         if (0 < \strlen($mResult['ReadReceipt'])) {
                             try {
                                 $oReadReceipt = \MailSo\Mime\Email::Parse($mResult['ReadReceipt']);
                                 if (!$oReadReceipt) {
                                     $mResult['ReadReceipt'] = '';
                                 }
                             } catch (\Exception $oException) {
                                 unset($oException);
                             }
                         }
                         if (0 < \strlen($mResult['ReadReceipt']) && '1' === $this->Cacher($oAccount)->Get(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['Folder'], $mResult['Uid']), '0')) {
                             $mResult['ReadReceipt'] = '';
                         }
                     }
                 }
             } else {
                 if ('MailSo\\Mime\\Email' === $sClassName) {
                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Name' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetDisplayName()), 'Email' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetEmail(true)), 'DkimStatus' => $mResponse->GetDkimStatus(), 'DkimValue' => $mResponse->GetDkimValue()));
                 } else {
                     if ('RainLoop\\Providers\\AddressBook\\Classes\\Contact' === $sClassName) {
                         $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdContact' => $mResponse->IdContact, 'Display' => \MailSo\Base\Utils::Utf8Clear($mResponse->Display), 'ReadOnly' => $mResponse->ReadOnly, 'IdPropertyFromSearch' => $mResponse->IdPropertyFromSearch, 'Properties' => $this->responseObject($mResponse->Properties, $sParent, $aParameters)));
                     } else {
                         if ('RainLoop\\Providers\\AddressBook\\Classes\\Tag' === $sClassName) {
                             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdContactTag' => $mResponse->IdContactTag, 'Name' => \MailSo\Base\Utils::Utf8Clear($mResponse->Name), 'ReadOnly' => $mResponse->ReadOnly));
                         } else {
                             if ('RainLoop\\Providers\\AddressBook\\Classes\\Property' === $sClassName) {
                                 // Simple hack
                                 if ($mResponse && $mResponse->IsWeb()) {
                                     $mResponse->Value = \preg_replace('/(skype|ftp|http[s]?)\\\\:\\/\\//i', '$1://', $mResponse->Value);
                                 }
                                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdProperty' => $mResponse->IdProperty, 'Type' => $mResponse->Type, 'TypeStr' => $mResponse->TypeStr, 'Value' => \MailSo\Base\Utils::Utf8Clear($mResponse->Value)));
                             } else {
                                 if ('MailSo\\Mail\\Attachment' === $sClassName) {
                                     $oAccount = $this->getAccountFromToken(false);
                                     $mFoundedCIDs = isset($aParameters['FoundedCIDs']) && \is_array($aParameters['FoundedCIDs']) && 0 < \count($aParameters['FoundedCIDs']) ? $aParameters['FoundedCIDs'] : null;
                                     $mFoundedContentLocationUrls = isset($aParameters['FoundedContentLocationUrls']) && \is_array($aParameters['FoundedContentLocationUrls']) && 0 < \count($aParameters['FoundedContentLocationUrls']) ? $aParameters['FoundedContentLocationUrls'] : null;
                                     if ($mFoundedCIDs || $mFoundedContentLocationUrls) {
                                         $mFoundedCIDs = \array_merge($mFoundedCIDs ? $mFoundedCIDs : array(), $mFoundedContentLocationUrls ? $mFoundedContentLocationUrls : array());
                                         $mFoundedCIDs = 0 < \count($mFoundedCIDs) ? $mFoundedCIDs : null;
                                     }
                                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Framed' => false, 'MimeIndex' => (string) $mResponse->MimeIndex(), 'MimeType' => $mResponse->MimeType(), 'FileName' => \MailSo\Base\Utils::ClearFileName(\MailSo\Base\Utils::ClearXss($mResponse->FileName(true))), 'EstimatedSize' => $mResponse->EstimatedSize(), 'CID' => $mResponse->Cid(), 'ContentLocation' => $mResponse->ContentLocation(), 'IsInline' => $mResponse->IsInline(), 'IsThumbnail' => $bThumb, 'IsLinked' => $mFoundedCIDs && \in_array(\trim(\trim($mResponse->Cid()), '<>'), $mFoundedCIDs) || $mFoundedContentLocationUrls && \in_array(\trim($mResponse->ContentLocation()), $mFoundedContentLocationUrls)));
                                     $mResult['Framed'] = $this->isFileHasFramedPreview($mResult['FileName']);
                                     if ($mResult['IsThumbnail']) {
                                         $mResult['IsThumbnail'] = $this->isFileHasThumbnail($mResult['FileName']);
                                     }
                                     $mResult['Download'] = \RainLoop\Utils::EncodeKeyValuesQ(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeIndex' => $mResult['MimeIndex'], 'MimeType' => $mResult['MimeType'], 'FileName' => $mResult['FileName'], 'Framed' => $mResult['Framed']));
                                 } else {
                                     if ('MailSo\\Mail\\Folder' === $sClassName) {
                                         $aExtended = null;
                                         //				$mStatus = $mResponse->Status();
                                         //				if (\is_array($mStatus) && isset($mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT']))
                                         //				{
                                         //					$aExtended = array(
                                         //						'MessageCount' => (int) $mStatus['MESSAGES'],
                                         //						'MessageUnseenCount' => (int) $mStatus['UNSEEN'],
                                         //						'UidNext' => (string) $mStatus['UIDNEXT'],
                                         //						'Hash' => $this->MailClient()->GenerateFolderHash(
                                         //							$mResponse->FullNameRaw(), $mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT'],
                                         //								empty($mStatus['HIGHESTMODSEQ']) ? '' : $mStatus['HIGHESTMODSEQ'])
                                         //					);
                                         //				}
                                         $aCheckableFolder = \call_user_func($fGetCheckableFolder);
                                         if (!\is_array($aCheckableFolder)) {
                                             $aCheckableFolder = array();
                                         }
                                         $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Name' => $mResponse->Name(), 'FullName' => $mResponse->FullName(), 'FullNameRaw' => $mResponse->FullNameRaw(), 'FullNameHash' => $this->hashFolderFullName($mResponse->FullNameRaw(), $mResponse->FullName()), 'Delimiter' => (string) $mResponse->Delimiter(), 'HasVisibleSubFolders' => $mResponse->HasVisibleSubFolders(), 'IsSubscribed' => $mResponse->IsSubscribed(), 'IsExists' => $mResponse->IsExists(), 'IsSelectable' => $mResponse->IsSelectable(), 'Flags' => $mResponse->FlagsLowerCase(), 'Checkable' => \in_array($mResponse->FullNameRaw(), $aCheckableFolder), 'Extended' => $aExtended, 'SubFolders' => $this->responseObject($mResponse->SubFolders(), $sParent, $aParameters)));
                                     } else {
                                         if ('MailSo\\Mail\\MessageCollection' === $sClassName) {
                                             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('MessageCount' => $mResponse->MessageCount, 'MessageUnseenCount' => $mResponse->MessageUnseenCount, 'MessageResultCount' => $mResponse->MessageResultCount, 'Folder' => $mResponse->FolderName, 'FolderHash' => $mResponse->FolderHash, 'UidNext' => $mResponse->UidNext, 'ThreadUid' => $mResponse->ThreadUid, 'NewMessages' => $this->responseObject($mResponse->NewMessages), 'Filtered' => $mResponse->Filtered, 'Offset' => $mResponse->Offset, 'Limit' => $mResponse->Limit, 'Search' => $mResponse->Search));
                                         } else {
                                             if ('MailSo\\Mail\\AttachmentCollection' === $sClassName) {
                                                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('InlineCount' => $mResponse->InlineCount()));
                                             } else {
                                                 if ('MailSo\\Mail\\FolderCollection' === $sClassName) {
                                                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Namespace' => $mResponse->GetNamespace(), 'FoldersHash' => isset($mResponse->FoldersHash) ? $mResponse->FoldersHash : '', 'IsThreadsSupported' => $mResponse->IsThreadsSupported, 'Optimized' => $mResponse->Optimized, 'CountRec' => $mResponse->CountRec(), 'SystemFolders' => isset($mResponse->SystemFolders) && \is_array($mResponse->SystemFolders) ? $mResponse->SystemFolders : array()));
                                                 } else {
                                                     if ($mResponse instanceof \MailSo\Base\Collection) {
                                                         $aList =& $mResponse->GetAsArray();
                                                         if (100 < \count($aList) && $mResponse instanceof \MailSo\Mime\EmailCollection) {
                                                             $aList = \array_slice($aList, 0, 100);
                                                         }
                                                         $mResult = $this->responseObject($aList, $sParent, $aParameters);
                                                         $bHook = false;
                                                     } else {
                                                         $mResult = '["' . \get_class($mResponse) . '"]';
                                                         $bHook = false;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($bHook) {
             $this->Plugins()->RunHook('filter.response-object', array($sClassName, $mResult), false);
         }
     } else {
         if (\is_array($mResponse)) {
             foreach ($mResponse as $iKey => $oItem) {
                 $mResponse[$iKey] = $this->responseObject($oItem, $sParent, $aParameters);
             }
             $mResult = $mResponse;
         }
     }
     unset($mResponse);
     return $mResult;
 }
Exemple #11
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);
     $sFaviconUrl = (string) $this->oActions->Config()->Get('webmail', 'favicon_url', '');
     $sStaticPrefix = \RainLoop\Utils::WebStaticPath();
     $aData = array('Language' => $sLanguage, 'Theme' => $sTheme, 'FaviconPngLink' => $sFaviconUrl ? $sFaviconUrl : $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sFaviconUrl ? '' : $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/', '{{BaseAppFaviconPngLinkTag}}' => $aData['FaviconPngLink'] ? '<link rel="shortcut icon" href="' . $aData['FaviconPngLink'] . '" type="image/png" />' : '', '{{BaseAppFaviconTouchLinkTag}}' => $aData['AppleTouchLink'] ? '<link rel="apple-touch-icon" href="' . $aData['AppleTouchLink'] . '" type="image/png" />' : '', '{{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'], '{{BaseVersion}}' => APP_VERSION, '{{BaseDir}}' => '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;
 }
Exemple #12
0
 /**
  * @param mixed $mResponse
  * @param string $sParent
  * @param array $aParameters = array()
  *
  * @return mixed
  */
 protected function responseObject($mResponse, $sParent = '', $aParameters = array())
 {
     $mResult = $mResponse;
     if (\is_object($mResponse)) {
         $bHook = true;
         $sClassName = \get_class($mResponse);
         $bHasSimpleJsonFunc = \method_exists($mResponse, 'ToSimpleJSON');
         $bThumb = $this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENT_THUMBNAILS);
         if ($bHasSimpleJsonFunc) {
             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON(true));
         } else {
             if ('MailSo\\Mail\\Message' === $sClassName) {
                 $oAccount = $this->getAccountFromToken(false);
                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($mResponse->Subject())), 'MessageId' => $mResponse->MessageId(), 'Size' => $mResponse->Size(), 'DateTimeStampInUTC' => !!$this->Config()->Get('labs', 'date_from_headers', false) ? $mResponse->HeaderTimeStampInUTC() : $mResponse->InternalTimeStampInUTC(), 'ReplyTo' => $this->responseObject($mResponse->ReplyTo(), $sParent, $aParameters), 'From' => $this->responseObject($mResponse->From(), $sParent, $aParameters), 'To' => $this->responseObject($mResponse->To(), $sParent, $aParameters), 'Cc' => $this->responseObject($mResponse->Cc(), $sParent, $aParameters), 'Bcc' => $this->responseObject($mResponse->Bcc(), $sParent, $aParameters), 'Sender' => $this->responseObject($mResponse->Sender(), $sParent, $aParameters), 'DeliveredTo' => $this->responseObject($mResponse->DeliveredTo(), $sParent, $aParameters), 'Priority' => $mResponse->Priority(), 'Threads' => $mResponse->Threads(), 'ThreadsLen' => $mResponse->ThreadsLen(), 'ParentThread' => $mResponse->ParentThread(), 'Sensitivity' => $mResponse->Sensitivity(), 'ExternalProxy' => false, 'ReadReceipt' => ''));
                 $mResult['SubjectParts'] = $this->explodeSubject($mResult['Subject']);
                 $oAttachments = $mResponse->Attachments();
                 $iAttachmentsCount = $oAttachments ? $oAttachments->Count() : 0;
                 $mResult['HasAttachments'] = 0 < $iAttachmentsCount;
                 $mResult['AttachmentsMainType'] = '';
                 if (0 < $iAttachmentsCount) {
                     switch (true) {
                         case $iAttachmentsCount === $oAttachments->ImageCount():
                             $mResult['AttachmentsMainType'] = 'image';
                             break;
                         case $iAttachmentsCount === $oAttachments->ArchiveCount():
                             $mResult['AttachmentsMainType'] = 'archive';
                             break;
                         case $iAttachmentsCount === $oAttachments->PdfCount():
                             $mResult['AttachmentsMainType'] = 'pdf';
                             break;
                         case $iAttachmentsCount === $oAttachments->DocCount():
                             $mResult['AttachmentsMainType'] = 'doc';
                             break;
                         case $iAttachmentsCount === $oAttachments->CertificateCount():
                             $mResult['AttachmentsMainType'] = 'certificate';
                             break;
                     }
                 }
                 $sSubject = $mResult['Subject'];
                 $mResult['Hash'] = \md5($mResult['Folder'] . $mResult['Uid']);
                 $mResult['RequestHash'] = \RainLoop\Utils::EncodeKeyValues(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeType' => 'message/rfc822', 'FileName' => (0 === \strlen($sSubject) ? 'message-' . $mResult['Uid'] : \MailSo\Base\Utils::ClearXss($sSubject)) . '.eml'));
                 // Flags
                 $aFlags = $mResponse->FlagsLowerCase();
                 $mResult['IsSeen'] = \in_array('\\seen', $aFlags);
                 $mResult['IsFlagged'] = \in_array('\\flagged', $aFlags);
                 $mResult['IsAnswered'] = \in_array('\\answered', $aFlags);
                 $mResult['IsDeleted'] = \in_array('\\deleted', $aFlags);
                 $sForwardedFlag = $this->Config()->Get('labs', 'imap_forwarded_flag', '');
                 $sReadReceiptFlag = $this->Config()->Get('labs', 'imap_read_receipt_flag', '');
                 $mResult['IsForwarded'] = 0 < \strlen($sForwardedFlag) && \in_array(\strtolower($sForwardedFlag), $aFlags);
                 $mResult['IsReadReceipt'] = 0 < \strlen($sReadReceiptFlag) && \in_array(\strtolower($sReadReceiptFlag), $aFlags);
                 $mResult['TextPartIsTrimmed'] = false;
                 if ('Message' === $sParent) {
                     $oAttachments = $mResponse->Attachments();
                     $bHasExternals = false;
                     $mFoundedCIDs = array();
                     $aContentLocationUrls = array();
                     $mFoundedContentLocationUrls = array();
                     if ($oAttachments && 0 < $oAttachments->Count()) {
                         $aList =& $oAttachments->GetAsArray();
                         foreach ($aList as $oAttachment) {
                             if ($oAttachment) {
                                 $sContentLocation = $oAttachment->ContentLocation();
                                 if ($sContentLocation && 0 < \strlen($sContentLocation)) {
                                     $aContentLocationUrls[] = $oAttachment->ContentLocation();
                                 }
                             }
                         }
                     }
                     $sPlain = '';
                     $sHtml = \trim($mResponse->Html());
                     if (0 === \strlen($sHtml)) {
                         $sPlain = \trim($mResponse->Plain());
                     }
                     $mResult['DraftInfo'] = $mResponse->DraftInfo();
                     $mResult['InReplyTo'] = $mResponse->InReplyTo();
                     $mResult['References'] = $mResponse->References();
                     $fAdditionalExternalFilter = null;
                     if (!!$this->Config()->Get('labs', 'use_local_proxy_for_external_images', false)) {
                         $fAdditionalExternalFilter = function ($sUrl) {
                             return './?/ProxyExternal/' . \RainLoop\Utils::EncodeKeyValues(array('Rnd' => \md5(\microtime(true)), 'Token' => \RainLoop\Utils::GetConnectionToken(), 'Url' => $sUrl)) . '/';
                         };
                     }
                     $mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml($sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls, false, false, $fAdditionalExternalFilter);
                     $mResult['ExternalProxy'] = null !== $fAdditionalExternalFilter;
                     $mResult['Plain'] = $sPlain;
                     //					$mResult['Plain'] = 0 === \strlen($sPlain) ? '' : \MailSo\Base\HtmlUtils::ConvertPlainToHtml($sPlain);
                     $mResult['TextHash'] = \md5($mResult['Html'] . $mResult['Plain']);
                     $mResult['TextPartIsTrimmed'] = $mResponse->TextPartIsTrimmed();
                     $mResult['PgpSigned'] = $mResponse->PgpSigned();
                     $mResult['PgpEncrypted'] = $mResponse->PgpEncrypted();
                     $mResult['PgpSignature'] = $mResponse->PgpSignature();
                     unset($sHtml, $sPlain);
                     $mResult['HasExternals'] = $bHasExternals;
                     $mResult['HasInternals'] = \is_array($mFoundedCIDs) && 0 < \count($mFoundedCIDs) || \is_array($mFoundedContentLocationUrls) && 0 < \count($mFoundedContentLocationUrls);
                     $mResult['FoundedCIDs'] = $mFoundedCIDs;
                     $mResult['Attachments'] = $this->responseObject($oAttachments, $sParent, \array_merge($aParameters, array('FoundedCIDs' => $mFoundedCIDs, 'FoundedContentLocationUrls' => $mFoundedContentLocationUrls)));
                     $mResult['ReadReceipt'] = $mResponse->ReadReceipt();
                     if (0 < \strlen($mResult['ReadReceipt']) && !$mResult['IsReadReceipt']) {
                         if (0 < \strlen($mResult['ReadReceipt'])) {
                             try {
                                 $oReadReceipt = \MailSo\Mime\Email::Parse($mResult['ReadReceipt']);
                                 if (!$oReadReceipt) {
                                     $mResult['ReadReceipt'] = '';
                                 }
                             } catch (\Exception $oException) {
                                 unset($oException);
                             }
                         }
                         if (0 < \strlen($mResult['ReadReceipt']) && '1' === $this->Cacher($oAccount)->Get(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $mResult['Folder'], $mResult['Uid']), '0')) {
                             $mResult['ReadReceipt'] = '';
                         }
                     }
                 }
             } else {
                 if ('MailSo\\Mime\\Email' === $sClassName) {
                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Name' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetDisplayName()), 'Email' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetEmail(true)), 'DkimStatus' => $mResponse->GetDkimStatus(), 'DkimValue' => $mResponse->GetDkimValue()));
                 } else {
                     if ('RainLoop\\Providers\\AddressBook\\Classes\\Contact' === $sClassName) {
                         $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdContact' => $mResponse->IdContact, 'Display' => \MailSo\Base\Utils::Utf8Clear($mResponse->Display), 'ReadOnly' => $mResponse->ReadOnly, 'IdPropertyFromSearch' => $mResponse->IdPropertyFromSearch, 'Properties' => $this->responseObject($mResponse->Properties, $sParent, $aParameters)));
                     } else {
                         if ('RainLoop\\Providers\\AddressBook\\Classes\\Tag' === $sClassName) {
                             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdContactTag' => $mResponse->IdContactTag, 'Name' => \MailSo\Base\Utils::Utf8Clear($mResponse->Name), 'ReadOnly' => $mResponse->ReadOnly));
                         } else {
                             if ('RainLoop\\Providers\\AddressBook\\Classes\\Property' === $sClassName) {
                                 // Simple hack
                                 if ($mResponse && $mResponse->IsWeb()) {
                                     $mResponse->Value = \preg_replace('/(skype|ftp|http[s]?)\\\\:\\/\\//i', '$1://', $mResponse->Value);
                                 }
                                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdProperty' => $mResponse->IdProperty, 'Type' => $mResponse->Type, 'TypeStr' => $mResponse->TypeStr, 'Value' => \MailSo\Base\Utils::Utf8Clear($mResponse->Value)));
                             } else {
                                 if ('MailSo\\Mail\\Attachment' === $sClassName) {
                                     $oAccount = $this->getAccountFromToken(false);
                                     $mFoundedCIDs = isset($aParameters['FoundedCIDs']) && \is_array($aParameters['FoundedCIDs']) && 0 < \count($aParameters['FoundedCIDs']) ? $aParameters['FoundedCIDs'] : null;
                                     $mFoundedContentLocationUrls = isset($aParameters['FoundedContentLocationUrls']) && \is_array($aParameters['FoundedContentLocationUrls']) && 0 < \count($aParameters['FoundedContentLocationUrls']) ? $aParameters['FoundedContentLocationUrls'] : null;
                                     if ($mFoundedCIDs || $mFoundedContentLocationUrls) {
                                         $mFoundedCIDs = \array_merge($mFoundedCIDs ? $mFoundedCIDs : array(), $mFoundedContentLocationUrls ? $mFoundedContentLocationUrls : array());
                                         $mFoundedCIDs = 0 < \count($mFoundedCIDs) ? $mFoundedCIDs : null;
                                     }
                                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Folder' => $mResponse->Folder(), 'Uid' => (string) $mResponse->Uid(), 'Framed' => false, 'MimeIndex' => (string) $mResponse->MimeIndex(), 'MimeType' => $mResponse->MimeType(), 'FileName' => \MailSo\Base\Utils::ClearFileName(\MailSo\Base\Utils::ClearXss($mResponse->FileName(true))), 'EstimatedSize' => $mResponse->EstimatedSize(), 'CID' => $mResponse->Cid(), 'ContentLocation' => $mResponse->ContentLocation(), 'IsInline' => $mResponse->IsInline(), 'IsThumbnail' => $bThumb, 'IsLinked' => $mFoundedCIDs && \in_array(\trim(\trim($mResponse->Cid()), '<>'), $mFoundedCIDs) || $mFoundedContentLocationUrls && \in_array(\trim($mResponse->ContentLocation()), $mFoundedContentLocationUrls)));
                                     $mResult['Framed'] = $this->isFileHasFramedPreview($mResult['FileName']);
                                     if ($mResult['IsThumbnail']) {
                                         $mResult['IsThumbnail'] = $this->isFileHasThumbnail($mResult['FileName']);
                                     }
                                     $mResult['Download'] = \RainLoop\Utils::EncodeKeyValues(array('V' => APP_VERSION, 'Account' => $oAccount ? \md5($oAccount->Hash()) : '', 'Folder' => $mResult['Folder'], 'Uid' => $mResult['Uid'], 'MimeIndex' => $mResult['MimeIndex'], 'MimeType' => $mResult['MimeType'], 'FileName' => $mResult['FileName'], 'Framed' => $mResult['Framed']));
                                 } else {
                                     if ('MailSo\\Mail\\Folder' === $sClassName) {
                                         $aExtended = null;
                                         $mStatus = $mResponse->Status();
                                         if (\is_array($mStatus) && isset($mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT'])) {
                                             $aExtended = array('MessageCount' => (int) $mStatus['MESSAGES'], 'MessageUnseenCount' => (int) $mStatus['UNSEEN'], 'UidNext' => (string) $mStatus['UIDNEXT'], 'Hash' => \MailSo\Mail\MailClient::GenerateHash($mResponse->FullNameRaw(), $mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT']));
                                         }
                                         $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Name' => $mResponse->Name(), 'FullName' => $mResponse->FullName(), 'FullNameRaw' => $mResponse->FullNameRaw(), 'FullNameHash' => $this->hashFolderFullName($mResponse->FullNameRaw(), $mResponse->FullName()), 'Delimiter' => (string) $mResponse->Delimiter(), 'HasVisibleSubFolders' => $mResponse->HasVisibleSubFolders(), 'IsSubscribed' => $mResponse->IsSubscribed(), 'IsExists' => $mResponse->IsExists(), 'IsSelectable' => $mResponse->IsSelectable(), 'Flags' => $mResponse->FlagsLowerCase(), 'Extended' => $aExtended, 'SubFolders' => $this->responseObject($mResponse->SubFolders(), $sParent, $aParameters)));
                                     } else {
                                         if ('MailSo\\Mail\\MessageCollection' === $sClassName) {
                                             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('MessageCount' => $mResponse->MessageCount, 'MessageUnseenCount' => $mResponse->MessageUnseenCount, 'MessageResultCount' => $mResponse->MessageResultCount, 'Folder' => $mResponse->FolderName, 'FolderHash' => $mResponse->FolderHash, 'UidNext' => $mResponse->UidNext, 'NewMessages' => $this->responseObject($mResponse->NewMessages), 'LastCollapsedThreadUids' => $mResponse->LastCollapsedThreadUids, 'Offset' => $mResponse->Offset, 'Limit' => $mResponse->Limit, 'Search' => $mResponse->Search));
                                         } else {
                                             if ('MailSo\\Mail\\AttachmentCollection' === $sClassName) {
                                                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('InlineCount' => $mResponse->InlineCount()));
                                             } else {
                                                 if ('MailSo\\Mail\\FolderCollection' === $sClassName) {
                                                     $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('Namespace' => $mResponse->GetNamespace(), 'FoldersHash' => isset($mResponse->FoldersHash) ? $mResponse->FoldersHash : '', 'IsThreadsSupported' => $mResponse->IsThreadsSupported, 'Optimized' => $mResponse->Optimized, 'SystemFolders' => isset($mResponse->SystemFolders) && \is_array($mResponse->SystemFolders) ? $mResponse->SystemFolders : array()));
                                                 } else {
                                                     if ($mResponse instanceof \MailSo\Base\Collection) {
                                                         $aList =& $mResponse->GetAsArray();
                                                         if (100 < \count($aList) && $mResponse instanceof \MailSo\Mime\EmailCollection) {
                                                             $aList = \array_slice($aList, 0, 100);
                                                         }
                                                         $mResult = $this->responseObject($aList, $sParent, $aParameters);
                                                         $bHook = false;
                                                     } else {
                                                         if ('RainLoop\\Providers\\AddressBook\\Classes\\Group' === $sClassName) {
                                                             $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdGroup' => $mResponse->IdGroup, 'Name' => $mResponse->Name, 'Contacts' => $this->responseObject($mResponse->Contacts, $sParent, $aParameters)));
                                                         } else {
                                                             if ('RainLoop\\Providers\\AddressBook\\Classes\\GroupContact' === $sClassName) {
                                                                 $mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array('IdContact' => $mResponse->IdContact, 'IdGroup' => $mResponse->IdGroup, 'Name' => $mResponse->Name, 'Email' => $mResponse->Email, 'Phone' => $mResponse->Phone));
                                                             } else {
                                                                 $mResult = '["' . \get_class($mResponse) . '"]';
                                                                 $bHook = false;
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($bHook) {
             $this->Plugins()->RunHook('filter.response-object', array($sClassName, $mResult), false);
         }
     } else {
         if (\is_array($mResponse)) {
             foreach ($mResponse as $iKey => $oItem) {
                 $mResponse[$iKey] = $this->responseObject($oItem, $sParent, $aParameters);
             }
             $mResult = $mResponse;
         }
     }
     unset($mResponse);
     return $mResult;
 }
Exemple #13
0
 /**
  * @return bool
  */
 public static function LogoutCurrentLogginedUser()
 {
     \RainLoop\Utils::ClearCookie('rlsession');
     return true;
 }
Exemple #14
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;
 }
Exemple #15
0
 /**
  * @param string $sEmail
  * @param string $sPassword
  * @param bool $bUseTimeout = true
  *
  * @return string
  */
 public static function GetUserSsoHash($sEmail, $sPassword, $bUseTimeout = true)
 {
     $sSsoHash = \sha1(\rand(10000, 99999) . $sEmail . $sPassword . \microtime(true));
     return self::Actions()->Cacher()->Set(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array('Email' => $sEmail, 'Password' => $sPassword, 'Time' => $bUseTimeout ? \time() : 0))) ? $sSsoHash : '';
 }
 /**
  * @return \RainLoop\Service
  */
 public function Handle()
 {
     if (!\class_exists('MailSo\\Version')) {
         return $this;
     }
     $this->oActions->BootStart();
     $this->oActions->ParseQueryAuthString();
     $bCached = false;
     $sResult = '';
     $sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
     $iPos = \strpos($sQuery, '&');
     if (0 < $iPos) {
         $sQuery = \substr($sQuery, 0, $iPos);
     }
     $this->oActions->Plugins()->RunHook('filter.http-query', array(&$sQuery));
     $aPaths = \explode('/', $sQuery);
     $this->oActions->Plugins()->RunHook('filter.http-paths', array(&$aPaths));
     $bAdmin = false;
     $sAdminPanelHost = $this->oActions->Config()->Get('security', 'admin_panel_host', '');
     if (empty($sAdminPanelHost)) {
         $bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp'));
     } else {
         if (empty($aPaths[0]) && \MailSo\Base\Utils::StrToLowerIfAscii($sAdminPanelHost) === \MailSo\Base\Utils::StrToLowerIfAscii($this->oHttp->GetHost())) {
             $bAdmin = true;
         }
     }
     if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true)) {
         echo $this->oActions->ErrorTemplates('Access Denied.', 'Access to the RainLoop Webmail Admin Panel is not allowed!', true);
         return $this;
     }
     $bIndex = true;
     if (0 < \count($aPaths) && !empty($aPaths[0]) && !$bAdmin && 'index' !== $aPaths[0]) {
         $bIndex = false;
         $sMethodName = 'Service' . $aPaths[0];
         if (\method_exists($this->oServiceActions, $sMethodName) && \is_callable(array($this->oServiceActions, $sMethodName))) {
             $this->oServiceActions->SetQuery($sQuery)->SetPaths($aPaths);
             $sResult = \call_user_func(array($this->oServiceActions, $sMethodName));
         } else {
             if (!$this->oActions->Plugins()->RunAdditionalPart($aPaths[0], $aPaths)) {
                 $bIndex = true;
             }
         }
     }
     if ($bIndex) {
         @header('Content-Type: text/html; charset=utf-8');
         $this->oHttp->ServerNoCache();
         $aTemplateParameters = $this->indexTemplateParameters($bAdmin);
         $sCacheFileName = '';
         if ($this->oActions->Config()->Get('labs', 'cache_system_data', true)) {
             $sCacheFileName = 'TMPL:' . $aTemplateParameters['{{BaseHash}}'];
             $sResult = $this->oActions->Cacher()->Get($sCacheFileName);
         }
         if (0 === \strlen($sResult)) {
             $sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH . 'app/templates/Index.html'), $aTemplateParameters);
             $sResult = \RainLoop\Utils::ClearHtmlOutput($sResult);
             if (0 < \strlen($sCacheFileName)) {
                 $this->oActions->Cacher()->Set($sCacheFileName, $sResult);
             }
         } else {
             $bCached = true;
         }
         $sResult .= '<!--';
         $sResult .= ' [version:' . APP_VERSION;
         $sResult .= '][time:' . \substr(\microtime(true) - APP_START, 0, 6);
         $sResult .= '][cached:' . ($bCached ? 'true' : 'false');
         $sResult .= '][hash:' . $aTemplateParameters['{{BaseHash}}'];
         $sResult .= '][session:' . \md5(\RainLoop\Utils::GetShortToken());
         $sResult .= '] -->';
     }
     // Output result
     echo $sResult;
     unset($sResult);
     $this->oActions->BootEnd();
     return $this;
 }
Exemple #17
0
 /**
  * @return string
  */
 private function getCaptchaCacherKey()
 {
     return 'CaptchaNew/Login/' . \RainLoop\Utils::GetConnectionToken();
 }
 /**
  * @param string $sName
  * @param bool $bFindWithWildCard = false
  * @param bool $bCheckDisabled = true
  *
  * @return \RainLoop\Model\Domain|null
  */
 public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
 {
     $mResult = null;
     $sDisabled = '';
     $sFoundedValue = '';
     $sRealFileName = $this->codeFileName($sName);
     if (\file_exists($this->sDomainPath . '/disabled')) {
         $sDisabled = @\file_get_contents($this->sDomainPath . '/disabled');
     }
     if (\file_exists($this->sDomainPath . '/' . $sRealFileName . '.ini') && (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . \MailSo\Base\Utils::IdnToAscii($sName, true) . ','))) {
         $aDomain = \RainLoop\Utils::CustomParseIniFile($this->sDomainPath . '/' . $sRealFileName . '.ini');
         // fix misspellings (#119)
         if (\is_array($aDomain)) {
             if (isset($aDomain['smpt_host'])) {
                 $aDomain['smtp_host'] = $aDomain['smpt_host'];
             }
             if (isset($aDomain['smpt_port'])) {
                 $aDomain['smtp_port'] = $aDomain['smpt_port'];
             }
             if (isset($aDomain['smpt_secure'])) {
                 $aDomain['smtp_secure'] = $aDomain['smpt_secure'];
             }
             if (isset($aDomain['smpt_auth'])) {
                 $aDomain['smtp_auth'] = $aDomain['smpt_auth'];
             }
         }
         //---
         $mResult = \RainLoop\Model\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain);
     } else {
         if ($bFindWithWildCard) {
             $sNames = $this->getWildcardDomainsLine();
             if (0 < \strlen($sNames)) {
                 if (\RainLoop\Plugins\Helper::ValidateWildcardValues(\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) {
                     if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . $sFoundedValue . ',')) {
                         $mResult = $this->Load($sFoundedValue, false);
                     }
                 }
             }
         }
     }
     return $mResult;
 }
Exemple #19
0
 /**
  * @return \RainLoop\Service
  */
 public function Handle()
 {
     if (!\class_exists('MailSo\\Version')) {
         return $this;
     }
     $this->oActions->BootStart();
     $this->oActions->ParseQueryAuthString();
     $bCached = false;
     $sResult = '';
     $sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
     $iPos = \strpos($sQuery, '&');
     if (0 < $iPos) {
         $sQuery = \substr($sQuery, 0, $iPos);
     }
     $this->oActions->Plugins()->RunHook('filter.http-query', array(&$sQuery));
     $aPaths = \explode('/', $sQuery);
     $this->oActions->Plugins()->RunHook('filter.http-paths', array(&$aPaths));
     $bAdmin = false;
     $sAdminPanelHost = $this->oActions->Config()->Get('security', 'admin_panel_host', '');
     if (empty($sAdminPanelHost)) {
         $bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp'));
     } else {
         if (empty($aPaths[0]) && \MailSo\Base\Utils::StrToLowerIfAscii($sAdminPanelHost) === \MailSo\Base\Utils::StrToLowerIfAscii($this->oHttp->GetHost())) {
             $bAdmin = true;
         }
     }
     if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true)) {
         echo $this->oActions->ErrorTemplates('Access Denied.', 'Access to the RainLoop Webmail Admin Panel is not allowed!', true);
         return $this;
     }
     $bIndex = true;
     if (0 < \count($aPaths) && !empty($aPaths[0]) && !$bAdmin && 'index' !== $aPaths[0]) {
         $bIndex = false;
         $sMethodName = 'Service' . $aPaths[0];
         if (\method_exists($this->oServiceActions, $sMethodName) && \is_callable(array($this->oServiceActions, $sMethodName))) {
             $this->oServiceActions->SetQuery($sQuery)->SetPaths($aPaths);
             $sResult = \call_user_func(array($this->oServiceActions, $sMethodName));
         } else {
             if (!$this->oActions->Plugins()->RunAdditionalPart($aPaths[0], $aPaths)) {
                 $bIndex = true;
             }
         }
     }
     if ($bIndex) {
         @header('Content-Type: text/html; charset=utf-8');
         $this->oHttp->ServerNoCache();
         $aData = $this->startUpData($bAdmin);
         $sCacheFileName = '';
         if ($this->oActions->Config()->Get('labs', 'cache_system_data', true)) {
             $sCacheFileName = 'TMPL:' . $aData['Hash'];
             $sResult = $this->oActions->Cacher()->Get($sCacheFileName);
         }
         if (0 === \strlen($sResult)) {
             $sJsBoot = \file_get_contents(APP_VERSION_ROOT_PATH . 'static/js/boot.js');
             $sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH . 'app/templates/Index.html'), array('{{BaseRandHash}}' => \md5(\rand(1000, 9000) . \microtime(true)), '{{BaseAppDataScriptLink}}' => $bAdmin ? './?/AdminAppData/' : './?/AppData/', '{{BaseAppFaviconIcoFile}}' => $aData['FaviconIcoLink'], '{{BaseAppFaviconPngFile}}' => $aData['FaviconPngLink'], '{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'], '{{BaseAppMainCssLink}}' => $aData['AppCssLink'], '{{BaseAppBootScriptSource}}' => $sJsBoot, '{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'], '{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'], '{{BaseAppMainScriptLink}}' => $aData['AppJsLink'], '{{BaseAppLoadingDescription}}' => \htmlspecialchars($aData['LoadingDescription'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'), '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr'));
             $sResult = \RainLoop\Utils::ClearHtmlOutput($sResult);
             if (0 < \strlen($sCacheFileName)) {
                 $this->oActions->Cacher()->Set($sCacheFileName, $sResult);
             }
         } else {
             $bCached = true;
         }
         $sResult .= '<!--';
         $sResult .= ' [version:' . APP_VERSION;
         $sResult .= '][time:' . \substr(\microtime(true) - APP_START, 0, 6);
         $sResult .= '][cached:' . ($bCached ? 'true' : 'false');
         $sResult .= '][session:' . \md5(\RainLoop\Utils::GetShortToken());
         $sResult .= '] -->';
     }
     // Output result
     echo $sResult;
     unset($sResult);
     $this->oActions->BootEnd();
     return $this;
 }
 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param string $sQuery
  * @param int $iLimit = 20
  *
  * @return array
  */
 public function Process($oAccount, $sQuery, $iLimit = 20)
 {
     $sQuery = \trim($sQuery);
     if (2 > \strlen($sQuery)) {
         return array();
     } else {
         if (!$oAccount || !\RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails)) {
             return array();
         }
     }
     $aResult = $this->ldapSearch($oAccount, $sQuery);
     $aResult = \RainLoop\Utils::RemoveSuggestionDuplicates($aResult);
     if ($iLimit < \count($aResult)) {
         $aResult = \array_slice($aResult, 0, $iLimit);
     }
     return $aResult;
 }
 /**
  * @param \RainLoop\Model\Account|string|null $mAccount
  * @param int $iStorageType
  * @param string $sKey
  * @param bool $bMkDir = false
  * @param bool $bForDeleteAction = false
  *
  * @return string
  */
 public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
 {
     $sFileName = parent::generateFileName($mAccount, $iStorageType, $sKey, false, false);
     return $sFileName . '/' . \RainLoop\Utils::GetConnectionToken() . '/';
 }
Exemple #22
0
 /**
  * @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 = \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(\md5($this->oActions->Config()->Get('cache', 'index', '')), $this->oActions->Plugins()->Hash(), \RainLoop\Utils::WebVersionPath(), APP_VERSION)) . \implode('~', $aTemplateParameters));
     return $aTemplateParameters;
 }