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


PHP CApi::ExecuteMethod方法代码示例

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


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

示例1: getDigestHash

 public function getDigestHash($sRealm, $sUserName)
 {
     if (class_exists('CApi') && \CApi::IsValid()) {
         /* @var $oApiCapabilityManager \CApiCapabilityManager */
         $oApiCapabilityManager = \CApi::GetSystemManager('capability');
         if ($oApiCapabilityManager) {
             $oAccount = \Afterlogic\DAV\Utils::GetAccountByLogin($sUserName);
             if ($oAccount && $oAccount->IsDisabled) {
                 return null;
             }
             $bIsOutlookSyncClient = \Afterlogic\DAV\Utils::ValidateClient('outlooksync');
             $bIsMobileSync = false;
             $bIsOutlookSync = false;
             $bIsDemo = false;
             if ($oAccount) {
                 $bIsMobileSync = $oApiCapabilityManager->isMobileSyncSupported($oAccount);
                 $bIsOutlookSync = $oApiCapabilityManager->isOutlookSyncSupported($oAccount);
                 \CApi::Plugin()->RunHook('plugin-is-demo-account', array(&$oAccount, &$bIsDemo));
             }
             if ($oAccount && ($bIsMobileSync && !$bIsOutlookSyncClient || $bIsOutlookSync && $bIsOutlookSyncClient) || $bIsDemo || $sUserName === \CApi::ExecuteMethod('Dav::GetPublicUser')) {
                 return md5($sUserName . ':' . $sRealm . ':' . ($bIsDemo ? 'demo' : $oAccount->IncomingMailPassword));
             }
         }
     }
     return null;
 }
开发者ID:afterlogic,项目名称:dav,代码行数:26,代码来源:Digest.php

示例2: loginToAccount

 /**
  * @param string $sEmail
  * @param string $sIncPassword
  * @param string $sIncLogin Default value is empty string.
  * @param string $sLanguage Default value is empty string.
  *
  * @throws CApiManagerException(Errs::WebMailManager_AccountDisabled) 1501
  * @throws CApiManagerException(Errs::Mail_AccountAuthentication) 4002
  * @throws CApiManagerException(Errs::WebMailManager_AccountCreateOnLogin) 1503
  *
  * @return CAccount|null|bool
  */
 public function loginToAccount($sEmail, $sIncPassword, $sIncLogin = '', $sLanguage = '')
 {
     $oResult = null;
     \CApi::AddSecret($sIncPassword);
     /* @var $oApiUsersManager CApiUsersManager */
     $oApiUsersManager = CApi::GetSystemManager('users');
     $bAuthResult = false;
     $oAccount = $oApiUsersManager->getAccountByEmail($sEmail);
     if ($oAccount instanceof CAccount) {
         if ($oAccount->IsDisabled || $oAccount->Domain && $oAccount->Domain->IsDisabled) {
             throw new CApiManagerException(Errs::WebMailManager_AccountDisabled);
         }
         if (0 < $oAccount->IdTenant) {
             $oApiTenantsManager = CApi::GetSystemManager('tenants');
             if ($oApiTenantsManager) {
                 $oTenant = $oApiTenantsManager->getTenantById($oAccount->IdTenant);
                 if ($oTenant && ($oTenant->IsDisabled || 0 < $oTenant->Expared && $oTenant->Expared < \time())) {
                     throw new CApiManagerException(Errs::WebMailManager_AccountDisabled);
                 }
             }
         }
         if (0 < strlen($sLanguage) && $sLanguage !== $oAccount->User->DefaultLanguage) {
             $oAccount->User->DefaultLanguage = $sLanguage;
         }
         if ($oAccount->Domain->AllowWebMail && $oAccount->AllowMail) {
             if ($sIncPassword !== $oAccount->IncomingMailPassword) {
                 $oAccount->IncomingMailPassword = $sIncPassword;
             }
             try {
                 \CApi::ExecuteMethod('Mail::ValidateAccountConnection', array('Account' => $oAccount));
             } catch (Exception $oException) {
                 throw $oException;
             }
         } else {
             if ($sIncPassword !== $oAccount->IncomingMailPassword) {
                 throw new CApiManagerException(Errs::Mail_AccountAuthentication);
             }
         }
         $sObsoleteIncPassword = $oAccount->GetObsoleteValue('IncomingMailPassword');
         $sObsoleteLanguage = $oAccount->User->GetObsoleteValue('DefaultLanguage');
         if (null !== $sObsoleteIncPassword && $sObsoleteIncPassword !== $oAccount->IncomingMailPassword || null !== $sObsoleteLanguage && $sObsoleteLanguage !== $oAccount->User->DefaultLanguage || $oAccount->ForceSaveOnLogin) {
             $oApiUsersManager->updateAccount($oAccount);
         }
         $oApiUsersManager->updateAccountLastLoginAndCount($oAccount->IdUser);
         $oResult = $oAccount;
     } else {
         if (null === $oAccount) {
             $aExtValues = array();
             if (0 < strlen($sIncLogin)) {
                 $aExtValues['Login'] = $sIncLogin;
             }
             $aExtValues['ApiIntegratorLoginToAccountResult'] = $bAuthResult;
             $oAccount = \CApi::ExecuteMethod('Core::CreateAccount', array('Email' => $sEmail, 'Password' => $sIncPassword, 'Language' => $sLanguage, 'ExtValues' => $aExtValues));
             if ($oAccount instanceof CAccount) {
                 $oResult = $oAccount;
             } else {
                 throw new CApiManagerException(Errs::WebMailManager_AccountCreateOnLogin);
             }
         } else {
             $oException = $oApiUsersManager->GetLastException();
             throw is_object($oException) ? $oException : new CApiManagerException(Errs::WebMailManager_AccountCreateOnLogin);
         }
     }
     return $oResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:77,代码来源:manager.php


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