mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-31 01:34:00 +02:00
Added epp launch phase info
This commit is contained in:
parent
e7e1b61c8a
commit
b0a3d4e8de
3 changed files with 295 additions and 162 deletions
|
@ -822,6 +822,7 @@ class EppWriter {
|
||||||
$writer->writeAttribute('xsi:schemaLocation', 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd');
|
$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:name', $resp['name']);
|
||||||
$writer->writeElement('domain:roid', $resp['roid']);
|
$writer->writeElement('domain:roid', $resp['roid']);
|
||||||
|
if (is_array($resp['status'])) {
|
||||||
foreach ($resp['status'] as $s) {
|
foreach ($resp['status'] as $s) {
|
||||||
if (isset($s[1]) && isset($s[2])) {
|
if (isset($s[1]) && isset($s[2])) {
|
||||||
$writer->writeElement('domain:status', $s[2], ['s' => $s[0], 'lang' => $s[1]]);
|
$writer->writeElement('domain:status', $s[2], ['s' => $s[0], 'lang' => $s[1]]);
|
||||||
|
@ -831,6 +832,11 @@ class EppWriter {
|
||||||
$writer->endElement();
|
$writer->endElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$writer->startElement('domain:status');
|
||||||
|
$writer->writeAttribute('s', $resp['status']);
|
||||||
|
$writer->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($resp['registrant'])) {
|
if (isset($resp['registrant'])) {
|
||||||
$writer->writeElement('domain:registrant', $resp['registrant']);
|
$writer->writeElement('domain:registrant', $resp['registrant']);
|
||||||
|
@ -896,7 +902,7 @@ class EppWriter {
|
||||||
$writer->endElement(); // End of 'resData'
|
$writer->endElement(); // End of 'resData'
|
||||||
|
|
||||||
// Begin the extension part if any of the extensions are present
|
// Begin the extension part if any of the extensions are present
|
||||||
if (isset($resp['rgpstatus']) || isset($resp['secDNS'])) {
|
if (isset($resp['rgpstatus']) || isset($resp['secDNS']) || isset($resp['launch_phase'])) {
|
||||||
$writer->startElement('extension');
|
$writer->startElement('extension');
|
||||||
|
|
||||||
// Handle RGP status
|
// Handle RGP status
|
||||||
|
@ -951,6 +957,28 @@ class EppWriter {
|
||||||
$writer->endElement(); // End of 'secDNS:infData'
|
$writer->endElement(); // End of 'secDNS:infData'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Launch Phase
|
||||||
|
if (isset($resp['launch_phase'])) {
|
||||||
|
$writer->startElement('launch:infData');
|
||||||
|
$writer->writeAttribute('xmlns:launch', 'urn:ietf:params:xml:ns:launch-1.0');
|
||||||
|
$writer->writeElement('launch:phase', $resp['launch_phase']);
|
||||||
|
if (!empty($resp['launch_application_id'])) {
|
||||||
|
$writer->writeElement('launch:applicationID', $resp['launch_application_id']);
|
||||||
|
}
|
||||||
|
$writer->startElement('launch:status');
|
||||||
|
$writer->writeAttribute('s', $resp['launch_status']);
|
||||||
|
$writer->endElement(); // End of 'launch:status'
|
||||||
|
if (isset($resp['launch_mark'])) {
|
||||||
|
$writer->startElement('mark:mark');
|
||||||
|
$writer->writeAttribute('xmlns:mark', 'urn:ietf:params:xml:ns:mark-1.0');
|
||||||
|
$value = $resp['launch_mark'];
|
||||||
|
$writer->text($value);
|
||||||
|
$writer->endElement(); // End of 'mark:mark'
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer->endElement(); // End of 'launch:infData'
|
||||||
|
}
|
||||||
|
|
||||||
$writer->endElement(); // End of 'extension'
|
$writer->endElement(); // End of 'extension'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,11 +211,112 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
|
|
||||||
// Check if includeMark is 'true'
|
// Check if includeMark is 'true'
|
||||||
$includeMarkBool = strtolower($includeMark) === 'true';
|
$includeMarkBool = strtolower($includeMark) === 'true';
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$query = "SELECT * FROM application WHERE name = :name AND phase_type = :phase";
|
||||||
|
|
||||||
|
if (!empty($applicationID)) {
|
||||||
|
$query .= " AND application_id = :applicationID";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $db->prepare($query);
|
||||||
|
$stmt->bindParam(':name', $domainName);
|
||||||
|
$stmt->bindParam(':phase', $phaseType);
|
||||||
|
|
||||||
|
if (!empty($applicationID)) {
|
||||||
|
$stmt->bindParam(':applicationID', $applicationID);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$domain = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$domain) {
|
||||||
|
sendEppError($conn, $db, 2303, 'Application does not exist', $clTRID, $trans);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch contacts
|
||||||
|
$stmt = $db->prepare("SELECT * FROM application_contact_map WHERE domain_id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
$contacts = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$transformedContacts = [];
|
||||||
|
foreach ($contacts as $contact) {
|
||||||
|
$transformedContacts[] = [$contact['type'], getContactIdentifier($db, $contact['contact_id'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch hosts
|
||||||
|
$stmt = $db->prepare("SELECT * FROM application_host_map WHERE domain_id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
$hosts = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$transformedHosts = [];
|
||||||
|
if ($hosts) {
|
||||||
|
foreach ($hosts as $host) {
|
||||||
|
$transformedHosts[] = [getHost($db, $host['host_id'])];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch status
|
||||||
|
$stmt = $db->prepare("SELECT * FROM application_status WHERE domain_id = :id LIMIT 1");
|
||||||
|
$stmt->execute(['id' => $domain['id']]);
|
||||||
|
$status = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Fetch registrant identifier
|
||||||
|
$stmt = $db->prepare("SELECT identifier FROM contact WHERE id = :id");
|
||||||
|
$stmt->execute(['id' => $domain['registrant']]);
|
||||||
|
$registrant_id = $stmt->fetch(PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
|
$svTRID = generateSvTRID();
|
||||||
|
$response = [
|
||||||
|
'command' => 'info_domain',
|
||||||
|
'clTRID' => $clTRID,
|
||||||
|
'svTRID' => $svTRID,
|
||||||
|
'resultCode' => 1000,
|
||||||
|
'msg' => 'Command completed successfully',
|
||||||
|
'name' => $domain['name'],
|
||||||
|
'roid' => 'A' . $domain['id'],
|
||||||
|
'status' => $status['status'],
|
||||||
|
'registrant' => $registrant_id,
|
||||||
|
'contact' => $transformedContacts,
|
||||||
|
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||||
|
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||||
|
'crDate' => $domain['crdate'],
|
||||||
|
'exDate' => $domain['exdate']
|
||||||
|
];
|
||||||
|
if (isset($domain['authinfo'])) {
|
||||||
|
$response['authInfo'] = 'valid';
|
||||||
|
$response['authInfo_type'] = $domain['authtype'];
|
||||||
|
$response['authInfo_val'] = $domain['authinfo'];
|
||||||
|
} else {
|
||||||
|
$response['authInfo'] = 'invalid';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conditionally add hostObj if hosts are available from domain_host_map
|
||||||
|
if (!empty($transformedHosts)) {
|
||||||
|
$response['hostObj'] = $transformedHosts;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response['launch_phase'] = $phaseType;
|
||||||
|
$response['launch_application_id'] = $applicationID;
|
||||||
|
$response['launch_status'] = $status['status'];
|
||||||
|
if ($includeMarkBool) {
|
||||||
|
$response['launch_mark'] = $domain['smd'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$epp = new EPP\EppWriter();
|
||||||
|
$xml = $epp->epp_writer($response);
|
||||||
|
updateTransaction($db, 'info', 'domain', 'A_'.$domain['id'], 1000, 'Command completed successfully', $svTRID, $xml, $trans);
|
||||||
|
sendEppResponse($conn, $xml);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
$stmt = $db->prepare("SELECT * FROM domain WHERE name = :name");
|
$stmt = $db->prepare("SELECT * FROM domain WHERE name = :name");
|
||||||
$stmt->execute(['name' => $domainName]);
|
$stmt->bindParam(':name', $domainName);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
$domain = $stmt->fetch(PDO::FETCH_ASSOC);
|
$domain = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
@ -382,6 +483,9 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFundsInfo($conn, $db, $xml, $clid, $trans) {
|
function processFundsInfo($conn, $db, $xml, $clid, $trans) {
|
||||||
|
|
|
@ -110,6 +110,7 @@ $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permi
|
||||||
$xml->registerXPathNamespace('secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1');
|
$xml->registerXPathNamespace('secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1');
|
||||||
$xml->registerXPathNamespace('launch', 'urn:ietf:params:xml:ns:launch-1.0');
|
$xml->registerXPathNamespace('launch', 'urn:ietf:params:xml:ns:launch-1.0');
|
||||||
$xml->registerXPathNamespace('fee', 'urn:ietf:params:xml:ns:epp:fee-1.0');
|
$xml->registerXPathNamespace('fee', 'urn:ietf:params:xml:ns:epp:fee-1.0');
|
||||||
|
$xml->registerXPathNamespace('mark', 'urn:ietf:params:xml:ns:mark-1.0');
|
||||||
|
|
||||||
if ($xml === false) {
|
if ($xml === false) {
|
||||||
sendEppError($conn, $pdo, 2001, 'Invalid XML');
|
sendEppError($conn, $pdo, 2001, 'Invalid XML');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue