EPP domain update fixes

This commit is contained in:
Pinga 2024-09-05 11:40:03 +03:00
parent 5cddfdfaaf
commit bcb4d50fcd

View file

@ -315,7 +315,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
$email = (string) $contactUpdate->chg->email; $email = (string) $contactUpdate->chg->email;
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { if ($email && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
sendEppError($conn, $db, 2005, 'Email address failed check', $clTRID, $trans); sendEppError($conn, $db, 2005, 'Email address failed check', $clTRID, $trans);
return; return;
} }
@ -503,18 +503,20 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$e_authInfo_pw = (string)($xml->xpath("//contact:authInfo/contact:pw")[0] ?? ""); $e_authInfo_pw = (string)($xml->xpath("//contact:authInfo/contact:pw")[0] ?? "");
$e_authInfo_ext = (string)($xml->xpath("//contact:authInfo/contact:ext")[0] ?? ""); $e_authInfo_ext = (string)($xml->xpath("//contact:authInfo/contact:ext")[0] ?? "");
// Update contact if (!empty($e_voice) || !empty($e_voice_x) || !empty($e_fax) || !empty($e_fax_x) || !empty($e_email)) {
$query = "UPDATE contact SET voice = ?, voice_x = ?, fax = ?, fax_x = ?, email = ?, upid = ?, lastupdate = CURRENT_TIMESTAMP(3) WHERE id = ?"; // Update contact
$stmt = $db->prepare($query); $query = "UPDATE contact SET voice = ?, voice_x = ?, fax = ?, fax_x = ?, email = ?, upid = ?, lastupdate = CURRENT_TIMESTAMP(3) WHERE id = ?";
$stmt->execute([ $stmt = $db->prepare($query);
$e_voice ?: null, $stmt->execute([
$e_voice_x ?: null, $e_voice ?: null,
$e_fax ?: null, $e_voice_x ?: null,
$e_fax_x ?: null, $e_fax ?: null,
$e_email, $e_fax_x ?: null,
$clid, $e_email,
$contact_id $clid,
]); $contact_id
]);
}
if ($postalInfoInt) { if ($postalInfoInt) {
// Update contact_postalInfo for 'int' // Update contact_postalInfo for 'int'
@ -555,21 +557,25 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
// Update contact_authInfo for 'pw' // Update contact_authInfo for 'pw'
$query = "UPDATE contact_authInfo SET authinfo = ? WHERE contact_id = ? AND authtype = ?"; if (!empty($e_authInfo_pw)) {
$stmt = $db->prepare($query); $query = "UPDATE contact_authInfo SET authinfo = ? WHERE contact_id = ? AND authtype = ?";
$stmt->execute([ $stmt = $db->prepare($query);
$e_authInfo_pw, $stmt->execute([
$contact_id, $e_authInfo_pw,
'pw' $contact_id,
]); 'pw'
]);
}
// Update contact_authInfo for 'ext' // Update contact_authInfo for 'ext'
$stmt = $db->prepare($query); // Same query as above, can reuse if (!empty($e_authInfo_ext)) {
$stmt->execute([ $stmt = $db->prepare($query); // Same query as above, can reuse
$e_authInfo_ext, $stmt->execute([
$contact_id, $e_authInfo_ext,
'ext' $contact_id,
]); 'ext'
]);
}
} }