2023-02-19 13:30:47 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Helpers;
|
|
|
|
|
|
|
|
class BlueprintVariableService
|
|
|
|
{
|
|
|
|
// Construct BlueprintVariableService
|
2023-02-21 03:21:45 -05:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-02-19 13:30:47 -05:00
|
|
|
|
|
|
|
// $bp->licenseIsValid()
|
2023-02-21 03:21:45 -05:00
|
|
|
public function licenseIsValid(): bool{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
2023-02-21 04:36:33 -05:00
|
|
|
CURLOPT_URL => 'http://api.ptero.shop:28015/legacy/validate/'.$this->licenseKey(),
|
2023-02-21 03:21:45 -05:00
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
|
CURLOPT_ENCODING => '',
|
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
|
CURLOPT_TIMEOUT => 3000,
|
|
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
|
|
|
|
if($response === "true") {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// $bp->licenseIsBlacklisted()
|
|
|
|
public function licenseIsBlacklisted(): bool{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
2023-02-21 04:36:33 -05:00
|
|
|
CURLOPT_URL => 'http://api.ptero.shop:28015/legacy/validate/'.$this->licenseKey(),
|
2023-02-21 03:21:45 -05:00
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
|
CURLOPT_ENCODING => '',
|
|
|
|
CURLOPT_MAXREDIRS => 10,
|
|
|
|
CURLOPT_TIMEOUT => 3000,
|
|
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
|
|
|
|
if($response === "1") {
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// $bp->licenseKey()
|
|
|
|
public function licenseKey(): string{
|
2023-02-21 03:24:15 -05:00
|
|
|
return "([(pterodactylmarket_transactionid)])";
|
2023-02-21 03:21:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// $bp->licenseKeyCensored()
|
|
|
|
public function licenseKeyCensored(): string{
|
|
|
|
return substr($this->licenseKey(), 0, 5) . "••••••••••••";
|
|
|
|
}
|
2023-02-19 13:30:47 -05:00
|
|
|
}
|