Completed
Push — release-2.1 ( 9df441...754615 )
by Mathias
15s
created
Themes/default/Profile.template.php 1 patch
Braces   +523 added lines, -402 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.)
@@ -99,19 +101,19 @@  discard block
 block discarded – undo
99 101
 		</div>
100 102
 		<div class="alerts_unread">';
101 103
 
102
-	if (empty($context['unread_alerts']))
103
-		template_alerts_all_read();
104
-
105
-	else
104
+	if (empty($context['unread_alerts'])) {
105
+			template_alerts_all_read();
106
+	} else
106 107
 	{
107
-		foreach ($context['unread_alerts'] as $id_alert => $details)
108
-			echo '
108
+		foreach ($context['unread_alerts'] as $id_alert => $details) {
109
+					echo '
109 110
 			<div class="unread">
110 111
 				', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', '
111 112
 				<div class="details">
112 113
 					', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], '
113 114
 				</div>
114 115
 			</div>';
116
+		}
115 117
 	}
116 118
 
117 119
 	echo '
@@ -158,37 +160,41 @@  discard block
 block discarded – undo
158 160
 	if (!empty($context['print_custom_fields']['above_member']))
159 161
 	{
160 162
 		$fields = '';
161
-		foreach ($context['print_custom_fields']['above_member'] as $field)
162
-			if (!empty($field['output_html']))
163
+		foreach ($context['print_custom_fields']['above_member'] as $field) {
164
+					if (!empty($field['output_html']))
163 165
 				$fields .= '
164 166
 					<li>' . $field['output_html'] . '</li>';
167
+		}
165 168
 
166
-		if (!empty($fields))
167
-			echo '
169
+		if (!empty($fields)) {
170
+					echo '
168 171
 			<div class="custom_fields_above_name">
169 172
 				<ul>', $fields, '
170 173
 				</ul>
171 174
 			</div>';
175
+		}
172 176
 	}
173 177
 
174 178
 	echo '
175 179
 			<div class="username clear">
176 180
 				<h4>';
177 181
 
178
-	if (!empty($context['print_custom_fields']['before_member']))
179
-		foreach ($context['print_custom_fields']['before_member'] as $field)
182
+	if (!empty($context['print_custom_fields']['before_member'])) {
183
+			foreach ($context['print_custom_fields']['before_member'] as $field)
180 184
 			if (!empty($field['output_html']))
181 185
 				echo '
182 186
 					<span>', $field['output_html'], '</span>';
187
+	}
183 188
 
184 189
 	echo '
185 190
 					', $context['member']['name'];
186 191
 
187
-	if (!empty($context['print_custom_fields']['after_member']))
188
-		foreach ($context['print_custom_fields']['after_member'] as $field)
192
+	if (!empty($context['print_custom_fields']['after_member'])) {
193
+			foreach ($context['print_custom_fields']['after_member'] as $field)
189 194
 			if (!empty($field['output_html']))
190 195
 				echo '
191 196
 					<span>', $field['output_html'], '</span>';
197
+	}
192 198
 
193 199
 
194 200
 	echo '
@@ -201,39 +207,44 @@  discard block
 block discarded – undo
201 207
 	if (!empty($context['print_custom_fields']['below_avatar']))
202 208
 	{
203 209
 		$fields = '';
204
-		foreach ($context['print_custom_fields']['below_avatar'] as $field)
205
-			if (!empty($field['output_html']))
210
+		foreach ($context['print_custom_fields']['below_avatar'] as $field) {
211
+					if (!empty($field['output_html']))
206 212
 				$fields .= '
207 213
 					<li>' . $field['output_html'] . '</li>';
214
+		}
208 215
 
209
-		if (!empty($fields))
210
-			echo '
216
+		if (!empty($fields)) {
217
+					echo '
211 218
 			<div class="custom_fields_below_avatar">
212 219
 				<ul>', $fields, '
213 220
 				</ul>
214 221
 			</div>';
222
+		}
215 223
 	}
216 224
 
217 225
 	echo '
218 226
 			<ul class="icon_fields clear">';
219 227
 
220 228
 	// Email is only visible if it's your profile or you have the moderate_forum permission
221
-	if ($context['member']['show_email'])
222
-		echo '
229
+	if ($context['member']['show_email']) {
230
+			echo '
223 231
 				<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>';
232
+	}
224 233
 
225 234
 	// Don't show an icon if they haven't specified a website.
226
-	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
227
-		echo '
235
+	if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) {
236
+			echo '
228 237
 				<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
238
+	}
229 239
 
230 240
 	// Are there any custom profile fields as icons?
231 241
 	if (!empty($context['print_custom_fields']['icons']))
232 242
 	{
233
-		foreach ($context['print_custom_fields']['icons'] as $field)
234
-			if (!empty($field['output_html']))
243
+		foreach ($context['print_custom_fields']['icons'] as $field) {
244
+					if (!empty($field['output_html']))
235 245
 				echo '
236 246
 				<li class="custom_field">', $field['output_html'], '</li>';
247
+		}
237 248
 	}
238 249
 
239 250
 	echo '
@@ -242,24 +253,27 @@  discard block
 block discarded – undo
242 253
 				', $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>' : '';
243 254
 
244 255
 	// Can they add this member as a buddy?
245
-	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
246
-		echo '
256
+	if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) {
257
+			echo '
247 258
 				<br>
248 259
 				<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
260
+	}
249 261
 
250 262
 	echo '
251 263
 			</span>';
252 264
 
253
-	if (!$context['user']['is_owner'] && $context['can_send_pm'])
254
-		echo '
265
+	if (!$context['user']['is_owner'] && $context['can_send_pm']) {
266
+			echo '
255 267
 			<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
268
+	}
256 269
 
257 270
 	echo '
258 271
 			<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
259 272
 
260
-	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
261
-		echo '
273
+	if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) {
274
+			echo '
262 275
 			<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
276
+	}
263 277
 
264 278
 	echo '
265 279
 			<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
@@ -268,17 +282,19 @@  discard block
 block discarded – undo
268 282
 	if (!empty($context['print_custom_fields']['bottom_poster']))
269 283
 	{
270 284
 		$fields = '';
271
-		foreach ($context['print_custom_fields']['bottom_poster'] as $field)
272
-			if (!empty($field['output_html']))
285
+		foreach ($context['print_custom_fields']['bottom_poster'] as $field) {
286
+					if (!empty($field['output_html']))
273 287
 				$fields .= '
274 288
 					<li>' . $field['output_html'] . '</li>';
289
+		}
275 290
 
276
-		if (!empty($fields))
277
-			echo '
291
+		if (!empty($fields)) {
292
+					echo '
278 293
 			<div class="custom_fields_bottom">
279 294
 				<ul class="nolist">', $fields, '
280 295
 				</ul>
281 296
 			</div>';
297
+		}
282 298
 	}
283 299
 
284 300
 	echo '
@@ -287,30 +303,35 @@  discard block
 block discarded – undo
287 303
 		<div id="detailedinfo">
288 304
 			<dl class="settings">';
289 305
 
290
-	if ($context['user']['is_owner'] || $context['user']['is_admin'])
291
-		echo '
306
+	if ($context['user']['is_owner'] || $context['user']['is_admin']) {
307
+			echo '
292 308
 				<dt>', $txt['username'], ': </dt>
293 309
 				<dd>', $context['member']['username'], '</dd>';
310
+	}
294 311
 
295
-	if (!isset($context['disabled_fields']['posts']))
296
-		echo '
312
+	if (!isset($context['disabled_fields']['posts'])) {
313
+			echo '
297 314
 				<dt>', $txt['profile_posts'], ': </dt>
298 315
 				<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
316
+	}
299 317
 
300
-	if ($context['member']['show_email'])
301
-		echo '
318
+	if ($context['member']['show_email']) {
319
+			echo '
302 320
 				<dt>', $txt['email'], ': </dt>
303 321
 				<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
322
+	}
304 323
 
305
-	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
306
-		echo '
324
+	if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) {
325
+			echo '
307 326
 				<dt>', $txt['custom_title'], ': </dt>
308 327
 				<dd>', $context['member']['title'], '</dd>';
328
+	}
309 329
 
310
-	if (!empty($context['member']['blurb']))
311
-		echo '
330
+	if (!empty($context['member']['blurb'])) {
331
+			echo '
312 332
 				<dt>', $txt['personal_text'], ': </dt>
313 333
 				<dd>', $context['member']['blurb'], '</dd>';
334
+	}
314 335
 
315 336
 	echo '
316 337
 				<dt>', $txt['age'], ':</dt>
@@ -324,19 +345,21 @@  discard block
 block discarded – undo
