* */ require_once "src/base.inc.php"; require_once "src/header.inc.php"; const MAX_IMAGE_UPLOADS = 4; echo "
Start by choosing a category from the list below
"; // List Categories $cats = Category::getCategories(); echo "$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']); $post->setLocation($values['location']); // Price is optional if (isset($_POST['price'])) { $post->setPrice($_POST['price']); } if ($post->save()) { return true; } else { $error .= 'An internal error has occured.'; } } handle_post($error); return false; } function handle_images() { $post = $_SESSION['newpost']; // Display image form echo "You may upload up to four images with your post." . " Valid image types are JPEG and PNG.
"; form_start('source'); for ($i = 1; $i <= MAX_IMAGE_UPLOADS; $i++) { echo ""; } form_end(); } function finish_images() { $post = $_SESSION['newpost']; if (isset($_FILES['images'])) { foreach ($_FILES["images"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $post->addImage($_FILES['images']['tmp_name'][$key]); } } } return true; } function handle_source($error='') { form_start('finish'); if ($error != '') { echo "Where did you hear about this site?
"; echo ""; echo "If you selecte other, please explain:"; echo "
"; form_end(); } function finish_source() { $error = 'This question is required.
'; $post = $_SESSION['newpost']; if (isset($_POST['source']) and is_numeric($_POST['source'])) { if ($_POST['source'] == 0) { if (isset($_POST['explain']) and trim($_POST['explain']) != '') { $post->otherSource($_POST['explain']); $post->save(); return true; } else { $error = 'Explaination is a required field.
'; } } else { $source = Source::getById($_POST['source']); if ($source) { $post->setSource($_POST['source']); $post->save(); return true; } } } handle_source($error); return false; } function handle_finish() { $post = $_SESSION['newpost']; // Send validation email. $post->sendValidation(); // Display confirmation message echo "Your posting is almost complete. You must verify your email address by visiting the link we have emailed you, then your posting will be reviewed by our moderation team.
"; } function form_start($stage) { echo ""; } require_once "src/footer.inc.php"; function render_form($error="") { $category = $_SESSION['newpost']->getCategory(); $title = isset($_POST['title']) ? $_POST['title'] : ''; $price = isset($_POST['price']) ? $_POST['price'] : ''; $location = isset($_POST['location']) ? $_POST['location'] : ''; $description = isset($_POST['description']) ? $_POST['description'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $email2 = isset($_POST['email2']) ? $_POST['email2'] : ''; if ($error != '') { echo ""; if ($category->getOption('price')) { echo " "; } echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
" . "Your email address will only be visible to our moderators.
"; } ?>