2015-05-05 01:00:01 +00:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2016-01-07 20:43:09 -03:00
|
|
|
// ============================================================================
|
|
|
|
// Check role
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-05-05 01:00:01 +00:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-08-02 21:49:12 -03:00
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-05-05 01:00:01 +00:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
|
|
{
|
2015-10-18 19:45:58 -03:00
|
|
|
if( isset($_POST['delete-page']) ) {
|
2017-06-23 00:41:00 +02:00
|
|
|
if( deletePage($_POST['key']) ) {
|
|
|
|
Alert::set( $Language->g('The changes have been saved') );
|
|
|
|
Redirect::page('pages');
|
|
|
|
}
|
2015-05-05 01:00:01 +00:00
|
|
|
}
|
|
|
|
else {
|
2017-06-23 00:41:00 +02:00
|
|
|
$key = editPage($_POST);
|
|
|
|
if( $key!==false ) {
|
|
|
|
Alert::set( $Language->g('The changes have been saved') );
|
|
|
|
Redirect::page('edit-page/'.$key);
|
|
|
|
}
|
2015-05-05 01:00:01 +00:00
|
|
|
}
|
2017-06-23 00:41:00 +02:00
|
|
|
|
|
|
|
Redirect::page('pages');
|
2015-05-05 01:00:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================================================================
|
2015-08-02 21:49:12 -03:00
|
|
|
// Main after POST
|
2015-05-05 01:00:01 +00:00
|
|
|
// ============================================================================
|
|
|
|
|
2017-05-17 00:04:53 +02:00
|
|
|
if( !$dbPages->exists($layout['parameters']) ) {
|
2015-07-25 21:25:13 -03:00
|
|
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$layout['parameters']);
|
2017-05-17 00:04:53 +02:00
|
|
|
Redirect::page('pages');
|
2015-05-05 01:00:01 +00:00
|
|
|
}
|
|
|
|
|
2017-05-27 19:46:46 +02:00
|
|
|
$page = $pagesByKey[$layout['parameters']];
|
2017-06-05 22:36:09 +02:00
|
|
|
|
|
|
|
$layout['title'] .= ' - '.$Language->g('Edit Content');
|