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


PHP CApi::Cacher方法代码示例

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


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

示例1: AjaxSystemDoServerInitializations

 /**
  * @return array
  */
 public function AjaxSystemDoServerInitializations()
 {
     $oAccount = $this->getAccountFromParam();
     $bResult = false;
     $oApiIntegrator = \CApi::Manager('integrator');
     if ($oAccount && $oApiIntegrator) {
         $oApiIntegrator->resetCookies();
     }
     $oApiHelpdesk = \CApi::Manager('helpdesk');
     if ($this->oApiCapability->isGlobalContactsSupported($oAccount, true)) {
         $oApiContacts = $this->ApiContacts();
         if ($oApiContacts && method_exists($oApiContacts, 'synchronizeExternalContacts')) {
             $bResult = $oApiContacts->synchronizeExternalContacts($oAccount);
         }
     }
     $oCacher = \CApi::Cacher();
     $bDoGC = false;
     $bDoHepdeskClear = false;
     if ($oCacher && $oCacher->IsInited()) {
         $iTime = $oCacher->GetTimer('Cache/ClearFileCache');
         if (0 === $iTime || $iTime + 60 * 60 * 24 < time()) {
             if ($oCacher->SetTimer('Cache/ClearFileCache')) {
                 $bDoGC = true;
             }
         }
         if ($oApiHelpdesk) {
             $iTime = $oCacher->GetTimer('Cache/ClearHelpdeskUsers');
             if (0 === $iTime || $iTime + 60 * 60 * 24 < time()) {
                 if ($oCacher->SetTimer('Cache/ClearHelpdeskUsers')) {
                     $bDoHepdeskClear = true;
                 }
             }
         }
     }
     if ($bDoGC) {
         \CApi::Log('GC: FileCache / Start');
         $this->ApiFileCache()->gc();
         $oCacher->gc();
         \CApi::Log('GC: FileCache / End');
     }
     if ($bDoHepdeskClear && $oApiHelpdesk) {
         \CApi::Log('GC: clear Unregistred Users');
         $oApiHelpdesk->clearUnregistredUsers();
         \CApi::Log('GC: clear Online');
         $oApiHelpdesk->clearAllOnline();
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $bResult);
 }
开发者ID:nsine,项目名称:webmail-lite,代码行数:51,代码来源:Actions.php

示例2: Handle


