Issues (1061)

Themes/default/MessageIndex.template.php (7 issues)

1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines https://www.simplemachines.org
7
 * @copyright 2020 Simple Machines and individual contributors
8
 * @license https://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 RC2
11
 */
12
13
/**
14
 * The main messageindex.
15
 */
16
function template_main()
17
{
18
	global $context, $settings, $options, $scripturl, $modSettings, $txt;
19
20
	// Let them know why their message became unapproved.
21
	if ($context['becomesUnapproved'])
22
		echo '
23
	<div class="noticebox">
24
		', $txt['post_becomes_unapproved'], '
25
	</div>';
26
27
	if (!empty($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0))
28
	{
29
		echo '
30
	<div id="board_', $context['current_board'], '_childboards" class="boardindex_table">
31
		<div class="cat_bar">
32
			<h3 class="catbg">', $txt['sub_boards'], '</h3>
33
		</div>';
34
35
		foreach ($context['boards'] as $board)
36
		{
37
			echo '
38
		<div id="board_', $board['id'], '" class="up_contain ', (!empty($board['css_class']) ? $board['css_class'] : ''), '">
39
			<div class="board_icon">
40
				', function_exists('template_bi_' . $board['type'] . '_icon') ? call_user_func('template_bi_' . $board['type'] . '_icon', $board) : template_bi_board_icon($board), '
0 ignored issues
show
Are you sure the usage of template_bi_board_icon($board) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
41
			</div>
42
			<div class="info">
43
				', function_exists('template_bi_' . $board['type'] . '_info') ? call_user_func('template_bi_' . $board['type'] . '_info', $board) : template_bi_board_info($board), '
0 ignored issues
show
Are you sure the usage of template_bi_board_info($board) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
44
			</div><!-- .info -->';
45
46
			// Show some basic information about the number of posts, etc.
47
			echo '
48
			<div class="board_stats">
49
				', function_exists('template_bi_' . $board['type'] . '_stats') ? call_user_func('template_bi_' . $board['type'] . '_stats', $board) : template_bi_board_stats($board), '
0 ignored issues
show
Are you sure the usage of template_bi_board_stats($board) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
50
			</div>';
51
52
			// Show the last post if there is one.
53
			if(!empty($board['last_post']['id']))
54
				echo '
55
			<div class="lastpost lpr_border">
56
				', function_exists('template_bi_' . $board['type'] . '_lastpost') ? call_user_func('template_bi_' . $board['type'] . '_lastpost', $board) : template_bi_board_lastpost($board), '
0 ignored issues
show
Are you sure the usage of template_bi_board_lastpost($board) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
57
			</div>';
58
59
			// Won't somebody think of the children!
60
			if (function_exists('template_bi_' . $board['type'] . '_children'))
61
				call_user_func('template_bi_' . $board['type'] . '_children', $board);
62
			else
63
				template_bi_board_children($board);
64
65
				echo '
66
		</div><!-- #board_[id] -->';
67
		}
68
69
		echo '
70
	</div><!-- #board_[current_board]_childboards -->';
71
	}
72
73
	if (!$context['no_topic_listing'])
74
	{
75
		// Mobile action buttons (top)
76
		if (!empty($context['normal_buttons']))
77
			echo '
78
	<div class="mobile_buttons floatright">
79
		<a class="button mobile_act">', $txt['mobile_action'], '</a>
80
	</div>';
81
82
		echo '
83
	<div class="pagesection">
84
		', $context['menu_separator'], '
85
		<div class="pagelinks floatleft">
86
			<a href="#bot" class="button">', $txt['go_down'], '</a>
87
			', $context['page_index'], '
88
		</div>
89
		', template_button_strip($context['normal_buttons'], 'right'), '
0 ignored issues
show
Are you sure the usage of template_button_strip($c...mal_buttons'], 'right') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
90
	</div>';
91
92
		if ($context['description'] != '' || !empty($context['moderators']))
93
		{
94
			echo '
95
	<div id="description_board" class="generic_list_wrapper">
96
		<h3>', $context['name'], '</h3>
97
		<div>';
98
99
			if ($context['description'] != '')
100
				echo '
101
			', $context['description'];
102
103
			if (!empty($context['moderators']))
104
				echo '
105
			', count($context['moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $context['link_moderators']), '.';
106
107
			echo '
108
		</div>
109
	</div>';
110
		}
111
112
		// If Quick Moderation is enabled start the form.
113
		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
114
			echo '
115
	<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" class="clear" name="quickModForm" id="quickModForm">';
116
117
		echo '
118
		<div id="messageindex">';
119
120
		if (!empty($settings['display_who_viewing']))
121
		{
122
			echo '
123
			<div class="information">';
124
125
			if ($settings['display_who_viewing'] == 1)
126
				echo count($context['view_members']), ' ', count($context['view_members']) === 1 ? $txt['who_member'] : $txt['members'];
127
128
			else
129
				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'] . ')');
130
			echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'];
131
132
			echo '
133
			</div>';
134
		}
135
136
		echo '
137
			<div class="title_bar" id="topic_header">';
138
139
		// Are there actually any topics to show?
140
		if (!empty($context['topics']))
141
		{
142
			echo '
143
				<div class="board_icon"></div>
144
				<div class="info">', $context['topics_headers']['subject'], ' / ', $context['topics_headers']['starter'], '</div>
145
				<div class="board_stats centertext">', $context['topics_headers']['replies'], ' / ', $context['topics_headers']['views'], '</div>
146
				<div class="lastpost">', $context['topics_headers']['last_post'], '</div>';
147
148
			// Show a "select all" box for quick moderation?
149
			if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
150
				echo '
151
				<div class="moderation">
152
					<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');">
153
				</div>';
154
155
			// If it's on in "image" mode, don't show anything but the column.
156
			elseif (!empty($context['can_quick_mod']))
157
				echo '
158
				<div class="moderation"></div>';
159
		}
160
161
		// No topics... just say, "sorry bub".
162
		else
163
			echo '
164
				<h3 class="titlebg">', $txt['topic_alert_none'], '</h3>';
165
166
		echo '
167
			</div><!-- #topic_header -->';
168
169
		// If this person can approve items and we have some awaiting approval tell them.
170
		if (!empty($context['unapproved_posts_message']))
171
			echo '
172
			<div class="information">
173
				<span class="alert">!</span> ', $context['unapproved_posts_message'], '
174
			</div>';
175
176
		// Contain the topic list
177
		echo '
178
			<div id="topic_container">';
179
180
		foreach ($context['topics'] as $topic)
181
		{
182
			echo '
183
				<div class="', $topic['css_class'], '">
184
					<div class="board_icon">
185
						<img src="', $topic['first_post']['icon_url'], '" alt="">
186
						', $topic['is_posted_in'] ? '<img class="posted" src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="">' : '', '
187
					</div>
188
					<div class="info', !empty($context['can_quick_mod']) ? '' : ' info_block', '">
189
						<div ', (!empty($topic['quick_mod']['modify']) ? 'id="topic_' . $topic['first_post']['id'] . '"  ondblclick="oQuickModifyTopic.modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\');"' : ''), '>';
190
191
			// Now we handle the icons
192
			echo '
193
							<div class="icons floatright">';
194
195
			if ($topic['is_watched'])
196
				echo '
197
								<span class="main_icons watch" title="', $txt['watching_this_topic'], '"></span>';
198
199
			if ($topic['is_locked'])
200
				echo '
201
								<span class="main_icons lock"></span>';
202
203
			if ($topic['is_sticky'])
204
				echo '
205
								<span class="main_icons sticky"></span>';
206
207
			if ($topic['is_redirect'])
208
				echo '
209
								<span class="main_icons move"></span>';
210
211
			if ($topic['is_poll'])
212
				echo '
213
								<span class="main_icons poll"></span>';
214
215
			echo '
216
							</div>';
217
218
			echo '
219
							<div class="message_index_title">
220
								', $topic['new'] && $context['user']['is_logged'] ? '<a href="' . $topic['new_href'] . '" id="newicon' . $topic['first_post']['id'] . '" class="new_posts">' . $txt['new'] . '</a>' : '', '
221
								<span class="preview', $topic['is_sticky'] ? ' bold_text' : '', '" title="', $topic[(empty($modSettings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '">
222
									<span id="msg_', $topic['first_post']['id'], '">', $topic['first_post']['link'], (!$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '</span>
223
								</span>
224
							</div>
225
							<p class="floatleft">
226
								', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
227
							</p>
228
							', !empty($topic['pages']) ? '<span id="pages' . $topic['first_post']['id'] . '" class="topic_pages">' . $topic['pages'] . '</span>' : '', '
229
							<br class="clear">
230
						</div><!-- #topic_[first_post][id] -->
231
					</div><!-- .info -->
232
					<div class="board_stats centertext">
233
						<p>', $txt['replies'], ': ', $topic['replies'], '<br>', $txt['views'], ': ', $topic['views'], '</p>
234
					</div>
235
					<div class="lastpost">
236
						<p>', sprintf($txt['last_post_topic'], '<a href="' . $topic['last_post']['href'] . '">' . $topic['last_post']['time'] . '</a>', $topic['last_post']['member']['link']), '</p>
237
					</div>';
238
239
			// Show the quick moderation options?
240
			if (!empty($context['can_quick_mod']))
241
			{
242
				echo '
243
					<div class="moderation">';
244
245
				if ($options['display_quick_mod'] == 1)
246
					echo '
247
						<input type="checkbox" name="topics[]" value="', $topic['id'], '">';
248
				else
249
				{
250
					// Check permissions on each and show only the ones they are allowed to use.
251
					if ($topic['quick_mod']['remove'])
252
						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="main_icons delete" title="', $txt['remove_topic'], '"></span></a>';
253
254
					if ($topic['quick_mod']['lock'])
255
						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="main_icons lock" title="', $topic['is_locked'] ? $txt['set_unlock'] : $txt['set_lock'], '"></span></a>';
256
257
					if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove'])
258
						echo '<br>';
259
260
					if ($topic['quick_mod']['sticky'])
261
						echo '<a href="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], ';actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="main_icons sticky" title="', $topic['is_sticky'] ? $txt['set_nonsticky'] : $txt['set_sticky'], '"></span></a>';
262
263
					if ($topic['quick_mod']['move'])
264
						echo '<a href="', $scripturl, '?action=movetopic;current_board=', $context['current_board'], ';board=', $context['current_board'], '.', $context['start'], ';topic=', $topic['id'], '.0"><span class="main_icons move" title="', $txt['move_topic'], '"></span></a>';
265
				}
266
				echo '
267
					</div><!-- .moderation -->';
268
			}
269
			echo '
270
				</div><!-- $topic[css_class] -->';
271
		}
272
		echo '
273
			</div><!-- #topic_container -->';
274
275
		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']))
276
		{
277
			echo '
278
			<div class="righttext" id="quick_actions">
279
				<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
280
					<option value="">--------</option>';
281
282
			foreach ($context['qmod_actions'] as $qmod_action)
283
				if ($context['can_' . $qmod_action])
284
					echo '
285
					<option value="' . $qmod_action . '">' . $txt['quick_mod_' . $qmod_action] . '</option>';
286
287
			echo '
288
				</select>';
289
290
			// Show a list of boards they can move the topic to.
291
			if ($context['can_move'])
292
				echo '
293
				<span id="quick_mod_jump_to"></span>';
294
295
			echo '
296
				<input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' &amp;&amp; confirm(\'', $txt['quickmod_confirm'], '\');" class="button qaction">
297
			</div><!-- #quick_actions -->';
298
		}
299
300
		echo '
301
		</div><!-- #messageindex -->';
302
303
		// Finish off the form - again.
304
		if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics']))
305
			echo '
306
		<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '">
307
	</form>';
308
309
		// Mobile action buttons (bottom)
310
		if (!empty($context['normal_buttons']))
311
			echo '
312
	<div class="mobile_buttons floatright">
313
		<a class="button mobile_act">', $txt['mobile_action'], '</a>
314
	</div>';
315
316
		echo '
317
	<div class="pagesection">
318
		', template_button_strip($context['normal_buttons'], 'right'), '
0 ignored issues
show
Are you sure the usage of template_button_strip($c...mal_buttons'], 'right') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
319
		', $context['menu_separator'], '
320
		<div class="pagelinks floatleft">
321
			<a href="#main_content_section" class="button" id="bot">', $txt['go_up'], '</a>
322
			', $context['page_index'], '
323
		</div>
324
	</div>';
325
	}
326
327
	// Show breadcrumbs at the bottom too.
328
	theme_linktree();
329
330
	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move'])
331
		echo '
332
	<script>
333
		if (typeof(window.XMLHttpRequest) != "undefined")
334
			aJumpTo[aJumpTo.length] = new JumpTo({
335
				sContainerId: "quick_mod_jump_to",
336
				sClassName: "qaction",
337
				sJumpToTemplate: "%dropdown_list%",
338
				iCurBoardId: ', $context['current_board'], ',
339
				iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
340
				sCurBoardName: "', $context['jump_to']['board_name'], '",
341
				sBoardChildLevelIndicator: "==",
342
				sBoardPrefix: "=> ",
343
				sCatSeparator: "-----------------------------",
344
				sCatPrefix: "",
345
				bNoRedirect: true,
346
				bDisabled: true,
347
				sCustomName: "move_to"
348
			});
349
	</script>';
350
351
	// Javascript for inline editing.
352
	echo '
353
	<script>
354
		var oQuickModifyTopic = new QuickModifyTopic({
355
			aHidePrefixes: Array("lockicon", "stickyicon", "pages", "newicon"),
356
			bMouseOnDiv: false,
357
		});
358
	</script>';
359
360
	template_topic_legend();
361
362
	// Lets pop the...
363
	echo '
364
	<div id="mobile_action" class="popup_container">
365
		<div class="popup_window description">
366
			<div class="popup_heading">', $txt['mobile_action'], '
367
				<a href="javascript:void(0);" class="main_icons hide_popup"></a>
368
			</div>
369
			', template_button_strip($context['normal_buttons']), '
0 ignored issues
show
Are you sure the usage of template_button_strip($context['normal_buttons']) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
370
		</div>
371
	</div>';
372
}
373
374
/**
375
 * Outputs the board icon for a standard board.
376
 *
377
 * @param array $board Current board information.
378
 */
