From 429dee657ac5e4cfbeb24979e9e6e7853a7408c3 Mon Sep 17 00:00:00 2001 From: Jordan S Date: Tue, 16 Nov 2021 18:22:22 -0400 Subject: [PATCH] Ensure hostnames/subdomains with dots in them are displayed correctly This ensures that subdomains of subdomains aren't cut off with just deepest subdomain showing. Example: test.test.domain.com would only show test when it should show test.test in WHMCS The most common use case for this now, is DKIM records which frequently look like: default._domainkey.theactualdomain.tld which would show as just 'default' in WHMCS until this patch. --- namesilo.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/namesilo.php b/namesilo.php index ad7b0f8..f811a3f 100644 --- a/namesilo.php +++ b/namesilo.php @@ -180,11 +180,8 @@ function namesilo_transactionCall($callType, $call, $params) if ($code == '300') { foreach ($xml->reply->resource_record as $record) { $hostname = (string)$record->host; - if ($hostname == $params['sld'] . "." . $params['tld']) { - $hostname = ''; - } - $hostname = explode(".", $hostname); - $hostname = (string)$hostname[0]; + $hostname = str_replace($params['sld'] . "." . $params['tld'], "", $hostname); + $hostname = rtrim($hostname, "."); $response[] = array("hostname" => $hostname, "type" => $record->type, "address" => $record->value, "record_id" => $record->record_id, "priority" => $record->distance); } break;