34 lines
886 B
PHP
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;
|
||
|
}
|
||
|
}
|