Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 641 lines (516 sloc) 24.865 kB
07959a2 Development version of PunBB 1.3
Anatoly authored
1 <?php
619e67e Added phpDoc comments to the start of every PHP file, replacing the e…
Anatoly authored
2 /**
3 * Adds a new post to the specified topic or a new topic to the specified forum.
4 *
b0b11dc @dimkalinux Change copyright date
dimkalinux authored
5 * @copyright (C) 2008-2011 PunBB, partially based on code (C) 2008-2009 FluxBB.org
619e67e Added phpDoc comments to the start of every PHP file, replacing the e…
Anatoly authored
6 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
7 * @package PunBB
8 */
07959a2 Development version of PunBB 1.3
Anatoly authored
9
1da248e Fixed a potential CSRF bypass, discovered by Stefan Esser. Imported f…
Anatoly authored
10 define('FORUM_SKIP_CSRF_CONFIRM', 1);
07959a2 Development version of PunBB 1.3
Anatoly authored
11
12 if (!defined('FORUM_ROOT'))
13 define('FORUM_ROOT', './');
14 require FORUM_ROOT.'include/common.php';
15
16 ($hook = get_hook('po_start')) ? eval($hook) : null;
17
18 if ($forum_user['g_read_board'] == '0')
19 message($lang_common['No view']);
20
21 // Load the post.php language file
22 require FORUM_ROOT.'lang/'.$forum_user['language'].'/post.php';
23
24
25 $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
26 $fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
27 if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0)
28 message($lang_common['Bad request']);
29
30
31 // Fetch some info about the topic and/or the forum
32 if ($tid)
33 {
34 $query = array(
35 'SELECT' => 'f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed, s.user_id AS is_subscribed',
36 'FROM' => 'topics AS t',
37 'JOINS' => array(
38 array(
39 'INNER JOIN' => 'forums AS f',
40 'ON' => 'f.id=t.forum_id'
41 ),
42 array(
43 'LEFT JOIN' => 'forum_perms AS fp',
44 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
45 ),
46 array(
47 'LEFT JOIN' => 'subscriptions AS s',
48 'ON' => '(t.id=s.topic_id AND s.user_id='.$forum_user['id'].')'
49 )
50 ),
51 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid
52 );
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
53
54 ($hook = get_hook('po_qr_get_topic_forum_info')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
55 }
56 else
57 {
58 $query = array(
59 'SELECT' => 'f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics',
60 'FROM' => 'forums AS f',
61 'JOINS' => array(
62 array(
63 'LEFT JOIN' => 'forum_perms AS fp',
64 'ON' => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
65 )
66 ),
67 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid
68 );
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
69
70 ($hook = get_hook('po_qr_get_forum_info')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
71 }
72
73 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
be36ba8 @dimkalinux Partialy remove num_rows from post.php
dimkalinux authored
74 $cur_posting = $forum_db->fetch_assoc($result);
07959a2 Development version of PunBB 1.3
Anatoly authored
75
be36ba8 @dimkalinux Partialy remove num_rows from post.php
dimkalinux authored
76 if (!$cur_posting)
07959a2 Development version of PunBB 1.3
Anatoly authored
77 message($lang_common['Bad request']);
78
79 $is_subscribed = $tid && $cur_posting['is_subscribed'];
80
81 // Is someone trying to post into a redirect forum?
82 if ($cur_posting['redirect_url'] != '')
83 message($lang_common['Bad request']);
84
85 // Sort out who the moderators are and if we are currently a moderator (or an admin)
86 $mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
87 $forum_page['is_admmod'] = ($forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && array_key_exists($forum_user['username'], $mods_array))) ? true : false;
88
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
89 ($hook = get_hook('po_pre_permission_check')) ? eval($hook) : null;
90
07959a2 Development version of PunBB 1.3
Anatoly authored
91 // Do we have permission to post?
92 if ((($tid && (($cur_posting['post_replies'] == '' && $forum_user['g_post_replies'] == '0') || $cur_posting['post_replies'] == '0')) ||
93 ($fid && (($cur_posting['post_topics'] == '' && $forum_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) ||
94 (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
95 !$forum_page['is_admmod'])
96 message($lang_common['No permission']);
97
98
99 ($hook = get_hook('po_posting_location_selected')) ? eval($hook) : null;
100
101 // Start with a clean slate
102 $errors = array();
103
104 // Did someone just hit "Submit" or "Preview"?
105 if (isset($_POST['form_sent']))
106 {
107 ($hook = get_hook('po_form_submitted')) ? eval($hook) : null;
108
109 // Make sure form_user is correct
110 if (($forum_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$forum_user['is_guest'] && $_POST['form_user'] != $forum_user['username']))
111 message($lang_common['Bad request']);
112
113 // Flood protection
ef1d76a Updated the flood protection for posts and searches to also apply to …
Anatoly authored
114 if (!isset($_POST['preview']) && $forum_user['last_post'] != '' && (time() - $forum_user['last_post']) < $forum_user['g_post_flood'] && (time() - $forum_user['last_post']) >= 0)
07959a2 Development version of PunBB 1.3
Anatoly authored
115 $errors[] = sprintf($lang_post['Flood'], $forum_user['g_post_flood']);
116
117 // If it's a new topic
118 if ($fid)
119 {
a096817 Globally replacing trim() with forum_trim().
Anatoly authored
120 $subject = forum_trim($_POST['req_subject']);
07959a2 Development version of PunBB 1.3
Anatoly authored
121
122 if ($subject == '')
123 $errors[] = $lang_post['No subject'];
124 else if (utf8_strlen($subject) > 70)
125 $errors[] = $lang_post['Too long subject'];
f763efb Fix #372 (better CAPS detect)
dimkalinux authored
126 else if ($forum_config['p_subject_all_caps'] == '0' && check_is_all_caps($subject) && !$forum_page['is_admmod'])
06e9b07 Made attempts to post in all capitals result in an error message rath…
Anatoly authored
127 $errors[] = $lang_post['All caps subject'];
07959a2 Development version of PunBB 1.3
Anatoly authored
128 }
129
130 // If the user is logged in we get the username and e-mail from $forum_user
131 if (!$forum_user['is_guest'])
132 {
133 $username = $forum_user['username'];
134 $email = $forum_user['email'];
135 }
136 // Otherwise it should be in $_POST
137 else
138 {
a096817 Globally replacing trim() with forum_trim().
Anatoly authored
139 $username = forum_trim($_POST['req_username']);
140 $email = strtolower(forum_trim(($forum_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));
07959a2 Development version of PunBB 1.3
Anatoly authored
141
142 // Load the profile.php language file
143 require FORUM_ROOT.'lang/'.$forum_user['language'].'/profile.php';
144
145 // It's a guest, so we have to validate the username
146 $errors = array_merge($errors, validate_username($username));
147
148 if ($forum_config['p_force_guest_email'] == '1' || $email != '')
149 {
806afa0 Added constants to various included files.
Anatoly authored
150 if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED'))
151 require FORUM_ROOT.'include/email.php';
152
07959a2 Development version of PunBB 1.3
Anatoly authored
153 if (!is_valid_email($email))
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
154 $errors[] = $lang_post['Invalid e-mail'];
de31fcc Various changes. Imported from FluxBB.
Roman authored
155
156 if (is_banned_email($email))
157 $errors[] = $lang_profile['Banned e-mail'];
07959a2 Development version of PunBB 1.3
Anatoly authored
158 }
159 }
160
161 // If we're an administrator or moderator, make sure the CSRF token in $_POST is valid
162 if ($forum_user['is_admmod'] && (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== generate_form_token(get_current_url())))
163 $errors[] = $lang_post['CSRF token mismatch'];
164
165 // Clean up message from POST
a096817 Globally replacing trim() with forum_trim().
Anatoly authored
166 $message = forum_linebreaks(forum_trim($_POST['req_message']));
07959a2 Development version of PunBB 1.3
Anatoly authored
167
e4eaae6 Fixed issue with FORUM_MAX_POSTSIZE_BYTES (a little bit more correct …
Roman authored
168 if (strlen($message) > FORUM_MAX_POSTSIZE_BYTES)
2acca10 Changed the message that appears when message length exceeds FORUM_MA…
Roman authored
169 $errors[] = sprintf($lang_post['Too long message'], forum_number_format(strlen($message)), forum_number_format(FORUM_MAX_POSTSIZE_BYTES));
f763efb Fix #372 (better CAPS detect)
dimkalinux authored
170 else if ($forum_config['p_message_all_caps'] == '0' && check_is_all_caps($message) && !$forum_page['is_admmod'])
06e9b07 Made attempts to post in all capitals result in an error message rath…
Anatoly authored
171 $errors[] = $lang_post['All caps message'];
07959a2 Development version of PunBB 1.3
Anatoly authored
172
173 // Validate BBCode syntax
174 if ($forum_config['p_message_bbcode'] == '1' || $forum_config['o_make_links'] == '1')
175 {
176 if (!defined('FORUM_PARSER_LOADED'))
177 require FORUM_ROOT.'include/parser.php';
806afa0 Added constants to various included files.
Anatoly authored
178
07959a2 Development version of PunBB 1.3
Anatoly authored
179 $message = preparse_bbcode($message, $errors);
180 }
181
7eb6d4f Fixed incorrect posted column being used to display post time in dele…
Anatoly authored
182 if ($message == '')
183 $errors[] = $lang_post['No message'];
184
07959a2 Development version of PunBB 1.3
Anatoly authored
185 $hide_smilies = isset($_POST['hide_smilies']) ? 1 : 0;
186 $subscribe = isset($_POST['subscribe']) ? 1 : 0;
187
188 $now = time();
189
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
190 ($hook = get_hook('po_end_validation')) ? eval($hook) : null;
191
07959a2 Development version of PunBB 1.3
Anatoly authored
192 // Did everything go according to plan?
193 if (empty($errors) && !isset($_POST['preview']))
194 {
195 // If it's a reply
196 if ($tid)
197 {
198 $post_info = array(
0ec9881 Moved code from post.php to the add_post and add_topic functions in o…
Anatoly authored
199 'is_guest' => $forum_user['is_guest'],
200 'poster' => $username,
201 'poster_id' => $forum_user['id'], // Always 1 for guest posts
202 'poster_email' => ($forum_user['is_guest'] && $email != '') ? $email : null, // Always null for non-guest posts
203 'subject' => $cur_posting['subject'],
204 'message' => $message,
205 'hide_smilies' => $hide_smilies,
206 'posted' => $now,
207 'subscr_action' => ($forum_config['o_subscriptions'] == '1' && $subscribe && !$is_subscribed) ? 1 : (($forum_config['o_subscriptions'] == '1' && !$subscribe && $is_subscribed) ? 2 : 0),
208 'topic_id' => $tid,
209 'forum_id' => $cur_posting['id'],
210 'update_user' => true,
211 'update_unread' => true
07959a2 Development version of PunBB 1.3
Anatoly authored
212 );
213
214 ($hook = get_hook('po_pre_add_post')) ? eval($hook) : null;
215 add_post($post_info, $new_pid);
216 }
217 // If it's a new topic
218 else if ($fid)
219 {
220 $post_info = array(
0ec9881 Moved code from post.php to the add_post and add_topic functions in o…
Anatoly authored
221 'is_guest' => $forum_user['is_guest'],
222 'poster' => $username,
223 'poster_id' => $forum_user['id'], // Always 1 for guest posts
224 'poster_email' => ($forum_user['is_guest'] && $email != '') ? $email : null, // Always null for non-guest posts
225 'subject' => $subject,
226 'message' => $message,
227 'hide_smilies' => $hide_smilies,
228 'posted' => $now,
229 'subscribe' => ($forum_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1')),
230 'forum_id' => $fid,
231 'update_user' => true,
232 'update_unread' => true
07959a2 Development version of PunBB 1.3
Anatoly authored
233 );
234
235 ($hook = get_hook('po_pre_add_topic')) ? eval($hook) : null;
236 add_topic($post_info, $new_tid, $new_pid);
237 }
238
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
239 ($hook = get_hook('po_pre_redirect')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
240
241 redirect(forum_link($forum_url['post'], $new_pid), $lang_post['Post redirect']);
242 }
243 }
244
245
246 // Are we quoting someone?
247 if ($tid && isset($_GET['qid']))
248 {
249 $qid = intval($_GET['qid']);
250 if ($qid < 1)
251 message($lang_common['Bad request']);
252
253 // Get the quote and quote poster
254 $query = array(
255 'SELECT' => 'p.poster, p.message',
256 'FROM' => 'posts AS p',
257 'WHERE' => 'id='.$qid.' AND topic_id='.$tid
258 );
259
260 ($hook = get_hook('po_qr_get_quote')) ? eval($hook) : null;
261 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
b2c9086 @dimkalinux Finished removing num_rows from post.php
dimkalinux authored
262 $quote_poster_and_message = $forum_db->fetch_row($result);
263
264 if (!$quote_poster_and_message)
265 {
07959a2 Development version of PunBB 1.3
Anatoly authored
266 message($lang_common['Bad request']);
b2c9086 @dimkalinux Finished removing num_rows from post.php
dimkalinux authored
267 }
07959a2 Development version of PunBB 1.3
Anatoly authored
268
b2c9086 @dimkalinux Finished removing num_rows from post.php
dimkalinux authored
269 list($q_poster, $q_message) = $quote_poster_and_message;
07959a2 Development version of PunBB 1.3
Anatoly authored
270
d1b8b49 Added the hook "po_modify_quote_info" to post.php after getting info …
SlavaK authored
271 ($hook = get_hook('po_modify_quote_info')) ? eval($hook) : null;
272
07959a2 Development version of PunBB 1.3
Anatoly authored
273 if ($forum_config['p_message_bbcode'] == '1')
274 {
275 // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
276 if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false)
277 {
278 if (strpos($q_poster, '\'') !== false)
279 $q_poster = '"'.$q_poster.'"';
280 else
281 $q_poster = '\''.$q_poster.'\'';
282 }
283 else
284 {
285 // Get the characters at the start and end of $q_poster
286 $ends = utf8_substr($q_poster, 0, 1).utf8_substr($q_poster, -1, 1);
287
288 // Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
289 if ($ends == '\'\'')
290 $q_poster = '"'.$q_poster.'"';
291 else if ($ends == '""')
292 $q_poster = '\''.$q_poster.'\'';
293 }
294
295 $forum_page['quote'] = '[quote='.$q_poster.']'.$q_message.'[/quote]'."\n";
296 }
297 else
298 $forum_page['quote'] = '> '.$q_poster.' '.$lang_common['wrote'].':'."\n\n".'> '.$q_message."\n";
299 }
300
301
302 // Setup form
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
303 $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
07959a2 Development version of PunBB 1.3
Anatoly authored
304 $forum_page['form_action'] = ($tid ? forum_link($forum_url['new_reply'], $tid) : forum_link($forum_url['new_topic'], $fid));
305 $forum_page['form_attributes'] = array();
306
307 $forum_page['hidden_fields'] = array(
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
308 'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
309 'form_user' => '<input type="hidden" name="form_user" value="'.((!$forum_user['is_guest']) ? forum_htmlencode($forum_user['username']) : 'Guest').'" />',
310 'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
07959a2 Development version of PunBB 1.3
Anatoly authored
311 );
312
313 // Setup help
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
314 $forum_page['text_options'] = array();
1c1ef29 PunBB update to rev265
Anatoly authored
315 if ($forum_config['p_message_bbcode'] == '1')
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
316 $forum_page['text_options']['bbcode'] = '<span'.(empty($forum_page['text_options']) ? ' class="first-item"' : '').'><a class="exthelp" href="'.forum_link($forum_url['help'], 'bbcode').'" title="'.sprintf($lang_common['Help page'], $lang_common['BBCode']).'">'.$lang_common['BBCode'].'</a></span>';
1c1ef29 PunBB update to rev265
Anatoly authored
317 if ($forum_config['p_message_img_tag'] == '1')
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
318 $forum_page['text_options']['img'] = '<span'.(empty($forum_page['text_options']) ? ' class="first-item"' : '').'><a class="exthelp" href="'.forum_link($forum_url['help'], 'img').'" title="'.sprintf($lang_common['Help page'], $lang_common['Images']).'">'.$lang_common['Images'].'</a></span>';
1c1ef29 PunBB update to rev265
Anatoly authored
319 if ($forum_config['o_smilies'] == '1')
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
320 $forum_page['text_options']['smilies'] = '<span'.(empty($forum_page['text_options']) ? ' class="first-item"' : '').'><a class="exthelp" href="'.forum_link($forum_url['help'], 'smilies').'" title="'.sprintf($lang_common['Help page'], $lang_common['Smilies']).'">'.$lang_common['Smilies'].'</a></span>';
07959a2 Development version of PunBB 1.3
Anatoly authored
321
322 // Setup breadcrumbs
323 $forum_page['crumbs'][] = array($forum_config['o_board_title'], forum_link($forum_url['index']));
324 $forum_page['crumbs'][] = array($cur_posting['forum_name'], forum_link($forum_url['forum'], array($cur_posting['id'], sef_friendly($cur_posting['forum_name']))));
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
325 if ($tid)
326 $forum_page['crumbs'][] = array($cur_posting['subject'], forum_link($forum_url['topic'], array($tid, sef_friendly($cur_posting['subject']))));
07959a2 Development version of PunBB 1.3
Anatoly authored
327 $forum_page['crumbs'][] = $tid ? $lang_post['Post reply'] : $lang_post['Post new topic'];
328
329 ($hook = get_hook('po_pre_header_load')) ? eval($hook) : null;
330
331 define('FORUM_PAGE', 'post');
332 require FORUM_ROOT.'header.php';
333
334 // START SUBST - <!-- forum_main -->
335 ob_start();
336
337 ($hook = get_hook('po_main_output_start')) ? eval($hook) : null;
338
6cfabc2 Markup: added main-head in edit.php, fixed main-head in post.php. Min…
Anatoly authored
339 ?>
340 <div class="main-head">
341 <h2 class="hn"><span><?php echo $tid ? $lang_post['Post reply'] : $lang_post['Post new topic'] ?></span></h2>
342 </div>
343 <?php
344
07959a2 Development version of PunBB 1.3
Anatoly authored
345 // If preview selected and there are no errors
346 if (isset($_POST['preview']) && empty($errors))
347 {
348 if (!defined('FORUM_PARSER_LOADED'))
349 require FORUM_ROOT.'include/parser.php';
806afa0 Added constants to various included files.
Anatoly authored
350
a096817 Globally replacing trim() with forum_trim().
Anatoly authored
351 $forum_page['preview_message'] = parse_message(forum_trim($message), $hide_smilies);
07959a2 Development version of PunBB 1.3
Anatoly authored
352
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
353 // Generate the post heading
354 $forum_page['post_ident'] = array();
355 $forum_page['post_ident']['num'] = '<span class="post-num">#</span>';
356 $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf((($tid) ? $lang_post['Reply byline'] : $lang_post['Topic byline']), '<strong>'.forum_htmlencode($forum_user['username']).'</strong>').'</span>';
357 $forum_page['post_ident']['link'] = '<span class="post-link">'.format_time(time()).'</span>';
358
359 ($hook = get_hook('po_preview_pre_display')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
360
361 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
362 <div class="main-subhead">
363 <h2 class="hn"><span><?php echo $tid ? $lang_post['Preview reply'] : $lang_post['Preview new topic']; ?></span></h2>
364 </div>
365 <div id="post-preview" class="main-content main-frm">
366 <div class="post singlepost">
c09198d post.php: fixed HTML-code indentation
Roman authored
367 <div class="posthead">
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
368 <h3 class="hn"><?php echo implode(' ', $forum_page['post_ident']) ?></h3>
369 <?php ($hook = get_hook('po_preview_new_post_head_option')) ? eval($hook) : null; ?>
07959a2 Development version of PunBB 1.3
Anatoly authored
370 </div>
c09198d post.php: fixed HTML-code indentation
Roman authored
371 <div class="postbody">
372 <div class="post-entry">
373 <div class="entry-content">
374 <?php echo $forum_page['preview_message']."\n" ?>
375 </div>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
376 <?php ($hook = get_hook('po_preview_new_post_entry_data')) ? eval($hook) : null; ?>
07959a2 Development version of PunBB 1.3
Anatoly authored
377 </div>
378 </div>
379 </div>
380 </div>
381 <?php
382
383 }
384
385 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
386 <div class="main-subhead">
387 <h2 class="hn"><span><?php echo ($tid) ? $lang_post['Compose your reply'] : $lang_post['Compose your topic'] ?></span></h2>
388 </div>
389 <div id="post-form" class="main-content main-frm">
07959a2 Development version of PunBB 1.3
Anatoly authored
390 <?php
391
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
392 if (!empty($forum_page['text_options']))
393 echo "\t\t".'<p class="ct-options options">'.sprintf($lang_common['You may use'], implode(' ', $forum_page['text_options'])).'</p>'."\n";
394
07959a2 Development version of PunBB 1.3
Anatoly authored
395 // If there were any errors, show them
396 if (!empty($errors))
397 {
398 $forum_page['errors'] = array();
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
399 foreach ($errors as $cur_error)
07959a2 Development version of PunBB 1.3
Anatoly authored
400 $forum_page['errors'][] = '<li class="warn"><span>'.$cur_error.'</span></li>';
401
402 ($hook = get_hook('po_pre_post_errors')) ? eval($hook) : null;
403
404 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
405 <div class="ct-box error-box">
ca8a458 post.php: fixed markup (continuing [853]).
Roman authored
406 <h2 class="warn hn"><?php echo $lang_post['Post errors'] ?></h2>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
407 <ul class="error-list">
408 <?php echo implode("\n\t\t\t\t", $forum_page['errors'])."\n" ?>
409 </ul>
410 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
411 <?php
412
413 }
414
415 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
416 <div id="req-msg" class="req-warn ct-box error-box">
417 <p><?php printf($lang_common['Required warn'], '<em>'.$lang_common['Required'].'</em>') ?></p>
07959a2 Development version of PunBB 1.3
Anatoly authored
418 </div>
45d7e50 @dimkalinux Add ctrl-enter submit to post forms
dimkalinux authored
419 <form id="afocus" class="frm-form frm-ctrl-submit" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>"<?php if (!empty($forum_page['form_attributes'])) echo ' '.implode(' ', $forum_page['form_attributes']) ?>>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
420 <div class="hidden">
421 <?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields'])."\n" ?>
422 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
423 <?php
424
425 if ($forum_user['is_guest'])
426 {
427 $forum_page['email_form_name'] = ($forum_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
428
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
429 ($hook = get_hook('po_pre_guest_info_fieldset')) ? eval($hook) : null;
430
07959a2 Development version of PunBB 1.3
Anatoly authored
431 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
432 <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
433 <legend class="group-legend"><strong><?php echo $lang_post['Guest post legend'] ?></strong></legend>
434 <?php ($hook = get_hook('po_pre_guest_username')) ? eval($hook) : null; ?>
435 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
436 <div class="sf-box text required">
ee8fdac @dimkalinux Remove "Required" label description
dimkalinux authored
437 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Guest name'] ?></span></label><br />
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
438 <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="req_username" value="<?php if (isset($_POST['req_username'])) echo forum_htmlencode($username); ?>" size="35" maxlength="25" /></span>
439 </div>
440 </div>
441 <?php ($hook = get_hook('po_pre_guest_email')) ? eval($hook) : null; ?>
442 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
443 <div class="sf-box text<?php if ($forum_config['p_force_guest_email'] == '1') echo ' required' ?>">
444 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Guest e-mail'] ?><?php if ($forum_config['p_force_guest_email'] == '1') echo ' <em>'.$lang_common['Required'].'</em>' ?></span></label><br />
4677ecb @dimkalinux Change form elements to HTML5 and add attributes
dimkalinux authored
445 <span class="fld-input"><input type="email" id="fld<?php echo $forum_page['fld_count'] ?>" name="<?php echo $forum_page['email_form_name'] ?>" value="<?php if (isset($_POST[$forum_page['email_form_name']])) echo forum_htmlencode($email); ?>" size="35" maxlength="80" /></span>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
446 </div>
447 </div>
448 <?php ($hook = get_hook('po_pre_guest_info_fieldset_end')) ? eval($hook) : null; ?>
449 </fieldset>
07959a2 Development version of PunBB 1.3
Anatoly authored
450 <?php
451
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
452 ($hook = get_hook('po_guest_info_fieldset_end')) ? eval($hook) : null;
453
454 // Reset counters
455 $forum_page['group_count'] = $forum_page['item_count'] = 0;
07959a2 Development version of PunBB 1.3
Anatoly authored
456 }
457
458 ($hook = get_hook('po_pre_req_info_fieldset')) ? eval($hook) : null;
459
460 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
461 <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
462 <legend class="group-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend>
07959a2 Development version of PunBB 1.3
Anatoly authored
463 <?php
464
465 if ($fid)
466 {
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
467 ($hook = get_hook('po_pre_req_subject')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
468
469 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
470 <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
471 <div class="sf-box text required longtext">
ee8fdac @dimkalinux Remove "Required" label description
dimkalinux authored
472 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Topic subject'] ?></span></label><br />
4677ecb @dimkalinux Change form elements to HTML5 and add attributes
dimkalinux authored
473 <span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo forum_htmlencode($subject); ?>" size="70" maxlength="70" required /></span>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
474 </div>
475 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
476 <?php
477
478 }
479
480 ($hook = get_hook('po_pre_post_contents')) ? eval($hook) : null;
481
482 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
483 <div class="txt-set set<?php echo ++$forum_page['item_count'] ?>">
484 <div class="txt-box textarea required">
ee8fdac @dimkalinux Remove "Required" label description
dimkalinux authored
485 <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_post['Write message'] ?></span></label>
844b1fb @dimkalinux Add spellcheck and novalidate attr in post/edit forms
dimkalinux authored
486 <div class="txt-input"><span class="fld-input"><textarea id="fld<?php echo $forum_page['fld_count'] ?>" name="req_message" rows="14" cols="95" required spellcheck="true"><?php echo isset($_POST['req_message']) ? forum_htmlencode($message) : (isset($forum_page['quote']) ? forum_htmlencode($forum_page['quote']) : ''); ?></textarea></span></div>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
487 </div>
488 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
489 <?php
490
491 $forum_page['checkboxes'] = array();
492 if ($forum_config['o_smilies'] == '1')
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
493 $forum_page['checkboxes']['hide_smilies'] = '<div class="mf-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="hide_smilies" value="1"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' /></span> <label for="fld'.$forum_page['fld_count'].'">'.$lang_post['Hide smilies'].'</label></div>';
07959a2 Development version of PunBB 1.3
Anatoly authored
494
495 // Check/uncheck the checkbox for subscriptions depending on scenario
496 if (!$forum_user['is_guest'] && $forum_config['o_subscriptions'] == '1')
497 {
498 $subscr_checked = false;
499
500 // If it's a preview
501 if (isset($_POST['preview']))
502 $subscr_checked = isset($_POST['subscribe']) ? true : false;
503 // If auto subscribed
504 else if ($forum_user['auto_notify'])
505 $subscr_checked = true;
506 // If already subscribed to the topic
507 else if ($is_subscribed)
508 $subscr_checked = true;
509
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
510 $forum_page['checkboxes']['subscribe'] = '<div class="mf-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="subscribe" value="1"'.($subscr_checked ? ' checked="checked"' : '').' /></span> <label for="fld'.$forum_page['fld_count'].'">'.($is_subscribed ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'</label></div>';
07959a2 Development version of PunBB 1.3
Anatoly authored
511 }
512
513 ($hook = get_hook('po_pre_optional_fieldset')) ? eval($hook) : null;
514
515 if (!empty($forum_page['checkboxes']))
516 {
517
518 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
519 <fieldset class="mf-set set<?php echo ++$forum_page['item_count'] ?>">
520 <div class="mf-box checkbox">
521 <?php echo implode("\n\t\t\t\t\t", $forum_page['checkboxes'])."\n"; ?>
522 </div>
523 <?php ($hook = get_hook('po_pre_checkbox_fieldset_end')) ? eval($hook) : null; ?>
524 </fieldset>
07959a2 Development version of PunBB 1.3
Anatoly authored
525 <?php
526
527 }
528
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
529 ($hook = get_hook('po_pre_req_info_fieldset_end')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
530
531 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
532 </fieldset>
533 <?php
07959a2 Development version of PunBB 1.3
Anatoly authored
534
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
535 ($hook = get_hook('po_req_info_fieldset_end')) ? eval($hook) : null;
536
537 ?>
538 <div class="frm-buttons">
da6b315 @dimkalinux Change .default to .primary buttons style
dimkalinux authored
539 <span class="submit primary"><input type="submit" name="submit" value="<?php echo ($tid) ? $lang_post['Submit reply'] : $lang_post['Submit topic'] ?>" /></span>
79d0aa2 @dimkalinux Remove novalidate attr in post/edit forms
dimkalinux authored
540 <span class="submit"><input type="submit" name="preview" value="<?php echo ($tid) ? $lang_post['Preview reply'] : $lang_post['Preview topic'] ?>" /></span>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
541 </div>
542 </form>
543 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
544 <?php
545
546
547 // Check if the topic review is to be displayed
548 if ($tid && $forum_config['o_topic_review'] != '0')
549 {
550 if (!defined('FORUM_PARSER_LOADED'))
551 require FORUM_ROOT.'include/parser.php';
552
eddcee3 Fixed inverse numeration on post preview (reported by maststef). Remo…
Roman authored
553 // Get the amount of posts in the topic
554 $query = array(
555 'SELECT' => 'count(p.id)',
556 'FROM' => 'posts AS p',
557 'WHERE' => 'topic_id='.$tid
558 );
559
560 ($hook = get_hook('po_topic_review_qr_get_post_count')) ? eval($hook) : null;
561 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
562 $forum_page['total_post_count'] = $forum_db->result($result, 0);
563
07959a2 Development version of PunBB 1.3
Anatoly authored
564 // Get posts to display in topic review
565 $query = array(
566 'SELECT' => 'p.id, p.poster, p.message, p.hide_smilies, p.posted',
567 'FROM' => 'posts AS p',
568 'WHERE' => 'topic_id='.$tid,
eddcee3 Fixed inverse numeration on post preview (reported by maststef). Remo…
Roman authored
569 'ORDER BY' => 'id DESC',
570 'LIMIT' => $forum_config['o_topic_review']
07959a2 Development version of PunBB 1.3
Anatoly authored
571 );
572
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
573 ($hook = get_hook('po_topic_review_qr_get_topic_review_posts')) ? eval($hook) : null;
07959a2 Development version of PunBB 1.3
Anatoly authored
574 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
575
be36ba8 @dimkalinux Partialy remove num_rows from post.php
dimkalinux authored
576 $posts = array();
577 while ($cur_post = $forum_db->fetch_assoc($result))
578 {
579 $posts[] = $cur_post;
580 }
581
07959a2 Development version of PunBB 1.3
Anatoly authored
582 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
583 <div class="main-subhead">
584 <h2 class="hn"><span><?php echo $lang_post['Topic review'] ?></span></h2>
07959a2 Development version of PunBB 1.3
Anatoly authored
585 </div>
6cfabc2 Markup: added main-head in edit.php, fixed main-head in post.php. Min…
Anatoly authored
586 <div id="topic-review" class="main-content main-frm">
07959a2 Development version of PunBB 1.3
Anatoly authored
587 <?php
588
589 $forum_page['item_count'] = 0;
be36ba8 @dimkalinux Partialy remove num_rows from post.php
dimkalinux authored
590 $forum_page['item_total'] = count($posts);
07959a2 Development version of PunBB 1.3
Anatoly authored
591
be36ba8 @dimkalinux Partialy remove num_rows from post.php
dimkalinux authored
592 foreach ($posts as $cur_post)
07959a2 Development version of PunBB 1.3
Anatoly authored
593 {
594 ++$forum_page['item_count'];
595
596 $forum_page['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
597
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
598 // Generate the post heading
599 $forum_page['post_ident'] = array();
eddcee3 Fixed inverse numeration on post preview (reported by maststef). Remo…
Roman authored
600 $forum_page['post_ident']['num'] = '<span class="post-num">'.forum_number_format($forum_page['total_post_count'] - $forum_page['item_count'] + 1).'</span>';
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
601 $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf($lang_post['Post byline'], '<strong>'.forum_htmlencode($cur_post['poster']).'</strong>').'</span>';
602 $forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" rel="bookmark" title="'.$lang_post['Permalink post'].'" href="'.forum_link($forum_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).'</a></span>';
603
07959a2 Development version of PunBB 1.3
Anatoly authored
604 ($hook = get_hook('po_topic_review_row_pre_display')) ? eval($hook) : null;
605
606 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
607 <div class="post<?php echo ($forum_page['item_count'] == 1) ? ' firstpost' : '' ?><?php echo ($forum_page['item_total'] == $forum_page['item_count']) ? ' lastpost' : '' ?>">
608 <div class="posthead">
609 <h3 class="hn post-ident"><?php echo implode(' ', $forum_page['post_ident']) ?></h3>
610 <?php ($hook = get_hook('po_topic_review_new_post_head_option')) ? eval($hook) : null; ?>
07959a2 Development version of PunBB 1.3
Anatoly authored
611 </div>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
612 <div class="postbody">
613 <div class="post-entry">
614 <div class="entry-content">
615 <?php echo $forum_page['message']."\n" ?>
616 <?php ($hook = get_hook('po_topic_review_new_post_entry_data')) ? eval($hook) : null; ?>
617 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
618 </div>
619 </div>
620 </div>
621 <?php
622
623 }
624
625 ?>
0a8534c Merged new markup (based on markup by Paul Sullivan) into main PunBB …
Anatoly authored
626 </div>
07959a2 Development version of PunBB 1.3
Anatoly authored
627 <?php
628
629 }
630
631 $forum_id = $cur_posting['id'];
632
633 ($hook = get_hook('po_end')) ? eval($hook) : null;
634
a096817 Globally replacing trim() with forum_trim().
Anatoly authored
635 $tpl_temp = forum_trim(ob_get_contents());
07959a2 Development version of PunBB 1.3
Anatoly authored
636 $tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
637 ob_end_clean();
638 // END SUBST - <!-- forum_main -->
639
640 require FORUM_ROOT.'footer.php';
Something went wrong with that request. Please try again.