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


PHP api_Utils::GetAccountNameFromEmail方法代码示例

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


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

示例1: AjaxSystemLogin

 /**
  * @return array
  */
 public function AjaxSystemLogin()
 {
     setcookie('aft-cache-ctrl', '', time() - 3600);
     $sEmail = trim((string) $this->getParamValue('Email', ''));
     $sIncLogin = (string) $this->getParamValue('IncLogin', '');
     $sIncPassword = (string) $this->getParamValue('IncPassword', '');
     $sLanguage = (string) $this->getParamValue('Language', '');
     $bSignMe = '1' === (string) $this->getParamValue('SignMe', '0');
     try {
         \CApi::Plugin()->RunHook('webmail-login-custom-data', array($this->getParamValue('CustomRequestData', null)));
     } catch (\Exception $oException) {
         \CApi::LogEvent(\EEvents::LoginFailed, $sEmail);
         throw $oException;
     }
     $oSettings =& \CApi::GetSettings();
     $sAtDomain = trim($oSettings->GetConf('WebMail/LoginAtDomainValue'));
     if ((\ELoginFormType::Email === (int) $oSettings->GetConf('WebMail/LoginFormType') || \ELoginFormType::Both === (int) $oSettings->GetConf('WebMail/LoginFormType')) && 0 === strlen($sAtDomain) && 0 < strlen($sEmail) && !\MailSo\Base\Validator::EmailString($sEmail)) {
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::AuthError);
     }
     if (\ELoginFormType::Login === (int) $oSettings->GetConf('WebMail/LoginFormType') && 0 < strlen($sAtDomain)) {
         $sEmail = \api_Utils::GetAccountNameFromEmail($sIncLogin) . '@' . $sAtDomain;
         $sIncLogin = $sEmail;
     }
     if (0 === strlen($sIncPassword) || 0 === strlen($sEmail . $sIncLogin)) {
         \CApi::LogEvent(\EEvents::LoginFailed, $sEmail);
         \CApi::Log($sEmail, \ELogLevel::Full, 'a-');
         \CApi::Log($sIncLogin, \ELogLevel::Full, 'a-');
         \CApi::Log($sIncPassword, \ELogLevel::Full, 'a-');
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::InvalidInputParameter);
     }
     try {
         if (0 === strlen($sLanguage)) {
             $sLanguage = $this->oApiIntegrator->getLoginLanguage();
         }
         $oAccount = $this->oApiIntegrator->loginToAccount($sEmail, $sIncPassword, $sIncLogin, $sLanguage);
     } 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;
                 case \Errs::Db_ExceptionError:
                     $iErrorCode = \ProjectCore\Notifications::DataBaseError;
                     break;
             }
         }
         \CApi::LogEvent(\EEvents::LoginFailed, $sEmail);
         throw new \ProjectCore\Exceptions\ClientException($iErrorCode, $oException, $oException instanceof \CApiBaseException ? $oException->GetPreviousMessage() : ($oException ? $oException->getMessage() : ''));
     }
     if ($oAccount instanceof \CAccount) {
         $sAuthToken = '';
         $bSetAccountAsLoggedIn = true;
         \CApi::Plugin()->RunHook('api-integrator-set-account-as-logged-in', array(&$bSetAccountAsLoggedIn));
         if ($bSetAccountAsLoggedIn) {
             \CApi::LogEvent(\EEvents::LoginSuccess, $oAccount);
             $sAuthToken = $this->oApiIntegrator->setAccountAsLoggedIn($oAccount, $bSignMe);
         }
         return $this->DefaultResponse($oAccount, __FUNCTION__, array('AuthToken' => $sAuthToken));
     }
     \CApi::LogEvent(\EEvents::LoginFailed, $oAccount);
     throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::AuthError);
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:86,代码来源:Actions.php

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

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

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

示例5: Handle


//.........这里部分代码省略.........
                                                                                                 }
                                                                                                 $mResult = call_user_func(array($this->oActions, $sMethodName));
                                                                                                 $sTemplate = isset($mResult['Template']) && !empty($mResult['Template']) && is_string($mResult['Template']) ? $mResult['Template'] : null;
                                                                                                 if (!empty($sTemplate) && is_array($mResult) && file_exists(PSEVEN_APP_ROOT_PATH . $sTemplate)) {
                                                                                                     $sResult = file_get_contents(PSEVEN_APP_ROOT_PATH . $sTemplate);
                                                                                                     if (is_string($sResult)) {
                                                                                                         $sResult = strtr($sResult, $mResult);
                                                                                                     } else {
                                                                                                         \CApi::Log('Empty template.', \ELogLevel::Error);
                                                                                                     }
                                                                                                 } else {
                                                                                                     if (!empty($sTemplate)) {
                                                                                                         \CApi::Log('Empty template.', \ELogLevel::Error);
                                                                                                     } else {
                                                                                                         if (true === $mResult) {
                                                                                                             $sResult = '';
                                                                                                         } else {
                                                                                                             \CApi::Log('False result.', \ELogLevel::Error);
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             } else {
                                                                                                 \CApi::Log('Invalid action.', \ELogLevel::Error);
                                                                                             }
                                                                                         } else {
                                                                                             \CApi::Log('Empty action.', \ELogLevel::Error);
                                                                                         }
                                                                                     } catch (\Exception $oException) {
                                                                                         \CApi::LogException($oException);
                                                                                     }
                                                                                 } else {
                                                                                     if ('twilio' === $sFirstPart) {
                                                                                         $sResult = $this->oTwilio->Init($aPaths, $this->oHttp);
                                                                                     } else {
                                                                                         if ('plugins' === $sFirstPart) {
                                                                                             $sType = !empty($aPaths[1]) ? trim($aPaths[1]) : '';
                                                                                             if ('js' === $sType) {
                                                                                                 @header('Content-Type: application/javascript; charset=utf-8');
                                                                                                 $sResult = \CApi::Plugin()->CompileJs();
                                                                                             }
                                                                                         } 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)) {
                                                                                                     $oAccount = $oApiIntegrator->LoginToAccount($sEmail, $sPassword, $sLogin);
                                                                                                     if ($oAccount instanceof \CAccount) {
                                                                                                         $oApiIntegrator->SetAccountAsLoggedIn($oAccount);
                                                                                                     }
                                                                                                 }
                                                                                                 \CApi::Location('./');
                                                                                             } else {
                                                                                                 if ('mobile' === $sFirstPart) {
                                                                                                     if ($oApiIntegrator && $oApiCapability && $oApiCapability->IsNotLite()) {
                                                                                                         $oApiIntegrator->SetMobile(true);
                                                                                                     }
                                                                                                     \CApi::Location('./');
                                                                                                 } else {
                                                                                                     @ob_start();
                                                                                                     \CApi::Plugin()->RunServiceHandle($sFirstPart, $aPaths);
                                                                                                     $sResult = @ob_get_clean();
                                                                                                     if (0 === strlen($sResult)) {
                                                                                                         $sResult = $this->getIndexHTML();
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $sResult = $this->getIndexHTML();
     }
     // Output result
     echo $sResult;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:101,代码来源:Service.php


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