Completed
Pull Request — release-2.1 (#4398)
by Colin
07:12
created
Themes/default/Profile.template.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3078,8 +3078,7 @@
 block discarded – undo
3078 3078
 			<div class="roundframe">
3079 3079
 				<div>
3080 3080
 		', !empty($context['tfa_backup']) ? '
3081
-					<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' :
3082
-			($modSettings['tfa_mode'] == 2 ? '
3081
+					<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : ($modSettings['tfa_mode'] == 2 ? '
3083 3082
 									<div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), '
3084 3083
 									<div class="smalltext">', $txt['tfa_desc'], '</div>
3085 3084
 									<div class="floatleft">
Please login to merge, or discard this patch.
Braces   +471 added lines, -351 removed lines patch added patch discarded remove patch
@@ -18,23 +18,25 @@  discard block
 block discarded – undo
18 18
 	global $context;
19 19
 
20 20
 	// Prevent Chrome from auto completing fields when viewing/editing other members profiles
21
-	if (isBrowser('is_chrome') && !$context['user']['is_owner'])
22
-		echo '
21
+	if (isBrowser('is_chrome') && !$context['user']['is_owner']) {
22
+			echo '
23 23
 			<script>
24 24
 				disableAutoComplete();
25 25
 			</script>';
26
+	}
26 27
 
27 28
 	// If an error occurred while trying to save previously, give the user a clue!
28 29
 	echo '
29 30
 			', template_error_message();
30 31
 
31 32
 	// If the profile was update successfully, let the user know this.
32
-	if (!empty($context['profile_updated']))
33
-		echo '
33
+	if (!empty($context['profile_updated'])) {
34
+			echo '
34 35
 			<div class="infobox">
35 36
 				', $context['profile_updated'], '
36 37
 			</div>';
37
-}
38
+	}
39
+	}
38 40
 
