This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/web/pages/settings/controller.php
Chris 9bded6133e
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
implemented theme changer
2023-10-31 20:29:17 +00:00

34 lines
886 B
PHP

<?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;
}
}