function post($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 == 'update') { $blogData->updateBlogPost($post_id, $_POST, isset($_POST['publish'])); $media = new MediaData(); $media->uploadFiles($post_id, true); } $blogData->orderBlog(); header('Location: /admin/blog/?updated=true'); } else { include_once '401.html'; } } }