35 lines
859 B
PHP
35 lines
859 B
PHP
<?php
|
|
namespace App\Controllers;
|
|
|
|
use App\Helpers\Misc;
|
|
use App\Helpers\Cookies;
|
|
use App\Helpers\Wrappers;
|
|
use App\Models\BaseTemplate;
|
|
|
|
class SettingsController {
|
|
static public function index() {
|
|
$latte = Wrappers::latte();
|
|
$latte->render(Misc::getView('settings'), new BaseTemplate('Settings'));
|
|
}
|
|
|
|
static private function redirect() {
|
|
$url = Misc::url('/settings');
|
|
header("Location: {$url}");
|
|
}
|
|
|
|
static public function general() {
|
|
if (isset($_POST['theme'])) {
|
|
$theme = $_POST['theme'];
|
|
Cookies::set('theme', $theme);
|
|
}
|
|
self::redirect();
|
|
}
|
|
static public function api() {
|
|
if (isset($_POST['api-legacy'])) {
|
|
$legacy = $_POST['api-legacy'];
|
|
}
|
|
Cookies::set('api-legacy', $legacy);
|
|
self::redirect();
|
|
}
|
|
}
|