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


PHP Agent::updateRegistration方法代码示例

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


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

示例1: processRegistration

 private function processRegistration()
 {
     $dom = $this->xmlDom;
     $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
     $authenticationLevel = $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
     $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
     if ($headerNode->getElementsByTagName('SIF_Timestamp')->item(0)) {
         $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
     } else {
         $originalTimestamp = Utility::createTimestamp();
     }
     $version = $_SESSION['ZONE_VERSION'];
     $buffer = $dom->getElementsByTagName('SIF_MaxBufferSize')->item(0)->nodeValue;
     $mode = $dom->getElementsByTagName('SIF_Mode')->item(0)->nodeValue;
     if ($dom->getElementsByTagName('SIF_Protocol')->item(0)) {
         $protocolType = $dom->getElementsByTagName('SIF_Protocol')->item(0)->attributes->item(0)->nodeValue;
         $protocolSecure = $dom->getElementsByTagName('SIF_Protocol')->item(0)->attributes->item(1)->nodeValue;
     }
     if ($dom->getElementsByTagName('SIF_URL')->item(0)) {
         $callBackUrl = $dom->getElementsByTagName('SIF_URL')->item(0)->nodeValue;
     }
     $validSourceId = Agent::checkSourceId($originalSourceId);
     if (!$validSourceId) {
         RegisterError::invalidSourceId($agent->sourceId, $originalMsgId);
     } else {
         //create agent object
         $agent = new Agent($originalSourceId);
         if (!Agent::allowedToRegister($agent->agentId)) {
             RegisterError::genericError($agent->sourceId, $originalMsgId);
         } else {
             /*				if($version != ZIT::checkVersion($version)){
             					RegisterError::invalidVersion($agent->sourceId, $originalMsgId);
             				}
             				else{
             */
             if ($buffer < ZIT::getMinBuffer()) {
                 RegisterError::invalidMaxBuffer($agent->sourceId, $originalMsgId);
             } else {
                 $empty = null;
                 $agent->authenticationLevel = $this->getSecurityLevel();
                 $agent->maxBuffersize = $buffer;
                 $agent->protocol = isset($protocolType) ? $protocolType : $empty;
                 $agent->callBackUrl = isset($callBackUrl) ? urlencode($callBackUrl) : $empty;
                 $agent->agentMode = Agent::convertAgentMode(isset($mode) ? $mode : $empty);
                 $agent->secure = Agent::convertSecure(isset($protocolSecure) ? $protocolSecure : $empty);
                 $agent->version = $version;
                 if ($agent->isRegistered()) {
                     if ($agent->updateRegistration()) {
                         $this->createAclAckMessage($agent->sourceId, $originalMsgId);
                     } else {
                         RegisterError::genericError($agent->sourceId, $originalMsgId, 'Error Registering Agent at agent->updateRegistration()');
                     }
                     //try to update registration
                 } else {
                     if ($agent->register()) {
                         $this->createAclAckMessage($agent->sourceId, $originalMsgId);
                     } else {
                         RegisterError::genericError($agent->sourceId, $originalMsgId, 'Error Registering Agent at agent->register()');
                     }
                     //try to register
                 }
                 //check if agent is registered
             }
             //check if buffer size is valid
             //				}//check if version is valid
         }
         //check if agent allowed to register
     }
     //check if sourceId is valid
 }
开发者ID:neilberget,项目名称:OpenZIS,代码行数:70,代码来源:Register.php


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