2023-09-03 09:33:39 -04:00
|
|
|
<?php
|
|
|
|
|
2023-09-07 10:17:04 -04:00
|
|
|
// Core file for the client-side library for Blueprint Extensions
|
2023-09-03 09:33:39 -04:00
|
|
|
|
2023-09-07 10:17:04 -04:00
|
|
|
|
|
|
|
namespace Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Client;
|
2023-09-03 09:33:39 -04:00
|
|
|
|
|
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
|
|
|
|
2023-09-07 10:17:04 -04:00
|
|
|
class BlueprintClientLibrary
|
2023-09-03 09:33:39 -04:00
|
|
|
{
|
2023-09-07 10:17:04 -04:00
|
|
|
// Construct core
|
2023-09-03 09:33:39 -04:00
|
|
|
public function __construct(
|
|
|
|
private SettingsRepositoryInterface $settings,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
| Databasing
|
|
|
|
|
|
|
|
|
| dbGet("table", "record");
|
|
|
|
| dbSet("table", "record", "value");
|
|
|
|
*/
|
|
|
|
public function dbGet($table, $record) {
|
|
|
|
return $this->settings->get($table."::".$record);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dbSet($table, $record, $value) {
|
|
|
|
return $this->settings->set($table."::".$record, $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
| Files
|
|
|
|
|
|
|
|
|
| fileRead("path");
|
2023-09-03 09:45:54 -04:00
|
|
|
| fileMake("path");
|
|
|
|
| fileWipe("path");
|
2023-09-03 09:33:39 -04:00
|
|
|
*/
|
|
|
|
public function fileRead($path) {
|
2023-10-03 15:56:13 -04:00
|
|
|
return file_get_contents($path);
|
2023-09-03 09:33:39 -04:00
|
|
|
}
|
2023-09-03 09:45:54 -04:00
|
|
|
|
|
|
|
public function fileMake($path) {
|
|
|
|
return shell_exec("touch ".escapeshellarg($path).";");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function fileWipe($path) {
|
|
|
|
return shell_exec("rm ".escapeshellarg($path).";");
|
|
|
|
}
|
2023-09-03 09:33:39 -04:00
|
|
|
}
|