Compare commits

..

No commits in common. "1bf327cc0072ab048c1e6524b454d7d89a81e810" and "c5f2d3044e3a3ae33a842f5f0b4e2c36fcd6f14b" have entirely different histories.

2 changed files with 7 additions and 22 deletions

View File

@ -152,6 +152,9 @@ class BindAPI
{
$nameServers = $this->nameserverController->findAll();
foreach($nameServers as $nameServer) {
if ($nameServer['name'] == 'ns1.24unix.net') {
continue;
}
echo COLOR_DEFAULT . ' ' . $nameServer['name'];
if (!empty($nameServer['aaaa'])) {
$result = $this->checkController->sendCommand(serverName: $nameServer['name'],
@ -196,6 +199,7 @@ class BindAPI
post: true,
body: $body);
}
die();
} else {
echo 'error';
}
@ -207,9 +211,7 @@ class BindAPI
function handleCheckPanels()
{
$parsedArguments = $this->parseArguments();
print_r($this->arguments);
$id = intval(value: $this->arguments[1] ?? 0);
$id = $this->getId();
print("id: $id " . PHP_EOL);
if ($id != 0) {
@ -227,21 +229,10 @@ class BindAPI
command: 'domains',
type: 'panel');
}
if ($result['error']) {
echo $result['data'] . PHP_EOL;
exit(1);
}
$domains = json_decode(json: $result['data']);
if ($domains['error']) {
echo $domains['data'];
exit(1);
}
$maxDomainName = 0;
// TODO this is ugly code
foreach ($domains as $domain) {
if (($domain->id_parent_domain == 0 && !str_contains(haystack: $domain->domain, needle: $panel['name'])) && (strlen(string: $domain->domain) > $maxDomainName)) {
$maxDomainName = strlen(string: $domain->domain);
@ -573,8 +564,6 @@ class BindAPI
if (str_contains(haystack: $argument, needle: '=')) {
[$key, $value] = explode(separator: '=', string: $argument);
$arguments[strtolower(string: $key)] = $value;
} else {
$arguments[strtolower(string: $argument)] = $argument;
}
}
return $arguments;

View File

@ -21,7 +21,6 @@ class CheckController
*/
function sendCommand(String $serverName, int $versionIP, String $apiKey, String $command, String $type, bool $post = false, array $body = []): array
{
$error = false;
$curl = curl_init();
if ($type == "panel") {
curl_setopt(handle: $curl, option: CURLOPT_URL, value: "https://$serverName/api/v2/" . $command);
@ -29,8 +28,7 @@ class CheckController
curl_setopt(handle: $curl, option: CURLOPT_URL, value: "https://$serverName/api/" . $command);
}
curl_setopt(handle: $curl, option: CURLOPT_RETURNTRANSFER, value: 1);
curl_setopt(handle: $curl, option: CURLOPT_TIMEOUT_MS, value: 3000);
curl_setopt(handle: $curl, option: CURLOPT_HTTP_VERSION, value: CURL_HTTP_VERSION_2TLS);
curl_setopt(handle: $curl, option: CURLOPT_TIMEOUT_MS, value: 1000);
if ($versionIP == 4) {
curl_setopt(handle: $curl, option: CURLOPT_IPRESOLVE, value: CURL_IPRESOLVE_V4);
@ -68,12 +66,10 @@ class CheckController
$result = 'Unhandled error: ' . $httpResponse;
}
} else {
$error = true;
$result = curl_error(handle: $curl);
}
curl_close(handle: $curl);
return [
'error' => true,
'data' => $result,
'header' => $httpResponse ?? ''
];