2022-01-03 10:11:24 -05:00
|
|
|
<?php
|
2022-01-30 18:02:52 -05:00
|
|
|
namespace App\Controllers;
|
2022-01-05 18:11:00 -05:00
|
|
|
|
2022-01-30 18:02:52 -05:00
|
|
|
use App\Helpers\Misc;
|
|
|
|
use App\Helpers\Cookies;
|
2022-03-29 13:30:31 -04:00
|
|
|
use App\Helpers\Wrappers;
|
2022-09-25 13:53:00 -04:00
|
|
|
use App\Models\SettingsTemplate;
|
2022-01-28 09:54:09 -05:00
|
|
|
|
2022-01-30 18:02:52 -05:00
|
|
|
class SettingsController {
|
|
|
|
static public function index() {
|
2022-11-04 15:08:19 -04:00
|
|
|
Wrappers::latte('settings', new SettingsTemplate());
|
2022-01-30 18:02:52 -05:00
|
|
|
}
|
2022-01-03 10:11:24 -05:00
|
|
|
|
2022-03-29 13:30:31 -04:00
|
|
|
static public function general() {
|
|
|
|
if (isset($_POST['theme'])) {
|
|
|
|
$theme = $_POST['theme'];
|
|
|
|
Cookies::set('theme', $theme);
|
2022-01-03 10:11:24 -05:00
|
|
|
}
|
2022-03-13 13:22:36 -04:00
|
|
|
self::redirect();
|
2022-01-30 18:02:52 -05:00
|
|
|
}
|
2022-11-04 12:10:51 -04:00
|
|
|
|
2022-03-11 14:50:11 -05:00
|
|
|
static public function api() {
|
2022-06-04 15:04:43 -04:00
|
|
|
// TODO, ADD COUNT
|
2022-06-28 14:41:51 -04:00
|
|
|
if (isset($_POST['api-test_endpoints'])) {
|
|
|
|
$test_endpoints = $_POST['api-test_endpoints'];
|
|
|
|
Cookies::set('api-test_endpoints', $test_endpoints);
|
|
|
|
}
|
2022-09-25 13:53:00 -04:00
|
|
|
|
|
|
|
if (isset($_POST['api-downloader'])) {
|
|
|
|
$downloader = $_POST['api-downloader'];
|
|
|
|
Cookies::set("api-downloader", $downloader);
|
|
|
|
}
|
2022-03-13 13:22:36 -04:00
|
|
|
self::redirect();
|
2022-03-11 14:50:11 -05:00
|
|
|
}
|
2022-06-28 14:41:51 -04:00
|
|
|
|
|
|
|
static private function redirect() {
|
|
|
|
$url = Misc::url('/settings');
|
|
|
|
header("Location: {$url}");
|
|
|
|
}
|
2022-01-30 18:02:52 -05:00
|
|
|
}
|