2000-07-13 13:30:44 +00:00
< ?
2000-05-18 19:52:00 +00:00
2001-02-17 12:59:24 +00:00
include_once " includes/common.inc " ;
2000-06-16 13:45:57 +00:00
function submit_enter () {
2001-01-21 19:41:11 +00:00
global $anonymous , $allowed_html , $theme , $user ;
2001-01-26 13:38:46 +00:00
2000-12-30 11:58:14 +00:00
// Guidlines:
2001-02-12 20:40:43 +00:00
$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 " ;
2000-06-20 07:33:17 +00:00
2000-12-30 11:58:14 +00:00
// Submission form:
2000-06-16 13:45:57 +00:00
$output .= " <FORM ACTION= \" submit.php \" METHOD= \" post \" > \n " ;
2000-05-18 19:52:00 +00:00
2001-02-17 12:59:24 +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
2000-06-16 13:45:57 +00:00
$output .= " </FORM> \n " ;
2001-01-26 13:38:46 +00:00
2000-06-16 13:45:57 +00:00
$theme -> header ();
2001-02-17 12:59:24 +00:00
$theme -> box ( t ( " New submission " ), $output );
2000-06-16 13:45:57 +00:00
$theme -> footer ();
2000-05-18 19:52:00 +00:00
}
2001-01-21 19:41:11 +00:00
function submit_preview ( $subject , $abstract , $article , $section ) {
global $allowed_html , $theme , $user ;
2000-06-05 15:59:06 +00:00
2000-11-02 09:23:07 +00:00
include " includes/story.inc " ;
2000-06-16 13:45:57 +00:00
$output .= " <FORM ACTION= \" submit.php \" METHOD= \" post \" > \n " ;
2001-02-17 12:59:24 +00:00
$output .= " <B> " . t ( " Your name " ) . " :</B><BR> \n " ;
$output .= format_username ( $user -> userid ) . " <P> " ;
2000-06-16 13:45:57 +00:00
2001-02-17 12:59:24 +00:00
$output .= " <B> " . t ( " Subject " ) . " :</B><BR> \n " ;
$output .= " <INPUT TYPE= \" text \" NAME= \" subject \" SIZE= \" 50 \" MAXLENGTH= \" 60 \" VALUE= \" " . check_textfield ( $subject ) . " \" ><BR><P> \n " ;
2000-06-16 13:45:57 +00:00
2001-02-17 12:59:24 +00:00
$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 " ;
2000-06-16 13:45:57 +00:00
2001-02-12 20:40:43 +00:00
$output .= " <B> " . t ( " Abstract " ) . " :</B><BR> \n " ;
2001-02-17 12:59:24 +00:00
$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 " ;
2000-06-16 13:45:57 +00:00
2001-02-17 12:59:24 +00:00
$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 )) {
2001-02-17 12:59:24 +00:00
$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 )) {
2001-02-17 12:59:24 +00:00
$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
}
2001-01-21 19:41:11 +00:00
else {
2001-02-17 12:59:24 +00:00
$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
}
2000-06-16 13:45:57 +00:00
$output .= " </FORM> \n " ;
2001-01-26 13:38:46 +00:00
2000-06-16 13:45:57 +00:00
$theme -> header ();
2001-01-21 19:41:11 +00:00
$theme -> article ( new Story ( $user -> userid , $subject , $abstract , $article , $section , time ()));
2001-02-12 20:40:43 +00:00
$theme -> box ( t ( " Submit a story " ), $output );
2000-06-16 13:45:57 +00:00
$theme -> footer ();
2000-05-18 19:52:00 +00:00
}
2001-01-21 19:41:11 +00:00
function submit_submit ( $subject , $abstract , $article , $section ) {
2000-07-12 07:15:09 +00:00
global $user , $theme ;
2000-05-18 19:52:00 +00:00
2000-12-30 11:58:14 +00:00
// Add log entry:
2001-01-07 19:21:28 +00:00
watchdog ( " story " , " story: added ' $subject ' " );
2001-01-26 13:38:46 +00:00
2000-12-30 11:58:14 +00:00
// Add submission to SQL table:
2001-01-21 19:41:11 +00:00
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
2000-12-30 11:58:14 +00:00
// Display confirmation message:
2001-01-26 13:38:46 +00:00
$theme -> header ();
2001-02-17 12:59:24 +00:00
$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 ) {
2001-02-17 12:59:24 +00:00
case t ( " Preview submission " ) :
2001-01-21 19:41:11 +00:00
submit_preview ( $subject , $abstract , $article , $section );
2000-05-18 19:52:00 +00:00
break ;
2001-02-17 12:59:24 +00:00
case t ( " Submit submission " ) :
2001-01-21 19:41:11 +00:00
submit_submit ( $subject , $abstract , $article , $section );
2000-05-18 19:52:00 +00:00
break ;
default :
2000-06-16 13:45:57 +00:00
submit_enter ();
2000-05-18 19:52:00 +00:00
break ;
}
2000-11-03 07:57:28 +00:00
?>