This commit is contained in:
Pinga 2023-12-29 20:35:23 +02:00
parent bd5ada89b9
commit d5be4841f5
2 changed files with 23 additions and 1 deletions

View file

@ -902,7 +902,7 @@ class EppWriter {
$writer->endElement(); // End of 'resData'
// Begin the extension part if any of the extensions are present
if (isset($resp['rgpstatus']) || isset($resp['secDNS']) || isset($resp['launch_phase'])) {
if (isset($resp['rgpstatus']) || isset($resp['secDNS']) || isset($resp['launch_phase'] || isset($resp['allocation'])) {
$writer->startElement('extension');
// Handle RGP status
@ -978,6 +978,14 @@ class EppWriter {
$writer->endElement(); // End of 'launch:infData'
}
// Handle Allocation Token
if (isset($resp['allocation'])) {
$writer->startElement('allocationToken:allocationToken');
$writer->writeAttribute('xmlns:allocationToken', 'urn:ietf:params:xml:ns:allocationToken-1.0');
$writer->text($resp['allocation']);
$writer->endElement(); // End of 'allocationToken:allocationToken'
}
$writer->endElement(); // End of 'extension'
}

View file

@ -175,6 +175,7 @@ function processDomainInfo($conn, $db, $xml, $trans) {
$extensionNode = $xml->command->extension;
if (isset($extensionNode)) {
$launch_info = $xml->xpath('//launch:info')[0] ?? null;
$allocation_token = $xml->xpath('//allocationToken:info')[0] ?? null;
}
$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
@ -476,6 +477,19 @@ function processDomainInfo($conn, $db, $xml, $trans) {
$response['rgpstatus'] = $rgpstatus;
}
if ($allocation_token !== null) {
$stmt = $db->prepare("SELECT token FROM allocation_tokens WHERE domain_name = :domainName LIMIT 1");
$stmt->bindParam(':domainName', $domainName, PDO::PARAM_STR);
$stmt->execute();
$token = $stmt->fetchColumn();
if ($token) {
$response['allocation'] = $token;
} else {
$response['allocation'] = 'ERROR';
}
}
$epp = new EPP\EppWriter();
$xml = $epp->epp_writer($response);
updateTransaction($db, 'info', 'domain', 'D_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);