Completed
Pull Request — release-2.1 (#4310)
by Jeremy
08:13
created
Themes/default/BoardIndex.template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		echo '
74 74
 		<div class="main_container">
75
-			<div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '">
75
+			<div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '', '" id="category_', $category['id'], '">
76 76
 				<h3 class="catbg">';
77 77
 
78 78
 		// If this category even can collapse, show a link to collapse it.
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		foreach ($board['children'] as $child)
248 248
 		{
249 249
 			if (!$child['is_redirect'])
250
-				$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']) . ')"><span class="new_posts">' . $txt['new'] . '</span></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>';
250
+				$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']) . ')"><span class="new_posts">' . $txt['new'] . '</span></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>';
251 251
 			else
252 252
 				$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
253 253
 
Please login to merge, or discard this patch.
Braces   +64 added lines, -45 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 	foreach ($context['categories'] as $category)
68 68
 	{
69 69
 		// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
70
-		if (empty($category['boards']) && !$category['is_collapsed'])
71
-			continue;
70
+		if (empty($category['boards']) && !$category['is_collapsed']) {
71
+					continue;
72
+		}
72 73
 
73 74
 		echo '
74 75
 		<div class="main_container">
@@ -76,9 +77,10 @@  discard block
 block discarded – undo
76 77
 				<h3 class="catbg">';
77 78
 
78 79
 		// If this category even can collapse, show a link to collapse it.
79
-		if ($category['can_collapse'])
80
-			echo '
80
+		if ($category['can_collapse']) {
81
+					echo '
81 82
 					<span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>';
83
+		}
82 84
 
83 85
 		echo '
84 86
 					', $category['link'], '
@@ -108,10 +110,11 @@  discard block
 block discarded – undo
108 110
 					</div>';
109 111
 
110 112
 				// Won't somebody think of the children!
111
-				if (function_exists('template_bi_' . $board['type'] . '_children'))
112
-					call_user_func('template_bi_' . $board['type'] . '_children', $board);
113
-				else
114
-					template_bi_board_children($board);
113
+				if (function_exists('template_bi_' . $board['type'] . '_children')) {
114
+									call_user_func('template_bi_' . $board['type'] . '_children', $board);
115
+				} else {
116
+									template_bi_board_children($board);
117
+				}
115 118
 
116 119
 				echo '
117 120
 					</div>';
@@ -126,10 +129,11 @@  discard block
 block discarded – undo
126 129
 	</div>';
127 130
 
128 131
 	// Show the mark all as read button?
129
-	if ($context['user']['is_logged'] && !empty($context['categories']))
130
-		echo '
132
+	if ($context['user']['is_logged'] && !empty($context['categories'])) {
133
+			echo '
131 134
 		<div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>';
132
-}
135
+	}
136
+	}
133 137
 
134 138
 /**
135 139
  * Outputs the board icon for a standard board.
@@ -173,18 +177,20 @@  discard block
 block discarded – undo
173 177
 						</a>';
174 178
 
175 179
 	// Has it outstanding posts for approval?
176
-	if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
177
-		echo '
180
+	if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) {
181
+			echo '
178 182
 						<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">(!)</a>';
183
+	}
179 184
 
180 185
 	echo '
181 186
 						<p class="board_description">', $board['description'], '</p>';
182 187
 
183 188
 	// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
184
-	if (!empty($board['link_moderators']))
185
-		echo '
189
+	if (!empty($board['link_moderators'])) {
190
+			echo '
186 191
 						<p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
187
-}
192
+	}
193
+	}
188 194
 
189 195
 /**
190 196
  * Outputs the board stats for a standard board.
@@ -223,10 +229,11 @@  discard block
 block discarded – undo
223 229
  */
224 230
 function template_bi_board_lastpost($board)
225 231
 {
226
-	if (!empty($board['last_post']['id']))
227
-		echo '
232
+	if (!empty($board['last_post']['id'])) {
233
+			echo '
228 234
 						<p>', $board['last_post']['last_post_message'], '</p>';
229
-}
235
+	}
236
+	}
230 237
 
