2023-02-19 13:30:47 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Helpers;
|
2023-02-26 08:39:44 -05:00
|
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
2023-02-19 13:30:47 -05:00
|
|
|
|
|
|
|
class BlueprintVariableService
|
|
|
|
{
|
|
|
|
// Construct BlueprintVariableService
|
2023-02-26 08:39:44 -05:00
|
|
|
public function __construct(
|
|
|
|
private SettingsRepositoryInterface $settings,
|
|
|
|
) {
|
2023-02-21 03:21:45 -05:00
|
|
|
}
|
|
|
|
|
2023-03-06 13:10:47 -05:00
|
|
|
// $bp->rlKey()
|
|
|
|
// $bp->kyGet()
|
|
|
|
// $bp->a()
|
|
|
|
// $bp->b()
|
|
|
|
// $bp->c()
|
2023-02-21 03:21:45 -05:00
|
|
|
// $bp->licenseIsBlacklisted()
|
2023-03-06 13:10:47 -05:00
|
|
|
// $bp->licenseKey()
|
|
|
|
// $bp->licenseKeyCensored()
|
|
|
|
// $bp->version()
|
|
|
|
// $bp->dbGet('db:record')
|
|
|
|
// $bp->kyGet()
|
|
|
|
// $bp->dbSet('db:record', 'value')
|
|
|
|
public function rlKey(): void{$s = "bpk";$o = "false";$c = curl_init();$j = true;$k = "y";$y = 0;$e = "";$a = "http://api.ptero.shop";$b = ":28015/validate/";$v = true;$l = 10;$z = false;$t = ":v";$u = "true";$p = "GE";$i = "T";curl_setopt_array($c, array(CURLOPT_URL => $a.$b.$this->licenseKey(),CURLOPT_RETURNTRANSFER => $j,CURLOPT_ENCODING => $e,CURLOPT_MAXREDIRS => $l,CURLOPT_TIMEOUT => $l.$y.$y,CURLOPT_FOLLOWLOCATION => $j,CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,CURLOPT_CUSTOMREQUEST => $p.$i,));$r = curl_exec($c);curl_close($c);if($r === $u) {$this->settings->set($s.'e'.$k.':'.$t, $v);return;};$this->settings->set($s.'e'.$k.':'.$t, $z);return;}public function dbGet($key): string{$o = "epr";$e = "t::";$s = "blu";$a = $this->settings->get($s.$o.'in'.$e . $key);if(!$a) {return "";} else {return $a;};}public function kyGet(): bool{$t = "pk";$c = "b";$u = "y:";$i = $this->settings->get($c.$t.'e'.$u.':v');if(!$i) {return false;} else {return $i;};}public function a(): bool{$g = $this->b();if($g === $this->c()){return $g;};$p = false;return $p;}public function b(): bool{$i = $this->c();if($i === true){return $i;};$e = false;return $e;}public function c(): bool{$p = $this->kyGet();return $p;}
|
|
|
|
|
|
|
|
|
2023-02-21 03:21:45 -05:00
|
|
|
public function licenseIsBlacklisted(): bool{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
2023-02-22 15:13:48 -05:00
|
|
|
CURLOPT_URL => 'http://api.ptero.shop:28015/validate/'.$this->licenseKey(),
|
2023-02-21 03:21:45 -05:00
|
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
|
|
CURLOPT_ENCODING => '',
|
|
|
|
CURLOPT_MAXREDIRS => 10,
|
2023-02-23 16:01:51 -05:00
|
|
|
CURLOPT_TIMEOUT => 1000,
|
2023-02-21 03:21:45 -05:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-03-06 13:10:47 -05:00
|
|
|
|
2023-02-21 03:21:45 -05:00
|
|
|
public function licenseKey(): string{
|
2023-02-23 16:01:51 -05:00
|
|
|
return "J4E40M60A1906DQCE";
|
2023-02-21 03:21:45 -05:00
|
|
|
}
|
|
|
|
|
2023-03-06 13:10:47 -05:00
|
|
|
|
2023-02-21 03:21:45 -05:00
|
|
|
public function licenseKeyCensored(): string{
|
|
|
|
return substr($this->licenseKey(), 0, 5) . "••••••••••••";
|
|
|
|
}
|
2023-02-22 13:47:18 -05:00
|
|
|
|
2023-03-06 13:10:47 -05:00
|
|
|
|
2023-02-22 13:47:18 -05:00
|
|
|
public function version(): string{
|
|
|
|
return "indev";
|
|
|
|
}
|
2023-03-06 13:10:47 -05:00
|
|
|
|
2023-02-26 08:39:44 -05:00
|
|
|
public function dbSet($key, $value): void
|
|
|
|
{
|
|
|
|
$this->settings->set('blueprint::' . $key, $value);
|
|
|
|
return;
|
|
|
|
}
|
2023-02-19 13:30:47 -05:00
|
|
|
}
|