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 "Category: "; foreach (Category::getCategories() as $short => $name) { - echo "$name"; + if (isset($_POST['category']) and $_POST['category'] == $short) { + echo "$name"; + + } else { + echo "$name"; + } } echo ""; - echo "Title: "; + echo "Title: "; echo "Description:"; echo ""; + . " cols=\"80\">${values[description]}
You must accept the terms of service.
Invalid category.
Category: "; foreach (Category::getCategories() as $short => $name) { - echo "$name"; + if (isset($_POST['category']) and $_POST['category'] == $short) { + echo "$name"; + + } else { + echo "$name"; + } } echo ""; - echo "
Title:
Description:
Email Address: " + echo "Email Address: " . ""; - echo "Confirm Email: " + echo "Confirm Email: " . ""; // TODO: Link to terms of service. -- cgit v1.2.3
Email Address: " . "
Confirm Email: " + echo "Confirm Email: " . ""; // TODO: Link to terms of service. -- cgit v1.2.3
Confirm Email: " . "