2022-01-03 15:11:24 +00:00
|
|
|
<?php
|
2022-01-30 23:02:52 +00:00
|
|
|
namespace App\Controllers;
|
2022-01-05 23:11:00 +00:00
|
|
|
|
2022-01-30 23:02:52 +00:00
|
|
|
use App\Helpers\Misc;
|
|
|
|
use App\Helpers\Cookies;
|
|
|
|
use App\Models\SettingsTemplate;
|
2022-01-28 14:54:09 +00:00
|
|
|
|
2022-01-30 23:02:52 +00:00
|
|
|
class SettingsController {
|
|
|
|
static public function index() {
|
2022-01-28 14:54:09 +00:00
|
|
|
$latte = Misc::latte();
|
2022-02-20 15:25:15 +00:00
|
|
|
$latte->render(Misc::getView('settings'), new SettingsTemplate);
|
2022-01-30 23:02:52 +00:00
|
|
|
}
|
2022-01-03 15:11:24 +00:00
|
|
|
|
2022-03-13 17:22:36 +00:00
|
|
|
static private function redirect() {
|
|
|
|
$url = Misc::url('/settings');
|
|
|
|
header("Location: {$url}");
|
|
|
|
}
|
|
|
|
|
2022-01-30 23:02:52 +00:00
|
|
|
static public function proxy() {
|
|
|
|
if (in_array(Cookies::PROXY, $_POST)) {
|
|
|
|
foreach (Cookies::PROXY as $proxy_element) {
|
|
|
|
Cookies::set($proxy_element, $_POST[$proxy_element]);
|
2022-01-28 14:54:09 +00:00
|
|
|
}
|
2022-01-03 15:11:24 +00:00
|
|
|
}
|
2022-03-13 17:22:36 +00:00
|
|
|
self::redirect();
|
2022-01-30 23:02:52 +00:00
|
|
|
}
|
2022-03-11 19:50:11 +00:00
|
|
|
|
|
|
|
static public function api() {
|
2022-03-13 17:22:36 +00:00
|
|
|
$legacy = 'off';
|
|
|
|
if (isset($_POST['api-legacy'])) {
|
|
|
|
$legacy = 'on';
|
|
|
|
}
|
|
|
|
Cookies::set('api-legacy', $legacy);
|
|
|
|
self::redirect();
|
2022-03-11 19:50:11 +00:00
|
|
|
}
|
2022-01-30 23:02:52 +00:00
|
|
|
}
|