This commit is contained in:
azett 2022-12-29 21:21:16 +01:00
parent 88494f5526
commit 3a32aad0de

View File

@ -1,7 +1,9 @@
<?php <?php
class admin_config extends AdminPanel { class admin_config extends AdminPanel {
var $panelname = 'config'; var $panelname = 'config';
} }
class admin_config_default extends AdminPanelActionValidated { class admin_config_default extends AdminPanelActionValidated {
@ -9,27 +11,96 @@
var $validators = array( var $validators = array(
// not needed anymore ! // not needed anymore !
// array('blog_root', 'blog_root', 'notEmpty', false, false, 'trim'), // array('blog_root', 'blog_root', 'notEmpty', false, false, 'trim'),
array('www', 'www', 'notEmpty', false, false, 'trim'), array(
'www',
'www',
'notEmpty',
false,
false,
'trim'
),
// ... // ...
array('title', 'title', 'notEmpty', false, false, 'trim'), array(
'title',
'title',
'notEmpty',
false,
false,
'trim'
),
// array('subtitle', 'subtitle', 'notEmpty', false, false, 'trim'), // array('subtitle', 'subtitle', 'notEmpty', false, false, 'trim'),
// array('blogfooter', 'blogfooter', 'notEmpty', false, false, 'trim'), // array('blogfooter', 'blogfooter', 'notEmpty', false, false, 'trim'),
array('email', 'email', 'isEmail', false, false, 'trim'), array(
array('maxentries', 'maxentries', 'isInt', false, false, 'trim'), 'email',
'email',
array('timeoffset', 'timeoffset', 'isNumber', false, false, 'trim'), 'isEmail',
array('timeformat', 'timeformat', 'notEmpty', false, false, 'trim'), false,
array('dateformat', 'dateformat', 'notEmpty', false, false, 'trim'), false,
array('dateformatshort', 'dateformatshort', 'notEmpty', false, false, 'trim'), 'trim'
),
array('lang', 'lang', 'notEmpty', false, false, 'trim'), array(
array('charset', 'charset', 'notEmpty', false, false, 'trim'), 'maxentries',
'maxentries',
'isInt',
false,
false,
'trim'
),
array(
'timeoffset',
'timeoffset',
'isNumber',
false,
false,
'trim'
),
array(
'timeformat',
'timeformat',
'notEmpty',
false,
false,
'trim'
),
array(
'dateformat',
'dateformat',
'notEmpty',
false,
false,
'trim'
),
array(
'dateformatshort',
'dateformatshort',
'notEmpty',
false,
false,
'trim'
),
array(
'lang',
'lang',
'notEmpty',
false,
false,
'trim'
),
array(
'charset',
'charset',
'notEmpty',
false,
false,
'trim'
)
); );
var $events = array('save'); var $events = array(
'save'
);
function setup() { function setup() {
$this->smarty->assign('themes', theme_list()); $this->smarty->assign('themes', theme_list());
@ -42,20 +113,17 @@
} }
$this->smarty->assign('static_list', $static_list); $this->smarty->assign('static_list', $static_list);
} }
function onsave() { function onsave() {
global $fp_config; global $fp_config;
$l = explode(',', $_POST ['lang']); $l = explode(',', $_POST ['lang']);
$fp_config ['general'] = array( $fp_config ['general'] = array(
// 'BLOG_ROOT' => $_POST['blog_root'], // 'BLOG_ROOT' => $_POST['blog_root'],
'www' => $_POST ['www'], 'www' => $_POST ['www'],
'title' => html_entity_decode(stripslashes($_POST['title'])), 'title' => wp_specialchars(stripslashes($_POST ['title'])),
'subtitle' => html_entity_decode(stripslashes($_POST['subtitle'])), 'subtitle' => wp_specialchars(stripslashes($_POST ['subtitle'])),
'footer' => html_entity_decode(stripslashes($_POST['blogfooter'])), 'footer' => wp_specialchars(stripslashes($_POST ['blogfooter'])),
'author' => $_POST ['author'], 'author' => $_POST ['author'],
'email' => $_POST ['email'], 'email' => $_POST ['email'],
'startpage' => ($_POST ['startpage'] == ':NULL:') ? null : $_POST ['startpage'], 'startpage' => ($_POST ['startpage'] == ':NULL:') ? null : $_POST ['startpage'],
@ -66,8 +134,7 @@
'theme' => $fp_config ['general'] ['theme'], 'theme' => $fp_config ['general'] ['theme'],
'style' => @$fp_config ['general'] ['style'], 'style' => @$fp_config ['general'] ['style'],
'blogid' => $fp_config ['general'] ['blogid'], 'blogid' => $fp_config ['general'] ['blogid'],
'charset'=> 'utf-8', 'charset' => 'utf-8'
); );
$fp_config ['locale'] = array( $fp_config ['locale'] = array(
@ -79,20 +146,14 @@
'lang' => $_POST ['lang'] 'lang' => $_POST ['lang']
); );
// 'LANG' => $l[0], // 'LANG' => $l[0],
// 'CHARSET'=> $l[1], // 'CHARSET'=> $l[1],
$success = config_save() ? 1 : -1; $success = config_save() ? 1 : -1;
$this->smarty->assign('success', $success); $this->smarty->assign('success', $success);
return 1; return 1;
} }
function onerror() { function onerror() {
@ -102,12 +163,9 @@
function cleartplcache() { function cleartplcache() {
// if theme was switched, clear tpl cache // if theme was switched, clear tpl cache
$tpl = new tpl_deleter(); $tpl = new tpl_deleter();
$tpl->getList(); $tpl->getList();
} }
} }