39 41
 /**
40 42
  * Template for any HTML needed below the profile (closing off divs/tables, etc.)
@@ -102,8 +104,7 @@  discard block
 block discarded – undo
102 104
 	if (empty($context['unread_alerts']))
103 105
 	{
104 106
 		template_alerts_all_read();
105
-	}
106
-	else
107
+	} else
107 108
 	{
108 109
 		foreach ($context['unread_alerts'] as $id_alert => $details)
109 110
 		{
@@ -164,10 +165,11 @@  discard block
 block discarded – undo
164 165
 			<div class="custom_fields_above_name">
165 166
 				<ul>';
166 167
 
167
-		foreach ($context['print_custom_fields']['above_member'] as $field)
168
-			if (!empty($field['output_html']))
168
+		foreach ($context['print_custom_fields']['above_member'] as $field) {
169
+					if (!empty($field['output_html']))
169 170
 				echo '
170 171
 					<li>', $field['output_html'], '</li>';
172
+		}
171 173
 
172 174
 		echo '
173 175
 				</ul>
@@ -179,20 +181,22 @@  discard block
 block discarded – undo
179 181
 			<div class="username clear">
180 182
 				<h4>';
181 183
 
182
-	if (!empty($context['print_custom_fields']['before_member']))
183
-		foreach ($context['print_custom_fields']['before_member'] as $field)
184
+	if (!empty($context['print_custom_fields']['before_member'])) {
185
+			foreach ($context['print_custom_fields']['before_member'] as $field)
184 186
 			if (!empty($field['output_html']))
185 187
 				echo '
186 188
 					<span>', $field['output_html'], '</span>';
189
+	}
187 190
 
188 191
 	echo '
189 192
 					', $context['member']['name'];
190 193
 
191
-	if (!empty($context['print_custom_fields']['after_member']))
192
-		foreach ($context['print_custom_fields']['after_member'] as $field)
194
+	if (!empty($context['print_custom_fields']['after_member'])) {
195
+			foreach ($context['print_custom_fields']['after_member'] as $field)
193 196
 			if (!empty($field['output_html']))
194 197
 				echo '
195 198
 					<span>', $field['output_html'], '</span>';
199
+	}
196 200
 
197 201
 
198 202
 	echo '
@@ -208,10 +212,11 @@  discard block
 block discarded – undo
208 212
 			<div class="custom_fields_below_avatar">
209 213
 				<ul>';
210 214
 
211
-		foreach ($context['print_custom_fields']['below_avatar'] as $field)
212
-			if (!empty($field['output_html']))
215
+		foreach ($context['print_custom_fields']['below_avatar'] as $field) {
216
+					if (!empty($field['output_html']))
213 217
 				echo '
214 218
 					<li>', $field['output_html'], '</li>';
219
+		}
215 220
 
216 221
 		echo '
217 222
 				</ul>
@@ -223,22 +228,25 @@  discard block
 block discarded – undo
223 228
 			<ul class="clear">';
224 229
 
225 230
 	// Email is only visible if it's your profile or you have the moderate_forum permission
226
-	if ($context['member']['show_email'])
227
-		echo '
231
+	if ($context['member']['show_email']) {
232
+			echo '
228 233
 				<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>';
234
+	}
229 235
 
230 236
 	// Don't show an icon if they haven't specified a website.
231
-	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
232
-		echo '
237
+	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) {
238
+			echo '
233 239
 				<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
240
+	}
234 241
 
235 242
 	// Are there any custom profile fields as icons?
236 243
 	if (!empty($context['print_custom_fields']['icons']))
237 244
 	{
238
-		foreach ($context['print_custom_fields']['icons'] as $field)
239
-			if (!empty($field['output_html']))
245
+		foreach ($context['print_custom_fields']['icons'] as $field) {
246
+					if (!empty($field['output_html']))
240 247
 				echo '
241 248
 				<li class="custom_field">', $field['output_html'], '</li>';
249
+		}
242 250
 	}
243 251
 
244 252
 	echo '
@@ -247,24 +255,27 @@  discard block
 block discarded – undo
247 255
 				', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : '';
248 256
 
249 257
 	// Can they add this member as a buddy?
250
-	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
251
-		echo '
258
+	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) {
259
+			echo '
252 260
 				<br>
253 261
 				<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
262
+	}
254 263
 
255 264
 	echo '
256 265
 			</span>';
257 266
 
258
-	if (!$context['user']['is_owner'] && $context['can_send_pm'])
259
-		echo '
267
+	if (!$context['user']['is_owner'] && $context['can_send_pm']) {
268
+			echo '
260 269
 			<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
270
+	}
261 271
 
262 272
 	echo '
263 273
 			<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
264 274
 
265
-	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
266
-		echo '
275
+	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) {
276
+			echo '
267 277
 			<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
278
+	}
268 279
 
269 280
 	echo '
270 281
 			<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
@@ -276,10 +287,11 @@  discard block
 block discarded – undo
276 287
 			<div class="custom_fields_bottom">
277 288
 				<ul class="nolist">';
278 289
 
279
-		foreach ($context['print_custom_fields']['bottom_poster'] as $field)
280
-			if (!empty($field['output_html']))
290
+		foreach ($context['print_custom_fields']['bottom_poster'] as $field) {
291
+					if (!empty($field['output_html']))
281 292
 				echo '
282 293
 					<li>', $field['output_html'], '</li>';
294
+		}
283 295
 
284 296
 		echo '
285 297
 				</ul>
@@ -292,15 +304,17 @@  discard block
 block discarded – undo
292 304
 		<div id="detailedinfo">
293 305
 			<dl class="settings">';
294 306
 
295
-	if ($context['user']['is_owner'] || $context['user']['is_admin'])
296
-		echo '
307
+	if ($context['user']['is_owner'] || $context['user']['is_admin']) {
308
+			echo '
297 309
 				<dt>', $txt['username'], ': </dt>
298 310
 				<dd>', $context['member']['username'], '</dd>';
311
+	}
299 312
 
300
-	if (!isset($context['disabled_fields']['posts']))
301
-		echo '
313
+	if (!isset($context['disabled_fields']['posts'])) {
314
+			echo '
302 315
 				<dt>', $txt['profile_posts'], ': </dt>
303 316
 				<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
317
+	}
304 318
 
305 319
 	if ($context['member']['show_email'])
306 320
 	{
@@ -309,15 +323,17 @@  discard block
 block discarded – undo
309 323
 				<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
310 324
 	}
311 325
 
312
-	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
313
-		echo '
326
+	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) {
327
+			echo '
314 328
 				<dt>', $txt['custom_title'], ': </dt>
315 329
 				<dd>', $context['member']['title'], '</dd>';
330
+	}
316 331
 
317
-	if (!empty($context['member']['blurb']))
318
-		echo '
332
+	if (!empty($context['member']['blurb'])) {
333
+			echo '
319 334
 				<dt>', $txt['personal_text'], ': </dt>
320 335
 				<dd>', $context['member']['blurb'], '</dd>';
336
+	}
321 337
 
322 338
 	echo '
323 339
 				<dt>', $txt['age'], ':</dt>
@@ -331,19 +347,21 @@  discard block
 block discarded – undo
331 347
 	{
332 348
 		$fields = array();
333 349
 
334
-		foreach ($context['print_custom_fields']['standard'] as $field)
335
-			if (!empty($field['output_html']))
350
+		foreach ($context['print_custom_fields']['standard'] as $field) {
351
+					if (!empty($field['output_html']))
336 352
 				$fields[] = $field;
353
+		}
337 354
 
338 355
 		if (count($fields) > 0)
339 356
 		{
340 357
 			echo '
341 358
 			<dl class="settings">';
342 359
 
343
-			foreach ($fields as $field)
344
-				echo '
360
+			foreach ($fields as $field) {
361
+							echo '
345 362
 				<dt>', $field['name'], ':</dt>
346 363
 				<dd>', $field['output_html'], '</dd>';
364
+			}
347 365
 
348 366
 			echo '
349 367
 			</dl>';
@@ -363,9 +381,10 @@  discard block
 block discarded – undo
363 381
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
364 382
 
365 383
 		// Can we provide information on what this means?
366
-		if (!empty($context['warning_status']))
367
-			echo '
384
+		if (!empty($context['warning_status'])) {
385
+					echo '
368 386
 					<span class="smalltext">(', $context['warning_status'], ')</span>';
387
+		}
369 388
 
370 389
 		echo '
371 390
 				</dd>';
@@ -376,9 +395,10 @@  discard block
 block discarded – undo
376 395
 	{
377 396
 
378 397
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
379
-		if (!empty($context['activate_message']))
380
-			echo '
398
+		if (!empty($context['activate_message'])) {
399
+					echo '
381 400
 				<dt class="clear"><span class="alert">', $context['activate_message'], '</span>&nbsp;(<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)</dt>';
401
+		}
382 402
 
383 403
 		// If the current member is banned, show a message and possibly a link to the ban.
384 404
 		if (!empty($context['member']['bans']))
@@ -390,10 +410,11 @@  discard block
 block discarded – undo
390 410
 				<dt class="clear" id="ban_info" style="display: none;">
391 411
 					<strong>', $txt['user_banned_by_following'], ':</strong>';
392 412
 
393
-			foreach ($context['member']['bans'] as $ban)
394
-				echo '
413
+			foreach ($context['member']['bans'] as $ban) {
414
+							echo '
395 415
 					<br>
396 416
 					<span class="smalltext">', $ban['explanation'], '</span>';
417
+			}
397 418
 
398 419
 			echo '
399 420
 				</dt>';
@@ -407,30 +428,34 @@  discard block
 block discarded – undo
407 428
 	// If the person looking is allowed, they can check the members IP address and hostname.
408 429
 	if ($context['can_see_ip'])
409 430
 	{
410
-		if (!empty($context['member']['ip']))
411
-		echo '
431
+		if (!empty($context['member']['ip'])) {
432
+				echo '
412 433
 				<dt>', $txt['ip'], ': </dt>
413 434
 				<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
435
+		}
414 436
 
415
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
416
-			echo '
437
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
438
+					echo '
417 439
 				<dt>', $txt['hostname'], ': </dt>
418 440
 				<dd>', $context['member']['hostname'], '</dd>';
441
+		}
419 442
 	}
420 443
 
421 444
 	echo '
422 445
 				<dt>', $txt['local_time'], ':</dt>
423 446
 				<dd>', $context['member']['local_time'], '</dd>';
424 447
 
425
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
426
-		echo '
448
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
449
+			echo '
427 450
 				<dt>', $txt['language'], ':</dt>
428 451
 				<dd>', $context['member']['language'], '</dd>';
452
+	}
429 453
 
430
-	if ($context['member']['show_last_login'])
431
-		echo '
454
+	if ($context['member']['show_last_login']) {
455
+			echo '
432 456
 				<dt>', $txt['lastLoggedIn'], ': </dt>
433 457
 				<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
458
+	}
434 459
 
435 460
 	echo '
436 461
 			</dl>';
@@ -442,10 +467,11 @@  discard block
 block discarded – undo
442 467
 			<div class="custom_fields_above_signature">
443 468
 				<ul class="nolist">';
444 469
 
445
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
446
-			if (!empty($field['output_html']))
470
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
471
+					if (!empty($field['output_html']))
447 472
 				echo '
448 473
 					<li>', $field['output_html'], '</li>';
474
+		}
449 475
 
450 476
 		echo '
451 477
 				</ul>
@@ -453,12 +479,13 @@  discard block
 block discarded – undo
453 479
 	}
454 480
 
455 481
 	// Show the users signature.
456
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
457
-		echo '
482
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
483
+			echo '
458 484
 			<div class="signature">
459 485
 				<h5>', $txt['signature'], ':</h5>
460 486
 				', $context['member']['signature'], '
461 487
 			</div>';
488
+	}
462 489
 
463 490
 	// Are there any custom profile fields for below the signature?
464 491
 	if (!empty($context['print_custom_fields']['below_signature']))
@@ -467,10 +494,11 @@  discard block
 block discarded – undo
467 494
 			<div class="custom_fields_below_signature">
468 495
 				<ul class="nolist">';
469 496
 
470
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
471
-			if (!empty($field['output_html']))
497
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
498
+					if (!empty($field['output_html']))
472 499
 				echo '
473 500
 					<li>', $field['output_html'], '</li>';
501
+		}
474 502
 
475 503
 		echo '
476 504
 				</ul>
@@ -516,62 +544,70 @@  discard block
 block discarded – undo
516 544
 			</div>
517 545
 			<div class="list_posts">';
518 546
 
519
-			if (!$post['approved'])
520
-				echo '
547
+			if (!$post['approved']) {
548
+							echo '
521 549
 				<div class="approve_post">
522 550
 					<em>', $txt['post_awaiting_approval'], '</em>
523 551
 				</div>';
552
+			}
524 553
 
525 554
 			echo '
526 555
 				', $post['body'], '
527 556
 			</div>';
528 557
 
529
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
530
-				echo '
558
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
559
+							echo '
531 560
 			<div class="floatright">
532 561
 				<ul class="quickbuttons">';
562
+			}
533 563
 
534 564
 			// If they *can* reply?
535
-			if ($post['can_reply'])
536
-				echo '
565
+			if ($post['can_reply']) {
566
+							echo '
537 567
 					<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
568
+			}
538 569
 
539 570
 			// If they *can* quote?
540
-			if ($post['can_quote'])
541
-				echo '
571
+			if ($post['can_quote']) {
572
+							echo '
542 573
 					<li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
574
+			}
543 575
 
544 576
 			// How about... even... remove it entirely?!
545
-			if ($post['can_delete'])
546
-				echo '
577
+			if ($post['can_delete']) {
578
+							echo '
547 579
 					<li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
580
+			}
548 581
 
549
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
550
-				echo '
582
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
583
+							echo '
551 584
 				</ul>
552 585
 			</div><!-- .floatright -->';
586
+			}
553 587
 
554 588
 			echo '
555 589
 		</div><!-- $post[css_class] -->';
556 590
 		}
591
+	} else {
592
+			template_show_list('attachments');
557 593
 	}
558
-	else
559
-		template_show_list('attachments');
560 594
 
561 595
 	// No posts? Just end with a informative message.
562
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
563
-		echo '
596
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
597
+			echo '
564 598
 		<div class="windowbg2">
565 599
 			', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
566 600
 		</div>';
601
+	}
567 602
 
568 603
 	// Show more page numbers.
569
-	if (!empty($context['page_index']))
570
-		echo '
604
+	if (!empty($context['page_index'])) {
605
+			echo '
571 606
 		<div class="pagesection">
572 607
 			<div class="pagelinks">', $context['page_index'], '</div>
573 608
 		</div>';
574
-}
609
+	}
610
+	}
575 611
 
576 612
 /**
577 613
  * Template for showing alerts within the alerts popup
@@ -581,11 +617,12 @@  discard block
 block discarded – undo
581 617
 	global $context, $txt, $scripturl;
582 618
 
583 619
 	// Do we have an update message?
584
-	if (!empty($context['update_message']))
585
-		echo '
620
+	if (!empty($context['update_message'])) {
621
+			echo '
586 622
 		<div class="infobox">
587 623
 			', $context['update_message'], '.
588 624
 		</div>';
625
+	}
589 626
 
590 627
 	echo '
591 628
 		<div class="cat_bar">
@@ -594,13 +631,12 @@  discard block
 block discarded – undo
594 631
 			</h3>
595 632
 		</div>';
596 633
 
597
-	if (empty($context['alerts']))
598
-		echo '
634
+	if (empty($context['alerts'])) {
635
+			echo '
599 636
 		<div class="information">
600 637
 			', $txt['alerts_none'], '
601 638
 		</div>';
602
-
603
-	else
639
+	} else
604 640
 	{
605 641
 		// Start the form.
606 642
 		echo '
@@ -662,12 +698,12 @@  discard block
 block discarded – undo
662 698
 		</div>' : '';
663 699
 
664 700
 	// No drafts? Just show an informative message.
665
-	if (empty($context['drafts']))
666
-		echo '
701
+	if (empty($context['drafts'])) {
702
+			echo '
667 703
 		<div class="windowbg2 centertext">
668 704
 			', $txt['draft_none'], '
669 705
 		</div>';
670
-	else
706
+	} else
671 707
 	{
672 708
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
673 709
 		foreach ($context['drafts'] as $draft)
@@ -679,13 +715,15 @@  discard block
 block discarded – undo
679 715
 				<h5>
680 716
 					<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
681 717
 
682
-			if (!empty($draft['sticky']))
683
-				echo '
718
+			if (!empty($draft['sticky'])) {
719
+							echo '
684 720
 					<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
721
+			}
685 722
 
686
-			if (!empty($draft['locked']))
687
-				echo '
723
+			if (!empty($draft['locked'])) {
724
+							echo '
688 725
 					<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
726
+			}
689 727
 
690 728
 			echo '
691 729
 				</h5>
@@ -718,13 +756,13 @@  discard block
 block discarded – undo
718 756
 {
719 757
 	global $context, $scripturl, $txt;
720 758
 
721
-	if (!empty($context['saved_successful']))
722
-		echo '
759
+	if (!empty($context['saved_successful'])) {
760
+			echo '
723 761
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
724
-
725
-	elseif (!empty($context['saved_failed']))
726
-		echo '
762
+	} elseif (!empty($context['saved_failed'])) {
763
+			echo '
727 764
 	<div class="errorbox">', $context['saved_failed'], '</div>';
765
+	}
728 766
 
729 767
 	echo '
730 768
 	<div id="edit_buddies">
@@ -739,14 +777,16 @@  discard block
 block discarded – undo
739 777
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
740 778
 					<th scope="col">', $txt['status'], '</th>';
741 779
 
742
-	if (allowedTo('moderate_forum'))
743
-		echo '
780
+	if (allowedTo('moderate_forum')) {
781
+			echo '
744 782
 					<th scope="col">', $txt['email'], '</th>';
783
+	}
745 784
 
746
-	if (!empty($context['custom_pf']))
747
-		foreach ($context['custom_pf'] as $column)
785
+	if (!empty($context['custom_pf'])) {
786
+			foreach ($context['custom_pf'] as $column)
748 787
 				echo '
749 788
 					<th scope="col">', $column['label'], '</th>';
789
+	}
750 790
 
751 791
 	echo '
752 792
 					<th scope="col">', $txt['remove'], '</th>
@@ -755,13 +795,14 @@  discard block
 block discarded – undo
755 795
 			<tbody>';
756 796
 
757 797
 	// If they don't have any buddies don't list them!
758
-	if (empty($context['buddies']))
759
-		echo '
798
+	if (empty($context['buddies'])) {
799
+			echo '
760 800
 				<tr class="windowbg">
761 801
 					<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '">
762 802
 						<strong>', $txt['no_buddies'], '</strong>
763 803
 					</td>
764 804
 				</tr>';
805
+	}
765 806
 
766 807
 		// Now loop through each buddy showing info on each.
767 808
 	else
@@ -775,17 +816,19 @@  discard block
 block discarded – undo
775 816
 						<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
776 817
 					</td>';
777 818
 
778
-			if ($buddy['show_email'])
779
-				echo '
819
+			if ($buddy['show_email']) {
820
+							echo '
780 821
 					<td>
781 822
 						<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
782 823
 					</td>';
824
+			}
783 825
 
784 826
 			// Show the custom profile fields for this user.
785
-			if (!empty($context['custom_pf']))
786
-				foreach ($context['custom_pf'] as $key => $column)
827
+			if (!empty($context['custom_pf'])) {
828
+							foreach ($context['custom_pf'] as $key => $column)
787 829
 					echo '
788 830
 					<td class="lefttext">', $buddy['options'][$key], '</td>';
831
+			}
789 832
 
790 833
 			echo '
791 834
 					<td>
@@ -818,9 +861,10 @@  discard block
 block discarded – undo
818 861
 			</dl>
819 862
 		</div>';
820 863
 
821
-	if (!empty($context['token_check']))
822
-		echo '
864
+	if (!empty($context['token_check'])) {
865
+			echo '
823 866
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
867
+	}
824 868
 
825 869
 	echo '
826 870
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -846,12 +890,13 @@  discard block
 block discarded – undo
846 890
 {
847 891
 	global $context, $scripturl, $txt;
848 892
 
849
-	if (!empty($context['saved_successful']))
850
-		echo '
893
+	if (!empty($context['saved_successful'])) {
894
+			echo '
851 895
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
852
-	elseif (!empty($context['saved_failed']))
853
-		echo '
896
+	} elseif (!empty($context['saved_failed'])) {
897
+			echo '
854 898
 	<div class="errorbox">', $context['saved_failed'], '</div>';
899
+	}
855 900
 
856 901
 	echo '
857 902
 	<div id="edit_buddies">
@@ -866,9 +911,10 @@  discard block
 block discarded – undo
866 911
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
867 912
 					<th scope="col">', $txt['status'], '</th>';
868 913
 
869
-	if (allowedTo('moderate_forum'))
870
-		echo '
914
+	if (allowedTo('moderate_forum')) {
915
+			echo '
871 916
 					<th scope="col">', $txt['email'], '</th>';
917
+	}
872 918
 
873 919
 	echo '
874 920
 					<th scope="col">', $txt['ignore_remove'], '</th>
@@ -877,13 +923,14 @@  discard block
 block discarded – undo
877 923
 			<tbody>';
878 924
 
879 925
 	// If they don't have anyone on their ignore list, don't list it!
880
-	if (empty($context['ignore_list']))
881
-		echo '
926
+	if (empty($context['ignore_list'])) {
927
+			echo '
882 928
 				<tr class="windowbg">
883 929
 					<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '">
884 930
 						<strong>', $txt['no_ignore'], '</strong>
885 931
 					</td>
886 932
 				</tr>';
933
+	}
887 934
 
888 935
 	// Now loop through each buddy showing info on each.
889 936
 	foreach ($context['ignore_list'] as $member)
@@ -895,11 +942,12 @@  discard block
 block discarded – undo
895 942
 						<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
896 943
 					</td>';
897 944
 
898
-		if ($member['show_email'])
899
-			echo '
945
+		if ($member['show_email']) {
946
+					echo '
900 947
 					<td>
901 948
 						<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
902 949
 					</td>';
950
+		}
903 951
 		echo '
904 952
 					<td>
905 953
 						<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a>
@@ -929,9 +977,10 @@  discard block
 block discarded – undo
929 977
 			</dl>
930 978
 		</div>';
931 979
 
932
-	if (!empty($context['token_check']))
933
-		echo '
980
+	if (!empty($context['token_check'])) {
981
+			echo '
934 982
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
983
+	}
935 984
 
936 985
 	echo '
937 986
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -977,9 +1026,10 @@  discard block
 block discarded – undo
977 1026
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
978 1027
 
979 1028
 	// Second address detected?
980
-	if (!empty($context['last_ip2']))
981
-		echo '
1029
+	if (!empty($context['last_ip2'])) {
1030
+			echo '
982 1031
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
1032
+	}
983 1033
 
984 1034
 	echo '
985 1035
 				</dd>';
@@ -1045,9 +1095,10 @@  discard block
 block discarded – undo
1045 1095
 		</div>
1046 1096
 		<div class="windowbg2 noup">';
1047 1097
 
1048
-		foreach ($context['whois_servers'] as $server)
1049
-		echo '
1098
+		foreach ($context['whois_servers'] as $server) {
1099
+				echo '
1050 1100
 			<a href="', $server['url'], '" target="_blank"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>';
1101
+		}
1051 1102
 		echo '
1052 1103
 		</div>
1053 1104
 		<br>';
@@ -1058,10 +1109,10 @@  discard block
 block discarded – undo
1058 1109
 		<div class="cat_bar">
1059 1110
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1060 1111
 		</div>';
1061
-	if (empty($context['ips']))
1062
-		echo '
1112
+	if (empty($context['ips'])) {
1113
+			echo '
1063 1114
 		<p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
1064
-	else
1115
+	} else
1065 1116
 	{
1066 1117
 		echo '
1067 1118
 		<table class="table_grid">
@@ -1074,12 +1125,13 @@  discard block
 block discarded – undo
1074 1125
 			<tbody>';
1075 1126
 
1076 1127
 		// Loop through each of the members and display them.
1077
-		foreach ($context['ips'] as $ip => $memberlist)
1078
-			echo '
1128
+		foreach ($context['ips'] as $ip => $memberlist) {
1129
+					echo '
1079 1130
 				<tr class="windowbg">
1080 1131
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1081 1132
 					<td>', implode(', ', $memberlist), '</td>
1082 1133
 				</tr>';
1134
+		}
1083 1135
 
1084 1136
 		echo '
1085 1137
 			</tbody>
@@ -1125,8 +1177,7 @@  discard block
 block discarded – undo
1125 1177
 	{
1126 1178
 		echo '
1127 1179
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1128
-	}
1129
-	else
1180
+	} else
1130 1181
 	{
1131 1182
 		echo '
1132 1183
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1141,9 +1192,10 @@  discard block
 block discarded – undo
1141 1192
 			<div class="windowbg smalltext">
1142 1193
 				', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1143 1194
 
1144
-			foreach ($context['no_access_boards'] as $no_access_board)
1145
-				echo '
1195
+			foreach ($context['no_access_boards'] as $no_access_board) {
1196
+							echo '
1146 1197
 				<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1198
+			}
1147 1199
 			echo '
1148 1200
 			</div>';
1149 1201
 		}
@@ -1175,12 +1227,13 @@  discard block
 block discarded – undo
1175 1227
 							</td>
1176 1228
 							<td class="smalltext">';
1177 1229
 
1178
-				if ($permission['is_denied'])
1179
-					echo '
1230
+				if ($permission['is_denied']) {
1231
+									echo '
1180 1232
 								<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1181
-				else
1182
-					echo '
1233
+				} else {
1234
+									echo '
1183 1235
 								', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
1236
+				}
1184 1237
 
1185 1238
 				echo '
1186 1239
 							</td>
@@ -1191,10 +1244,10 @@  discard block
 block discarded – undo
1191 1244
 				</table>
1192 1245
 			</div><!-- .tborder -->
1193 1246
 			<br>';
1194
-		}
1195
-		else
1196
-			echo '
1247
+		} else {
1248
+					echo '
1197 1249
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1250
+		}
1198 1251
 
1199 1252
 		// Board permission section.
1200 1253
 		echo '
@@ -1204,14 +1257,16 @@  discard block
 block discarded – undo
1204 1257
 						<a id="board_permissions"></a>', $txt['showPermissions_select'], ':
1205 1258
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1206 1259
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
1207
-		if (!empty($context['boards']))
1208
-			echo '
1260
+		if (!empty($context['boards'])) {
1261
+					echo '
1209 1262
 							<option value="" disabled>---------------------------</option>';
1263
+		}
1210 1264
 
1211 1265
 		// Fill the box with any local permission boards.
1212
-		foreach ($context['boards'] as $board)
1213
-			echo '
1266
+		foreach ($context['boards'] as $board) {
1267
+					echo '
1214 1268
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1269
+		}
1215 1270
 
1216 1271
 		echo '
1217 1272
 						</select>
@@ -1242,8 +1297,7 @@  discard block
 block discarded – undo
1242 1297
 				{
1243 1298
 					echo '
1244 1299
 							<span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
1245
-				}
1246
-				else
1300
+				} else
1247 1301
 				{
1248 1302
 					echo '
1249 1303
 							', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
@@ -1255,10 +1309,10 @@  discard block
 block discarded – undo
1255 1309
 			echo '
1256 1310
 				</tbody>
1257 1311
 			</table>';
1258
-		}
1259
-		else
1260
-			echo '
1312
+		} else {
1313
+					echo '
1261 1314
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1315
+		}
1262 1316
 	echo '
1263 1317
 		</div><!-- #permissions -->';
1264 1318
 	}
@@ -1299,9 +1353,10 @@  discard block
 block discarded – undo
1299 1353
 			</div>';
1300 1354
 
1301 1355
 	// If they haven't post at all, don't draw the graph.
1302
-	if (empty($context['posts_by_time']))
1303
-		echo '
1356
+	if (empty($context['posts_by_time'])) {
1357
+			echo '
1304 1358
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1359
+	}
1305 1360
 	// Otherwise do!
1306 1361
 	else
1307 1362
 	{
@@ -1339,11 +1394,10 @@  discard block
 block discarded – undo
1339 1394
 					</h3>
1340 1395
 				</div>';
1341 1396
 
1342
-	if (empty($context['popular_boards']))
1343
-		echo '
1397
+	if (empty($context['popular_boards'])) {
1398
+			echo '
1344 1399
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1345
-
1346
-	else
1400
+	} else
1347 1401
 	{
1348 1402
 		echo '
1349 1403
 				<dl class="stats">';
@@ -1373,10 +1427,10 @@  discard block
 block discarded – undo
1373 1427
 					</h3>
1374 1428
 				</div>';
1375 1429
 
1376
-	if (empty($context['board_activity']))
1377
-		echo '
1430
+	if (empty($context['board_activity'])) {
1431
+			echo '
1378 1432
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1379
-	else
1433
+	} else
1380 1434
 	{
1381 1435
 		echo '
1382 1436
 				<dl class="stats">';
@@ -1427,41 +1481,46 @@  discard block
 block discarded – undo
1427 1481
 				<h3 class="catbg profile_hd">';
1428 1482
 
1429 1483
 		// Don't say "Profile" if this isn't the profile...
1430
-		if (!empty($context['profile_header_text']))
1431
-			echo '
1484
+		if (!empty($context['profile_header_text'])) {
1485
+					echo '
1432 1486
 					', $context['profile_header_text'];
1433
-		else
1434
-			echo '
1487
+		} else {
1488
+					echo '
1435 1489
 					', $txt['profile'];
1490
+		}
1436 1491
 
1437 1492
 		echo '
1438 1493
 				</h3>
1439 1494
 			</div>';
1440 1495
 
1441 1496
 	// Have we some description?
1442
-	if ($context['page_desc'])
1443
-		echo '
1497
+	if ($context['page_desc']) {
1498
+			echo '
1444 1499
 			<p class="information">', $context['page_desc'], '</p>';
1500
+	}
1445 1501
 
1446 1502
 	echo '
1447 1503
 			<div class="roundframe">';
1448 1504
 
1449 1505
 	// Any bits at the start?
1450
-	if (!empty($context['profile_prehtml']))
1451
-		echo '
1506
+	if (!empty($context['profile_prehtml'])) {
1507
+			echo '
1452 1508
 				<div>', $context['profile_prehtml'], '</div>';
1509
+	}
1453 1510
 
1454
-	if (!empty($context['profile_fields']))
1455
-		echo '
1511
+	if (!empty($context['profile_fields'])) {
1512
+			echo '
1456 1513
 				<dl class="settings">';
1514
+	}
1457 1515
 
1458 1516
 	// Start the big old loop 'of love.
1459 1517
 	$lastItem = 'hr';
1460 1518
 	foreach ($context['profile_fields'] as $key => $field)
1461 1519
 	{
1462 1520
 		// We add a little hack to be sure we never get more than one hr in a row!
1463
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1464
-			continue;
1521
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1522
+					continue;
1523
+		}
1465 1524
 
1466 1525
 		$lastItem = $field['type'];
1467 1526
 		if ($field['type'] == 'hr')
@@ -1470,48 +1529,50 @@  discard block
 block discarded – undo
1470 1529
 				</dl>
1471 1530
 				<hr>
1472 1531
 				<dl class="settings">';
1473
-		}
1474
-		elseif ($field['type'] == 'callback')
1532
+		} elseif ($field['type'] == 'callback')
1475 1533
 		{
1476 1534
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1477 1535
 			{
1478 1536
 				$callback_func = 'template_profile_' . $field['callback_func'];
1479 1537
 				$callback_func();
1480 1538
 			}
1481
-		}
1482
-		else
1539
+		} else
1483 1540
 		{
1484 1541
 			echo '
1485 1542
 					<dt>
1486 1543
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1487 1544
 
1488 1545
 			// Does it have any subtext to show?
1489
-			if (!empty($field['subtext']))
1490
-				echo '
1546
+			if (!empty($field['subtext'])) {
1547
+							echo '
1491 1548
 						<br>
1492 1549
 						<span class="smalltext">', $field['subtext'], '</span>';
1550
+			}
1493 1551
 
1494 1552
 			echo '
1495 1553
 					</dt>
1496 1554
 					<dd>';
1497 1555
 
1498 1556
 			// Want to put something infront of the box?
1499
-			if (!empty($field['preinput']))
1500
-				echo '
1557
+			if (!empty($field['preinput'])) {
1558
+							echo '
1501 1559
 						', $field['preinput'];
1560
+			}
1502 1561
 
1503 1562
 			// What type of data are we showing?
1504
-			if ($field['type'] == 'label')
1505
-				echo '
1563
+			if ($field['type'] == 'label') {
1564
+							echo '
1506 1565
 						', $field['value'];
1566
+			}
1507 1567
 
1508 1568
 			// Maybe it's a text box - very likely!
1509 1569
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1510 1570
 			{
1511
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1512
-					$type = 'number';
1513
-				else
1514
-					$type = $field['type'];
1571
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1572
+									$type = 'number';
1573
+				} else {
1574
+									$type = $field['type'];
1575
+				}
1515 1576
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1516 1577
 
1517 1578
 
@@ -1519,10 +1580,11 @@  discard block
 block discarded – undo
1519 1580
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1520 1581
 			}
1521 1582
 			// You "checking" me out? ;)
1522
-			elseif ($field['type'] == 'check')
1523
-				echo '
1583
+			elseif ($field['type'] == 'check') {
1584
+							echo '
1524 1585
 						<input type="hidden" name="', $key, '" value="0">
1525 1586
 						<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1587
+			}
1526 1588
 
1527 1589
 			// Always fun - select boxes!
1528 1590
 			elseif ($field['type'] == 'select')
@@ -1533,14 +1595,16 @@  discard block
 block discarded – undo
1533 1595
 				if (isset($field['options']))
1534 1596
 				{
1535 1597
 					// Is this some code to generate the options?
1536
-					if (!is_array($field['options']))
1537
-						$field['options'] = $field['options']();
1598
+					if (!is_array($field['options'])) {
1599
+											$field['options'] = $field['options']();
1600
+					}
1538 1601
 
1539 1602
 					// Assuming we now have some!
1540
-					if (is_array($field['options']))
1541
-						foreach ($field['options'] as $value => $name)
1603
+					if (is_array($field['options'])) {
1604
+											foreach ($field['options'] as $value => $name)
1542 1605
 							echo '
1543 1606
 							<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1607
+					}
1544 1608
 				}
1545 1609
 
1546 1610
 				echo '
@@ -1548,25 +1612,28 @@  discard block
 block discarded – undo
1548 1612
 			}
1549 1613
 
1550 1614
 			// Something to end with?
1551
-			if (!empty($field['postinput']))
1552
-				echo '
1615
+			if (!empty($field['postinput'])) {
1616
+							echo '
1553 1617
 						', $field['postinput'];
1618
+			}
1554 1619
 
1555 1620
 			echo '
1556 1621
 					</dd>';
1557 1622
 		}
1558 1623
 	}
1559 1624
 
1560
-	if (!empty($context['profile_fields']))
1561
-		echo '
1625
+	if (!empty($context['profile_fields'])) {
1626
+			echo '
1562 1627
 				</dl>';
1628
+	}
1563 1629
 
1564 1630
 	// Are there any custom profile fields - if so print them!
1565 1631
 	if (!empty($context['custom_fields']))
1566 1632
 	{
1567
-		if ($lastItem != 'hr')
1568
-			echo '
1633
+		if ($lastItem != 'hr') {
1634
+					echo '
1569 1635
 				<hr>';
1636
+		}
1570 1637
 
1571 1638
 		echo '
1572 1639
 				<dl class="settings">';
@@ -1589,13 +1656,14 @@  discard block
 block discarded – undo
1589 1656
 	}
1590 1657
 
1591 1658
 	// Any closing HTML?
1592
-	if (!empty($context['profile_posthtml']))
1593
-		echo '
1659
+	if (!empty($context['profile_posthtml'])) {
1660
+			echo '
1594 1661
 				<div>', $context['profile_posthtml'], '</div>';
1662
+	}
1595 1663
 
1596 1664
 	// Only show the password box if it's actually needed.
1597
-	if ($context['require_password'])
1598
-		echo '
1665
+	if ($context['require_password']) {
1666
+			echo '
1599 1667
 				<dl class="settings">
1600 1668
 					<dt>
1601 1669
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1605,18 +1673,21 @@  discard block
 block discarded – undo
1605 1673
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1606 1674
 					</dd>
1607 1675
 				</dl>';
1676
+	}
1608 1677
 
1609 1678
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1610
-	if (!empty($context['submit_button_text']))
1611
-		echo '
1679
+	if (!empty($context['submit_button_text'])) {
1680
+			echo '
1612 1681
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button">';
1613
-	else
1614
-		echo '
1682
+	} else {
1683
+			echo '
1615 1684
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button">';
1685
+	}
1616 1686
 
1617
-	if (!empty($context['token_check']))
1618
-		echo '
1687
+	if (!empty($context['token_check'])) {
1688
+			echo '
1619 1689
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1690
+	}
1620 1691
 
1621 1692
 	echo '
1622 1693
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1626,10 +1697,11 @@  discard block
 block discarded – undo
1626 1697
 		</form>';
1627 1698
 
1628 1699
 	// Any final spellchecking stuff?
1629
-	if (!empty($context['show_spellchecking']))
1630
-		echo '
1700
+	if (!empty($context['show_spellchecking'])) {
1701
+			echo '
1631 1702
 		<form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>';
1632
-}
1703
+	}
1704
+	}
1633 1705
 
1634 1706
 /**
1635 1707
  * Personal Message settings.
@@ -1666,10 +1738,11 @@  discard block
 block discarded – undo
1666 1738
 						<select name="pm_receive_from" id="pm_receive_from">
1667 1739
 							<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1668 1740
 
1669
-	if (!empty($modSettings['enable_buddylist']))
1670
-		echo '
1741
+	if (!empty($modSettings['enable_buddylist'])) {
1742
+			echo '
1671 1743
 							<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1672 1744
 							<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1745
+	}
1673 1746
 
1674 1747
 	echo '
1675 1748
 							<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1712,11 +1785,12 @@  discard block
 block discarded – undo
1712 1785
 		if (empty($setting) || !is_array($setting))
1713 1786
 		{
1714 1787
 			// Insert a separator (unless this is the first item in the list)
1715
-			if ($i !== $first_option_key)
1716
-				echo '
1788
+			if ($i !== $first_option_key) {
1789
+							echo '
1717 1790
 				</dl>
1718 1791
 				<hr>
1719 1792
 				<dl class="settings">';
1793
+			}
1720 1794
 
1721 1795
 			// Should we give a name to this section?
1722 1796
 			if (is_string($setting) && !empty($setting))
@@ -1725,52 +1799,57 @@  discard block
 block discarded – undo
1725 1799
 				echo '
1726 1800
 					<dt><strong>' . $setting . '</strong></dt>
1727 1801
 					<dd></dd>';
1802
+			} else {
1803
+							$titled_section = false;
1728 1804
 			}
1729
-			else
1730
-				$titled_section = false;
1731 1805
 
1732 1806
 			continue;
1733 1807
 		}
1734 1808
 
1735 1809
 		// Is this disabled?
1736
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1737
-			continue;
1738
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1739
-			continue;
1740
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1741
-			continue;
1742
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1743
-			continue;
1744
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1745
-			continue;
1746
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1747
-			continue;
1748
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1749
-			continue;
1810
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1811
+					continue;
1812
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1813
+					continue;
1814
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1815
+					continue;
1816
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1817
+					continue;
1818
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1819
+					continue;
1820
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1821
+					continue;
1822
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1823
+					continue;
1824
+		}
1750 1825
 
1751 1826
 		// Some of these may not be set...  Set to defaults here
1752 1827
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1753
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1754
-			$context['member']['options'][$setting['id']] = 0;
1828
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1829
+					$context['member']['options'][$setting['id']] = 0;
1830
+		}
1755 1831
 
1756
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1757
-			$setting['type'] = 'checkbox';
1758
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1759
-			$setting['type'] = 'number';
1760
-		elseif ($setting['type'] == 'string')
1761
-			$setting['type'] = 'text';
1832
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1833
+					$setting['type'] = 'checkbox';
1834
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1835
+					$setting['type'] = 'number';
1836
+		} elseif ($setting['type'] == 'string') {
1837
+					$setting['type'] = 'text';
1838
+		}
1762 1839
 
1763
-		if (isset($setting['options']))
1764
-			$setting['type'] = 'list';
1840
+		if (isset($setting['options'])) {
1841
+					$setting['type'] = 'list';
1842
+		}
1765 1843
 
1766 1844
 		echo '
1767 1845
 					<dt>
1768 1846
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1769 1847
 
1770
-		if (isset($setting['description']))
1771
-			echo '
1848
+		if (isset($setting['description'])) {
1849
+					echo '
1772 1850
 						<br>
1773 1851
 						<span class="smalltext">', $setting['description'], '</span>';
1852
+		}
1774 1853
 		echo '
1775 1854
 					</dt>
1776 1855
 					<dd>';
@@ -1808,13 +1887,11 @@  discard block
 block discarded – undo
1808 1887
 
1809 1888
 				echo '
1810 1889
 						<input type="number"', $min . $max . $step;
1811
-			}
1812
-			else if (isset($setting['type']) && $setting['type'] == 'url')
1890
+			} else if (isset($setting['type']) && $setting['type'] == 'url')
1813 1891
 			{
1814 1892
 				echo'
1815 1893
 						<input type="url"';
1816
-			}
1817
-			else
1894
+			} else
1818 1895
 			{
1819 1896
 				echo '
1820 1897
 						<input type="text"';
@@ -1855,8 +1932,8 @@  discard block
 block discarded – undo
1855 1932
 				<dl class="settings">';
1856 1933
 
1857 1934
 	// Allow notification on announcements to be disabled?
1858
-	if (!empty($modSettings['allow_disableAnnounce']))
1859
-		echo '
1935
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1936
+			echo '
1860 1937
 					<dt>
1861 1938
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1862 1939
 					</dt>
@@ -1864,15 +1941,17 @@  discard block
 block discarded – undo
1864 1941
 						<input type="hidden" name="notify_announcements" value="0">
1865 1942
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1866 1943
 					</dd>';
1944
+	}
1867 1945
 
1868
-	if (!empty($modSettings['enable_ajax_alerts']))
1869
-		echo '
1946
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1947
+			echo '
1870 1948
 					<dt>
1871 1949
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1872 1950
 					</dt>
1873 1951
 					<dd>
1874 1952
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1875 1953
 					</dd>';
1954
+	}
1876 1955
 
1877 1956
 	echo '
1878 1957
 				</dl>
@@ -1902,9 +1981,10 @@  discard block
 block discarded – undo
1902 1981
 					<td colspan="3">';
1903 1982
 				$label = $txt['alert_opt_' . $opts[1]];
1904 1983
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1905
-				if ($label_pos == 'before')
1906
-					echo '
1984
+				if ($label_pos == 'before') {
1985
+									echo '
1907 1986
 						<label for="opt_', $opts[1], '">', $label, '</label>';
1987
+				}
1908 1988
 
1909 1989
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1910 1990
 				switch ($opts[0])
@@ -1916,17 +1996,19 @@  discard block
 block discarded – undo
1916 1996
 					case 'select':
1917 1997
 						echo '
1918 1998
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1919
-						foreach ($opts['opts'] as $k => $v)
1920
-							echo '
1999
+						foreach ($opts['opts'] as $k => $v) {
2000
+													echo '
1921 2001
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
2002
+						}
1922 2003
 						echo '
1923 2004
 						</select>';
1924 2005
 						break;
1925 2006
 				}
1926 2007
 
1927
-				if ($label_pos == 'after')
1928
-					echo '
2008
+				if ($label_pos == 'after') {
2009
+									echo '
1929 2010
 						<label for="opt_', $opts[1], '">', $label, '</label>';
2011
+				}
1930 2012
 
1931 2013
 				echo '
1932 2014
 					</td>
@@ -2042,11 +2124,12 @@  discard block
 block discarded – undo
2042 2124
 			<p class="information">', $txt['groupMembership_info'], '</p>';
2043 2125
 
2044 2126
 	// Do we have an update message?
2045
-	if (!empty($context['update_message']))
2046
-		echo '
2127
+	if (!empty($context['update_message'])) {
2128
+			echo '
2047 2129
 			<div class="infobox">
2048 2130
 				', $context['update_message'], '.
2049 2131
 			</div>';
2132
+	}
2050 2133
 
2051 2134
 	echo '
2052 2135
 			<div id="groups">';
@@ -2068,8 +2151,7 @@  discard block
 block discarded – undo
2068 2151
 						</div>
2069 2152
 					</div>
2070 2153
 				</div><!-- .groupmembership -->';
2071
-	}
2072
-	else
2154
+	} else
2073 2155
 	{
2074 2156
 		echo '
2075 2157
 				<div class="title_bar">
@@ -2081,27 +2163,30 @@  discard block
 block discarded – undo
2081 2163
 			echo '
2082 2164
 				<div class="windowbg" id="primdiv_', $group['id'], '">';
2083 2165
 
2084
-				if ($context['can_edit_primary'])
2085
-					echo '
2166
+				if ($context['can_edit_primary']) {
2167
+									echo '
2086 2168
 					<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>';
2169
+				}
2087 2170
 
2088 2171
 				echo '
2089 2172
 					<label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>';
2090 2173
 
2091 2174
 				// Can they leave their group?
2092
-				if ($group['can_leave'])
2093
-					echo '
2175
+				if ($group['can_leave']) {
2176
+									echo '
2094 2177
 					<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
2178
+				}
2095 2179
 
2096 2180
 				echo '
2097 2181
 				</div><!-- .windowbg -->';
2098 2182
 		}
2099 2183
 
2100
-		if ($context['can_edit_primary'])
2101
-			echo '
2184
+		if ($context['can_edit_primary']) {
2185
+					echo '
2102 2186
 				<div class="padding righttext">
2103 2187
 					<input type="submit" value="', $txt['make_primary'], '" class="button">
2104 2188
 				</div>';
2189
+		}
2105 2190
 
2106 2191
 		// Any groups they can join?
2107 2192
 		if (!empty($context['groups']['available']))
@@ -2117,15 +2202,16 @@  discard block
 block discarded – undo
2117 2202
 				<div class="windowbg">
2118 2203
 					<strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '';
2119 2204
 
2120
-				if ($group['type'] == 3)
2121
-					echo '
2205
+				if ($group['type'] == 3) {
2206
+									echo '
2122 2207
 					<a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>';
2123
-				elseif ($group['type'] == 2 && $group['pending'])
2124
-					echo '
2208
+				} elseif ($group['type'] == 2 && $group['pending']) {
2209
+									echo '
2125 2210
 					<span class="floatright">', $txt['approval_pending'], '</span>';
2126
-				elseif ($group['type'] == 2)
2127
-					echo '
2211
+				} elseif ($group['type'] == 2) {
2212
+									echo '
2128 2213
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2214
+				}
2129 2215
 
2130 2216
 				echo '
2131 2217
 				</div><!-- .windowbg -->';
@@ -2148,9 +2234,10 @@  discard block
 block discarded – undo
2148 2234
 
2149 2235
 						prevDiv.className = "windowbg";
2150 2236
 					}';
2151
-		if (isset($context['groups']['member'][$context['primary_group']]))
2152
-			echo '
2237
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2238
+					echo '
2153 2239
 					highlightSelected("primdiv_' . $context['primary_group'] . '");';
2240
+		}
2154 2241
 		echo '
2155 2242
 				</script>';
2156 2243
 	}
@@ -2158,9 +2245,10 @@  discard block
 block discarded – undo
2158 2245
 	echo '
2159 2246
 			</div><!-- #groups -->';
2160 2247
 
2161
-	if (!empty($context['token_check']))
2162
-		echo '
2248
+	if (!empty($context['token_check'])) {
2249
+			echo '
2163 2250
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2251
+	}
2164 2252
 
2165 2253
 	echo '
2166 2254
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2208,14 +2296,15 @@  discard block
 block discarded – undo
2208 2296
 
2209 2297
 		foreach ($category['boards'] as $board)
2210 2298
 		{
2211
-			if ($i == $limit)
2212
-				echo '
2299
+			if ($i == $limit) {
2300
+							echo '
2213 2301
 						</ul>
2214 2302
 					</li>
2215 2303
 				</ul>
2216 2304
 				<ul class="ignoreboards floatright">
2217 2305
 					<li class="category">
2218 2306
 						<ul>';
2307
+			}
2219 2308
 
2220 2309
 			echo '
2221 2310
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2261,10 +2350,11 @@  discard block
 block discarded – undo
2261 2350
 
2262 2351
 	// Work out the starting color.
2263 2352
 	$context['current_color'] = $context['colors'][0];
2264
-	foreach ($context['colors'] as $limit => $color)
2265
-		if ($context['member']['warning'] >= $limit)
2353
+	foreach ($context['colors'] as $limit => $color) {
2354
+			if ($context['member']['warning'] >= $limit)
2266 2355
 			$context['current_color'] = $color;
2267
-}
2356
+	}
2357
+	}
2268 2358
 
2269 2359
 // Show all warnings of a user?
2270 2360
 function template_viewWarning()
@@ -2303,14 +2393,15 @@  discard block
 block discarded – undo
2303 2393
 				</dd>';
2304 2394
 
2305 2395
 	// There's some impact of this?
2306
-	if (!empty($context['level_effects'][$context['current_level']]))
2307
-		echo '
2396
+	if (!empty($context['level_effects'][$context['current_level']])) {
2397
+			echo '
2308 2398
 				<dt>
2309 2399
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2310 2400
 				</dt>
2311 2401
 				<dd>
2312 2402
 					', $context['level_effects'][$context['current_level']], '
2313 2403
 				</dd>';
2404
+	}
2314 2405
 
2315 2406
 	echo '
2316 2407
 			</dl>
@@ -2348,10 +2439,11 @@  discard block
 block discarded – undo
2348 2439
 
2349 2440
 			// Otherwise see what we can do...';
2350 2441
 
2351
-	foreach ($context['notification_templates'] as $k => $type)
2352
-		echo '
2442
+	foreach ($context['notification_templates'] as $k => $type) {
2443
+			echo '
2353 2444
 			if (index == ', $k, ')
2354 2445
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2446
+	}
2355 2447
 
2356 2448
 	echo '
2357 2449
 		}
@@ -2361,10 +2453,11 @@  discard block
 block discarded – undo
2361 2453
 			// Also set the right effect.
2362 2454
 			effectText = "";';
2363 2455
 
2364
-	foreach ($context['level_effects'] as $limit => $text)
2365
-		echo '
2456
+	foreach ($context['level_effects'] as $limit => $text) {
2457
+			echo '
2366 2458
 			if (slideAmount >= ', $limit, ')
2367 2459
 				effectText = "', $text, '";';
2460
+	}
2368 2461
 
2369 2462
 	echo '
2370 2463
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2379,32 +2472,35 @@  discard block
 block discarded – undo
2379 2472
 			</h3>
2380 2473
 		</div>';
2381 2474
 
2382
-	if (!$context['user']['is_owner'])
2383
-		echo '
2475
+	if (!$context['user']['is_owner']) {
2476
+			echo '
2384 2477
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2478
+	}
2385 2479
 
2386 2480
 	echo '
2387 2481
 		<div class="windowbg">
2388 2482
 			<dl class="settings">';
2389 2483
 
2390
-	if (!$context['user']['is_owner'])
2391
-		echo '
2484
+	if (!$context['user']['is_owner']) {
2485
+			echo '
2392 2486
 				<dt>
2393 2487
 					<strong>', $txt['profile_warning_name'], ':</strong>
2394 2488
 				</dt>
2395 2489
 				<dd>
2396 2490
 					<strong>', $context['member']['name'], '</strong>
2397 2491
 				</dd>';
2492
+	}
2398 2493
 
2399 2494
 	echo '
2400 2495
 				<dt>
2401 2496
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2402 2497
 
2403 2498
 	// Is there only so much they can apply?
2404
-	if ($context['warning_limit'])
2405
-		echo '
2499
+	if ($context['warning_limit']) {
2500
+			echo '
2406 2501
 					<br>
2407 2502
 					<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2503
+	}
2408 2504
 
2409 2505
 	echo '
2410 2506
 				</dt>
@@ -2459,9 +2555,10 @@  discard block
 block discarded – undo
2459 2555
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2460 2556
 						<option value="-1" disabled>------------------------------</option>';
2461 2557
 
2462
-		foreach ($context['notification_templates'] as $id_template => $template)
2463
-			echo '
2558
+		foreach ($context['notification_templates'] as $id_template => $template) {
2559
+					echo '
2464 2560
 						<option value="', $id_template, '">', $template['title'], '</option>';
2561
+		}
2465 2562
 
2466 2563
 		echo '
2467 2564
 					</select>
@@ -2474,9 +2571,10 @@  discard block
 block discarded – undo
2474 2571
 			</dl>
2475 2572
 			<div class="righttext">';
2476 2573
 
2477
-	if (!empty($context['token_check']))
2478
-		echo '
2574
+	if (!empty($context['token_check'])) {
2575
+			echo '
2479 2576
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2577
+	}
2480 2578
 
2481 2579
 	echo '
2482 2580
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2492,8 +2590,8 @@  discard block
 block discarded – undo
2492 2590
 	echo '
2493 2591
 	<script>';
2494 2592
 
2495
-	if (!$context['user']['is_owner'])
2496
-		echo '
2593
+	if (!$context['user']['is_owner']) {
2594
+			echo '
2497 2595
 		modifyWarnNotify();
2498 2596
 		$(document).ready(function() {
2499 2597
 			$("#preview_button").click(function() {
@@ -2532,6 +2630,7 @@  discard block
 block discarded – undo
2532 2630
 			});
2533 2631
 			return false;
2534 2632
 		}';
2633
+	}
2535 2634
 
2536 2635
 	echo '
2537 2636
 	</script>';
@@ -2554,16 +2653,18 @@  discard block
 block discarded – undo
2554 2653
 			</div>';
2555 2654
 
2556 2655
 	// If deleting another account give them a lovely info box.
2557
-	if (!$context['user']['is_owner'])
2558
-		echo '
2656
+	if (!$context['user']['is_owner']) {
2657
+			echo '
2559 2658
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2659
+	}
2560 2660
 	echo '
2561 2661
 			<div class="windowbg2">';
2562 2662
 
2563 2663
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2564
-	if ($context['needs_approval'])
2565
-		echo '
2664
+	if ($context['needs_approval']) {
2665
+			echo '
2566 2666
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2667
+	}
2567 2668
 
2568 2669
 	// If the user is deleting their own account warn them first - and require a password!
2569 2670
 	if ($context['user']['is_owner'])
@@ -2575,9 +2676,10 @@  discard block
 block discarded – undo
2575 2676
 					<input type="password" name="oldpasswrd" size="20">&nbsp;&nbsp;&nbsp;&nbsp;
2576 2677
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2577 2678
 
2578
-		if (!empty($context['token_check']))
2579
-			echo '
2679
+		if (!empty($context['token_check'])) {
2680
+					echo '
2580 2681
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2682
+		}
2581 2683
 
2582 2684
 		echo '
2583 2685
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2607,10 +2709,11 @@  discard block
 block discarded – undo
2607 2709
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2608 2710
 					</select>';
2609 2711
 
2610
-			if ($context['show_perma_delete'])
2611
-				echo '
2712
+			if ($context['show_perma_delete']) {
2713
+							echo '
2612 2714
 					<br>
2613 2715
 					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2716
+			}
2614 2717
 
2615 2718
 			echo '
2616 2719
 				</div>';
@@ -2623,9 +2726,10 @@  discard block
 block discarded – undo
2623 2726
 				<div>
2624 2727
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2625 2728
 
2626
-		if (!empty($context['token_check']))
2627
-			echo '
2729
+		if (!empty($context['token_check'])) {
2730
+					echo '
2628 2731
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2732
+		}
2629 2733
 
2630 2734
 		echo '
2631 2735
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2651,8 +2755,8 @@  discard block
 block discarded – undo
2651 2755
 					<hr>';
2652 2756
 
2653 2757
 	// Only show the password box if it's actually needed.
2654
-	if ($context['require_password'])
2655
-		echo '
2758
+	if ($context['require_password']) {
2759
+			echo '
2656 2760
 					<dl class="settings">
2657 2761
 						<dt>
2658 2762
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2662,13 +2766,15 @@  discard block
 block discarded – undo
2662 2766
 							<input type="password" name="oldpasswrd" size="20">
2663 2767
 						</dd>
2664 2768
 					</dl>';
2769
+	}
2665 2770
 
2666 2771
 	echo '
2667 2772
 					<div class="righttext">';
2668 2773
 
2669
-	if (!empty($context['token_check']))
2670
-		echo '
2774
+	if (!empty($context['token_check'])) {
2775
+			echo '
2671 2776
 						<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2777
+	}
2672 2778
 
2673 2779
 	echo '
2674 2780
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2695,9 +2801,10 @@  discard block
 block discarded – undo
2695 2801
 			<ul id="list_errors">';
2696 2802
 
2697 2803
 		// Cycle through each error and display an error message.
2698
-		foreach ($context['post_errors'] as $error)
2699
-			echo '
2804
+		foreach ($context['post_errors'] as $error) {
2805
+					echo '
2700 2806
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2807
+		}
2701 2808
 
2702 2809
 		echo '
2703 2810
 			</ul>';
@@ -2723,12 +2830,13 @@  discard block
 block discarded – undo
2723 2830
 								<select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 &amp;&amp; !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>';
2724 2831
 
2725 2832
 	// Fill the select box with all primary member groups that can be assigned to a member.
2726
-	foreach ($context['member_groups'] as $member_group)
2727
-		if (!empty($member_group['can_be_primary']))
2833
+	foreach ($context['member_groups'] as $member_group) {
2834
+			if (!empty($member_group['can_be_primary']))
2728 2835
 			echo '
2729 2836
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2730 2837
 										', $member_group['name'], '
2731 2838
 									</option>';
2839
+	}
2732 2840
 	echo '
2733 2841
 								</select>
2734 2842
 							</dd>
@@ -2740,10 +2848,11 @@  discard block
 block discarded – undo
2740 2848
 									<input type="hidden" name="additional_groups[]" value="0">';
2741 2849
 
2742 2850
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
2743
-	foreach ($context['member_groups'] as $member_group)
2744
-		if ($member_group['can_be_additional'])
2851
+	foreach ($context['member_groups'] as $member_group) {
2852
+			if ($member_group['can_be_additional'])
2745 2853
 			echo '
2746 2854
 									<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>';
2855
+	}
2747 2856
 	echo '
2748 2857
 								</span>
2749 2858
 								<a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a>
@@ -2803,9 +2912,10 @@  discard block
 block discarded – undo
2803 2912
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2804 2913
 								<br>';
2805 2914
 
2806
-	if ($context['show_spellchecking'])
2807
-		echo '
2915
+	if ($context['show_spellchecking']) {
2916
+			echo '
2808 2917
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2918
+	}
2809 2919
 
2810 2920
 		echo '
2811 2921
 							</dt>
@@ -2813,17 +2923,20 @@  discard block
 block discarded – undo
2813 2923
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2814 2924
 
2815 2925
 	// If there is a limit at all!
2816
-	if (!empty($context['signature_limits']['max_length']))
2817
-		echo '
2926
+	if (!empty($context['signature_limits']['max_length'])) {
2927
+			echo '
2818 2928
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2929
+	}
2819 2930
 
2820
-	if (!empty($context['show_preview_button']))
2821
-		echo '
2931
+	if (!empty($context['show_preview_button'])) {
2932
+			echo '
2822 2933
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button">';
2934
+	}
2823 2935
 
2824
-	if ($context['signature_warning'])
2825
-		echo '
2936
+	if ($context['signature_warning']) {
2937
+			echo '
2826 2938
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2939
+	}
2827 2940
 
2828 2941
 	// Some javascript used to count how many characters have been used so far in the signature.
2829 2942
 	echo '
@@ -2868,9 +2981,10 @@  discard block
 block discarded – undo
2868 2981
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2869 2982
 
2870 2983
 		// This lists all the file categories.
2871
-		foreach ($context['avatars'] as $avatar)
2872
-			echo '
2984
+		foreach ($context['avatars'] as $avatar) {
2985
+					echo '
2873 2986
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2987
+		}
2874 2988
 		echo '
2875 2989
 										</select>
2876 2990
 									</div>
@@ -2927,16 +3041,17 @@  discard block
 block discarded – undo
2927 3041
 								<div id="avatar_gravatar">
2928 3042
 									<img src="' . $context['member']['avatar']['href'] . '" alt="" />';
2929 3043
 
2930
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2931
-			echo '
3044
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
3045
+					echo '
2932 3046
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2933
-		else
3047
+		} else
2934 3048
 		{
2935 3049
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2936
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2937
-				$textbox_value = '';
2938
-			else
2939
-				$textbox_value = $context['member']['avatar']['external'];
3050
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
3051
+							$textbox_value = '';
3052
+			} else {
3053
+							$textbox_value = $context['member']['avatar']['external'];
3054
+			}
2940 3055
 
2941 3056
 			echo '
2942 3057
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -3008,8 +3123,9 @@  discard block
 block discarded – undo
3008 3123
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
3009 3124
 
3010 3125
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
3011
-	if (empty($suffix))
3012
-		return;
3126
+	if (empty($suffix)) {
3127
+			return;
3128
+	}
3013 3129
 
3014 3130
 	echo '
3015 3131
 								<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -3034,9 +3150,10 @@  discard block
 block discarded – undo
3034 3150
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
3035 3151
 
3036 3152
 	// Help the user by showing a list of common time formats.
3037
-	foreach ($context['easy_timeformats'] as $time_format)
3038
-		echo '
3153
+	foreach ($context['easy_timeformats'] as $time_format) {
3154
+			echo '
3039 3155
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3156
+	}
3040 3157
 	echo '
3041 3158
 								</select><br>
3042 3159
 								<input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30">
@@ -3073,9 +3190,10 @@  discard block
 block discarded – undo
3073 3190
 							<dd>
3074 3191
 								<select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">';
3075 3192
 
3076
-	foreach ($context['smiley_sets'] as $set)
3077
-		echo '
3193
+	foreach ($context['smiley_sets'] as $set) {
3194
+			echo '
3078 3195
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3196
+	}
3079 3197
 	echo '
3080 3198
 								</select>
3081 3199
 								<img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)">
@@ -3126,10 +3244,11 @@  discard block
 block discarded – undo
3126 3244
 										<img src="', $context['tfa_qr_url'], '" alt="">
3127 3245
 									</div>';
3128 3246
 
3129
-	if (!empty($context['from_ajax']))
3130
-		echo '
3247
+	if (!empty($context['from_ajax'])) {
3248
+			echo '
3131 3249
 					<br>
3132 3250
 					<a href="javascript:self.close();"></a>';
3251
+	}
3133 3252
 
3134 3253
 	echo '
3135 3254
 				</div>
@@ -3168,15 +3287,16 @@  discard block
 block discarded – undo
3168 3287
 								<div class="smalltext">', $txt['tfa_profile_desc'], '</div>
3169 3288
 							</dt>
3170 3289
 							<dd>';
3171
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3172
-		echo '
3290
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3291
+			echo '
3173 3292
 								<a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>';
3174
-	elseif (!$context['tfa_enabled'])
3175
-		echo '
3293
+	} elseif (!$context['tfa_enabled']) {
3294
+			echo '
3176 3295
 								', $txt['tfa_profile_disabled'];
3177
-	else
3178
-		echo '
3296
+	} else {
3297
+			echo '
3179 3298
 							', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3299
+	}
3180 3300
 	echo '
3181 3301
 							</dd>';
3182 3302
 }
Please login to merge, or discard this patch.
Themes/default/ManageBans.template.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,9 +26,10 @@  discard block
 block discarded – undo
26 26
 				</h3>
27 27
 			</div>';
28 28
 
29
-	if ($context['ban']['is_new'])
30
-		echo '
29
+	if ($context['ban']['is_new']) {
30
+			echo '
31 31
 			<div class="information noup">', $txt['ban_add_notes'], '</div>';
32
+	}
32 33
 
33 34
 	// If there were errors creating the ban, show them.
34 35
 	if (!empty($context['error_messages']))
@@ -38,9 +39,10 @@  discard block
 block discarded – undo
38 39
 				<strong>', $txt['ban_errors_detected'], '</strong>
39 40
 				<ul>';
40 41
 
41
-		foreach ($context['error_messages'] as $error)
42
-			echo '
42
+		foreach ($context['error_messages'] as $error) {
43
+					echo '
43 44
 					<li class="error">', $error, '</li>';
45
+		}
44 46
 
45 47
 		echo '
46 48
 				</ul>
@@ -57,8 +59,8 @@  discard block
 block discarded – undo
57 59
 						<input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60">
58 60
 					</dd>';
59 61
 
60
-	if (isset($context['ban']['reason']))
61
-		echo '
62
+	if (isset($context['ban']['reason'])) {
63
+			echo '
62 64
 					<dt>
63 65
 						<strong><label for="reason">', $txt['ban_reason'], ':</label></strong><br>
64 66
 						<span class="smalltext">', $txt['ban_reason_desc'], '</span>
@@ -66,9 +68,10 @@  discard block
 block discarded – undo
66 68
 					<dd>
67 69
 						<textarea name="reason" id="reason" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['reason'], '</textarea>
68 70
 					</dd>';
71
+	}
69 72
 
70
-	if (isset($context['ban']['notes']))
71
-		echo '
73
+	if (isset($context['ban']['notes'])) {
74
+			echo '
72 75
 					<dt>
73 76
 						<strong><label for="ban_notes">', $txt['ban_notes'], ':</label></strong><br>
74 77
 						<span class="smalltext">', $txt['ban_notes_desc'], '</span>
@@ -76,6 +79,7 @@  discard block
 block discarded – undo
76 79
 					<dd>
77 80
 						<textarea name="notes" id="ban_notes" cols="40" rows="3" style="min-height: 64px; max-height: 64px; min-width: 50%; max-width: 99%;">', $context['ban']['notes'], '</textarea>
78 81
 					</dd>';
82
+	}
79 83
 
80 84
 	echo '
81 85
 				</dl>
@@ -115,8 +119,8 @@  discard block
 block discarded – undo
115 119
 							<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
116 120
 						</dd>';
117 121
 
118
-		if (empty($modSettings['disableHostnameLookup']))
119
-			echo '
122
+		if (empty($modSettings['disableHostnameLookup'])) {
123
+					echo '
120 124
 						<dt>
121 125
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', !empty($context['ban_suggestions']['hostname']) ? ' checked' : '', '>
122 126
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -124,6 +128,7 @@  discard block
 block discarded – undo
124 128
 						<dd>
125 129
 							<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
126 130
 						</dd>';
131
+		}
127 132
 
128 133
 		echo '
129 134
 						<dt>
@@ -153,14 +158,15 @@  discard block
 block discarded – undo
153 158
 					<dl class="settings">';
154 159
 
155 160
 					$count = 0;
156
-					foreach ($ban_ips as $ip)
157
-						echo '
161
+					foreach ($ban_ips as $ip) {
162
+											echo '
158 163
 						<dt>
159 164
 							<input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]"', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? ' checked' : '', ' value="', $ip, '">
160 165
 						</dt>
161 166
 						<dd>
162 167
 							<label for="suggestions_', $key, '_', $count++, '">', $ip, '</label>
163 168
 						</dd>';
169
+					}
164 170
 
165 171
 					echo '
166 172
 					</dl>';
@@ -202,8 +208,8 @@  discard block
 block discarded – undo
202 208
 		addLoadEvent(fUpdateStatus);';
203 209
 
204 210
 	// Auto suggest only needed for adding new bans, not editing
205
-	if ($context['ban']['is_new'] && empty($_REQUEST['u']))
206
-		echo '
211
+	if ($context['ban']['is_new'] && empty($_REQUEST['u'])) {
212
+			echo '
207 213
 		var oAddMemberSuggest = new smc_AutoSuggest({
208 214
 			sSelf: \'oAddMemberSuggest\',
209 215
 			sSessionId: smf_session_id,
@@ -221,6 +227,7 @@  discard block
 block discarded – undo
221 227
 			return true;
222 228
 		}
223 229
 		oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\');';
230
+	}
224 231
 
225 232
 	echo '
226 233
 		function confirmBan(aForm)
@@ -269,8 +276,8 @@  discard block
 block discarded – undo
269 276
 							<input type="text" name="main_ip" value="', $context['ban_trigger']['ip']['value'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;">
270 277
 						</dd>';
271 278
 
272
-	if (empty($modSettings['disableHostnameLookup']))
273
-		echo '
279
+	if (empty($modSettings['disableHostnameLookup'])) {
280
+			echo '
274 281
 						<dt>
275 282
 							<input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname"', $context['ban_trigger']['hostname']['selected'] ? ' checked' : '', '>
276 283
 							<label for="hostname_check">', $txt['ban_on_hostname'], '</label>
@@ -278,6 +285,7 @@  discard block
 block discarded – undo
278 285
 						<dd>
279 286
 							<input type="text" name="hostname" value="', $context['ban_trigger']['hostname']['value'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;">
280 287
 						</dd>';
288
+	}
281 289
 
282 290
 	echo '
283 291
 						<dt>
Please login to merge, or discard this patch.
Themes/default/ManageMembergroups.template.php 1 patch
Braces   +92 added lines, -66 removed lines patch added patch discarded remove patch
@@ -55,9 +55,10 @@  discard block
 block discarded – undo
55 55
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
56 56
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
57 57
 
58
-		if ($context['allow_protected'])
59
-			echo '
58
+		if ($context['allow_protected']) {
59
+					echo '
60 60
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
61
+		}
61 62
 
62 63
 		echo '
63 64
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -67,14 +68,15 @@  discard block
 block discarded – undo
67 68
 					</dd>';
68 69
 	}
69 70
 
70
-	if ($context['post_group'] || $context['undefined_group'])
71
-		echo '
71
+	if ($context['post_group'] || $context['undefined_group']) {
72
+			echo '
72 73
 					<dt id="min_posts_text">
73 74
 						<strong>', $txt['membergroups_min_posts'], ':</strong>
74 75
 					</dt>
75 76
 					<dd>
76 77
 						<input type="number" name="min_posts" id="min_posts_input" size="5">
77 78
 					</dd>';
79
+	}
78 80
 
79 81
 	if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups']))
80 82
 	{
@@ -92,9 +94,10 @@  discard block
 block discarded – undo
92 94
 								<option value="-1">', $txt['membergroups_guests'], '</option>
93 95
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
94 96
 
95
-		foreach ($context['groups'] as $group)
96
-			echo '
97
+		foreach ($context['groups'] as $group) {
98
+					echo '
97 99
 								<option value="', $group['id'], '">', $group['name'], '</option>';
100
+		}
98 101
 
99 102
 		echo '
100 103
 							</select>
@@ -105,9 +108,10 @@  discard block
 block discarded – undo
105 108
 								<option value="-1">', $txt['membergroups_guests'], '</option>
106 109
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
107 110
 
108
-		foreach ($context['groups'] as $group)
109
-			echo '
111
+		foreach ($context['groups'] as $group) {
112
+					echo '
110 113
 								<option value="', $group['id'], '">', $group['name'], '</option>';
114
+		}
111 115
 
112 116
 		echo '
113 117
 							</select>
@@ -183,8 +187,8 @@  discard block
 block discarded – undo
183 187
 						<input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30">
184 188
 					</dd>';
185 189
 
186
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
187
-		echo '
190
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
191
+			echo '
188 192
 
189 193
 					<dt id="group_desc_text">
190 194
 						<label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label>
@@ -192,6 +196,7 @@  discard block
 block discarded – undo
192 196
 					<dd>
193 197
 						<textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea>
194 198
 					</dd>';
199
+	}
195 200
 
196 201
 	// Group type...
197 202
 	if ($context['group']['allow_post_group'])
@@ -205,9 +210,10 @@  discard block
 block discarded – undo
205 210
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
206 211
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
207 212
 
208
-		if ($context['group']['allow_protected'])
209
-			echo '
213
+		if ($context['group']['allow_protected']) {
214
+					echo '
210 215
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
216
+		}
211 217
 
212 218
 		echo '
213 219
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -217,8 +223,8 @@  discard block
 block discarded – undo
217 223
 					</dd>';
218 224
 	}
219 225
 
220
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
221
-		echo '
226
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
227
+			echo '
222 228
 					<dt id="group_moderators_text">
223 229
 						<label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label>
224 230
 					</dt>
@@ -236,6 +242,7 @@  discard block
 block discarded – undo
236 242
 							<option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option>
237 243
 						</select>
238 244
 					</dd>';
245
+	}
239 246
 
240 247
 	// Can they inherit permissions?
241 248
 	if ($context['group']['id'] > 1 && $context['group']['id'] != 3)
@@ -252,9 +259,10 @@  discard block
 block discarded – undo
252 259
 							<option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>';
253 260
 
254 261
 		// For all the inheritable groups show an option.
255
-		foreach ($context['inheritable_groups'] as $id => $group)
256
-			echo '
262
+		foreach ($context['inheritable_groups'] as $id => $group) {
263
+					echo '
257 264
 							<option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>';
265
+		}
258 266
 
259 267
 		echo '
260 268
 						</select>
@@ -262,8 +270,8 @@  discard block
 block discarded – undo
262 270
 					</dd>';
263 271
 	}
264 272
 
265
-	if ($context['group']['allow_post_group'])
266
-		echo '
273
+	if ($context['group']['allow_post_group']) {
274
+			echo '
267 275
 
268 276
 					<dt id="min_posts_text">
269 277
 						<label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label>
@@ -271,6 +279,7 @@  discard block
 block discarded – undo
271 279
 					<dd>
272 280
 						<input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6">
273 281
 					</dd>';
282
+	}
274 283
 
275 284
 	echo '
276 285
 					<dt>
@@ -313,9 +322,10 @@  discard block
 block discarded – undo
313 322
 	}
314 323
 
315 324
 	// No? Hide the entire control.
316
-	else
317
-		echo '
325
+	else {
326
+			echo '
318 327
 					<input type="hidden" name="icon_image" value="">';
328
+	}
319 329
 
320 330
 	echo '
321 331
 					<dt>
@@ -327,8 +337,8 @@  discard block
 block discarded – undo
327 337
 					</dd>';
328 338
 
329 339
 	// Force 2FA for this membergroup?
330
-	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2)
331
-		echo '
340
+	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) {
341
+			echo '
332 342
 					<dt>
333 343
 						<label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br>
334 344
 						<span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span>
@@ -336,6 +346,7 @@  discard block
 block discarded – undo
336 346
 					<dd>
337 347
 						<input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', '>
338 348
 					</dd>';
349
+	}
339 350
 
340 351
 	if (!empty($context['categories']))
341 352
 	{
@@ -346,11 +357,11 @@  discard block
 block discarded – undo
346 357
 					</dt>
347 358
 					<dd>';
348 359
 
349
-		if (!empty($context['can_manage_boards']))
350
-			echo $txt['membergroups_can_manage_access'];
351
-
352
-		else
353
-			template_add_edit_group_boards_list();
360
+		if (!empty($context['can_manage_boards'])) {
361
+					echo $txt['membergroups_can_manage_access'];
362
+		} else {
363
+					template_add_edit_group_boards_list();
364
+		}
354 365
 
355 366
 		echo '
356 367
 					</dd>';
@@ -379,20 +390,21 @@  discard block
 block discarded – undo
379 390
 			sItemListContainerId: \'moderator_container\',
380 391
 			aListItems: [';
381 392
 
382
-	foreach ($context['group']['moderators'] as $id_member => $member_name)
383
-		echo '
393
+	foreach ($context['group']['moderators'] as $id_member => $member_name) {
394
+			echo '
384 395
 				{
385 396
 					sItemId: ', JavaScriptEscape($id_member), ',
386 397
 					sItemName: ', JavaScriptEscape($member_name), '
387 398
 				}', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
399
+	}
388 400
 
389 401
 	echo '
390 402
 			]
391 403
 		});
392 404
 	</script>';
393 405
 
394
-	if ($context['group']['allow_post_group'])
395
-		echo '
406
+	if ($context['group']['allow_post_group']) {
407
+			echo '
396 408
 	<script>
397 409
 		function swapPostGroup(isChecked)
398 410
 		{
@@ -440,7 +452,8 @@  discard block
 block discarded – undo
440 452
 
441 453
 		swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
442 454
 	</script>';
443
-}
455
+	}
456
+	}
444 457
 
445 458
 /**
446 459
  * The template for determining which boards a group has access to.
@@ -458,13 +471,13 @@  discard block
 block discarded – undo
458 471
 
459 472
 	foreach ($context['categories'] as $category)
460 473
 	{
461
-		if (empty($modSettings['deny_boards_access']))
462
-			echo '
474
+		if (empty($modSettings['deny_boards_access'])) {
475
+					echo '
463 476
 									<li class="category">
464 477
 										<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a>
465 478
 										<ul style="width:100%">';
466
-		else
467
-			echo '
479
+		} else {
480
+					echo '
468 481
 									<li class="category">
469 482
 										<strong>', $category['name'], '</strong>
470 483
 										<span class="select_all_box">
@@ -477,16 +490,17 @@  discard block
 block discarded – undo
477 490
 											</select>
478 491
 										</span>
479 492
 										<ul style="width:100%" id="boards_list_', $category['id'], '">';
493
+		}
480 494
 
481 495
 		foreach ($category['boards'] as $board)
482 496
 		{
483
-			if (empty($modSettings['deny_boards_access']))
484
-				echo '
497
+			if (empty($modSettings['deny_boards_access'])) {
498
+							echo '
485 499
 											<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
486 500
 												<input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', '> <label for="brd', $board['id'], '">', $board['name'], '</label>
487 501
 											</li>';
488
-			else
489
-				echo '
502
+			} else {
503
+							echo '
490 504
 											<li class="board" style="width:100%">
491 505
 												<span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
492 506
 												<span style="width:50%;float:right">
@@ -495,6 +509,7 @@  discard block
 block discarded – undo
495 509
 													<input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', '> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
496 510
 												</span>
497 511
 											</li>';
512
+			}
498 513
 		}
499 514
 
500 515
 		echo '
@@ -505,14 +520,14 @@  discard block
 block discarded – undo
505 520
 	echo '
506 521
 								</ul>';
507 522
 
508
-	if (empty($modSettings['deny_boards_access']))
509
-		echo '
523
+	if (empty($modSettings['deny_boards_access'])) {
524
+			echo '
510 525
 								<br class="clear"><br>
511 526
 								<input type="checkbox" id="checkall_check" onclick="invertAll(this, this.form, \'boardaccess\');">
512 527
 								<label for="checkall_check"><em>', $txt['check_all'], '</em></label>
513 528
 							</fieldset>';
514
-	else
515
-		echo '
529
+	} else {
530
+			echo '
516 531
 								<br class="clear">
517 532
 								<span class="select_all_box">
518 533
 									<em>', $txt['all'], ': </em>
@@ -528,15 +543,17 @@  discard block
 block discarded – undo
528 543
 									});
529 544
 								});
530 545
 							</script>';
546
+	}
531 547
 
532
-	if ($collapse)
533
-		echo '
548
+	if ($collapse) {
549
+			echo '
534 550
 							<a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a>
535 551
 							<script>
536 552
 								document.getElementById("visible_boards_link").style.display = "";
537 553
 								document.getElementById("visible_boards").style.display = "none";
538 554
 							</script>';
539
-}
555
+	}
556
+	}
540 557
 
541 558
 /**
542 559
  * Templatine for viewing the members of a group.
@@ -561,14 +578,15 @@  discard block
 block discarded – undo
561 578
 					</dd>';
562 579
 
563 580
 	// Any description to show?
564
-	if (!empty($context['group']['description']))
565
-		echo '
581
+	if (!empty($context['group']['description'])) {
582
+			echo '
566 583
 					<dt>
567 584
 						<strong>' . $txt['membergroups_members_description'] . ':</strong>
568 585
 					</dt>
569 586
 					<dd>
570 587
 						', $context['group']['description'], '
571 588
 					</dd>';
589
+	}
572 590
 
573 591
 	echo '
574 592
 					<dt>
@@ -582,8 +600,9 @@  discard block
 block discarded – undo
582 600
 	if (!empty($context['group']['moderators']))
583 601
 	{
584 602
 		$moderators = array();
585
-		foreach ($context['group']['moderators'] as $moderator)
586
-			$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
603
+		foreach ($context['group']['moderators'] as $moderator) {
604
+					$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
605
+		}
587 606
 
588 607
 		echo '
589 608
 					<dt>
@@ -608,9 +627,10 @@  discard block
 block discarded – undo
608 627
 					<tr class="title_bar">
609 628
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
610 629
 
611
-	if ($context['can_send_email'])
612
-		echo '
630
+	if ($context['can_send_email']) {
631
+			echo '
613 632
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
633
+	}
614 634
 
615 635
 	echo '
616 636
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
@@ -619,19 +639,21 @@  discard block
 block discarded – undo
619 639
 							<a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a>
620 640
 						</th>';
621 641
 
622
-	if (!empty($context['group']['assignable']))
623
-		echo '
642
+	if (!empty($context['group']['assignable'])) {
643
+			echo '
624 644
 						<th style="width: 4%"><input type="checkbox" onclick="invertAll(this, this.form);"></th>';
645
+	}
625 646
 	echo '
626 647
 					</tr>
627 648
 				</thead>
628 649
 				<tbody>';
629 650
 
630
-	if (empty($context['members']))
631
-		echo '
651
+	if (empty($context['members'])) {
652
+			echo '
632 653
 					<tr class="windowbg">
633 654
 						<td colspan="6">', $txt['membergroups_members_no_members'], '</td>
634 655
 					</tr>';
656
+	}
635 657
 
636 658
 	foreach ($context['members'] as $member)
637 659
 	{
@@ -652,9 +674,10 @@  discard block
 block discarded – undo
652 674
 						<td>', $member['registered'], '</td>
653 675
 						<td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
654 676
 
655
-		if (!empty($context['group']['assignable']))
656
-			echo '
677
+		if (!empty($context['group']['assignable'])) {
678
+					echo '
657 679
 						<td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>';
680
+		}
658 681
 		echo '
659 682
 					</tr>';
660 683
 	}
@@ -663,11 +686,12 @@  discard block
 block discarded – undo
663 686
 				</tbody>
664 687
 			</table>';
665 688
 
666
-	if (!empty($context['group']['assignable']))
667
-		echo '
689
+	if (!empty($context['group']['assignable'])) {
690
+			echo '
668 691
 			<div class="floatright">
669 692
 				<input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button ">
670 693
 			</div>';
694
+	}
671 695
 
672 696
 	echo '
673 697
 			<div class="pagesection flow_hidden">
@@ -701,8 +725,8 @@  discard block
 block discarded – undo
701 725
 		</form>
702 726
 	</div><!-- #admincenter -->';
703 727
 
704
-	if (!empty($context['group']['assignable']))
705
-		echo '
728
+	if (!empty($context['group']['assignable'])) {
729
+			echo '
706 730
 	<script>
707 731
 		var oAddMemberSuggest = new smc_AutoSuggest({
708 732
 			sSelf: \'oAddMemberSuggest\',
@@ -718,7 +742,8 @@  discard block
 block discarded – undo
718 742
 			sItemListContainerId: \'toAddItemContainer\'
719 743
 		});
720 744
 	</script>';
721
-}
745
+	}
746
+	}
722 747
 
723 748
 /**
724 749
  * Allow the moderator to enter a reason to each user being rejected.
@@ -738,8 +763,8 @@  discard block
 block discarded – undo
738 763
 				<dl class="settings">';
739 764
 
740 765
 	// Loop through and print out a reason box for each...
741
-	foreach ($context['group_requests'] as $request)
742
-		echo '
766
+	foreach ($context['group_requests'] as $request) {
767
+			echo '
743 768
 					<dt>
744 769
 						<strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
745 770
 					</dt>
@@ -747,6 +772,7 @@  discard block
 block discarded – undo
747 772
 						<input type="hidden" name="groupr[]" value="', $request['id'], '">
748 773
 						<textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="min-width: 80%; max-width: 99%;"></textarea>
749 774
 					</dd>';
775
+	}
750 776
 
751 777
 	echo '
752 778
 				</dl>
Please login to merge, or discard this patch.
Sources/ShowAttachments.php 1 patch
Braces   +59 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Downloads an avatar or attachment based on $_GET['attach'], and increments the download count.
@@ -40,11 +41,11 @@  discard block
 block discarded – undo
40 41
 
41 42
 	if (!empty($modSettings['enableCompressedOutput']) && !headers_sent() && ob_get_length() == 0)
42 43
 	{
43
-		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler')
44
-			$modSettings['enableCompressedOutput'] = 0;
45
-
46
-		else
47
-			ob_start('ob_gzhandler');
44
+		if (@ini_get('zlib.output_compression') == '1' || @ini_get('output_handler') == 'ob_gzhandler') {
45
+					$modSettings['enableCompressedOutput'] = 0;
46
+		} else {
47
+					ob_start('ob_gzhandler');
48
+		}
48 49
 	}
49 50
 
50 51
 	if (empty($modSettings['enableCompressedOutput']))
@@ -76,8 +77,9 @@  discard block
 block discarded – undo
76 77
 	}
77 78
 
78 79
 	// Use cache when possible.
79
-	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null)
80
-		list($file, $thumbFile) = $cache;
80
+	if (($cache = cache_get_data('attachment_lookup_id-' . $attachId)) != null) {
81
+			list($file, $thumbFile) = $cache;
82
+	}
81 83
 
82 84
 	// Get the info from the DB.
83 85
 	if (empty($file) || empty($thumbFile) && !empty($file['id_thumb']))
@@ -85,10 +87,9 @@  discard block
 block discarded – undo
85 87
 		// Do we have a hook wanting to use our attachment system? We use $attachRequest to prevent accidental usage of $request.
86 88
 		$attachRequest = null;
87 89
 		call_integration_hook('integrate_download_request', array(&$attachRequest));
88
-		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest))
89
-			$request = $attachRequest;
90
-
91
-		else
90
+		if (!is_null($attachRequest) && $smcFunc['db_is_resource']($attachRequest)) {
91
+					$request = $attachRequest;
92
+		} else
92 93
 		{
93 94
 			// Make sure this attachment is on this board and load its info while we are at it.
94 95
 			$request = $smcFunc['db_query']('', '
@@ -181,13 +182,15 @@  discard block
 block discarded – undo
181 182
 		}
182 183
 
183 184
 		// Cache it.
184
-		if (!empty($file) || !empty($thumbFile))
185
-			cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
185
+		if (!empty($file) || !empty($thumbFile)) {
186
+					cache_put_data('attachment_lookup_id-' . $file['id_attach'], array($file, $thumbFile), mt_rand(850, 900));
187
+		}
186 188
 	}
187 189
 
188 190
 	// Replace the normal file with its thumbnail if it has one!
189
-	if (!empty($showThumb) && !empty($thumbFile))
190
-		$file = $thumbFile;
191
+	if (!empty($showThumb) && !empty($thumbFile)) {
192
+			$file = $thumbFile;
193
+	}
191 194
 
192 195
 	// No point in a nicer message, because this is supposed to be an attachment anyway...
193 196
 	if (!file_exists($file['filePath']))
@@ -237,8 +240,8 @@  discard block
 block discarded – undo
237 240
 	}
238 241
 
239 242
 	// Update the download counter (unless it's a thumbnail or resuming an incomplete download).
240
-	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0)
241
-		$smcFunc['db_query']('', '
243
+	if ($file['attachment_type'] != 3 && empty($showThumb) && $range === 0) {
244
+			$smcFunc['db_query']('', '
242 245
 			UPDATE {db_prefix}attachments
243 246
 			SET downloads = downloads + 1
244 247
 			WHERE id_attach = {int:id_attach}',
@@ -246,12 +249,14 @@  discard block
 block discarded – undo
246 249
 				'id_attach' => $attachId,
247 250
 			)
248 251
 		);
252
+	}
249 253
 
250 254
 	// Send the attachment headers.
251 255
 	header('Pragma: ');
252 256
 
253
-	if (!isBrowser('gecko'))
254
-		header('Content-Transfer-Encoding: binary');
257
+	if (!isBrowser('gecko')) {
258
+			header('Content-Transfer-Encoding: binary');
259
+	}
255 260
 
256 261
 	header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT');
257 262
 	header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file['filePath'])) . ' GMT');
@@ -260,18 +265,19 @@  discard block
 block discarded – undo
260 265
 	header('ETag: ' . $eTag);
261 266
 
262 267
 	// Make sure the mime type warrants an inline display.
263
-	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0)
264
-		unset($_REQUEST['image']);
268
+	if (isset($_REQUEST['image']) && !empty($file['mime_type']) && strpos($file['mime_type'], 'image/') !== 0) {
269
+			unset($_REQUEST['image']);
270
+	}
265 271
 
266 272
 	// Does this have a mime type?
267
-	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff'))))
268
-		header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
269
-
270
-	else
273
+	elseif (!empty($file['mime_type']) && (isset($_REQUEST['image']) || !in_array($file['fileext'], array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff')))) {
274
+			header('Content-Type: ' . strtr($file['mime_type'], array('image/bmp' => 'image/x-ms-bmp')));
275
+	} else
271 276
 	{
272 277
 		header('Content-Type: ' . (isBrowser('ie') || isBrowser('opera') ? 'application/octetstream' : 'application/octet-stream'));
273
-		if (isset($_REQUEST['image']))
274
-			unset($_REQUEST['image']);
278
+		if (isset($_REQUEST['image'])) {
279
+					unset($_REQUEST['image']);
280
+		}
275 281
 	}
276 282
 
277 283
 	// Convert the file to UTF-8, cuz most browsers dig that.
@@ -279,24 +285,22 @@  discard block
 block discarded – undo
279 285
 	$disposition = !isset($_REQUEST['image']) ? 'attachment' : 'inline';
280 286
 
281 287
 	// Different browsers like different standards...
282
-	if (isBrowser('firefox'))
283
-		header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
284
-
285
-	elseif (isBrowser('opera'))
286
-		header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
287
-
288
-	elseif (isBrowser('ie'))
289
-		header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
290
-
291
-	else
292
-		header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"');
288
+	if (isBrowser('firefox')) {
289
+			header('Content-Disposition: ' . $disposition . '; filename*=UTF-8\'\'' . rawurlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)));
290
+	} elseif (isBrowser('opera')) {
291
+			header('Content-Disposition: ' . $disposition . '; filename="' . preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name) . '"');
292
+	} elseif (isBrowser('ie')) {
293
+			header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace_callback('~&#(\d{3,8});~', 'fixchar__callback', $utf8name)) . '"');
294
+	} else {
295
+			header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"');
296
+	}
293 297
 
294 298
 	// If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE.
295
-	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff')))
296
-		header('Cache-Control: no-cache');
297
-
298
-	else
299
-		header('Cache-Control: max-age=' . (525600 * 60) . ', private');
299
+	if (!isset($_REQUEST['image']) && in_array($file['fileext'], array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff'))) {
300
+			header('Cache-Control: no-cache');
301
+	} else {
302
+			header('Cache-Control: max-age=' . (525600 * 60) . ', private');
303
+	}
300 304
 
301 305
 	// Multipart and resuming support
302 306
 	if (isset($_SERVER['HTTP_RANGE']))
@@ -304,9 +308,9 @@  discard block
 block discarded – undo
304 308
 		header("HTTP/1.1 206 Partial Content");
305 309
 		header("Content-Length: $new_length");
306 310
 		header("Content-Range: bytes $range-$range_end/$size");
311
+	} else {
312
+			header("Content-Length: " . $size);
307 313
 	}
308
-	else
309
-		header("Content-Length: " . $size);
310 314
 
311 315
 
312 316
 	// Try to buy some time...
@@ -315,8 +319,9 @@  discard block
 block discarded – undo
315 319
 	// For multipart/resumable downloads, send the requested chunk(s) of the file
316 320
 	if (isset($_SERVER['HTTP_RANGE']))
317 321
 	{
318
-		while (@ob_get_level() > 0)
319
-			@ob_end_clean();
322
+		while (@ob_get_level() > 0) {
323
+					@ob_end_clean();
324
+		}
320 325
 
321 326
 		// 40 kilobytes is a good-ish amount
322 327
 		$chunksize = 40 * 1024;
@@ -340,8 +345,9 @@  discard block
 block discarded – undo
340 345
 	elseif ($size > 4194304)
341 346
 	{
342 347
 		// Forcibly end any output buffering going on.
343
-		while (@ob_get_level() > 0)
344
-			@ob_end_clean();
348
+		while (@ob_get_level() > 0) {
349
+					@ob_end_clean();
350
+		}
345 351
 
346 352
 		$fp = fopen($file['filePath'], 'rb');
347 353
 		while (!feof($fp))
@@ -353,8 +359,9 @@  discard block
 block discarded – undo
353 359
 	}
354 360
 
355 361
 	// On some of the less-bright hosts, readfile() is disabled.  It's just a faster, more byte safe, version of what's in the if.
356
-	elseif (@readfile($file['filePath']) === null)
357
-		echo file_get_contents($file['filePath']);
362
+	elseif (@readfile($file['filePath']) === null) {
363
+			echo file_get_contents($file['filePath']);
364
+	}
358 365
 
359 366
 	die();
360 367
 }
Please login to merge, or discard this patch.
Sources/Subs-BoardIndex.php 1 patch
Braces   +60 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Fetches a list of boards and (optional) categories including
@@ -37,11 +38,12 @@  discard block
 block discarded – undo
37 38
 	require_once($sourcedir . '/Subs-Boards.php');
38 39
 
39 40
 	// For performance, track the latest post while going through the boards.
40
-	if (!empty($boardIndexOptions['set_latest_post']))
41
-		$latest_post = array(
41
+	if (!empty($boardIndexOptions['set_latest_post'])) {
42
+			$latest_post = array(
42 43
 			'timestamp' => 0,
43 44
 			'ref' => 0,
44 45
 		);
46
+	}
45 47
 
46 48
 	// Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
47 49
 	$result_boards = $smcFunc['db_query']('', '
@@ -74,10 +76,11 @@  discard block
 block discarded – undo
74 76
 	);
75 77
 
76 78
 	// Start with an empty array.
77
-	if ($boardIndexOptions['include_categories'])
78
-		$categories = array();
79
-	else
80
-		$this_category = array();
79
+	if ($boardIndexOptions['include_categories']) {
80
+			$categories = array();
81
+	} else {
82
+			$this_category = array();
83
+	}
81 84
 	$boards = array();
82 85
 
83 86
 	// Run through the categories and boards (or only boards)....
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 		$row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0';
89 92
 
90 93
 		// Add parent boards to the $boards list later used to fetch moderators
91
-		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'])
92
-			$boards[] = $row_board['id_board'];
94
+		if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) {
95
+					$boards[] = $row_board['id_board'];
96
+		}
93 97
 
94 98
 		if ($boardIndexOptions['include_categories'])
95 99
 		{
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 			}
112 116
 
113 117
 			// If this board has new posts in it (and isn't the recycle bin!) then the category is new.
114
-			if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board'])
115
-				$categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
118
+			if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) {
119
+							$categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
120
+			}
116 121
 
117 122
 			// Avoid showing category unread link where it only has redirection boards.
118 123
 			$categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect'];
@@ -161,14 +166,12 @@  discard block
 block discarded – undo
161 166
 				{
162 167
 					$this_category[$row_board['id_board']]['board_class'] = 'redirect';
163 168
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board'];
164
-				}
165
-				elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
169
+				} elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
166 170
 				{
167 171
 					// If we're showing to guests, we want to give them the idea that something interesting is going on!
168 172
 					$this_category[$row_board['id_board']]['board_class'] = 'on';
169 173
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts'];
170
-				}
171
-				else
174
+				} else
172 175
 				{
173 176
 					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts'];
174 177
 				}
@@ -219,14 +222,16 @@  discard block
 block discarded – undo
219 222
 		// Child of a child... just add it on...
220 223
 		elseif (!empty($boardIndexOptions['countChildPosts']))
221 224
 		{
222
-			if (!isset($parent_map))
223
-				$parent_map = array();
225
+			if (!isset($parent_map)) {
226
+							$parent_map = array();
227
+			}
224 228
 
225
-			if (!isset($parent_map[$row_board['id_parent']]))
226
-				foreach ($this_category as $id => $board)
229
+			if (!isset($parent_map[$row_board['id_parent']])) {
230
+							foreach ($this_category as $id => $board)
227 231
 				{
228 232
 					if (!isset($board['children'][$row_board['id_parent']]))
229 233
 						continue;
234
+			}
230 235
 
231 236
 					$parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
232 237
 					$parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
@@ -247,8 +252,9 @@  discard block
 block discarded – undo
247 252
 			continue;
248 253
 		}
249 254
 		// Found a child of a child - skip.
250
-		else
251
-			continue;
255
+		else {
256
+					continue;
257
+		}
252 258
 
253 259
 		// Prepare the subject, and make sure it's not too long.
254 260
 		censorText($row_board['subject']);
@@ -269,12 +275,13 @@  discard block
 block discarded – undo
269 275
 			'topic' => $row_board['id_topic']
270 276
 		);
271 277
 
272
-		if (!empty($settings['avatars_on_boardIndex']))
273
-			$this_last_post['member']['avatar'] = set_avatar_data(array(
278
+		if (!empty($settings['avatars_on_boardIndex'])) {
279
+					$this_last_post['member']['avatar'] = set_avatar_data(array(
274 280
 				'avatar' => $row_board['avatar'],
275 281
 				'email' => $row_board['email_address'],
276 282
 				'filename' => !empty($row_board['member_filename']) ? $row_board['member_filename'] : '',
277 283
 			));
284
+		}
278 285
 
279 286
 		// Provide the href and link.
280 287
 		if ($row_board['subject'] != '')
@@ -286,8 +293,7 @@  discard block
 block discarded – undo
286 293
 			link, href, subject, start (where they should go for the first unread post.),
287 294
 			and member. (which has id, name, link, href, username in it.) */
