mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-12 13:58:12 +02:00
Identica extension fixes
This commit is contained in:
parent
12c5fa3eb1
commit
d7708f6fb6
5 changed files with 17 additions and 28 deletions
|
@ -620,7 +620,7 @@ class EppWriter {
|
|||
// Validation timestamp
|
||||
if (!empty($resp['validation_stamp'])) {
|
||||
$stamp = new \DateTime($resp['validation_stamp']);
|
||||
$writer->writeElement('identica:date', $stamp->format('Y-m-d\TH:i:s.v\Z'));
|
||||
$writer->writeElement('identica:date', $stamp->format('Y-m-d H:i:s.v'));
|
||||
}
|
||||
|
||||
// Validation log
|
||||
|
|
|
@ -328,11 +328,11 @@ function processContactCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
}
|
||||
}
|
||||
|
||||
$obj_ext = $xml->xpath('//identica:create')[0] ?? null;
|
||||
$identicaCreate = $xml->xpath('//identica:create') ?? null;
|
||||
|
||||
if ($obj_ext) {
|
||||
$nin = (string)$obj_ext->xpath('identica:nin')[0] ?? '';
|
||||
$nin_type = (string)$obj_ext->xpath('identica:nin/@type')[0] ?? '';
|
||||
if ($identicaCreate) {
|
||||
$nin = (string) ($xml->xpath('//identica:nin[1]')[0] ?? null);
|
||||
$nin_type = (string) ($xml->xpath('//identica:nin/@type[1]')[0] ?? null);
|
||||
|
||||
if (!preg_match('/\d/', $nin)) {
|
||||
sendEppError($conn, $db, 2005, 'NIN should contain one or more numbers', $clTRID, $trans);
|
||||
|
|
|
@ -420,24 +420,12 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
|
||||
}
|
||||
|
||||
$identicaUpdateResults = $xml->xpath('//identica:update');
|
||||
|
||||
if (!empty($identicaUpdateResults)) {
|
||||
$identica_update = $identicaUpdateResults[0];
|
||||
} else {
|
||||
$identica_update = null;
|
||||
}
|
||||
|
||||
if ($identica_update) {
|
||||
$nin = (string)$identica_update->xpath('//identica:nin[1]')[0];
|
||||
$nin_type = (string)$identica_update->xpath('//identica:nin/@type[1]')[0];
|
||||
$status = $identica_update->xpath('//identica:status[1]');
|
||||
$statusDate = $identica_update->xpath('//identica:date[1]');
|
||||
$statusDetails = $identica_update->xpath('//identica:details[1]');
|
||||
|
||||
$validation = isset($status[0]) ? (string)$status[0] : null;
|
||||
$validation_stamp = isset($statusDate[0]) ? (string)$statusDate[0] : null;
|
||||
$validation_log = isset($statusDetails[0]) ? (string)$statusDetails[0] : null;
|
||||
if (isset($identicaUpdate)) {
|
||||
$nin = (string) ($xml->xpath('//identica:nin[1]')[0] ?? null);
|
||||
$nin_type = (string) ($xml->xpath('//identica:nin/@type[1]')[0] ?? null);
|
||||
$validation = (string) ($xml->xpath('//identica:status[1]')[0] ?? null);
|
||||
$validation_stamp = (string) ($xml->xpath('//identica:date[1]')[0] ?? null);
|
||||
$validation_log = (string) ($xml->xpath('//identica:details[1]')[0] ?? null);
|
||||
|
||||
if (!preg_match('/\d/', $nin)) {
|
||||
sendEppError($conn, $db, 2005, 'NIN should contain one or more numbers', $clTRID, $trans);
|
||||
|
@ -454,8 +442,8 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($validation_stamp !== null && !preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/', $validation_stamp)) {
|
||||
sendEppError($conn, $db, 2005, 'Invalid status date format. Use ISO 8601 format like 2025-07-02T12:00:00.000Z', $clTRID, $trans);
|
||||
if ($validation_stamp !== null && \DateTime::createFromFormat('Y-m-d H:i:s.u', $validation_stamp) === false) {
|
||||
sendEppError($conn, $db, 2005, 'Validation date must be in format Y-m-d H:i:s.v (e.g. 2025-07-02 10:34:00.000)', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -724,7 +712,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
|
||||
}
|
||||
|
||||
if ($identica_update) {
|
||||
if ($identicaUpdate) {
|
||||
$query = "
|
||||
UPDATE contact
|
||||
SET nin = ?, nin_type = ?, validation = ?, validation_stamp = ?, validation_log = ?, upid = ?, lastupdate = CURRENT_TIMESTAMP(3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue