From 24547ccec6526fcef3cccb34bc35fb81f31236b3 Mon Sep 17 00:00:00 2001 From: Nicolas BERNSTEIN Date: Sun, 12 Feb 2012 19:50:55 +0100 Subject: A lot of changes : blogging system essentially. --- lib/blog/publish.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/blog/publish.php (limited to 'lib/blog/publish.php') diff --git a/lib/blog/publish.php b/lib/blog/publish.php new file mode 100644 index 0000000..1674911 --- /dev/null +++ b/lib/blog/publish.php @@ -0,0 +1,13 @@ += 3, 'blog'); +$postid = intval($args[2]); + +$post = mysql_fetch_assoc(sql("SELECT owner, draft FROM blog_posts WHERE id = $postid")); +assert_error($post && $post['owner'] == $user['id'], + "This note does not exist, or you are not allowed to delete it."); +assert_error($post['draft'] == 1, "This post is already published."); + +token_validate("Are you sure this post is ready to be published ?", "blog"); +sql("UPDATE blog_posts SET draft = 0, date = NOW() WHERE id = $postid"); +header("Location: blog"); -- cgit v1.2.3