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


PHP CApi::LogObject方法代码示例

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


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

示例1: Init

 public static function Init($oTenant = null)
 {
     parent::Init($oTenant);
     $bResult = false;
     $oUser = null;
     $oClient = self::CreateClient($oTenant);
     if ($oClient) {
         if ($success = $oClient->Initialize()) {
             if ($success = $oClient->Process()) {
                 if (strlen($oClient->access_token)) {
                     $success = $oClient->CallAPI('https://api.twitter.com/1.1/account/verify_credentials.json', 'GET', array(), array('FailOnAccessError' => true), $oUser);
                 }
             }
             $success = $oClient->Finalize($success);
         }
         if ($oClient->exit) {
             $bResult = false;
             exit;
         }
         if ($success && $oUser) {
             // if you need re-ask user for permission
             //$oClient->ResetAccessToken();
             $aSocial = array('type' => self::$ConnectorName, 'id' => $oUser->id, 'name' => $oUser->name, 'email' => isset($oUser->email) ? $oUser->email : '', 'access_token' => $oClient->access_token, 'scopes' => self::$Scopes);
             \CApi::Log('social_user_' . self::$ConnectorName);
             \CApi::LogObject($oUser);
             $bResult = $aSocial;
         } else {
             $bResult = false;
             $oClient->ResetAccessToken();
             self::_socialError($oClient->error, self::$ConnectorName);
         }
     }
     return $bResult;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:34,代码来源:index.php

示例2: request

 public function request($method, $url = '', $body = null, $headers = array())
 {
     $headers['user-agent'] = Constants::DAV_USER_AGENT;
     $sLog = "REQUEST: " . $method;
     if ($url != '') {
         $sLog = $sLog . " " . $url;
     }
     if ($body != null) {
         $sLog = $sLog . "\r\nBody:\r\n" . $body;
     }
     \CApi::Log($sLog, \ELogLevel::Full, 'dav-');
     \CApi::LogObject($headers, \ELogLevel::Full, 'dav-');
     $response = array();
     try {
         $response = parent::request($method, $url, $body, $headers);
     } catch (\Sabre\DAV\Exception $ex) {
         \CApi::LogObject($ex->getMessage(), \ELogLevel::Full, 'dav-');
         throw $ex;
     }
     $sLog = "RESPONSE: " . $method;
     if (!empty($response['body'])) {
         $sLog = $sLog . "\r\nBody:\r\n" . $response['body'];
     }
     \CApi::Log($sLog, \ELogLevel::Full, 'dav-');
     if (!empty($response['headers'])) {
         \CApi::LogObject($response['headers'], \ELogLevel::Full, 'dav-');
     }
     return $response;
 }
开发者ID:Git-Host,项目名称:email,代码行数:29,代码来源:Client.php

示例3: beforeMethod

 /**
  * This method is called before any HTTP method, but after authentication.
  *
  * @param string $sMethod
  * @param string $path
  * @throws \Sabre\DAV\Exception\NotAuthenticated
  * @return bool
  */
 public function beforeMethod($sMethod, $path)
 {
     $aHeaders = $this->server->httpRequest->getHeaders();
     \CApi::Log($sMethod . ' ' . $path, \ELogLevel::Full, 'sabredav-');
     \CApi::LogObject($aHeaders, \ELogLevel::Full, 'sabredav-');
     $bLogBody = (bool) \CApi::GetConf('labs.dav.log-body', false);
     if ($bLogBody) {
         $body = $this->server->httpRequest->getBodyAsString();
         $this->server->httpRequest->setBody($body);
         \CApi::LogObject($body, \ELogLevel::Full, 'sabredav-');
     }
     \CApi::Log('', \ELogLevel::Full, 'sabredav-');
     return;
 }
开发者ID:afterlogic,项目名称:dav,代码行数:22,代码来源:Plugin.php

示例4: FoldersOrder

 /**
  * @param CAccount $oAccount
  *
  * @return array
  */
 public function FoldersOrder($oAccount)
 {
     $aList = array();
     if ($this->oConnection->Execute($this->oCommandCreator->FoldersOrder($oAccount))) {
         $oRow = $this->oConnection->GetNextRecord();
         if ($oRow) {
             $sOrder = $oRow->folders_order;
             if (!empty($sOrder)) {
                 CApi::LogObject($sOrder);
                 $aOrder = @json_decode($sOrder, 3);
                 CApi::LogObject($aOrder);
                 if (is_array($aOrder) && 0 < count($aOrder)) {
                     $aList = $aOrder;
                 }
             }
         }
         $this->oConnection->FreeResult();
     }
     $this->throwDbExceptionIfExist();
     return $aList;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:26,代码来源:storage.php

示例5: Init

 public static function Init($oTenant = null)
 {
     parent::Init($oTenant);
     $bResult = false;
     $oUser = null;
     $oClient = self::CreateClient($oTenant);
     if ($oClient) {
         if ($success = $oClient->Initialize()) {
             if ($success = $oClient->Process()) {
                 if (strlen($oClient->access_token)) {
                     $success = $oClient->CallAPI('https://www.googleapis.com/oauth2/v1/userinfo', 'GET', array(), array('FailOnAccessError' => true), $oUser);
                 } else {
                     $oClient->error = $oClient->authorization_error;
                     $success = false;
                 }
             }
             $success = $oClient->Finalize($success);
         }
         if ($oClient->exit) {
             $bResult = false;
             exit;
         }
         if ($success && $oUser) {
             // if you need re-ask user for permission
             $oClient->ResetAccessToken();
             $iExpiresIn = 3600;
             $dAccessTokenExpiry = new DateTime($oClient->access_token_expiry);
             $aAccessToken = json_encode(array('access_token' => $oClient->access_token, 'created' => $dAccessTokenExpiry->getTimestamp() - $iExpiresIn, 'expires_in' => $iExpiresIn));
             $aSocial = array('type' => self::$ConnectorName, 'id' => $oUser->id, 'name' => $oUser->name, 'email' => isset($oUser->email) ? $oUser->email : '', 'access_token' => $aAccessToken, 'refresh_token' => $oClient->refresh_token, 'scopes' => self::$Scopes);
             \CApi::Log('social_user_' . self::$ConnectorName);
             \CApi::LogObject($oUser);
             $bResult = $aSocial;
         } else {
             $bResult = false;
             $oClient->ResetAccessToken();
             self::_socialError($oClient->error, self::$ConnectorName);
         }
     }
     return $bResult;
 }
开发者ID:Git-Host,项目名称:email,代码行数:40,代码来源:index.php

示例6: Modify

 /**
  * @return bool
  */
 public function Modify($sModifyDn, $aModifyEntry)
 {
     $bResult = false;
     if (!empty($sModifyDn)) {
         if (!empty($this->sSearchDN)) {
             $sModifyDn = $sModifyDn . ',' . $this->sSearchDN;
         }
         CApi::Log('ldap_modify = ' . $sModifyDn);
         CApi::LogObject($aModifyEntry);
         $bResult = !!@ldap_modify($this->rLink, $sModifyDn, $aModifyEntry);
         $this->validateLdapErrorOnFalse($bResult);
     }
     return $bResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:17,代码来源:ldap.php

示例7: CsvToArray

 /**
  * @return string $sFileName
  * @return string
  */
 public static function CsvToArray($sFileName)
 {
     if (!file_exists($sFileName) || !is_readable($sFileName)) {
         return false;
     }
     $aHeaders = null;
     $aData = array();
     @setlocale(LC_CTYPE, 'en_US.UTF-8');
     \ini_set('auto_detect_line_endings', true);
     if (false !== ($rHandle = @fopen($sFileName, 'rb'))) {
         $sDelimiterSearchString = @fread($rHandle, 2000);
         rewind($rHandle);
         $sDelimiter = (int) substr_count($sDelimiterSearchString, ',') > (int) substr_count($sDelimiterSearchString, ';') ? ',' : ';';
         while (false !== ($mRow = fgetcsv($rHandle, 5000, $sDelimiter, '"'))) {
             $mRow = preg_replace('/[\\r\\n]+/', "\n", $mRow);
             if (null === $aHeaders) {
                 if (3 >= count($mRow)) {
                     CApi::Log('Invalid csv headers');
                     CApi::LogObject($mRow);
                     fclose($rHandle);
                     return $aData;
                 }
                 $aHeaders = $mRow;
             } else {
                 $aNewItem = array();
                 foreach ($aHeaders as $iIndex => $sHeaderValue) {
                     $aNewItem[@iconv('utf-8', 'utf-8//IGNORE', $sHeaderValue)] = isset($mRow[$iIndex]) ? $mRow[$iIndex] : '';
                 }
                 $aData[] = $aNewItem;
             }
         }
         fclose($rHandle);
     }
     ini_set('auto_detect_line_endings', false);
     return $aData;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:40,代码来源:utils.php

示例8: Handle


//.........这里部分代码省略.........
                         if ($this->oHttp->IsPut()) {
                             $rPutData = fopen("php://input", "r");
                             $aFilePath = array_slice($aPaths, 3);
                             $sFilePath = implode('/', $aFilePath);
                             $this->oActions->SetActionParams(array('FileData' => array('name' => basename($sFilePath), 'size' => (int) $this->oHttp->GetHeader('Content-Length'), 'tmp_name' => $rPutData), 'AdditionalData' => json_encode(array('Type' => empty($aPaths[2]) ? 'personal' : strtolower($aPaths[2]), 'CalendarID' => empty($aPaths[2]) ? '' : strtolower($aPaths[2]), 'Folder' => dirname($sFilePath), 'Path' => dirname($sFilePath), 'GroupId' => '', 'IsShared' => false)), 'IsExt' => '1' === (string) $this->oHttp->GetQuery('IsExt', '0') ? '1' : '0', 'TenantHash' => (string) $this->oHttp->GetQuery('TenantHash', ''), 'AuthToken' => $this->oHttp->GetHeader('Auth-Token'), 'AccountID' => empty($aPaths[2]) ? '0' : strtolower($aPaths[2])));
                             try {
                                 $sMethodName = 'Upload' . $sAction;
                                 if (method_exists($this->oActions, $sMethodName) && is_callable(array($this->oActions, $sMethodName))) {
                                     $aResponseItem = call_user_func(array($this->oActions, $sMethodName));
                                 }
                                 if (!is_array($aResponseItem) && empty($sError)) {
                                     throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::UnknownError);
                                 }
                             } catch (\Exception $oException) {
                                 \CApi::LogException($oException);
                                 $aResponseItem = $this->oActions->ExceptionResponse(null, 'Upload', $oException);
                                 $sError = 'exception';
                             }
                             if (0 < strlen($sError)) {
                                 $aResponseItem['Error'] = $sError;
                             }
                         } else {
                             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', ''), 'AuthToken' => $this->oHttp->GetPost('AuthToken', '')));
                                             \CApi::LogObject($this->oActions->GetActionParams());
                                             $aResponseItem = call_user_func(array($this->oActions, $sMethodName));
                                         } else {
                                             $sError = $this->oActions->convertUploadErrorToString($iError);
                                         }
                                     } else {
                                         if (!isset($_FILES) || !is_array($_FILES) || 0 === count($_FILES)) {
                                             $sError = 'size';
                                         } else {
                                             $sError = 'unknown';
                                         }
                                     }
                                 }
                                 if (!is_array($aResponseItem) && empty($sError)) {
                                     throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::UnknownError);
                                 }
                             } catch (\Exception $oException) {
                                 \CApi::LogException($oException);
                                 $aResponseItem = $this->oActions->ExceptionResponse(null, 'Upload', $oException);
                                 $sError = 'exception';
                             }
                             if (0 < strlen($sError)) {
                                 $aResponseItem['Error'] = $sError;
                             }
                         }
                         @ob_get_clean();
                         @header('Content-Type: text/html; charset=utf-8');
                         $sResult = \MailSo\Base\Utils::Php2js($aResponseItem);
                     } else {
                         if ('speclogon' === $sFirstPart || 'speclogoff' === $sFirstPart) {
                             \CApi::SpecifiedUserLogging('speclogon' === $sFirstPart);
                             \CApi::Location('./');
                         } else {
开发者ID:zhuomingliang,项目名称:webmail-lite,代码行数:67,代码来源:Service.php

示例9: _socialError

 protected static function _socialError($oClientError, $sSocialName)
 {
     \CApi::Log($sSocialName, ' error');
     \CApi::LogObject($oClientError);
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:5,代码来源:index.php

示例10: setThreadIdFromRequest

 /**
  * @param int $iThreadID
  * @param string $sThreadAction Default value is empty string.
  */
 public function setThreadIdFromRequest($iThreadID, $sThreadAction = '')
 {
     $aHashTable = array('token' => 'thread_id', 'id' => (int) $iThreadID, 'action' => (string) $sThreadAction);
     CApi::LogObject($aHashTable);
     $_COOKIE[self::TOKEN_HD_THREAD_ID] = CApi::EncodeKeyValues($aHashTable);
     @setcookie(self::TOKEN_HD_THREAD_ID, CApi::EncodeKeyValues($aHashTable), 0, $this->getCookiePath(), null, null, true);
 }
开发者ID:vitaliy7711,项目名称:webmail-lite,代码行数:11,代码来源:manager.php

示例11: getTwiML

 public function getTwiML($aPaths, $oHttp)
 {
     $oApiCapability = \CApi::Manager('capability');
     $oApiUsers = \CApi::Manager('users');
     $oApiTenants = \CApi::Manager('tenants');
     $sTenantId = isset($aPaths[1]) ? $aPaths[1] : null;
     $oTenant = null;
     if ($oApiTenants) {
         $oTenant = $sTenantId ? $oApiTenants->GetTenantById($sTenantId) : $oApiTenants->GetDefaultGlobalTenant();
     }
     $sTwilioPhoneNumber = $oTenant->TwilioPhoneNumber;
     $sDigits = $oHttp->GetRequest('Digits');
     //$sFrom = str_replace('client:', '', $oHttp->GetRequest('From'));
     $sFrom = $oHttp->GetRequest('From');
     $sTo = $oHttp->GetRequest('PhoneNumber');
     $aTwilioNumbers = $oApiUsers->GetUserTwilioNumbers($sTenantId);
     @header('Content-type: text/xml');
     $aResult = array('<?xml version="1.0" encoding="UTF-8"?>');
     $aResult[] = '<Response>';
     if ($oHttp->GetRequest('CallSid')) {
         if ($oHttp->GetRequest('AfterlogicCall')) {
             if (preg_match("/^[\\d\\+\\-\\(\\) ]+\$/", $sTo) && strlen($sTo) > 0 && strlen($sTo) < 10) {
                 $aResult[] = '<Dial callerId="' . $sFrom . '"><Client>' . $sTo . '</Client></Dial>';
             } else {
                 if (strlen($sTo) > 10) {
                     $aResult[] = '<Dial callerId="' . $sFrom . '">' . $sTo . '</Dial>';
                 }
             }
             //@setcookie('twilioCall['.$oHttp->GetRequest('CallSid').']', $sTo, time()+60);
             @setcookie('PhoneNumber', $sTo);
         } else {
             if ($oTenant->TwilioAccountSID === $oHttp->GetRequest('AccountSid') && $oTenant->TwilioAppSID === $oHttp->GetRequest('ApplicationSid')) {
                 /*$sTo = isset($_COOKIE['twilioCall'][$oHttp->GetRequest('CallSid')]) ? $_COOKIE['twilioCall'][$oHttp->GetRequest('CallSid')] : '';
                 		@setcookie ('twilioCall['.$oHttp->GetRequest('CallSid').']', '', time() - 1);*/
                 if (strlen($sTo) > 0 && strlen($sTo) < 10) {
                     $aResult[] = '<Dial callerId="' . $sFrom . '"><Client>' . $sTo . '</Client></Dial>';
                 } else {
                     if (strlen($sTo) > 10) {
                         $aResult[] = '<Dial callerId="' . $sTwilioPhoneNumber . '">' . $sTo . '</Dial>';
                         //in there caller id must be full with country code number!
                     }
                 }
             } else {
                 if ($sDigits) {
                     $aResult[] = '<Dial callerId="' . $sDigits . '"><Client>' . $sDigits . '</Client></Dial>';
                 } else {
                     $aResult[] = '<Gather timeout="5" numDigits="4">';
                     $aResult[] = '<Say>Please enter the extension number or stay on the line</Say>';
                     $aResult[] = '</Gather>';
                     //$aResult[] = '<Say>You will be connected with an operator</Say>';
                     $aResult[] = self::_getDialToDefault($oApiUsers->GetUserTwilioNumbers($sTenantId));
                 }
             }
         }
     } else {
         $aResult[] = '<Say>This functionality doesn\'t allowed</Say>';
     }
     $aResult[] = '</Response>';
     \CApi::LogObject('twilio_xml_start');
     \CApi::LogObject($aPaths);
     \CApi::LogObject($_REQUEST);
     \CApi::LogObject($aTwilioNumbers);
     \CApi::LogObject($aResult);
     \CApi::LogObject('twilio_From-' . $sFrom);
     \CApi::LogObject('twilio_TwilioPhoneNumber-' . $oTenant->TwilioPhoneNumber);
     \CApi::LogObject('twilio_TwilioAllow-' . $oTenant->TwilioAllow);
     \CApi::LogObject('twilio_xml_end');
     //return implode("\r\n", $aResult);
     return implode('', $aResult);
 }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:70,代码来源:twilio.php

示例12: Init

 public function Init($aPaths, $oHttp)
 {
     /* @var $oApiIntegrator \CApiIntegratorManager */
     $oApiIntegrator = \CApi::Manager('integrator');
     $oApiUsers = \CApi::Manager('users');
     $oAccount = $oApiIntegrator->GetLogginedDefaultAccount();
     $bDirection = $oHttp->GetRequest('Direction') === 'inbound' ? true : false;
     $sDigits = $oHttp->GetRequest('Digits');
     //		$sFrom = str_replace('client:', '', $oHttp->GetRequest('From'));
     $sFrom = $oHttp->GetRequest('From');
     $sTenantId = isset($aPaths[1]) ? $aPaths[1] : null;
     //		$bTwilioAllowUser = $oAccount->User->TwilioEnable;
     //		$bTwilioDefaultNumber = $oAccount->User->TwilioDefaultNumber;
     $aTwilioNumbers = $oApiUsers->GetUserTwilioNumbers($sTenantId);
     $bTwilioAllowTenant = false;
     $sTwilioPhoneNumber = '';
     if (is_numeric($sTenantId)) {
         $oApiTenants = \CApi::Manager('tenants');
         $oTenant = $oApiTenants ? $oApiTenants->GetTenantById($sTenantId) : null;
         if ($oTenant) {
             $bTwilioAllowTenant = $oTenant->TwilioAllow && $oTenant->TwilioAllowConfiguration;
             //TODO consider user enable twilio checkbox
             $sTwilioPhoneNumber = $oTenant->TwilioPhoneNumber;
         }
     } else {
         $bTwilioAllowTenant = true;
         //TODO if no tenant system
     }
     @header('Content-type: text/xml');
     $aResult = array('<?xml version="1.0" encoding="UTF-8"?>');
     $aResult[] = '<Response>';
     if ($bTwilioAllowTenant) {
         if ($bDirection) {
             // TODO
             if ($sDigits) {
                 $aResult[] = '<Dial><Client>' . $sDigits . '</Client></Dial>';
                 //					$aResult[] = self::_getDialToDefault($oApiUsers->GetUserTwilioNumbers($sTenantId));
             } else {
                 $aResult[] = '<Gather timeout="10" numDigits="4">';
                 //					$aResult[] = '<Say>Please enter the extension number or stay on the line to talk to an operator</Say>';
                 $aResult[] = '<Say>Please enter the extension number or stay on the line</Say>';
                 $aResult[] = '</Gather>';
                 //					$aResult[] = '<Say>You will be connected with an operator</Say>';
                 //					$aResult[] = '<Dial><Client></Client></Dial>';
                 //					$aResult[] = '<Dial></Dial>';
                 $aResult[] = self::_getDialToDefault($oApiUsers->GetUserTwilioNumbers($sTenantId));
             }
         } else {
             /* @var $oApiCapability \CApiCapabilityManager */
             $oApiCapability = \CApi::Manager('capability');
             if ($oApiCapability->IsTwilioSupported($oAccount)) {
                 $sPhoneNumber = $oHttp->GetRequest('PhoneNumber');
                 if (preg_match("/^[\\d\\+\\-\\(\\) ]+\$/", $sPhoneNumber) && strlen($sPhoneNumber) > 10) {
                     $aResult[] = '<Dial callerId="' . $sTwilioPhoneNumber . '">' . $sPhoneNumber . '</Dial>';
                 } else {
                     $aResult[] = '<Dial callerId="' . $sFrom . '"><Client>' . $sPhoneNumber . '</Client></Dial>';
                 }
             }
         }
     } else {
         $aResult[] = '<Say>This functionality doesn\'t allowed</Say>';
     }
     $aResult[] = '</Response>';
     //$sResult = implode("\r\n", $aResult);
     \CApi::LogObject('twilio_xml_start');
     \CApi::LogObject($aPaths);
     \CApi::LogObject($_REQUEST);
     //		\CApi::LogObject($bTwilioAllowUser);
     //		\CApi::LogObject($bTwilioDefaultNumber);
     \CApi::LogObject($aTwilioNumbers);
     \CApi::LogObject($aResult);
     \CApi::LogObject($sFrom);
     \CApi::LogObject('twilio_xml_end');
     return implode('', $aResult);
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:75,代码来源:twilio.php

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

示例14: populateContact

 /**
  * @param CAccount $oAccount
  * @return CContact|bool
  */
 private function populateContact($oAccount, $aLdapData)
 {
     $oContact = false;
     if ($aLdapData && isset($aLdapData[$this->sContactUidFieldName][0])) {
         CApi::LogObject($aLdapData);
         $oContact = new CContact();
         $oContact->IdUser = $oAccount->IdUser;
         $oContact->IdTenant = $oAccount->IdTenant;
         $oContact->IdDomain = $oAccount->IdDomain;
         $oContact->IdContact = (string) $aLdapData[$this->sContactUidFieldName][0];
         $oContact->IdContactStr = $oContact->IdContact;
         $oContact->UseFriendlyName = true;
         // TODO
         if (!empty($aLdapData['sn'][0]) && '-' === $aLdapData['sn'][0]) {
             $aLdapData['sn'][0] = '';
         }
         $aMap = $this->contactObjectMap();
         $aMap = array_change_key_case($aMap, CASE_LOWER);
         $aLdapDataLower = array_change_key_case($aLdapData, CASE_LOWER);
         foreach ($aLdapDataLower as $sKey => $mRow) {
             if (isset($aMap[$sKey]) && isset($oContact->{$aMap[$sKey]}) && 0 === strlen($oContact->{$aMap[$sKey]})) {
                 $oContact->{$aMap[$sKey]} = isset($mRow[0]) ? $mRow[0] : '';
             }
         }
         $sDateOfBirth = isset($aLdapDataLower['dateofbirth'][0]) ? (string) $aLdapDataLower['dateofbirth'][0] : '';
         if (strlen($sDateOfBirth) > 0) {
             $aDateOfBirth = explode('/', $sDateOfBirth, 3);
             if (3 === count($aDateOfBirth) && isset($aDateOfBirth[0], $aDateOfBirth[1], $aDateOfBirth[2])) {
                 $oContact->BirthdayDay = is_numeric($aDateOfBirth[0]) ? (int) $aDateOfBirth[0] : 0;
                 $oContact->BirthdayMonth = is_numeric($aDateOfBirth[1]) ? (int) $aDateOfBirth[1] : 0;
                 $oContact->BirthdayYear = is_numeric($aDateOfBirth[2]) ? (int) $aDateOfBirth[2] : 0;
             }
         }
         if (isset($aLdapDataLower['memberofpabgroup'])) {
             unset($aLdapDataLower['memberofpabgroup']['count']);
             if (is_array($aLdapDataLower['memberofpabgroup'])) {
                 $aGroupsIds = array();
                 $aMemberOfPabGroup = array_values($aLdapDataLower['memberofpabgroup']);
                 foreach ($aMemberOfPabGroup as $sGroupId) {
                     if (!empty($sGroupId)) {
                         $aGroupsIds[] = (string) $sGroupId;
                     }
                 }
                 $oContact->GroupsIds = $aGroupsIds;
             }
         }
     }
     return $oContact;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:53,代码来源:storage.php

示例15: GetTimeOffset

 /**
  * @param int $iDefaultTimeZone
  * @param string $sClientTimeZone = ''
  * @return short
  */
 public static function GetTimeOffset($iDefaultTimeZone, $sClientTimeZone = '')
 {
     if ('' !== $sClientTimeZone) {
         try {
             $oDateTimeZone = new DateTimeZone($sClientTimeZone);
             return $oDateTimeZone->getOffset(new DateTime('now')) / 60;
         } catch (Exception $oE) {
             CApi::Log($sClientTimeZone);
             CApi::LogObject($oE, ELogLevel::Warning);
         }
     }
     $iTimeOffset = 0;
     switch ($iDefaultTimeZone) {
         default:
         case 0:
             break;
         case 1:
             $iTimeOffset = -12 * 60;
             break;
         case 2:
             $iTimeOffset = -11 * 60;
             break;
         case 3:
             $iTimeOffset = -10 * 60;
             break;
         case 4:
             $iTimeOffset = -9 * 60;
             break;
         case 5:
             $iTimeOffset = -8 * 60;
             break;
         case 6:
         case 7:
             $iTimeOffset = -7 * 60;
             break;
         case 8:
         case 9:
         case 10:
         case 11:
             $iTimeOffset = -6 * 60;
             break;
         case 12:
         case 13:
         case 14:
             $iTimeOffset = -5 * 60;
             break;
         case 15:
         case 16:
         case 17:
             $iTimeOffset = -4 * 60;
             break;
         case 18:
             $iTimeOffset = -3.5 * 60;
             break;
         case 19:
         case 20:
         case 21:
             $iTimeOffset = -3 * 60;
             break;
         case 22:
             $iTimeOffset = -2 * 60;
             break;
         case 23:
         case 24:
             $iTimeOffset = -60;
             break;
         case 25:
         case 26:
             $iTimeOffset = 0;
             break;
         case 27:
         case 28:
         case 29:
         case 30:
         case 31:
             $iTimeOffset = 60;
             break;
         case 32:
         case 33:
         case 34:
         case 35:
         case 36:
         case 37:
             $iTimeOffset = 2 * 60;
             break;
         case 38:
         case 39:
         case 40:
             $iTimeOffset = 3 * 60;
             break;
         case 41:
             $iTimeOffset = 3.5 * 60;
             break;
         case 42:
         case 43:
//.........这里部分代码省略.........
开发者ID:afterlogic,项目名称:aurora-core,代码行数:101,代码来源:utils.php


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