Fixes in settings admin

This commit is contained in:
Antonio de la Rosa 2025-11-28 01:28:32 +01:00
parent 2df08a0e7d
commit e3775e1045
6 changed files with 597 additions and 14 deletions

View file

@ -24,6 +24,8 @@ class AppController extends TplController{
//Default admin page.
echo $this->tpl->load_template('layout', ['title' => 'Admin', 'path_module' => 'admin.home']);
}
else {
@ -319,6 +321,42 @@ class AppController extends TplController{
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin'));
break;
case 'change_theme':
if($this->check_login()) {
settype($_GET['theme'], 'integer');
if($_GET['theme']>1 || $_GET['theme']<0) {
$_GET['theme']=0;
}
$error=0;
$message='';
$this->db->connect();
if(!$this->db->update('useradmin', ['theme' => $_GET['theme']], 'WHERE id=?', [$_SESSION['admin_login']])) {
$error=1;
}
else {
$_SESSION['theme']=$_GET['theme'];
}
}
echo $this->json(['error' => $error, 'message' => $message]);
break;
}