379
function template_bi_board_icon($board)
380
{
381
	global $context, $scripturl;
382
383
	echo '
384
		<a href="', ($context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a>';
385
}
386
387
/**
388
 * Outputs the board icon for a redirect.
389
 *
390
 * @param array $board Current board information.
391
 */
392
function template_bi_redirect_icon($board)
393
{
394
	global $context, $scripturl;
395
396
	echo '
397
		<a href="', $board['href'], '" class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></a>';
398
}
399
400
/**
401
 * Outputs the board info for a standard board or redirect.
402
 *
403
 * @param array $board Current board information.
404
 */
405
function template_bi_board_info($board)
406
{
407
	global $context, $scripturl, $txt;
408
409
	echo '
410
		<a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '">
411
			', $board['name'], '
412
		</a>';
413
414
	// Has it outstanding posts for approval?
415
	if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
416
		echo '
417
		<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link amt">!</a>';
418
419
	echo '
420
		<div class="board_description">', $board['description'], '</div>';
421
422
	// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
423
	if (!empty($board['moderators']) || !empty($board['moderator_groups']))
424
		echo '
425
		<p class="moderators">', count($board['link_moderators']) === 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
426
}
427
428
/**
429
 * Outputs the board stats for a standard board.
430
 *
431
 * @param array $board Current board information.
432
 */
