2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
2006-06-16 23:53:56 +00:00
|
|
|
/**
|
|
|
|
* This file allows you to create a new thread in a forum
|
|
|
|
* At first it displays an input box and when you submit
|
|
|
|
* it will apply the changes by calling methods on the forum
|
|
|
|
**/
|
|
|
|
|
|
|
|
require_once('../inc/email.inc');
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/forum.inc');
|
2006-06-16 23:53:56 +00:00
|
|
|
require_once('../inc/forum_std.inc');
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2004-12-27 03:42:11 +00:00
|
|
|
db_init();
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
$logged_in_user = re_get_logged_in_user(true);
|
2004-09-04 23:37:49 +00:00
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
$forumid = get_int("id");
|
2006-06-16 23:53:56 +00:00
|
|
|
$forum = new Forum($forumid);
|
|
|
|
|
|
|
|
if ($logged_in_user->getTotalCredit()<$forum->getPostMinTotalCredit || $logged_in_user->getExpavgCredit()<$forum->getPostMinExpavgCredit()){
|
2005-04-20 21:11:20 +00:00
|
|
|
//If user haven't got enough credit (according to forum regulations)
|
|
|
|
//We do not tell the (ab)user how much this is - no need to make it easy for them to break the system.
|
2006-06-16 23:53:56 +00:00
|
|
|
error_page(sprintf(tr(FORUM_ERR_EXPAVG),$forum->getTitle()));
|
2005-04-20 21:11:20 +00:00
|
|
|
}
|
2006-06-16 23:53:56 +00:00
|
|
|
if (time()-$logged_in_user->getLastPostTimestamp()<$forum->getPostMinInterval()){
|
2005-04-20 21:11:20 +00:00
|
|
|
//If the user is posting faster than forum regulations allow
|
|
|
|
//Tell the user to wait a while before creating any more posts
|
2005-09-27 20:38:44 +00:00
|
|
|
error_page(tr(FORUM_ERR_INTERVAL));
|
2005-04-20 21:11:20 +00:00
|
|
|
}
|
2005-02-13 21:33:02 +00:00
|
|
|
$title = post_str("title", true);
|
|
|
|
$content = post_str("content", true);
|
2006-06-16 23:53:56 +00:00
|
|
|
|
|
|
|
if ($content && $title){
|
|
|
|
if (post_str('add_signature',true)=="add_it"){
|
|
|
|
$add_signature=true; // set a flag and concatenate later
|
|
|
|
} else {
|
2005-02-13 21:33:02 +00:00
|
|
|
$add_signature=false;
|
2003-11-28 22:35:01 +00:00
|
|
|
}
|
2006-06-16 23:53:56 +00:00
|
|
|
$thread = $forum->createThread($title, $content, $logged_in_user, $add_signature);
|
|
|
|
header('Location: forum_thread.php?id=' . $thread->getID());
|
2003-07-24 22:57:41 +00:00
|
|
|
}
|
2003-08-01 20:30:25 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
page_head('Forum');
|
2003-08-01 20:30:25 +00:00
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
show_forum_title($forum, NULL, $category->is_helpdesk);
|
2003-08-01 20:30:25 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
echo "<form action=\"forum_post.php?id=".$forum->getID()."\" method=POST>\n";
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-06-07 03:34:07 +00:00
|
|
|
start_table();
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
row1(tr(FORUM_SUBMIT_NEW)); //New thread
|
|
|
|
$submit_help = "";
|
|
|
|
$body_help = "";
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2005-09-27 20:38:44 +00:00
|
|
|
//Title
|
2006-06-16 23:53:56 +00:00
|
|
|
row2(tr(FORUM_SUBMIT_NEW_TITLE).$submit_help, "<input type=text name=title size=62>");
|
2005-09-27 20:38:44 +00:00
|
|
|
//Message
|
|
|
|
row2(tr(FORUM_MESSAGE).html_info().post_warning().$body_help, "<textarea name=content rows=12 cols=54></textarea>");
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($logged_in_user->hasSignatureByDefault()) {
|
2005-02-13 21:33:02 +00:00
|
|
|
$enable_signature="checked=\"true\"";
|
|
|
|
} else {
|
|
|
|
$enable_signature="";
|
|
|
|
}
|
2005-09-27 20:38:44 +00:00
|
|
|
|
|
|
|
row2("", "<input name=add_signature value=add_it ".$enable_signature." type=checkbox>".tr(FORUM_ADD_MY_SIG));
|
2003-12-10 00:54:17 +00:00
|
|
|
row2("", "<input type=submit value=\"OK\">");
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
// STUB: Insert java code to check if user remembered to enter title and a message
|
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
end_forum_table();
|
|
|
|
|
|
|
|
echo "</form>\n";
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-08-15 00:58:48 +00:00
|
|
|
page_tail();
|
2003-11-28 22:35:01 +00:00
|
|
|
?>
|