231 238
 /**
232 239
  * Outputs the board children for a standard board.
@@ -246,14 +253,16 @@  discard block
 block discarded – undo
246 253
 				id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
247 254
 		foreach ($board['children'] as $child)
248 255
 		{
249
-			if (!$child['is_redirect'])
250
-				$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']) . ')"><span class="new_posts">' . $txt['new'] . '</span></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>';
251
-			else
252
-				$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
256
+			if (!$child['is_redirect']) {
257
+							$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']) . ')"><span class="new_posts">' . $txt['new'] . '</span></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>';
258
+			} else {
259
+							$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
260
+			}
253 261
 
254 262
 			// Has it posts awaiting approval?
255
-			if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
256
-				$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">(!)</a>';
263
+			if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) {
264
+							$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">(!)</a>';
265
+			}
257 266
 
258 267
 			$children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>';
259 268
 		}
@@ -280,8 +289,9 @@  discard block
 block discarded – undo
280 289
 {
281 290
 	global $context, $options, $txt;
282 291
 
283
-	if (empty($context['info_center']))
284
-		return;
292
+	if (empty($context['info_center'])) {
293
+			return;
294
+	}
285 295
 
286 296
 	// Here's where the "Info Center" starts...
287 297
 	echo '
@@ -381,14 +391,15 @@  discard block
 block discarded – undo
381 391
 		/* Each post in latest_posts has:
382 392
 				board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
383 393
 				subject, short_subject (shortened with...), time, link, and href. */
384
-		foreach ($context['latest_posts'] as $post)
385
-			echo '
394
+		foreach ($context['latest_posts'] as $post) {
395
+					echo '
386 396
 					<tr class="windowbg">
387 397
 						<td class="recentpost"><strong>', $post['link'], '</strong></td>
388 398
 						<td class="recentposter">', $post['poster']['link'], '</td>
389 399
 						<td class="recentboard">', $post['board']['link'], '</td>
390 400
 						<td class="recenttime">', $post['time'], '</td>
391 401
 					</tr>';
402
+		}
392 403
 		echo '
393 404
 				</table>';
394 405
 	}
@@ -412,9 +423,10 @@  discard block
 block discarded – undo
412 423
 			</div>';
413 424
 
414 425
 	// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
415
-	if (!empty($context['calendar_holidays']))
416
-		echo '
426
+	if (!empty($context['calendar_holidays'])) {
427
+			echo '
417 428
 				<p class="inline holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), '</p>';
429
+	}
418 430
 
419 431
 	// People's birthdays. Like mine. And yours, I guess. Kidding.
420 432
 	if (!empty($context['calendar_birthdays']))
@@ -423,9 +435,10 @@  discard block
 block discarded – undo
423 435
 				<p class="inline">
424 436
 					<span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>';
425 437
 		// Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?)
426
-		foreach ($context['calendar_birthdays'] as $member)
427
-			echo '
438
+		foreach ($context['calendar_birthdays'] as $member) {
439
+					echo '
428 440
 					<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', ';
441
+		}
429 442
 		echo '
430 443
 				</p>';
431 444
 	}
@@ -439,9 +452,10 @@  discard block
 block discarded – undo
439 452
 
440 453
 		// Each event in calendar_events should have:
441 454
 		//		title, href, is_last, can_edit (are they allowed?), modify_href, and is_today.
442
-		foreach ($context['calendar_events'] as $event)
443
-			echo '
455
+		foreach ($context['calendar_events'] as $event) {
456
+					echo '
444 457
 					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', ';
458
+		}
445 459
 		echo '
446 460
 				</p>';
447 461
 	}
@@ -486,15 +500,19 @@  discard block
 block discarded – undo
486 500
 
487 501
 	// Handle hidden users and buddies.
488 502
 	$bracketList = array();
489
-	if ($context['show_buddies'])
490
-		$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
491
-	if (!empty($context['num_spiders']))
492
-		$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
493
-	if (!empty($context['num_users_hidden']))
494
-		$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']);
503
+	if ($context['show_buddies']) {
504
+			$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
505
+	}
506
+	if (!empty($context['num_spiders'])) {
507
+			$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
508
+	}
509
+	if (!empty($context['num_users_hidden'])) {
510
+			$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']);
511
+	}
495 512
 
496
-	if (!empty($bracketList))
497
-		echo ' (' . implode(', ', $bracketList) . ')';
513
+	if (!empty($bracketList)) {
514
+			echo ' (' . implode(', ', $bracketList) . ')';
515
+	}
498 516
 
499 517
 	echo $context['show_who'] ? '</a>' : '', '
500 518
 
@@ -508,9 +526,10 @@  discard block
 block discarded – undo
508 526
 				', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']);
509 527
 
510 528
 		// Showing membergroups?
511
-		if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
512
-			echo '
529
+		if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) {
530
+					echo '
513 531
 				<span class="membergroups">' . implode(',&nbsp;', $context['membergroups']) . '</span>';
532
+		}
514 533
 	}
515 534
 
516 535
 	echo '
Please login to merge, or discard this patch.