From 96d3efaa652876fc0a109969b856c65f3e459339 Mon Sep 17 00:00:00 2001 From: Diego Date: Sun, 26 Mar 2017 20:51:32 +0200 Subject: [PATCH] Categories implementation --- bl-kernel/admin/controllers/new-post.php | 13 ++- bl-kernel/admin/views/new-post.php | 10 ++ bl-kernel/boot/init.php | 2 + bl-kernel/dbcategories.class.php | 125 +++++++++++++---------- bl-kernel/dbposts.class.php | 38 +++---- bl-kernel/functions.php | 17 +++ 6 files changed, 123 insertions(+), 82 deletions(-) diff --git a/bl-kernel/admin/controllers/new-post.php b/bl-kernel/admin/controllers/new-post.php index 19463e3b..5979c0af 100644 --- a/bl-kernel/admin/controllers/new-post.php +++ b/bl-kernel/admin/controllers/new-post.php @@ -15,21 +15,24 @@ function addPost($args) // Add the page, if the $key is FALSE the creation of the post failure. $key = $dbPosts->add($args); - if($key) - { + if($key) { // Reindex tags, this function is in 70.posts.php reIndexTagsPosts(); - // Call the plugins after post created. + // Re index categories + reIndexCategoriesPosts(); + + // Call the plugins after post creation Theme::plugins('afterPostCreate'); // Alert for the user Alert::set($Language->g('Post added successfully')); Redirect::page('admin', 'manage-posts'); } - else - { + else { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the post.'); + Log::set(__METHOD__.LOG_SEP.'Cleaning database...'); + $dbPosts->delete($key); } return false; diff --git a/bl-kernel/admin/views/new-post.php b/bl-kernel/admin/views/new-post.php index 335e4774..fd986acd 100644 --- a/bl-kernel/admin/views/new-post.php +++ b/bl-kernel/admin/views/new-post.php @@ -51,6 +51,16 @@ echo '
'; echo '
  • '; echo '