324 345
 	{
325 346
 		$fields = array();
326 347
 
327
-		foreach ($context['print_custom_fields']['standard'] as $field)
328
-			if (!empty($field['output_html']))
348
+		foreach ($context['print_custom_fields']['standard'] as $field) {
349
+					if (!empty($field['output_html']))
329 350
 				$fields[] = $field;
351
+		}
330 352
 
331 353
 		if (count($fields) > 0)
332 354
 		{
333 355
 			echo '
334 356
 			<dl class="settings">';
335 357
 
336
-			foreach ($fields as $field)
337
-				echo '
358
+			foreach ($fields as $field) {
359
+							echo '
338 360
 				<dt>', $field['name'], ':</dt>
339 361
 				<dd>', $field['output_html'], '</dd>';
362
+			}
340 363
 
341 364
 			echo '
342 365
 			</dl>';
@@ -356,9 +379,10 @@  discard block
 block discarded – undo
356 379
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
357 380
 
358 381
 		// Can we provide information on what this means?
359
-		if (!empty($context['warning_status']))
360
-			echo '
382
+		if (!empty($context['warning_status'])) {
383
+					echo '
361 384
 					<span class="smalltext">(', $context['warning_status'], ')</span>';
385
+		}
362 386
 
363 387
 		echo '
364 388
 				</dd>';
@@ -369,11 +393,12 @@  discard block
 block discarded – undo
369 393
 	{
370 394
 
371 395
 		// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
372
-		if (!empty($context['activate_message']))
373
-			echo '
396
+		if (!empty($context['activate_message'])) {
397
+					echo '
374 398
 				<dt class="clear">
375 399
 					<span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)
376 400
 				</dt>';
401
+		}
377 402
 
378 403
 		// If the current member is banned, show a message and possibly a link to the ban.
379 404
 		if (!empty($context['member']['bans']))
@@ -385,10 +410,11 @@  discard block
 block discarded – undo
385 410
 				<dt class="clear" id="ban_info" style="display: none;">
386 411
 					<strong>', $txt['user_banned_by_following'], ':</strong>';
387 412
 
388
-			foreach ($context['member']['bans'] as $ban)
389
-				echo '
413
+			foreach ($context['member']['bans'] as $ban) {
414
+							echo '
390 415
 					<br>
391 416
 					<span class="smalltext">', $ban['explanation'], '</span>';
417
+			}
392 418
 
393 419
 			echo '
394 420
 				</dt>';
@@ -402,30 +428,34 @@  discard block
 block discarded – undo
402 428
 	// If the person looking is allowed, they can check the members IP address and hostname.
403 429
 	if ($context['can_see_ip'])
404 430
 	{
405
-		if (!empty($context['member']['ip']))
406
-		echo '
431
+		if (!empty($context['member']['ip'])) {
432
+				echo '
407 433
 				<dt>', $txt['ip'], ': </dt>
408 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
+		}
409 436
 
410
-		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
411
-			echo '
437
+		if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) {
438
+					echo '
412 439
 				<dt>', $txt['hostname'], ': </dt>
413 440
 				<dd>', $context['member']['hostname'], '</dd>';
441
+		}
414 442
 	}
415 443
 
416 444
 	echo '
417 445
 				<dt>', $txt['local_time'], ':</dt>
418 446
 				<dd>', $context['member']['local_time'], '</dd>';
419 447
 
420
-	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
421
-		echo '
448
+	if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) {
449
+			echo '
422 450
 				<dt>', $txt['language'], ':</dt>
423 451
 				<dd>', $context['member']['language'], '</dd>';
452
+	}
424 453
 
425
-	if ($context['member']['show_last_login'])
426
-		echo '
454
+	if ($context['member']['show_last_login']) {
455
+			echo '
427 456
 				<dt>', $txt['lastLoggedIn'], ': </dt>
428 457
 				<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
458
+	}
429 459
 
430 460
 	echo '
431 461
 			</dl>';
@@ -434,42 +464,47 @@  discard block
 block discarded – undo
434 464
 	if (!empty($context['print_custom_fields']['above_signature']))
435 465
 	{
436 466
 		$fields = '';
437
-		foreach ($context['print_custom_fields']['above_signature'] as $field)
438
-			if (!empty($field['output_html']))
467
+		foreach ($context['print_custom_fields']['above_signature'] as $field) {
468
+					if (!empty($field['output_html']))
439 469
 				$fields .= '
440 470
 					<li>' . $field['output_html'] . '</li>';
471
+		}
441 472
 
442
-		if (!empty($fields))
443
-			echo '
473
+		if (!empty($fields)) {
474
+					echo '
444 475
 			<div class="custom_fields_above_signature">
445 476
 				<ul class="nolist">', $fields, '
446 477
 				</ul>
447 478
 			</div>';
479
+		}
448 480
 	}
449 481
 
450 482
 	// Show the users signature.
451
-	if ($context['signature_enabled'] && !empty($context['member']['signature']))
452
-		echo '
483
+	if ($context['signature_enabled'] && !empty($context['member']['signature'])) {
484
+			echo '
453 485
 			<div class="signature">
454 486
 				<h5>', $txt['signature'], ':</h5>
455 487
 				', $context['member']['signature'], '
456 488
 			</div>';
489
+	}
457 490
 
458 491
 	// Are there any custom profile fields for below the signature?
459 492
 	if (!empty($context['print_custom_fields']['below_signature']))
460 493
 	{
461 494
 		$fields = '';
462
-		foreach ($context['print_custom_fields']['below_signature'] as $field)
463
-			if (!empty($field['output_html']))
495
+		foreach ($context['print_custom_fields']['below_signature'] as $field) {
496
+					if (!empty($field['output_html']))
464 497
 				$fields .=  '
465 498
 					<li>' . $field['output_html'] . '</li>';
499
+		}
466 500
 
467
-		if (!empty($fields))
468
-			echo '
501
+		if (!empty($fields)) {
502
+					echo '
469 503
 			<div class="custom_fields_below_signature">
470 504
 				<ul class="nolist">', $fields, '
471 505
 				</ul>
472 506
 			</div>';
507
+		}
473 508
 	}
474 509
 
475 510
 	echo '
@@ -511,62 +546,70 @@  discard block
 block discarded – undo
511 546
 			</div>
512 547
 			<div class="list_posts">';
513 548
 
514
-			if (!$post['approved'])
515
-				echo '
549
+			if (!$post['approved']) {
550
+							echo '
516 551
 				<div class="approve_post">
517 552
 					<em>', $txt['post_awaiting_approval'], '</em>
518 553
 				</div>';
554
+			}
519 555
 
520 556
 			echo '
521 557
 				', $post['body'], '
522 558
 			</div>';
523 559
 
524
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
525
-				echo '
560
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
561
+							echo '
526 562
 			<div class="floatright">
527 563
 				<ul class="quickbuttons">';
564
+			}
528 565
 
529 566
 			// If they *can* reply?
530
-			if ($post['can_reply'])
531
-				echo '
567
+			if ($post['can_reply']) {
568
+							echo '
532 569
 					<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
570
+			}
533 571
 
534 572
 			// If they *can* quote?
535
-			if ($post['can_quote'])
536
-				echo '
573
+			if ($post['can_quote']) {
574
+							echo '
537 575
 					<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>';
576
+			}
538 577
 
539 578
 			// How about... even... remove it entirely?!
540
-			if ($post['can_delete'])
541
-				echo '
579
+			if ($post['can_delete']) {
580
+							echo '
542 581
 					<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>';
582
+			}
543 583
 
544
-			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
545
-				echo '
584
+			if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) {
585
+							echo '
546 586
 				</ul>
547 587
 			</div><!-- .floatright -->';
588
+			}
548 589
 
549 590
 			echo '
550 591
 		</div><!-- $post[css_class] -->';
551 592
 		}
593
+	} else {
594
+			template_show_list('attachments');
552 595
 	}
553
-	else
554
-		template_show_list('attachments');
555 596
 
556 597
 	// No posts? Just end with a informative message.
557
-	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
558
-		echo '
598
+	if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) {
599
+			echo '
559 600
 		<div class="windowbg2">
560 601
 			', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
561 602
 		</div>';
603
+	}
562 604
 
563 605
 	// Show more page numbers.
564
-	if (!empty($context['page_index']))
565
-		echo '
606
+	if (!empty($context['page_index'])) {
607
+			echo '
566 608
 		<div class="pagesection">
567 609
 			<div class="pagelinks">', $context['page_index'], '</div>
568 610
 		</div>';
569
-}
611
+	}
612
+	}
570 613
 
