2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
New post page
|
|
|
|
|
|
|
|
This is the page that's loaded if someone wants to make a new topic.
|
|
|
|
|
|
|
|
Information to be expected in $_GET:
|
|
|
|
forumid: The ID of the forum that it's being posted in
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$ForumID = $_GET['forumid'];
|
2013-04-19 08:00:55 +00:00
|
|
|
if (!is_number($ForumID)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
$Forum = get_forum_info($ForumID);
|
2013-04-19 08:00:55 +00:00
|
|
|
if ($Forum === false) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-19 08:00:55 +00:00
|
|
|
if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
|
|
|
|
error(403);
|
|
|
|
}
|
2013-04-30 18:18:07 +00:00
|
|
|
View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode');
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<div class="thin">
|
|
|
|
<h2><a href="forums.php">Forums</a> > <a href="forums.php?action=viewforum&forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> > <span id="newthreadtitle">New Topic</span></h2>
|
|
|
|
<div class="hidden" id="newthreadpreview">
|
|
|
|
<div class="linkbox">
|
|
|
|
<div class="center">
|
2013-03-02 08:00:34 +00:00
|
|
|
<a href="#" onclick="return false;" class="brackets">Report thread</a>
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="#" onclick="return false;" class="brackets"><?=!empty($HeavyInfo['AutoSubscribe']) ? 'Unsubscribe' : 'Subscribe'?></a>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2013-04-19 08:00:55 +00:00
|
|
|
<? if (check_perms('forums_polls_create')) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="box thin clear hidden" id="pollpreview">
|
2013-03-02 08:00:34 +00:00
|
|
|
<div class="head colhead_dark"><strong>Poll</strong> <a href="#" onclick="$('#threadpoll').toggle();return false;" class="brackets">View</a></div>
|
2011-03-28 14:21:28 +00:00
|
|
|
<div class="pad" id="threadpoll">
|
|
|
|
<p><strong id="pollquestion"></strong></p>
|
|
|
|
<div id="pollanswers"></div>
|
2013-03-02 08:00:34 +00:00
|
|
|
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — show the results!</label><br /><br />
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="button" style="float: left;" value="Vote" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2013-04-19 08:00:55 +00:00
|
|
|
<? } ?>
|
|
|
|
<table class="forum_post box vertical_margin" style="text-align: left;">
|
2012-10-29 08:00:20 +00:00
|
|
|
<colgroup>
|
2013-04-19 08:00:55 +00:00
|
|
|
<? if (empty($HeavyInfo['DisableAvatars'])) { ?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<col class="col_avatar" />
|
2013-04-19 08:00:55 +00:00
|
|
|
<? } ?>
|
2012-10-29 08:00:20 +00:00
|
|
|
<col class="col_post_body" />
|
|
|
|
</colgroup>
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr class="colhead_dark">
|
2013-04-19 08:00:55 +00:00
|
|
|
<td colspan="<?=empty($HeavyInfo['DisableAvatars']) ? 2 : 1 ?>">
|
|
|
|
<span style="float: left;"><a href="#newthreadpreview">#XXXXXX</a>
|
2012-10-11 08:00:15 +00:00
|
|
|
by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
|
2011-03-28 14:21:28 +00:00
|
|
|
Just now
|
|
|
|
</span>
|
2013-03-02 08:00:34 +00:00
|
|
|
<span id="barpreview" style="float: right;">
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="#newthreadpreview" class="brackets">Report</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
<a href="#">↑</a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="avatar" valign="top">
|
2013-04-19 08:00:55 +00:00
|
|
|
<? if (!empty($LoggedUser['Avatar'])) { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<img src="<?=$LoggedUser['Avatar']?>" width="150" alt="<?=$LoggedUser['Username']?>'s avatar" />
|
2013-04-19 08:00:55 +00:00
|
|
|
<? } else { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="150" alt="Default avatar" />
|
2013-04-19 08:00:55 +00:00
|
|
|
<? } ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
<td class="body" valign="top">
|
2013-03-02 08:00:34 +00:00
|
|
|
<div id="contentpreview" style="text-align: left;"></div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="box pad">
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="create_form" name="forum_thread" action="" id="newthreadform" onsubmit="newthreadform.submit_button.disabled=true;" method="post">
|
2011-03-28 14:21:28 +00:00
|
|
|
<input type="hidden" name="action" value="new" />
|
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
|
|
|
<input type="hidden" name="forum" value="<?=$ForumID?>" />
|
2012-09-01 08:00:24 +00:00
|
|
|
<table id="newthreadtext" class="layout">
|
2011-03-28 14:21:28 +00:00
|
|
|
<tr>
|
2013-04-19 08:00:55 +00:00
|
|
|
<td class="label">Title:</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td><input id="title" type="text" name="title" style="width: 98%;" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2012-11-06 08:00:20 +00:00
|
|
|
<td class="label">Body:</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td><textarea id="posttext" style="width: 98%;" onkeyup="resize('posttext');" name="body" cols="90" rows="8"></textarea></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2013-03-02 08:00:34 +00:00
|
|
|
<input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> onchange="$('#subscribeboxpreview').raw().checked=this.checked;" />
|
2011-03-28 14:21:28 +00:00
|
|
|
<label for="subscribebox">Subscribe to topic</label>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-05-03 08:00:25 +00:00
|
|
|
<?
|
|
|
|
|
2012-11-08 08:00:19 +00:00
|
|
|
if (check_perms('forums_polls_create')) {
|
2012-05-03 08:00:25 +00:00
|
|
|
?>
|
2013-01-16 08:00:31 +00:00
|
|
|
<script type="text/javascript">//<![CDATA[
|
2011-03-28 14:21:28 +00:00
|
|
|
var AnswerCount = 1;
|
|
|
|
|
|
|
|
function AddAnswerField() {
|
2013-04-19 08:00:55 +00:00
|
|
|
if (AnswerCount >= 25) {
|
|
|
|
return;
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
var AnswerField = document.createElement("input");
|
|
|
|
AnswerField.type = "text";
|
|
|
|
AnswerField.id = "answer_"+AnswerCount;
|
|
|
|
AnswerField.name = "answers[]";
|
|
|
|
AnswerField.style.width = "90%";
|
2013-02-18 08:00:22 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
var x = $('#answer_block').raw();
|
|
|
|
x.appendChild(document.createElement("br"));
|
|
|
|
x.appendChild(AnswerField);
|
|
|
|
AnswerCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
function RemoveAnswerField() {
|
2013-04-19 08:00:55 +00:00
|
|
|
if (AnswerCount == 1) {
|
|
|
|
return;
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
var x = $('#answer_block').raw();
|
2013-04-19 08:00:55 +00:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
x.removeChild(x.lastChild);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
AnswerCount--;
|
|
|
|
}
|
2013-01-16 08:00:31 +00:00
|
|
|
//]]>
|
2011-03-28 14:21:28 +00:00
|
|
|
</script>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" class="center">
|
2013-02-18 08:00:22 +00:00
|
|
|
<strong>Poll Settings</strong>
|
2013-03-02 08:00:34 +00:00
|
|
|
<a href="#" onclick="$('#poll_question, #poll_answers').toggle();return false;" class="brackets">View</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr id="poll_question" class="hidden">
|
2012-11-06 08:00:20 +00:00
|
|
|
<td class="label">Question:</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td><input type="text" name="question" id="pollquestionfield" style="width: 98%;" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr id="poll_answers" class="hidden">
|
2012-11-06 08:00:20 +00:00
|
|
|
<td class="label">Answers:</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td id="answer_block">
|
|
|
|
<input type="text" name="answers[]" style="width: 90%;" />
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="#" onclick="AddAnswerField();return false;" class="brackets">+</a>
|
2013-02-18 08:00:22 +00:00
|
|
|
<a href="#" onclick="RemoveAnswerField();return false;" class="brackets">−</a>
|
2011-03-28 14:21:28 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<? } ?>
|
|
|
|
</table>
|
|
|
|
<div id="subscribediv" class="hidden">
|
2013-04-19 08:00:55 +00:00
|
|
|
<input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : '' ?> />
|
2011-03-28 14:21:28 +00:00
|
|
|
<label for="subscribebox">Subscribe to topic</label>
|
|
|
|
</div>
|
2012-11-14 08:00:19 +00:00
|
|
|
<div id="buttons" class="center">
|
|
|
|
<input type="button" value="Preview" onclick="Newthread_Preview(1);" id="newthreadpreviewbutton" />
|
|
|
|
<input type="button" value="Editor" onclick="Newthread_Preview(0);" id="newthreadeditbutton" class="hidden" />
|
|
|
|
<input type="submit" id="submit_button" value="Create thread" />
|
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-10-11 08:00:15 +00:00
|
|
|
<? View::show_footer(); ?>
|