mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-02 15:51:49 +02:00
Final EPP update for the day
This commit is contained in:
parent
012f859c09
commit
595d8b7b2f
2 changed files with 38 additions and 16 deletions
|
@ -542,15 +542,15 @@ class EppWriter {
|
|||
$writer->writeElement('contact:email', $resp['email']);
|
||||
$writer->writeElement('contact:clID', $resp['clID']);
|
||||
$writer->writeElement('contact:crID', $resp['crID']);
|
||||
$writer->writeElement('contact:crDate', $resp['crDate']);
|
||||
$writer->writeElement('contact:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
if (isset($resp['upID'])) {
|
||||
$writer->writeElement('contact:upID', $resp['upID']);
|
||||
}
|
||||
if (isset($resp['upDate'])) {
|
||||
$writer->writeElement('contact:upDate', $resp['upDate']);
|
||||
$writer->writeElement('contact:upDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['upDate'])));
|
||||
}
|
||||
if (isset($resp['trDate'])) {
|
||||
$writer->writeElement('contact:trDate', $resp['trDate']);
|
||||
$writer->writeElement('contact:trDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['trDate'])));
|
||||
}
|
||||
|
||||
// Handling 'contact:authInfo'
|
||||
|
@ -717,19 +717,19 @@ class EppWriter {
|
|||
$writer->writeElement('domain:crID', $resp['crID']);
|
||||
}
|
||||
if (isset($resp['crDate'])) {
|
||||
$writer->writeElement('domain:crDate', $resp['crDate']);
|
||||
$writer->writeElement('domain:crDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['crDate'])));
|
||||
}
|
||||
if (isset($resp['exDate'])) {
|
||||
$writer->writeElement('domain:exDate', $resp['exDate']);
|
||||
$writer->writeElement('domain:exDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['exDate'])));
|
||||
}
|
||||
if (isset($resp['upID'])) {
|
||||
$writer->writeElement('domain:upID', $resp['upID']);
|
||||
}
|
||||
if (isset($resp['upDate'])) {
|
||||
$writer->writeElement('domain:upDate', $resp['upDate']);
|
||||
$writer->writeElement('domain:upDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['upDate'])));
|
||||
}
|
||||
if (isset($resp['trDate'])) {
|
||||
$writer->writeElement('domain:trDate', $resp['trDate']);
|
||||
$writer->writeElement('domain:trDate', gmdate('Y-m-d\TH:i:s\.0\Z', strtotime($resp['trDate'])));
|
||||
}
|
||||
if ($resp['authInfo'] == 'valid') {
|
||||
$writer->startElement('domain:authInfo');
|
||||
|
|
40
epp/epp.php
40
epp/epp.php
|
@ -209,6 +209,27 @@ function generateSvTRID($prefix = "Namingo") {
|
|||
return $svTRID;
|
||||
}
|
||||
|
||||
function getRegistrarClid(PDO $db, $id) {
|
||||
$stmt = $db->prepare("SELECT clid FROM registrar WHERE id = :id");
|
||||
$stmt->execute([':id' => $id]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['clid'] ?? null; // Return the clid if found, otherwise return null
|
||||
}
|
||||
|
||||
function getContactIdentifier(PDO $db, $id) {
|
||||
$stmt = $db->prepare("SELECT identifier FROM contact WHERE id = :id");
|
||||
$stmt->execute([':id' => $id]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['identifier'] ?? null; // Return the identifier if found, otherwise return null
|
||||
}
|
||||
|
||||
function getHost(PDO $db, $id) {
|
||||
$stmt = $db->prepare("SELECT name FROM host WHERE id = :id");
|
||||
$stmt->execute([':id' => $id]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
return $result['name'] ?? null; // Return the name if found, otherwise return null
|
||||
}
|
||||
|
||||
function processContactCheck($conn, $db, $xml) {
|
||||
$contactIDs = $xml->command->check->children('urn:ietf:params:xml:ns:contact-1.0')->check->{'id'};
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
@ -322,10 +343,10 @@ function processContactInfo($conn, $db, $xml) {
|
|||
'voice' => $contact['voice'],
|
||||
'fax' => $contact['fax'],
|
||||
'email' => $contact['email'],
|
||||
'clID' => $contact['clid'],
|
||||
'crID' => $contact['crid'],
|
||||
'clID' => getRegistrarClid($db, $contact['clid']),
|
||||
'crID' => getRegistrarClid($db, $contact['crid']),
|
||||
'crDate' => $contact['crdate'],
|
||||
'upID' => $contact['upid'],
|
||||
'upID' => getRegistrarClid($db, $contact['upid']),
|
||||
'upDate' => $contact['update'],
|
||||
'authInfo' => 'valid',
|
||||
'authInfo_type' => $authInfo['authtype'],
|
||||
|
@ -468,7 +489,7 @@ function processDomainInfo($conn, $db, $xml) {
|
|||
|
||||
$transformedContacts = [];
|
||||
foreach ($contacts as $contact) {
|
||||
$transformedContacts[] = [$contact['type'], $contact['contact_id']];
|
||||
$transformedContacts[] = [$contact['type'], getContactIdentifier($db, $contact['contact_id'])];
|
||||
}
|
||||
|
||||
// Fetch hosts
|
||||
|
@ -478,7 +499,7 @@ function processDomainInfo($conn, $db, $xml) {
|
|||
|
||||
$transformedHosts = [];
|
||||
foreach ($hosts as $host) {
|
||||
$transformedHosts[] = [$host['host_id']];
|
||||
$transformedHosts[] = [getHost($db, $host['host_id'])];
|
||||
}
|
||||
|
||||
// Fetch authInfo
|
||||
|
@ -507,12 +528,13 @@ function processDomainInfo($conn, $db, $xml) {
|
|||
'status' => $statusArray,
|
||||
'registrant' => $domain['registrant'],
|
||||
'contact' => $transformedContacts,
|
||||
'hostObj' => $transformedHosts,
|
||||
'clID' => $domain['clid'],
|
||||
'crID' => $domain['crid'],
|
||||
'hostObj' => $transformedHosts,
|
||||
'clID' => getRegistrarClid($db, $domain['clid']),
|
||||
'crID' => getRegistrarClid($db, $domain['crid']),
|
||||
'crDate' => $domain['crdate'],
|
||||
'upID' => $domain['upid'],
|
||||
'upID' => getRegistrarClid($db, $domain['upid']),
|
||||
'upDate' => $domain['update'],
|
||||
'exDate' => $domain['exdate'],
|
||||
'trDate' => $domain['trdate'],
|
||||
'authInfo' => 'valid',
|
||||
'authInfo_type' => $authInfo['authtype'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue