Merge pull request #830 from stehled/master

Fix domain edit for .eu and other domains.
This commit is contained in:
Johnny 2023-12-06 08:44:03 -05:00 committed by GitHub
commit 0eaf9febeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -55,6 +55,14 @@ if ($row) {
$txt = sanitizeInput($records['txt']); $txt = sanitizeInput($records['txt']);
$whois = sanitizeInput($records['whois']); $whois = sanitizeInput($records['whois']);
if (
$expire === 'NULL'
&& $row['domain_expire'] !== null
&& (new DateTime($row['domain_expire'])) >= (new DateTime())
) {
$expire = $row['domain_expire'];
}
// Update the domain // Update the domain
mysqli_query($mysqli, "UPDATE domains SET domain_name = '$domain_name', domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois' WHERE domain_id = $domain_id"); mysqli_query($mysqli, "UPDATE domains SET domain_name = '$domain_name', domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois' WHERE domain_id = $domain_id");
} }

View File

@ -380,9 +380,12 @@ function getDomainExpirationDate($name) {
if (is_array($response['expiration_date'])) { if (is_array($response['expiration_date'])) {
$expiry = new DateTime($response['expiration_date'][1]); $expiry = new DateTime($response['expiration_date'][1]);
} }
else { elseif (isset($response['expiration_date'])) {
$expiry = new DateTime($response['expiration_date']); $expiry = new DateTime($response['expiration_date']);
} }
else {
return "NULL";
}
return $expiry->format('Y-m-d'); return $expiry->format('Y-m-d');
} }

View File

@ -70,15 +70,13 @@ if (isset($_POST['edit_domain'])) {
$registrar = intval($_POST['registrar']); $registrar = intval($_POST['registrar']);
$webhost = intval($_POST['webhost']); $webhost = intval($_POST['webhost']);
$expire = sanitizeInput($_POST['expire']); $expire = sanitizeInput($_POST['expire']);
if (empty($expire)) {
$expire = "NULL";
} else {
$expire = "'" . $expire . "'";
}
$client_id = intval($_POST['client_id']);
// Update domain expiry date if (empty($expire) || (new DateTime($expire)) < (new DateTime())) {
$expire = getDomainExpirationDate($name); // Update domain expiry date
$expire = getDomainExpirationDate($name);
}
$client_id = intval($_POST['client_id']);
// Update NS, MX, A and WHOIS records/data // Update NS, MX, A and WHOIS records/data
$records = getDomainRecords($name); $records = getDomainRecords($name);