From b2a7cfb9b152dcad1333b92dde76af3a164af8f6 Mon Sep 17 00:00:00 2001
From: jesse
Date: Fri, 27 May 2011 11:57:02 -0700
Subject: Got image posting finished.
---
htdocs/new-post.php | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
(limited to 'htdocs/new-post.php')
diff --git a/htdocs/new-post.php b/htdocs/new-post.php
index b4dd6ad..7112a8c 100644
--- a/htdocs/new-post.php
+++ b/htdocs/new-post.php
@@ -138,7 +138,8 @@ function finish_post() {
);
$error = '';
- $values = array();
+ $values = array('title' => '', 'description' => '',
+ 'email' => '', 'email2' => '');
foreach ($required as $field => $desc) {
if (!isset($_POST[$field]) or trim($_POST[$field]) == '') {
$error .= "$desc is a required field.
";
@@ -188,9 +189,11 @@ function handle_images() {
function finish_images() {
$post = $_SESSION['newpost'];
- if (isset($_FILES['images']) and is_array($_FILES['images'])) {
- foreach ($_FILES['images'] as $file) {
- $post->addImage($file['tmp_name']);
+ if (isset($_FILES['images'])) {
+ foreach ($_FILES["images"]["error"] as $key => $error) {
+ if ($error == UPLOAD_ERR_OK) {
+ $post->addImage($_FILES['images']['tmp_name'][$key]);
+ }
}
}
@@ -223,21 +226,25 @@ require_once "src/footer.inc.php";
function render_form($error="") {
- global $values;
+
+ $title = isset($_POST['title']) ? $_POST['title'] : '';
+ $description = isset($_POST['description']) ? $_POST['description'] : '';
+ $email = isset($_POST['email']) ? $_POST['email'] : '';
+ $email2 = isset($_POST['email2']) ? $_POST['email2'] : '';
if ($error != '') {
echo "$error
";
}
- echo "";
+ echo "";
echo "";
echo "";
+ . " cols=\"80\">$description
";
- echo "