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


PHP CApi::LogException方法代码示例

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


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

示例1: AjaxTwilioGetToken

 /**
  * @return array
  */
 public function AjaxTwilioGetToken()
 {
     $oAccount = $this->getAccountFromParam();
     $oTenant = null;
     if ($this->oApiTenants) {
         $oTenant = 0 < $oAccount->IdTenant ? $this->oApiTenants->getTenantById($oAccount->IdTenant) : $this->oApiTenants->getDefaultGlobalTenant();
     }
     $mToken = false;
     if ($oTenant && $this->oApiCapability->isTwilioSupported($oAccount) && $oTenant->isTwilioSupported() && $oTenant->TwilioAllow && $oAccount->User->TwilioEnable && file_exists(PSEVEN_APP_ROOT_PATH . 'libraries/Services/Twilio.php')) {
         try {
             include PSEVEN_APP_ROOT_PATH . 'libraries/Services/Twilio.php';
             // Twilio API credentials
             $sAccountSid = $oTenant->TwilioAccountSID;
             $sAuthToken = $oTenant->TwilioAuthToken;
             // Twilio Application Sid
             $sAppSid = $oTenant->TwilioAppSID;
             $sTwilioPhoneNumber = $oTenant->TwilioPhoneNumber;
             $bUserTwilioEnable = $oAccount->User->TwilioEnable;
             $sUserPhoneNumber = $oAccount->User->TwilioNumber;
             $bUserDefaultNumber = $oAccount->User->TwilioDefaultNumber;
             $oCapability = new \Services_Twilio_Capability($sAccountSid, $sAuthToken);
             $oCapability->allowClientOutgoing($sAppSid);
             \CApi::Log('twilio_debug');
             \CApi::Log('twilio_account_sid-' . $sAccountSid);
             \CApi::Log('twilio_auth_token-' . $sAuthToken);
             \CApi::Log('twilio_app_sid-' . $sAppSid);
             \CApi::Log('twilio_enable-' . $bUserTwilioEnable ? 'true' : 'false');
             \CApi::Log('twilio_user_default_number-' . ($bUserDefaultNumber ? 'true' : 'false'));
             \CApi::Log('twilio_number-' . $sTwilioPhoneNumber);
             \CApi::Log('twilio_user_number-' . $sUserPhoneNumber);
             \CApi::Log('twilio_debug_end');
             //$oCapability->allowClientIncoming('TwilioAftId_'.$oAccount->IdTenant.'_'.$oAccount->User->TwilioNumber);
             if ($bUserTwilioEnable) {
                 if ($bUserDefaultNumber) {
                     $oCapability->allowClientIncoming(strlen($sUserPhoneNumber) > 0 ? $sUserPhoneNumber : 'default');
                 } else {
                     if (strlen($sUserPhoneNumber) > 0) {
                         $oCapability->allowClientIncoming($sUserPhoneNumber);
                     }
                 }
             }
             $mToken = $oCapability->generateToken(86400000);
             //Token lifetime set to 24hr (default 1hr)
         } catch (\Exception $oE) {
             \CApi::LogException($oE);
         }
     } else {
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::VoiceNotAllowed);
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $mToken);
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:54,代码来源:Actions.php

