mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-15 17:16:59 +02:00
Milliseconds are now fully supported
This commit is contained in:
parent
ea754362f8
commit
63aa36ff0a
13 changed files with 425 additions and 321 deletions
|
@ -55,179 +55,179 @@ class EppWriter {
|
|||
$writer->endDocument();
|
||||
return $writer->outputMemory();
|
||||
}
|
||||
|
||||
private function epp_result_totext($code, $lang = 'en-US') {
|
||||
|
||||
private function epp_result_totext($code, $lang = 'en-US') {
|
||||
$resultTexts = [
|
||||
1000 => [
|
||||
1000 => [
|
||||
'code' => 'EPP_RS_SUCCESS',
|
||||
'en-US' => 'Command completed successfully',
|
||||
'fr-FR' => "la commande terminée avec succès"
|
||||
],
|
||||
1001 => [
|
||||
],
|
||||
1001 => [
|
||||
'code' => 'EPP_RS_PENDING',
|
||||
'en-US' => 'Command completed successfully; action pending',
|
||||
'fr-FR' => "la commande terminée avec succès ; l;'action est en suspens"
|
||||
],
|
||||
1300 => [
|
||||
],
|
||||
1300 => [
|
||||
'code' => 'EPP_RS_NOMSG',
|
||||
'en-US' => 'Command completed successfully; no messages',
|
||||
'fr-FR' => "la commande terminée avec succès ; il n'ya acun message"
|
||||
],
|
||||
1301 => [
|
||||
],
|
||||
1301 => [
|
||||
'code' => 'EPP_RS_ACK',
|
||||
'en-US' => 'Command completed successfully; ack to dequeue',
|
||||
'fr-FR' => "la commande terminé avec succès ; ack à retirer de la file d'attente"
|
||||
],
|
||||
1500 => [
|
||||
],
|
||||
1500 => [
|
||||
'code' => 'EPP_RS_END',
|
||||
'en-US' => 'Command completed successfully; ending session',
|
||||
'fr-FR' => "la commande terminé avec succès ; la session termine"
|
||||
],
|
||||
2000 => [
|
||||
],
|
||||
2000 => [
|
||||
'code' => 'EPP_RF_UNKCMD',
|
||||
'en-US' => 'Unknown command',
|
||||
'fr-FR' => "la commande est inconnue"
|
||||
],
|
||||
2001 => [
|
||||
],
|
||||
2001 => [
|
||||
'code' => 'EPP_RF_SYNTAX',
|
||||
'en-US' => 'Command syntax error',
|
||||
'fr-FR' => "erreur de syntaxe à la commande"
|
||||
],
|
||||
2002 => [
|
||||
],
|
||||
2002 => [
|
||||
'code' => 'EPP_RF_CMDUSE',
|
||||
'en-US' => 'Command use error',
|
||||
'fr-FR' => "erreur d'utilisation à la commande"
|
||||
],
|
||||
2003 => [
|
||||
],
|
||||
2003 => [
|
||||
'code' => 'EPP_RF_PARAM',
|
||||
'en-US' => 'Required parameter missing',
|
||||
'fr-FR' => "paramètre exigé est manquant"
|
||||
],
|
||||
2004 => [
|
||||
],
|
||||
2004 => [
|
||||
'code' => 'EPP_RF_VALRANGE',
|
||||
'en-US' => 'Parameter value range error',
|
||||
'fr-FR' => "la valeur de paramètre est hors d'intervalle"
|
||||
],
|
||||
2005 => [
|
||||
],
|
||||
2005 => [
|
||||
'code' => 'EPP_RF_VALSYNTAX',
|
||||
'en-US' => 'Parameter value syntax error',
|
||||
'fr-FR' => "erreur de syntaxe en valeur de paramètre"
|
||||
],
|
||||
2100 => [
|
||||
],
|
||||
2100 => [
|
||||
'code' => 'EPP_RF_PROTVERS',
|
||||
'en-US' => 'Unimplemented protocol version',
|
||||
'fr-FR' => "la version de protocole n'est pas mise en application"
|
||||
],
|
||||
2101 => [
|
||||
],
|
||||
2101 => [
|
||||
'code' => 'EPP_RF_UNIMPCMD',
|
||||
'en-US' => 'Unimplemented command',
|
||||
'fr-FR' => "la commande n'est pas mise en application"
|
||||
],
|
||||
2102 => [
|
||||
],
|
||||
2102 => [
|
||||
'code' => 'EPP_RF_UNIMPOPT',
|
||||
'en-US' => 'Unimplemented option',
|
||||
'fr-FR' => "l'option n'est pas mise en application"
|
||||
],
|
||||
2103 => [
|
||||
],
|
||||
2103 => [
|
||||
'code' => 'EPP_RF_UNIMPEXT',
|
||||
'en-US' => 'Unimplemented extension',
|
||||
'fr-FR' => "l'extension n'est pas mise en application"
|
||||
],
|
||||
2104 => [
|
||||
],
|
||||
2104 => [
|
||||
'code' => 'EPP_RF_BILLING',
|
||||
'en-US' => 'Billing failure',
|
||||
'fr-FR' => "panne de facturation"
|
||||
],
|
||||
2105 => [
|
||||
],
|
||||
2105 => [
|
||||
'code' => 'EPP_RF_NORENEW',
|
||||
'en-US' => 'Object is not eligible for renewal',
|
||||
'fr-FR' => "l'objet n'est pas habilité au renouvellement"
|
||||
],
|
||||
2106 => [
|
||||
],
|
||||
2106 => [
|
||||
'code' => 'EPP_RF_NOTRANSFER',
|
||||
'en-US' => 'Object is not eligible for transfer',
|
||||
'fr-FR' => "l'objet n'est pas éligible pour être transféré"
|
||||
],
|
||||
2200 => [
|
||||
],
|
||||
2200 => [
|
||||
'code' => 'EPP_RF_AUTHENTICATION',
|
||||
'en-US' => 'Authentication error',
|
||||
'fr-FR' => "erreur d'authentification"
|
||||
],
|
||||
2201 => [
|
||||
],
|
||||
2201 => [
|
||||
'code' => 'EPP_RF_AUTHORIZATION',
|
||||
'en-US' => 'Authorization error',
|
||||
'fr-FR' => "erreur d'autorisation"
|
||||
],
|
||||
2202 => [
|
||||
],
|
||||
2202 => [
|
||||
'code' => 'EPP_RF_INVAUTHOR',
|
||||
'en-US' => 'Invalid authorization information',
|
||||
'fr-FR' => "l'information d'autorisation est incorrecte"
|
||||
],
|
||||
2300 => [
|
||||
],
|
||||
2300 => [
|
||||
'code' => 'EPP_RF_PENDINGTRANSFER',
|
||||
'en-US' => 'Object pending transfer',
|
||||
'fr-FR' => "l'objet est transfert en suspens"
|
||||
],
|
||||
2301 => [
|
||||
],
|
||||
2301 => [
|
||||
'code' => 'EPP_RF_NOTPENDINGTRANSFER',
|
||||
'en-US' => 'Object not pending transfer',
|
||||
'fr-FR' => "l'objet n'est pas transfert en suspens"
|
||||
],
|
||||
2302 => [
|
||||
],
|
||||
2302 => [
|
||||
'code' => 'EPP_RF_EXISTS',
|
||||
'en-US' => 'Object exists',
|
||||
'fr-FR' => "l'objet existe"
|
||||
],
|
||||
2303 => [
|
||||
],
|
||||
2303 => [
|
||||
'code' => 'EPP_RF_NOTEXISTS',
|
||||
'en-US' => 'Object does not exist',
|
||||
'fr-FR' => "l'objet n'existe pas"
|
||||
],
|
||||
2304 => [
|
||||
],
|
||||
2304 => [
|
||||
'code' => 'EPP_RF_STATUS',
|
||||
'en-US' => 'Object status prohibits operation',
|
||||
'fr-FR' => "le statut de l'objet interdit cette exécution"
|
||||
],
|
||||
2305 => [
|
||||
],
|
||||
2305 => [
|
||||
'code' => 'EPP_RF_INUSE',
|
||||
'en-US' => 'Object association prohibits operation',
|
||||
'fr-FR' => "l'assocation de l'objet interdit cette exécution"
|
||||
],
|
||||
2306 => [
|
||||
],
|
||||
2306 => [
|
||||
'code' => 'EPP_RF_POLICYPARAM',
|
||||
'en-US' => 'Parameter value policy error',
|
||||
'fr-FR' => "erreur de politique en valeur du paramètre"
|
||||
],
|
||||
2307 => [
|
||||
],
|
||||
2307 => [
|
||||
'code' => 'EPP_RF_UNIMPLSERVICE',
|
||||
'en-US' => 'Unimplemented object service',
|
||||
'fr-FR' => "le service d'objet n'est pas mis en application"
|
||||
],
|
||||
2308 => [
|
||||
],
|
||||
2308 => [
|
||||
'code' => 'EPP_RF_DATAMGT',
|
||||
'en-US' => 'Data management policy violation',
|
||||
'fr-FR' => "violation de la politique de gestion des données"
|
||||
],
|
||||
2400 => [
|
||||
],
|
||||
2400 => [
|
||||
'code' => 'EPP_RF_FAIL',
|
||||
'en-US' => 'Command failed',
|
||||
'fr-FR' => "la commande a échoué"
|
||||
],
|
||||
2500 => [
|
||||
],
|
||||
2500 => [
|
||||
'code' => 'EPP_RF_CLOSING',
|
||||
'en-US' => 'Command failed; server closing connection',
|
||||
'fr-FR' => "la commande a échoué ; le serveur ferme la connexion"
|
||||
],
|
||||
2501 => [
|
||||
],
|
||||
2501 => [
|
||||
'code' => 'EPP_RF_AUTHCLOSING',
|
||||
'en-US' => 'Authentiction error; server closing connection',
|
||||
'fr-FR' => "erreur d'authentification ; le serveur ferme la connexion"
|
||||
],
|
||||
2502 => [
|
||||
],
|
||||
2502 => [
|
||||
'code' => 'EPP_RF_SESSIONLIMIT',
|
||||
'en-US' => 'Session limit exceeded; server closing connection',
|
||||
'fr-FR' => "la limite de session a été dépassée ; le serveur ferme la connexion"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
if (isset($resultTexts[$code][$lang])) {
|
||||
|
@ -242,7 +242,7 @@ class EppWriter {
|
|||
// Return a default message if the code is not found
|
||||
return 'Unknown response code';
|
||||
}
|
||||
|
||||
|
||||
private function epp_success($resultCode) {
|
||||
// Typically, EPP result codes for successful commands are in the range of 1000-1999.
|
||||
// But you might need to adjust this range based on your specific EPP server responses.
|
||||
|
@ -292,8 +292,8 @@ class EppWriter {
|
|||
if (isset($resp['dcp']['access'])) {
|
||||
$writer->startElement('access');
|
||||
foreach ($resp['dcp']['access'] as $accessType) {
|
||||
$writer->startElement($accessType);
|
||||
$writer->endElement();
|
||||
$writer->startElement($accessType);
|
||||
$writer->endElement();
|
||||
}
|
||||
$writer->endElement(); // End of 'access'
|
||||
}
|
||||
|
@ -306,8 +306,8 @@ class EppWriter {
|
|||
if (isset($resp['dcp']['statement']['purpose'])) {
|
||||
$writer->startElement('purpose');
|
||||
foreach ($resp['dcp']['statement']['purpose'] as $purposeType) {
|
||||
$writer->startElement($purposeType);
|
||||
$writer->endElement();
|
||||
$writer->startElement($purposeType);
|
||||
$writer->endElement();
|
||||
}
|
||||
$writer->endElement(); // End of 'purpose'
|
||||
}
|
||||
|
@ -316,8 +316,8 @@ class EppWriter {
|
|||
if (isset($resp['dcp']['statement']['recipient'])) {
|
||||
$writer->startElement('recipient');
|
||||
foreach ($resp['dcp']['statement']['recipient'] as $recipientType) {
|
||||
$writer->startElement($recipientType);
|
||||
$writer->endElement();
|
||||
$writer->startElement($recipientType);
|
||||
$writer->endElement();
|
||||
}
|
||||
$writer->endElement(); // End of 'recipient'
|
||||
}
|
||||
|
@ -326,8 +326,8 @@ class EppWriter {
|
|||
if (isset($resp['dcp']['statement']['retention'])) {
|
||||
$writer->startElement('retention');
|
||||
foreach ($resp['dcp']['statement']['retention'] as $retentionType) {
|
||||
$writer->startElement($retentionType);
|
||||
$writer->endElement();
|
||||
$writer->startElement($retentionType);
|
||||
$writer->endElement();
|
||||
}
|
||||
$writer->endElement(); // End of 'retention'
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ class EppWriter {
|
|||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->_postamble($writer, $resp);
|
||||
|
||||
}
|
||||
|
@ -461,16 +461,16 @@ class EppWriter {
|
|||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd');
|
||||
|
||||
foreach ($resp['ids'] as $ids) {
|
||||
$writer->startElement('contact:cd');
|
||||
$writer->startElement('contact:id');
|
||||
$writer->startElement('contact:cd');
|
||||
$writer->startElement('contact:id');
|
||||
$writer->writeAttribute('avail', $ids[1]);
|
||||
$writer->text($ids[0]);
|
||||
$writer->endElement(); // End of 'contact:id'
|
||||
|
||||
if (isset($ids[2])) {
|
||||
$writer->endElement(); // End of 'contact:id'
|
||||
|
||||
if (isset($ids[2])) {
|
||||
$writer->writeElement('contact:reason', $ids[2]);
|
||||
}
|
||||
$writer->endElement(); // End of 'contact:cd'
|
||||
}
|
||||
$writer->endElement(); // End of 'contact:cd'
|
||||
}
|
||||
|
||||
$writer->endElement(); // End of 'contact:chkData'
|
||||
|
@ -479,7 +479,7 @@ class EppWriter {
|
|||
|
||||
$this->_postamble($writer, $resp);
|
||||
}
|
||||
|
||||
|
||||
private function _info_contact($writer, $resp) {
|
||||
$this->_preamble($writer, $resp);
|
||||
|
||||
|
@ -545,15 +545,21 @@ class EppWriter {
|
|||
$writer->writeElement('contact:email', $resp['email']);
|
||||
$writer->writeElement('contact:clID', $resp['clID']);
|
||||
$writer->writeElement('contact:crID', $resp['crID']);
|
||||
$writer->writeElement('contact:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:crDate', $crDateFormatted);
|
||||
if (isset($resp['upID'])) {
|
||||
$writer->writeElement('contact:upID', $resp['upID']);
|
||||
}
|
||||
if (isset($resp['upDate'])) {
|
||||
$writer->writeElement('contact:upDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['upDate'])));
|
||||
$upDate = new DateTime($resp['upDate']);
|
||||
$upDateFormatted = $upDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:upDate', $upDateFormatted);
|
||||
}
|
||||
if (isset($resp['trDate'])) {
|
||||
$writer->writeElement('contact:trDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['trDate'])));
|
||||
$trDate = new DateTime($resp['trDate']);
|
||||
$trDateFormatted = $trDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:trDate', $trDateFormatted);
|
||||
}
|
||||
|
||||
// Handling 'contact:authInfo'
|
||||
|
@ -601,9 +607,13 @@ class EppWriter {
|
|||
$writer->writeElement('contact:id', $resp['id']);
|
||||
$writer->writeElement('contact:trStatus', $resp['trStatus']);
|
||||
$writer->writeElement('contact:reID', $resp['reID']);
|
||||
$writer->writeElement('contact:reDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['reDate'])));
|
||||
$reDate = new DateTime($resp['reDate']);
|
||||
$reDateFormatted = $reDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:reDate', $reDateFormatted);
|
||||
$writer->writeElement('contact:acID', $resp['acID']);
|
||||
$writer->writeElement('contact:acDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['acDate'])));
|
||||
$acDate = new DateTime($resp['acDate']);
|
||||
$acDateFormatted = $acDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:acDate', $acDateFormatted);
|
||||
$writer->endElement(); // End of 'contact:trnData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
|
@ -620,7 +630,9 @@ class EppWriter {
|
|||
$writer->writeAttribute('xmlns:contact', 'urn:ietf:params:xml:ns:contact-1.0');
|
||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd');
|
||||
$writer->writeElement('contact:id', $resp['id']);
|
||||
$writer->writeElement('contact:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('contact:crDate', $crDateFormatted);
|
||||
$writer->endElement(); // End of 'contact:creData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
|
@ -663,8 +675,12 @@ class EppWriter {
|
|||
$writer->writeAttribute('xmlns:domain', 'urn:ietf:params:xml:ns:domain-1.0');
|
||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd');
|
||||
$writer->writeElement('domain:name', $resp['name']);
|
||||
$writer->writeElement('domain:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$writer->writeElement('domain:exDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['exDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:crDate', $crDateFormatted);
|
||||
$exDate = new DateTime($resp['exDate']);
|
||||
$exDateFormatted = $exDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:exDate', $exDateFormatted);
|
||||
$writer->endElement(); // End of 'domain:creData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
|
@ -720,19 +736,27 @@ class EppWriter {
|
|||
$writer->writeElement('domain:crID', $resp['crID']);
|
||||
}
|
||||
if (isset($resp['crDate'])) {
|
||||
$writer->writeElement('domain:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:crDate', $crDateFormatted);
|
||||
}
|
||||
if (isset($resp['exDate'])) {
|
||||
$writer->writeElement('domain:exDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['exDate'])));
|
||||
$exDate = new DateTime($resp['exDate']);
|
||||
$exDateFormatted = $exDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:exDate', $exDateFormatted);
|
||||
}
|
||||
if (isset($resp['upID'])) {
|
||||
$writer->writeElement('domain:upID', $resp['upID']);
|
||||
}
|
||||
if (isset($resp['upDate'])) {
|
||||
$writer->writeElement('domain:upDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['upDate'])));
|
||||
$upDate = new DateTime($resp['upDate']);
|
||||
$upDateFormatted = $upDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:upDate', $upDateFormatted);
|
||||
}
|
||||
if (isset($resp['trDate'])) {
|
||||
$writer->writeElement('domain:trDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['trDate'])));
|
||||
$trDate = new DateTime($resp['trDate']);
|
||||
$trDateFormatted = $trDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:trDate', $trDateFormatted);
|
||||
}
|
||||
if ($resp['authInfo'] == 'valid') {
|
||||
$writer->startElement('domain:authInfo');
|
||||
|
@ -819,7 +843,9 @@ class EppWriter {
|
|||
$writer->writeAttribute('xmlns:domain', 'urn:ietf:params:xml:ns:domain-1.0');
|
||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd');
|
||||
$writer->writeElement('domain:name', $resp['name']);
|
||||
$writer->writeElement('domain:exDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['exDate'])));
|
||||
$exDate = new DateTime($resp['exDate']);
|
||||
$exDateFormatted = $exDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:exDate', $exDateFormatted);
|
||||
$writer->endElement(); // End of 'domain:renData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
|
@ -838,11 +864,17 @@ class EppWriter {
|
|||
$writer->writeElement('domain:name', $resp['name']);
|
||||
$writer->writeElement('domain:trStatus', $resp['trStatus']);
|
||||
$writer->writeElement('domain:reID', $resp['reID']);
|
||||
$writer->writeElement('domain:reDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['reDate'])));
|
||||
$reDate = new DateTime($resp['reDate']);
|
||||
$reDateFormatted = $reDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:reDate', $reDateFormatted);
|
||||
$writer->writeElement('domain:acID', $resp['acID']);
|
||||
$writer->writeElement('domain:acDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['acDate'])));
|
||||
$acDate = new DateTime($resp['acDate']);
|
||||
$acDateFormatted = $acDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:acDate', $acDateFormatted);
|
||||
if (isset($resp['exDate'])) {
|
||||
$writer->writeElement('domain:exDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['exDate'])));
|
||||
$exDate = new DateTime($resp['exDate']);
|
||||
$exDateFormatted = $exDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('domain:exDate', $exDateFormatted);
|
||||
}
|
||||
$writer->endElement(); // End of 'domain:trnData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
|
@ -886,7 +918,9 @@ class EppWriter {
|
|||
$writer->writeAttribute('xmlns:host', 'urn:ietf:params:xml:ns:host-1.0');
|
||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd');
|
||||
$writer->writeElement('host:name', $resp['name']);
|
||||
$writer->writeElement('host:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('host:crDate', $crDateFormatted);
|
||||
$writer->endElement(); // End of 'host:creData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
}
|
||||
|
@ -929,15 +963,21 @@ class EppWriter {
|
|||
}
|
||||
$writer->writeElement('host:clID', $resp['clID']);
|
||||
$writer->writeElement('host:crID', $resp['crID']);
|
||||
$writer->writeElement('host:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
$crDate = new DateTime($resp['crDate']);
|
||||
$crDateFormatted = $crDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('host:crDate', $crDateFormatted);
|
||||
if (isset($resp['upID'])) {
|
||||
$writer->writeElement('host:upID', $resp['upID']);
|
||||
}
|
||||
if (isset($resp['upDate'])) {
|
||||
$writer->writeElement('host:upDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['upDate'])));
|
||||
$upDate = new DateTime($resp['upDate']);
|
||||
$upDateFormatted = $upDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('host:upDate', $upDateFormatted);
|
||||
}
|
||||
if (isset($resp['trDate'])) {
|
||||
$writer->writeElement('host:trDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['trDate'])));
|
||||
$trDate = new DateTime($resp['trDate']);
|
||||
$trDateFormatted = $trDate->format('Y-m-d\TH:i:s.v\Z');
|
||||
$writer->writeElement('host:trDate', $trDateFormatted);
|
||||
}
|
||||
$writer->endElement(); // End of 'host:infData'
|
||||
$writer->endElement(); // End of 'resData'
|
||||
|
|
|
@ -10,7 +10,8 @@ function checkLogin($db, $clID, $pw) {
|
|||
|
||||
function sendGreeting($conn) {
|
||||
global $c;
|
||||
$currentDate = gmdate('Y-m-d\TH:i:s\Z');
|
||||
$currentDateTime = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$currentDate = $currentDateTime->format("Y-m-d\TH:i:s.v\Z");
|
||||
|
||||
$response = [
|
||||
'command' => 'greeting',
|
||||
|
@ -224,8 +225,9 @@ function createTransaction($db, $clid, $clTRID, $clTRIDframe) {
|
|||
$stmt = $db->prepare("INSERT INTO `registryTransaction`.`transaction_identifier` (`registrar_id`,`clTRID`,`clTRIDframe`,`cldate`,`clmicrosecond`) VALUES(?,?,?,?,?)");
|
||||
|
||||
// Get date and microsecond for cl transaction
|
||||
$currentDateTime = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$cldate = $currentDateTime->format("Y-m-d H:i:s.v");
|
||||
$dateForClTransaction = microtime(true);
|
||||
$cldate = date("Y-m-d H:i:s", $dateForClTransaction);
|
||||
$clmicrosecond = sprintf("%06d", ($dateForClTransaction - floor($dateForClTransaction)) * 1000000);
|
||||
|
||||
if (empty($clTRID)) {
|
||||
|
@ -253,8 +255,9 @@ function updateTransaction($db, $cmd, $obj_type, $obj_id, $code, $msg, $svTRID,
|
|||
$stmt = $db->prepare("UPDATE `registryTransaction`.`transaction_identifier` SET `cmd` = ?, `obj_type` = ?, `obj_id` = ?, `code` = ?, `msg` = ?, `svTRID` = ?, `svTRIDframe` = ?, `svdate` = ?, `svmicrosecond` = ? WHERE `id` = ?");
|
||||
|
||||
// Get date and microsecond for sv transaction
|
||||
$currentDateTime = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$svdate = $currentDateTime->format("Y-m-d H:i:s.v");
|
||||
$dateForSvTransaction = microtime(true);
|
||||
$svdate = date("Y-m-d H:i:s", $dateForSvTransaction);
|
||||
$svmicrosecond = sprintf("%06d", ($dateForSvTransaction - floor($dateForSvTransaction)) * 1000000);
|
||||
|
||||
// Execute the statement
|
||||
|
@ -320,68 +323,68 @@ function getClid(PDO $db, string $clid): ?int {
|
|||
* -5, unsupported publickey
|
||||
*/
|
||||
function dnssec_key2ds($owner, $flags, $protocol, $algorithm, $publickey) {
|
||||
// define paramenter check variants
|
||||
$regex_owner = '/^[a-z0-9\-]+\.[a-z]+\.$/';
|
||||
$allowed_flags = array(256, 257);
|
||||
$allowed_protocol = array(3);
|
||||
$allowed_algorithm = array(2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16);
|
||||
$regex_publickey = '/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/';
|
||||
|
||||
// do parameter checks and break if failed
|
||||
if(!preg_match($regex_owner, $owner)) return -1;
|
||||
if(!in_array($flags, $allowed_flags)) return -2;
|
||||
if(!in_array($protocol, $allowed_protocol)) return -3;
|
||||
if(!in_array($algorithm, $allowed_algorithm)) return -4;
|
||||
if(!preg_match($regex_publickey, $publickey)) return -5;
|
||||
|
||||
// calculate hex of parameters
|
||||
$owner_hex = '';
|
||||
$parts = explode(".", substr($owner, 0, -1));
|
||||
foreach ($parts as $part) {
|
||||
$len = dechex(strlen($part));
|
||||
$owner_hex .= str_repeat('0', 2 - strlen($len)).$len;
|
||||
$part = str_split($part);
|
||||
for ($i = 0; $i < count($part); $i++) {
|
||||
$byte = strtoupper(dechex(ord($part[$i])));
|
||||
$byte = str_repeat('0', 2 - strlen($byte)).$byte;
|
||||
$owner_hex .= $byte;
|
||||
}
|
||||
}
|
||||
$owner_hex .= '00';
|
||||
$flags_hex = sprintf("%04d", dechex($flags));
|
||||
$protocol_hex = sprintf("%02d", dechex($protocol));
|
||||
$algorithm_hex = sprintf("%02d", dechex($algorithm));
|
||||
$publickey_hex = bin2hex(base64_decode($publickey));
|
||||
|
||||
// calculate keytag using algorithm defined in rfc
|
||||
$string = hex2bin($flags_hex.$protocol_hex.$algorithm_hex.$publickey_hex);
|
||||
$sum = 0;
|
||||
for($i = 0; $i < strlen($string); $i++) {
|
||||
$b = ord($string[$i]);
|
||||
$sum += ($i & 1) ? $b : $b << 8;
|
||||
}
|
||||
$keytag = 0xffff & ($sum + ($sum >> 16));
|
||||
|
||||
// calculate digest using rfc specified hashing algorithms
|
||||
$string = hex2bin($owner_hex.$flags_hex.$protocol_hex.$algorithm_hex.$publickey_hex);
|
||||
$digest_sha1 = strtoupper(sha1($string));
|
||||
$digest_sha256 = strtoupper(hash('sha256', $string));
|
||||
|
||||
// return results and also copied parameters
|
||||
return array(
|
||||
//'debug' => array($owner_hex, $flags_hex, $protocol_hex, $algorithm_hex, $publickey_hex),
|
||||
'owner' => $owner,
|
||||
'keytag' => $keytag,
|
||||
'algorithm' => $algorithm,
|
||||
'digest' => array(
|
||||
array(
|
||||
'type' => 1,
|
||||
'hash' => $digest_sha1
|
||||
),
|
||||
array(
|
||||
'type' => 2,
|
||||
'hash' => $digest_sha256
|
||||
)
|
||||
)
|
||||
);
|
||||
// define paramenter check variants
|
||||
$regex_owner = '/^[a-z0-9\-]+\.[a-z]+\.$/';
|
||||
$allowed_flags = array(256, 257);
|
||||
$allowed_protocol = array(3);
|
||||
$allowed_algorithm = array(2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16);
|
||||
$regex_publickey = '/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/';
|
||||
|
||||
// do parameter checks and break if failed
|
||||
if(!preg_match($regex_owner, $owner)) return -1;
|
||||
if(!in_array($flags, $allowed_flags)) return -2;
|
||||
if(!in_array($protocol, $allowed_protocol)) return -3;
|
||||
if(!in_array($algorithm, $allowed_algorithm)) return -4;
|
||||
if(!preg_match($regex_publickey, $publickey)) return -5;
|
||||
|
||||
// calculate hex of parameters
|
||||
$owner_hex = '';
|
||||
$parts = explode(".", substr($owner, 0, -1));
|
||||
foreach ($parts as $part) {
|
||||
$len = dechex(strlen($part));
|
||||
$owner_hex .= str_repeat('0', 2 - strlen($len)).$len;
|
||||
$part = str_split($part);
|
||||
for ($i = 0; $i < count($part); $i++) {
|
||||
$byte = strtoupper(dechex(ord($part[$i])));
|
||||
$byte = str_repeat('0', 2 - strlen($byte)).$byte;
|
||||
$owner_hex .= $byte;
|
||||
}
|
||||
}
|
||||
$owner_hex .= '00';
|
||||
$flags_hex = sprintf("%04d", dechex($flags));
|
||||
$protocol_hex = sprintf("%02d", dechex($protocol));
|
||||
$algorithm_hex = sprintf("%02d", dechex($algorithm));
|
||||
$publickey_hex = bin2hex(base64_decode($publickey));
|
||||
|
||||
// calculate keytag using algorithm defined in rfc
|
||||
$string = hex2bin($flags_hex.$protocol_hex.$algorithm_hex.$publickey_hex);
|
||||
$sum = 0;
|
||||
for($i = 0; $i < strlen($string); $i++) {
|
||||
$b = ord($string[$i]);
|
||||
$sum += ($i & 1) ? $b : $b << 8;
|
||||
}
|
||||
$keytag = 0xffff & ($sum + ($sum >> 16));
|
||||
|
||||
// calculate digest using rfc specified hashing algorithms
|
||||
$string = hex2bin($owner_hex.$flags_hex.$protocol_hex.$algorithm_hex.$publickey_hex);
|
||||
$digest_sha1 = strtoupper(sha1($string));
|
||||
$digest_sha256 = strtoupper(hash('sha256', $string));
|
||||
|
||||
// return results and also copied parameters
|
||||
return array(
|
||||
//'debug' => array($owner_hex, $flags_hex, $protocol_hex, $algorithm_hex, $publickey_hex),
|
||||
'owner' => $owner,
|
||||
'keytag' => $keytag,
|
||||
'algorithm' => $algorithm,
|
||||
'digest' => array(
|
||||
array(
|
||||
'type' => 1,
|
||||
'hash' => $digest_sha1
|
||||
),
|
||||
array(
|
||||
'type' => 2,
|
||||
'hash' => $digest_sha256
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue