1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-07 05:37:03 +02:00

Pages Plugin: updates

This commit is contained in:
Awilum
2012-09-30 21:03:01 +03:00
parent 8e0aef02fa
commit 22b108771c

View File

@@ -229,19 +229,16 @@
} else { } else {
$parent_page = Request::post('pages'); $parent_page = Request::post('pages');
} }
// Save field // Save field
$post_parent = Request::post('pages'); $post_parent = Request::post('pages');
// Validate // Validate
//-------------- //--------------
if (trim(Request::post('page_name')) == '') $errors['pages_empty_name'] = __('This field should not be empty', 'pages'); if (trim(Request::post('page_name')) == '') $errors['pages_empty_name'] = __('Required field', 'pages');
if ((count($pages->select('[slug="'.Security::safeName(Request::post('page_name'), '-', true).'"]')) != 0) and (Security::safeName(Request::post('page_old_name'), '-', true) !== Security::safeName(Request::post('page_name'), '-', true))) $errors['pages_exists'] = __('This page already exists', 'pages');
$_page = $pages->select('[slug="'.Security::safeName(Request::post('page_name'), '-', true).'"]'); if (trim(Request::post('page_title')) == '') $errors['pages_empty_title'] = __('Required field', 'pages');
if ((count($_page) != 0) and (Security::safeName(Request::post('page_old_name'), '-', true) !== Security::safeName(Request::post('page_name'), '-', true))) $errors['pages_exists'] = __('This page already exists', 'pages');
if (trim(Request::post('page_title')) == '') $errors['pages_empty_title'] = __('This field should not be empty', 'pages');
// Save fields // Save fields
if (Request::post('page_name')) $post_name = Request::post('page_name'); else $post_name = ''; if (Request::post('page_name')) $post_name = Request::post('page_name'); else $post_name = '';
@@ -254,13 +251,12 @@
if (Request::post('robots_follow')) $post_robots_follow = true; else $post_robots_follow = false; if (Request::post('robots_follow')) $post_robots_follow = true; else $post_robots_follow = false;
//-------------- //--------------
// Generate date // Prepare date
$date = mktime(Request::post('hour'), if (Valid::date(Request::post('page_date'))) {
Request::post('minute'), $date = strtotime(Request::post('page_date'));
Request::post('second'), } else {
Request::post('month'), $date = time();
Request::post('day'), }
Request::post('year'));
if (Request::post('robots_index')) $robots_index = 'noindex'; else $robots_index = 'index'; if (Request::post('robots_index')) $robots_index = 'noindex'; else $robots_index = 'index';
if (Request::post('robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow'; if (Request::post('robots_follow')) $robots_follow = 'nofollow'; else $robots_follow = 'follow';