2015-05-05 03:00:01 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-07-14 06:41:32 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Functions
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
function addPost($args)
|
|
|
|
{
|
|
|
|
global $dbPosts;
|
2015-07-20 05:14:12 +02:00
|
|
|
global $Language;
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
// Page status, published or draft.
|
|
|
|
if( isset($args['publish']) ) {
|
|
|
|
$args['status'] = "published";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$args['status'] = "draft";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the page.
|
|
|
|
if( $dbPosts->add($args) )
|
|
|
|
{
|
2015-06-27 06:32:29 +02:00
|
|
|
Alert::set('Post added successfuly');
|
2015-05-05 03:00:01 +02:00
|
|
|
Redirect::page('admin', 'manage-posts');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-20 05:14:12 +02:00
|
|
|
Alert::set($Language->g('an-error-occurred-while-trying-to-create-the-post'));
|
2015-05-05 03:00:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-14 06:41:32 +02:00
|
|
|
// ============================================================================
|
|
|
|
// POST Method
|
|
|
|
// ============================================================================
|
|
|
|
|
2015-05-05 03:00:01 +02:00
|
|
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
|
|
|
{
|
|
|
|
addPost($_POST);
|
2015-05-31 03:06:55 +02:00
|
|
|
}
|