Ejemplo n.º 1
0
 /**
  * @return string
  */
 public function GetAuthToken()
 {
     return \RainLoop\Utils::EncodeKeyValues(array('token', $this->sEmail, $this->sLogin, $this->sPassword, \RainLoop\Utils::Fingerprint(), $this->sSignMeToken, $this->sParentEmail, \RainLoop\Utils::GetShortToken(), $this->sProxyAuthUser, $this->sProxyAuthPassword, 0));
 }
Ejemplo n.º 2
0
 /**
  * @return array
  */
 public function DoEnableTwoFactor()
 {
     $oAccount = $this->getAccountFromToken();
     if (!$this->TwoFactorAuthProvider()->IsActive() || !$this->GetCapa(false, \RainLoop\Enumerations\Capa::TWO_FACTOR, $oAccount)) {
         return $this->FalseResponse(__FUNCTION__);
     }
     $sEmail = $oAccount->ParentEmailHelper();
     $bResult = false;
     $mData = $this->getTwoFactorInfo($oAccount);
     if (isset($mData['Secret'], $mData['BackupCodes'])) {
         $bResult = $this->StorageProvider()->Put($oAccount, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, 'two_factor', \RainLoop\Utils::EncodeKeyValues(array('User' => $sEmail, 'Enable' => '1' === \trim($this->GetActionParam('Enable', '0')), 'Secret' => $mData['Secret'], 'BackupCodes' => $mData['BackupCodes'])));
     }
     return $this->DefaultResponse(__FUNCTION__, $bResult);
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 public function TwitterPopupService()
 {
     $sResult = '';
     $sLoginUrl = '';
     $sSocialName = '';
     $bLogin = false;
     $iErrorCode = \RainLoop\Notifications::UnknownError;
     $sRedirectUrl = $this->oHttp->GetFullUrl() . '?SocialTwitter';
     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 {
         $oTwitter = $this->TwitterConnector();
         if ($oTwitter) {
             $sSessionKey = \implode('_', array('twitter', \md5($oTwitter->config['consumer_secret']), \md5(\RainLoop\Utils::GetConnectionToken()), 'AuthSessionData'));
             $oAccount = $this->oActions->GetAccount();
             if ($oAccount) {
                 if (isset($_REQUEST['oauth_verifier'])) {
                     $sAuth = $this->oActions->Cacher()->Get($sSessionKey);
                     $oAuth = $sAuth ? \json_decode($sAuth, true) : null;
                     if ($oAuth && !empty($oAuth['oauth_token']) && !empty($oAuth['oauth_token_secret'])) {
                         $oTwitter->config['user_token'] = $oAuth['oauth_token'];
                         $oTwitter->config['user_secret'] = $oAuth['oauth_token_secret'];
                         $iCode = $oTwitter->request('POST', $oTwitter->url('oauth/access_token', ''), array('oauth_callback' => $sRedirectUrl, 'oauth_verifier' => $_REQUEST['oauth_verifier']));
                         if (200 === $iCode && isset($oTwitter->response['response'])) {
                             $this->oActions->Logger()->WriteDump($oTwitter->response['response']);
                             $aAccessToken = $oTwitter->extract_params($oTwitter->response['response']);
                             $this->oActions->Logger()->WriteDump($aAccessToken);
                             if ($aAccessToken && isset($aAccessToken['oauth_token']) && !empty($aAccessToken['user_id'])) {
                                 $oTwitter->config['user_token'] = $aAccessToken['oauth_token'];
                                 $oTwitter->config['user_secret'] = $aAccessToken['oauth_token_secret'];
                                 $sSocialName = !empty($aAccessToken['screen_name']) ? '@' . $aAccessToken['screen_name'] : $aAccessToken['user_id'];
                                 $sSocialName = \trim($sSocialName);
                                 $aUserData = array('Email' => $oAccount->Email(), 'Password' => $oAccount->Password());
                                 $oSettings = $this->oActions->SettingsProvider()->Load($oAccount);
                                 $oSettings->SetConf('TwitterAccessToken', \RainLoop\Utils::EncodeKeyValues($aAccessToken));
                                 $oSettings->SetConf('TwitterSocialName', $sSocialName);
                                 $this->oActions->SettingsProvider()->Save($oAccount, $oSettings);
                                 $this->oActions->StorageProvider()->Put(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, $this->TwitterUserLoginStorageKey($oTwitter, $aAccessToken['user_id']), \RainLoop\Utils::EncodeKeyValues($aUserData));
                                 $iErrorCode = 0;
                             }
                         }
                     }
                 } else {
                     $aParams = array('oauth_callback' => $sRedirectUrl, 'x_auth_access_type' => 'read');
                     $iCode = $oTwitter->request('POST', $oTwitter->url('oauth/request_token', ''), $aParams);
                     if (200 === $iCode && isset($oTwitter->response['response'])) {
                         $oAuth = $oTwitter->extract_params($oTwitter->response['response']);
                         if (!empty($oAuth['oauth_token'])) {
                             $this->oActions->Cacher()->Set($sSessionKey, \json_encode($oAuth));
                             $sLoginUrl = $oTwitter->url('oauth/authenticate', '') . '?oauth_token=' . $oAuth['oauth_token'];
                         }
                     }
                 }
             } else {
                 $bLogin = true;
                 if (isset($_REQUEST['oauth_verifier'])) {
                     $sAuth = $this->oActions->Cacher()->Get($sSessionKey);
                     $oAuth = $sAuth ? \json_decode($sAuth, true) : null;
                     if ($oAuth && !empty($oAuth['oauth_token']) && !empty($oAuth['oauth_token_secret'])) {
                         $oTwitter->config['user_token'] = $oAuth['oauth_token'];
                         $oTwitter->config['user_secret'] = $oAuth['oauth_token_secret'];
                         $iCode = $oTwitter->request('POST', $oTwitter->url('oauth/access_token', ''), array('oauth_callback' => $sRedirectUrl, 'oauth_verifier' => $_REQUEST['oauth_verifier']));
                         if (200 === $iCode && isset($oTwitter->response['response'])) {
                             $aAccessToken = $oTwitter->extract_params($oTwitter->response['response']);
                             if ($aAccessToken && isset($aAccessToken['oauth_token']) && !empty($aAccessToken['user_id'])) {
                                 $sUserData = $this->oActions->StorageProvider()->Get(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, $this->TwitterUserLoginStorageKey($oTwitter, $aAccessToken['user_id']));
                                 $aUserData = \RainLoop\Utils::DecodeKeyValues($sUserData);
                                 if ($aUserData && \is_array($aUserData) && !empty($aUserData['Email']) && isset($aUserData['Password'])) {
                                     $oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
                                     if ($oAccount instanceof \RainLoop\Account) {
                                         $this->oActions->AuthProcess($oAccount);
                                         $iErrorCode = 0;
                                     }
                                 } else {
                                     $iErrorCode = \RainLoop\Notifications::SocialTwitterLoginAccessDisable;
                                 }
                                 $this->oActions->Cacher()->Delete($sSessionKey);
                             }
                         }
                     }
                 } else {
                     $aParams = array('oauth_callback' => $sRedirectUrl, 'x_auth_access_type' => 'read');
                     $iCode = $oTwitter->request('POST', $oTwitter->url('oauth/request_token', ''), $aParams);
                     if (200 === $iCode && isset($oTwitter->response['response'])) {
                         $oAuth = $oTwitter->extract_params($oTwitter->response['response']);
                         if (!empty($oAuth['oauth_token'])) {
                             $this->oActions->Cacher()->Set($sSessionKey, \json_encode($oAuth));
                             $sLoginUrl = $oTwitter->url('oauth/authenticate', '') . '?oauth_token=' . $oAuth['oauth_token'];
                         }
                     }
                 }
             }
         }
     } catch (\Exception $oException) {
         $this->oActions->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
     }
     if ($sLoginUrl) {
         $this->oActions->Location($sLoginUrl);
     } else {
         @\header('Content-Type: text/html; charset=utf-8');
         $sCallBackType = $bLogin ? '_login' : '';
         $sConnectionFunc = 'rl_' . \md5(\RainLoop\Utils::GetConnectionToken()) . '_twitter' . $sCallBackType . '_service';
         $sResult = '<script type="text/javascript" data-cfasync="false">opener && opener.' . $sConnectionFunc . ' && opener.' . $sConnectionFunc . '(' . $iErrorCode . '); self && self.close && self.close();</script>';
     }
     return $sResult;
 }
Ejemplo n.º 4
0
 /**
  * @param string $sEmail
  * @param string $sPassword
  * @param array $aAdditionalOptions = array()
  * @param bool $bUseTimeout = true
  *
  * @return string
  */
 public static function GetUserSsoHash($sEmail, $sPassword, $aAdditionalOptions = array(), $bUseTimeout = true)
 {
     $sSsoHash = \MailSo\Base\Utils::Sha1Rand($sEmail . $sPassword);
     return \RainLoop\Api::Actions()->Cacher()->Set(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array('Email' => $sEmail, 'Password' => $sPassword, 'AdditionalOptions' => $aAdditionalOptions, 'Time' => $bUseTimeout ? \time() : 0))) ? $sSsoHash : '';
 }
Ejemplo n.º 5
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 : '';
 }
Ejemplo n.º 6
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;
 }