Update high

This commit is contained in:
Kevin Feiler
2025-10-16 01:15:48 +02:00
parent 15815e3a9d
commit ceee8d9663
92 changed files with 20860 additions and 34 deletions

View File

@@ -0,0 +1,38 @@
<?php
require_once __DIR__ . "/lib/Requests.php";
require_once __DIR__ . "/lib/TSDNS.php";
use Illuminate\Database\Capsule\Manager as Capsule;
function hook_check_subdomain(array $params)
{
try {
$settings = Capsule::table('modwhmcs_teamspeak_settings')->select('enabletsdns', 'domaintsdns', 'urlapi', 'keyapi')->first();
if ($settings->enabletsdns) {
$tsdnsClient = new TSDNS($settings->urlapi, $settings->keyapi);
if (!$tsdnsClient) {
throw new Exception('The subdomains availability could not be checked. Contact support.');
}
$id = Capsule::table('tblcustomfields')->where('fieldname', 'Subdomain')->value('id');
$request = $tsdnsClient->getZone($params['customfield'][$id] . '.' . $settings->domaintsdns);
$zone = json_decode($request->body);
if (count($zone->message)) {
throw new Exception('Subdomain is already in use');
}
}
} catch (Exception $e) {
$errors = array();
$errors[] = $e->getMessage();
return $errors;
}
}
add_hook("ShoppingCartValidateProductUpdate", 1, "hook_check_subdomain");