本文整理汇总了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
}