fixes #153 - thx laborix!
This commit is contained in:
parent
5ad4647e94
commit
0a7ad2ccb8
@ -12,28 +12,46 @@
|
|||||||
* @author NoWhereMan <real_nowhereman at users dot sf dot com>
|
* @author NoWhereMan <real_nowhereman at users dot sf dot com>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class admin_static_write extends AdminPanelActionValidated {
|
class admin_static_write extends AdminPanelActionValidated {
|
||||||
|
|
||||||
var $validators = array(
|
var $validators = array(
|
||||||
array('subject', 'subject', 'notEmpty', false, false, 'trim'),
|
array(
|
||||||
array('content', 'content', 'notEmpty', false, false, 'stripslashes'),
|
'subject',
|
||||||
array('id', 'id', 'isValidEntryId', false, false, 'stripslashes'),
|
'subject',
|
||||||
|
'notEmpty',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'trim'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'content',
|
||||||
|
'content',
|
||||||
|
'notEmpty',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'stripslashes'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id',
|
||||||
|
'id',
|
||||||
|
'isValidEntryId',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'stripslashes'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var $events = array('save', 'preview');
|
var $events = array(
|
||||||
|
'save',
|
||||||
|
'preview'
|
||||||
|
);
|
||||||
|
|
||||||
function _makePreview($arr, $id = null) {
|
function _makePreview($arr, $id = null) {
|
||||||
|
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
$arr ['subject'] = apply_filters('title_save_pre', $arr ['subject']);
|
$arr ['subject'] = apply_filters('title_save_pre', $arr ['subject']);
|
||||||
$arr ['content'] = apply_filters('content_save_pre', $arr ['content']);
|
$arr ['content'] = apply_filters('content_save_pre', $arr ['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->smarty->assign('post', $arr);
|
$this->smarty->assign('post', $arr);
|
||||||
|
|
||||||
if (THEME_LEGACY_MODE) {
|
if (THEME_LEGACY_MODE) {
|
||||||
@ -46,19 +64,14 @@
|
|||||||
$this->smarty->assign('preview', true);
|
$this->smarty->assign('preview', true);
|
||||||
|
|
||||||
$this->smarty->assign('id', $id);
|
$this->smarty->assign('id', $id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function makePageTitle($title, $sep) {
|
function makePageTitle($title, $sep) {
|
||||||
global $lang;
|
global $lang;
|
||||||
return "$title $sep {$lang['admin']['static']['write']['head']}";
|
return "$title $sep {$lang['admin']['static']['write']['head']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
$this->smarty->assign('static_id', 'static' . date_time());
|
$this->smarty->assign('static_id', 'static' . date_time());
|
||||||
@ -70,19 +83,21 @@
|
|||||||
// we print the list
|
// we print the list
|
||||||
if ($arr) {
|
if ($arr) {
|
||||||
$this->_makePreview($arr, $id);
|
$this->_makePreview($arr, $id);
|
||||||
|
} else {
|
||||||
|
$id = '';
|
||||||
|
$arr = array();
|
||||||
|
$_GET ['page'] = '';
|
||||||
|
utils_redirect('admin.php?p=static');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
add_filter('wp_title', array(
|
||||||
|
&$this,
|
||||||
|
'makePageTitle'
|
||||||
|
), 10, 2);
|
||||||
|
|
||||||
add_filter('wp_title', array(&$this, 'makePageTitle'), 10, 2);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getposteddata() {
|
function _getposteddata() {
|
||||||
|
|
||||||
$arr ['version'] = system_ver();
|
$arr ['version'] = system_ver();
|
||||||
$arr ['subject'] = ($_POST ['subject']);
|
$arr ['subject'] = ($_POST ['subject']);
|
||||||
$arr ['content'] = ($_POST ['content']);
|
$arr ['content'] = ($_POST ['content']);
|
||||||
@ -96,11 +111,9 @@
|
|||||||
// $arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
|
// $arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onsave() {
|
function onsave() {
|
||||||
|
|
||||||
$oldid = isset($_GET ['page']) ? $_GET ['page'] : null;
|
$oldid = isset($_GET ['page']) ? $_GET ['page'] : null;
|
||||||
$id = $_POST ['id'];
|
$id = $_POST ['id'];
|
||||||
|
|
||||||
@ -117,8 +130,6 @@
|
|||||||
$this->_makePreview($this->_getposteddata());
|
$this->_makePreview($this->_getposteddata());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onerror() {
|
function onerror() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user