proxitok/app/Controllers/SettingsController.php

50 lines
1.3 KiB
PHP
Raw 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 {
static public function index() {
$latte = Wrappers::latte();
2022-09-25 17:53:00 +00:00
$latte->render(Misc::getView('settings'), new SettingsTemplate());
2022-01-30 23:02:52 +00:00
}
static public 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
static public 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
2022-11-04 16:25:14 +00:00
static public function misc() {
if (isset($_POST['misc-sw'])) {
$sw = $_POST['misc-sw'];
Cookies::set("misc-sw", $sw);
}
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
}