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

34 lines
886 B
PHP
Raw Permalink Normal View History

2023-10-31 21:29:17 +01:00
<?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;
}
}