proxitok/app/Controllers/SettingsController.php

41 lines
1 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 {
2023-04-27 14:23:23 -04:00
public static function index() {
2022-11-04 15:08:19 -04:00
Wrappers::latte('settings', new SettingsTemplate());
2022-01-30 18:02:52 -05:00
}
2023-04-27 14:23:23 -04:00
public static 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
2023-04-27 14:23:23 -04:00
public static 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
static private function redirect() {
$url = Misc::url('/settings');
header("Location: {$url}");
}
2022-01-30 18:02:52 -05:00
}