288 295
 			$this_last_post['last_post_message'] = sprintf($txt['last_post_message'], $this_last_post['member']['link'], $this_last_post['link'], $this_last_post['time']);
289
-		}
290
-		else
296
+		} else
291 297
 		{
292 298
 			$this_last_post['href'] = '';
293 299
 			$this_last_post['link'] = $txt['not_applicable'];
@@ -295,8 +301,9 @@  discard block
 block discarded – undo
295 301
 		}
296 302
 
297 303
 		// Set the last post in the parent board.
298
-		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))
299
-			$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
304
+		if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time']))) {
305
+					$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
306
+		}
300 307
 		// Just in the child...?
301 308
 		if ($isChild)
302 309
 		{
@@ -306,15 +313,17 @@  discard block
 block discarded – undo
306 313
 			$this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['new'] &= $row_board['poster_name'] != '';
307 314
 		}
308 315
 		// No last post for this board?  It's not new then, is it..?
309
-		elseif ($row_board['poster_name'] == '')
310
-			$this_category[$row_board['id_board']]['new'] = false;
316
+		elseif ($row_board['poster_name'] == '') {
317
+					$this_category[$row_board['id_board']]['new'] = false;
318
+		}
311 319
 
312 320
 		// Determine a global most recent topic.
313
-		if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard)
314
-			$latest_post = array(
321
+		if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) {
322
+					$latest_post = array(
315 323
 				'timestamp' => $row_board['poster_time'],
316 324
 				'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'],
317 325
 			);
