function deletePost($key) { global $dbPosts; global $Language; if ($dbPosts->delete($key)) { // Reindex tags, this function is in 70.posts.php reIndexTagsPosts(); Alert::set($Language->g('The post has been deleted successfully')); Redirect::page('admin', 'manage-posts'); } else { Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the post.'); } }
function addPost($args) { global $dbPosts; global $Language; // Add the page. if ($dbPosts->add($args)) { // Reindex tags, this function is in 70.posts.php reIndexTagsPosts(); Alert::set($Language->g('Post added successfully')); Redirect::page('admin', 'manage-posts'); } else { Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the post.'); } return false; }
function addPost($args) { global $dbPosts; global $Language; // Add the page, if the $key is FALSE the creation of the post failure. $key = $dbPosts->add($args); if ($key) { // Reindex tags, this function is in 70.posts.php reIndexTagsPosts(); // Call the plugins after post created. Theme::plugins('afterPostCreate'); // Alert for the user Alert::set($Language->g('Post added successfully')); Redirect::page('admin', 'manage-posts'); } else { Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the post.'); } return false; }
} return $posts; } // ============================================================================ // Main // ============================================================================ // Search for changes on posts by the user. if ($Site->cliMode()) { if ($dbPosts->regenerateCli()) { reIndexTagsPosts(); } } // Execute the scheduler. if ($dbPosts->scheduler()) { // Reindex dbTags. reIndexTagsPosts(); } // Build specific post. if ($Url->whereAmI() === 'post' && $Url->notFound() === false) { $Post = buildPost($Url->slug()); // The post doesn't exist. if ($Post === false) { $Url->setNotFound(true); unset($Post); } elseif (!$Post->published()) { $Url->setNotFound(true); unset($Post); } else { $posts[0] = $Post; } } elseif ($Url->whereAmI() === 'tag' && $Url->notFound() === false) {