implemented theme changer
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
2023-10-31 20:29:17 +00:00
parent 3614ba829c
commit 9bded6133e
4 changed files with 53 additions and 5 deletions

View File

@ -0,0 +1,34 @@
<?php
class Settings extends Page {
function index()
{
$this->set('userdata', $_SESSION['user']->data);
$this->set('template', "settings.html");
}
function edit()
{
$theme = $_REQUEST['theme'];
switch($theme)
{
case 'light':
case 'dark':
$_SESSION['user']->data['theme'] = $theme;
$_SESSION['user']->save();
$this->redirect('/settings');
break;
default:
return partial('error.html', ['errorMessage' => 'Dieses Theme existiert nicht']);
}
}
function maySeeThisPage(){
if($_SESSION['user'])
return true;
else return false;
}
}