format php and add domainIsOnServer

This commit is contained in:
Florian Schmitt 2024-12-05 22:45:51 +03:00
parent 02372fe988
commit 45ea6abffb

View file

@ -6,6 +6,12 @@ use Amp\Future;
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\Request;
function domainIsOnServer($domain)
{
$domainWithoutWww = preg_replace('/^www\./m', '', $domain);
return file_exists('/etc/nginx/conf.d/'.$domainWithoutWww.'.conf');
}
function checkIP($domain, $withWww = false, $noip6 = false)
{
if (!preg_match('/(?=^.{4,253}$)(^((?!-)[a-zA-Z0-9-]{0,62}[a-zA-Z0-9]\.)+[a-zA-Z]{2,63}$)/', strtolower($domain))) {