diff options
Diffstat (limited to 'submit.php')
-rw-r--r-- | submit.php | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/submit.php b/submit.php index dee10e316..f77c908d2 100644 --- a/submit.php +++ b/submit.php @@ -8,7 +8,7 @@ function submit_enter() { ### Guidlines: $output .= "<P>Got some news or some thoughts you would like to share? Fill out this form and they will automatically get whisked away to our submission queue where our moderators will frown at it, poke at it and hopefully post it. Every registered user is automatically a moderator and can vote whether or not your sumbission should be carried to the front page for discussion.</P>\n"; - $output .= "<P>Note that we do not revamp or extend your submission so it is totally up to you to make sure it is well-written: if you don't care enough to be clear and complete, your submission is likely to be moderated down by our army of moderators. Try to be complete, aim for clarity, organize and structure your text, and try to carry out your statements with examples. It is also encouraged to extend your submission with arguments that flow from your unique intellectual capability and experience: offer some insight or explanation as to why you think your submission is interesting. Make sure your submission has some meat on it!</P>\n"; + $output .= "<P>Note that we do not revamp or extend your submission so it is up to you to make sure your submission is well-written: if you don't care enough to be clear and complete, your submission is likely to be moderated down by our army of moderators. Try to be complete, aim for clarity, organize and structure your text, and try to carry out your statements with examples. It is also encouraged to extend your submission with arguments that flow from your unique intellectual capability and experience: offer some insight or explanation as to why you think your submission is interesting. Make sure your submission has some meat on it!</P>\n"; $output .= "<P>However, if you have bugs to report, complaints, personal questions or anything besides a public submission, we would prefer you to mail us instead, or your message is likely to get lost.</P><BR>\n"; ### Submission form: @@ -58,7 +58,7 @@ function submit_enter() { $theme->footer(); } -function submit_preview($name, $address, $subject, $abstract, $story, $category) { +function submit_preview($subject, $abstract, $story, $category) { global $user; include "functions.inc"; @@ -99,10 +99,28 @@ function submit_preview($name, $address, $subject, $abstract, $story, $category) $output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"story\">". stripslashes($story) ."</TEXTAREA><BR>\n"; $output .= " <SMALL><I>HTML is nice and dandy, but double check those URLs and HTML tags!</I></SMALL>\n"; $output .= "</P>\n"; - - $output .= "<P>\n"; - $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Submit submission\">\n"; - $output .= "</P>\n"; + + if (empty($subject)) { + $output .= "<P>\n"; + $output .= " <FONT COLOR=\"red\"><B>Warning:</B></FONT> you did not supply a <U>subject</U>.\n"; + $outout .= "</P>\n"; + $output .= "<P>\n"; + $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n"; + $output .= "</P>\n"; + } + else if (empty($abstract)) { + $output .= "<P>\n"; + $output .= " <FONT COLOR=\"red\"><B>Warning:</B></FONT> you did not supply an <U>abstract</U>.\n"; + $outout .= "</P>\n"; + $output .= "<P>\n"; + $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n"; + $output .= "</P>\n"; + } + else { + $output .= "<P>\n"; + $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\"> <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Submit submission\">\n"; + $output .= "</P>\n"; + } $output .= "</FORM>\n"; @@ -112,43 +130,33 @@ function submit_preview($name, $address, $subject, $abstract, $story, $category) $theme->footer(); } -function submit_submit($name, $address, $subject, $abstract, $article, $category) { +function submit_submit($subject, $abstract, $article, $category) { global $user; include "functions.inc"; include "theme.inc"; + ### Add submission to SQL table: + db_query("INSERT INTO stories (author, subject, abstract, article, category, timestamp) VALUES ('$user->id', '$subject', '$abstract', '$article', '$category', '". time() ."')"); + ### Display confirmation message: - $theme->header(); $theme->box("Thanks for your submission.", "Thanks for your submission. The submission moderators in our basement will frown at it, poke at it, and vote for it!"); $theme->footer(); - ### Add submission to queue: - if ($user) { - $uid = $user->id; - $name = $user->userid; - } - else { - $uid = -1; - $name = $anonymous; - } - - db_query("INSERT INTO submissions (uid, uname, subject, article, timestamp, category, abstract, score, votes) VALUES ('$uid', '$name', '$subject', '$article', '". time() ."', '$category', '$abstract', '0', '0')"); - ### Send e-mail notification (if enabled): if ($notify) { - $message = "New submission:\n\nsubject...: $subject\nauthor....: $name\ncategory..: $category\nabstract..:\n$abstract\n\narticle...:\n$article"; + $message = "New submission:\n\nsubject...: $subject\nauthor....: $user->userid <$user->email>\ncategory..: $category\nabstract..:\n$abstract\n\narticle...:\n$article"; mail($notify_email, "$notify_subject $subject", $message, "From: $notify_from\nX-Mailer: PHP/" . phpversion()); } } switch($op) { case "Preview submission": - submit_preview($name, $address, $subject, $abstract, $story, $category); + submit_preview($subject, $abstract, $story, $category); break; case "Submit submission": - submit_submit($name, $address, $subject, $abstract, $story, $category); + submit_submit($subject, $abstract, $story, $category); break; default: submit_enter(); |