proxitok/app/Controllers/SettingsController.php

41 lines
1 KiB
PHP
Raw Permalink Normal View History

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