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


PHP CApi::MailSoLogger方法代码示例

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


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

示例1: array

 /**
  * Returns ImapClient object from cache.
  * 
  * @param CAccount $oAccount Account object.
  * @param int $iForceConnectTimeOut = 0. The value overrides connection timeout value.
  * @param int $iForceSocketTimeOut = 0. The value overrides socket timeout value.
  *
  * @return \MailSo\Imap\ImapClient|null
  */
 protected function &_getImapClient(CAccount $oAccount, $iForceConnectTimeOut = 0, $iForceSocketTimeOut = 0)
 {
     $oResult = null;
     if ($oAccount) {
         $sCacheKey = $oAccount->Email;
         if (!isset($this->aImapClientCache[$sCacheKey])) {
             $iConnectTimeOut = CApi::GetConf('socket.connect-timeout', 10);
             $iSocketTimeOut = CApi::GetConf('socket.get-timeout', 20);
             $bVerifySsl = !!CApi::GetConf('socket.verify-ssl', false);
             if (0 < $iForceConnectTimeOut) {
                 $iConnectTimeOut = $iForceConnectTimeOut;
             }
             if (0 < $iForceSocketTimeOut) {
                 $iSocketTimeOut = $iForceSocketTimeOut;
             }
             CApi::Plugin()->RunHook('webmail-imap-update-socket-timeouts', array(&$iConnectTimeOut, &$iSocketTimeOut));
             $this->aImapClientCache[$sCacheKey] = \MailSo\Imap\ImapClient::NewInstance();
             $this->aImapClientCache[$sCacheKey]->SetTimeOuts($iConnectTimeOut, $iSocketTimeOut);
             // TODO
             $this->aImapClientCache[$sCacheKey]->SetLogger(\CApi::MailSoLogger());
         }
         $oResult =& $this->aImapClientCache[$sCacheKey];
         if (!$oResult->IsConnected()) {
             $oResult->Connect($oAccount->IncomingMailServer, $oAccount->IncomingMailPort, $oAccount->IncomingMailUseSSL ? \MailSo\Net\Enumerations\ConnectionSecurityType::SSL : \MailSo\Net\Enumerations\ConnectionSecurityType::NONE, $bVerifySsl);
         }
         if (!$oResult->IsLoggined()) {
             $sProxyAuthUser = !empty($oAccount->CustomFields['ProxyAuthUser']) ? $oAccount->CustomFields['ProxyAuthUser'] : '';
             $oResult->Login($oAccount->IncomingMailLogin, $oAccount->IncomingMailPassword, $sProxyAuthUser);
         }
     }
     return $oResult;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:41,代码来源:manager.php

示例2: __construct

 /**
  * @return void
  */
 protected function __construct()
 {
     $this->oModuleManager = \CApi::GetModuleManager();
     //		\MailSo\Config::$FixIconvByMbstring = false;
     \MailSo\Config::$SystemLogger = \CApi::MailSoLogger();
     \MailSo\Config::$PreferStartTlsIfAutoDetect = !!\CApi::GetConf('labs.prefer-starttls', true);
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:10,代码来源:Service.php

示例3: getTestPop3Client

 /**
  * @param CFetcher $oFetcher
  *
  * @return \MailSo\Pop3\Pop3Client|null
  */
 private function getTestPop3Client($oFetcher)
 {
     $oPop3Client = null;
     if ($oFetcher) {
         $oPop3Client = \MailSo\Pop3\Pop3Client::NewInstance();
         $oPop3Client->SetTimeOuts(5, 5);
         $oPop3Client->SetLogger(\CApi::MailSoLogger());
         if (!$oPop3Client->IsConnected()) {
             $oPop3Client->Connect($oFetcher->IncomingMailServer, $oFetcher->IncomingMailPort, $oFetcher->IncomingMailSecurity);
         }
         if (!$oPop3Client->IsLoggined()) {
             $oPop3Client->Login($oFetcher->IncomingMailLogin, $oFetcher->IncomingMailPassword);
         }
     }
     return $oPop3Client;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:21,代码来源:manager.php

示例4: AjaxAccountConfigureMail

 /**
  * @return array
  */
 public function AjaxAccountConfigureMail()
 {
     $mResult = false;
     $oAccount = $this->getDefaultAccountFromParam();
     $this->populateAccountFromHttpPost(true, $oAccount);
     $oAccount->AllowMail = true;
     $iConnectTimeOut = \CApi::GetConf('socket.connect-timeout', 10);
     $iSocketTimeOut = \CApi::GetConf('socket.get-timeout', 20);
     \CApi::Plugin()->RunHook('webmail-imap-update-socket-timeouts', array(&$iConnectTimeOut, &$iSocketTimeOut));
     $aConnectErrors = array(false, false);
     $bConnectValid = false;
     try {
         $oImapClient = \MailSo\Imap\ImapClient::NewInstance();
         $oImapClient->SetTimeOuts($iConnectTimeOut, $iSocketTimeOut);
         $oImapClient->SetLogger(\CApi::MailSoLogger());
         $oImapClient->Connect($oAccount->IncomingMailServer, $oAccount->IncomingMailPort, $oAccount->IncomingMailUseSSL ? \MailSo\Net\Enumerations\ConnectionSecurityType::SSL : \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
         $aConnectErrors[0] = true;
         $sProxyAuthUser = !empty($oAccount->CustomFields['ProxyAuthUser']) ? $oAccount->CustomFields['ProxyAuthUser'] : '';
         $oImapClient->Login($oAccount->IncomingMailLogin, $oAccount->IncomingMailPassword, $sProxyAuthUser);
         $aConnectErrors[1] = true;
         $bConnectValid = true;
         $oImapClient->LogoutAndDisconnect();
     } catch (\Exception $oExceprion) {
     }
     if ($bConnectValid) {
         if ($this->oApiUsers->updateAccount($oAccount)) {
             $mResult = true;
         } else {
             $iClientErrorCode = \ProjectCore\Notifications::CanNotCreateAccount;
             $oException = $this->oApiUsers->GetLastException();
             if ($oException) {
                 switch ($oException->getCode()) {
                     case \Errs::WebMailManager_AccountDisabled:
                     case \Errs::UserManager_AccountAuthenticationFailed:
                     case \Errs::WebMailManager_AccountAuthentication:
                     case \Errs::WebMailManager_NewUserRegistrationDisabled:
                     case \Errs::WebMailManager_AccountWebmailDisabled:
                         $iClientErrorCode = \ProjectCore\Notifications::AuthError;
                         break;
                     case \Errs::UserManager_AccountConnectToMailServerFailed:
                     case \Errs::WebMailManager_AccountConnectToMailServerFailed:
                         $iClientErrorCode = \ProjectCore\Notifications::MailServerError;
                         break;
                     case \Errs::UserManager_LicenseKeyInvalid:
                     case \Errs::UserManager_AccountCreateUserLimitReached:
                     case \Errs::UserManager_LicenseKeyIsOutdated:
                         $iClientErrorCode = \ProjectCore\Notifications::LicenseProblem;
                         break;
                     case \Errs::Db_ExceptionError:
                         $iClientErrorCode = \ProjectCore\Notifications::DataBaseError;
                         break;
                 }
             }
             return $this->FalseResponse($oAccount, __FUNCTION__, $iClientErrorCode);
         }
     } else {
         if ($aConnectErrors[0]) {
             throw new \CApiManagerException(\Errs::UserManager_AccountAuthenticationFailed);
         } else {
             throw new \CApiManagerException(\Errs::UserManager_AccountConnectToMailServerFailed);
         }
     }
     if ($mResult && $oAccount) {
         $aExtensions = $oAccount->getExtensionList();
         $mResult = array('IdAccount' => $oAccount->IdAccount, 'Extensions' => $aExtensions);
     } else {
         $mResult = false;
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $mResult);
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:73,代码来源:Actions.php

示例5: _getSieveDriver

 /**
  * @param CAccount $oAccount
  * @return \MailSo\Sieve\ManageSieveClient|false
  */
 protected function _getSieveDriver(CAccount $oAccount)
 {
     $oSieve = false;
     if ($oAccount instanceof CAccount) {
         if (!isset($this->aSieves[$oAccount->Email])) {
             $oSieve = \MailSo\Sieve\ManageSieveClient::NewInstance();
             $oSieve->SetLogger(\CApi::MailSoLogger());
             $this->aSieves[$oAccount->Email] = $oSieve;
         } else {
             $oSieve = $this->aSieves[$oAccount->Email];
         }
     }
     return $oSieve;
 }
开发者ID:Git-Host,项目名称:email,代码行数:18,代码来源:manager.php

示例6: Handle

 /**
  * @return void
  */
 public function Handle()
 {
     $sVersion = file_get_contents(PSEVEN_APP_ROOT_PATH . 'VERSION');
     define('PSEVEN_APP_VERSION', $sVersion);
     if (!class_exists('MailSo\\Version')) {
         echo 'MailSo';
         return '';
     } else {
         if (!class_exists('\\CApi') || !\CApi::IsValid()) {
             echo 'AfterLogic API';
             return '';
         }
     }
     $sPathInfo = \trim(\trim($this->oHttp->GetServer('PATH_INFO', '')), ' /');
     if (!empty($sPathInfo)) {
         if ('dav' === \substr($sPathInfo, 0, 3)) {
             $this->oActions->PathInfoDav();
             return '';
         }
     }
     /* @var $oApiIntegrator \CApiIntegratorManager */
     $oApiIntegrator = \CApi::Manager('integrator');
     // ------ Redirect to HTTPS
     $oSettings =& \CApi::GetSettings();
     $bRedirectToHttps = $oSettings->GetConf('Common/RedirectToHttps');
     $bHttps = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== "off" || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == "443";
     if ($bRedirectToHttps && !$bHttps) {
         header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     }
     // ------
     /* @var $oApiCapability \CApiCapabilityManager */
     $oApiCapability = \CApi::Manager('capability');
     $sResult = '';
     $sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
     \CApi::Plugin()->RunQueryHandle($sQuery);
     $iPos = \strpos($sQuery, '&');
     if (0 < $iPos) {
         $sQuery = \substr($sQuery, 0, $iPos);
     }
     $aPaths = explode('/', $sQuery);
     if (0 < count($aPaths) && !empty($aPaths[0])) {
         $sFirstPart = strtolower($aPaths[0]);
         if ('ping' === $sFirstPart) {
             @header('Content-Type: text/plain; charset=utf-8');
             $sResult = 'Pong';
         } else {
             if ('pull' === $sFirstPart) {
                 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                     pclose(popen("start /B git pull", "r"));
                 } else {
                     exec("git pull > /dev/null 2>&1 &");
                 }
                 \CApi::Location('./');
             } else {
                 if ('ajax' === $sFirstPart) {
                     @ob_start();
                     $aResponseItem = null;
                     $sAction = $this->oHttp->GetPost('Action', null);
                     try {
                         \CApi::Log('AJAX: Action: ' . $sAction);
                         if ('SystemGetAppData' !== $sAction && \CApi::GetConf('labs.webmail.csrftoken-protection', true) && !$this->validateToken()) {
                             throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::InvalidToken);
                         } else {
                             if (!empty($sAction)) {
                                 $sMethodName = 'Ajax' . $sAction;
                                 $this->oActions->SetActionParams($this->oHttp->GetPostAsArray());
                                 if (method_exists($this->oActions, $sMethodName) && is_callable(array($this->oActions, $sMethodName))) {
                                     $aResponseItem = call_user_func(array($this->oActions, $sMethodName));
                                 }
                                 if (\CApi::Plugin()->JsonHookExists($sMethodName)) {
                                     $aResponseItem = \CApi::Plugin()->RunJsonHook($this->oActions, $sMethodName, $aResponseItem);
                                 }
                             }
                         }
                         if (!is_array($aResponseItem)) {
                             throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::UnknownError);
                         }
                     } catch (\Exception $oException) {
                         //if ($oException instanceof \ProjectCore\Exceptions\ClientException &&
                         //	\ProjectCore\Notifications::AuthError === $oException->getCode())
                         //{
                         //	$oApiIntegrator = /* @var $oApiIntegrator \CApiIntegratorManager */ \CApi::Manager('integrator');
                         //	$oApiIntegrator->setLastErrorCode(\ProjectCore\Notifications::AuthError);
                         //	$oApiIntegrator->logoutAccount();
                         //}
                         \CApi::LogException($oException);
                         $sAction = empty($sAction) ? 'Unknown' : $sAction;
                         $aAdditionalParams = null;
                         if ($oException instanceof \ProjectCore\Exceptions\ClientException) {
                             $aAdditionalParams = $oException->GetObjectParams();
                         }
                         $aResponseItem = $this->oActions->ExceptionResponse(null, $sAction, $oException, $aAdditionalParams);
                     }
                     @header('Content-Type: application/json; charset=utf-8');
                     \CApi::Plugin()->RunHook('ajax.response-result', array($sAction, &$aResponseItem));
                     $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, \CApi::MailSoLogger());
                     //				\CApi::Log('AJAX: Response: '.$sResult);
//.........这里部分代码省略.........
开发者ID:zhuomingliang,项目名称:webmail-lite,代码行数:101,代码来源:Service.php

示例7: createAccount

 /**
  * Creates WebMail account. In most cases, using simpler loginToAccount wrapper is recommended.
  * 
  * @api
  * 
  * @param CAccount &$oAccount Object instance with prepopulated account properties.
  * @param bool $bWithMailConnection Default value is **true**. Defines whether account credentials should be verified against mail server.
  * 
  * @return bool
  */
 public function createAccount(CAccount &$oAccount, $bWithMailConnection = true)
 {
     $bResult = false;
     try {
         if ($oAccount->isValid()) {
             if (!$this->accountExists($oAccount)) {
                 /* @var $oApiLicensingManager CApiLicensingManager */
                 $oApiLicensingManager = CApi::Manager('licensing');
                 if ($oApiLicensingManager) {
                     $isValidKey = $oApiLicensingManager->IsValidKey();
                     if (!$isValidKey && in_array($oApiLicensingManager->GetLicenseType(), array(11, 13, 14))) {
                         throw new CApiManagerException(Errs::UserManager_LicenseKeyIsOutdated);
                     } else {
                         if (!$isValidKey) {
                             throw new CApiManagerException(Errs::UserManager_LicenseKeyInvalid);
                         }
                     }
                     if ($oAccount->IsDefaultAccount && !$oApiLicensingManager->IsValidLimit(true)) {
                         throw new CApiManagerException(Errs::UserManager_AccountCreateUserLimitReached);
                     }
                 }
                 if (0 < $oAccount->Domain->IdTenant && CApi::GetConf('tenant', false)) {
                     /* @var $oTenantsApi CApiTenantsManager */
                     $oTenantsApi = CApi::Manager('tenants');
                     if ($oTenantsApi) {
                         /* @var $oTenant CTenant */
                         $oTenant = $oTenantsApi->getTenantById($oAccount->Domain->IdTenant);
                         if (!$oTenant) {
                             throw new CApiManagerException(Errs::TenantsManager_TenantDoesNotExist);
                         } else {
                             if (0 < $oTenant->UserCountLimit && $oTenant->UserCountLimit <= $oTenant->getUserCount()) {
                                 throw new CApiManagerException(Errs::TenantsManager_AccountCreateUserLimitReached);
                             }
                             $this->_validateAccountSubscriptionLimits($oAccount, $oTenant, true);
                         }
                         if (0 < $oTenant->QuotaInMB) {
                             $iSize = $oTenantsApi->getTenantAllocatedSize($oTenant->IdTenant);
                             if ((int) ($oAccount->getRealQuotaSize() / 1024) + $iSize > $oTenant->QuotaInMB) {
                                 throw new CApiManagerException(Errs::TenantsManager_QuotaLimitExided);
                             }
                         }
                     }
                 }
                 $bConnectValid = true;
                 $aConnectErrors = array(false, false);
                 if ($bWithMailConnection && !$oAccount->IsMailingList && !$oAccount->IsInternal && !$oAccount->Domain->IsDefaultTenantDomain) {
                     $bConnectValid = false;
                     $iConnectTimeOut = CApi::GetConf('socket.connect-timeout', 10);
                     $iSocketTimeOut = CApi::GetConf('socket.get-timeout', 20);
                     CApi::Plugin()->RunHook('webmail-imap-update-socket-timeouts', array(&$iConnectTimeOut, &$iSocketTimeOut));
                     try {
                         $oImapClient = \MailSo\Imap\ImapClient::NewInstance();
                         $oImapClient->SetTimeOuts($iConnectTimeOut, $iSocketTimeOut);
                         $oImapClient->SetLogger(\CApi::MailSoLogger());
                         $oImapClient->Connect($oAccount->IncomingMailServer, $oAccount->IncomingMailPort, $oAccount->IncomingMailUseSSL ? \MailSo\Net\Enumerations\ConnectionSecurityType::SSL : \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
                         $aConnectErrors[0] = true;
                         $sProxyAuthUser = !empty($oAccount->CustomFields['ProxyAuthUser']) ? $oAccount->CustomFields['ProxyAuthUser'] : '';
                         $oImapClient->Login($oAccount->IncomingMailLogin, $oAccount->IncomingMailPassword, $sProxyAuthUser);
                         $aConnectErrors[1] = true;
                         $bConnectValid = true;
                         $oImapClient->LogoutAndDisconnect();
                     } catch (\Exception $oExceprion) {
                     }
                 }
                 if ($bConnectValid) {
                     if (!$this->oStorage->createAccount($oAccount)) {
                         throw new CApiManagerException(Errs::UserManager_AccountCreateFailed);
                     }
                     if ($oAccount && $oAccount->IsDefaultAccount) {
                         /* @var $oApiContactsManager CApiContactsManager */
                         $oApiContactsManager = CApi::Manager('contactsmain');
                         if ($oApiContactsManager && 'db' === CApi::GetManager()->GetStorageByType('contactsmain')) {
                             $oContact = $oApiContactsManager->createContactObject();
                             $oContact->BusinessEmail = $oAccount->Email;
                             $oContact->PrimaryEmail = EPrimaryEmailType::Business;
                             $oContact->FullName = $oAccount->FriendlyName;
                             $oContact->Type = EContactType::GlobalAccounts;
                             $oContact->IdTypeLink = $oAccount->IdUser;
                             $oContact->IdDomain = 0 < $oAccount->IdDomain ? $oAccount->IdDomain : 0;
                             $oContact->IdTenant = $oAccount->Domain ? $oAccount->Domain->IdTenant : 0;
                             $oApiContactsManager->createContact($oContact);
                         }
                     }
                     CApi::Plugin()->RunHook('statistics.signup', array(&$oAccount));
                 } else {
                     if ($aConnectErrors[0]) {
                         throw new CApiManagerException(Errs::UserManager_AccountAuthenticationFailed);
                     } else {
                         throw new CApiManagerException(Errs::UserManager_AccountConnectToMailServerFailed);
                     }
//.........这里部分代码省略.........
开发者ID:Git-Host,项目名称:email,代码行数:101,代码来源:manager.php

示例8: Handle

 /**
  * @return void
  */
 public function Handle()
 {
     $sVersion = file_get_contents(PSEVEN_APP_ROOT_PATH . 'VERSION');
     define('PSEVEN_APP_VERSION', $sVersion);
     if (!class_exists('MailSo\\Version')) {
         echo 'MailSo';
         return '';
     } else {
         if (!class_exists('\\CApi') || !\CApi::IsValid()) {
             echo 'AfterLogic API';
             return '';
         }
     }
     $sPathInfo = \trim(\trim($this->oHttp->GetServer('PATH_INFO', '')), ' /');
     if (!empty($sPathInfo)) {
         if ('dav' === \substr($sPathInfo, 0, 3)) {
             $this->oActions->PathInfoDav();
             return '';
         }
     }
     /* @var $oApiIntegrator \CApiIntegratorManager */
     $oApiIntegrator = \CApi::Manager('integrator');
     /* @var $oApiCapability \CApiCapabilityManager */
     $oApiCapability = \CApi::Manager('capability');
     $sResult = '';
     $sQuery = \trim(\trim($this->oHttp->GetServer('QUERY_STRING', '')), ' /');
     $iPos = \strpos($sQuery, '&');
     if (0 < $iPos) {
         $sQuery = \substr($sQuery, 0, $iPos);
     }
     $aPaths = explode('/', $sQuery);
     if (0 < count($aPaths) && !empty($aPaths[0])) {
         $sFirstPart = strtolower($aPaths[0]);
         if ('ping' === $sFirstPart) {
             @header('Content-Type: text/plain; charset=utf-8');
             $sResult = 'Pong';
         } else {
             if ('ajax' === $sFirstPart) {
                 @ob_start();
                 $aResponseItem = null;
                 $sAction = $this->oHttp->GetPost('Action', null);
                 try {
                     \CApi::Log('AJAX: Action: ' . $sAction);
                     if ('AppData' !== $sAction && \CApi::GetConf('labs.webmail.csrftoken-protection', true) && !$this->validateToken()) {
                         throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::InvalidToken);
                     } else {
                         if (!empty($sAction)) {
                             $sMethodName = 'Ajax' . $sAction;
                             if (method_exists($this->oActions, $sMethodName) && is_callable(array($this->oActions, $sMethodName))) {
                                 $this->oActions->SetActionParams($this->oHttp->GetPostAsArray());
                                 $aResponseItem = call_user_func(array($this->oActions, $sMethodName));
                             } else {
                                 if (\CApi::Plugin()->JsonHookExists($sMethodName)) {
                                     $this->oActions->SetActionParams($this->oHttp->GetPostAsArray());
                                     $aResponseItem = \CApi::Plugin()->RunJsonHook($this->oActions, $sMethodName);
                                 }
                             }
                         }
                     }
                     if (!is_array($aResponseItem)) {
                         throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::UnknownError);
                     }
                 } catch (\Exception $oException) {
                     //					if ($oException instanceof \ProjectSeven\Exceptions\ClientException &&
                     //						\ProjectSeven\Notifications::AuthError === $oException->getCode())
                     //					{
                     //						$oApiIntegrator = /* @var $oApiIntegrator \CApiIntegratorManager */ \CApi::Manager('integrator');
                     //						$oApiIntegrator->SetLastErrorCode(\ProjectSeven\Notifications::AuthError);
                     //						$oApiIntegrator->LogoutAccount();
                     //					}
                     \CApi::LogException($oException);
                     $sAction = empty($sAction) ? 'Unknown' : $sAction;
                     $aResponseItem = $this->oActions->ExceptionResponse(null, $sAction, $oException);
                 }
                 @header('Content-Type: application/json; charset=utf-8');
                 \CApi::Plugin()->RunHook('ajax.response-result', array($sAction, &$aResponseItem));
                 $sResult = \MailSo\Base\Utils::Php2js($aResponseItem, \CApi::MailSoLogger());
                 //				\CApi::Log('AJAX: Response: '.$sResult);
             } else {
                 if ('upload' === $sFirstPart) {
                     @ob_start();
                     $aResponseItem = null;
                     $sAction = empty($aPaths[1]) ? '' : $aPaths[1];
                     try {
                         $sMethodName = 'Upload' . $sAction;
                         if (method_exists($this->oActions, $sMethodName) && is_callable(array($this->oActions, $sMethodName))) {
                             $sError = '';
                             $sInputName = 'jua-uploader';
                             $iError = UPLOAD_ERR_OK;
                             $_FILES = isset($_FILES) ? $_FILES : null;
                             if (isset($_FILES, $_FILES[$sInputName], $_FILES[$sInputName]['name'], $_FILES[$sInputName]['tmp_name'], $_FILES[$sInputName]['size'], $_FILES[$sInputName]['type'])) {
                                 $iError = isset($_FILES[$sInputName]['error']) ? (int) $_FILES[$sInputName]['error'] : UPLOAD_ERR_OK;
                                 if (UPLOAD_ERR_OK === $iError) {
                                     $this->oActions->SetActionParams(array('AccountID' => $this->oHttp->GetPost('AccountID', ''), 'FileData' => $_FILES[$sInputName], 'AdditionalData' => $this->oHttp->GetPost('AdditionalData', null), 'IsExt' => '1' === (string) $this->oHttp->GetPost('IsExt', '0') ? '1' : '0', 'TenantHash' => (string) $this->oHttp->GetPost('TenantHash', ''), 'Token' => $this->oHttp->GetPost('Token', '')));
                                     \CApi::LogObject($this->oActions->GetActionParams());
                                     $aResponseItem = call_user_func(array($this->oActions, $sMethodName));
                                 } else {
//.........这里部分代码省略.........
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:101,代码来源:Service.php

示例9: EntryApi

 /**
  * 
  * @return string
  * @throws \System\Exceptions\AuroraApiException
  */
 public function EntryApi()
 {
     @ob_start();
     $aResponseItem = null;
     $sModule = $this->oHttp->GetPost('Module', null);
     $sMethod = $this->oHttp->GetPost('Method', null);
     $sParameters = $this->oHttp->GetPost('Parameters', null);
     $sFormat = $this->oHttp->GetPost('Format', null);
     try {
         if (isset($sModule, $sMethod)) {
             if (strtolower($sModule) === strtolower($this->GetName())) {
                 \CApi::Log('API:');
                 \CApi::Log('Module: ' . $sModule);
                 \CApi::Log('Method: ' . $sMethod);
                 if (strtolower($sModule) !== 'core' && \CApi::GetConf('labs.webmail.csrftoken-protection', true) && !\CApi::validateAuthToken()) {
                     throw new \System\Exceptions\AuroraApiException(\System\Notifications::InvalidToken);
                 } else {
                     if (!empty($sModule) && !empty($sMethod)) {
                         $aParameters = isset($sParameters) && is_string($sParameters) ? @json_decode($sParameters, true) : array();
                         $sTenantName = $this->oHttp->GetPost('TenantName', '');
                         \CApi::setTenantName($sTenantName);
                         if (!is_array($aParameters)) {
                             $aParameters = array($aParameters);
                         }
                         $mUploadData = $this->getUploadData();
                         if (is_array($mUploadData)) {
                             $aParameters['UploadData'] = $mUploadData;
                         }
                         $this->CallMethod($sMethod, $aParameters, true);
                         $aResponseItem = $this->DefaultResponse($sMethod, \CApi::GetModuleManager()->GetResults());
                     }
                 }
                 if (!is_array($aResponseItem)) {
                     throw new \System\Exceptions\AuroraApiException(\System\Notifications::UnknownError);
                 }
                 if ($sFormat !== 'Raw') {
                     @header('Content-Type: application/json; charset=utf-8');
                 }
             }
         } else {
             throw new \System\Exceptions\AuroraApiException(\System\Notifications::InvalidInputParameter);
         }
     } catch (\Exception $oException) {
         \CApi::LogException($oException);
         $aAdditionalParams = null;
         if ($oException instanceof \System\Exceptions\AuroraApiException) {
             $aAdditionalParams = $oException->GetObjectParams();
         }
         $aResponseItem = $this->ExceptionResponse($sMethod, $oException, $aAdditionalParams);
     }
     return \MailSo\Base\Utils::Php2js($aResponseItem, \CApi::MailSoLogger());
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:57,代码来源:module.php


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