433
function template_bi_board_stats($board)
434
{
435
	global $txt;
436
437
	echo '
438
		<p>
439
			', $txt['posts'], ': ', comma_format($board['posts']), '<br>', $txt['board_topics'], ': ', comma_format($board['topics']), '
440
		</p>';
441
}
442
443
/**
444
 * Outputs the board stats for a redirect.
445
 *
446
 * @param array $board Current board information.
447
 */
448
function template_bi_redirect_stats($board)
449
{
450
	global $txt;
451
452
	echo '
453
		<p>
454
			', $txt['redirects'], ': ', comma_format($board['posts']), '
455
		</p>';
456
}
457
458
/**
459
 * Outputs the board lastposts for a standard board or a redirect.
460
 * When on a mobile device, this may be hidden if no last post exists.
461
 *
462
 * @param array $board Current board information.
463
 */
464
function template_bi_board_lastpost($board)
465
{
466
	if (!empty($board['last_post']['id']))
467
		echo '
468
			<p>', $board['last_post']['last_post_message'], '</p>';
469
}
470
471
/**
472
 * Outputs the board children for a standard board.
473
 *
474
 * @param array $board Current board information.
475
 */
476
function template_bi_board_children($board)
477
{
478
	global $txt, $scripturl, $context;
479
480
	// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
481
	if (!empty($board['children']))
482
	{
483
		// Sort the links into an array with new boards bold so it can be imploded.
484
		$children = array();
485
		/* Each child in each board's children has:
486
			id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
487
		foreach ($board['children'] as $child)
488
		{
489
			if (!$child['is_redirect'])
490
				$child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
491
			else
492
				$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
493
494
			// Has it posts awaiting approval?
495
			if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
496
				$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link amt">!</a>';
497
498
			$children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>';
499
		}
500
501
		echo '
502
			<div id="board_', $board['id'], '_children" class="children">
503
				<p><strong id="child_list_', $board['id'], '">', $txt['sub_boards'], '</strong>', implode($children), '</p>
504
			</div>';
505
	}
506
}
507
508
/**
509
 * Shows a legend for topic icons.
510
 */
511
function template_topic_legend()
512
{
513
	global $context, $settings, $txt, $modSettings;
514
515
	echo '
516
	<div class="tborder" id="topic_icons">
517
		<div class="information">
518
			<p class="floatright" id="message_index_jump_to"></p>';
519
520
	if (empty($context['no_topic_listing']))
521
		echo '
522
			<p class="floatleft">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
523
				<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="" class="centericon"> ' . $txt['participation_caption'] . '<br>' : '', '
524
				' . ($modSettings['pollMode'] == '1' ? '<span class="main_icons poll centericon"></span> ' . $txt['poll'] : '') . '<br>
525
				<img src="' . $settings['images_url'] . '/post/moved.png" alt="" class="centericon sizefix"> ' . $txt['moved_topic'] . '<br>
526
			</p>
527
			<p>
528
				<span class="main_icons lock centericon"></span> ' . $txt['locked_topic'] . '<br>
529
				<span class="main_icons sticky centericon"></span> ' . $txt['sticky_topic'] . '<br>
530
			</p>';
531
532
	if (!empty($context['jump_to']))
533
		echo '
534
			<script>
535
				if (typeof(window.XMLHttpRequest) != "undefined")
536
					aJumpTo[aJumpTo.length] = new JumpTo({
537
						sContainerId: "message_index_jump_to",
538
						sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', $context['jump_to']['label'], '<" + "/label> %dropdown_list%",
539
						iCurBoardId: ', $context['current_board'], ',
540
						iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
541
						sCurBoardName: "', $context['jump_to']['board_name'], '",
542
						sBoardChildLevelIndicator: "==",
543
						sBoardPrefix: "=> ",
544
						sCatSeparator: "-----------------------------",
545
						sCatPrefix: "",
546
						sGoButtonLabel: "', $txt['quick_mod_go'], '"
547
					});
548
			</script>';
549
550
	echo '
551
			<br class="clear">
552
		</div><!-- .information -->
553
	</div><!-- #topic_icons -->';
554
}
555
556
?>