Created new language file
[moodle.git] / mod / forum / post.php
CommitLineData
41905731 1<?php // $Id$
501cdbd8 2
3// Edit and save a new post to a discussion
4
5
b0e3a925 6 require_once("../../config.php");
7 require_once("lib.php");
501cdbd8 8
9 if (isguest()) {
c59eb341 10 $wwwroot = $CFG->wwwroot.'/login/index.php';
11 if (!empty($CFG->loginhttps)) {
12 $wwwroot = str_replace('http','https', $wwwroot);
13 }
556963f5 14
15 if (isset($forum)) { // User is starting a new discussion in a forum
16 if (! $forum = get_record('forum', 'id', $forum)) {
17 error('The forum number was incorrect');
18 }
19 } else if (isset($reply)) { // User is writing a new reply
20 if (! $parent = forum_get_post_full($reply)) {
21 error('Parent post ID was incorrect');
22 }
23 if (! $discussion = get_record('forum_discussions', 'id', $parent->discussion)) {
24 error('This post is not part of a discussion!');
25 }
26 if (! $forum = get_record('forum', 'id', $discussion->forum)) {
27 error('The forum number was incorrect');
28 }
29 }
30 if (! $course = get_record('course', 'id', $forum->course)) {
31 error('The course number was incorrect');
32 }
33 if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) { // For the logs
34 $cm->id = 0;
35 }
36
37 $strforums = get_string('modulenameplural', 'forum');
38 if ($course->category) {
39 print_header($course->shortname, $course->fullname,
40 "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
e6157a73 41 <a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
3849dae8 42 <a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>", '', '', true, "", navmenu($course, $cm));
556963f5 43 } else {
44 print_header($course->shortname, $course->fullname,
e6157a73 45 "<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
3849dae8 46 <a href=\"view.php?f=$forum->id\">".format_string($forum->name)."</a>", '', '', true, "", navmenu($course, $cm));
556963f5 47 }
c59eb341 48 notice_yesno(get_string('noguestpost', 'forum').'<br /><br />'.get_string('liketologin'),
49 $wwwroot, $_SERVER['HTTP_REFERER']);
cd8d4471 50 print_footer($course);
c59eb341 51 exit;
501cdbd8 52 }
53
8e8d0524 54 require_login(0, false); // Script is useless unless they're logged in
48d38fad 55
36b4f985 56 if ($post = data_submitted()) {
f7abd64a 57 if (empty($post->course)) {
58 error('No course was defined!');
59 }
60
61 if (!$course = get_record('course', 'id', $post->course)) {
62 error('Could not find specified course!');
63 }
64
65 if (!empty($course->lang)) { // Override current language
66 $CFG->courselang = $course->lang;
0d1db48e 67 }
501cdbd8 68
3395f2d6 69 if (empty($SESSION->fromurl)) {
70 $errordestination = "$CFG->wwwroot/mod/forum/view.php?f=$post->forum";
71 } else {
72 $errordestination = $SESSION->fromurl;
73 }
74
83ec9098 75 $post->subject = strip_tags($post->subject, '<lang>'); // Strip all tags except lang
db46e49c 76
3b7d3db5 77 //$post->message = clean_text($post->message, $post->format); // Clean up any bad tags
501cdbd8 78
36257d39 79 $post->attachment = isset($_FILES['attachment']) ? $_FILES['attachment'] : NULL;
7f6689e4 80
f7abd64a 81 if (!$cm = get_coursemodule_from_instance("forum", $post->forum, $course->id)) { // For the logs
69d79bc3 82 $cm->id = 0;
83 }
84
3395f2d6 85 if (!$post->subject or !$post->message) {
86 $post->error = get_string("emptymessage", "forum");
7f6689e4 87
3395f2d6 88 } else if ($post->edit) { // Updating a post
501cdbd8 89 $post->id = $post->edit;
db290a6e 90 $message = '';
91 if (forum_update_post($post,$message)) {
8f0cd6ef 92
f7abd64a 93 add_to_log($course->id, "forum", "update post",
839f2456 94 "discuss.php?d=$post->discussion&amp;parent=$post->id", "$post->id", $cm->id);
69d79bc3 95
db290a6e 96 $timemessage = 2;
97 if (!empty($message)) { // if we're printing stuff about the file upload
98 $timemessage = 4;
99 }
100 $message .= '<br />'.get_string("postupdated", "forum");
8f0cd6ef 101
0a9f61b5 102 if ($subscribemessage = forum_post_subscription($post)) {
db290a6e 103 $timemessage = 4;
0a9f61b5 104 }
b22b0e61 105 redirect(forum_go_back_to("discuss.php?d=$post->discussion#$post->id"), $message.$subscribemessage, $timemessage);
0a9f61b5 106
501cdbd8 107 } else {
8f0cd6ef 108 error(get_string("couldnotupdate", "forum"), $errordestination);
501cdbd8 109 }
3395f2d6 110 exit;
7f6689e4 111
501cdbd8 112 } else if ($post->discussion) { // Adding a new post to an existing discussion
db290a6e 113 $message = '';
114 if ($post->id = forum_add_new_post($post,$message)) {
69d79bc3 115
f7abd64a 116 add_to_log($course->id, "forum", "add post",
839f2456 117 "discuss.php?d=$post->discussion&amp;parent=$post->id", "$post->id", $cm->id);
69d79bc3 118
0a9f61b5 119 $timemessage = 2;
db290a6e 120 if (!empty($message)) { // if we're printing stuff about the file upload
121 $timemessage = 4;
122 }
123 $message .= '<br />'.get_string("postadded", "forum", format_time($CFG->maxeditingtime));
0a9f61b5 124
125 if ($subscribemessage = forum_post_subscription($post)) {
126 $timemessage = 4;
501cdbd8 127 }
128
b22b0e61 129 redirect(forum_go_back_to("discuss.php?d=$post->discussion#$post->id"), $message.$subscribemessage, $timemessage);
0a9f61b5 130
501cdbd8 131 } else {
8f0cd6ef 132 error(get_string("couldnotadd", "forum"), $errordestination);
501cdbd8 133 }
3395f2d6 134 exit;
135
501cdbd8 136 } else { // Adding a new discussion
137 $discussion = $post;
138 $discussion->name = $post->subject;
139 $discussion->intro = $post->message;
db290a6e 140 $message = '';
141 if ($discussion->id = forum_add_discussion($discussion,$message)) {
69d79bc3 142
680afe2e 143 add_to_log($course->id, "forum", "add discussion",
69d79bc3 144 "discuss.php?d=$discussion->id", "$discussion->id", $cm->id);
145
0a9f61b5 146 $timemessage = 2;
db290a6e 147 if (!empty($message)) { // if we're printing stuff about the file upload
148 $timemessage = 4;
149 }
150 $message .= '<br />'.get_string("postadded", "forum", format_time($CFG->maxeditingtime));
8f0cd6ef 151
0a9f61b5 152 if ($subscribemessage = forum_post_subscription($discussion)) {
153 $timemessage = 4;
154 }
155
156 redirect(forum_go_back_to("view.php?f=$post->forum"), $message.$subscribemessage, $timemessage);
157
501cdbd8 158 } else {
8f0cd6ef 159 error(get_string("couldnotadd", "forum"), $errordestination);
501cdbd8 160 }
3395f2d6 161 exit;
501cdbd8 162 }
501cdbd8 163 }
164
213e8cc6 165 if ($usehtmleditor = can_use_richtext_editor()) {
166 $defaultformat = FORMAT_HTML;
213e8cc6 167 } else {
168 $defaultformat = FORMAT_MOODLE;
169 }
501cdbd8 170
9814a0ed 171 $parent=NULL; // Initialise some things
172
501cdbd8 173
3395f2d6 174 if (isset($post->error)) { // User is re-editing a failed posting
175
176 // Set up all the required objects again, and reuse the same $post
177
178 if (! $forum = get_record("forum", "id", $post->forum)) {
179 error("The forum number was incorrect ($post->forum)");
180 }
181
182 if (! $course = get_record("course", "id", $forum->course)) {
183 error("The course number was incorrect ($forum->course)");
184 }
185
186 if (!empty($post->parent)) {
187 if (! $parent = forum_get_post_full($post->parent)) {
188 error("Parent post ID was incorrect ($post->parent)");
189 }
190 }
191
192 if (!empty($post->discussion)) {
193 if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
194 error("This post is not part of a discussion! ($post->discussion)");
195 }
196 }
197
198 } else if (isset($forum)) { // User is starting a new discussion in a forum
501cdbd8 199
607809b3 200 $SESSION->fromurl = $_SERVER["HTTP_REFERER"];
501cdbd8 201
202 if (! $forum = get_record("forum", "id", $forum)) {
203 error("The forum number was incorrect ($forum)");
204 }
205 if (! $course = get_record("course", "id", $forum->course)) {
3395f2d6 206 error("The course number was incorrect ($forum->course)");
501cdbd8 207 }
208
11b0c469 209 if (! forum_user_can_post_discussion($forum)) {
501cdbd8 210 error("Sorry, but you can not post a new discussion in this forum.");
211 }
212
80602101 213 if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
214 if (!$cm->visible and !isteacher($course->id)) {
215 error(get_string("activityiscurrentlyhidden"));
216 }
217 }
218
501cdbd8 219 // Load up the $post variable.
220
221 $post->course = $course->id;
222 $post->forum = $forum->id;
223 $post->discussion = 0; // ie discussion # not defined yet
224 $post->parent = 0;
225 $post->subject = "";
ebc3bd2b 226 $post->userid = $USER->id;
501cdbd8 227 $post->message = "";
213e8cc6 228 $post->format = $defaultformat;
501cdbd8 229
2862b309 230 $post->groupid = get_current_group($course->id);
231 if (isteacheredit($course->id) and $post->groupid == 0) {
232 $post->groupid = -1;
233 }
234
11b0c469 235 forum_set_return();
236
501cdbd8 237 } else if (isset($reply)) { // User is writing a new reply
238
11b0c469 239 if (! $parent = forum_get_post_full($reply)) {
29ad118c 240 error("Parent post ID was incorrect");
501cdbd8 241 }
242 if (! $discussion = get_record("forum_discussions", "id", $parent->discussion)) {
29ad118c 243 error("This post is not part of a discussion!");
501cdbd8 244 }
245 if (! $forum = get_record("forum", "id", $discussion->forum)) {
246 error("The forum number was incorrect ($discussion->forum)");
247 }
248 if (! $course = get_record("course", "id", $discussion->course)) {
249 error("The course number was incorrect ($discussion->course)");
250 }
6c506ca7 251
252 if (! forum_user_can_post($forum)) {
253 error("Sorry, but you can not post in this forum.");
254 }
02509fe6 255
256 if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
257 if (groupmode($course, $cm) and !isteacheredit($course->id)) { // Make sure user can post here
63e20b88 258 $mygroupid = mygroupid($course->id);
259 if (!((empty($mygroupid) and $discussion->groupid == -1) || ($mygroupid == $discussion->groupid))) {
02509fe6 260 error("Sorry, but you can not post in this discussion.");
261 }
262 }
80602101 263 if (!$cm->visible and !isteacher($course->id)) {
264 error(get_string("activityiscurrentlyhidden"));
265 }
02509fe6 266 }
267
501cdbd8 268 // Load up the $post variable.
269
270 $post->course = $course->id;
271 $post->forum = $forum->id;
272 $post->discussion = $parent->discussion;
273 $post->parent = $parent->id;
274 $post->subject = $parent->subject;
ebc3bd2b 275 $post->userid = $USER->id;
501cdbd8 276 $post->message = "";
213e8cc6 277 $post->format = $defaultformat;
501cdbd8 278
e9584ca3 279 $strre = get_string('re', 'forum');
280 if (!(substr($post->subject, 0, strlen($strre)) == $strre)) {
281 $post->subject = $strre.' '.$post->subject;
501cdbd8 282 }
283
b22b0e61 284 unset($SESSION->fromdiscussion);
501cdbd8 285
286 } else if (isset($edit)) { // User is editing their own post
287
b8be40ce 288 $adminedit = (isadmin() and !empty($CFG->admineditalways));
289
11b0c469 290 if (! $post = forum_get_post_full($edit)) {
501cdbd8 291 error("Post ID was incorrect");
292 }
b8be40ce 293 if (($post->userid <> $USER->id) and !$adminedit) {
501cdbd8 294 error("You can't edit other people's posts!");
295 }
b8be40ce 296 if (((time() - $post->created) > $CFG->maxeditingtime) and !$adminedit) {
cf38360f 297 error( get_string("maxtimehaspassed", "forum", format_time($CFG->maxeditingtime)) );
501cdbd8 298 }
299 if ($post->parent) {
11b0c469 300 if (! $parent = forum_get_post_full($post->parent)) {
501cdbd8 301 error("Parent post ID was incorrect ($post->parent)");
302 }
303 }
304 if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
305 error("This post is not part of a discussion! ($reply)");
306 }
307 if (! $forum = get_record("forum", "id", $discussion->forum)) {
308 error("The forum number was incorrect ($discussion->forum)");
309 }
310 if (! $course = get_record("course", "id", $discussion->course)) {
311 error("The course number was incorrect ($discussion->course)");
312 }
313
314 // Load up the $post variable.
315
316 $post->edit = $edit;
317
318 $post->course = $course->id;
319 $post->forum = $forum->id;
320
b22b0e61 321 unset($SESSION->fromdiscussion);
501cdbd8 322
323
324 } else if (isset($delete)) { // User is deleting a post
325
11b0c469 326 if (! $post = forum_get_post_full($delete)) {
501cdbd8 327 error("Post ID was incorrect");
328 }
501cdbd8 329 if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
330 error("This post is not part of a discussion!");
331 }
64eacd6f 332 if (! $forum = get_record("forum", "id", $discussion->forum)) {
333 error("The forum number was incorrect ($discussion->forum)");
334 }
ebc3bd2b 335 if (($post->userid <> $USER->id) and !isteacher($forum->course)) {
64eacd6f 336 error("You can't delete other people's posts!");
337 }
0d1db48e 338 if (!empty($forum->course)) {
339 if ($course = get_record('course', 'id', $forum->course)) {
340 if (!empty($course->lang)) {
341 $CFG->courselang = $course->lang;
342 }
343 }
344 }
501cdbd8 345
346 if (isset($confirm)) { // User has confirmed the delete
347
348 if ($post->totalscore) {
8f0cd6ef 349 notice(get_string("couldnotdeleteratings", "forum"),
11b0c469 350 forum_go_back_to("discuss.php?d=$post->discussion"));
501cdbd8 351
352 } else if (record_exists("forum_posts", "parent", $delete)) {
cf38360f 353 error(get_string("couldnotdeletereplies", "forum"),
8203d211 354 forum_go_back_to("discuss.php?d=$post->discussion"));
501cdbd8 355
356 } else {
69d79bc3 357 if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $forum->course)) { // For the logs
358 $cm->id = 0;
359 }
501cdbd8 360 if (! $post->parent) { // post is a discussion topic as well, so delete discussion
64eacd6f 361 if ($forum->type == "single") {
8f0cd6ef 362 notice("Sorry, but you are not allowed to delete that discussion!",
64eacd6f 363 forum_go_back_to("discuss.php?d=$post->discussion"));
364 }
501cdbd8 365 forum_delete_discussion($discussion);
366
8f0cd6ef 367 add_to_log($discussion->course, "forum", "delete discussion",
b17333be 368 "view.php?id=$cm->id", "$forum->id", $cm->id);
69d79bc3 369
8f0cd6ef 370 redirect("view.php?f=$discussion->forum",
cf38360f 371 get_string("deleteddiscussion", "forum"), 1);
501cdbd8 372
7f6689e4 373 } else if (forum_delete_post($post)) {
501cdbd8 374
8f0cd6ef 375 add_to_log($discussion->course, "forum", "delete post",
69d79bc3 376 "discuss.php?d=$post->discussion", "$post->id", $cm->id);
377
8f0cd6ef 378 redirect(forum_go_back_to("discuss.php?d=$post->discussion"),
cf38360f 379 get_string("deletedpost", "forum"), 1);
501cdbd8 380 } else {
381 error("An error occurred while deleting record $post->id");
382 }
383 }
384
385
386 } else { // User just asked to delete something
387
11b0c469 388 forum_set_return();
501cdbd8 389
390 print_header();
8f0cd6ef 391 notice_yesno(get_string("deletesure", "forum"),
839f2456 392 "post.php?delete=$delete&amp;confirm=$delete",
607809b3 393 $_SERVER["HTTP_REFERER"]);
8f0cd6ef 394
41905731 395 echo "<center><hr />";
8aed46c7 396 forum_print_post($post, $forum->course, $ownpost=false, $reply=false, $link=false);
839f2456 397 echo "</center>";
501cdbd8 398 }
839f2456 399 print_footer($course);
501cdbd8 400 die;
401
402
cf84431b 403 } else if (isset($prune)) { // Teacher is pruning
8f0cd6ef 404
cf84431b 405 if (! $post = forum_get_post_full($prune)) {
406 error("Post ID was incorrect");
407 }
408 if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
409 error("This post is not part of a discussion!");
410 }
411 if (! $forum = get_record("forum", "id", $discussion->forum)) {
412 error("The forum number was incorrect ($discussion->forum)");
413 }
414 if (!isteacher($forum->course)) {
4d35d88b 415 error("You can't split discussions!");
cf84431b 416 }
417 if (!$post->parent) {
418 error('This is already the first post in the discussion');
419 }
420
421 if (isset($_REQUEST['name'])) { // User has confirmed the prune
8f0cd6ef 422
cf84431b 423 $newdiscussion->course = $discussion->course;
424 $newdiscussion->forum = $discussion->forum;
425 $newdiscussion->name = $name;
426 $newdiscussion->firstpost = $post->id;
427 $newdiscussion->userid = $discussion->userid;
428 $newdiscussion->groupid = $discussion->groupid;
429 $newdiscussion->assessed = $discussion->assessed;
430 $newdiscussion->usermodified = $post->userid;
8f0cd6ef 431
cf84431b 432 if (!$newid = insert_record('forum_discussions', $newdiscussion)) {
433 error('Could not create new discussion');
434 }
8f0cd6ef 435
13152de4 436 $newpost->id = $post->id;
437 $newpost->parent = 0;
438 $newpost->subject = $name;
d078ee9b 439
13152de4 440 if (!update_record("forum_posts", $newpost)) {
d078ee9b 441 error('Could not update the original post');
442 }
443
cf84431b 444 forum_change_discussionid($post->id, $newid);
8f0cd6ef 445
cf84431b 446 // set timemodified to time of last post in each discussion
447 $lastpost = get_record_sql("SELECT MAX(modified) AS time
8f0cd6ef 448 FROM {$CFG->prefix}forum_posts
cf84431b 449 WHERE discussion = '$discussion->id'");
450 set_field('forum_discussions', 'timemodified', $lastpost->time, 'id', $discussion->id);
451 $lastpost = get_record_sql("SELECT MAX(modified) AS time
8f0cd6ef 452 FROM {$CFG->prefix}forum_posts
cf84431b 453 WHERE discussion = '$newid'");
8f0cd6ef 454 set_field('forum_discussions', 'timemodified', $lastpost->time, 'id', $newid);
cf84431b 455
456
457 if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $forum->course)) { // For the logs
458 $cm->id = 0;
459 }
8f0cd6ef 460 add_to_log($discussion->course, "forum", "prune post",
cf84431b 461 "discuss.php?d=$newid", "$post->id", $cm->id);
462
d078ee9b 463 redirect(forum_go_back_to("discuss.php?d=$newid"), get_string("prunedpost", "forum"), 1);
cf84431b 464
465 } else { // User just asked to prune something
466
467 $course = get_record('course', 'id', $forum->course);
468 $strforums = get_string("modulenameplural", "forum");
c78ac798 469 print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "",
8f0cd6ef 470 "<a href=\"../forum/index.php?id=$course->id\">$strforums</a> ->
3849dae8 471 <a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a> ->
17dc3f3c 472 <a href=\"discuss.php?d=$discussion->id\">".format_string($post->subject,true)."</a> -> ".
cf84431b 473 get_string("prune", "forum"), '', "", true, "", navmenu($course, $cm));
8f0cd6ef 474
cf84431b 475 print_heading(get_string('pruneheading', 'forum'));
d078ee9b 476 echo '<center>';
8f0cd6ef 477
cf84431b 478 include('prune.html');
8f0cd6ef 479
cf84431b 480 forum_print_post($post, $forum->course, $ownpost=false, $reply=false, $link=false);
839f2456 481 echo '</center>';
cf84431b 482 }
839f2456 483 print_footer($course);
cf84431b 484 die;
485
486
501cdbd8 487 } else {
488 error("No operation specified");
489
490 }
491
492
8f0cd6ef 493 // To get here they need to edit a post, and the $post
501cdbd8 494 // variable will be loaded with all the particulars,
495 // so bring up the form.
496
497 // $course, $forum are defined. $discussion is for edit and reply only.
498
ec81373f 499 $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id);
500
501 require_login($course->id, false, $cm);
501cdbd8 502
dfc9ba9b 503
501cdbd8 504 if ($post->discussion) {
9fa49e22 505 if (! $toppost = get_record("forum_posts", "discussion", $post->discussion, "parent", 0)) {
501cdbd8 506 error("Could not find top parent of post $post->id");
507 }
508 } else {
680afe2e 509 $toppost->subject = ($forum->type == "news") ? get_string("addanewtopic", "forum") :
21da9db8 510 get_string("addanewdiscussion", "forum");
501cdbd8 511 }
512
3bbde520 513 if (empty($post->subject)) {
0ae5e5ea 514 $formstart = "theform.subject";
3bbde520 515 } else {
516 $formstart = "";
501cdbd8 517 }
518
519 if ($post->parent) {
17dc3f3c 520 $navtail = "<a href=\"discuss.php?d=$discussion->id\">".format_string($toppost->subject,true)."</a> -> ".get_string("editing", "forum");
501cdbd8 521 } else {
17dc3f3c 522 $navtail = format_string($toppost->subject);
501cdbd8 523 }
524
9c9f7d77 525 if (empty($post->edit)) {
526 $post->edit = "";
527 }
528
cf38360f 529 $strforums = get_string("modulenameplural", "forum");
530
73bb0835 531
3849dae8 532 $navmiddle = "<a href=\"../forum/index.php?id=$course->id\">$strforums</a> -> <a href=\"view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
501cdbd8 533
f37da850 534 if (empty($discussion->name)) {
9c9f7d77 535 $discussion->name = $forum->name;
536 }
537
501cdbd8 538 if ($course->category) {
c78ac798 539 print_header("$course->shortname: ".format_string($discussion->name).": ".format_string($toppost->subject), "$course->fullname",
325505f4 540 "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
3bbde520 541 $navmiddle -> $navtail", $formstart, "", true, "", navmenu($course, $cm));
680afe2e 542
501cdbd8 543 } else {
c78ac798 544 print_header("$course->shortname: ".format_string($discussion->name).": ".format_string($toppost->subject), "$course->fullname",
9c9f7d77 545 "$navmiddle -> $navtail", "$formstart", "", true, "", navmenu($course, $cm));
501cdbd8 546
547 }
548
3395f2d6 549 if (!empty($parent)) {
11b0c469 550 forum_print_post($parent, $course->id, $ownpost=false, $reply=false, $link=false);
f8029045 551 if (empty($post->edit)) {
f37da850 552 if ($CFG->forum_trackreadposts) {
553 $user_read_array = forum_tp_get_discussion_read_records($USER->id, $discussion->id);
554 } else {
555 $user_read_array = array();
556 }
e6157a73 557 forum_print_posts_threaded($parent->id, $course->id, 0, false, false, $user_read_array, $discussion->forum);
f8029045 558 }
556963f5 559 print_heading(get_string("yourreply", "forum").':');
501cdbd8 560 } else {
21da9db8 561 $forum->intro = trim($forum->intro);
562 if (!empty($forum->intro)) {
563 print_simple_box(format_text($forum->intro), 'center');
564 }
565 print_heading(get_string('yournewtopic', 'forum'));
501cdbd8 566 }
556963f5 567 echo '<center>';
3395f2d6 568 if (!empty($post->error)) {
569 notify($post->error);
570 }
556963f5 571 echo '</center>';
501cdbd8 572
d30867b0 573 print_simple_box_start("center");
501cdbd8 574 require("post.html");
575 print_simple_box_end();
576
4b00b4b3 577 if ($usehtmleditor) {
76138908 578 use_html_editor("message");
4b00b4b3 579 }
580
501cdbd8 581 print_footer($course);
582
583
584?>