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


PHP api_Utils::GetDomainFromEmail方法代码示例

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


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

示例1: 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

示例2: CreateAccountProcess

 /**
  * @param string $sEmail
  * @param string $sPassword
  * @param string $sChangeLang = ''
  * @param array $aExtValues = null
  * @param bool $bAllowInternalOnly = false
  * @return CAccount | false
  */
 public function CreateAccountProcess($sEmail, $sPassword, $sChangeLang = '', $aExtValues = null, $bAllowInternalOnly = false)
 {
     $mResult = false;
     try {
         /* @var $oApiDomainsManager CApiDomainsManager */
         $oApiDomainsManager = CApi::Manager('domains');
         /* @var $oApiUsersManager CApiUsersManager */
         $oApiUsersManager = CApi::Manager('users');
         $sDomainName = api_Utils::GetDomainFromEmail($sEmail);
         $oDomain = $oApiDomainsManager->GetDomainByName($sDomainName);
         if (!$oDomain) {
             $oDomain = $oApiDomainsManager->GetDefaultDomain();
         }
         $bApiIntegratorLoginToAccountResult = isset($aExtValues['ApiIntegratorLoginToAccountResult']) ? $aExtValues['ApiIntegratorLoginToAccountResult'] : false;
         if ($oDomain && ($bApiIntegratorLoginToAccountResult || $oDomain->AllowNewUsersRegister || $oDomain->IsInternal && $bAllowInternalOnly || 'nodb' === CApi::GetManager()->GetStorageByType('webmail'))) {
             /*if ($oDomain && !$oDomain->AllowWebMail)
             		{
             			throw new CApiManagerException(Errs::WebMailManager_AccountWebmailDisabled);
             		}
             		else */
             if ($oDomain && $oDomain->IsInternal && !$bAllowInternalOnly) {
                 throw new CApiManagerException(Errs::WebMailManager_NewUserRegistrationDisabled);
             } else {
                 if ($oDomain && $bAllowInternalOnly && (!$oDomain->IsInternal || $oDomain->IsDefaultDomain)) {
                     throw new CApiManagerException(Errs::WebMailManager_NewUserRegistrationDisabled);
                 } else {
                     if ($oDomain) {
                         $oAccountToCreate = new CAccount($oDomain);
                         $oAccountToCreate->Email = $sEmail;
                         //					$oAccountToCreate->IncomingMailLogin = (isset($aExtValues['Login'])) ? $aExtValues['Login'] :
                         //						(($this->oSettings->GetConf('WebMail/UseLoginWithoutDomain'))
                         //							? api_Utils::GetAccountNameFromEmail($sEmail) : $sEmail);
                         $oAccountToCreate->IncomingMailLogin = isset($aExtValues['Login']) ? $aExtValues['Login'] : $sEmail;
                         if ($this->oSettings->GetConf('WebMail/UseLoginWithoutDomain')) {
                             $oAccountToCreate->IncomingMailLogin = api_Utils::GetAccountNameFromEmail($oAccountToCreate->IncomingMailLogin);
                         }
                         $oAccountToCreate->IncomingMailPassword = $sPassword;
                         if (0 < strlen($sChangeLang) && $sChangeLang !== $oAccountToCreate->User->DefaultLanguage) {
                             $oAccountToCreate->User->DefaultLanguage = $sChangeLang;
                         }
                         if ($oDomain->IsDefaultDomain && isset($aExtValues['IncProtocol'], $aExtValues['IncHost'], $aExtValues['IncPort'], $aExtValues['OutHost'], $aExtValues['OutPort'], $aExtValues['OutAuth'])) {
                             $oAccountToCreate->IncomingMailProtocol = (int) $aExtValues['IncProtocol'];
                             $oAccountToCreate->IncomingMailServer = trim($aExtValues['IncHost']);
                             $oAccountToCreate->IncomingMailPort = (int) trim($aExtValues['IncPort']);
                             $oAccountToCreate->OutgoingMailServer = trim($aExtValues['OutHost']);
                             $oAccountToCreate->OutgoingMailPort = (int) trim($aExtValues['OutPort']);
                             $oAccountToCreate->OutgoingMailAuth = (bool) $aExtValues['OutAuth'] ? ESMTPAuthType::AuthCurrentUser : ESMTPAuthType::NoAuth;
                             // TODO
                             $oAccountToCreate->IncomingMailUseSSL = in_array($oAccountToCreate->IncomingMailPort, array(993, 995));
                             $oAccountToCreate->OutgoingMailUseSSL = in_array($oAccountToCreate->OutgoingMailPort, array(465));
                         }
                         CApi::Plugin()->RunHook('api-pre-create-account-process-call', array(&$oAccountToCreate));
                         if (isset($aExtValues['FriendlyName'])) {
                             $oAccountToCreate->FriendlyName = $aExtValues['FriendlyName'];
                         }
                         if (isset($aExtValues['Question1'])) {
                             $oAccountToCreate->User->Question1 = $aExtValues['Question1'];
                         }
                         if (isset($aExtValues['Question2'])) {
                             $oAccountToCreate->User->Question2 = $aExtValues['Question2'];
                         }
                         if (isset($aExtValues['Answer1'])) {
                             $oAccountToCreate->User->Answer1 = $aExtValues['Answer1'];
                         }
                         if (isset($aExtValues['Answer2'])) {
                             $oAccountToCreate->User->Answer2 = $aExtValues['Answer2'];
                         }
                         if ($oApiUsersManager->CreateAccount($oAccountToCreate, !($oAccountToCreate->IsInternal || !$oAccountToCreate->Domain->AllowWebMail || $bApiIntegratorLoginToAccountResult))) {
                             CApi::Plugin()->RunHook('api-success-post-create-account-process-call', array(&$oAccountToCreate));
                             $mResult = $oAccountToCreate;
                         } else {
                             $oException = $oApiUsersManager->GetLastException();
                             CApi::Plugin()->RunHook('api-error-post-create-account-process-call', array(&$oAccountToCreate, &$oException));
                             throw is_object($oException) ? $oException : new CApiManagerException(Errs::WebMailManager_AccountCreateOnLogin);
                         }
                     } else {
                         throw new CApiManagerException(Errs::WebMailManager_DomainDoesNotExist);
                     }
                 }
             }
         } else {
             throw new CApiManagerException(Errs::WebMailManager_NewUserRegistrationDisabled);
         }
     } catch (CApiBaseException $oException) {
         $mResult = false;
         $this->setLastException($oException);
     }
     return $mResult;
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:97,代码来源:manager.php

示例3: isset

 $sEmail = isset($aInputData['email']) ? trim($aInputData['email']) : '';
 $sPassword = isset($aInputData['password']) ? trim($aInputData['password']) : '';
 $sParent = isset($aInputData['parent']) ? trim($aInputData['parent']) : '';
 $sFriendlyName = isset($aInputData['friendlyName']) ? trim($aInputData['friendlyName']) : '';
 $sIncomingMailLogin = isset($aInputData['incomingMailLogin']) ? trim($aInputData['incomingMailLogin']) : $sEmail;
 $sIncomingMailServer = isset($aInputData['incomingMailServer']) ? trim($aInputData['incomingMailServer']) : $oDefaultDomain->IncomingMailServer;
 $iIncomingMailPort = isset($aInputData['incomingMailPort']) ? (int) trim($aInputData['incomingMailPort']) : $oDefaultDomain->IncomingMailPort;
 $iIncomingMailUseSSL = isset($aInputData['incomingMailUseSSL']) ? (int) trim($aInputData['incomingMailUseSSL']) : $oDefaultDomain->IncomingMailUseSSL;
 $sOutgoingMailLogin = isset($aInputData['outgoingMailLogin']) ? trim($aInputData['outgoingMailLogin']) : '';
 $sOutgoingMailServer = isset($aInputData['outgoingMailServer']) ? trim($aInputData['outgoingMailServer']) : $oDefaultDomain->OutgoingMailServer;
 $iOutgoingMailPort = isset($aInputData['outgoingMailPort']) ? (int) trim($aInputData['outgoingMailPort']) : $oDefaultDomain->OutgoingMailPort;
 $iOutgoingMailUseSSL = isset($aInputData['outgoingMailUseSSL']) ? (int) trim($aInputData['outgoingMailUseSSL']) : $oDefaultDomain->OutgoingMailUseSSL;
 $iOutgoingMailAuth = isset($aInputData['outgoingMailAuth']) && $aInputData['outgoingMailAuth'] ? \ESMTPAuthType::AuthCurrentUser : $oDefaultDomain->OutgoingMailAuth;
 $sOutgoingMailPassword = isset($aInputData['outgoingMailPassword']) ? trim($aInputData['outgoingMailPassword']) : $oDefaultDomain->OutgoingMailPassword;
 if (strlen($sEmail) > 0 && strlen($sPassword) > 0 && $oApiUsersManager && $oApiDomainsManager) {
     $sDomainName = api_Utils::GetDomainFromEmail($sEmail);
     $oDomain = $oApiDomainsManager->GetDomainByName($sDomainName);
     if (!$iAuthTenantId || $oDomain && $oDomain->IdTenant === $iAuthTenantId) {
         $oAccount = new CAccount($oDomain ? $oDomain : $oDefaultDomain);
         if (strlen($sParent) > 0) {
             $oParentAccount = $oApiUsersManager->GetAccountOnLogin($sParent);
             $oAccount->IdUser = $oParentAccount->IdUser;
         }
         $oAccount->IsDefaultAccount = strlen($sParent) > 0 ? false : true;
         $oAccount->Email = $sEmail;
         $oAccount->IncomingMailPassword = $sPassword;
         $oAccount->FriendlyName = $sFriendlyName;
         $oAccount->IncomingMailLogin = $oDomain ? $sEmail : $sIncomingMailLogin;
         $oAccount->IncomingMailServer = $oDomain ? $oDomain->IncomingMailServer : $sIncomingMailServer;
         $oAccount->IncomingMailPort = $oDomain ? $oDomain->IncomingMailPort : $iIncomingMailPort;
         $oAccount->IncomingMailUseSSL = $oDomain ? $oDomain->IncomingMailUseSSL : $iIncomingMailUseSSL;
开发者ID:BertLasker,项目名称:Catch-design,代码行数:31,代码来源:rest.php


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