remove old readme
[atutor.git] / docs / mods / _standard / forums / html / new_thread.inc.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
16
17 if (!$_SESSION['valid_user']) {
18         $msg->printInfos('LOGIN_TO_POST');
19         return;
20 }
21
22 $msg->printErrors();
23
24 if (isset($_POST['submit'])) {
25 //      $subject        = htmlentities_utf8($_POST['subject']);
26 //      $body           = htmlentities_utf8($_POST['body']);
27         $parent_id      = $_POST['parent_id'];
28         $parent_name    = $_POST['parent_name'];
29         //post reply is set when there is an error occuring.
30         if ($_POST['reply']!=''){
31                 $saved_post['body'] = $_POST['replytext'];
32                 $reply_hidden = '<input name="reply" type="hidden" value="'.AT_print($_REQUEST['reply'], 'input.text').'" />';
33         }
34 } else if (isset($_GET['reply']) && $_GET['reply'] != '') {
35         $subject = $saved_post['subject'];
36         $reply_hidden = '<input name="reply" type="hidden" value="'.AT_print($_REQUEST['reply'], 'input.text').'" />';
37
38         if (substr($subject, 0, 3) != 'Re:') {
39                 $subject = 'Re: '.$subject;
40         }
41 }
42
43 ?>
44 <a name="post"></a>
45 <form action="mods/_standard/forums/forum/new_thread.php" method="post" name="form">
46 <input name="parent_id" type="hidden" value="<?php echo $parent_id; ?>" />
47 <input name="fid" type="hidden" value="<?php echo $fid; ?>" />
48 <input name="page" type="hidden" value="<?php echo $_GET['page']; ?>" />
49 <input name="parent_name" type="hidden" value="<?php echo urlencode($parent_name); ?>" />
50 <?php echo $reply_hidden; //print hidden reply field if it exists. ?>
51
52 <a name="post"></a>
53
54 <div class="input-form">
55         <fieldset class="group_form"><legend class="group_form"><?php echo _AT('post_message'); ?></legend>
56         <div class="row">
57                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="subject"><?php echo _AT('subject'); ?></label><br />
58                 <input type="text" maxlength="80" name="subject" size="36" value="<?php echo AT_print($subject, 'input.text'); ?>" id="subject" />
59         </div>
60
61         <div class="row">
62                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="body"><?php echo _AT('body'); ?></label><br />
63                 <textarea cols="45" name="body" rows="10" id="body"><?php echo AT_print($_POST['body'], 'input.text'); ?></textarea>
64
65                 <small class="spacer"><br />&middot; <?php echo _AT('forum_links'); ?><br />
66                 &middot; <?php echo _AT('forum_email_links'); ?><br />
67                 &middot; <?php echo _AT('forum_html_disabled'); ?></small>
68         </div>
69
70         <?php if (isset($_REQUEST['reply'])): ?>
71                 <div class="row">
72                         <label for="body"><?php echo _AT('forum_reply_to'); ?></label><br />
73                         <textarea cols="45" name="replytext" rows="5"><?php echo $saved_post['body']; ?></textarea>
74                 </div>
75
76         <?php endif; ?>
77
78         <div class="row">       
79                 <a href="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES); ?>#jumpcodes" title="<?php echo _AT('jump_codes'); ?>"><img src="images/clr.gif" height="1" width="1" alt="<?php echo _AT('jump_codes'); ?>" border="0" /></a><?php require(AT_INCLUDE_PATH.'html/code_picker.inc.php'); ?>
80
81                 <a name="jumpcodes"></a>
82         </div>
83
84         <?php if (!$subscribed): ?>
85                 <div class="row">
86                         <input type="checkbox" name="subscribe" value="1" id="sub" />
87                         <label for="sub"><?php echo _AT('thread_subscribe'); ?></label>
88                 </div>
89         <?php else: ?>
90                 <div class="row">
91                         <?php echo _AT('thread_already_subscribed'); ?>
92                 </div>
93         <?php endif; ?>
94 </fieldset>
95         <div class="row buttons">
96                 <input name="submit" accesskey="s" type="submit" value=" <?php echo _AT('post'); ?>" />
97                 <?php if ($new_thread == TRUE) : ?>
98                         <input name="cancel" type="submit" value="<?php echo _AT('cancel'); ?>" />
99                 <?php endif; ?>
100         </div>
101 </div>
102 </form>