326
+		}
318 327
 	}
319 328
 	$smcFunc['db_free_result']($result_boards);
320 329
 
@@ -331,8 +340,9 @@  discard block
 block discarded – undo
331 340
 				if (!empty($moderators[$board['id']]))
332 341
 				{
333 342
 					$categories[$k]['boards'][$j]['moderators'] = $moderators[$board['id']];
334
-					foreach ($moderators[$board['id']] as $moderator)
335
-						$categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link'];
343
+					foreach ($moderators[$board['id']] as $moderator) {
344
+											$categories[$k]['boards'][$j]['link_moderators'][] = $moderator['link'];
345
+					}
336 346
 				}
337 347
 				if (!empty($groups[$board['id']]))
338 348
 				{
@@ -345,16 +355,16 @@  discard block
 block discarded – undo
345 355
 				}
346 356
 			}
347 357
 		}
348
-	}
349
-	else
358
+	} else
350 359
 	{
351 360
 		foreach ($this_category as $k => $board)
352 361
 		{
353 362
 			if (!empty($moderators[$board['id']]))
354 363
 			{
355 364
 				$this_category[$k]['moderators'] = $moderators[$board['id']];
356
-				foreach ($moderators[$board['id']] as $moderator)
357
-					$this_category[$k]['link_moderators'][] = $moderator['link'];
365
+				foreach ($moderators[$board['id']] as $moderator) {
366
+									$this_category[$k]['link_moderators'][] = $moderator['link'];
367
+				}
358 368
 			}
359 369
 			if (!empty($groups[$board['id']]))
360 370
 			{
@@ -368,20 +378,23 @@  discard block
 block discarded – undo
368 378
 		}
369 379
 	}
370 380
 
371
-	if ($boardIndexOptions['include_categories'])
372
-		sortCategories($categories);
373
-	else
374
-		sortBoards($this_category);
381
+	if ($boardIndexOptions['include_categories']) {
382
+			sortCategories($categories);
383
+	} else {
384
+			sortBoards($this_category);
385
+	}
375 386
 
376 387
 	// By now we should know the most recent post...if we wanna know it that is.
377
-	if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref']))
378
-		$context['latest_post'] = $latest_post['ref'];
388
+	if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) {
389
+			$context['latest_post'] = $latest_post['ref'];
390
+	}
379 391
 
380 392
 	// I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea.
381
-	if ($boardIndexOptions['include_categories'])
382
-		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories));
383
-	else
384
-		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category));
393
+	if ($boardIndexOptions['include_categories']) {
394
+			call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories));
395
+	} else {
396
+			call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category));
397
+	}
385 398
 
386 399
 	return $boardIndexOptions['include_categories'] ? $categories : $this_category;
387 400
 }
Please login to merge, or discard this patch.