proxitok/app/Controllers/SettingsController.php

50 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2022-01-30 18:02:52 -05:00
namespace App\Controllers;
2022-01-30 18:02:52 -05:00
use App\Helpers\Misc;
use App\Helpers\Cookies;
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() {
$latte = Wrappers::latte();
2022-09-25 13:53:00 -04:00
$latte->render(Misc::getView('settings'), new SettingsTemplate());
2022-01-30 18:02:52 -05:00
}
static public function general() {
if (isset($_POST['theme'])) {
$theme = $_POST['theme'];
Cookies::set('theme', $theme);
}
self::redirect();
2022-01-30 18:02:52 -05:00
}
2022-11-04 12:10:51 -04: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);
}
self::redirect();
}
2022-06-28 14:41:51 -04:00
2022-11-04 12:10:51 -04:00
static public function misc() {
if (isset($_POST['misc-sw'])) {
$sw = $_POST['misc-sw'];
Cookies::set("misc-sw", $sw);
}
self::redirect();
}
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
}