From 51adde0103f90194caa6c1faddc2f191e1360adb Mon Sep 17 00:00:00 2001 From: Miky Date: Tue, 22 Dec 2015 09:27:16 +0100 Subject: [PATCH] Added the possibility to use https:// with whoisproxy.php On Settings, add https:// or http:// before your domain URL to use of them. Automatically switches to http:// if none specified. --- ddwhois.php | 12 ++++++++---- lang/english.php | 2 +- lang/spanish.php | 2 +- version.json | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ddwhois.php b/ddwhois.php index db33edd..90d2a6d 100644 --- a/ddwhois.php +++ b/ddwhois.php @@ -383,9 +383,15 @@ function ddwhois_setup( array $vars, $new_tld ) $server = $components[1]; $match = $components[2]; + $domain = ddwhois_get( 'domain' ); + + if( substr( $domain, 0, 4 ) != 'http' ){ + $domain = 'http://' . $domain; + } + //TLD found; modify its settings if( $tld == $new_tld ){ - $whois_database[$whois_id] = $tld . '|http://' . ddwhois_get( 'domain' ) . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; + $whois_database[$whois_id] = $tld . '|' . $domain . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; $found = true; } @@ -393,7 +399,7 @@ function ddwhois_setup( array $vars, $new_tld ) //TLD not found in current file; add it to the bottom if( !$found ){ - $whois_database[] = $new_tld . '|http://' . ddwhois_get( 'domain' ) . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; + $whois_database[] = $new_tld . '|' . $domain . $route . '/modules/addons/ddwhois/whoisproxy.php?domain=|HTTPREQUEST-DDAVAILABLE' . "\r\n"; } //Save the resulting file @@ -439,8 +445,6 @@ function ddwhois_backup() function ddwhois_save_settings( array $settings ) { - $settings['domain'] = str_replace( array( 'http://', 'https://' ), array( '', '' ), $settings['domain'] ); - $username = ddwhois_set( 'apiUsername', trim($settings['apiuser']) ); $password = ddwhois_set( 'apiPassword', trim($settings['apipasswd']) ); $domain = ddwhois_set( 'domain', trim( $settings['domain'] )); diff --git a/lang/english.php b/lang/english.php index d786644..d938c86 100644 --- a/lang/english.php +++ b/lang/english.php @@ -8,7 +8,7 @@ 'config_username' => 'API Username', 'config_password' => 'API Password', 'config_domain' => 'Access domain', - 'config_domain_info' => 'This is the domain name where your WHMCS frontend is hosted, without http:// or https://.', + 'config_domain_info' => 'This is the domain name where your WHMCS frontend is hosted, con http:// o https://.', 'config_ip' => 'Allowed IPs', 'config_ip_info' => 'Only requests coming from these IPs will be allowed to access the Whois proxy. Separate IPs with ;.', 'config_save' => 'Save settings', diff --git a/lang/spanish.php b/lang/spanish.php index 1443071..1189587 100644 --- a/lang/spanish.php +++ b/lang/spanish.php @@ -8,7 +8,7 @@ 'config_username' => 'Usuario de API', 'config_password' => 'Contraseña de API', 'config_domain' => 'Dominio de acceso', - 'config_domain_info' => 'Este es el dominio donde se aloja tu frontend de WHMCS, sin http:// o https://.', + 'config_domain_info' => 'Este es el dominio donde se aloja tu frontend de WHMCS, con http:// o https://.', 'config_ip' => 'IPs permitidas', 'config_ip_info' => 'Sólo las peticiones provenientes de estas IPs tendrán acceso al proxy de Whois. Separa varias IPs con ;.', 'config_save' => 'Guardar cambios', diff --git a/version.json b/version.json index 95944c1..4241db5 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "0.3", - "releaseDate": "2015-12-17" + "version": "0.4", + "releaseDate": "2015-12-22" } \ No newline at end of file