571 614
 /**
572 615
  * Template for showing alerts within the alerts popup
@@ -576,11 +619,12 @@  discard block
 block discarded – undo
576 619
 	global $context, $txt, $scripturl;
577 620
 
578 621
 	// Do we have an update message?
579
-	if (!empty($context['update_message']))
580
-		echo '
622
+	if (!empty($context['update_message'])) {
623
+			echo '
581 624
 		<div class="infobox">
582 625
 			', $context['update_message'], '
583 626
 		</div>';
627
+	}
584 628
 
585 629
 	echo '
586 630
 		<div class="cat_bar">
@@ -589,13 +633,12 @@  discard block
 block discarded – undo
589 633
 			</h3>
590 634
 		</div>';
591 635
 
592
-	if (empty($context['alerts']))
593
-		echo '
636
+	if (empty($context['alerts'])) {
637
+			echo '
594 638
 		<div class="information">
595 639
 			', $txt['alerts_none'], '
596 640
 		</div>';
597
-
598
-	else
641
+	} else
599 642
 	{
600 643
 		// Start the form.
601 644
 		echo '
@@ -657,12 +700,12 @@  discard block
 block discarded – undo
657 700
 		</div>' : '';
658 701
 
659 702
 	// No drafts? Just show an informative message.
660
-	if (empty($context['drafts']))
661
-		echo '
703
+	if (empty($context['drafts'])) {
704
+			echo '
662 705
 		<div class="windowbg2 centertext">
663 706
 			', $txt['draft_none'], '
664 707
 		</div>';
665
-	else
708
+	} else
666 709
 	{
667 710
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
668 711
 		foreach ($context['drafts'] as $draft)
@@ -674,13 +717,15 @@  discard block
 block discarded – undo
674 717
 				<h5>
675 718
 					<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> &nbsp; &nbsp;';
676 719
 
677
-			if (!empty($draft['sticky']))
678
-				echo '
720
+			if (!empty($draft['sticky'])) {
721
+							echo '
679 722
 					<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>';
723
+			}
680 724
 
681
-			if (!empty($draft['locked']))
682
-				echo '
725
+			if (!empty($draft['locked'])) {
726
+							echo '
683 727
 					<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>';
728
+			}
684 729
 
685 730
 			echo '
686 731
 				</h5>
@@ -713,13 +758,13 @@  discard block
 block discarded – undo
713 758
 {
714 759
 	global $context, $scripturl, $txt;
715 760
 
716
-	if (!empty($context['saved_successful']))
717
-		echo '
761
+	if (!empty($context['saved_successful'])) {
762
+			echo '
718 763
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
719
-
720
-	elseif (!empty($context['saved_failed']))
721
-		echo '
764
+	} elseif (!empty($context['saved_failed'])) {
765
+			echo '
722 766
 	<div class="errorbox">', $context['saved_failed'], '</div>';
767
+	}
723 768
 
724 769
 	echo '
725 770
 	<div id="edit_buddies">
@@ -734,14 +779,16 @@  discard block
 block discarded – undo
734 779
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
735 780
 					<th scope="col">', $txt['status'], '</th>';
736 781
 
737
-	if (allowedTo('moderate_forum'))
738
-		echo '
782
+	if (allowedTo('moderate_forum')) {
783
+			echo '
739 784
 					<th scope="col">', $txt['email'], '</th>';
785
+	}
740 786
 
741
-	if (!empty($context['custom_pf']))
742
-		foreach ($context['custom_pf'] as $column)
787
+	if (!empty($context['custom_pf'])) {
788
+			foreach ($context['custom_pf'] as $column)
743 789
 				echo '
744 790
 					<th scope="col">', $column['label'], '</th>';
791
+	}
745 792
 
746 793
 	echo '
747 794
 					<th scope="col">', $txt['remove'], '</th>
@@ -750,13 +797,14 @@  discard block
 block discarded – undo
750 797
 			<tbody>';
751 798
 
752 799
 	// If they don't have any buddies don't list them!
753
-	if (empty($context['buddies']))
754
-		echo '
800
+	if (empty($context['buddies'])) {
801
+			echo '
755 802
 				<tr class="windowbg">
756 803
 					<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '">
757 804
 						<strong>', $txt['no_buddies'], '</strong>
758 805
 					</td>
759 806
 				</tr>';
807
+	}
760 808
 
761 809
 		// Now loop through each buddy showing info on each.
762 810
 	else
@@ -770,17 +818,19 @@  discard block
 block discarded – undo
770 818
 						<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
771 819
 					</td>';
772 820
 
773
-			if ($buddy['show_email'])
774
-				echo '
821
+			if ($buddy['show_email']) {
822
+							echo '
775 823
 					<td>
776 824
 						<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
777 825
 					</td>';
826
+			}
778 827
 
779 828
 			// Show the custom profile fields for this user.
780
-			if (!empty($context['custom_pf']))
781
-				foreach ($context['custom_pf'] as $key => $column)
829
+			if (!empty($context['custom_pf'])) {
830
+							foreach ($context['custom_pf'] as $key => $column)
782 831
 					echo '
783 832
 					<td class="lefttext">', $buddy['options'][$key], '</td>';
833
+			}
784 834
 
785 835
 			echo '
786 836
 					<td>
@@ -813,9 +863,10 @@  discard block
 block discarded – undo
813 863
 			</dl>
814 864
 		</div>';
815 865
 
816
-	if (!empty($context['token_check']))
817
-		echo '
866
+	if (!empty($context['token_check'])) {
867
+			echo '
818 868
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
869
+	}
819 870
 
820 871
 	echo '
821 872
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -841,13 +892,13 @@  discard block
 block discarded – undo
841 892
 {
842 893
 	global $context, $scripturl, $txt;
843 894
 
844
-	if (!empty($context['saved_successful']))
845
-		echo '
895
+	if (!empty($context['saved_successful'])) {
896
+			echo '
846 897
 	<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
847
-
848
-	elseif (!empty($context['saved_failed']))
849
-		echo '
898
+	} elseif (!empty($context['saved_failed'])) {
899
+			echo '
850 900
 	<div class="errorbox">', $context['saved_failed'], '</div>';
901
+	}
851 902
 
852 903
 	echo '
853 904
 	<div id="edit_buddies">
@@ -862,9 +913,10 @@  discard block
 block discarded – undo
862 913
 					<th scope="col" class="quarter_table">', $txt['name'], '</th>
863 914
 					<th scope="col">', $txt['status'], '</th>';
864 915
 
865
-	if (allowedTo('moderate_forum'))
866
-		echo '
916
+	if (allowedTo('moderate_forum')) {
917
+			echo '
867 918
 					<th scope="col">', $txt['email'], '</th>';
919
+	}
868 920
 
869 921
 	echo '
870 922
 					<th scope="col">', $txt['ignore_remove'], '</th>
@@ -873,13 +925,14 @@  discard block
 block discarded – undo
873 925
 			<tbody>';
874 926
 
875 927
 	// If they don't have anyone on their ignore list, don't list it!
876
-	if (empty($context['ignore_list']))
877
-		echo '
928
+	if (empty($context['ignore_list'])) {
929
+			echo '
878 930
 				<tr class="windowbg">
879 931
 					<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '">
880 932
 						<strong>', $txt['no_ignore'], '</strong>
881 933
 					</td>
882 934
 				</tr>';
935
+	}
883 936
 
884 937
 	// Now loop through each buddy showing info on each.
885 938
 	foreach ($context['ignore_list'] as $member)
@@ -891,11 +944,12 @@  discard block
 block discarded – undo
891 944
 						<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
892 945
 					</td>';
893 946
 
894
-		if ($member['show_email'])
895
-			echo '
947
+		if ($member['show_email']) {
948
+					echo '
896 949
 					<td>
897 950
 						<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
898 951
 					</td>';
952
+		}
899 953
 		echo '
900 954
 					<td>
901 955
 						<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>
@@ -925,9 +979,10 @@  discard block
 block discarded – undo
925 979
 			</dl>
926 980
 		</div>';
927 981
 
928
-	if (!empty($context['token_check']))
929
-		echo '
982
+	if (!empty($context['token_check'])) {
983
+			echo '
930 984
 		<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
985
+	}
931 986
 
932 987
 	echo '
933 988
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -973,9 +1028,10 @@  discard block
 block discarded – undo
973 1028
 					<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
974 1029
 
975 1030
 	// Second address detected?
976
-	if (!empty($context['last_ip2']))
977
-		echo '
1031
+	if (!empty($context['last_ip2'])) {
1032
+			echo '
978 1033
 					, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
1034
+	}
979 1035
 
980 1036
 	echo '
981 1037
 				</dd>';
@@ -1041,9 +1097,10 @@  discard block
 block discarded – undo
1041 1097
 		</div>
1042 1098
 		<div class="windowbg2 noup">';
1043 1099
 
1044
-		foreach ($context['whois_servers'] as $server)
1045
-			echo '
1100
+		foreach ($context['whois_servers'] as $server) {
1101
+					echo '
1046 1102
 			<a href="', $server['url'], '" target="_blank" rel="noopener"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>';
1103
+		}
1047 1104
 		echo '
1048 1105
 		</div>
1049 1106
 		<br>';
@@ -1055,13 +1112,12 @@  discard block
 block discarded – undo
1055 1112
 			<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
1056 1113
 		</div>';
1057 1114
 
1058
-	if (empty($context['ips']))
1059
-		echo '
1115
+	if (empty($context['ips'])) {
1116
+			echo '
1060 1117
 		<p class="windowbg2 description">
1061 1118
 			<em>', $txt['no_members_from_ip'], '</em>
1062 1119
 		</p>';
1063
-
1064
-	else
1120
+	} else
1065 1121
 	{
1066 1122
 		echo '
1067 1123
 		<table class="table_grid">
@@ -1074,12 +1130,13 @@  discard block
 block discarded – undo
1074 1130
 			<tbody>';
1075 1131
 
1076 1132
 		// Loop through each of the members and display them.
1077
-		foreach ($context['ips'] as $ip => $memberlist)
1078
-			echo '
1133
+		foreach ($context['ips'] as $ip => $memberlist) {
1134
+					echo '
1079 1135
 				<tr class="windowbg">
1080 1136
 					<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
1081 1137
 					<td>', implode(', ', $memberlist), '</td>
1082 1138
 				</tr>';
1139
+		}
1083 1140
 
1084 1141
 		echo '
1085 1142
 			</tbody>
@@ -1121,11 +1178,10 @@  discard block
 block discarded – undo
1121 1178
 			</h3>
1122 1179
 		</div>';
1123 1180
 
1124
-	if ($context['member']['has_all_permissions'])
1125
-		echo '
1181
+	if ($context['member']['has_all_permissions']) {
1182
+			echo '
1126 1183
 		<div class="information">', $txt['showPermissions_all'], '</div>';
1127
-
1128
-	else
1184
+	} else
1129 1185
 	{
1130 1186
 		echo '
1131 1187
 		<div class="information">',$txt['showPermissions_help'], '</div>
@@ -1140,9 +1196,10 @@  discard block
 block discarded – undo
1140 1196
 			<div class="windowbg smalltext">
1141 1197
 				', $txt['showPermissions_restricted_boards_desc'], ':<br>';
1142 1198
 
1143
-			foreach ($context['no_access_boards'] as $no_access_board)
1144
-				echo '
1199
+			foreach ($context['no_access_boards'] as $no_access_board) {
1200
+							echo '
1145 1201
 				<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
1202
+			}
1146 1203
 			echo '
1147 1204
 			</div>';
1148 1205
 		}
@@ -1174,12 +1231,13 @@  discard block
 block discarded – undo
1174 1231
 							</td>
1175 1232
 							<td class="smalltext">';
1176 1233
 
1177
-				if ($permission['is_denied'])
1178
-					echo '
1234
+				if ($permission['is_denied']) {
1235
+									echo '
1179 1236
 								<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1180
-				else
1181
-					echo '
1237
+				} else {
1238
+									echo '
1182 1239
 								', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1240
+				}
1183 1241
 
1184 1242
 				echo '
1185 1243
 							</td>
@@ -1190,10 +1248,10 @@  discard block
 block discarded – undo
1190 1248
 				</table>
1191 1249
 			</div><!-- .tborder -->
1192 1250
 			<br>';
1193
-		}
1194
-		else
1195
-			echo '
1251
+		} else {
1252
+					echo '
1196 1253
 			<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>';
1254
+		}
1197 1255
 
1198 1256
 		// Board permission section.
1199 1257
 		echo '
@@ -1204,14 +1262,16 @@  discard block
 block discarded – undo
1204 1262
 						<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
1205 1263
 							<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>';
1206 1264
 
1207
-		if (!empty($context['boards']))
1208
-			echo '
1265
+		if (!empty($context['boards'])) {
1266
+					echo '
1209 1267
 							<option value="" disabled>---------------------------</option>';
1268
+		}
1210 1269
 
1211 1270
 		// Fill the box with any local permission boards.
1212
-		foreach ($context['boards'] as $board)
1213
-			echo '
1271
+		foreach ($context['boards'] as $board) {
1272
+					echo '
1214 1273
 							<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
1274
+		}
1215 1275
 
1216 1276
 		echo '
1217 1277
 						</select>
@@ -1240,13 +1300,13 @@  discard block
 block discarded – undo
1240 1300
 						</td>
1241 1301
 						<td class="smalltext">';
1242 1302
 
1243
-				if ($permission['is_denied'])
1244
-					echo '
1303
+				if ($permission['is_denied']) {
1304
+									echo '
1245 1305
 							<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>';
1246
-
1247
-				else
1248
-					echo '
1306
+				} else {
1307
+									echo '
1249 1308
 							', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']);
1309
+				}
1250 1310
 
1251 1311
 				echo '
1252 1312
 						</td>
@@ -1255,10 +1315,10 @@  discard block
 block discarded – undo
1255 1315
 			echo '
1256 1316
 				</tbody>
1257 1317
 			</table>';
1258
-		}
1259
-		else
1260
-			echo '
1318
+		} else {
1319
+					echo '
1261 1320
 			<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>';
1321
+		}
1262 1322
 	echo '
1263 1323
 		</div><!-- #permissions -->';
1264 1324
 	}
@@ -1299,9 +1359,10 @@  discard block
 block discarded – undo
1299 1359
 			</div>';
1300 1360
 
1301 1361
 	// If they haven't post at all, don't draw the graph.
1302
-	if (empty($context['posts_by_time']))
1303
-		echo '
1362
+	if (empty($context['posts_by_time'])) {
1363
+			echo '
1304 1364
 			<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1365
+	}
1305 1366
 
1306 1367
 	// Otherwise do!
1307 1368
 	else
@@ -1310,8 +1371,8 @@  discard block
 block discarded – undo
1310 1371
 			<ul class="activity_stats flow_hidden">';
1311 1372
 
1312 1373
 		// The labels.
1313
-		foreach ($context['posts_by_time'] as $time_of_day)
1314
-			echo '
1374
+		foreach ($context['posts_by_time'] as $time_of_day) {
1375
+					echo '
1315 1376
 				<li', $time_of_day['is_last'] ? ' class="last"' : '', '>
1316 1377
 					<div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '">
1317 1378
 						<div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
@@ -1320,6 +1381,7 @@  discard block
 block discarded – undo
1320 1381
 					</div>
1321 1382
 					<span class="stats_hour">', $time_of_day['hour_format'], '</span>
1322 1383
 				</li>';
1384
+		}
1323 1385
 
1324 1386
 		echo '
1325 1387
 			</ul>';
@@ -1338,11 +1400,10 @@  discard block
 block discarded – undo
1338 1400
 					</h3>
1339 1401
 				</div>';
1340 1402
 
1341
-	if (empty($context['popular_boards']))
1342
-		echo '
1403
+	if (empty($context['popular_boards'])) {
1404
+			echo '
1343 1405
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1344
-
1345
-	else
1406
+	} else
1346 1407
 	{
1347 1408
 		echo '
1348 1409
 				<dl class="stats">';
@@ -1372,10 +1433,10 @@  discard block
 block discarded – undo
1372 1433
 					</h3>
1373 1434
 				</div>';
1374 1435
 
1375
-	if (empty($context['board_activity']))
1376
-		echo '
1436
+	if (empty($context['board_activity'])) {
1437
+			echo '
1377 1438
 				<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>';
1378
-	else
1439
+	} else
1379 1440
 	{
1380 1441
 		echo '
1381 1442
 				<dl class="stats">';
@@ -1426,90 +1487,97 @@  discard block
 block discarded – undo
1426 1487
 				<h3 class="catbg profile_hd">';
1427 1488
 
1428 1489
 		// Don't say "Profile" if this isn't the profile...
1429
-		if (!empty($context['profile_header_text']))
1430
-			echo '
1490
+		if (!empty($context['profile_header_text'])) {
1491
+					echo '
1431 1492
 					', $context['profile_header_text'];
1432
-		else
1433
-			echo '
1493
+		} else {
1494
+					echo '
1434 1495
 					', $txt['profile'];
1496
+		}
1435 1497
 
1436 1498
 		echo '
1437 1499
 				</h3>
1438 1500
 			</div>';
1439 1501
 
1440 1502
 	// Have we some description?
1441
-	if ($context['page_desc'])
1442
-		echo '
1503
+	if ($context['page_desc']) {
1504
+			echo '
1443 1505
 			<p class="information">', $context['page_desc'], '</p>';
1506
+	}
1444 1507
 
1445 1508
 	echo '
1446 1509
 			<div class="roundframe">';
1447 1510
 
1448 1511
 	// Any bits at the start?
1449
-	if (!empty($context['profile_prehtml']))
1450
-		echo '
1512
+	if (!empty($context['profile_prehtml'])) {
1513
+			echo '
1451 1514
 				<div>', $context['profile_prehtml'], '</div>';
1515
+	}
1452 1516
 
1453
-	if (!empty($context['profile_fields']))
1454
-		echo '
1517
+	if (!empty($context['profile_fields'])) {
1518
+			echo '
1455 1519
 				<dl class="settings">';
1520
+	}
1456 1521
 
1457 1522
 	// Start the big old loop 'of love.
1458 1523
 	$lastItem = 'hr';
1459 1524
 	foreach ($context['profile_fields'] as $key => $field)
1460 1525
 	{
1461 1526
 		// We add a little hack to be sure we never get more than one hr in a row!
1462
-		if ($lastItem == 'hr' && $field['type'] == 'hr')
1463
-			continue;
1527
+		if ($lastItem == 'hr' && $field['type'] == 'hr') {
1528
+					continue;
1529
+		}
1464 1530
 
1465 1531
 		$lastItem = $field['type'];
1466
-		if ($field['type'] == 'hr')
1467
-			echo '
1532
+		if ($field['type'] == 'hr') {
1533
+					echo '
1468 1534
 				</dl>
1469 1535
 				<hr>
1470 1536
 				<dl class="settings">';
1471
-
1472
-		elseif ($field['type'] == 'callback')
1537
+		} elseif ($field['type'] == 'callback')
1473 1538
 		{
1474 1539
 			if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
1475 1540
 			{
1476 1541
 				$callback_func = 'template_profile_' . $field['callback_func'];
1477 1542
 				$callback_func();
1478 1543
 			}
1479
-		}
1480
-		else
1544
+		} else
1481 1545
 		{
1482 1546
 			echo '
1483 1547
 					<dt>
1484 1548
 						<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
1485 1549
 
1486 1550
 			// Does it have any subtext to show?
1487
-			if (!empty($field['subtext']))
1488
-				echo '
1551
+			if (!empty($field['subtext'])) {
1552
+							echo '
1489 1553
 						<br>
1490 1554
 						<span class="smalltext">', $field['subtext'], '</span>';
1555
+			}
1491 1556
 
1492 1557
 			echo '
1493 1558
 					</dt>
1494 1559
 					<dd>';
1495 1560
 
1496 1561
 			// Want to put something infront of the box?
1497
-			if (!empty($field['preinput']))
1498
-				echo '
1562
+			if (!empty($field['preinput'])) {
1563
+							echo '
1499 1564
 						', $field['preinput'];
1565
+			}
1500 1566
 
1501 1567
 			// What type of data are we showing?
1502
-			if ($field['type'] == 'label')
1503
-				echo '
1568
+			if ($field['type'] == 'label') {
1569
+							echo '
1504 1570
 						', $field['value'];
1571
+			}
1505 1572
 
1506 1573
 			// Maybe it's a text box - very likely!
1507 1574
 			elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url')))
1508 1575
 			{
1509
-				if ($field['type'] == 'int' || $field['type'] == 'float')
1510
-					$type = 'number';
1511
-				else
1512
-					$type = $field['type'];
1576
+				if ($field['type'] == 'int' || $field['type'] == 'float') {
1577
+									$type = 'number';
1578
+				} else {
1579
+									$type = $field['type'];
1580
+				}
1513 1581
 				$step = $field['type'] == 'float' ? ' step="0.1"' : '';
1514 1582
 
1515 1583
 
@@ -1517,10 +1585,11 @@  discard block
 block discarded – undo
1517 1585
 						<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>';
1518 1586
 			}
1519 1587
 			// You "checking" me out? ;)
1520
-			elseif ($field['type'] == 'check')
1521
-				echo '
1588
+			elseif ($field['type'] == 'check') {
1589
+							echo '
1522 1590
 						<input type="hidden" name="', $key, '" value="0">
1523 1591
 						<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>';
1592
+			}
1524 1593
 
1525 1594
 			// Always fun - select boxes!
1526 1595
 			elseif ($field['type'] == 'select')
@@ -1531,14 +1600,16 @@  discard block
 block discarded – undo
1531 1600
 				if (isset($field['options']))
1532 1601
 				{
1533 1602
 					// Is this some code to generate the options?
1534
-					if (!is_array($field['options']))
1535
-						$field['options'] = $field['options']();
1603
+					if (!is_array($field['options'])) {
1604
+											$field['options'] = $field['options']();
1605
+					}
1536 1606
 
1537 1607
 					// Assuming we now have some!
1538
-					if (is_array($field['options']))
1539
-						foreach ($field['options'] as $value => $name)
1608
+					if (is_array($field['options'])) {
1609
+											foreach ($field['options'] as $value => $name)
1540 1610
 							echo '
1541 1611
 							<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>';
1612
+					}
1542 1613
 				}
1543 1614
 
1544 1615
 				echo '
@@ -1546,31 +1617,34 @@  discard block
 block discarded – undo
1546 1617
 			}
1547 1618
 
1548 1619
 			// Something to end with?
1549
-			if (!empty($field['postinput']))
1550
-				echo '
1620
+			if (!empty($field['postinput'])) {
1621
+							echo '
1551 1622
 						', $field['postinput'];
1623
+			}
1552 1624
 
1553 1625
 			echo '
1554 1626
 					</dd>';
1555 1627
 		}
1556 1628
 	}
1557 1629
 
1558
-	if (!empty($context['profile_fields']))
1559
-		echo '
1630
+	if (!empty($context['profile_fields'])) {
1631
+			echo '
1560 1632
 				</dl>';
1633
+	}
1561 1634
 
1562 1635
 	// Are there any custom profile fields - if so print them!
1563 1636
 	if (!empty($context['custom_fields']))
1564 1637
 	{
1565
-		if ($lastItem != 'hr')
1566
-			echo '
1638
+		if ($lastItem != 'hr') {
1639
+					echo '
1567 1640
 				<hr>';
1641
+		}
1568 1642
 
1569 1643
 		echo '
1570 1644
 				<dl class="settings">';
1571 1645
 
1572
-		foreach ($context['custom_fields'] as $field)
1573
-			echo '
1646
+		foreach ($context['custom_fields'] as $field) {
1647
+					echo '
1574 1648
 					<dt>
1575 1649
 						<strong>', $field['name'], ': </strong><br>
1576 1650
 						<span class="smalltext">', $field['desc'], '</span>
@@ -1578,6 +1652,7 @@  discard block
 block discarded – undo
1578 1652
 					<dd>
1579 1653
 						', $field['input_html'], '
1580 1654
 					</dd>';
1655
+		}
1581 1656
 
1582 1657
 		echo '
1583 1658
 				</dl>';
@@ -1585,13 +1660,14 @@  discard block
 block discarded – undo
1585 1660
 	}
1586 1661
 
1587 1662
 	// Any closing HTML?
1588
-	if (!empty($context['profile_posthtml']))
1589
-		echo '
1663
+	if (!empty($context['profile_posthtml'])) {
1664
+			echo '
1590 1665
 				<div>', $context['profile_posthtml'], '</div>';
1666
+	}
1591 1667
 
1592 1668
 	// Only show the password box if it's actually needed.
1593
-	if ($context['require_password'])
1594
-		echo '
1669
+	if ($context['require_password']) {
1670
+			echo '
1595 1671
 				<dl class="settings">
1596 1672
 					<dt>
1597 1673
 						<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br>
@@ -1601,18 +1677,21 @@  discard block
 block discarded – undo
1601 1677
 						<input type="password" name="oldpasswrd" id="oldpasswrd" size="20">
1602 1678
 					</dd>
1603 1679
 				</dl>';
1680
+	}
1604 1681
 
1605 1682
 	// The button shouldn't say "Change profile" unless we're changing the profile...
1606
-	if (!empty($context['submit_button_text']))
1607
-		echo '
1683
+	if (!empty($context['submit_button_text'])) {
1684
+			echo '
1608 1685
 				<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">';
1609
-	else
1610
-		echo '
1686
+	} else {
1687
+			echo '
1611 1688
 				<input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">';
1689
+	}
1612 1690
 
1613
-	if (!empty($context['token_check']))
1614
-		echo '
1691
+	if (!empty($context['token_check'])) {
1692
+			echo '
1615 1693
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
1694
+	}
1616 1695
 
1617 1696
 	echo '
1618 1697
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1622,10 +1701,11 @@  discard block
 block discarded – undo
1622 1701
 		</form>';
1623 1702
 
1624 1703
 	// Any final spellchecking stuff?
1625
-	if (!empty($context['show_spellchecking']))
1626
-		echo '
1704
+	if (!empty($context['show_spellchecking'])) {
1705
+			echo '
1627 1706
 		<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>';
1628
-}
1707
+	}
1708
+	}
1629 1709
 
1630 1710
 /**
1631 1711
  * Personal Message settings.
@@ -1662,10 +1742,11 @@  discard block
 block discarded – undo
1662 1742
 						<select name="pm_receive_from" id="pm_receive_from">
1663 1743
 							<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
1664 1744
 
1665
-	if (!empty($modSettings['enable_buddylist']))
1666
-		echo '
1745
+	if (!empty($modSettings['enable_buddylist'])) {
1746
+			echo '
1667 1747
 							<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
1668 1748
 							<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
1749
+	}
1669 1750
 
1670 1751
 	echo '
1671 1752
 							<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
@@ -1708,11 +1789,12 @@  discard block
 block discarded – undo
1708 1789
 		if (empty($setting) || !is_array($setting))
1709 1790
 		{
1710 1791
 			// Insert a separator (unless this is the first item in the list)
1711
-			if ($i !== $first_option_key)
1712
-				echo '
1792
+			if ($i !== $first_option_key) {
1793
+							echo '
1713 1794
 				</dl>
1714 1795
 				<hr>
1715 1796
 				<dl class="settings">';
1797
+			}
1716 1798
 
1717 1799
 			// Should we give a name to this section?
1718 1800
 			if (is_string($setting) && !empty($setting))
@@ -1721,69 +1803,67 @@  discard block
 block discarded – undo
1721 1803
 				echo '
1722 1804
 					<dt><strong>' . $setting . '</strong></dt>
1723 1805
 					<dd></dd>';
1806
+			} else {
1807
+							$titled_section = false;
1724 1808
 			}
1725
-			else
1726
-				$titled_section = false;
1727 1809
 
1728 1810
 			continue;
1729 1811
 		}
1730 1812
 
1731 1813
 		// Is this disabled?
1732
-		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled']))
1733
-			continue;
1734
-
1735
-		elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage']))
1736
-			continue;
1737
-
1738
-		elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored']))
1739
-			continue;
1740
-
1741
-		elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist']))
1742
-			continue;
1743
-
1744
-		elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg']))
1745
-			continue;
1746
-
1747
-		elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1748
-			continue;
1749
-
1750
-		elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled']))))
1751
-			continue;
1814
+		if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) {
1815
+					continue;
1816
+		} elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) {
1817
+					continue;
1818
+		} elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) {
1819
+					continue;
1820
+		} elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) {
1821
+					continue;
1822
+		} elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) {
1823
+					continue;
1824
+		} elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1825
+					continue;
1826
+		} elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) {
1827
+					continue;
1828
+		}
1752 1829
 
1753 1830
 		// Some of these may not be set...  Set to defaults here
1754 1831
 		$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod');
1755
-		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']]))
1756
-			$context['member']['options'][$setting['id']] = 0;
1757
-
1758
-		if (!isset($setting['type']) || $setting['type'] == 'bool')
1759
-			$setting['type'] = 'checkbox';
1760
-
1761
-		elseif ($setting['type'] == 'int' || $setting['type'] == 'integer')
1762
-			$setting['type'] = 'number';
1832
+		if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) {
1833
+					$context['member']['options'][$setting['id']] = 0;
1834
+		}
1763 1835
 
1764
-		elseif ($setting['type'] == 'string')
1765
-			$setting['type'] = 'text';
1836
+		if (!isset($setting['type']) || $setting['type'] == 'bool') {
1837
+					$setting['type'] = 'checkbox';
1838
+		} elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') {
1839
+					$setting['type'] = 'number';
1840
+		} elseif ($setting['type'] == 'string') {
1841
+					$setting['type'] = 'text';
1842
+		}
1766 1843
 
1767
-		if (isset($setting['options']))
1768
-			$setting['type'] = 'list';
1844
+		if (isset($setting['options'])) {
1845
+					$setting['type'] = 'list';
1846
+		}
1769 1847
 
1770 1848
 		echo '
1771 1849
 					<dt>
1772 1850
 						<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>';
1773 1851
 
1774
-		if (isset($setting['description']))
1775
-			echo '
1852
+		if (isset($setting['description'])) {
1853
+					echo '
1776 1854
 						<br>
1777 1855
 						<span class="smalltext">', $setting['description'], '</span>';
1856
+		}
1778 1857
 		echo '
1779 1858
 					</dt>
1780 1859
 					<dd>';
1781 1860
 
1782 1861
 		// Display checkbox options
1783
-		if ($setting['type'] == 'checkbox')
1784
-			echo '
1862
+		if ($setting['type'] == 'checkbox') {
1863
+					echo '
1785 1864
 						<input type="hidden" name="default_options[' . $setting['id'] . ']" value="0">
1786 1865
 						<input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">';
1866
+		}
1787 1867
 
1788 1868
 		// How about selection lists, we all love them
1789 1869
 		elseif ($setting['type'] == 'list')
@@ -1791,9 +1871,10 @@  discard block
 block discarded – undo
1791 1871
 			echo '
1792 1872
 						<select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>';
1793 1873
 
1794
-			foreach ($setting['options'] as $value => $label)
1795
-				echo '
1874
+			foreach ($setting['options'] as $value => $label) {
1875
+							echo '
1796 1876
 							<option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>';
1877
+			}
1797 1878
 
1798 1879
 			echo '
1799 1880
 						</select>';
@@ -1809,14 +1890,13 @@  discard block
 block discarded – undo
1809 1890
 
1810 1891
 				echo '
1811 1892
 						<input type="number"', $min . $max . $step;
1812
-			}
1813
-			elseif (isset($setting['type']) && $setting['type'] == 'url')
1814
-				echo'
1893
+			} elseif (isset($setting['type']) && $setting['type'] == 'url') {
1894
+							echo'
1815 1895
 						<input type="url"';
1816
-
1817
-			else
1818
-				echo '
1896
+			} else {
1897
+							echo '
1819 1898
 						<input type="text"';
1899
+			}
1820 1900
 
1821 1901
 			echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>';
1822 1902
 		}
@@ -1853,8 +1933,8 @@  discard block
 block discarded – undo
1853 1933
 				<dl class="settings">';
1854 1934
 
1855 1935
 	// Allow notification on announcements to be disabled?
1856
-	if (!empty($modSettings['allow_disableAnnounce']))
1857
-		echo '
1936
+	if (!empty($modSettings['allow_disableAnnounce'])) {
1937
+			echo '
1858 1938
 					<dt>
1859 1939
 						<label for="notify_announcements">', $txt['notify_important_email'], '</label>
1860 1940
 					</dt>
@@ -1862,15 +1942,17 @@  discard block
 block discarded – undo
1862 1942
 						<input type="hidden" name="notify_announcements" value="0">
1863 1943
 						<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '>
1864 1944
 					</dd>';
1945
+	}
1865 1946
 
1866
-	if (!empty($modSettings['enable_ajax_alerts']))
1867
-		echo '
1947
+	if (!empty($modSettings['enable_ajax_alerts'])) {
1948
+			echo '
1868 1949
 					<dt>
1869 1950
 						<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label>
1870 1951
 					</dt>
1871 1952
 					<dd>
1872 1953
 						<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '">
1873 1954
 					</dd>';
1955
+	}
1874 1956
 
1875 1957
 	echo '
1876 1958
 				</dl>
@@ -1902,9 +1984,10 @@  discard block
 block discarded – undo
1902 1984
 
1903 1985
 				$label = $txt['alert_opt_' . $opts[1]];
1904 1986
 				$label_pos = isset($opts['label']) ? $opts['label'] : '';
1905
-				if ($label_pos == 'before')
1906
-					echo '
1987
+				if ($label_pos == 'before') {
1988
+									echo '
1907 1989
 						<label for="opt_', $opts[1], '">', $label, '</label>';
1990
+				}
1908 1991
 
1909 1992
 				$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
1910 1993
 				switch ($opts[0])
@@ -1918,17 +2001,19 @@  discard block
 block discarded – undo
1918 2001
 						echo '
1919 2002
 						<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
1920 2003
 
1921
-						foreach ($opts['opts'] as $k => $v)
1922
-							echo '
2004
+						foreach ($opts['opts'] as $k => $v) {
2005
+													echo '
1923 2006
 							<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
2007
+						}
1924 2008
 						echo '
1925 2009
 						</select>';
1926 2010
 						break;
1927 2011
 				}
1928 2012
 
1929
-				if ($label_pos == 'after')
1930
-					echo '
2013
+				if ($label_pos == 'after') {
2014
+									echo '
1931 2015
 						<label for="opt_', $opts[1], '">', $label, '</label>';
2016
+				}
1932 2017
 
1933 2018
 				echo '
1934 2019
 					</td>
@@ -2045,11 +2130,12 @@  discard block
 block discarded – undo
2045 2130
 			<p class="information">', $txt['groupMembership_info'], '</p>';
2046 2131
 
2047 2132
 	// Do we have an update message?
2048
-	if (!empty($context['update_message']))
2049
-		echo '
2133
+	if (!empty($context['update_message'])) {
2134
+			echo '
2050 2135
 			<div class="infobox">
2051 2136
 				', $context['update_message'], '.
2052 2137
 			</div>';
2138
+	}
2053 2139
 
2054 2140
 	echo '
2055 2141
 			<div id="groups">';
@@ -2071,8 +2157,7 @@  discard block
 block discarded – undo
2071 2157
 						</div>
2072 2158
 					</div>
2073 2159
 				</div><!-- .groupmembership -->';
2074
-	}
2075
-	else
2160
+	} else
2076 2161
 	{
2077 2162
 		echo '
2078 2163
 				<div class="title_bar">
@@ -2084,27 +2169,30 @@  discard block
 block discarded – undo
2084 2169
 			echo '
2085 2170
 				<div class="windowbg" id="primdiv_', $group['id'], '">';
2086 2171
 
2087
-				if ($context['can_edit_primary'])
2088
-					echo '
2172
+				if ($context['can_edit_primary']) {
2173
+									echo '
2089 2174
 					<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', '>';
2175
+				}
2090 2176
 
2091 2177
 				echo '
2092 2178
 					<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>';
2093 2179
 
2094 2180
 				// Can they leave their group?
2095
-				if ($group['can_leave'])
2096
-					echo '
2181
+				if ($group['can_leave']) {
2182
+									echo '
2097 2183
 					<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>';
2184
+				}
2098 2185
 
2099 2186
 				echo '
2100 2187
 				</div><!-- .windowbg -->';
2101 2188
 		}
2102 2189
 
2103
-		if ($context['can_edit_primary'])
2104
-			echo '
2190
+		if ($context['can_edit_primary']) {
2191
+					echo '
2105 2192
 				<div class="padding righttext">
2106 2193
 					<input type="submit" value="', $txt['make_primary'], '" class="button">
2107 2194
 				</div>';
2195
+		}
2108 2196
 
2109 2197
 		// Any groups they can join?
2110 2198
 		if (!empty($context['groups']['available']))
@@ -2120,17 +2208,16 @@  discard block
 block discarded – undo
2120 2208
 				<div class="windowbg">
2121 2209
 					<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>' : ''), '';
2122 2210
 
2123
-				if ($group['type'] == 3)
2124
-					echo '
2211
+				if ($group['type'] == 3) {
2212
+									echo '
2125 2213
 					<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>';
2126
-
2127
-				elseif ($group['type'] == 2 && $group['pending'])
2128
-					echo '
2214
+				} elseif ($group['type'] == 2 && $group['pending']) {
2215
+									echo '
2129 2216
 					<span class="floatright">', $txt['approval_pending'], '</span>';
2130
-
2131
-				elseif ($group['type'] == 2)
2132
-					echo '
2217
+				} elseif ($group['type'] == 2) {
2218
+									echo '
2133 2219
 					<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>';
2220
+				}
2134 2221
 
2135 2222
 				echo '
2136 2223
 				</div><!-- .windowbg -->';
@@ -2153,9 +2240,10 @@  discard block
 block discarded – undo
2153 2240
 
2154 2241
 						prevDiv.className = "windowbg";
2155 2242
 					}';
2156
-		if (isset($context['groups']['member'][$context['primary_group']]))
2157
-			echo '
2243
+		if (isset($context['groups']['member'][$context['primary_group']])) {
2244
+					echo '
2158 2245
 					highlightSelected("primdiv_' . $context['primary_group'] . '");';
2246
+		}
2159 2247
 
2160 2248
 		echo '
2161 2249
 				</script>';
@@ -2164,9 +2252,10 @@  discard block
 block discarded – undo
2164 2252
 	echo '
2165 2253
 			</div><!-- #groups -->';
2166 2254
 
2167
-	if (!empty($context['token_check']))
2168
-		echo '
2255
+	if (!empty($context['token_check'])) {
2256
+			echo '
2169 2257
 			<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2258
+	}
2170 2259
 
2171 2260
 	echo '
2172 2261
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2214,14 +2303,15 @@  discard block
 block discarded – undo
2214 2303
 
2215 2304
 		foreach ($category['boards'] as $board)
2216 2305
 		{
2217
-			if ($i == $limit)
2218
-				echo '
2306
+			if ($i == $limit) {
2307
+							echo '
2219 2308
 						</ul>
2220 2309
 					</li>
2221 2310
 				</ul>
2222 2311
 				<ul class="ignoreboards floatright">
2223 2312
 					<li class="category">
2224 2313
 						<ul>';
2314
+			}
2225 2315
 
2226 2316
 			echo '
2227 2317
 							<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
@@ -2267,10 +2357,11 @@  discard block
 block discarded – undo
2267 2357
 
2268 2358
 	// Work out the starting color.
2269 2359
 	$context['current_color'] = $context['colors'][0];
2270
-	foreach ($context['colors'] as $limit => $color)
2271
-		if ($context['member']['warning'] >= $limit)
2360
+	foreach ($context['colors'] as $limit => $color) {
2361
+			if ($context['member']['warning'] >= $limit)
2272 2362
 			$context['current_color'] = $color;
2273
-}
2363
+	}
2364
+	}
2274 2365
 
2275 2366
 // Show all warnings of a user?
2276 2367
 function template_viewWarning()
@@ -2309,14 +2400,15 @@  discard block
 block discarded – undo
2309 2400
 				</dd>';
2310 2401
 
2311 2402
 	// There's some impact of this?
2312
-	if (!empty($context['level_effects'][$context['current_level']]))
2313
-		echo '
2403
+	if (!empty($context['level_effects'][$context['current_level']])) {
2404
+			echo '
2314 2405
 				<dt>
2315 2406
 					<strong>', $txt['profile_viewwarning_impact'], ':</strong>
2316 2407
 				</dt>
2317 2408
 				<dd>
2318 2409
 					', $context['level_effects'][$context['current_level']], '
2319 2410
 				</dd>';
2411
+	}
2320 2412
 
2321 2413
 	echo '
2322 2414
 			</dl>
@@ -2354,10 +2446,11 @@  discard block
 block discarded – undo
2354 2446
 
2355 2447
 			// Otherwise see what we can do...';
2356 2448
 
2357
-	foreach ($context['notification_templates'] as $k => $type)
2358
-		echo '
2449
+	foreach ($context['notification_templates'] as $k => $type) {
2450
+			echo '
2359 2451
 			if (index == ', $k, ')
2360 2452
 				document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
2453
+	}
2361 2454
 
2362 2455
 	echo '
2363 2456
 		}
@@ -2367,10 +2460,11 @@  discard block
 block discarded – undo
2367 2460
 			// Also set the right effect.
2368 2461
 			effectText = "";';
2369 2462
 
2370
-	foreach ($context['level_effects'] as $limit => $text)
2371
-		echo '
2463
+	foreach ($context['level_effects'] as $limit => $text) {
2464
+			echo '
2372 2465
 			if (slideAmount >= ', $limit, ')
2373 2466
 				effectText = "', $text, '";';
2467
+	}
2374 2468
 
2375 2469
 	echo '
2376 2470
 			setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\');
@@ -2385,32 +2479,35 @@  discard block
 block discarded – undo
2385 2479
 			</h3>
2386 2480
 		</div>';
2387 2481
 
2388
-	if (!$context['user']['is_owner'])
2389
-		echo '
2482
+	if (!$context['user']['is_owner']) {
2483
+			echo '
2390 2484
 		<p class="information">', $txt['profile_warning_desc'], '</p>';
2485
+	}
2391 2486
 
2392 2487
 	echo '
2393 2488
 		<div class="windowbg">
2394 2489
 			<dl class="settings">';
2395 2490
 
2396
-	if (!$context['user']['is_owner'])
2397
-		echo '
2491
+	if (!$context['user']['is_owner']) {
2492
+			echo '
2398 2493
 				<dt>
2399 2494
 					<strong>', $txt['profile_warning_name'], ':</strong>
2400 2495
 				</dt>
2401 2496
 				<dd>
2402 2497
 					<strong>', $context['member']['name'], '</strong>
2403 2498
 				</dd>';
2499
+	}
2404 2500
 
2405 2501
 	echo '
2406 2502
 				<dt>
2407 2503
 					<strong>', $txt['profile_warning_level'], ':</strong>';
2408 2504
 
2409 2505
 	// Is there only so much they can apply?
2410
-	if ($context['warning_limit'])
2411
-		echo '
2506
+	if ($context['warning_limit']) {
2507
+			echo '
2412 2508
 					<br>
2413 2509
 					<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
2510
+	}
2414 2511
 
2415 2512
 	echo '
2416 2513
 				</dt>
@@ -2465,9 +2562,10 @@  discard block
 block discarded – undo
2465 2562
 						<option value="-1">', $txt['profile_warning_notify_template'], '</option>
2466 2563
 						<option value="-1" disabled>------------------------------</option>';
2467 2564
 
2468
-		foreach ($context['notification_templates'] as $id_template => $template)
2469
-			echo '
2565
+		foreach ($context['notification_templates'] as $id_template => $template) {
2566
+					echo '
2470 2567
 						<option value="', $id_template, '">', $template['title'], '</option>';
2568
+		}
2471 2569
 
2472 2570
 		echo '
2473 2571
 					</select>
@@ -2480,9 +2578,10 @@  discard block
 block discarded – undo
2480 2578
 			</dl>
2481 2579
 			<div class="righttext">';
2482 2580
 
2483
-	if (!empty($context['token_check']))
2484
-		echo '
2581
+	if (!empty($context['token_check'])) {
2582
+			echo '
2485 2583
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2584
+	}
2486 2585
 
2487 2586
 	echo '
2488 2587
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2498,8 +2597,8 @@  discard block
 block discarded – undo
2498 2597
 	echo '
2499 2598
 	<script>';
2500 2599
 
2501
-	if (!$context['user']['is_owner'])
2502
-		echo '
2600
+	if (!$context['user']['is_owner']) {
2601
+			echo '
2503 2602
 		modifyWarnNotify();
2504 2603
 		$(document).ready(function() {
2505 2604
 			$("#preview_button").click(function() {
@@ -2538,6 +2637,7 @@  discard block
 block discarded – undo
2538 2637
 			});
2539 2638
 			return false;
2540 2639
 		}';
2640
+	}
2541 2641
 
2542 2642
 	echo '
2543 2643
 	</script>';
@@ -2560,17 +2660,19 @@  discard block
 block discarded – undo
2560 2660
 			</div>';
2561 2661
 
2562 2662
 	// If deleting another account give them a lovely info box.
2563
-	if (!$context['user']['is_owner'])
2564
-		echo '
2663
+	if (!$context['user']['is_owner']) {
2664
+			echo '
2565 2665
 			<p class="information">', $txt['deleteAccount_desc'], '</p>';
2666
+	}
2566 2667
 
2567 2668
 	echo '
2568 2669
 			<div class="windowbg2">';
2569 2670
 
2570 2671
 	// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
2571
-	if ($context['needs_approval'])
2572
-		echo '
2672
+	if ($context['needs_approval']) {
2673
+			echo '
2573 2674
 				<div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
2675
+	}
2574 2676
 
2575 2677
 	// If the user is deleting their own account warn them first - and require a password!
2576 2678
 	if ($context['user']['is_owner'])
@@ -2582,9 +2684,10 @@  discard block
 block discarded – undo
2582 2684
 					<input type="password" name="oldpasswrd" size="20">
2583 2685
 					<input type="submit" value="', $txt['yes'], '" class="button">';
2584 2686
 
2585
-		if (!empty($context['token_check']))
2586
-			echo '
2687
+		if (!empty($context['token_check'])) {
2688
+					echo '
2587 2689
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2690
+		}
2588 2691
 
2589 2692
 		echo '
2590 2693
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2614,10 +2717,11 @@  discard block
 block discarded – undo
2614 2717
 						<option value="topics">', $txt['deleteAccount_topics'], '</option>
2615 2718
 					</select>';
2616 2719
 
2617
-			if ($context['show_perma_delete'])
2618
-				echo '
2720
+			if ($context['show_perma_delete']) {
2721
+							echo '
2619 2722
 					<br>
2620 2723
 					<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>';
2724
+			}
2621 2725
 
2622 2726
 			echo '
2623 2727
 				</div>';
@@ -2630,9 +2734,10 @@  discard block
 block discarded – undo
2630 2734
 				<div>
2631 2735
 					<input type="submit" value="', $txt['delete'], '" class="button">';
2632 2736
 
2633
-		if (!empty($context['token_check']))
2634
-			echo '
2737
+		if (!empty($context['token_check'])) {
2738
+					echo '
2635 2739
 				<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2740
+		}
2636 2741
 
2637 2742
 		echo '
2638 2743
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -2658,8 +2763,8 @@  discard block
 block discarded – undo
2658 2763
 					<hr>';
2659 2764
 
2660 2765
 	// Only show the password box if it's actually needed.
2661
-	if ($context['require_password'])
2662
-		echo '
2766
+	if ($context['require_password']) {
2767
+			echo '
2663 2768
 					<dl class="settings">
2664 2769
 						<dt>
2665 2770
 							<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
@@ -2669,13 +2774,15 @@  discard block
 block discarded – undo
2669 2774
 							<input type="password" name="oldpasswrd" size="20">
2670 2775
 						</dd>
2671 2776
 					</dl>';
2777
+	}
2672 2778
 
2673 2779
 	echo '
2674 2780
 					<div class="righttext">';
2675 2781
 
2676
-	if (!empty($context['token_check']))
2677
-		echo '
2782
+	if (!empty($context['token_check'])) {
2783
+			echo '
2678 2784
 						<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
2785
+	}
2679 2786
 
2680 2787
 	echo '
2681 2788
 						<input type="submit" value="', $txt['change_profile'], '" class="button">
@@ -2702,9 +2809,10 @@  discard block
 block discarded – undo
2702 2809
 			<ul id="list_errors">';
2703 2810
 
2704 2811
 		// Cycle through each error and display an error message.
2705
-		foreach ($context['post_errors'] as $error)
2706
-			echo '
2812
+		foreach ($context['post_errors'] as $error) {
2813
+					echo '
2707 2814
 				<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
2815
+		}
2708 2816
 
2709 2817
 		echo '
2710 2818
 			</ul>';
@@ -2730,12 +2838,13 @@  discard block
 block discarded – undo
2730 2838
 								<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;"' : ''), '>';
2731 2839
 
2732 2840
 	// Fill the select box with all primary member groups that can be assigned to a member.
2733
-	foreach ($context['member_groups'] as $member_group)
2734
-		if (!empty($member_group['can_be_primary']))
2841
+	foreach ($context['member_groups'] as $member_group) {
2842
+			if (!empty($member_group['can_be_primary']))
2735 2843
 			echo '
2736 2844
 									<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
2737 2845
 										', $member_group['name'], '
2738 2846
 									</option>';
2847
+	}
2739 2848
 
2740 2849
 	echo '
2741 2850
 								</select>
@@ -2748,10 +2857,11 @@  discard block
 block discarded – undo
2748 2857
 									<input type="hidden" name="additional_groups[]" value="0">';
2749 2858
 
2750 2859
 	// For each membergroup show a checkbox so members can be assigned to more than one group.
2751
-	foreach ($context['member_groups'] as $member_group)
2752
-		if ($member_group['can_be_additional'])
2860
+	foreach ($context['member_groups'] as $member_group) {
2861
+			if ($member_group['can_be_additional'])
2753 2862
 			echo '
2754 2863
 									<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>';
2864
+	}
2755 2865
 
2756 2866
 	echo '
2757 2867
 								</span>
@@ -2811,9 +2921,10 @@  discard block
 block discarded – undo
2811 2921
 								<span class="smalltext">', $txt['sig_info'], '</span><br>
2812 2922
 								<br>';
2813 2923
 
2814
-	if ($context['show_spellchecking'])
2815
-		echo '
2924
+	if ($context['show_spellchecking']) {
2925
+			echo '
2816 2926
 								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">';
2927
+	}
2817 2928
 
2818 2929
 	echo '
2819 2930
 							</dt>
@@ -2821,17 +2932,20 @@  discard block
 block discarded – undo
2821 2932
 								<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>';
2822 2933
 
2823 2934
 	// If there is a limit at all!
2824
-	if (!empty($context['signature_limits']['max_length']))
2825
-		echo '
2935
+	if (!empty($context['signature_limits']['max_length'])) {
2936
+			echo '
2826 2937
 								<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
2938
+	}
2827 2939
 
2828
-	if (!empty($context['show_preview_button']))
2829
-		echo '
2940
+	if (!empty($context['show_preview_button'])) {
2941
+			echo '
2830 2942
 								<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">';
2943
+	}
2831 2944
 
2832
-	if ($context['signature_warning'])
2833
-		echo '
2945
+	if ($context['signature_warning']) {
2946
+			echo '
2834 2947
 								<span class="smalltext">', $context['signature_warning'], '</span>';
2948
+	}
2835 2949
 
2836 2950
 	// Some javascript used to count how many characters have been used so far in the signature.
2837 2951
 	echo '
@@ -2876,9 +2990,10 @@  discard block
 block discarded – undo
2876 2990
 										<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
2877 2991
 
2878 2992
 		// This lists all the file categories.
2879
-		foreach ($context['avatars'] as $avatar)
2880
-			echo '
2993
+		foreach ($context['avatars'] as $avatar) {
2994
+					echo '
2881 2995
 											<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
2996
+		}
2882 2997
 
2883 2998
 		echo '
2884 2999
 										</select>
@@ -2910,20 +3025,22 @@  discard block
 block discarded – undo
2910 3025
 	}
2911 3026
 
2912 3027
 	// If the user can link to an off server avatar, show them a box to input the address.
2913
-	if (!empty($context['member']['avatar']['allow_external']))
2914
-		echo '
3028
+	if (!empty($context['member']['avatar']['allow_external'])) {
3029
+			echo '
2915 3030
 								<div id="avatar_external">
2916 3031
 									<div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', '
2917 3032
 									<input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);">
2918 3033
 								</div>';
3034
+	}
2919 3035
 
2920 3036
 	// If the user is able to upload avatars to the server show them an upload box.
2921
-	if (!empty($context['member']['avatar']['allow_upload']))
2922
-		echo '
3037
+	if (!empty($context['member']['avatar']['allow_upload'])) {
3038
+			echo '
2923 3039
 								<div id="avatar_upload">
2924 3040
 									<input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)"  onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), '
2925 3041
 									', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&amp;') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), '
2926 3042
 								</div>';
3043
+	}
2927 3044
 
2928 3045
 	// if the user is able to use Gravatar avatars show then the image preview
2929 3046
 	if (!empty($context['member']['avatar']['allow_gravatar']))
@@ -2932,16 +3049,17 @@  discard block
 block discarded – undo
2932 3049
 								<div id="avatar_gravatar">
2933 3050
 									<img src="' . $context['member']['avatar']['href'] . '" alt="">';
2934 3051
 
2935
-		if (empty($modSettings['gravatarAllowExtraEmail']))
2936
-			echo '
3052
+		if (empty($modSettings['gravatarAllowExtraEmail'])) {
3053
+					echo '
2937 3054
 									<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>';
2938
-		else
3055
+		} else
2939 3056
 		{
2940 3057
 			// Depending on other stuff, the stored value here might have some odd things in it from other areas.
2941
-			if ($context['member']['avatar']['external'] == $context['member']['email'])
2942
-				$textbox_value = '';
2943
-			else
2944
-				$textbox_value = $context['member']['avatar']['external'];
3058
+			if ($context['member']['avatar']['external'] == $context['member']['email']) {
3059
+							$textbox_value = '';
3060
+			} else {
3061
+							$textbox_value = $context['member']['avatar']['external'];
3062
+			}
2945 3063
 
2946 3064
 			echo '
2947 3065
 									<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div>
@@ -3013,8 +3131,9 @@  discard block
 block discarded – undo
3013 3131
 	$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
3014 3132
 
3015 3133
 	$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
3016
-	if (empty($suffix))
3017
-		return;
3134
+	if (empty($suffix)) {
3135
+			return;
3136
+	}
3018 3137
 
3019 3138
 	echo '
3020 3139
 								<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
@@ -3039,9 +3158,10 @@  discard block
 block discarded – undo
3039 3158
 								<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">';
3040 3159
 
3041 3160
 	// Help the user by showing a list of common time formats.
3042
-	foreach ($context['easy_timeformats'] as $time_format)
3043
-		echo '
3161
+	foreach ($context['easy_timeformats'] as $time_format) {
3162
+			echo '
3044 3163
 									<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
3164
+	}
3045 3165
 
3046 3166
 	echo '
3047 3167
 								</select>
@@ -3079,9 +3199,10 @@  discard block
 block discarded – undo
3079 3199
 							<dd>
3080 3200
 								<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.png\';">';
3081 3201
 
3082
-	foreach ($context['smiley_sets'] as $set)
3083
-		echo '
3202
+	foreach ($context['smiley_sets'] as $set) {
3203
+			echo '
3084 3204
 									<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
3205
+	}
3085 3206
 
3086 3207
 	echo '
3087 3208
 								</select>
@@ -3133,10 +3254,11 @@  discard block
 block discarded – undo
3133 3254
 										<img src="', $context['tfa_qr_url'], '" alt="">
3134 3255
 									</div>';
3135 3256
 
3136
-	if (!empty($context['from_ajax']))
3137
-		echo '
3257
+	if (!empty($context['from_ajax'])) {
3258
+			echo '
3138 3259
 					<br>
3139 3260
 					<a href="javascript:self.close();"></a>';
3261
+	}
3140 3262
 
3141 3263
 	echo '
3142 3264
 				</div>
@@ -3176,17 +3298,16 @@  discard block
 block discarded – undo
3176 3298
 							</dt>
3177 3299
 							<dd>';
3178 3300
 
3179
-	if (!$context['tfa_enabled'] && $context['user']['is_owner'])
3180
-		echo '
3301
+	if (!$context['tfa_enabled'] && $context['user']['is_owner']) {
3302
+			echo '
3181 3303
 								<a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>';
3182
-
3183
-	elseif (!$context['tfa_enabled'])
3184
-		echo '
3304
+	} elseif (!$context['tfa_enabled']) {
3305
+			echo '
3185 3306
 								', $txt['tfa_profile_disabled'];
3186
-
3187
-	else
3188
-		echo '
3307
+	} else {
3308
+			echo '
3189 3309
 								', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable');
3310
+	}
3190 3311
 
3191 3312
 	echo '
3192 3313
 							</dd>';
Please login to merge, or discard this patch.