drupal/submit.php

117 lines
6.0 KiB
PHP
Raw Normal View History

<?
2000-05-18 19:52:00 +00:00
include_once "includes/common.inc";
function submit_enter() {
global $anonymous, $allowed_html, $theme, $user;
2001-01-26 13:38:46 +00:00
// Guidlines:
$output .= "<P>". t("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>". t("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>". t("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>\n";
Here we go again with a rather large commit: fixed a lot of annoying bugs and boxed whatever there was left to be boxed. * user.class.php: renamed $user->update() to $user->rehash(). * user.class.php: fixed a typical quote-bug in $user->rehash(). * functions.inc: fixed bug in displayOldHeadlines(). * functions.inc: improved several functions. * account.php: fixed major bug in showUser(). * account.php: added some extra words to the human-readable password-generator(tm). * account.php: boxed ALL functions! Fieuw! * submit.php: add some general information and guidlines on how to post submissions. * config.inc: re-thought the categories to be more generic. * submission.php: minor changes * search.pph: fixed minor bug with the author's names. Woops. I have an exam within 4 hours: back to my books. ;-) -------------------------------------------------------------------- * Anyone could check sumbit.php, sumbission.php and faq.php for typoes? * Anyone could adjust calendar.class.php to fit IE? *huh*huh* * Don't be scared to hack along (see below)! I'll be working on the submissions and comments. -------------------------------------------------------------------- Status of drop v0.10: (make the system erational' and release it.) - submissions: submission queue (75% complete) submission moderation (75% complete) - comments: comment moderation ( 0% complete) comment administration ( 0% complete) fixup timestamp mess ( 0% complete) - user system: mail password ( 0% complete) user administation (50% complete) patch admin.php ( 0% complete) account confirmation ( 0% complete) e-mail confimation upon modification of e-mail address ( 0% complete) - proper handling of forms: text2html, html2text html2txt, txt2html (10% complete) bad-word filter (80% complete) automatic link detection ( 0% complete) allowed HTML-tag checker ( 0% complete) - FAQ: cleanup, disclaimer (50% complete) - theme: box everything (100% complete)
2000-06-20 07:33:17 +00:00
// Submission form:
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
2000-05-18 19:52:00 +00:00
$output .= "<B>". t("Your name") .":</B><BR>\n";
$output .= format_username($user->userid) ."<P>\n";
$output .= "<B>". t("Subject") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\"><P>\n";
$output .= "<B>". t("Section") .":</B><BR>\n";
foreach ($sections = section_get() as $value) $options .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
$output .= "<SELECT NAME=\"section\">$options</SELECT><P>\n";
$output .= "<B>". t("Abstract") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
$output .= "<B>". t("Extended story") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\"></TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
$output .= "<SMALL><I>". t("You must preview at least once before you can submit") .":</I></SMALL><BR>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview submission") ."\"><P>\n";
2001-01-26 13:38:46 +00:00
$output .= "</FORM>\n";
2001-01-26 13:38:46 +00:00
$theme->header();
$theme->box(t("New submission"), $output);
$theme->footer();
2000-05-18 19:52:00 +00:00
}
function submit_preview($subject, $abstract, $article, $section) {
global $allowed_html, $theme, $user;
include "includes/story.inc";
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
$output .= "<B>". t("Your name") .":</B><BR>\n";
$output .= format_username($user->userid) ."<P>";
$output .= "<B>". t("Subject") .":</B><BR>\n";
$output .= "<INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"". check_textfield($subject) ."\"><BR><P>\n";
$output .= "<B>". t("Section") .":</B><BR>\n";
foreach ($sections = section_get() as $value) $options .= " <OPTION VALUE=\"$value\"". ($section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
$output .= "<SELECT NAME=\"section\">$options</SELECT><P>\n";
$output .= "<B>". t("Abstract") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\">". check_textarea($abstract) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
$output .= "<B>". t("Extended story") .":</B><BR>\n";
$output .= "<TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\">". check_textarea($article) ."</TEXTAREA><BR>\n";
$output .= "<SMALL><I>". t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html) .".</I></SMALL><P>\n";
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.
2000-06-21 15:41:20 +00:00
if (empty($subject)) {
$output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview submission") ."\">\n";
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.
2000-06-21 15:41:20 +00:00
}
else if (empty($abstract)) {
$output .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview submission") ."\">\n";
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.
2000-06-21 15:41:20 +00:00
}
else {
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview submission") ."\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Submit submission") ."\">\n";
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.
2000-06-21 15:41:20 +00:00
}
$output .= "</FORM>\n";
2001-01-26 13:38:46 +00:00
$theme->header();
$theme->article(new Story($user->userid, $subject, $abstract, $article, $section, time()));
$theme->box(t("Submit a story"), $output);
$theme->footer();
2000-05-18 19:52:00 +00:00
}
function submit_submit($subject, $abstract, $article, $section) {
global $user, $theme;
2000-05-18 19:52:00 +00:00
// Add log entry:
watchdog("story", "story: added '$subject'");
2001-01-26 13:38:46 +00:00
// Add submission to SQL table:
db_query("INSERT INTO stories (author, subject, abstract, article, section, timestamp) VALUES ('$user->id', '". check_input($subject) ."', '". check_input($abstract) ."', '". check_input($article) ."', '". check_input($section) ."', '". time() ."')");
2001-01-26 13:38:46 +00:00
// Display confirmation message:
2001-01-26 13:38:46 +00:00
$theme->header();
$theme->box(t("Submission completed"), t("Thank you for your submission. Your submission has been whisked away to our submission queue where our registered users will frown at it, poke at it and hopefully carry it to the front page for discussion."));
2000-05-18 19:52:00 +00:00
$theme->footer();
}
switch($op) {
case t("Preview submission"):
submit_preview($subject, $abstract, $article, $section);
2000-05-18 19:52:00 +00:00
break;
case t("Submit submission"):
submit_submit($subject, $abstract, $article, $section);
2000-05-18 19:52:00 +00:00
break;
default:
submit_enter();
2000-05-18 19:52:00 +00:00
break;
}
?>