summaryrefslogtreecommitdiff
path: root/submit.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2000-06-21 15:41:20 +0000
committerDries Buytaert <dries@buytaert.net>2000-06-21 15:41:20 +0000
commit0f5a60e1095857ae4e9a2c5ea1f3db68a9a57ef5 (patch)
tree6852ef1654c661715dcfcc2554b86851984e7923 /submit.php
parent8a7690af5723ec22fccd450097cc8fb0e8216649 (diff)
downloadbrdo-0f5a60e1095857ae4e9a2c5ea1f3db68a9a57ef5.tar.gz
brdo-0f5a60e1095857ae4e9a2c5ea1f3db68a9a57ef5.tar.bz2
IMPORANT - IMPORTANT - :)
========================= Wulp. I did a major upgrade by (a) breaking a lot of stuff and (b) by re-doing those things in a much better way. I redesigned the stories and submissions SQL tables, the way they work and the way they co- operate together. In addition, I changed the way parameters are passed to $theme->abstract() and $theme->article(). Instead of passing a sh!tload of parameters that only cluttered the code and required too much pre-processing on the engine-side, we now pass a singly object $story. $story has more variables then the paramaters we used to pass, so it allows for better theming (if you feel like it). I'm not finished yet but I decided to upload my changes so you can start patching and updating your themes: PLEASE update your themes ASAP! I don't plan making heavy changes like this again, so don't get intimiated. ;) You mainly have to update article() and abstract() as well as a minor update of footer(): article(), abstract(): ---------------------- - use the $story object - see my theme! - the morelink can now be themed. Currently you can use the function morelink_bytes() in function.inc to `render' the old morelink. The idea is to make a morelink_words() or morelink_lines() sooner or later because "188 bytes in body" is not half as clear as "52 words in body". Clearly, "52 words" is much more informative. ;-) footer(): --------- - in the article-part, you need to update the displayRelatedLinks(): instead of passing it $sid, you need to pass it $story (after you globaled $story). Everything should display correct on the following pages: - main page - article page (follow a `read more | xxx bytes in bdoy | x comments' link) - submission queue Check if they work with your theme: they should as they work fine for me (theme `Dries') ... If you got stuck, just look at my theme or ask for a hand on the list! Hopefully you can update your themes asap. Thanks in advance.
Diffstat (limited to 'submit.php')
-rw-r--r--submit.php54
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();