* */ require_once "src/base.inc.php"; require_once "src/header.inc.php"; echo "
Start by choosing a category from the list below
"; // List Categories foreach (Category::getCategories() as $short => $name) { echo ""; } } function finish_category() { $post = $_SESSION['newpost']; if (isset($_GET['category'])) { $category = Category::getByShortname(addslashes($_GET['category'])); if ($category) { $post->setCategory($category->getId()); return true; } } handle_category(); return false; } function handle_tos() { // Display ToS // TODO: Display ToS Here form_start('post'); echo ""; form_end(); } function finish_tos() { if (isset($_POST['tos']) and $_POST['tos'] == 1) { return true; } else { header('Location: ' . $GLOBALS['CONFIG']['urlroot']); exit; } } function handle_post($error='') { // Display Form form_start('images'); render_form($error); form_end(); } function finish_post() { $post = $_SESSION['newpost']; $required = array( 'title' => 'Title', 'description' => 'Description', 'email' => 'Email Address', 'email2' => 'Confirm Email Address', ); $error = ''; $values = array(); foreach ($required as $field => $desc) { if (!isset($_POST[$field]) or trim($_POST[$field]) == '') { $error .= "$desc is a required field.
"; } else { $values[$field] = trim($_POST[$field]); } } if ($values['email'] != $values['email2']) { $error .= "Email addresses must match.
"; } if ($error == '') { $post->setEmail($values['email']); $post->setName($values['title']); $post->setDescription($values['description']); return true; } handle_post($error); return false; } function handle_images() { $post = $_SESSION['newpost']; // Save Post if (!$post->save()) { $error .= "An internal error has occured."; } // Display image form } function finish_images() { } function handle_finish() { $post = $_SESSION['newpost']; // Send validation email. $post->sendValidation(); // Display confirmation message // TODO: Revise wording of confirmation message. echo "Your posting is awaiting email verification
"; } function form_start($stage) { echo ""; } require_once "src/footer.inc.php"; function render_form($error="") { global $values; if ($error != '') { echo ""; echo "
"; } ?>