2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/forum.inc');
|
|
|
|
require_once('../inc/util.inc');
|
|
|
|
require_once('../inc/subscribe.inc');
|
2005-09-27 20:38:44 +00:00
|
|
|
require_once('../inc/translation.inc');
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2004-12-27 03:42:11 +00:00
|
|
|
db_init();
|
|
|
|
|
2004-09-04 23:37:49 +00:00
|
|
|
$logged_in_user = get_logged_in_user(true);
|
|
|
|
$logged_in_user = getForumPreferences($logged_in_user);
|
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
$forumid = get_int("id");
|
|
|
|
$forum = getForum($forumid);
|
|
|
|
if (!$forum) {
|
2005-09-27 20:38:44 +00:00
|
|
|
error_page(tr(FORUM_ERR_NOT_FOUND));
|
2005-02-13 21:33:02 +00:00
|
|
|
}
|
2005-04-20 21:11:20 +00:00
|
|
|
if ($logged_in_user->total_credit<$forum->post_min_total_credit || $logged_in_user->expavg_credit<$forum->post_min_expavg_credit){
|
|
|
|
//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.
|
2005-09-27 20:38:44 +00:00
|
|
|
error_page(sprintf(tr(FORUM_ERR_EXPAVG),$forum->title));
|
2005-04-20 21:11:20 +00:00
|
|
|
}
|
|
|
|
if (time()-$logged_in_user->last_post<$forum->post_min_interval){
|
|
|
|
//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);
|
|
|
|
if ($title && $content) {
|
2004-04-04 07:37:23 +00:00
|
|
|
if ($_POST['add_signature']=="add_it") {
|
2005-02-13 21:33:02 +00:00
|
|
|
$add_signature=true;
|
2004-10-10 03:04:29 +00:00
|
|
|
} else {
|
2005-02-13 21:33:02 +00:00
|
|
|
$add_signature=false;
|
2003-11-28 22:35:01 +00:00
|
|
|
}
|
2005-02-13 21:33:02 +00:00
|
|
|
$threadID = createThread(
|
|
|
|
$forumid, $logged_in_user->id, $title, $content, $add_signature
|
|
|
|
);
|
2004-05-30 21:47:11 +00:00
|
|
|
if (!$threadID) {
|
2005-02-16 00:24:53 +00:00
|
|
|
error_page("Can't create thread (title may be missing)");
|
2004-05-30 21:47:11 +00:00
|
|
|
}
|
2003-08-22 19:09:32 +00:00
|
|
|
|
2004-10-26 22:27:50 +00:00
|
|
|
$thread->id=$threadID;
|
|
|
|
setThreadLastVisited($logged_in_user,$thread);
|
2005-02-13 21:33:02 +00:00
|
|
|
header('Location: forum_thread.php?id=' . $threadID);
|
2003-07-24 22:57:41 +00:00
|
|
|
}
|
2003-08-01 20:30:25 +00:00
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
$category = getCategory($forum->category);
|
2003-08-13 22:08:12 +00:00
|
|
|
|
|
|
|
if ($category->is_helpdesk) {
|
2005-02-13 21:33:02 +00:00
|
|
|
page_head('Help Desk');
|
2003-08-01 20:30:25 +00:00
|
|
|
} else {
|
2005-02-13 21:33:02 +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
|
|
|
|
2003-08-13 22:08:12 +00:00
|
|
|
if ($category->is_helpdesk) {
|
2005-09-27 20:38:44 +00:00
|
|
|
//Tell people to first search for answers THEN ask the question...
|
|
|
|
echo "<p>".sprintf(tr(FORUM_QA_POST_MESSAGE), "<b>".tr(LINKS_QA)."</b>");
|
|
|
|
echo "<ul><li>".sprintf(tr(FORUM_QA_POST_MESSAGE2), "<b>".tr(FORUM_QA_GOT_PROBLEM_TOO)."</b>", "<b>".tr(FORUM_QA_QUESTION_ANSWERED)."</b>");
|
|
|
|
echo "<li>".tr(FORUM_QA_POST_MESSAGE3);
|
|
|
|
echo "</ul>".tr(FORUM_QA_POST_MESSAGE4);
|
2003-08-13 22:08:12 +00:00
|
|
|
}
|
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
echo "<form action=forum_post.php?id=$forumid 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
|
|
|
|
|
|
|
if ($category->is_helpdesk) {
|
2005-09-27 20:38:44 +00:00
|
|
|
row1(tr(FORUM_QA_SUBMIT_NEW)); //New question
|
|
|
|
$submit_help = "<br>".tr(FORUM_QA_SUBMIT_NEW_HELP);
|
|
|
|
$body_help ="<br>".tr(FORUM_QA_SUBMIT_NEW_BODY_HELP);
|
|
|
|
} else {
|
|
|
|
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
|
|
|
|
row2(tr(FORUM_SUBMIT_NEW_TITLE).html_info().$submit_help, "<input type=text name=title size=62>");
|
|
|
|
//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
|
|
|
|
2005-02-13 21:33:02 +00:00
|
|
|
if ($logged_in_user->no_signature_by_default==0) {
|
|
|
|
$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
|
|
|
|
|
|
|
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
|
|
|
?>
|