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,6 +503,7 @@ 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] ?? "");
if (!empty($e_voice) || !empty($e_voice_x) || !empty($e_fax) || !empty($e_fax_x) || !empty($e_email)) {
// Update contact // Update contact
$query = "UPDATE contact SET voice = ?, voice_x = ?, fax = ?, fax_x = ?, email = ?, upid = ?, lastupdate = CURRENT_TIMESTAMP(3) WHERE id = ?"; $query = "UPDATE contact SET voice = ?, voice_x = ?, fax = ?, fax_x = ?, email = ?, upid = ?, lastupdate = CURRENT_TIMESTAMP(3) WHERE id = ?";
$stmt = $db->prepare($query); $stmt = $db->prepare($query);
@ -515,6 +516,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$clid, $clid,
$contact_id $contact_id
]); ]);
}
if ($postalInfoInt) { if ($postalInfoInt) {
// Update contact_postalInfo for 'int' // Update contact_postalInfo for 'int'
@ -555,6 +557,7 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
// Update contact_authInfo for 'pw' // Update contact_authInfo for 'pw'
if (!empty($e_authInfo_pw)) {
$query = "UPDATE contact_authInfo SET authinfo = ? WHERE contact_id = ? AND authtype = ?"; $query = "UPDATE contact_authInfo SET authinfo = ? WHERE contact_id = ? AND authtype = ?";
$stmt = $db->prepare($query); $stmt = $db->prepare($query);
$stmt->execute([ $stmt->execute([
@ -562,14 +565,17 @@ function processContactUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$contact_id, $contact_id,
'pw' 'pw'
]); ]);
}
// Update contact_authInfo for 'ext' // Update contact_authInfo for 'ext'
if (!empty($e_authInfo_ext)) {
$stmt = $db->prepare($query); // Same query as above, can reuse $stmt = $db->prepare($query); // Same query as above, can reuse
$stmt->execute([ $stmt->execute([
$e_authInfo_ext, $e_authInfo_ext,
$contact_id, $contact_id,
'ext' 'ext'
]); ]);
}
} }