示例2: GetLastInsertId

 /**
  * @param string $sTableName = null
  * @param string $sFieldName = null
  * @return int
  */
 public function GetLastInsertId($sTableName = null, $sFieldName = null)
 {
     try {
         $sName = null;
         if (null !== $sTableName && null !== $sFieldName) {
             $sName = $this->sDbTablePrefix . $sTableName . '_' . $sFieldName . '_seq';
         }
         return (int) ($sName ? $this->oPDO->lastInsertId($sName) : $this->oPDO->lastInsertId());
     } catch (Exception $e) {
         CApi::LogException($e);
     }
     return 0;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:18,代码来源:postgres.php

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

示例4: GetLastInsertId

	/**
	 * @param string $sTableName = null
	 * @param string $sFieldName = null
	 * @return int
	 */
	public function GetLastInsertId($sTableName = null, $sFieldName = null)
	{
		try
		{
			return (int) $this->oPDO->lastInsertId();
		}
		catch( Exception $e)
		{
			CApi::LogException($e);
		}
		
		return 0;
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:18,代码来源:mysql.php

示例5: sendMessage

 /**
  *
  * @param CAccount $oAccount
  * @param string $sSubject
  * @param string $sEventName
  * @param string $sDate
  * @param string $sCalendarName
  * @param string $sEventText
  * @param string $sCalendarColor
  *
  * @return bool
  */
 private function sendMessage($oAccount, $sSubject, $sEventName, $sDate, $sCalendarName, $sEventText, $sCalendarColor)
 {
     $oMessage = $this->createMessage($oAccount, $sSubject, $this->createBodyHtml($oAccount, $sEventName, $sDate, $sCalendarName, $sEventText, $sCalendarColor), $this->createBodyText($oAccount, $sEventName, $sDate, $sCalendarName, $sEventText));
     try {
         return $this->oApiMailManager->sendMessage($oAccount, $oMessage);
     } catch (Exception $oException) {
         CApi::Log('MessageSend Exception', ELogLevel::Error, 'cron-');
         CApi::LogException($oException, ELogLevel::Error, 'cron-');
     }
     return false;
 }
开发者ID:Git-Host,项目名称:email,代码行数:23,代码来源:reminders.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');
     /* @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

示例7: EntryDownload

 /**
  * 
  * @return mixed
  */
 public function EntryDownload()
 {
     $mResult = false;
     $aPaths = \System\Service::GetPaths();
     $sMethod = empty($aPaths[2]) ? '' : $aPaths[2];
     try {
         if (!empty($sMethod)) {
             $sRawKey = empty($aPaths[3]) ? '' : $aPaths[3];
             $aParameters = CApi::DecodeKeyValues($sRawKey);
             $aParameters['AuthToken'] = empty($aPaths[4]) ? '' : $aPaths[4];
             $aParameters['SharedHash'] = empty($aPaths[5]) ? '' : $aPaths[5];
             $mResult = $this->CallMethod($sMethod, $aParameters, true);
         }
     } catch (\Exception $oException) {
         \CApi::LogException($oException);
         $this->oHttp->StatusHeader(404);
     }
     return $mResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:23,代码来源:module.php

示例8: AjaxGetTwilioToken

 /**
  * @return array
  */
 public function AjaxGetTwilioToken()
 {
     $oAccount = $this->getAccountFromParam();
     $oTenant = null;
     if ($this->oApiTenants) {
         $oTenant = 0 < $oAccount->IdTenant ? $this->oApiTenants->GetTenantById($oAccount->IdTenant) : $this->oApiTenants->GetDefaultGlobalTenant();
     }
     $mToken = false;
     if ($oTenant && $this->oApiCapability->IsTwilioSupported($oAccount) && $oTenant->IsTwilioSupported() && file_exists(PSEVEN_APP_ROOT_PATH . 'libraries/Services/Twilio.php')) {
         try {
             include PSEVEN_APP_ROOT_PATH . 'libraries/Services/Twilio.php';
             // put your Twilio API credentials here
             $sAccountSid = $oTenant->TwilioAccountSID;
             $sAuthToken = $oTenant->TwilioAuthToken;
             // put your Twilio Application Sid here
             $sAppSid = $oTenant->TwilioAppSID;
             /*\CApi::Log('twilio_calls_log');
             		$client = new \Services_Twilio($sAccountSid, $sAuthToken);
             		foreach ($client->account->calls->getIterator(0, 50, array(
             			//"From" => "client:7333",
             			"StartTime>" => "2014-01-01"
             		)) as $call
             		) {
             			\CApi::Log('status-'.$call->status.' to-'.$call->to .' from-'.$call->from);
             		}
             		\CApi::Log('twilio_calls_log_end');*/
             //				$sTwilioPhoneNumber = $oTenant->TwilioPhoneNumber;
             $sUserPhoneNumber = $oAccount->User->TwilioNumber;
             $oCapability = new \Services_Twilio_Capability($sAccountSid, $sAuthToken);
             $oCapability->allowClientOutgoing($sAppSid);
             \CApi::Log('twilio_debug');
             \CApi::Log('twilio_account_sid-' . $sAccountSid);
             \CApi::Log('twilio_auth_token-' . $sAuthToken);
             \CApi::Log('twilio_app_sid-' . $sAppSid);
             \CApi::Log('twilio_number-' . $sUserPhoneNumber);
             \CApi::Log('twilio_enable-' . $oAccount->User->TwilioEnable);
             \CApi::Log('twilio_default_number-' . ($oAccount->User->TwilioDefaultNumber ? 'true' : 'false'));
             \CApi::Log('twilio_debug_end');
             //				$oCapability->allowClientIncoming('TwilioAftId_'.$oAccount->User->TwilioNumber);
             $oCapability->allowClientIncoming($sUserPhoneNumber ? $sUserPhoneNumber : 'default');
             //				$oCapability->allowClientIncoming('TwilioAftId_'.$oAccount->IdTenant.'_'.$oAccount->User->TwilioNumber);
             $mToken = $oCapability->generateToken(86400000);
             //Token lifetime set to 24hr (default 1hr)
         } catch (\Exception $oE) {
             \CApi::LogException($oE);
         }
     } else {
         throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\Notifications::VoiceNotAllowed);
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $mToken);
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:54,代码来源:Actions.php


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