From 0c72d673a9056c753503e6b2a8d4fbf3aba75a95 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Wed, 25 May 2011 11:32:49 -0700 Subject: Moderation workflow is.. working --- htdocs/new-post.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'htdocs/new-post.php') diff --git a/htdocs/new-post.php b/htdocs/new-post.php index cef238e..3c2fe42 100644 --- a/htdocs/new-post.php +++ b/htdocs/new-post.php @@ -43,11 +43,16 @@ if (isset($_POST['category'])) { $error .= "

You must accept the terms of service.

"; } + $category = Category::getByShortname(addslashes($values['category'])); + if (!$category) { + $error .= "

Invalid category.

"; + } + if ($error == '') { $post = new Post(); $post->setEmail($values['email']); - $post->setCategory($values['category']); + $post->setCategory($category->getId()); $post->setName($values['title']); $post->setDescription($values['description']); @@ -75,26 +80,33 @@ require_once "src/footer.inc.php"; function render_form($error="") { + global $values; + if ($error != '') { - echo "
$error
"; + echo "
$error
"; } echo "
"; echo "

"; + echo "

"; echo "

"; echo "

"; + . " cols=\"80\">${values[description]}

"; - echo "

"; - echo "

"; // TODO: Link to terms of service. -- cgit v1.2.3