function get($post_id = null, $action = null) { $users = new UsersData(); if (is_null($post_id)) { include_once '404.html'; } else { if ($users->checkPass() && !$users->authNeeded()) { $blogData = new BlogData(); if ($action == 'publish') { $blogData->publishPost($post_id); $blogData->orderBlog(); header('Location: /admin/blog/?updated=true'); } else { if ($action == 'unpublish') { $blogData->unpublishPost($post_id); $blogData->orderBlog(); header('Location: /admin/blog/?updated=true'); } else { if ($action == 'trash') { $blogData->trashPost($post_id); $blogData->orderBlog(); header('Location: /admin/blog/?updated=true'); } else { if ($post_id == 'new') { $post_id = uniqid(); } else { $postInfo = $blogData->getPostData($post_id); } include_once 'admin-pages/post.php'; } } } } else { include_once '401.html'; } } }