bludit/admin/controllers/new-post.php

40 lines
906 B
PHP

<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Functions
// ============================================================================
function addPost($args)
{
global $dbPosts;
global $Language;
// Page status, published or draft.
if( isset($args['publish']) ) {
$args['status'] = "published";
}
else {
$args['status'] = "draft";
}
// Add the page.
if( $dbPosts->add($args) )
{
Alert::set('Post added successfuly');
Redirect::page('admin', 'manage-posts');
}
else
{
Alert::set($Language->g('an-error-occurred-while-trying-to-create-the-post'));
}
}
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
addPost($_POST);
}