Completed
Push — release-2.1 ( e6c696...22bfba )
by Mathias
07:04
created

Themes/default/Display.template.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines http://www.simplemachines.org
7
 * @copyright 2016 Simple Machines and individual contributors
8
 * @license http://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 Beta 3
11
 */
12
13
/**
14
 * This tempate handles displaying a topic
15
 */
16
function template_main()
17
{
18
	global $context, $settings, $options, $txt, $scripturl, $modSettings;
19
20
	// Let them know, if their report was a success!
21
	if ($context['report_sent'])
22
	{
23
		echo '
24
			<div class="infobox">
25
				', $txt['report_sent'], '
26
			</div>';
27
	}
28
29
	// Let them know why their message became unapproved.
30
	if ($context['becomesUnapproved'])
31
	{
32
		echo '
33
			<div class="noticebox">
34
				', $txt['post_becomesUnapproved'], '
35
			</div>';
36
	}
37
38
	// Show new topic info here?
39
	echo '
40
		<div id="display_head" class="information">
41
			<h2 class="display_title"><span id="top_subject">', $context['subject'], '</span>', ($context['is_locked']) ? ' <span class="generic_icons lock"></span>' : '', ($context['is_sticky']) ? ' <span class="generic_icons sticky"></span>' : '', '</h2>
42
			<p>',$txt['started_by'],' ', $context['topic_poster_name'],', ', $context['topic_started_time'],'</p>';
43
44
	// Next - Prev
45
	echo '
46
		<span class="nextlinks floatright">', $context['previous_next'], '</span>';
47
48 View Code Duplication
	if (!empty($settings['display_who_viewing']))
49
	{
50
		echo '
51
				<p>';
52
53
		// Show just numbers...?
54
		if ($settings['display_who_viewing'] == 1)
55
				echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
56
		// Or show the actual people viewing the topic?
57
		else
58
			echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
59
60
		// Now show how many guests are here too.
61
		echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
62
				</p>';
63
	}
64
65
	// Show the anchor for the top and for the first message. If the first message is new, say so.
66
	echo '
67
		</div>
68
			<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
69
70
	// Is this topic also a poll?
71
	if ($context['is_poll'])
72
	{
73
		echo '
74
			<div id="poll">
75
				<div class="cat_bar">
76
					<h3 class="catbg">
77
						<span class="generic_icons poll"></span>', $context['poll']['is_locked'] ? '<span class="generic_icons lock"></span>' : '' ,' ', $context['poll']['question'], '
78
					</h3>
79
				</div>
80
				<div class="windowbg noup">
81
					<div id="poll_options">';
82
83
		// Are they not allowed to vote but allowed to view the options?
84
		if ($context['poll']['show_results'] || !$context['allow_vote'])
85
		{
86
			echo '
87
					<dl class="options">';
88
89
			// Show each option with its corresponding percentage bar.
90
			foreach ($context['poll']['options'] as $option)
91
			{
92
				echo '
93
						<dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
94
						<dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">';
95
96
				if ($context['allow_results_view'])
97
					echo '
98
							', $option['bar_ndt'], '
99
							<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
100
101
				echo '
102
						</dd>';
103
			}
104
105
			echo '
106
					</dl>';
107
108
			if ($context['allow_results_view'])
109
				echo '
110
						<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
111
		}
112
		// They are allowed to vote! Go to it!
113
		else
114
		{
115
			echo '
116
						<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
117
118
			// Show a warning if they are allowed more than one option.
119
			if ($context['poll']['allowed_warning'])
120
				echo '
121
							<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
122
123
			echo '
124
							<ul class="options">';
125
126
			// Show each option with its button - a radio likely.
127
			foreach ($context['poll']['options'] as $option)
128
				echo '
129
								<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
130
131
			echo '
132
							</ul>
133
							<div class="submitbutton">
134
								<input type="submit" value="', $txt['poll_vote'], '" class="button_submit">
135
								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
136
							</div>
137
						</form>';
138
		}
139
140
		// Is the clock ticking?
141
		if (!empty($context['poll']['expire_time']))
142
			echo '
143
						<p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';
144
145
		echo '
146
					</div>
147
				</div>
148
			</div>
149
			<div id="pollmoderation">';
150
151
		template_button_strip($context['poll_buttons']);
152
153
		echo '
154
			</div>';
155
	}
156
157
	// Does this topic have some events linked to it?
158
	if (!empty($context['linked_calendar_events']))
159
	{
160
		echo '
161
			<div class="title_bar">
162
				<h3 class="titlebg">', $txt['calendar_linked_events'], '</h3>
163
			</div>
164
			<div class="information">
165
				<ul>';
166
167
		foreach ($context['linked_calendar_events'] as $event)
168
		{
169
			echo '
170
					<li>
171
						<b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>';
172
173 View Code Duplication
			if ($event['can_edit'])
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
174
				echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
175
176 View Code Duplication
			if ($event['can_export'])
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
177
				echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
178
179
			echo '
180
						<br>';
181
182
			if (!empty($event['allday']))
183
			{
184
				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
185
			}
186
			else
187
			{
188
				// Display event info relative to user's local timezone
189
				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
190
191
				if ($event['start_date_local'] != $event['end_date_local'])
192
					echo trim($event['end_date_local']) . ', ';
193
194
				echo trim($event['end_time_local']);
195
196
				// Display event info relative to original timezone
197
				if ($event['start_date_local'] . $event['start_time_local'] != $event['start_date_orig'] . $event['start_time_orig'])
198
				{
199
					echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
200
201
					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
202
						echo trim($event['start_date_orig']), ', ';
203
204
					echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
205
206
					if ($event['start_date_orig'] != $event['end_date_orig'])
207
						echo trim($event['end_date_orig']) . ', ';
208
209
					echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
210
				}
211
				// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
212
				else
213
					echo ' ', $event['tz_abbrev'], '</time>';
214
			}
215
216
			if (!empty($event['location']))
217
				echo '<br>', $event['location'];
218
219
			echo '
220
					</li>';
221
		}
222
		echo '
223
				</ul>
224
			</div>';
225
	}
226
227
	// Show the page index... "Pages: [1]".
228
	echo '
229
			<div class="pagesection top">
230
				', template_button_strip($context['normal_buttons'], 'right'), '
231
				', $context['menu_separator'], '<a href="#bot" class="topbottom floatleft">', $txt['go_down'], '</a>
232
				<div class="pagelinks floatleft">
233
					', $context['page_index'], '
234
				</div>
235
			</div>';
236
237
	// Mobile action - moderation buttons (top)
238
	echo '
239
			<div class="mobile_buttons floatright">
240
				<a class="button mobile_act">', $txt['mobile_action'],'</a>
241
				', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">'. $txt['mobile_moderation'].'</a>' : '','
242
			</div>';
243
244
	// Show the topic information - icon, subject, etc.
245
	echo '
246
			<div id="forumposts">';
247
248
	echo '
249
				<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\') : false">';
250
251
	$context['ignoredMsgs'] = array();
252
	$context['removableMessageIDs'] = array();
253
254
	// Get all the messages...
255
	while ($message = $context['get_message']())
256
		template_single_post($message);
257
258
	echo '
259
				</form>
260
			</div>';
261
262
	// Mobile action - moderation buttons (bottom)
263
	echo '
264
			<div class="mobile_buttons floatright">
265
				<a class="button mobile_act">', $txt['mobile_action'],'</a>
266
				', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">'. $txt['mobile_moderation'].'</a>' : '','
267
			</div>';
268
269
	// Show the page index... "Pages: [1]".
270
	echo '
271
			<div class="pagesection">
272
				', template_button_strip($context['normal_buttons'], 'right'), '
273
				', $context['menu_separator'], '<a href="#main_content_section" class="topbottom floatleft" id="bot">', $txt['go_up'], '</a>
274
				<div class="pagelinks floatleft">
275
					', $context['page_index'], '
276
				</div>
277
			</div>';
278
279
	// Show the lower breadcrumbs.
280
	theme_linktree();
281
282
	// Moderation buttons
283
	echo '
284
			<div id="moderationbuttons">
285
				', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip')), '
