当前位置: 首页>>代码示例>>PHP>>正文


PHP api_Utils类代码示例

本文整理汇总了PHP中api_Utils的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils类的具体用法?PHP api_Utils怎么用?PHP api_Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了api_Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Import

 /**
  * @param int $iUserId
  * @param string $sTempFileName
  * @param int $iParsedCount
  * @return int
  */
 public function Import($iUserId, $sTempFileName, &$iParsedCount)
 {
     $iCount = -1;
     $iParsedCount = 0;
     if (file_exists($sTempFileName)) {
         $aCsv = api_Utils::CsvToArray($sTempFileName);
         if (is_array($aCsv)) {
             $iCount = 0;
             foreach ($aCsv as $aCsvItem) {
                 set_time_limit(30);
                 $this->oParser->Reset();
                 $oContact = new CContact();
                 $oContact->IdUser = $iUserId;
                 $this->oParser->SetContainer($aCsvItem);
                 $aParameters = $this->oParser->GetParameters();
                 foreach ($aParameters as $sPropertyName => $mValue) {
                     if ($oContact->IsProperty($sPropertyName)) {
                         $oContact->{$sPropertyName} = $mValue;
                     }
                 }
                 if (0 === strlen($oContact->FullName)) {
                     $oContact->FullName = trim($oContact->FirstName . ' ' . $oContact->LastName);
                 }
                 $iParsedCount++;
                 $oContact->__SKIP_VALIDATE__ = true;
                 if ($this->oApiContactsManager->CreateContact($oContact)) {
                     $iCount++;
                 }
                 unset($oContact, $aParameters, $aCsvItem);
             }
         }
     }
     return $iCount;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:40,代码来源:csv.php

示例2: Import

 /**
  * @param int $iUserId
  * @param string $sTempFileName
  * @param int $iParsedCount
  * @param int $iGroupId
  * @param bool $bIsShared
  * @return int
  */
 public function Import($iUserId, $sTempFileName, &$iParsedCount, $iGroupId, $bIsShared)
 {
     $iCount = -1;
     $iParsedCount = 0;
     if (file_exists($sTempFileName)) {
         $aCsv = api_Utils::CsvToArray($sTempFileName);
         if (is_array($aCsv)) {
             $oApiUsersManager = CApi::Manager('users');
             $oAccount = $oApiUsersManager->GetDefaultAccount($iUserId);
             $iCount = 0;
             foreach ($aCsv as $aCsvItem) {
                 set_time_limit(30);
                 $this->oParser->Reset();
                 $oContact = new CContact();
                 $oContact->IdUser = $iUserId;
                 $this->oParser->SetContainer($aCsvItem);
                 $aParameters = $this->oParser->GetParameters();
                 foreach ($aParameters as $sPropertyName => $mValue) {
                     if ($oContact->IsProperty($sPropertyName)) {
                         $oContact->{$sPropertyName} = $mValue;
                     }
                 }
                 if (0 === strlen($oContact->FullName)) {
                     $oContact->FullName = trim($oContact->FirstName . ' ' . $oContact->LastName);
                 }
                 if (0 !== strlen($oContact->HomeEmail)) {
                     $oContact->PrimaryEmail = \EPrimaryEmailType::Home;
                     $oContact->ViewEmail = $oContact->HomeEmail;
                 } else {
                     if (0 !== strlen($oContact->BusinessEmail)) {
                         $oContact->PrimaryEmail = \EPrimaryEmailType::Business;
                         $oContact->ViewEmail = $oContact->BusinessEmail;
                     } else {
                         if (0 !== strlen($oContact->OtherEmail)) {
                             $oContact->PrimaryEmail = \EPrimaryEmailType::Other;
                             $oContact->ViewEmail = $oContact->OtherEmail;
                         }
                     }
                 }
                 if (strlen($oContact->BirthdayYear) === 2) {
                     $oDt = DateTime::createFromFormat('y', $oContact->BirthdayYear);
                     $oContact->BirthdayYear = $oDt->format('Y');
                 }
                 $iParsedCount++;
                 $oContact->__SKIP_VALIDATE__ = true;
                 if ($oAccount) {
                     $oContact->IdDomain = $oAccount->IdDomain;
                     $oContact->IdTenant = $oAccount->IdTenant;
                 }
                 $oContact->SharedToAll = $bIsShared;
                 $oContact->GroupsIds = array($iGroupId);
                 if ($this->oApiContactsManager->CreateContact($oContact)) {
                     $iCount++;
                 }
                 unset($oContact, $aParameters, $aCsvItem);
             }
         }
     }
     return $iCount;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:68,代码来源:csv.php

示例3: createMin

 /**
  * @param string $sHashID
  * @param array $aParams
  *
  * @return string|bool
  */
 public function createMin($sHashID, $aParams)
 {
     $mResult = false;
     $sNewMin = '';
     if (is_string($sHashID) && 0 < strlen($sHashID) && false !== $this->getMinByID($sHashID)) {
         return false;
     }
     while (true) {
         $sNewMin = api_Utils::GenerateShortHashString(10);
         if (false === $this->getMinByHash($sNewMin)) {
             break;
         }
     }
     if (0 < strlen($sNewMin)) {
         $aParams['__hash_id__'] = $sHashID;
         $aParams['__hash__'] = $sNewMin;
         $aParams['__time__'] = time();
         $aParams['__time_update__'] = time();
         if ($this->oConnection->Execute($this->oCommandCreator->createMin($sNewMin, md5($sHashID), @\json_encode($aParams)))) {
             $mResult = $sNewMin;
         }
     }
     $this->throwDbExceptionIfExist();
     return $mResult;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:31,代码来源:storage.php

示例4: getQuotaInfo

 public function getQuotaInfo()
 {
     $Size = 0;
     $aResult = \api_Utils::GetDirectorySize($this->path);
     if ($aResult && $aResult['size']) {
         $Size = (int) $aResult['size'];
     }
     return array($Size, 0);
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:9,代码来源:RootPublic.php

示例5: Ldap

 /**
  * @staticvar CLdapConnector|null $oLdap
  * @param CAccount $oAccount
  * @return CLdapConnector|bool
  */
 private function Ldap($oAccount)
 {
     //		if ($oAccount)
     //		{
     //			// TODO
     //			$aCustomFields = $oAccount->CustomFields;
     //			$aCustomFields['LdapPabUrl'] = 'ldap://192.168.0.197:389/ou=TestUser2,ou=PAB,dc=example,dc=com';
     //			$aCustomFields['LdapPabUrl'] = 'ldap://jes7dir.netvision.net.il:389/ou=24606995,ou=People,o=netvision.net.il,o=NVxSP,o=pab';
     //			$oAccount->CustomFields = $aCustomFields;
     //		}
     static $aLdap = array();
     if (!$oAccount || !isset($oAccount->CustomFields) || empty($oAccount->CustomFields['LdapPabUrl'])) {
         return false;
     }
     $sPabUrl = $oAccount->CustomFields['LdapPabUrl'];
     $aPabUrl = api_Utils::LdapUriParse($sPabUrl);
     if (isset($aLdap[$sPabUrl]) && $aLdap[$sPabUrl]) {
         return $aLdap[$sPabUrl];
     }
     if (!extension_loaded('ldap')) {
         CApi::Log('LDAP: Can\'t load LDAP extension.', ELogLevel::Error);
         return false;
     }
     if (!class_exists('CLdapConnector')) {
         CApi::Inc('common.ldap');
     }
     $oLdap = new CLdapConnector($aPabUrl['search_dn']);
     $oLdap = $oLdap->Connect((string) $aPabUrl['host'], (int) $aPabUrl['port'], (string) CApi::GetConf('contacts.ldap.bind-dn', ''), (string) CApi::GetConf('contacts.ldap.bind-password', '')) ? $oLdap : false;
     if ($oLdap) {
         if (!$oLdap->Search('(objectClass=*)')) {
             CApi::Log('LDAP: Init PabUrl Entry');
             $sNewDn = $oLdap->GetSearchDN();
             $aDnExplode = ldap_explode_dn($sNewDn, 1);
             $sOu = isset($aDnExplode[0]) ? trim($aDnExplode[0]) : '';
             $aPabUrlEntry = CApi::GetConf('contacts.ldap.pab-url-entry', array('objectClass' => array('top', 'organizationalUnit')));
             if (isset($aPabUrlEntry['objectClass'])) {
                 $aPabUrlEntry['ou'] = $sOu;
                 if (0 < strlen($sOu)) {
                     if (!$oLdap->Add('', $aPabUrlEntry)) {
                         $oLdap = false;
                     }
                 } else {
                     CApi::Log('LDAP: empty Ou in SearchDn = ' . $sNewDn);
                     $oLdap = false;
                 }
             } else {
                 CApi::Log('LDAP: pab-url-entry format error');
                 CApi::Log(print_r($aPabUrlEntry, true));
                 $oLdap = false;
             }
         }
     }
     $aLdap[$sPabUrl] = $oLdap;
     return $oLdap;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:60,代码来源:storage.php

示例6: SystemLogging

 public function SystemLogging(ap_Standard_Screen &$oScreen)
 {
     $this->oSettings->GetConf('Common/LoggingLevel');
     $this->oSettings->GetConf('Common/EnableEventLogging');
     $oScreen->Data->SetValue('ch_EnableDebugLogging', $this->oSettings->GetConf('Common/EnableLogging'));
     $iLogLevel = $this->oSettings->GetConf('Common/LoggingLevel');
     $oScreen->Data->SetValue('selVerbosityFull', ELogLevel::Full === $iLogLevel);
     $oScreen->Data->SetValue('selVerbosityWarning', ELogLevel::Warning === $iLogLevel);
     $oScreen->Data->SetValue('selVerbosityError', ELogLevel::Error === $iLogLevel);
     $oScreen->Data->SetValue('selVerbositySpec', ELogLevel::Spec === $iLogLevel);
     $oScreen->Data->SetValue('ch_EnableUserActivityLogging', $this->oSettings->GetConf('Common/EnableEventLogging'));
     $aSize = $this->oModule->GetLogsSize();
     $oScreen->Data->SetValue('DownloadLogSize', '(' . api_Utils::GetFriendlySize($aSize[0]) . ')');
     $oScreen->Data->SetValue('DownloadUserActivityLogSize', '(' . api_Utils::GetFriendlySize($aSize[1]) . ')');
     $oScreen->Data->SetValue('MaxViewSize', CApi::GetConf('log.max-view-size', 100) . 'KB');
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:16,代码来源:populate.php

示例7: Handle


//.........这里部分代码省略.........
                                                                                 $sType = !empty($aPaths[1]) ? trim($aPaths[1]) : '';
                                                                                 if ('js' === $sType) {
                                                                                     @header('Content-Type: application/javascript; charset=utf-8');
                                                                                     $sResult = \CApi::Plugin()->CompileJs();
                                                                                 } else {
                                                                                     if ('images' === $sType) {
                                                                                         if (!empty($aPaths[2]) && !empty($aPaths[3])) {
                                                                                             $oPlugin = \CApi::Plugin()->GetPluginByName($aPaths[2]);
                                                                                             if ($oPlugin) {
                                                                                                 echo $oPlugin->GetImage($aPaths[3]);
                                                                                                 exit;
                                                                                             }
                                                                                         }
                                                                                     } else {
                                                                                         if ('fonts' === $sType) {
                                                                                             if (!empty($aPaths[2]) && !empty($aPaths[3])) {
                                                                                                 $oPlugin = \CApi::Plugin()->GetPluginByName($aPaths[2]);
                                                                                                 if ($oPlugin) {
                                                                                                     echo $oPlugin->GetFont($aPaths[3]);
                                                                                                     exit;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             } else {
                                                                                 if ('postlogin' === $sFirstPart && \CApi::GetConf('labs.allow-post-login', false)) {
                                                                                     $oSettings =& \CApi::GetSettings();
                                                                                     $sEmail = trim((string) $this->oHttp->GetRequest('Email', ''));
                                                                                     $sLogin = (string) $this->oHttp->GetRequest('Login', '');
                                                                                     $sPassword = (string) $this->oHttp->GetRequest('Password', '');
                                                                                     $sAtDomain = trim($oSettings->GetConf('WebMail/LoginAtDomainValue'));
                                                                                     if (\ELoginFormType::Login === (int) $oSettings->GetConf('WebMail/LoginFormType') && 0 < strlen($sAtDomain)) {
                                                                                         $sEmail = \api_Utils::GetAccountNameFromEmail($sLogin) . '@' . $sAtDomain;
                                                                                         $sLogin = $sEmail;
                                                                                     }
                                                                                     if (0 !== strlen($sPassword) && 0 !== strlen($sEmail . $sLogin)) {
                                                                                         try {
                                                                                             $oAccount = $oApiIntegrator->loginToAccount($sEmail, $sPassword, $sLogin);
                                                                                         } catch (\Exception $oException) {
                                                                                             $iErrorCode = \ProjectCore\Notifications::UnknownError;
                                                                                             if ($oException instanceof \CApiManagerException) {
                                                                                                 switch ($oException->getCode()) {
                                                                                                     case \Errs::WebMailManager_AccountDisabled:
                                                                                                     case \Errs::WebMailManager_AccountWebmailDisabled:
                                                                                                         $iErrorCode = \ProjectCore\Notifications::AuthError;
                                                                                                         break;
                                                                                                     case \Errs::UserManager_AccountAuthenticationFailed:
                                                                                                     case \Errs::WebMailManager_AccountAuthentication:
                                                                                                     case \Errs::WebMailManager_NewUserRegistrationDisabled:
                                                                                                     case \Errs::WebMailManager_AccountCreateOnLogin:
                                                                                                     case \Errs::Mail_AccountAuthentication:
                                                                                                     case \Errs::Mail_AccountLoginFailed:
                                                                                                         $iErrorCode = \ProjectCore\Notifications::AuthError;
                                                                                                         break;
                                                                                                     case \Errs::UserManager_AccountConnectToMailServerFailed:
                                                                                                     case \Errs::WebMailManager_AccountConnectToMailServerFailed:
                                                                                                     case \Errs::Mail_AccountConnectToMailServerFailed:
                                                                                                         $iErrorCode = \ProjectCore\Notifications::MailServerError;
                                                                                                         break;
                                                                                                     case \Errs::UserManager_LicenseKeyInvalid:
                                                                                                     case \Errs::UserManager_AccountCreateUserLimitReached:
                                                                                                     case \Errs::UserManager_LicenseKeyIsOutdated:
                                                                                                     case \Errs::TenantsManager_AccountCreateUserLimitReached:
                                                                                                         $iErrorCode = \ProjectCore\Notifications::LicenseProblem;
                                                                                                         break;
开发者ID:zhuomingliang,项目名称:webmail-lite,代码行数:67,代码来源:Service.php

示例8: parseGetConf

 /**
  * @param string $sKey
  *
  * @return mixed
  */
 protected function parseGetConf($sKey)
 {
     $mValue = null;
     $sKey = strtolower($sKey);
     if (isset($this->aLowerMap[$sKey])) {
         if (array_key_exists($sKey, $this->aContainer)) {
             $mValue = $this->aContainer[$sKey];
         } else {
             $mValue = $this->aLowerMap[$sKey][0];
         }
         $aType = $this->aLowerMap[$sKey];
         switch ($aType[1]) {
             case 'string':
                 $mValue = api_Utils::EncodeSpecialXmlChars((string) $mValue);
                 break;
             case 'int':
                 $mValue = (int) $mValue;
                 break;
             case 'bool':
                 $mValue = (bool) $mValue ? 'On' : 'Off';
                 break;
             case 'spec':
                 $mValue = $this->specBackConver($sKey, $mValue);
                 break;
         }
     }
     return $mValue;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:33,代码来源:settings.php

示例9: AjaxSocialAccountListGet

 public function AjaxSocialAccountListGet()
 {
     $mResult['Result'] = false;
     $oTenant = null;
     $oAccount = \api_Utils::GetDefaultAccount();
     $oApiTenants = \CApi::Manager('tenants');
     if ($oAccount && $oApiTenants) {
         $oTenant = 0 < $oAccount->IdTenant ? $oApiTenants->getTenantById($oAccount->IdTenant) : $oApiTenants->getDefaultGlobalTenant();
     }
     if ($oTenant) {
         $oApiSocial = \CApi::Manager('social');
         $mResult['Result'] = $oApiSocial->getSocials($oAccount->IdAccount);
     }
     return $mResult;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:15,代码来源:index.php

示例10: getMessageListByUids

 /**
  * Obtains a list of specific messages.
  * 
  * @param CAccount $oAccount Account object.
  * @param string $sFolderFullNameRaw Raw full name of the folder.
  * @param array $aUids List of message UIDs.
  *
  * @return CApiMailMessageCollection
  *
  * @throws CApiInvalidArgumentException
  */
 public function getMessageListByUids($oAccount, $sFolderFullNameRaw, $aUids)
 {
     if (0 === strlen($sFolderFullNameRaw) || !is_array($aUids) || 0 === count($aUids)) {
         throw new CApiInvalidArgumentException();
     }
     $oMessageCollection = false;
     $oImapClient =& $this->_getImapClient($oAccount);
     $oImapClient->FolderExamine($sFolderFullNameRaw);
     $aList = $this->_getFolderInformation($oImapClient, $sFolderFullNameRaw);
     $iMessageRealCount = $aList[0];
     $iMessageUnseenCount = $aList[1];
     $sUidNext = $aList[2];
     $oMessageCollection = CApiMailMessageCollection::createInstance();
     $oMessageCollection->FolderName = $sFolderFullNameRaw;
     $oMessageCollection->Offset = 0;
     $oMessageCollection->Limit = 0;
     $oMessageCollection->Search = '';
     $oMessageCollection->UidNext = $sUidNext;
     if (0 < $iMessageRealCount) {
         $bIndexAsUid = true;
         $aIndexOrUids = $aUids;
         if (is_array($aIndexOrUids)) {
             $oMessageCollection->MessageCount = $iMessageRealCount;
             $oMessageCollection->MessageUnseenCount = $iMessageUnseenCount;
             $oMessageCollection->MessageSearchCount = $oMessageCollection->MessageCount;
             $oMessageCollection->MessageResultCount = $oMessageCollection->MessageCount;
             if (0 < count($aIndexOrUids)) {
                 $aRequestIndexOrUids = $aIndexOrUids;
                 if ($bIndexAsUid) {
                     $oMessageCollection->Uids = $aRequestIndexOrUids;
                 }
                 if (is_array($aRequestIndexOrUids) && 0 < count($aRequestIndexOrUids)) {
                     $aFetchResponse = $oImapClient->Fetch(array(\MailSo\Imap\Enumerations\FetchType::INDEX, \MailSo\Imap\Enumerations\FetchType::UID, \MailSo\Imap\Enumerations\FetchType::RFC822_SIZE, \MailSo\Imap\Enumerations\FetchType::INTERNALDATE, \MailSo\Imap\Enumerations\FetchType::FLAGS, \MailSo\Imap\Enumerations\FetchType::BODYSTRUCTURE, \MailSo\Imap\Enumerations\FetchType::BODY_HEADER_PEEK), implode(',', $aRequestIndexOrUids), $bIndexAsUid);
                     if (is_array($aFetchResponse) && 0 < count($aFetchResponse)) {
                         $aFetchIndexArray = array();
                         $oFetchResponseItem = null;
                         foreach ($aFetchResponse as &$oFetchResponseItem) {
                             $aFetchIndexArray[$bIndexAsUid ? $oFetchResponseItem->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID) : $oFetchResponseItem->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::INDEX)] =& $oFetchResponseItem;
                             unset($oFetchResponseItem);
                         }
                         foreach ($aRequestIndexOrUids as $iFUid) {
                             if (isset($aFetchIndexArray[$iFUid])) {
                                 $oMailMessage = CApiMailMessage::createInstance($oMessageCollection->FolderName, $aFetchIndexArray[$iFUid]);
                                 if (!$bIndexAsUid) {
                                     $oMessageCollection->Uids[] = $oMailMessage->getUid();
                                 }
                                 $oMessageCollection->Add($oMailMessage);
                                 unset($oMailMessage);
                             }
                         }
                     }
                 }
             }
         }
     }
     $oMessageCollection->FolderHash = api_Utils::GenerateFolderHash($sFolderFullNameRaw, $oMessageCollection->MessageCount, $oMessageCollection->MessageUnseenCount, $oMessageCollection->UidNext);
     return $oMessageCollection;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:69,代码来源:manager.php

示例11: GetParamTagValueByName

 /**
  * @param string $sName
  * @return string
  */
 public function GetParamTagValueByName($sName)
 {
     $oParam =& $this->getParamNodeByName($sName);
     return null !== $oParam ? api_Utils::DecodeSpecialXmlChars($oParam->Value) : '';
 }
开发者ID:Git-Host,项目名称:email,代码行数:9,代码来源:xml.php

示例12: RawIframe

 /**
  * @return bool
  */
 public function RawIframe()
 {
     $sEncodedUrl = $this->getParamValue('RawKey', '');
     $sUrl = urldecode($sEncodedUrl);
     $sUrl = trim(trim($sUrl), '/\\?');
     $aParts = null;
     if (!empty($sUrl)) {
         $aParts = explode('/', $sUrl);
     }
     if (is_array($aParts) && isset($aParts[0], $aParts[1], $aParts[2], $aParts[3])) {
         $aValues = \CApi::DecodeKeyValues($aParts[3]);
         if (isset($aValues['Iframed'], $aValues['Name'], $aValues['AccountID']) && (!isset($aValues['MimeType']) || !isset($aValues['FileName']))) {
             $aValues['FileName'] = $aValues['Name'];
             $aValues['MimeType'] = \api_Utils::MimeContentType($aValues['FileName']);
         }
         if (isset($aValues['Iframed'], $aValues['MimeType'], $aValues['FileName']) && $aValues['Iframed'] && \CApi::isIframedMimeTypeSupported($aValues['MimeType'], $aValues['FileName'])) {
             $oAccount = $this->getAccountFromParam(false);
             if ($oAccount) {
                 $sNewUrl = '';
                 $sNewHash = '';
                 $sResultUrl = '';
                 $aSubParts = \CApi::DecodeKeyValues($aParts[3]);
                 if (isset($aSubParts['Iframed']) && (int) $aParts[2] === (int) $oAccount->IdAccount && 0 < $oAccount->IdAccount) {
                     $aSubParts['Time'] = \time();
                     $sNewHash = \CApi::EncodeKeyValues($aSubParts);
                 }
                 if (!empty($sNewHash)) {
                     $aParts[3] = $sNewHash;
                     $sNewUrl = rtrim(trim($this->oHttp->GetFullUrl()), '/') . '/?/' . implode('/', $aParts);
                     \CApi::Plugin()->RunHook('webmail.filter.iframed-attachments-url', array(&$sResultUrl, $sNewUrl, $aValues['MimeType'], $aValues['FileName']));
                     if (empty($sResultUrl) && \CApi::GetConf('labs.allow-officeapps-viewer', true)) {
                         $sResultUrl = 'https://view.officeapps.live.com/op/view.aspx?src=' . urlencode($sNewUrl);
                     }
                 }
                 if (!empty($sResultUrl)) {
                     header('Content-Type: text/html', true);
                     echo '<html style="height: 100%; width: 100%; margin: 0; padding: 0"><head></head><body' . ' style="height: 100%; width: 100%; margin: 0; padding: 0">' . '<iframe style="height: 100%; width: 100%; margin: 0; padding: 0; border: 0" src="' . $sResultUrl . '"></iframe></body></html>';
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:47,代码来源:Actions.php

示例13: getFullQuotaInfo

 public function getFullQuotaInfo()
 {
     $iFreeSize = 0;
     $sRootPath = $this->getRootPath(\EFileStorageTypeStr::Personal);
     $aSize = \api_Utils::GetDirectorySize($sRootPath);
     $iUsageSize = (int) $aSize['size'];
     $sRootPath = $this->getRootPath(\EFileStorageTypeStr::Corporate);
     $aSize = \api_Utils::GetDirectorySize($sRootPath);
     $iUsageSize += (int) $aSize['size'];
     $oAccount = $this->getAccount();
     if ($oAccount) {
         $oTenant = $this->getTenant();
         if ($oTenant) {
             $iFreeSize = $oTenant->FilesUsageDynamicQuotaInMB * 1024 * 1024 - $iUsageSize;
         }
     }
     return array($iUsageSize, $iFreeSize);
 }
开发者ID:Git-Host,项目名称:email,代码行数:18,代码来源:Directory.php

示例14: InitLoginAndEmail

 /**
  * @param string $sLogin
  * @param string $sAtChar = '@'
  */
 public function InitLoginAndEmail($sLogin, $sAtChar = '@')
 {
     $this->Email = '';
     $this->IncomingMailLogin = $sLogin;
     $sLoginPart = api_Utils::GetAccountNameFromEmail($sLogin);
     $sDomainPart = api_Utils::GetDomainFromEmail($sLogin);
     $sDomainName = $this->Domain->IsDefaultDomain || $this->Domain->IsDefaultTenantDomain ? $sDomainPart : $this->Domain->Name;
     if (!empty($sDomainName)) {
         $this->Email = $sLoginPart . $sAtChar . $sDomainName;
         if ($this->Domain && $this->Domain->IsInternal && 0 < strlen($this->Domain->Name)) {
             $this->IncomingMailLogin = $sLoginPart . $sAtChar . $this->Domain->Name;
         }
     }
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:18,代码来源:account.php

示例15: updateSieveFilters

 /**
  * @param CAcount $oAccount
  * @param array $aFilters
  *
  * @return bool
  */
 public function updateSieveFilters($oAccount, $aFilters)
 {
     $sFilters = "#sieve filter\n\n";
     if ($oAccount) {
         foreach ($aFilters as $oFilter) {
             if ('' === trim($oFilter->Filter)) {
                 continue;
             }
             if (EFilterAction::MoveToFolder === $oFilter->Action && '' === trim($oFilter->FolderFullName)) {
                 continue;
             }
             $aFields = array();
             switch ($oFilter->Field) {
                 default:
                 case EFilterFiels::From:
                     $aFields[] = 'From';
                     break;
                 case EFilterFiels::To:
                     $aFields[] = 'To';
                     $aFields[] = 'CC';
                     break;
                 case EFilterFiels::Subject:
                     $aFields[] = 'Subject';
                     break;
             }
             // condition
             foreach ($aFields as $iIndex => $sField) {
                 $aFields[$iIndex] = '"' . $this->_quoteValue($sField) . '"';
             }
             $sCondition = '';
             $sFields = implode(',', $aFields);
             switch ($oFilter->Condition) {
                 case EFilterCondition::ContainSubstring:
                     $sCondition = 'if header :contains [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
                 case EFilterCondition::ContainExactPhrase:
                     $sCondition = 'if header :is [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
                 case EFilterCondition::NotContainSubstring:
                     $sCondition = 'if not header :contains [' . $sFields . '] "' . $this->_quoteValue($oFilter->Filter) . '" {';
                     break;
             }
             // folder
             $sFolderFullName = '';
             if (EFilterAction::MoveToFolder === $oFilter->Action) {
                 $sFolderFullName = api_Utils::ConvertEncoding($oFilter->FolderFullName, 'utf7-imap', $this->sSieveFolderCharset);
             }
             // action
             $sAction = '';
             switch ($oFilter->Action) {
                 case EFilterAction::DeleteFromServerImmediately:
                     $sAction = 'discard ;';
                     $sAction .= 'stop ;';
                     break;
                 case EFilterAction::MoveToFolder:
                     $sAction = 'fileinto "' . $this->_quoteValue($sFolderFullName) . '" ;' . "\n";
                     $sAction .= 'stop ;';
                     break;
             }
             $sEnd = '}';
             if (!$oFilter->Enable) {
                 $sCondition = '#' . $sCondition;
                 $sAction = '#' . $sAction;
                 $sEnd = '#' . $sEnd;
             }
             $sFilters .= "\n" . '#sieve_filter:' . implode(';', array($oFilter->Enable ? '1' : '0', $oFilter->Condition, $oFilter->Field, $oFilter->Filter, $oFilter->Action, $sFolderFullName)) . "\n";
             $sFilters .= $sCondition . "\n";
             $sFilters .= $sAction . "\n";
             $sFilters .= $sEnd . "\n";
         }
         $sFilters = $sFilters . "\n" . '#end sieve filter' . "\n";
         return $this->setFiltersRawData($oAccount, $sFilters);
     }
     return false;
 }
开发者ID:Git-Host,项目名称:email,代码行数:81,代码来源:manager.php


注:本文中的api_Utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。