//.........这里部分代码省略.........
                                     } 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 {
                             if ('sso' === $sFirstPart) {
                                 $oApiIntegratorManager = \CApi::Manager('integrator');
                                 try {
                                     $sHash = $this->oHttp->GetRequest('hash');
                                     if (!empty($sHash)) {
                                         $sData = \CApi::Cacher()->get('SSO:' . $sHash, true);
                                         $aData = \CApi::DecodeKeyValues($sData);
                                         if (!empty($aData['Email']) && isset($aData['Password'], $aData['Login'])) {
                                             $oAccount = $oApiIntegratorManager->loginToAccount($aData['Email'], $aData['Password'], $aData['Login']);
                                             if ($oAccount) {
                                                 $oApiIntegratorManager->setAccountAsLoggedIn($oAccount);
                                             }
                                         }
                                     } else {
                                         $oApiIntegratorManager->logoutAccount();
                                     }
                                 } catch (\Exception $oExc) {
                                     \CApi::LogException($oExc);
                                 }
                                 \CApi::Location('./');
                             } else {
                                 if ('autodiscover' === $sFirstPart) {
                                     $oSettings =& \CApi::GetSettings();
                                     $sInput = \file_get_contents('php://input');
                                     \CApi::Log('#autodiscover:');
                                     \CApi::LogObject($sInput);
                                     $aMatches = array();
                                     $aEmailAddress = array();
                                     \preg_match("/\\<AcceptableResponseSchema\\>(.*?)\\<\\/AcceptableResponseSchema\\>/i", $sInput, $aMatches);
                                     \preg_match("/\\<EMailAddress\\>(.*?)\\<\\/EMailAddress\\>/", $sInput, $aEmailAddress);
                                     if (!empty($aMatches[1]) && !empty($aEmailAddress[1])) {
                                         $sIncMailServer = trim($oSettings->GetConf('WebMail/ExternalHostNameOfLocalImap'));
                                         $sOutMailServer = trim($oSettings->GetConf('WebMail/ExternalHostNameOfLocalSmtp'));
                                         if (0 < \strlen($sIncMailServer) && 0 < \strlen($sOutMailServer)) {
                                             $iIncMailPort = 143;
                                             $iOutMailPort = 25;
                                             $aMatch = array();
                                             if (\preg_match('/:([\\d]+)$/', $sIncMailServer, $aMatch) && !empty($aMatch[1]) && is_numeric($aMatch[1])) {
开发者ID:zhuomingliang,项目名称:webmail-lite,代码行数:67,代码来源:Service.php

示例3: setAccountAsLoggedIn

 /**
  * @param CAccount $oAccount
  * @param bool $bSignMe Default value is **false**.
  *
  * @return string
  */
 public function setAccountAsLoggedIn(CAccount $oAccount, $bSignMe = false)
 {
     $aAccountHashTable = array('token' => 'auth', 'sign-me' => $bSignMe, 'id' => $oAccount->IdUser, 'login' => $oAccount->IncomingMailLogin);
     $iTime = $bSignMe ? time() + 60 * 60 * 24 * 30 : 0;
     $sAccountHashTable = \CApi::EncodeKeyValues($aAccountHashTable);
     $_COOKIE[self::AUTH_KEY] = $sAccountHashTable;
     @setcookie(self::AUTH_KEY, $sAccountHashTable, $iTime, $this->getCookiePath(), null, null, true);
     $sAuthToken = \md5($oAccount->IdUser . $oAccount->IncomingMailLogin . \microtime(true) . \rand(10000, 99999));
     return \CApi::Cacher()->Set('AUTHTOKEN:' . $sAuthToken, $sAccountHashTable) ? $sAuthToken : '';
 }
开发者ID:vitaliy7711,项目名称:webmail-lite,代码行数:16,代码来源:manager.php

示例4: GenerateSsoToken

 /**
  * @param string $sEmail
  * @param string $sPassword
  * @param string $sLogin = ''
  * @return string
  */
 public static function GenerateSsoToken($sEmail, $sPassword, $sLogin = '')
 {
     $sSsoHash = \md5($sEmail . $sPassword . $sLogin . \microtime(true) . \rand(10000, 99999));
     return CApi::Cacher()->Set('SSO:' . $sSsoHash, CApi::EncodeKeyValues(array('Email' => $sEmail, 'Password' => $sPassword, 'Login' => $sLogin))) ? $sSsoHash : '';
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:11,代码来源:api.php

示例5: Handle


//.........这里部分代码省略.........
                                 } else {
                                     $sError = 'unknown';
                                 }
                             }
                         }
                         if (!is_array($aResponseItem) && empty($sError)) {
                             throw new \ProjectSeven\Exceptions\ClientException(\ProjectSeven\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();
                     if ('iframe' === $this->oHttp->GetPost('jua-post-type', '')) {
                         @header('Content-Type: text/html; charset=utf-8');
                     } else {
                         @header('Content-Type: application/json; charset=utf-8');
                     }
                     $sResult = \MailSo\Base\Utils::Php2js($aResponseItem);
                 } else {
                     if ('speclogon' === $sFirstPart || 'speclogoff' === $sFirstPart) {
                         \CApi::SpecifiedUserLogging('speclogon' === $sFirstPart);
                         \CApi::Location('./');
                     } else {
                         if ('sso' === $sFirstPart) {
                             $oApiIntegratorManager = \CApi::Manager('integrator');
                             try {
                                 $sHash = $this->oHttp->GetRequest('hash');
                                 if (!empty($sHash)) {
                                     $sData = \CApi::Cacher()->Get('SSO:' . $sHash, true);
                                     $aData = \CApi::DecodeKeyValues($sData);
                                     if (!empty($aData['Email']) && isset($aData['Password'], $aData['Login'])) {
                                         $oAccount = $oApiIntegratorManager->LoginToAccount($aData['Email'], $aData['Password'], $aData['Login']);
                                         if ($oAccount) {
                                             $oApiIntegratorManager->SetAccountAsLoggedIn($oAccount);
                                         }
                                     }
                                 } else {
                                     $oApiIntegratorManager->LogoutAccount();
                                 }
                             } catch (\Exception $oExc) {
                                 \CApi::LogException($oExc);
                             }
                             \CApi::Location('./');
                         } else {
                             if ('autodiscover' === $sFirstPart) {
                                 $oSettings =& \CApi::GetSettings();
                                 $sInput = \file_get_contents('php://input');
                                 //$sInput = '<?'.'xml version="1.0" encoding="utf-8"?'.'><Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"><Request><EMailAddress>test@afterlogic.com</EMailAddress><AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema></Request></Autodiscover>';
                                 \CApi::Log('#autodiscover:');
                                 \CApi::LogObject($sInput);
                                 $aMatches = array();
                                 $aEmailAddress = array();
                                 \preg_match("/\\<AcceptableResponseSchema\\>(.*?)\\<\\/AcceptableResponseSchema\\>/i", $sInput, $aMatches);
                                 \preg_match("/\\<EMailAddress\\>(.*?)\\<\\/EMailAddress\\>/", $sInput, $aEmailAddress);
                                 if (!empty($aMatches[1]) && !empty($aEmailAddress[1])) {
                                     $sIncMailServer = $oSettings->GetConf('WebMail/ExternalHostNameOfLocalImap');
                                     $sOutMailServer = $oSettings->GetConf('WebMail/ExternalHostNameOfLocalSmtp');
                                     if (0 < \strlen($sIncMailServer) && 0 < \strlen($sOutMailServer)) {
                                         $sResult = \implode("\n", array('<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">', '	<Response xmlns="' . $aMatches[1] . '">', '		<Account>', '			<AccountType>email</AccountType>', '			<Action>settings</Action>', '			<Protocol>', '				<Type>IMAP</Type>', '				<Server>' . $sIncMailServer . '</Server>', '				<LoginName>' . $aEmailAddress[1] . '</LoginName>', '				<Port>143</Port>', '				<SSL>off</SSL>', '				<SPA>off</SPA>', '				<AuthRequired>on</AuthRequired>', '			</Protocol>', '			<Protocol>', '				<Type>SMTP</Type>', '				<Server>' . $sOutMailServer . '</Server>', '				<LoginName>' . $aEmailAddress[1] . '</LoginName>', '				<Port>25</Port>', '				<SSL>off</SSL>', '				<SPA>off</SPA>', '				<AuthRequired>on</AuthRequired>', '			</Protocol>', '		</Account>', '	</Response>', '</Autodiscover>'));
                                     }
                                 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:67,代码来源:Service.php

示例6: setAccountAsLoggedIn

 /**
  * @param CAccount $oAccount
  * @param bool $bSignMe Default value is **false**.
  *
  * @return string
  */
 public function setAccountAsLoggedIn(CAccount $oAccount, $bSignMe = false)
 {
     $aAccountHashTable = array('token' => 'auth', 'sign-me' => $bSignMe, 'id' => $oAccount->IdUser, 'email' => $oAccount->Email);
     $iTime = $bSignMe ? time() + 60 * 60 * 24 * 30 : 0;
     $sAccountHashTable = \CApi::EncodeKeyValues($aAccountHashTable);
     $sAuthToken = \md5($oAccount->IdUser . $oAccount->IncomingMailLogin . \microtime(true) . \rand(10000, 99999));
     return \CApi::Cacher()->Set('AUTHTOKEN:' . $sAuthToken, $sAccountHashTable) ? $sAuthToken : '';
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:14,代码来源:manager.php


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