2015-05-05 03:00:01 +02:00
|
|
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
|
|
|
|
2015-08-03 02:49:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Check role
|
|
|
|
// ============================================================================
|
|
|
|
|
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-08-03 02:49:12 +02:00
|
|
|
|
2016-01-08 00:43:09 +01:00
|
|
|
// Add the page, if the $key is FALSE the creation of the post failure.
|
|
|
|
$key = $dbPosts->add($args);
|
|
|
|
|
|
|
|
if($key)
|
2015-05-05 03:00:01 +02:00
|
|
|
{
|
2015-08-31 03:18:06 +02:00
|
|
|
// Reindex tags, this function is in 70.posts.php
|
|
|
|
reIndexTagsPosts();
|
2015-08-29 07:02:09 +02:00
|
|
|
|
2016-01-08 00:43:09 +01:00
|
|
|
// Call the plugins after post created.
|
|
|
|
Theme::plugins('afterPostCreate');
|
|
|
|
|
|
|
|
// Alert for the user
|
2015-07-22 05:15:02 +02:00
|
|
|
Alert::set($Language->g('Post added successfully'));
|
2015-05-05 03:00:01 +02:00
|
|
|
Redirect::page('admin', 'manage-posts');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-22 05:15:02 +02:00
|
|
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the post.');
|
2015-05-05 03:00:01 +02:00
|
|
|
}
|
2015-08-31 03:18:06 +02:00
|
|
|
|
|
|
|
return false;
|
2015-05-05 03:00:01 +02:00
|
|
|
}
|
|
|
|
|
2015-08-03 02:49:12 +02:00
|
|
|
// ============================================================================
|
|
|
|
// Main before POST
|
|
|
|
// ============================================================================
|
|
|
|
|
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
|
|
|
}
|
2015-08-03 02:49:12 +02:00
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Main after POST
|
2015-11-28 15:47:03 +01:00
|
|
|
// ============================================================================
|