diff --git a/automation/change-domain-status.php b/automation/change-domain-status.php index f6b766d..eede5c7 100644 --- a/automation/change-domain-status.php +++ b/automation/change-domain-status.php @@ -59,7 +59,8 @@ if ($auto_renew) { $dbh->exec("INSERT INTO `domain_status` (`domain_id`, `status`) VALUES('$domain_id', 'pendingDelete')"); } } - echo date("Y-m-d H:i:s") . " - $domain_id\t|\t$name\t|\trgpStatus:autoRenewPeriod exdate:$exdate\n"; + $currentDateTime = new DateTime(); + echo $currentDateTime->format("Y-m-d H:i:s.v") . " - $domain_id\t|\t$name\t|\trgpStatus:autoRenewPeriod exdate:$exdate\n"; } } else { $grace_period = 30; @@ -87,8 +88,8 @@ if ($auto_renew) { $dbh->exec("UPDATE `domain` SET `rgpstatus` = 'redemptionPeriod', `delTime` = DATE_ADD(`exdate`, INTERVAL $grace_period DAY) WHERE `id` = '$domain_id'"); $dbh->exec("INSERT INTO `domain_status` (`domain_id`, `status`) VALUES('$domain_id', 'pendingDelete')"); } - - echo date("Y-m-d H:i:s") . " - $domain_id\t|\t$name\t|\trgpStatus:redemptionPeriod exdate:$exdate\n"; + $currentDateTime = new DateTime(); + echo $currentDateTime->format("Y-m-d H:i:s.v") . " - $domain_id\t|\t$name\t|\trgpStatus:redemptionPeriod exdate:$exdate\n"; } } @@ -138,8 +139,8 @@ while ($row = $sth_pendingdelete->fetch(PDO::FETCH_ASSOC)) { if ($set_pendingDelete) { $dbh->exec("UPDATE `domain` SET `rgpstatus` = 'pendingDelete' WHERE `id` = '$domain_id'"); } - - echo date("Y-m-d H:i:s") . " - $domain_id\t|\t$name\t|\trgpStatus:pendingDelete exdate:$exdate\n"; + $currentDateTime = new DateTime(); + echo $currentDateTime->format("Y-m-d H:i:s.v") . " - $domain_id\t|\t$name\t|\trgpStatus:pendingDelete exdate:$exdate\n"; } // Pending Restore @@ -153,7 +154,8 @@ while ($row = $sth_pendingRestore->fetch(PDO::FETCH_ASSOC)) { $dbh->exec("UPDATE `domain` SET `rgpstatus` = 'redemptionPeriod' WHERE `id` = '$domain_id'"); - echo date("Y-m-d H:i:s") . " - $domain_id\t|\t$name\t|\tback to redemptionPeriod from pendingRestore exdate:$exdate\n"; + $currentDateTime = new DateTime(); + echo $currentDateTime->format("Y-m-d H:i:s.v") . " - $domain_id\t|\t$name\t|\tback to redemptionPeriod from pendingRestore exdate:$exdate\n"; } // Domain Deletion @@ -209,6 +211,6 @@ while ($row = $sth_delete->fetch(PDO::FETCH_ASSOC)) { $dbh->exec("UPDATE `statistics` SET `deleted_domains` = `deleted_domains` + 1 WHERE `date` = CURDATE()"); } } - - echo date("Y-m-d H:i:s") . " - $domain_id\t|\t$name\t|\tdomain:Deleted exdate:$exdate\n"; + $currentDateTime = new DateTime(); + echo $currentDateTime->format("Y-m-d H:i:s.v") . " - $domain_id\t|\t$name\t|\tdomain:Deleted exdate:$exdate\n"; } \ No newline at end of file diff --git a/automation/escrow.php b/automation/escrow.php index ba7480b..93daf9e 100644 --- a/automation/escrow.php +++ b/automation/escrow.php @@ -107,8 +107,10 @@ foreach ($tlds as $tld) { $xml->writeElement('rdeDom:clID', $domain['clid']); $xml->writeElement('rdeDom:crRr', $domain['crid']); - $xml->writeElement('rdeDom:crDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($domain['crdate']))); - $xml->writeElement('rdeDom:exDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($domain['exdate']))); + $crDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $domain['crdate']); + $xml->writeElement('rdeDom:crDate', $crDate->format("Y-m-d\\TH:i:s.v\\Z")); + $exDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $domain['exdate']); + $xml->writeElement('rdeDom:exDate', $exDate->format("Y-m-d\\TH:i:s.v\\Z")); $xml->endElement(); // Closing rdeDom:domain } @@ -153,7 +155,8 @@ foreach ($tlds as $tld) { $xml->writeElement('rdeRegistrar:url', $registrar['whois_server']); $xml->endElement(); // Closing rdeRegistrar:whoisInfo - $xml->writeElement('rdeRegistrar:crDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($registrar['crdate']))); + $crDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $registrar['crdate']); + $xml->writeElement('rdeRegistrar:crDate', $crDate->format("Y-m-d\\TH:i:s.v\\Z")); } $xml->endElement(); // Closing rdeRegistrar:registrar @@ -174,7 +177,8 @@ foreach ($tlds as $tld) { $xml->writeElement('rdeHost:clID', $host['clid']); $xml->writeElement('rdeHost:crRr', $host['crid']); - $xml->writeElement('rdeHost:crDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($host['crdate']))); + $crDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $host['crdate']); + $xml->writeElement('rdeHost:crDate', $crDate->format("Y-m-d\\TH:i:s.v\\Z")); $xml->endElement(); // Closing rdeHost:host } @@ -217,10 +221,12 @@ foreach ($tlds as $tld) { $xml->writeElement('rdeContact:email', $contact['email']); $xml->writeElement('rdeContact:clID', $contact['clid']); $xml->writeElement('rdeContact:crRr', $contact['crid']); - $xml->writeElement('rdeContact:crDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($contact['crdate']))); + $crDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $contact['crdate']); + $xml->writeElement('rdeContact:crDate', $crDate->format("Y-m-d\\TH:i:s.v\\Z")); if (!empty($contact['upid'])) { $xml->writeElement('rdeContact:upRr', $contact['upid']); - $xml->writeElement('rdeContact:upDate', date("Y-m-d\\TH:i:s.0\\Z", strtotime($contact['update']))); + $upDate = DateTime::createFromFormat('Y-m-d H:i:s.v', $contact['update']); + $xml->writeElement('rdeContact:upDate', $upDate->format("Y-m-d\\TH:i:s.v\\Z")); } $xml->endElement(); // Closing rdeContact:contact } @@ -372,9 +378,11 @@ foreach ($tlds as $tld) { $reportXML->writeElement('rdeReport:rydeSpecEscrow', 'RFC8909'); $reportXML->writeElement('rdeReport:rydeSpecMapping', 'RFC9022'); $reportXML->writeElement('rdeReport:resend', '0'); - $reportXML->writeElement('rdeReport:crDate', date("Y-m-d\\TH:i:s.0\\Z")); + $currentDateTime = new DateTime(); + $crDateWithMilliseconds = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); + $reportXML->writeElement('rdeReport:crDate', $crDateWithMilliseconds); $reportXML->writeElement('rdeReport:kind', 'FULL'); - $reportXML->writeElement('rdeReport:watermark', date('Y-m-d\\T00:00:00\\Z')); + $reportXML->writeElement('rdeReport:watermark', date('Y-m-d\\T00:00:00.000\\Z')); $reportXML->startElement('rdeHeader:header'); $reportXML->writeElement('rdeHeader:tld', $tld['tld']); diff --git a/automation/urs.php b/automation/urs.php index ea55880..904cde2 100644 --- a/automation/urs.php +++ b/automation/urs.php @@ -31,7 +31,7 @@ foreach ($allEmails as $emailId) { $header = imap_headerinfo($inbox, $emailId); $from = $header->from[0]->mailbox . "@" . $header->from[0]->host; $subject = $header->subject; - $date = date('Y-m-d H:i:s', strtotime($header->date)); + $date = date('Y-m-d H:i:s', strtotime($header->date)) . '.000'; // Determine the URS provider based on the email sender $ursProvider = ($from == 'providerA@example.com') ? 'URSPA' : 'URSPB'; diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index 76d476f..381ab52 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -338,15 +338,15 @@ class ContactsController extends Controller ]); } - $disclose_voice = isset($data['disclose_voice']) ? 1 : 0; - $disclose_fax = isset($data['disclose_fax']) ? 1 : 0; - $disclose_email = isset($data['disclose_email']) ? 1 : 0; - $disclose_name_int = isset($data['disclose_name_int']) ? 1 : 0; - $disclose_name_loc = isset($data['disclose_name_loc']) ? 1 : 0; - $disclose_org_int = isset($data['disclose_org_int']) ? 1 : 0; - $disclose_org_loc = isset($data['disclose_org_loc']) ? 1 : 0; - $disclose_addr_int = isset($data['disclose_addr_int']) ? 1 : 0; - $disclose_addr_loc = isset($data['disclose_addr_loc']) ? 1 : 0; + $disclose_voice = isset($data['disclose_voice']) ? 1 : 0; + $disclose_fax = isset($data['disclose_fax']) ? 1 : 0; + $disclose_email = isset($data['disclose_email']) ? 1 : 0; + $disclose_name_int = isset($data['disclose_name_int']) ? 1 : 0; + $disclose_name_loc = isset($data['disclose_name_loc']) ? 1 : 0; + $disclose_org_int = isset($data['disclose_org_int']) ? 1 : 0; + $disclose_org_loc = isset($data['disclose_org_loc']) ? 1 : 0; + $disclose_addr_int = isset($data['disclose_addr_int']) ? 1 : 0; + $disclose_addr_loc = isset($data['disclose_addr_loc']) ? 1 : 0; if ($data['nin']) { $nin = $data['nin']; @@ -365,6 +365,8 @@ class ContactsController extends Controller $db->beginTransaction(); try { + $currentDateTime = new DateTime(); + $crdate = $currentDateTime->format('Y-m-d H:i:s.v'); $db->insert( 'contact', [ @@ -378,7 +380,7 @@ class ContactsController extends Controller 'nin_type' => $nin_type ?? null, 'clid' => $clid, 'crid' => $clid, - 'crdate' => date('Y-m-d H:i:s'), + 'crdate' => $crdate, 'disclose_voice' => $disclose_voice, 'disclose_fax' => $disclose_fax, 'disclose_email' => $disclose_email diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index 7c078d8..06d4de4 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -335,8 +335,12 @@ class DomainsController extends Controller try { $db->beginTransaction(); - $crdate = date('Y-m-d H:i:s'); // Current timestamp - $exdate = date('Y-m-d H:i:s', strtotime("+$date_add months")); // Expiry timestamp after $date_add months + $currentDateTime = new DateTime(); + $crdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp + + $currentDateTime = new DateTime(); + $currentDateTime->modify("+$date_add months"); + $exdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Expiry timestamp after $date_add months $db->insert('domain', [ 'name' => $domainName, @@ -499,11 +503,13 @@ class DomainsController extends Controller $from = $row['crdate']; $to = $row['exdate']; + $currentDateTime = new DateTime(); + $stdate = $currentDateTime->format('Y-m-d H:i:s.v'); $db->insert( 'statement', [ 'registrar_id' => $clid, - 'date' => date('Y-m-d H:i:s'), + 'date' => $stdate, 'command' => 'create', 'domain_name' => $domainName, 'length_in_months' => $date_add, @@ -534,16 +540,20 @@ class DomainsController extends Controller ] ); } else { + $currentDateTime = new DateTime(); + $logdate = $currentDateTime->format('Y-m-d H:i:s.v'); $db->insert( 'error_log', [ 'registrar_id' => $clid, 'log' => "Domain : $domainName ; hostName : $nameserver - is duplicated", - 'date' => date('Y-m-d H:i:s') + 'date' => $logdate ] ); } } else { + $currentDateTime = new DateTime(); + $host_date = $currentDateTime->format('Y-m-d H:i:s.v'); $host_id = $db->insert( 'host', [ @@ -551,7 +561,7 @@ class DomainsController extends Controller 'domain_id' => $domain_id, 'clid' => $clid, 'crid' => $clid, - 'crdate' => date('Y-m-d H:i:s') + 'crdate' => $host_date ] ); diff --git a/cp/app/Controllers/HostsController.php b/cp/app/Controllers/HostsController.php index 3eda138..b90786b 100644 --- a/cp/app/Controllers/HostsController.php +++ b/cp/app/Controllers/HostsController.php @@ -127,6 +127,8 @@ class HostsController extends Controller $db->beginTransaction(); try { + $currentDateTime = new DateTime(); + $crdate = $currentDateTime->format('Y-m-d H:i:s.v'); $db->insert( 'host', [ @@ -134,7 +136,7 @@ class HostsController extends Controller 'domain_id' => $superordinate_dom, 'clid' => $clid, 'crid' => $clid, - 'crdate' => date('Y-m-d H:i:s') + 'crdate' => $crdate ] ); $host_id = $db->getLastInsertId(); @@ -201,13 +203,15 @@ class HostsController extends Controller 'registrars' => $registrars, ]); } else { + $currentDateTime = new DateTime(); + $crdate = $currentDateTime->format('Y-m-d H:i:s.v'); $db->insert( 'host', [ 'name' => $hostName, 'clid' => $clid, 'crid' => $clid, - 'crdate' => date('Y-m-d H:i:s') + 'crdate' => $crdate ] ); $host_id = $db->getLastInsertId(); diff --git a/das/start_das.php b/das/start_das.php index a7380f1..61f44ab 100644 --- a/das/start_das.php +++ b/das/start_das.php @@ -107,7 +107,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/das/das_request.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $domain . "\n"); fclose($fp); } $server->close($fd); @@ -117,7 +120,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/das/das_not_found.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $domain . "\n"); fclose($fp); } $server->close($fd); diff --git a/database/registry.mariadb.sql b/database/registry.mariadb.sql index 3a832ee..a16b7ab 100644 --- a/database/registry.mariadb.sql +++ b/database/registry.mariadb.sql @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`error_log` ( `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `registrar_id` INT(11) NOT NULL, `log` TEXT NOT NULL, - `date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP + `date` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='registry error log'; CREATE TABLE IF NOT EXISTS `registry`.`reserved_domain_names` ( @@ -73,8 +73,8 @@ CREATE TABLE IF NOT EXISTS `registry`.`registrar` ( `creditThreshold` decimal(8,2) NOT NULL default '0.00', `thresholdType` enum('fixed','percent') NOT NULL default 'fixed', `currency` varchar(5) NOT NULL, - `crdate` datetime NOT NULL, - `update` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `crdate` datetime(3) NOT NULL, + `update` TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `clid` (`clid`), UNIQUE KEY `prefix` (`prefix`), @@ -117,16 +117,16 @@ CREATE TABLE IF NOT EXISTS `registry`.`registrar_contact` ( CREATE TABLE IF NOT EXISTS `registry`.`poll` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `registrar_id` int(10) unsigned NOT NULL, - `qdate` datetime NOT NULL, + `qdate` datetime(3) NOT NULL, `msg` text default NULL, `msg_type` enum('lowBalance','domainTransfer','contactTransfer') default NULL, `obj_name_or_id` varchar(68), `obj_trStatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL, `obj_reID` varchar(255), - `obj_reDate` datetime, + `obj_reDate` datetime(3), `obj_acID` varchar(255), - `obj_acDate` datetime, - `obj_exDate` datetime default NULL, + `obj_acDate` datetime(3), + `obj_exDate` datetime(3) default NULL, `registrarName` varchar(255), `creditLimit` decimal(8,2) default '0.00', `creditThreshold` decimal(8,2) default '0.00', @@ -139,7 +139,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`poll` ( CREATE TABLE IF NOT EXISTS `registry`.`payment_history` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `registrar_id` int(10) unsigned NOT NULL, - `date` datetime NOT NULL, + `date` datetime(3) NOT NULL, `description` text NOT NULL, `amount` decimal(8,2) NOT NULL, PRIMARY KEY (`id`), @@ -149,12 +149,12 @@ CREATE TABLE IF NOT EXISTS `registry`.`payment_history` ( CREATE TABLE IF NOT EXISTS `registry`.`statement` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `registrar_id` int(10) unsigned NOT NULL, - `date` datetime NOT NULL, + `date` datetime(3) NOT NULL, `command` enum('create','renew','transfer','restore','autoRenew') NOT NULL default 'create', `domain_name` varchar(68) NOT NULL, `length_in_months` tinyint(3) unsigned NOT NULL, - `from` datetime NOT NULL, - `to` datetime NOT NULL, + `from` datetime(3) NOT NULL, + `to` datetime(3) NOT NULL, `amount` decimal(8,2) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `statement_ibfk_1` FOREIGN KEY (`registrar_id`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT @@ -172,15 +172,15 @@ CREATE TABLE IF NOT EXISTS `registry`.`contact` ( `nin_type` enum('personal','business') default NULL, `clid` int(10) unsigned NOT NULL, `crid` int(10) unsigned NOT NULL, - `crdate` datetime NOT NULL, + `crdate` datetime(3) NOT NULL, `upid` int(10) unsigned default NULL, - `update` datetime default NULL, - `trdate` datetime default NULL, + `update` datetime(3) default NULL, + `trdate` datetime(3) default NULL, `trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL, `reid` int(10) unsigned default NULL, - `redate` datetime default NULL, + `redate` datetime(3) default NULL, `acid` int(10) unsigned default NULL, - `acdate` datetime default NULL, + `acdate` datetime(3) default NULL, `disclose_voice` enum('0','1') NOT NULL default '1', `disclose_fax` enum('0','1') NOT NULL default '1', `disclose_email` enum('0','1') NOT NULL default '1', @@ -239,26 +239,26 @@ CREATE TABLE IF NOT EXISTS `registry`.`domain` ( `name` varchar(68) NOT NULL, `tldid` int(10) unsigned NOT NULL, `registrant` int(10) unsigned default NULL, - `crdate` datetime NOT NULL, - `exdate` datetime NOT NULL, - `update` datetime default NULL, + `crdate` datetime(3) NOT NULL, + `exdate` datetime(3) NOT NULL, + `update` datetime(3) default NULL, `clid` int(10) unsigned NOT NULL, `crid` int(10) unsigned NOT NULL, `upid` int(10) unsigned default NULL, - `trdate` datetime default NULL, + `trdate` datetime(3) default NULL, `trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL, `reid` int(10) unsigned default NULL, - `redate` datetime default NULL, + `redate` datetime(3) default NULL, `acid` int(10) unsigned default NULL, - `acdate` datetime default NULL, - `transfer_exdate` datetime default NULL, + `acdate` datetime(3) default NULL, + `transfer_exdate` datetime(3) default NULL, `idnlang` varchar(16) default NULL, - `delTime` datetime default NULL, - `resTime` datetime default NULL, + `delTime` datetime(3) default NULL, + `resTime` datetime(3) default NULL, `rgpstatus` enum('addPeriod','autoRenewPeriod','renewPeriod','transferPeriod','pendingDelete','pendingRestore','redemptionPeriod') default NULL, `rgppostData` text default NULL, - `rgpdelTime` datetime default NULL, - `rgpresTime` datetime default NULL, + `rgpdelTime` datetime(3) default NULL, + `rgpresTime` datetime(3) default NULL, `rgpresReason` text default NULL, `rgpstatement1` text default NULL, `rgpstatement2` text default NULL, @@ -267,7 +267,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`domain` ( `autoRenewPeriod` tinyint(3) unsigned default NULL, `renewPeriod` tinyint(3) unsigned default NULL, `transferPeriod` tinyint(3) unsigned default NULL, - `renewedDate` datetime default NULL, + `renewedDate` datetime(3) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), CONSTRAINT `domain_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT, @@ -333,10 +333,10 @@ CREATE TABLE IF NOT EXISTS `registry`.`host` ( `domain_id` int(10) unsigned default NULL, `clid` int(10) unsigned NOT NULL, `crid` int(10) unsigned NOT NULL, - `crdate` datetime NOT NULL, + `crdate` datetime(3) NOT NULL, `upid` int(10) unsigned default NULL, - `update` datetime default NULL, - `trdate` datetime default NULL, + `update` datetime(3) default NULL, + `trdate` datetime(3) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), CONSTRAINT `host_ibfk_1` FOREIGN KEY (`clid`) REFERENCES `registrar` (`id`) ON DELETE RESTRICT, @@ -378,19 +378,19 @@ CREATE TABLE IF NOT EXISTS `registry`.`domain_auto_approve_transfer` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(68) NOT NULL, `registrant` int(10) unsigned default NULL, - `crdate` datetime NOT NULL, - `exdate` datetime NOT NULL, - `update` datetime default NULL, + `crdate` datetime(3) NOT NULL, + `exdate` datetime(3) NOT NULL, + `update` datetime(3) default NULL, `clid` int(10) unsigned NOT NULL, `crid` int(10) unsigned NOT NULL, `upid` int(10) unsigned default NULL, - `trdate` datetime default NULL, + `trdate` datetime(3) default NULL, `trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL, `reid` int(10) unsigned default NULL, - `redate` datetime default NULL, + `redate` datetime(3) default NULL, `acid` int(10) unsigned default NULL, - `acdate` datetime default NULL, - `transfer_exdate` datetime default NULL, + `acdate` datetime(3) default NULL, + `transfer_exdate` datetime(3) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='domain_auto_approve_transfer'; @@ -406,15 +406,15 @@ CREATE TABLE IF NOT EXISTS `registry`.`contact_auto_approve_transfer` ( `nin_type` enum('personal','business') default NULL, `clid` int(10) unsigned NOT NULL, `crid` int(10) unsigned NOT NULL, - `crdate` datetime NOT NULL, + `crdate` datetime(3) NOT NULL, `upid` int(10) unsigned default NULL, - `update` datetime default NULL, - `trdate` datetime default NULL, + `update` datetime(3) default NULL, + `trdate` datetime(3) default NULL, `trstatus` enum('clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled') default NULL, `reid` int(10) unsigned default NULL, - `redate` datetime default NULL, + `redate` datetime(3) default NULL, `acid` int(10) unsigned default NULL, - `acdate` datetime default NULL, + `acdate` datetime(3) default NULL, `disclose_voice` enum('0','1') NOT NULL default '1', `disclose_fax` enum('0','1') NOT NULL default '1', `disclose_email` enum('0','1') NOT NULL default '1', @@ -581,8 +581,8 @@ CREATE TABLE IF NOT EXISTS `registry`.`support_tickets` ( evidence TEXT DEFAULT NULL, relevant_urls TEXT DEFAULT NULL, date_of_incident DATE DEFAULT NULL, - date_created DATETIME DEFAULT CURRENT_TIMESTAMP, - last_updated DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + date_created datetime(3) DEFAULT CURRENT_TIMESTAMP, + last_updated datetime(3) DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users(id), FOREIGN KEY (category_id) REFERENCES ticket_categories(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Support Tickets'; @@ -592,7 +592,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`ticket_responses` ( ticket_id INT(11) UNSIGNED NOT NULL, responder_id INT(11) UNSIGNED NOT NULL, response TEXT NOT NULL, - date_created DATETIME DEFAULT CURRENT_TIMESTAMP, + date_created datetime(3) DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (ticket_id) REFERENCES support_tickets(id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ticket Responses'; @@ -660,7 +660,7 @@ CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` ( `registrar_id` int(10) unsigned NOT NULL, `clTRID` varchar(64), `clTRIDframe` text, - `cldate` datetime, + `cldate` datetime(3), `clmicrosecond` int(6), `cmd` enum('login','logout','check','info','poll','transfer','create','delete','renew','update') default NULL, `obj_type` enum('domain','host','contact') default NULL, @@ -669,7 +669,7 @@ CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` ( `msg` varchar(255) default NULL, `svTRID` varchar(64), `svTRIDframe` text, - `svdate` datetime, + `svdate` datetime(3), `svmicrosecond` int(6), PRIMARY KEY (`id`), UNIQUE KEY `clTRID` (`clTRID`), diff --git a/database/registry.postgres.sql b/database/registry.postgres.sql index 76c348b..cb00c91 100644 --- a/database/registry.postgres.sql +++ b/database/registry.postgres.sql @@ -43,7 +43,7 @@ CREATE TABLE registry.error_log ( "id" INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, "registrar_id" INT(11) NOT NULL, "log" TEXT NOT NULL, - "date" TIMESTAMP DEFAULT CURRENT_TIMESTAMP + "date" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE registry.reserved_domain_names ( @@ -72,8 +72,8 @@ CREATE TABLE registry.registrar ( "creditthreshold" decimal(8,2) NOT NULL default '0.00', "thresholdtype" varchar CHECK ("thresholdtype" IN ( 'fixed','percent' )) NOT NULL default 'fixed', "currency" varchar(5) NOT NULL, - "crdate" timestamp without time zone NOT NULL, - "update" TIMESTAMP , + "crdate" timestamp(3) without time zone NOT NULL, + "update" timestamp(3), primary key ("id"), unique ("clid") , unique ("prefix") , @@ -125,16 +125,16 @@ CREATE TABLE registry.registrar_contact ( CREATE TABLE registry.poll ( "id" serial8, "registrar_id" int CHECK ("registrar_id" >= 0) NOT NULL, - "qdate" timestamp without time zone NOT NULL, + "qdate" timestamp(3) without time zone NOT NULL, "msg" text default NULL, "msg_type" varchar CHECK ("msg_type" IN ( 'lowBalance','domainTransfer','contactTransfer' )) default NULL, "obj_name_or_id" varchar(68), "obj_trstatus" varchar CHECK ("obj_trstatus" IN ( 'clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled' )) default NULL, "obj_reid" varchar(255), - "obj_redate" timestamp without time zone, + "obj_redate" timestamp(3) without time zone, "obj_acid" varchar(255), - "obj_acdate" timestamp without time zone, - "obj_exdate" timestamp without time zone default NULL, + "obj_acdate" timestamp(3) without time zone, + "obj_exdate" timestamp(3) without time zone default NULL, "registrarname" varchar(255), "creditlimit" decimal(8,2) default '0.00', "creditthreshold" decimal(8,2) default '0.00', @@ -146,7 +146,7 @@ CREATE TABLE registry.poll ( CREATE TABLE registry.payment_history ( "id" serial8, "registrar_id" int CHECK ("registrar_id" >= 0) NOT NULL, - "date" timestamp without time zone NOT NULL, + "date" timestamp(3) without time zone NOT NULL, "description" text NOT NULL, "amount" decimal(8,2) NOT NULL, primary key ("id") @@ -155,12 +155,12 @@ CREATE TABLE registry.payment_history ( CREATE TABLE registry.statement ( "id" serial8, "registrar_id" int CHECK ("registrar_id" >= 0) NOT NULL, - "date" timestamp without time zone NOT NULL, + "date" timestamp(3) without time zone NOT NULL, "command" varchar CHECK ("command" IN ( 'create','renew','transfer','restore','autoRenew' )) NOT NULL default 'create', "domain_name" varchar(68) NOT NULL, "length_in_months" smallint CHECK ("length_in_months" >= 0) NOT NULL, - "from" timestamp without time zone NOT NULL, - "to" timestamp without time zone NOT NULL, + "from" timestamp(3) without time zone NOT NULL, + "to" timestamp(3) without time zone NOT NULL, "amount" decimal(8,2) NOT NULL, primary key ("id") ); @@ -177,15 +177,15 @@ CREATE TABLE registry.contact ( "nin_type" varchar CHECK ("nin_type" IN ( 'personal','business' )) default NULL, "clid" int CHECK ("clid" >= 0) NOT NULL, "crid" int CHECK ("crid" >= 0) NOT NULL, - "crdate" timestamp without time zone NOT NULL, + "crdate" timestamp(3) without time zone NOT NULL, "upid" int CHECK ("upid" >= 0) default NULL, - "update" timestamp without time zone default NULL, - "trdate" timestamp without time zone default NULL, + "update" timestamp(3) without time zone default NULL, + "trdate" timestamp(3) without time zone default NULL, "trstatus" varchar CHECK ("trstatus" IN ( 'clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled' )) default NULL, "reid" int CHECK ("reid" >= 0) default NULL, - "redate" timestamp without time zone default NULL, + "redate" timestamp(3) without time zone default NULL, "acid" int CHECK ("acid" >= 0) default NULL, - "acdate" timestamp without time zone default NULL, + "acdate" timestamp(3) without time zone default NULL, "disclose_voice" varchar CHECK ("disclose_voice" IN ( '0','1' )) NOT NULL default '1', "disclose_fax" varchar CHECK ("disclose_fax" IN ( '0','1' )) NOT NULL default '1', "disclose_email" varchar CHECK ("disclose_email" IN ( '0','1' )) NOT NULL default '1', @@ -238,26 +238,26 @@ CREATE TABLE registry.domain ( "name" varchar(68) NOT NULL, "tldid" int CHECK ("tldid" >= 0) NOT NULL, "registrant" int CHECK ("registrant" >= 0) default NULL, - "crdate" timestamp without time zone NOT NULL, - "exdate" timestamp without time zone NOT NULL, - "update" timestamp without time zone default NULL, + "crdate" timestamp(3) without time zone NOT NULL, + "exdate" timestamp(3) without time zone NOT NULL, + "update" timestamp(3) without time zone default NULL, "clid" int CHECK ("clid" >= 0) NOT NULL, "crid" int CHECK ("crid" >= 0) NOT NULL, "upid" int CHECK ("upid" >= 0) default NULL, - "trdate" timestamp without time zone default NULL, + "trdate" timestamp(3) without time zone default NULL, "trstatus" varchar CHECK ("trstatus" IN ( 'clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled' )) default NULL, "reid" int CHECK ("reid" >= 0) default NULL, - "redate" timestamp without time zone default NULL, + "redate" timestamp(3) without time zone default NULL, "acid" int CHECK ("acid" >= 0) default NULL, - "acdate" timestamp without time zone default NULL, - "transfer_exdate" timestamp without time zone default NULL, + "acdate" timestamp(3) without time zone default NULL, + "transfer_exdate" timestamp(3) without time zone default NULL, "idnlang" varchar(16) default NULL, - "deltime" timestamp without time zone default NULL, - "restime" timestamp without time zone default NULL, + "deltime" timestamp(3) without time zone default NULL, + "restime" timestamp(3) without time zone default NULL, "rgpstatus" varchar CHECK ("rgpstatus" IN ( 'addPeriod','autoRenewPeriod','renewPeriod','transferPeriod','pendingDelete','pendingRestore','redemptionPeriod' )) default NULL, "rgppostdata" text default NULL, - "rgpdeltime" timestamp without time zone default NULL, - "rgprestime" timestamp without time zone default NULL, + "rgpdeltime" timestamp(3) without time zone default NULL, + "rgprestime" timestamp(3) without time zone default NULL, "rgpresreason" text default NULL, "rgpstatement1" text default NULL, "rgpstatement2" text default NULL, @@ -266,7 +266,7 @@ CREATE TABLE registry.domain ( "autorenewperiod" smallint CHECK ("autorenewperiod" >= 0) default NULL, "renewperiod" smallint CHECK ("renewperiod" >= 0) default NULL, "transferperiod" smallint CHECK ("transferperiod" >= 0) default NULL, - "reneweddate" timestamp without time zone default NULL, + "reneweddate" timestamp(3) without time zone default NULL, primary key ("id"), unique ("name") ); @@ -320,10 +320,10 @@ CREATE TABLE registry.host ( "domain_id" int CHECK ("domain_id" >= 0) default NULL, "clid" int CHECK ("clid" >= 0) NOT NULL, "crid" int CHECK ("crid" >= 0) NOT NULL, - "crdate" timestamp without time zone NOT NULL, + "crdate" timestamp(3) without time zone NOT NULL, "upid" int CHECK ("upid" >= 0) default NULL, - "update" timestamp without time zone default NULL, - "trdate" timestamp without time zone default NULL, + "update" timestamp(3) without time zone default NULL, + "trdate" timestamp(3) without time zone default NULL, primary key ("id"), unique ("name") ); @@ -357,19 +357,19 @@ CREATE TABLE registry.domain_auto_approve_transfer ( "id" serial8, "name" varchar(68) NOT NULL, "registrant" int CHECK ("registrant" >= 0) default NULL, - "crdate" timestamp without time zone NOT NULL, - "exdate" timestamp without time zone NOT NULL, - "update" timestamp without time zone default NULL, + "crdate" timestamp(3) without time zone NOT NULL, + "exdate" timestamp(3) without time zone NOT NULL, + "update" timestamp(3) without time zone default NULL, "clid" int CHECK ("clid" >= 0) NOT NULL, "crid" int CHECK ("crid" >= 0) NOT NULL, "upid" int CHECK ("upid" >= 0) default NULL, - "trdate" timestamp without time zone default NULL, + "trdate" timestamp(3) without time zone default NULL, "trstatus" varchar CHECK ("trstatus" IN ( 'clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled' )) default NULL, "reid" int CHECK ("reid" >= 0) default NULL, - "redate" timestamp without time zone default NULL, + "redate" timestamp(3) without time zone default NULL, "acid" int CHECK ("acid" >= 0) default NULL, - "acdate" timestamp without time zone default NULL, - "transfer_exdate" timestamp without time zone default NULL, + "acdate" timestamp(3) without time zone default NULL, + "transfer_exdate" timestamp(3) without time zone default NULL, primary key ("id") ); @@ -385,15 +385,15 @@ CREATE TABLE registry.contact_auto_approve_transfer ( "nin_type" varchar CHECK ("nin_type" IN ( 'personal','business' )) default NULL, "clid" int CHECK ("clid" >= 0) NOT NULL, "crid" int CHECK ("crid" >= 0) NOT NULL, - "crdate" timestamp without time zone NOT NULL, + "crdate" timestamp(3) without time zone NOT NULL, "upid" int CHECK ("upid" >= 0) default NULL, - "update" timestamp without time zone default NULL, - "trdate" timestamp without time zone default NULL, + "update" timestamp(3) without time zone default NULL, + "trdate" timestamp(3) without time zone default NULL, "trstatus" varchar CHECK ("trstatus" IN ( 'clientApproved','clientCancelled','clientRejected','pending','serverApproved','serverCancelled' )) default NULL, "reid" int CHECK ("reid" >= 0) default NULL, - "redate" timestamp without time zone default NULL, + "redate" timestamp(3) without time zone default NULL, "acid" int CHECK ("acid" >= 0) default NULL, - "acdate" timestamp without time zone default NULL, + "acdate" timestamp(3) without time zone default NULL, "disclose_voice" varchar CHECK ("disclose_voice" IN ( '0','1' )) NOT NULL default '1', "disclose_fax" varchar CHECK ("disclose_fax" IN ( '0','1' )) NOT NULL default '1', "disclose_email" varchar CHECK ("disclose_email" IN ( '0','1' )) NOT NULL default '1', @@ -563,8 +563,8 @@ CREATE TABLE registry.support_tickets ( evidence TEXT DEFAULT NULL, relevant_urls TEXT DEFAULT NULL, date_of_incident DATE DEFAULT NULL, - date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, - last_updated TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, + date_created TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, + last_updated TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES registry.users(id), FOREIGN KEY (category_id) REFERENCES registry.ticket_categories(id) ); @@ -574,7 +574,7 @@ CREATE TABLE ticket_responses ( ticket_id INTEGER NOT NULL, responder_id INTEGER NOT NULL, response TEXT NOT NULL, - date_created TIMESTAMP WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, + date_created TIMESTAMP(3) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (ticket_id) REFERENCES support_tickets(id) ); @@ -664,7 +664,7 @@ CREATE TABLE registryTransaction.transaction_identifier ( registrar_id INT NOT NULL, clTRID VARCHAR(64), clTRIDframe TEXT, - cldate TIMESTAMP WITHOUT TIME ZONE, + cldate TIMESTAMP(3) WITHOUT TIME ZONE, clmicrosecond INT, cmd VARCHAR(10) CHECK (cmd IN ('login','logout','check','info','poll','transfer','create','delete','renew','update')), obj_type VARCHAR(10) CHECK (obj_type IN ('domain','host','contact')), @@ -673,7 +673,7 @@ CREATE TABLE registryTransaction.transaction_identifier ( msg VARCHAR(255), svTRID VARCHAR(64), svTRIDframe TEXT, - svdate TIMESTAMP WITHOUT TIME ZONE, + svdate TIMESTAMP(3) WITHOUT TIME ZONE, svmicrosecond INT, CONSTRAINT unique_clTRID UNIQUE (clTRID), CONSTRAINT unique_svTRID UNIQUE (svTRID), diff --git a/epp/src/EppWriter.php b/epp/src/EppWriter.php index bf06f91..76ca46f 100644 --- a/epp/src/EppWriter.php +++ b/epp/src/EppWriter.php @@ -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' diff --git a/epp/src/helpers.php b/epp/src/helpers.php index d0318ec..cd33d16 100644 --- a/epp/src/helpers.php +++ b/epp/src/helpers.php @@ -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 + ) + ) + ); } \ No newline at end of file diff --git a/rdap/start_rdap.php b/rdap/start_rdap.php index b038842..f53e95d 100644 --- a/rdap/start_rdap.php +++ b/rdap/start_rdap.php @@ -299,17 +299,25 @@ function handleDomainQuery($request, $response, $pdo, $domainName) { $events = [ ['eventAction' => 'registration', 'eventDate' => $domainDetails['crdate']], ['eventAction' => 'expiration', 'eventDate' => $domainDetails['exdate']], - ['eventAction' => 'last rdap database update', 'eventDate' => date('Y-m-d\TH:i:s\Z')], + ['eventAction' => 'last rdap database update', 'eventDate' => (new DateTime())->format('Y-m-d\TH:i:s.v\Z')], ]; // Check if domain last update is set and not empty if (isset($domainDetails['update']) && !empty($domainDetails['update'])) { - $events[] = ['eventAction' => 'last domain update', 'eventDate' => date('Y-m-d', strtotime($domainDetails['update']))]; + $updateDateTime = new DateTime($domainDetails['update']); + $events[] = [ + 'eventAction' => 'last domain update', + 'eventDate' => $updateDateTime->format('Y-m-d\TH:i:s.v\Z') + ]; } // Check if domain transfer date is set and not empty if (isset($domainDetails['trdate']) && !empty($domainDetails['trdate'])) { - $events[] = ['eventAction' => 'domain transfer', 'eventDate' => date('Y-m-d', strtotime($domainDetails['trdate']))]; + $transferDateTime = new DateTime($domainDetails['trdate']); + $events[] = [ + 'eventAction' => 'domain transfer', + 'eventDate' => $transferDateTime->format('Y-m-d\TH:i:s.v\Z') + ]; } $abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : ''; @@ -539,7 +547,7 @@ function handleEntityQuery($request, $response, $pdo, $entityHandle) { // Define the basic events $events = [ - ['eventAction' => 'last rdap database update', 'eventDate' => date('Y-m-d\TH:i:s\Z')], + ['eventAction' => 'last rdap database update', 'eventDate' => (new DateTime())->format('Y-m-d\TH:i:s.v\Z')], ]; $abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : ''; @@ -770,7 +778,7 @@ function handleNameserverQuery($request, $response, $pdo, $nameserverHandle) { // Define the basic events $events = [ - ['eventAction' => 'last rdap database update', 'eventDate' => date('Y-m-d\TH:i:s\Z')], + ['eventAction' => 'last rdap database update', 'eventDate' => (new DateTime())->format('Y-m-d\TH:i:s.v\Z')], ]; $abuseContactName = ($registrarAbuseDetails) ? $registrarAbuseDetails['first_name'] . ' ' . $registrarAbuseDetails['last_name'] : ''; diff --git a/whois/port43/start_whois.php b/whois/port43/start_whois.php index 5ad0b16..205bc76 100644 --- a/whois/port43/start_whois.php +++ b/whois/port43/start_whois.php @@ -109,7 +109,8 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) } $res .= "\nURL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/"; - $currentTimestamp = date('Y-m-d\TH:i:s\Z'); + $currentDateTime = new DateTime(); + $currentTimestamp = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); $res .= "\n>>> Last update of WHOIS database: {$currentTimestamp} <<<"; $res .= "\n"; $res .= "\nFor more information on Whois status codes, please visit https://icann.org/epp"; @@ -136,7 +137,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_request.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$nameserver."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $nameserver . "\n"); fclose($fp); } $server->close($fd); @@ -147,7 +151,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_not_found.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$nameserver."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $nameserver . "\n"); fclose($fp); } $server->close($fd); @@ -210,7 +217,8 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) } $res .= "\nURL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/"; - $currentTimestamp = date('Y-m-d\TH:i:s\Z'); + $currentDateTime = new DateTime(); + $currentTimestamp = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); $res .= "\n>>> Last update of WHOIS database: {$currentTimestamp} <<<"; $res .= "\n"; $res .= "\nFor more information on Whois status codes, please visit https://icann.org/epp"; @@ -237,7 +245,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_request.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$registrar."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $registrar . "\n"); fclose($fp); } $server->close($fd); @@ -248,7 +259,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_not_found.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$registrar."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $registrar . "\n"); fclose($fp); } $server->close($fd); @@ -534,7 +548,8 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) $res .= "\nDNSSEC: unsigned"; } $res .= "\nURL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/"; - $currentTimestamp = date('Y-m-d\TH:i:s\Z'); + $currentDateTime = new DateTime(); + $currentTimestamp = $currentDateTime->format("Y-m-d\TH:i:s.v\Z"); $res .= "\n>>> Last update of WHOIS database: {$currentTimestamp} <<<"; $res .= "\n"; $res .= "\nFor more information on Whois status codes, please visit https://icann.org/epp"; @@ -561,7 +576,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_request.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $domain . "\n"); fclose($fp); } $server->close($fd); @@ -572,7 +590,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo) if ($fp = @fopen("/var/log/whois/whois_not_found.log",'a')) { $clientInfo = $server->getClientInfo($fd); $remoteAddr = $clientInfo['remote_ip']; - fwrite($fp,date('Y-m-d H:i:s')."\t-\t".$remoteAddr."\t-\t".$domain."\n"); + $currentDateTime = new DateTime(); + $milliseconds = $currentDateTime->format("v"); + $timestampWithMilliseconds = $currentDateTime->format("Y-m-d H:i:s") . '.' . $milliseconds; + fwrite($fp, $timestampWithMilliseconds . "\t-\t" . $remoteAddr . "\t-\t" . $domain . "\n"); fclose($fp); } $server->close($fd);