Added CCTLDs Check Using CSV From https://github.com/gavingmiller/second-level-domains
This commit is contained in:
parent
867a904f13
commit
5ac9be0ff8
2 changed files with 1426 additions and 1 deletions
|
@ -13636,7 +13636,9 @@ function syncDomains($file='',$domainname='') {
|
|||
echo "\nUsing Let's Encrypt SSL certificate for domain " . $dom['domainname'] . ".\n";
|
||||
$dmnNamesToEncrypt = array($dom['domainname']);
|
||||
$parts = explode(".", $dom['domainname']);
|
||||
array_push($dmnNamesToEncrypt, "www." . $dom['domainname']); // Add www. as alias for cert
|
||||
if(count($parts) <= 2 || $this->domainIsCCTLD($dom['domainname'])){
|
||||
array_push($dmnNamesToEncrypt, "www." . $dom['domainname']); // Add www. as alias for cert
|
||||
}
|
||||
$encDomains["domainnames"] = $dmnNamesToEncrypt;
|
||||
$encDomains["domainpath"] = $dom['homedir'] . "/httpdocs";
|
||||
$this->getAndUseLetsEncryptCert($encDomains, $this->getClientEmailFromPanelUsername($dom['panelusername']));
|
||||
|
@ -15686,5 +15688,26 @@ function array_copy($arr) {
|
|||
return $newArray;
|
||||
}
|
||||
|
||||
function domainIsCCTLD($domain){
|
||||
$domain = strtolower($domain);
|
||||
$finalList = array();
|
||||
$csv = array_map('str_getcsv', file($this->ehcpInstallPath . '/misc/SLDs.csv'));
|
||||
foreach($csv as $key => $value){
|
||||
if(is_array($value) && count($value) == 2){
|
||||
$finalList[] = strtolower($value[1]);
|
||||
}else if(!is_array($value)){
|
||||
$finalList[] = strtolower($value);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($finalList as $val){
|
||||
if(endsWith($domain, $val)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}// end class
|
||||
?>
|
||||
|
|
1402
ehcp/misc/SLDs.csv
Normal file
1402
ehcp/misc/SLDs.csv
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue