drupal/submit.php

157 lines
5.5 KiB
PHP
Raw Normal View History

<?
2000-05-18 19:52:00 +00:00
function submit_enter() {
global $anonymous, $categories, $allowed_html, $theme, $user;
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
### Guidlines:
$output .= droplet_get("submit_information");
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 .= "<P>\n <B>Your name:</B><BR>\n";
$output .= format_username($user->userid);
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P><B>Category:</B><BR>\n";
$output .= " <SELECT NAME=\"category\">\n";
for ($i = 0; $i < sizeof($categories); $i++) {
$output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Abstract:</B><BR>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Extended story:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
2000-05-18 19:52:00 +00:00
$output .= "<P>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$output .= " You must preview at least once before you can submit:<BR>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Preview submission\">\n";
$output .= "</P>\n";
2000-05-18 19:52:00 +00:00
$output .= "</FORM>\n";
$theme->header();
$theme->box("Submit a story", $output);
$theme->footer();
2000-05-18 19:52:00 +00:00
}
function submit_preview($subject, $abstract, $article, $category) {
global $categories, $allowed_html, $theme, $user;
include "includes/story.inc";
$output .= "<FORM ACTION=\"submit.php\" METHOD=\"post\">\n";
$output .= "<P>\n";
$output .= " <B>Your name:</B><BR>\n";
$output .= format_username($user->userid);
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"subject\" SIZE=\"50\" MAXLENGTH=\"60\" VALUE=\"". check_output(check_field($subject)) ."\"><BR>\n";
$output .= " <SMALL><I>Bad subjects are 'Check this out!' or 'An article'. Be descriptive, clear and simple!</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P><B>Category:</B><BR>\n";
$output .= " <SELECT NAME=\"category\">\n";
for ($i = 0; $i < sizeof($categories); $i++) {
$output .= " <OPTION VALUE=\"$categories[$i]\" ";
if ($category == $categories[$i]) $output .= "SELECTED";
$output .= ">$categories[$i]</OPTION>\n";
}
$output .= "</SELECT>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<B>Abstract:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"abstract\">". check_output($abstract) ."</TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <B>Extended story:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"article\">". check_output($article) ."</TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</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 .= "<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\">\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"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 .= "</P>\n";
}
2000-05-18 19:52:00 +00:00
$output .= "</FORM>\n";
$theme->header();
$theme->article(new Story($user->userid, $subject, $abstract, $article, $category, time()));
$theme->box("Submit a story", $output);
$theme->footer();
2000-05-18 19:52:00 +00:00
}
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
function submit_submit($subject, $abstract, $article, $category) {
global $user, $theme;
2000-05-18 19:52:00 +00:00
### Add log entry:
watchdog("story", "added new story with subject `$subject'");
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
### Add submission to SQL table:
db_query("INSERT INTO stories (author, subject, abstract, article, category, timestamp) VALUES ('$user->id', '". check_input($subject) ."', '". check_input($abstract) ."', '". check_input($article) ."', '". check_input($category) ."', '". time() ."')");
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
2000-05-18 19:52:00 +00:00
### Display confirmation message:
$theme->header();
$theme->box("Thank you for your submission.", droplet_get("submit_confirmation"));
2000-05-18 19:52:00 +00:00
$theme->footer();
}
2000-10-10 10:51:00 +00:00
include "includes/theme.inc";
2000-05-18 19:52:00 +00:00
switch($op) {
case "Preview submission":
submit_preview($subject, $abstract, $article, $category);
2000-05-18 19:52:00 +00:00
break;
case "Submit submission":
submit_submit($subject, $abstract, $article, $category);
2000-05-18 19:52:00 +00:00
break;
default:
submit_enter();
2000-05-18 19:52:00 +00:00
break;
}
?>