286
			</div>';
287
288
	// Show the jumpto box, or actually...let Javascript do it.
289
	echo '
290
			<div id="display_jump_to">&nbsp;</div>';
291
292
	// Show quickreply
293
	if ($context['can_reply'])
294
	template_quickreply();
295
296
	// User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device.
297
	echo '
298
			<div id="mobile_action" class="popup_container">
299
				<div class="popup_window description">
300
					<div class="popup_heading">', $txt['mobile_action'],'
301
					<a href="javascript:void(0);" class="generic_icons hide_popup"></a></div>
302
					', template_button_strip($context['normal_buttons']), '
303
				</div>
304
			</div>';
305
306
	// Show the moderation button & pop only if user can moderate
307
	if ($context['can_moderate_forum'] || $context['user']['is_mod'])
308
		echo '
309
			<div id="mobile_moderation" class="popup_container">
310
				<div class="popup_window description">
311
					<div class="popup_heading">', $txt['mobile_moderation'],'
312
					<a href="javascript:void(0);" class="generic_icons hide_popup"></a></div>
313
					<div id="moderationbuttons_mobile">
314
						', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip_mobile')), '
315
					</div>
316
				</div>
317
			</div>';
318
319
		echo '
320
				<script>';
321
322
	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
323
	{
324
		echo '
325
					var oInTopicModeration = new InTopicModeration({
326
						sSelf: \'oInTopicModeration\',
327
						sCheckboxContainerMask: \'in_topic_mod_check_\',
328
						aMessageIds: [\'', implode('\', \'', $context['removableMessageIDs']), '\'],
329
						sSessionId: smf_session_id,
330
						sSessionVar: smf_session_var,
331
						sButtonStrip: \'moderationbuttons\',
332
						sButtonStripDisplay: \'moderationbuttons_strip\',
333
						bUseImageButton: false,
334
						bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
335
						sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
336
						sRemoveButtonImage: \'delete_selected.png\',
337
						sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
338
						bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
339
						sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
340
						sRestoreButtonImage: \'restore_selected.png\',
341
						sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
342
						bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
343
						sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
344
						sSplitButtonImage: \'split_selected.png\',
345
						sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
346
						sFormId: \'quickModForm\'
347
					});';
348
349
		// Add it to the mobile button strip as well
350
		echo '
351
					var oInTopicModerationMobile = new InTopicModeration({
352
						sSelf: \'oInTopicModerationMobile\',
353
						sCheckboxContainerMask: \'in_topic_mod_check_\',
354
						aMessageIds: [\'', implode('\', \'', $context['removableMessageIDs']), '\'],
355
						sSessionId: smf_session_id,
356
						sSessionVar: smf_session_var,
357
						sButtonStrip: \'moderationbuttons_mobile\',
358
						sButtonStripDisplay: \'moderationbuttons_strip_mobile\',
359
						bUseImageButton: false,
360
						bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
361
						sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
362
						sRemoveButtonImage: \'delete_selected.png\',
363
						sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
364
						bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
365
						sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
366
						sRestoreButtonImage: \'restore_selected.png\',
367
						sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
368
						bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
369
						sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
370
						sSplitButtonImage: \'split_selected.png\',
371
						sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
372
						sFormId: \'quickModForm\'
373
					});';
374
	}
375
376
	echo '
377
					if (\'XMLHttpRequest\' in window)
378
					{
379
						var oQuickModify = new QuickModify({
380
							sScriptUrl: smf_scripturl,
381
							sClassName: \'quick_edit\',
382
							bShowModify: ', $modSettings['show_modify'] ? 'true' : 'false', ',
383
							iTopicId: ', $context['current_topic'], ',
384
							sTemplateBodyEdit: ', JavaScriptEscape('
385
								<div id="quick_edit_body_container">
386
									<div id="error_box" class="error"></div>
387
									<textarea class="editor" name="message" rows="12" style="margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br>
388
									<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '">
389
									<input type="hidden" name="topic" value="' . $context['current_topic'] . '">
390
									<input type="hidden" name="msg" value="%msg_id%">
391
									<div class="righttext quickModifyMargin">
392
										<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit">&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit">&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit">
393
									</div>
394
								</div>'), ',
395
							sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text">'), ',
396
							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
397
							sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
398
							sTemplateTopSubject: ', JavaScriptEscape('%subject%'), ',
399
							sTemplateReasonEdit: ', JavaScriptEscape($txt['reason_for_edit'] .': <input type="text" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text quickModifyMargin">'), ',
400
							sTemplateReasonNormal: ', JavaScriptEscape('%modify_text'), ',
401
							sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply']) ? ',
402
							sFormRemoveAccessKeys: \'postmodify\'' : '', '
403
						});
404
405
						aJumpTo[aJumpTo.length] = new JumpTo({
406
							sContainerId: "display_jump_to",
407
							sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', $context['jump_to']['label'], '<" + "/label> %dropdown_list%",
408
							iCurBoardId: ', $context['current_board'], ',
409
							iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
410
							sCurBoardName: "', $context['jump_to']['board_name'], '",
411
							sBoardChildLevelIndicator: "==",
412
							sBoardPrefix: "=> ",
413
							sCatSeparator: "-----------------------------",
414
							sCatPrefix: "",
415
							sGoButtonLabel: "', $txt['go'], '"
416
						});
417
418
						aIconLists[aIconLists.length] = new IconList({
419
							sBackReference: "aIconLists[" + aIconLists.length + "]",
420
							sIconIdPrefix: "msg_icon_",
421
							sScriptUrl: smf_scripturl,
422
							bShowModify: ', !empty($modSettings['show_modify']) ? 'true' : 'false', ',
423
							iBoardId: ', $context['current_board'], ',
424
							iTopicId: ', $context['current_topic'], ',
425
							sSessionId: smf_session_id,
426
							sSessionVar: smf_session_var,
427
							sLabelIconList: "', $txt['message_icon'], '",
428
							sBoxBackground: "transparent",
429
							sBoxBackgroundHover: "#ffffff",
430
							iBoxBorderWidthHover: 1,
431
							sBoxBorderColorHover: "#adadad" ,
432
							sContainerBackground: "#ffffff",
433
							sContainerBorder: "1px solid #adadad",
434
							sItemBorder: "1px solid #ffffff",
435
							sItemBorderHover: "1px dotted gray",
436
							sItemBackground: "transparent",
437
							sItemBackgroundHover: "#e0e0f0"
438
						});
439
					}';
440
441
	if (!empty($context['ignoredMsgs']))
442
		echo '
443
					ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
444
445
	echo '
446
				</script>';
447
}
448
449
/**
450
 * Template for displaying a single post.
451
 *
452
 * @param array $message An array of information about the message to display. Should have 'id' and 'member'. Can also have 'first_new', 'is_ignored' and 'css_class'.
453
 */
454
function template_single_post($message)
455
{
456
	global $context, $settings, $options, $txt, $scripturl, $modSettings;
457
458
	$ignoring = false;
459
460
	if ($message['can_remove'])
461
		$context['removableMessageIDs'][] = $message['id'];
462
463
	// Are we ignoring this message?
464
	if (!empty($message['is_ignored']))
465
	{
466
		$ignoring = true;
467
		$context['ignoredMsgs'][] = $message['id'];
468
	}
469
470
	// Show the message anchor and a "new" anchor if this message is new.
471
	echo '
472
				<div class="', $message['css_class'] ,'">', $message['id'] != $context['first_message'] ? '
473
					<a id="msg' . $message['id'] . '"></a>' . ($message['first_new'] ? '<a id="new"></a>' : '') : '', '
474
					<div class="post_wrapper">';
475
476
	// Show information about the poster of this message.
477
	echo '
478
						<div class="poster">';
479
480
	// Are there any custom fields above the member name?
481 View Code Duplication
	if (!empty($message['custom_fields']['above_member']))
482
	{
483
		echo '
484
							<div class="custom_fields_above_member">
485
								<ul class="nolist">';
486
487
		foreach ($message['custom_fields']['above_member'] as $custom)
488
			echo '
489
									<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
490
491
		echo '
492
								</ul>
493
							</div>';
494
	}
495
496
	echo '
497
									<h4>';
498
499
	// Show online and offline buttons?
500
	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
501
		echo '
502
								', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : '';
503
504
505
	// Show a link to the member's profile.
506
	echo '
507
								', $message['member']['link'], '
508
									</h4>';
509
510
	echo '
511
							<ul class="user_info">';
512
513
514
	// Show the user's avatar.
515 View Code Duplication
	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
516
		echo '
517
								<li class="avatar">
518
									<a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a>
519
								</li>';
520
521
	// Are there any custom fields below the avatar?
522 View Code Duplication
	if (!empty($message['custom_fields']['below_avatar']))
523
		foreach ($message['custom_fields']['below_avatar'] as $custom)
524
			echo '
525
								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
526
527
	// Show the post group icons, but not for guests.
528
	if (!$message['member']['is_guest'])
529
		echo '
530
								<li class="icons">', $message['member']['group_icons'], '</li>';
531
532
	// Show the member's primary group (like 'Administrator') if they have one.
533
	if (!empty($message['member']['group']))
534
		echo '
535
								<li class="membergroup">', $message['member']['group'], '</li>';
536
537
	// Show the member's custom title, if they have one.
538
	if (!empty($message['member']['title']))
539
		echo '
540
								<li class="title">', $message['member']['title'], '</li>';
541
542
	// Don't show these things for guests.
543
	if (!$message['member']['is_guest'])
544
	{
545
546
		// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
547
		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group']))
548
			echo '
549
								<li class="postgroup">', $message['member']['post_group'], '</li>';
550
551
		// Show how many posts they have made.
552 View Code Duplication
		if (!isset($context['disabled_fields']['posts']))
553
			echo '
554
								<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
555
556
		// Show their personal text?
557 View Code Duplication
		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb']))
558
			echo '
559
								<li class="blurb">', $message['member']['blurb'], '</li>';
560
561
		// Any custom fields to show as icons?
562 View Code Duplication
		if (!empty($message['custom_fields']['icons']))
563
		{
564
			echo '
565
								<li class="im_icons">
566
									<ol>';
567
568
			foreach ($message['custom_fields']['icons'] as $custom)
569
				echo '
570
										<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
571
572
			echo '
573
									</ol>
574
								</li>';
575
		}
576
577
		// Show the website and email address buttons.
578
		if ($message['member']['show_profile_buttons'])
579
		{
580
			echo '
581
								<li class="profile">
582
									<ol class="profile_icons">';
583
584
			// Don't show an icon if they haven't specified a website.
585 View Code Duplication
			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website']))
586
				echo '
587
										<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
588
589
			// Since we know this person isn't a guest, you *can* message them.
590 View Code Duplication
			if ($context['can_send_pm'])
591
				echo '
592
										<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
593
594
			// Show the email if necessary
595 View Code Duplication
			if (!empty($message['member']['email']) && $message['member']['show_email'])
596
				echo '
597
										<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
598
599
				echo '
600
									</ol>
601
								</li>';
602
		}
603
604
		// Any custom fields for standard placement?
605 View Code Duplication
		if (!empty($message['custom_fields']['standard']))
606
			foreach ($message['custom_fields']['standard'] as $custom)
607
				echo '
608
								<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>';
609
610
	}
611
	// Otherwise, show the guest's email.
612 View Code Duplication
	elseif (!empty($message['member']['email']) && $message['member']['show_email'])
613
		echo '
614
								<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
615
616
	// Show the IP to this user for this post - because you can moderate?
617
	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
618
		echo '
619
								<li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>';
620
621
	// Or, should we show it because this is you?
622
	elseif ($message['can_see_ip'])
623
		echo '
624
								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>';
625
626
	// Okay, are you at least logged in? Then we can show something about why IPs are logged...
627
	elseif (!$context['user']['is_guest'])
628
		echo '
629
								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>';
630
631
	// Otherwise, you see NOTHING!
632
	else
633
		echo '
634
								<li class="poster_ip">', $txt['logged'], '</li>';
635
636
	// Are we showing the warning status?
637
	// Don't show these things for guests.
638
	if (!$message['member']['is_guest'] && $message['member']['can_see_warning'])
639
		echo '
640
								<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
641
642
	// Are there any custom fields to show at the bottom of the poster info?
643 View Code Duplication
	if (!empty($message['custom_fields']['bottom_poster']))
644
		foreach ($message['custom_fields']['bottom_poster'] as $custom)
645
			echo '
646
									<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
647
648
	// Poster info ends.
649
	echo '
650
							</ul>';
651
	echo '
652
						</div>
653
						<div class="postarea">
654
							<div class="keyinfo">
655
								<div class="messageicon" ', ($message['icon_url'] !== $settings['images_url'] . '/post/xx.png') ? '' : 'style="position: absolute; z-index: -1;"', '>
656
									<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', '>
657
								</div>';
658
659
	//Some people don't want subject ... The div is still required or quick edit breaks...
660
	echo '
661
								<div id="subject_', $message['id'], '" class="subject_title">', (empty($modSettings['subject_toggle']) ? '' : '<a href="' . $message['href'] . '" rel="nofollow">' . $message['subject'] . '</a>'), '</div>';
662
663
	echo '
664
								<div class="page_number floatright">
665
									', !empty($message['counter']) ? ' #' . $message['counter'] : '', ' ', '
666
								</div>
667
								<h5>
668
									<a href="', $message['href'], '" rel="nofollow" title="', !empty($message['counter']) ? sprintf($txt['reply_number'], $message['counter'], ' - ') : '', $message['subject'], '" class="smalltext">', $message['time'], '</a>';
669
670
	// Show "<< Last Edit: Time by Person >>" if this post was edited. But we need the div even if it wasn't modified!
671
	// Because we insert into it through AJAX and we don't want to stop themers moving it around if they so wish so they can put it where they want it.
672
	echo '
673
									<span class="smalltext modified" id="modified_', $message['id'], '">';
674
675
	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name']))
676
		echo
677
										$message['modified']['last_edit_text'];
678
679
	echo '
680
									</span>';
681
682
	echo '
683
								</h5>
684
								<div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' style="display:none;"' : '', '></div>
685
							</div>';
686
687
	// Ignoring this user? Hide the post.
688 View Code Duplication
	if ($ignoring)
689
		echo '
690
							<div id="msg_', $message['id'], '_ignored_prompt">
691
								', $txt['ignoring_user'], '
692
								<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
693
							</div>';
694
695
	// Show the post itself, finally!
696
	echo '
697
							<div class="post">';
698
699
	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
700
		echo '
701
								<div class="approve_post">
702
									', $txt['post_awaiting_approval'], '
703
								</div>';
704
	echo '
705
								<div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div>
706
							</div>';
707
708
	// Assuming there are attachments...
709
	if (!empty($message['attachment']))
710
	{
711
		$last_approved_state = 1;
712
		$attachments_per_line = 5;
713
		$i = 0;
714
		// Don't output the div unless we actually have something to show...
715
		$div_output = false;
716
717
		foreach ($message['attachment'] as $attachment)
718
		{
719
			// Do we want this attachment to not be showed here?
720
			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']]))
721
				continue;
722
			elseif (!$div_output)
723
			{
724
				$div_output = true;
725
726
				echo '
727
							<div id="msg_', $message['id'], '_footer" class="attachments"', $ignoring ? ' style="display:none;"' : '', '>';
728
			}
729
730
			// Show a special box for unapproved attachments...
731
			if ($attachment['is_approved'] != $last_approved_state)
732
			{
733
				$last_approved_state = 0;
734
				echo '
735
								<fieldset>
736
									<legend>', $txt['attach_awaiting_approve'];
737
738
				if ($context['can_approve'])
739
					echo '
740
										&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
741
742
				echo '
743
									</legend>';
744
			}
745
746
			echo '
747
									<div class="floatleft attached">';
748
749
			if ($attachment['is_image'])
750
			{
751
				echo '
752
										<div class="attachments_top">';
753
754
				if ($attachment['thumbnail']['has_thumb'])
755
					echo '
756
											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>';
757
				else
758
					echo '
759
											<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">';
760
761
				echo '
762
										</div>';
763
			}
764
765
			echo '
766
										<div class="attachments_bot">
767
											<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*">&nbsp;' . $attachment['name'] . '</a> ';
768
769
			if (!$attachment['is_approved'] && $context['can_approve'])
770
				echo '
771
											[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
772
			echo '
773
											<br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), '
774
										</div>';
775
776
			echo '
777
									</div>';
778
779
			// Next attachment line ?
780
			if (++$i % $attachments_per_line === 0)
781
				echo '
782
									<br>';
783
		}
784
785
		// If we had unapproved attachments clean up.
786
		if ($last_approved_state == 0)
787
			echo '
788
								</fieldset>';
789
790
		// Only do this if we output a div above - otherwise it'll break things
791
		if ($div_output)
792
			echo '
793
							</div>';
794
	}
795
796
	// And stuff below the attachments.
797 View Code Duplication
	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
798
	echo '
799
							<div class="under_message">';
800
801
	// Maybe they want to report this post to the moderator(s)?
802
	if ($context['can_report_moderator'])
803
		echo '
804
								<ul class="floatright smalltext">
805
									<li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li>
806
								</ul>';
807
808
	// What about likes?
809
	if (!empty($modSettings['enable_likes']))
810
	{
811
		echo '
812
								<ul class="floatleft">';
813
814
		if (!empty($message['likes']['can_like']))
815
		{
816
			echo '
817
									<li class="like_button" id="msg_', $message['id'], '_likes"', $ignoring ? ' style="display:none;"' : '', '><a href="', $scripturl, '?action=likes;ltype=msg;sa=like;like=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="msg_like"><span class="generic_icons ', $message['likes']['you'] ? 'unlike' : 'like', '"></span> ', $message['likes']['you'] ? $txt['unlike'] : $txt['like'], '</a></li>';
818
		}
819
820 View Code Duplication
		if (!empty($message['likes']['count']) && !empty($context['can_see_likes']))
821
		{
822
			$context['some_likes'] = true;
823
			$count = $message['likes']['count'];
824
			$base = 'likes_';
825
			if ($message['likes']['you'])
826
			{
827
				$base = 'you_' . $base;
828
				$count--;
829
			}
830
			$base .= (isset($txt[$base . $count])) ? $count : 'n';
831
832
			echo '
833
									<li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $message['id'] .';'. $context['session_var'] .'='. $context['session_id'], comma_format($count)), '</li>';
834
		}
835
836
		echo '
837
								</ul>';
838
	}
839
840
	// Show the quickbuttons, for various operations on posts.
841
	if ($message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
842
	{
843
		echo '
844
								<ul class="quickbuttons">';
845
846
		// Can they quote? if so they can select and quote as well!
847
		if ($context['can_quote'])
848
			echo '
849
									<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>
850
									<li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>';
851
852
		// Can the user modify the contents of this post? Show the modify inline image.
853
		if ($message['can_modify'])
854
			echo '
855
									<li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>';
856
857 View Code Duplication
		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
858
			echo '
859
									<li class="post_options">', $txt['post_options'];
860
861
		echo '
862
										<ul>';
863
864
		// Can the user modify the contents of this post?
865
		if ($message['can_modify'])
866
			echo '
867
											<li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>';
868
869
		// How about... even... remove it entirely?!
870
		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id']))
871
			echo '
872
											<li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>';
873 View Code Duplication
		elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id']))
874
			echo '
875
											<li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'] ,'" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
876
877
		// What about splitting it off the rest of the topic?
878
		if ($context['can_split'] && !empty($context['real_num_replies']))
879
			echo '
880
											<li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>';
881
882
		// Can we issue a warning because of this post? Remember, we can't give guests warnings.
883
		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
884
			echo '
885
											<li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>';
886
887
		// Can we restore topics?
888
		if ($context['can_restore_msg'])
889
			echo '
890
											<li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>';
891
892
		// Maybe we can approve it, maybe we should?
893
		if ($message['can_approve'])
894
			echo '
895
											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>';
896
897
		// Maybe we can unapprove it?
898
		if ($message['can_unapprove'])
899
			echo '
900
											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>';
901
902
		echo '
903
										</ul>
904
									</li>';
905
906
		// Show a checkbox for quick moderation?
907 View Code Duplication
		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
908
			echo '
909
									<li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
910
911 View Code Duplication
		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
912
			echo '
913
								</ul>';
914
	}
915
916 View Code Duplication
	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
917
	echo '
918
							</div>';
919
920
	echo '
921
						</div>
922
						<div class="moderatorbar">';
923
924
	// Are there any custom profile fields for above the signature?
925 View Code Duplication
	if (!empty($message['custom_fields']['above_signature']))
926
	{
927
		echo '
928
							<div class="custom_fields_above_signature">
929
								<ul class="nolist">';
930
931
		foreach ($message['custom_fields']['above_signature'] as $custom)
932
			echo '
933
									<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
934
935
		echo '
936
								</ul>
937
							</div>';
938
	}
939
940
	// Show the member's signature?
941
	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
942
		echo '
943
							<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>';
944
945
946
	// Are there any custom profile fields for below the signature?
947 View Code Duplication
	if (!empty($message['custom_fields']['below_signature']))
948
	{
949
		echo '
950
							<div class="custom_fields_below_signature">
951
								<ul class="nolist">';
952
953
		foreach ($message['custom_fields']['below_signature'] as $custom)
954
			echo '
955
									<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
956
957
		echo '
958
								</ul>
959
							</div>';
960
	}
961
962
	echo '
963
						</div>
964
					</div>
965
				</div>
966
				<hr class="post_separator">';
967
}
968
969
/**
970
 * The template for displaying the quick reply box.
971
 */
972
function template_quickreply()
973
{
974
	global $context, $modSettings, $scripturl, $options, $txt;
975
	echo '
976
		<a id="quickreply"></a>
977
		<div class="tborder" id="quickreplybox">
978
			<div class="cat_bar">
979
				<h3 class="catbg">
980
					', $txt['quick_reply'], '
981
				</h3>
982
			</div>
983
			<div id="quickReplyOptions">
984
				<div class="roundframe">', empty($options['use_editor_quick_reply']) ? '
985
					<p class="smalltext lefttext">' . $txt['quick_reply_desc'] . '</p>' : '', '
986
					', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '',
987
					!empty($context['oldTopicError']) ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
988
					', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
989
					', !$context['can_reply_approved'] && $context['require_verification'] ? '<br>' : '', '
990
					<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);">
991
						<input type="hidden" name="topic" value="', $context['current_topic'], '">
992
						<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '">
993
						<input type="hidden" name="icon" value="xx">
994
						<input type="hidden" name="from_qr" value="1">
995
						<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '">
996
						<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '">
997
						<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '">
998
						<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">
999
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1000
						<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">';
1001
1002
		// Guests just need more.
1003
		if ($context['user']['is_guest'])
1004
			echo '
1005
						<dl id="post_header">
1006
							<dt>
1007
								', $txt['name'], ':
1008
							</dt>
1009
							<dd>
1010
								<input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text">
1011
							</dd>
1012
							<dt>
1013
								', $txt['email'], ':
1014
							</dt>
1015
							<dd>
1016
								<input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required>
1017
							</dd>
1018
						</dl>';
1019
1020
		echo '
1021
						', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
1022
						<script>
1023
							function insertQuoteFast(messageid)
1024
							{
1025
								if (window.XMLHttpRequest)
1026
									getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
1027
								else
1028
									reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
1029
								return false;
1030
							}
1031
							function onDocReceived(XMLDoc)
1032
							{
1033
								var text = \'\';
1034
								for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
1035
									text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
1036
								$("#', $context['post_box_name'], '").data("sceditor").InsertText(text);
1037
1038
								ajax_indicator(false);
1039
							}
1040
						</script>';
1041
1042
	// Is visual verification enabled?
1043 View Code Duplication
	if ($context['require_verification'])
1044
	{
1045
		echo '
1046
				<div class="post_verification">
1047
					<strong>', $txt['verification'], ':</strong>
1048
					', template_control_verification($context['visual_verification_id'], 'all'), '
1049
				</div>';
1050
	}
1051
1052
	// Finally, the submit buttons.
1053
	echo '
1054
				<br class="clear_right">
1055
				<span id="post_confirm_buttons">
1056
					', template_control_richedit_buttons($context['post_box_name']) ,'
1057
				</span>';
1058
		echo '
1059
					</form>
1060
				</div>
1061
			</div>
1062
		</div>
1063
		<br class="clear">';
1064
1065
	// draft autosave available and the user has it enabled?
1066
	if (!empty($context['drafts_autosave']))
1067
		echo '
1068
			<script>
1069
				var oDraftAutoSave = new smf_DraftAutoSave({
1070
					sSelf: \'oDraftAutoSave\',
1071
					sLastNote: \'draft_lastautosave\',
1072
					sLastID: \'id_draft\',', !empty($context['post_box_name']) ? '
1073
					sSceditorID: \'' . $context['post_box_name'] . '\',' : '', '
1074
					sType: \'', 'quick', '\',
1075
					iBoard: ', (empty($context['current_board']) ? 0 : $context['current_board']), ',
1076
					iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), '
1077
				});
1078
			</script>';
1079
1080
	if ($context['show_spellchecking'])
1081
		echo '
1082
			<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>';
1083
1084
	echo '
1085
				<script>
1086
					var oQuickReply = new QuickReply({
1087
						bDefaultCollapsed: false,
1088
						iTopicId: ', $context['current_topic'], ',
1089
						iStart: ', $context['start'], ',
1090
						sScriptUrl: smf_scripturl,
1091
						sImagesUrl: smf_images_url,
1092
						sContainerId: "quickReplyOptions",
1093
						sImageId: "quickReplyExpand",
1094
						sClassCollapsed: "toggle_up",
1095
						sClassExpanded: "toggle_down",
1096
						sJumpAnchor: "quickreply",
1097
						bIsFull: true
1098
					});
1099
					var oEditorID = "', $context['post_box_name'] ,'";
1100
					var oEditorObject = oEditorHandle_', $context['post_box_name'], ';
1101
					var oJumpAnchor = "quickreply";
1102
				</script>';
1103
}
1104
?>
1105