Completed
Pull Request — release-2.1 (#4184)
by Mert
10:08
created
Themes/default/PersonalMessage.template.php 1 patch
Braces   +262 added lines, -181 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 	<div id="personal_messages">';
22 22
 
23 23
 	// Show the capacity bar, if available.
24
-	if (!empty($context['limit_bar']))
25
-		echo '
24
+	if (!empty($context['limit_bar'])) {
25
+			echo '
26 26
 		<div class="cat_bar">
27 27
 			<h3 class="catbg">
28 28
 				<span class="floatleft">', $txt['pm_capacity'], ':</span>
@@ -32,14 +32,16 @@  discard block
 block discarded – undo
32 32
 				<span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span>
33 33
 			</h3>
34 34
 		</div>';
35
+	}
35 36
 
36 37
 	// Message sent? Show a small indication.
37
-	if (isset($context['pm_sent']))
38
-		echo '
38
+	if (isset($context['pm_sent'])) {
39
+			echo '
39 40
 		<div class="infobox">
40 41
 			', $txt['pm_sent'], '
41 42
 		</div>';
42
-}
43
+	}
44
+	}
43 45
 
44 46
 /**
45 47
  * Just the end of the index bar, nothing special.
@@ -72,8 +74,7 @@  discard block
 block discarded – undo
72 74
 	{
73 75
 		echo '
74 76
 			<div class="no_unread">', $txt['pm_no_unread'], '</div>';
75
-	}
76
-	else
77
+	} else
77 78
 	{
78 79
 		foreach ($context['unread_pms'] as $id_pm => $pm_details)
79 80
 		{
@@ -193,14 +194,15 @@  discard block
 block discarded – undo
193 194
 	if ($context['get_pmessage']('message', true))
194 195
 	{
195 196
 		// Show the helpful titlebar - generally.
196
-		if ($context['display_mode'] != 1)
197
-			echo '
197
+		if ($context['display_mode'] != 1) {
198
+					echo '
198 199
 				<div class="cat_bar">
199 200
 					<h3 class="catbg">
200 201
 						<span id="author">', $txt['author'], '</span>
201 202
 						<span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span>
202 203
 					</h3>
203 204
 				</div>';
205
+		}
204 206
 
205 207
 		// Show a few buttons if we are in conversation mode and outputting the first message.
206 208
 		if ($context['display_mode'] == 2)
@@ -229,9 +231,10 @@  discard block
 block discarded – undo
229 231
 			<div class="custom_fields_above_member">
230 232
 				<ul class="nolist">';
231 233
 
232
-			foreach ($message['custom_fields']['above_member'] as $custom)
233
-				echo '
234
+			foreach ($message['custom_fields']['above_member'] as $custom) {
235
+							echo '
234 236
 					<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
237
+			}
235 238
 
236 239
 			echo '
237 240
 				</ul>
@@ -243,9 +246,10 @@  discard block
 block discarded – undo
243 246
 				<a id="msg', $message['id'], '"></a>';
244 247
 
245 248
 		// Show online and offline buttons?
246
-		if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
247
-			echo '
249
+		if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
250
+					echo '
248 251
 				<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>';
252
+		}
249 253
 
250 254
 		// Show a link to the member's profile (but only if the sender isn't a guest).
251 255
 				echo '
@@ -258,48 +262,56 @@  discard block
 block discarded – undo
258 262
 			<ul class="user_info">';
259 263
 
260 264
 			// Show the user's avatar.
261
-			if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
262
-				echo '
265
+			if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
266
+							echo '
263 267
 				<li class="avatar">
264 268
 					<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a>
265 269
 				</li>';
270
+			}
266 271
 
267 272
 		// Are there any custom fields below the avatar?
268
-		if (!empty($message['custom_fields']['below_avatar']))
269
-			foreach ($message['custom_fields']['below_avatar'] as $custom)
273
+		if (!empty($message['custom_fields']['below_avatar'])) {
274
+					foreach ($message['custom_fields']['below_avatar'] as $custom)
270 275
 				echo '
271 276
 				<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
277
+		}
272 278
 
273
-			if (!$message['member']['is_guest'])
274
-				echo '
279
+			if (!$message['member']['is_guest']) {
280
+							echo '
275 281
 				<li class="icons">', $message['member']['group_icons'], '</li>';
282
+			}
276 283
 			// Show the member's primary group (like 'Administrator') if they have one.
277
-			if (isset($message['member']['group']) && $message['member']['group'] != '')
278
-				echo '
284
+			if (isset($message['member']['group']) && $message['member']['group'] != '') {
285
+							echo '
279 286
 				<li class="membergroup">', $message['member']['group'], '</li>';
287
+			}
280 288
 
281 289
 			// Show the member's custom title, if they have one.
282
-			if (isset($message['member']['title']) && $message['member']['title'] != '')
283
-				echo '
290
+			if (isset($message['member']['title']) && $message['member']['title'] != '') {
291
+							echo '
284 292
 				<li class="title">', $message['member']['title'], '</li>';
293
+			}
285 294
 
286 295
 			// Don't show these things for guests.
287 296
 			if (!$message['member']['is_guest'])
288 297
 			{
289 298
 				// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
290
-				if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
291
-					echo '
299
+				if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') {
300
+									echo '
292 301
 				<li class="postgroup">', $message['member']['post_group'], '</li>';
302
+				}
293 303
 
294 304
 				// Show how many posts they have made.
295
-				if (!isset($context['disabled_fields']['posts']))
296
-					echo '
305
+				if (!isset($context['disabled_fields']['posts'])) {
306
+									echo '
297 307
 				<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
308
+				}
298 309
 
299 310
 				// Show their personal text?
300
-				if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '')
301
-					echo '
311
+				if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') {
312
+									echo '
302 313
 				<li class="blurb">', $message['member']['blurb'], '</li>';
314
+				}
303 315
 
304 316
 				// Any custom fields to show as icons?
305 317
 				if (!empty($message['custom_fields']['icons']))
@@ -308,9 +320,10 @@  discard block
 block discarded – undo
308 320
 				<li class="im_icons">
309 321
 					<ol>';
310 322
 
311
-					foreach ($message['custom_fields']['icons'] as $custom)
312
-						echo '
323
+					foreach ($message['custom_fields']['icons'] as $custom) {
324
+											echo '
313 325
 						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
326
+					}
314 327
 
315 328
 					echo '
316 329
 					</ol>
@@ -318,19 +331,22 @@  discard block
 block discarded – undo
318 331
 				}
319 332
 
320 333
 		// Show the IP to this user for this post - because you can moderate?
321
-		if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
322
-			echo '
334
+		if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
335
+					echo '
323 336
 				<li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>';
337
+		}
324 338
 
325 339
 		// Or, should we show it because this is you?
326
-		elseif ($message['can_see_ip'])
327
-			echo '
340
+		elseif ($message['can_see_ip']) {
341
+					echo '
328 342
 				<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>';
343
+		}
329 344
 
330 345
 		// Okay, you are logged in, then we can show something about why IPs are logged...
331
-		else
332
-			echo '
346
+		else {
347
+					echo '
333 348
 				<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>';
349
+		}
334 350
 
335 351
 				// Show the profile, website, email address, and personal message buttons.
336 352
 				if ($message['member']['show_profile_buttons'])
@@ -340,24 +356,28 @@  discard block
 block discarded – undo
340 356
 					<ol class="profile_icons">';
341 357
 
342 358
 					// Show the profile button
343
-					if ($message['member']['can_view_profile'])
344
-						echo '
359
+					if ($message['member']['can_view_profile']) {
360
+											echo '
345 361
 						<li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>';
362
+					}
346 363
 
347 364
 					// Don't show an icon if they haven't specified a website.
348
-					if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
349
-						echo '
365
+					if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) {
366
+											echo '
350 367
 						<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
368
+					}
351 369
 
352 370
 					// Don't show the email address if they want it hidden.
353
-					if ($message['member']['show_email'])
354
-						echo '
371
+					if ($message['member']['show_email']) {
372
+											echo '
355 373
 						<li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
374
+					}
356 375
 
357 376
 					// Since we know this person isn't a guest, you *can* message them.
358
-					if ($context['can_send_pm'])
359
-						echo '
377
+					if ($context['can_send_pm']) {
378
+											echo '
360 379
 						<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
380
+					}
361 381
 
362 382
 					echo '
363 383
 					</ol>
@@ -365,21 +385,24 @@  discard block
 block discarded – undo
365 385
 				}
366 386
 
367 387
 				// Any custom fields for standard placement?
368
-				if (!empty($message['custom_fields']['standard']))
369
-					foreach ($message['custom_fields']['standard'] as $custom)
388
+				if (!empty($message['custom_fields']['standard'])) {
389
+									foreach ($message['custom_fields']['standard'] as $custom)
370 390
 						echo '
371 391
 				<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>';
392
+				}
372 393
 
373 394
 				// Are we showing the warning status?
374
-				if ($message['member']['can_see_warning'])
375
-					echo '
395
+				if ($message['member']['can_see_warning']) {
396
+									echo '
376 397
 				<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
398
+				}
377 399
 
378 400
 				// Are there any custom fields to show at the bottom of the poster info?
379
-				if (!empty($message['custom_fields']['bottom_poster']))
380
-					foreach ($message['custom_fields']['bottom_poster'] as $custom)
401
+				if (!empty($message['custom_fields']['bottom_poster'])) {
402
+									foreach ($message['custom_fields']['bottom_poster'] as $custom)
381 403
 						echo '
382 404
 				<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
405
+				}
383 406
 			}
384 407
 
385 408
 			// Done with the information about the poster... on to the post itself.
@@ -398,24 +421,28 @@  discard block
 block discarded – undo
398 421
 					<span class="smalltext">&#171; <strong> ', $txt['sent_to'], ':</strong> ';
399 422
 
400 423
 			// People it was sent directly to....
401
-			if (!empty($message['recipients']['to']))
402
-				echo implode(', ', $message['recipients']['to']);
424
+			if (!empty($message['recipients']['to'])) {
425
+							echo implode(', ', $message['recipients']['to']);
426
+			}
403 427
 			// Otherwise, we're just going to say "some people"...
404
-			elseif ($context['folder'] != 'sent')
405
-				echo '(', $txt['pm_undisclosed_recipients'], ')';
428
+			elseif ($context['folder'] != 'sent') {
429
+							echo '(', $txt['pm_undisclosed_recipients'], ')';
430
+			}
406 431
 
407 432
 			echo '
408 433
 						<strong> ', $txt['on'], ':</strong> ', $message['time'], ' &#187;
409 434
 					</span>';
410 435
 
411 436
 			// If we're in the sent items, show who it was sent to besides the "To:" people.
412
-			if (!empty($message['recipients']['bcc']))
413
-				echo '
437
+			if (!empty($message['recipients']['bcc'])) {
438
+							echo '
414 439
 					<br><span class="smalltext">&#171; <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' &#187;</span>';
440
+			}
415 441
 
416
-			if (!empty($message['is_replied_to']))
417
-				echo '
442
+			if (!empty($message['is_replied_to'])) {
443
+							echo '
418 444
 					<br><span class="smalltext">&#171; ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' &#187;</span>';
445
+			}
419 446
 
420 447
 			echo '
421 448
 				</div>
@@ -423,13 +450,15 @@  discard block
 block discarded – undo
423 450
 			<div class="post">
424 451
 				<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>';
425 452
 
426
-			if ($message['can_report'] || $context['can_send_pm'])
427
-			echo '
453
+			if ($message['can_report'] || $context['can_send_pm']) {
454
+						echo '
428 455
 				<div class="under_message">';
456
+			}
429 457
 
430
-				if ($message['can_report'])
431
-				echo '
458
+				if ($message['can_report']) {
459
+								echo '
432 460
 					<a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>';
461
+				}
433 462
 
434 463
 				echo '
435 464
 					<ul class="quickbuttons">';
@@ -441,32 +470,36 @@  discard block
 block discarded – undo
441 470
 					if (!$message['member']['is_guest'])
442 471
 					{
443 472
 						// Is there than more than one recipient you can reply to?
444
-						if ($message['number_recipients'] > 1)
445
-							echo '
473
+						if ($message['number_recipients'] > 1) {
474
+													echo '
446 475
 						<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>';
476
+						}
447 477
 
448 478
 						echo '
449 479
 						<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>
450 480
 						<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>';
451 481
 					}
452 482
 					// This is for "forwarding" - even if the member is gone.
453
-					else
454
-						echo '
483
+					else {
484
+											echo '
455 485
 						<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>';
486
+					}
456 487
 				}
457 488
 				echo '
458 489
 						<li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>';
459 490
 
460
-				if (empty($context['display_mode']))
461
-					echo '
491
+				if (empty($context['display_mode'])) {
492
+									echo '
462 493
 						<li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;" class="input_check"></li>';
494
+				}
463 495
 
464 496
 				echo '
465 497
 					</ul>';
466 498
 
467
-			if ($message['can_report'] || $context['can_send_pm'])
468
-			echo '
499
+			if ($message['can_report'] || $context['can_send_pm']) {
500
+						echo '
469 501
 				</div>';
502
+			}
470 503
 
471 504
 			// Are there any custom profile fields for above the signature?
472 505
 			if (!empty($message['custom_fields']['above_signature']))
@@ -475,9 +508,10 @@  discard block
 block discarded – undo
475 508
 					<div class="custom_fields_above_signature">
476 509
 						<ul class="nolist">';
477 510
 
478
-				foreach ($message['custom_fields']['above_signature'] as $custom)
479
-					echo '
511
+				foreach ($message['custom_fields']['above_signature'] as $custom) {
512
+									echo '
480 513
 							<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
514
+				}
481 515
 
482 516
 				echo '
483 517
 						</ul>
@@ -485,9 +519,10 @@  discard block
 block discarded – undo
485 519
 			}
486 520
 
487 521
 			// Show the member's signature?
488
-			if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
489
-				echo '
522
+			if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
523
+							echo '
490 524
 				<div class="signature">', $message['member']['signature'], '</div>';
525
+			}
491 526
 
492 527
 			// Are there any custom profile fields for below the signature?
493 528
 			if (!empty($message['custom_fields']['below_signature']))
@@ -496,9 +531,10 @@  discard block
 block discarded – undo
496 531
 					<div class="custom_fields_below_signature">
497 532
 						<ul class="nolist">';
498 533
 
499
-				foreach ($message['custom_fields']['below_signature'] as $custom)
500
-					echo '
534
+				foreach ($message['custom_fields']['below_signature'] as $custom) {
535
+									echo '
501 536
 							<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
537
+				}
502 538
 
503 539
 				echo '
504 540
 						</ul>
@@ -523,19 +559,21 @@  discard block
 block discarded – undo
523 559
 					{
524 560
 						echo '
525 561
 						<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>';
526
-						foreach ($context['labels'] as $label)
527
-							if (!isset($message['labels'][$label['id']]))
562
+						foreach ($context['labels'] as $label) {
563
+													if (!isset($message['labels'][$label['id']]))
528 564
 								echo '
529 565
 							<option value="', $label['id'], '">&nbsp;', $label['name'], '</option>';
566
+						}
530 567
 					}
531 568
 					// ... and are there any that can be removed?
532 569
 					if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1])))
533 570
 					{
534 571
 						echo '
535 572
 						<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>';
536
-						foreach ($message['labels'] as $label)
537
-							echo '
573
+						foreach ($message['labels'] as $label) {
574
+													echo '
538 575
 							<option value="', $label['id'], '">&nbsp;', $label['name'], '</option>';
576
+						}
539 577
 					}
540 578
 					echo '
541 579
 					</select>
@@ -555,13 +593,14 @@  discard block
 block discarded – undo
555 593
 	</div>';
556 594
 		}
557 595
 
558
-		if (empty($context['display_mode']))
559
-			echo '
596
+		if (empty($context['display_mode'])) {
597
+					echo '
560 598
 
561 599
 	<div class="pagesection">
562 600
 		<div class="floatleft">', $context['page_index'], '</div>
563 601
 		<div class="floatright"><input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button_submit"></div>
564 602
 	</div>';
603
+		}
565 604
 
566 605
 		// Show a few buttons if we are in conversation mode and outputting the first message.
567 606
 		elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons']))
@@ -621,11 +660,12 @@  discard block
 block discarded – undo
621 660
 		</tr>
622 661
 	</thead>
623 662
 	<tbody>';
624
-	if (!$context['show_delete'])
625
-		echo '
663
+	if (!$context['show_delete']) {
664
+			echo '
626 665
 		<tr class="windowbg">
627 666
 			<td colspan="5">', $txt['pm_alert_none'], '</td>
628 667
 		</tr>';
668
+	}
629 669
 
630 670
 	while ($message = $context['get_pmessage']('subject'))
631 671
 	{
@@ -678,9 +718,10 @@  discard block
 block discarded – undo
678 718
 
679 719
 			foreach ($context['labels'] as $label)
680 720
 			{
681
-				if ($label['id'] != $context['current_label_id'])
682
-					echo '
721
+				if ($label['id'] != $context['current_label_id']) {
722
+									echo '
683 723
 					<option value="add_', $label['id'], '">&nbsp;', $label['name'], '</option>';
724
+				}
684 725
 			}
685 726
 
686 727
 			echo '
@@ -765,9 +806,10 @@  discard block
 block discarded – undo
765 806
 					<dt class="between">', $txt['pm_search_post_age'], ':</dt>
766 807
 					<dd>', $txt['pm_search_between'], ' <input type="number" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" class="input_text" min="0" max="9999">&nbsp;', $txt['pm_search_between_and'], '&nbsp;<input type="number" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" class="input_text" min="0" max="9999"> ', $txt['pm_search_between_days'], '</dd>
767 808
 				</dl>';
768
-	if (!$context['currently_using_labels'])
769
-		echo '
809
+	if (!$context['currently_using_labels']) {
810
+			echo '
770 811
 				<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button_submit">';
812
+	}
771 813
 		echo '
772 814
 				<br class="clear_right">
773 815
 			</div>
@@ -787,12 +829,13 @@  discard block
 block discarded – undo
787 829
 				<div id="advanced_panel_div">
788 830
 					<ul id="searchLabelsExpand">';
789 831
 
790
-		foreach ($context['search_labels'] as $label)
791
-			echo '
832
+		foreach ($context['search_labels'] as $label) {
833
+					echo '
792 834
 						<li>
793 835
 							<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', ' class="input_check">
794 836
 							', $label['name'], '</label>
795 837
 						</li>';
838
+		}
796 839
 
797 840
 		echo '
798 841
 					</ul>
@@ -852,8 +895,8 @@  discard block
 block discarded – undo
852 895
 		</div>';
853 896
 
854 897
 	// complete results ?
855
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
856
-		echo '
898
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
899
+			echo '
857 900
 	<table class="table_grid">
858 901
 	<thead>
859 902
 		<tr class="title_bar">
@@ -863,6 +906,7 @@  discard block
 block discarded – undo
863 906
 		</tr>
864 907
 	</thead>
865 908
 	<tbody>';
909
+	}
866 910
 
867 911
 	// Print each message out...
868 912
 	foreach ($context['personal_messages'] as $message)
@@ -882,11 +926,13 @@  discard block
 block discarded – undo
882 926
 
883 927
 				// Show the recipients.
884 928
 				// @todo This doesn't deal with the sent item searching quite right for bcc.
885
-				if (!empty($message['recipients']['to']))
886
-					echo implode(', ', $message['recipients']['to']);
929
+				if (!empty($message['recipients']['to'])) {
930
+									echo implode(', ', $message['recipients']['to']);
931
+				}
887 932
 				// Otherwise, we're just going to say "some people"...
888
-				elseif ($context['folder'] != 'sent')
889
-					echo '(', $txt['pm_undisclosed_recipients'], ')';
933
+				elseif ($context['folder'] != 'sent') {
934
+									echo '(', $txt['pm_undisclosed_recipients'], ')';
935
+				}
890 936
 
891 937
 					echo '
892 938
 				</h3>
@@ -900,14 +946,16 @@  discard block
 block discarded – undo
900 946
 					$quote_button = create_button('quote.png', 'reply_quote', 'reply_quote', 'class="centericon"');
901 947
 					$reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"');
902 948
 					// You can only reply if they are not a guest...
903
-					if (!$message['member']['is_guest'])
904
-						echo '
949
+					if (!$message['member']['is_guest']) {
950
+											echo '
905 951
 							<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], '
906 952
 							<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator'];
953
+					}
907 954
 					// This is for "forwarding" - even if the member is gone.
908
-					else
909
-						echo '
955
+					else {
956
+											echo '
910 957
 							<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator'];
958
+					}
911 959
 				}
912 960
 
913 961
 				echo '
@@ -928,17 +976,19 @@  discard block
 block discarded – undo
928 976
 	}
929 977
 
930 978
 	// Finish off the page...
931
-	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
932
-		echo '
979
+	if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) {
980
+			echo '
933 981
 		</tbody>
934 982
 		</table>';
983
+	}
935 984
 
936 985
 	// No results?
937
-	if (empty($context['personal_messages']))
938
-		echo '
986
+	if (empty($context['personal_messages'])) {
987
+			echo '
939 988
 		<div class="windowbg">
940 989
 			<p class="centertext">', $txt['pm_search_none_found'], '</p>
941 990
 		</div>';
991
+	}
942 992
 
943 993
 	echo '
944 994
 		<div class="pagesection">
@@ -962,12 +1012,14 @@  discard block
 block discarded – undo
962 1012
 				<h3 class="catbg">', $txt['pm_send_report'], '</h3>
963 1013
 			</div>
964 1014
 			<div class="windowbg">';
965
-				if (!empty($context['send_log']['sent']))
966
-					foreach ($context['send_log']['sent'] as $log_entry)
1015
+				if (!empty($context['send_log']['sent'])) {
1016
+									foreach ($context['send_log']['sent'] as $log_entry)
967 1017
 						echo '<span class="error">', $log_entry, '</span><br>';
968
-				if (!empty($context['send_log']['failed']))
969
-					foreach ($context['send_log']['failed'] as $log_entry)
1018
+				}
1019
+				if (!empty($context['send_log']['failed'])) {
1020
+									foreach ($context['send_log']['failed'] as $log_entry)
970 1021
 						echo '<span class="error">', $log_entry, '</span><br>';
1022
+				}
971 1023
 				echo '
972 1024
 			</div>
973 1025
 			<br>';
@@ -1015,12 +1067,13 @@  discard block
 block discarded – undo
1015 1067
 				</dl>
1016 1068
 			</div>';
1017 1069
 
1018
-	if (!empty($modSettings['drafts_pm_enabled']))
1019
-		echo '
1070
+	if (!empty($modSettings['drafts_pm_enabled'])) {
1071
+			echo '
1020 1072
 			<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
1021 1073
 				sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
1022 1074
 				', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
1023 1075
 			</div>';
1076
+	}
1024 1077
 
1025 1078
 	echo '
1026 1079
 			<dl id="post_header">';
@@ -1075,9 +1128,10 @@  discard block
 block discarded – undo
1075 1128
 	}
1076 1129
 
1077 1130
 	// What about smileys?
1078
-	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
1079
-		echo '
1131
+	if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) {
1132
+			echo '
1080 1133
 			<div id="smileyBox_message"></div>';
1134
+	}
1081 1135
 
1082 1136
 	// Show BBC buttons, smileys and textbox.
1083 1137
 	echo '
@@ -1124,10 +1178,11 @@  discard block
 block discarded – undo
1124 1178
 					<dt><strong>', $txt['subject'], '</strong></dt>
1125 1179
 					<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
1126 1180
 
1127
-		foreach ($context['drafts'] as $draft)
1128
-			echo '
1181
+		foreach ($context['drafts'] as $draft) {
1182
+					echo '
1129 1183
 					<dt>', $draft['link'], '</dt>
1130 1184
 					<dd>', $draft['poster_time'], '</dd>';
1185
+		}
1131 1186
 		echo '
1132 1187
 				</dl>
1133 1188
 			</div>';
@@ -1233,8 +1288,8 @@  discard block
 block discarded – undo
1233 1288
 			}';
1234 1289
 
1235 1290
 	// Code for showing and hiding drafts
1236
-	if (!empty($context['drafts']))
1237
-		echo '
1291
+	if (!empty($context['drafts'])) {
1292
+			echo '
1238 1293
 			var oSwapDraftOptions = new smc_Toggle({
1239 1294
 				bToggleEnabled: true,
1240 1295
 				bCurrentlyCollapsed: true,
@@ -1256,13 +1311,14 @@  discard block
 block discarded – undo
1256 1311
 					}
1257 1312
 				]
1258 1313
 			});';
1314
+	}
1259 1315
 
1260 1316
 	echo '
1261 1317
 		</script>';
1262 1318
 
1263 1319
 	// Show the message you're replying to.
1264
-	if ($context['reply'])
1265
-		echo '
1320
+	if ($context['reply']) {
1321
+			echo '
1266 1322
 	<br>
1267 1323
 	<br>
1268 1324
 	<div class="cat_bar">
@@ -1276,6 +1332,7 @@  discard block
 block discarded – undo
1276 1332
 		<hr>
1277 1333
 		', $context['quoted_message']['body'], '
1278 1334
 	</div><br class="clear">';
1335
+	}
1279 1336
 
1280 1337
 	echo '
1281 1338
 		<script>
@@ -1286,22 +1343,24 @@  discard block
 block discarded – undo
1286 1343
 				sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
1287 1344
 				sToControlId: \'to_control\',
1288 1345
 				aToRecipients: [';
1289
-	foreach ($context['recipients']['to'] as $i => $member)
1290
-		echo '
1346
+	foreach ($context['recipients']['to'] as $i => $member) {
1347
+			echo '
1291 1348
 					{
1292 1349
 						sItemId: ', JavaScriptEscape($member['id']), ',
1293 1350
 						sItemName: ', JavaScriptEscape($member['name']), '
1294 1351
 					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
1352
+	}
1295 1353
 
1296 1354
 	echo '
1297 1355
 				],
1298 1356
 				aBccRecipients: [';
1299
-	foreach ($context['recipients']['bcc'] as $i => $member)
1300
-		echo '
1357
+	foreach ($context['recipients']['bcc'] as $i => $member) {
1358
+			echo '
1301 1359
 					{
1302 1360
 						sItemId: ', JavaScriptEscape($member['id']), ',
1303 1361
 						sItemName: ', JavaScriptEscape($member['name']), '
1304 1362
 					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
1363
+	}
1305 1364
 
1306 1365
 	echo '
1307 1366
 				],
@@ -1388,26 +1447,28 @@  discard block
 block discarded – undo
1388 1447
 				</th>
1389 1448
 				<th class="centertext table_icon">';
1390 1449
 
1391
-	if (count($context['labels']) > 2)
1392
-		echo '
1450
+	if (count($context['labels']) > 2) {
1451
+			echo '
1393 1452
 					<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);">';
1453
+	}
1394 1454
 
1395 1455
 	echo '
1396 1456
 				</th>
1397 1457
 			</tr>
1398 1458
 		</thead>
1399 1459
 		<tbody>';
1400
-	if (count($context['labels']) < 2)
1401
-		echo '
1460
+	if (count($context['labels']) < 2) {
1461
+			echo '
1402 1462
 			<tr class="windowbg">
1403 1463
 				<td colspan="2">', $txt['pm_labels_no_exist'], '</td>
1404 1464
 			</tr>';
1405
-	else
1465
+	} else
1406 1466
 	{
1407 1467
 		foreach ($context['labels'] as $label)
1408 1468
 		{
1409
-			if ($label['id'] == -1)
1410
-				continue;
1469
+			if ($label['id'] == -1) {
1470
+							continue;
1471
+			}
1411 1472
 
1412 1473
 				echo '
1413 1474
 			<tr class="windowbg">
@@ -1422,12 +1483,13 @@  discard block
 block discarded – undo
1422 1483
 		</tbody>
1423 1484
 		</table>';
1424 1485
 
1425
-	if (!count($context['labels']) < 2)
1426
-		echo '
1486
+	if (!count($context['labels']) < 2) {
1487
+			echo '
1427 1488
 		<div class="padding">
1428 1489
 			<input type="submit" name="save" value="', $txt['save'], '" class="button_submit">
1429 1490
 			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button_submit you_sure">
1430 1491
 		</div>';
1492
+	}
1431 1493
 
1432 1494
 	echo '
1433 1495
 		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
@@ -1482,9 +1544,10 @@  discard block
 block discarded – undo
1482 1544
 				<dd>
1483 1545
 					<select name="id_admin">
1484 1546
 						<option value="0">', $txt['pm_report_all_admins'], '</option>';
1485
-		foreach ($context['admins'] as $id => $name)
1486
-			echo '
1547
+		foreach ($context['admins'] as $id => $name) {
1548
+					echo '
1487 1549
 						<option value="', $id, '">', $name, '</option>';
1550
+		}
1488 1551
 		echo '
1489 1552
 					</select>
1490 1553
 				</dd>';
@@ -1546,9 +1609,10 @@  discard block
 block discarded – undo
1546 1609
 				</th>
1547 1610
 				<th class="centertext table_icon">';
1548 1611
 
1549
-	if (!empty($context['rules']))
1550
-		echo '
1612
+	if (!empty($context['rules'])) {
1613
+			echo '
1551 1614
 					<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check">';
1615
+	}
1552 1616
 
1553 1617
 	echo '
1554 1618
 				</th>
@@ -1556,13 +1620,14 @@  discard block
 block discarded – undo
1556 1620
 		</thead>
1557 1621
 		<tbody>';
1558 1622
 
1559
-	if (empty($context['rules']))
1560
-		echo '
1623
+	if (empty($context['rules'])) {
1624
+			echo '
1561 1625
 			<tr class="windowbg">
1562 1626
 				<td colspan="2">
1563 1627
 					', $txt['pm_rules_none'], '
1564 1628
 				</td>
1565 1629
 			</tr>';
1630
+	}
1566 1631
 
1567 1632
 	foreach ($context['rules'] as $rule)
1568 1633
 	{
@@ -1583,14 +1648,16 @@  discard block
 block discarded – undo
1583 1648
 		<div class="righttext">
1584 1649
 			<a class="button_link" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>';
1585 1650
 
1586
-	if (!empty($context['rules']))
1587
-		echo '
1651
+	if (!empty($context['rules'])) {
1652
+			echo '
1588 1653
 			[<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]';
1654
+	}
1589 1655
 
1590
-	if (!empty($context['rules']))
1591
-		echo '
1656
+	if (!empty($context['rules'])) {
1657
+			echo '
1592 1658
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1593 1659
 			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button_submit smalltext you_sure">';
1660
+	}
1594 1661
 
1595 1662
 	echo '
1596 1663
 		</div>
@@ -1612,14 +1679,16 @@  discard block
 block discarded – undo
1612 1679
 			var groups = new Array()
1613 1680
 			var labels = new Array()';
1614 1681
 
1615
-	foreach ($context['groups'] as $id => $title)
1616
-		echo '
1682
+	foreach ($context['groups'] as $id => $title) {
1683
+			echo '
1617 1684
 			groups[', $id, '] = "', addslashes($title), '";';
1685
+	}
1618 1686
 
1619
-	foreach ($context['labels'] as $label)
1620
-		if ($label['id'] != -1)
1687
+	foreach ($context['labels'] as $label) {
1688
+			if ($label['id'] != -1)
1621 1689
 			echo '
1622 1690
 			labels[', ($label['id']), '] = "', addslashes($label['name']), '";';
1691
+	}
1623 1692
 
1624 1693
 	echo '
1625 1694
 			function addCriteriaOption()
@@ -1634,8 +1703,9 @@  discard block
 block discarded – undo
1634 1703
 
1635 1704
 				setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select>&nbsp;<span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value="" class="input_text"><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>';
1636 1705
 
1637
-	foreach ($context['groups'] as $id => $group)
1638
-		echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1706
+	foreach ($context['groups'] as $id => $group) {
1707
+			echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>';
1708
+	}
1639 1709
 
1640 1710
 	echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\');
1641 1711
 			}
@@ -1652,9 +1722,10 @@  discard block
 block discarded – undo
1652 1722
 
1653 1723
 				setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select>&nbsp;<span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>';
1654 1724
 
1655
-	foreach ($context['labels'] as $label)
1656
-		if ($label['id'] != -1)
1725
+	foreach ($context['labels'] as $label) {
1726
+			if ($label['id'] != -1)
1657 1727
 			echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>';
1728
+	}
1658 1729
 
1659 1730
 	echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\');
1660 1731
 			}
@@ -1768,18 +1839,20 @@  discard block
 block discarded – undo
1768 1839
 	$isFirst = true;
1769 1840
 	foreach ($context['rule']['criteria'] as $k => $criteria)
1770 1841
 	{
1771
-		if (!$isFirst && $criteria['t'] == '')
1772
-			echo '<div id="removeonjs1">';
1773
-		elseif (!$isFirst)
1774
-			echo '<br>';
1842
+		if (!$isFirst && $criteria['t'] == '') {
1843
+					echo '<div id="removeonjs1">';
1844
+		} elseif (!$isFirst) {
1845
+					echo '<br>';
1846
+		}
1775 1847
 
1776 1848
 		echo '
1777 1849
 				<select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();">
1778 1850
 					<option value="">', $txt['pm_rule_criteria_pick'], ':</option>';
1779 1851
 
1780
-		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr)
1781
-			echo '
1852
+		foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) {
1853
+					echo '
1782 1854
 					<option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>';
1855
+		}
1783 1856
 
1784 1857
 		echo '
1785 1858
 				</select>
@@ -1790,18 +1863,20 @@  discard block
 block discarded – undo
1790 1863
 					<select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();">
1791 1864
 						<option value="">', $txt['pm_rule_sel_group'], '</option>';
1792 1865
 
1793
-		foreach ($context['groups'] as $id => $group)
1794
-			echo '
1866
+		foreach ($context['groups'] as $id => $group) {
1867
+					echo '
1795 1868
 						<option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>';
1869
+		}
1796 1870
 		echo '
1797 1871
 					</select>
1798 1872
 				</span>';
1799 1873
 
1800 1874
 		// If this is the dummy we add a means to hide for non js users.
1801
-		if ($isFirst)
1802
-			$isFirst = false;
1803
-		elseif ($criteria['t'] == '')
1804
-			echo '</div>';
1875
+		if ($isFirst) {
1876
+					$isFirst = false;
1877
+		} elseif ($criteria['t'] == '') {
1878
+					echo '</div>';
1879
+		}
1805 1880
 	}
1806 1881
 
1807 1882
 	echo '
@@ -1824,10 +1899,11 @@  discard block
 block discarded – undo
1824 1899
 	$isFirst = true;
1825 1900
 	foreach ($context['rule']['actions'] as $k => $action)
1826 1901
 	{
1827
-		if (!$isFirst && $action['t'] == '')
1828
-			echo '<div id="removeonjs2">';
1829
-		elseif (!$isFirst)
1830
-			echo '<br>';
1902
+		if (!$isFirst && $action['t'] == '') {
1903
+					echo '<div id="removeonjs2">';
1904
+		} elseif (!$isFirst) {
1905
+					echo '<br>';
1906
+		}
1831 1907
 
1832 1908
 		echo '
1833 1909
 				<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
@@ -1838,20 +1914,22 @@  discard block
 block discarded – undo
1838 1914
 				<span id="labdiv', $k, '">
1839 1915
 					<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
1840 1916
 						<option value="">', $txt['pm_rule_sel_label'], '</option>';
1841
-		foreach ($context['labels'] as $label)
1842
-			if ($label['id'] != -1)
1917
+		foreach ($context['labels'] as $label) {
1918
+					if ($label['id'] != -1)
1843 1919
 				echo '
1844 1920
 						<option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>';
1921
+		}
1845 1922
 
1846 1923
 		echo '
1847 1924
 					</select>
1848 1925
 				</span>';
1849 1926
 
1850
-		if ($isFirst)
1851
-			$isFirst = false;
1852
-		elseif ($action['t'] == '')
1853
-			echo '
1927
+		if ($isFirst) {
1928
+					$isFirst = false;
1929
+		} elseif ($action['t'] == '') {
1930
+					echo '
1854 1931
 			</div>';
1932
+		}
1855 1933
 	}
1856 1934
 
1857 1935
 	echo '
@@ -1875,22 +1953,25 @@  discard block
 block discarded – undo
1875 1953
 		echo '
1876 1954
 	<script>';
1877 1955
 
1878
-	foreach ($context['rule']['criteria'] as $k => $c)
1879
-		echo '
1956
+	foreach ($context['rule']['criteria'] as $k => $c) {
1957
+			echo '
1880 1958
 			updateRuleDef(', $k, ');';
1959
+	}
1881 1960
 
1882
-	foreach ($context['rule']['actions'] as $k => $c)
1883
-		echo '
1961
+	foreach ($context['rule']['actions'] as $k => $c) {
1962
+			echo '
1884 1963
 			updateActionDef(', $k, ');';
1964
+	}
1885 1965
 
1886 1966
 	echo '
1887 1967
 			rebuildRuleDesc();';
1888 1968
 
1889 1969
 	// If this isn't a new rule and we have JS enabled remove the JS compatibility stuff.
1890
-	if ($context['rid'])
1891
-		echo '
1970
+	if ($context['rid']) {
1971
+			echo '
1892 1972
 			document.getElementById("removeonjs1").style.display = "none";
1893 1973
 			document.getElementById("removeonjs2").style.display = "none";';
1974
+	}
1894 1975
 
1895 1976
 	echo '
1896 1977
 			document.getElementById("addonjs1").style.display = "";
@@ -1918,12 +1999,12 @@  discard block
 block discarded – undo
1918 1999
 		</div>';
1919 2000
 
1920 2001
 	// No drafts? Just show an informative message.
1921
-	if (empty($context['drafts']))
1922
-		echo '
2002
+	if (empty($context['drafts'])) {
2003
+			echo '
1923 2004
 		<div class="windowbg2 centertext">
1924 2005
 			', $txt['draft_none'], '
1925 2006
 		</div>';
1926
-	else
2007
+	} else
1927 2008
 	{
1928 2009
 		// For every draft to be displayed, give it its own div, and show the important details of the draft.
1929 2010
 		foreach ($context['drafts'] as $draft)
Please login to merge, or discard this patch.
Sources/tasks/CreatePost-Notify.php 1 patch
Braces   +62 added lines, -46 removed lines patch added patch discarded remove patch
@@ -73,8 +73,9 @@  discard block
 block discarded – undo
73 73
 		while ($row = $smcFunc['db_fetch_assoc']($request))
74 74
 		{
75 75
 			$groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups'])));
76
-			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0)
77
-				continue;
76
+			if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) {
77
+							continue;
78
+			}
78 79
 
79 80
 			$members[] = $row['id_member'];
80 81
 			$watched[$row['id_member']] = $row;
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 
83 84
 		$smcFunc['db_free_result']($request);
84 85
 
85
-		if (empty($members))
86
-			return true;
86
+		if (empty($members)) {
87
+					return true;
88
+		}
87 89
 
88 90
 		$members = array_unique($members);
89 91
 		$prefs = getNotifyPrefs($members, '', true);
@@ -105,20 +107,23 @@  discard block
 block discarded – undo
105 107
 			$notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1;
106 108
 
107 109
 			// Don't send a notification if the watching member ignored the member who made the action.
108
-			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list'])))
109
-			    continue;
110
-			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started'])
111
-				continue;
112
-			elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id'])
113
-				continue;
114
-			elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3)
115
-				continue;
116
-			elseif ($notify_types == 4)
117
-				continue;
110
+			if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) {
111
+						    continue;
112
+			}
113
+			if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) {
114
+							continue;
115
+			} elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) {
116
+							continue;
117
+			} elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) {
118
+							continue;
119
+			} elseif ($notify_types == 4) {
120
+							continue;
121
+			}
118 122
 
119 123
 			if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members)
120
-				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only'])))
121
-				continue;
124
+				|| (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) {
125
+							continue;
126
+			}
122 127
 
123 128
 			// Watched topic?
124 129
 			if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member]))
@@ -128,10 +133,12 @@  discard block
 block discarded – undo
128 133
 
129 134
 				if ($type == 'reply')
130 135
 				{
131
-					if (!empty($prefs[$member]['msg_receive_body']))
132
-						$message_type .= '_body';
133
-					if (!empty($frequency))
134
-						$message_type .= '_once';
136
+					if (!empty($prefs[$member]['msg_receive_body'])) {
137
+											$message_type .= '_body';
138
+					}
139
+					if (!empty($frequency)) {
140
+											$message_type .= '_once';
141
+					}
135 142
 				}
136 143
 
137 144
 				$content_type = 'topic';
@@ -144,12 +151,14 @@  discard block
 block discarded – undo
144 151
 				$content_type = 'board';
145 152
 
146 153
 				$message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards';
147
-				if (!empty($prefs[$member]['msg_receive_body']))
148
-					$message_type .= '_body';
154
+				if (!empty($prefs[$member]['msg_receive_body'])) {
155
+									$message_type .= '_body';
156
+				}
149 157
 			}
150 158
 			// If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip
151
-			else
152
-				continue;
159
+			else {
160
+							continue;
161
+			}
153 162
 
154 163
 			if ($pref & 0x02)
155 164
 			{
@@ -212,14 +221,15 @@  discard block
 block discarded – undo
212 221
 		);
213 222
 
214 223
 		// Insert the alerts if any
215
-		if (!empty($alert_rows))
216
-			$smcFunc['db_insert']('',
224
+		if (!empty($alert_rows)) {
225
+					$smcFunc['db_insert']('',
217 226
 				'{db_prefix}user_alerts',
218 227
 				array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string',
219 228
 					'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'),
220 229
 				$alert_rows,
221 230
 				array()
222 231
 			);
232
+		}
223 233
 
224 234
 		return true;
225 235
 	}
@@ -230,8 +240,9 @@  discard block
 block discarded – undo
230 240
 
231 241
 		foreach ($quotedMembers as $id => $member)
232 242
 		{
233
-			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote']))
234
-				continue;
243
+			if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) {
244
+							continue;
245
+			}
235 246
 
236 247
 			$done_members[] = $id;
237 248
 
@@ -283,32 +294,35 @@  discard block
 block discarded – undo
283 294
 		{
284 295
 			if (preg_match('/\[quote(.*)?\]/i', $block, $matches))
285 296
 			{
286
-				if ($quote_level == 0)
287
-					$message .= '[quote' . $matches[1] . ']';
297
+				if ($quote_level == 0) {
298
+									$message .= '[quote' . $matches[1] . ']';
299
+				}
288 300
 				$quote_level++;
289
-			}
290
-			elseif (preg_match('/\[\/quote\]/i', $block))
301
+			} elseif (preg_match('/\[\/quote\]/i', $block))
291 302
 			{
292
-				if ($quote_level <= 1)
293
-					$message .= '[/quote]';
303
+				if ($quote_level <= 1) {
304
+									$message .= '[/quote]';
305
+				}
294 306
 				if ($quote_level >= 1)
295 307
 				{
296 308
 					$quote_level--;
297 309
 					$message .= "\n";
298 310
 				}
311
+			} elseif ($quote_level <= 1) {
312
+							$message .= $block;
299 313
 			}
300
-			elseif ($quote_level <= 1)
301
-				$message .= $block;
302 314
 		}
303 315
 
304 316
 		preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches);
305 317
 
306 318
 		$id_msgs = $matches[1];
307
-		foreach ($id_msgs as $k => $id_msg)
308
-			$id_msgs[$k] = (int) $id_msg;
319
+		foreach ($id_msgs as $k => $id_msg) {
320
+					$id_msgs[$k] = (int) $id_msg;
321
+		}
309 322
 
310
-		if (empty($id_msgs))
311
-			return array();
323
+		if (empty($id_msgs)) {
324
+					return array();
325
+		}
312 326
 
313 327
 		// Get the messages
314 328
 		$request = $smcFunc['db_query']('', '
@@ -326,8 +340,9 @@  discard block
 block discarded – undo
326 340
 		$members = array();
327 341
 		while ($row = $smcFunc['db_fetch_assoc']($request))
328 342
 		{
329
-			if ($posterOptions['id'] == $row['id_member'])
330
-				continue;
343
+			if ($posterOptions['id'] == $row['id_member']) {
344
+							continue;
345
+			}
331 346
 
332 347
 			$members[$row['id_member']] = $row;
333 348
 		}
@@ -341,10 +356,11 @@  discard block
 block discarded – undo
341 356
 
342 357
 		foreach ($members as $id => $member)
343 358
 		{
344
-			if (!empty($prefs[$id]['msg_mention']))
345
-				$done_members[] = $id;
346
-			else
347
-				continue;
359
+			if (!empty($prefs[$id]['msg_mention'])) {
360
+							$done_members[] = $id;
361
+			} else {
362
+							continue;
363
+			}
348 364
 
349 365
 			// Alerts' emails are always instant
350 366
 			if ($prefs[$id]['msg_mention'] & 0x02)
Please login to merge, or discard this patch.
Sources/tasks/Likes-Notify.php 1 patch
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -51,30 +51,33 @@  discard block
 block discarded – undo
51 51
 				$ignored_members = explode(',', $row['pm_ignore_list']);
52 52
 
53 53
 				// If the user is in group 1 anywhere, they can see everything anyway.
54
-				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0)
55
-					$author = $row['id_member'];
54
+				if (in_array(1, $groups) || count(array_intersect($allowed, $groups)) != 0) {
55
+									$author = $row['id_member'];
56
+				}
56 57
 			}
57 58
 			$smcFunc['db_free_result']($request);
58
-		}
59
-		else
59
+		} else
60 60
 		{
61 61
 			// This isn't something we know natively how to support. Call the hooks, if they're dealing with it, return false, otherwise return the user id.
62 62
 			$hook_results = call_integration_hook('integrate_find_like_author', array($this->_details['content_type'], $this->_details['content_id']));
63
-			foreach ($hook_results as $result)
64
-				if (!empty($result))
63
+			foreach ($hook_results as $result) {
64
+							if (!empty($result))
65 65
 				{
66 66
 					$author = $result;
67
+			}
67 68
 					break;
68 69
 				}
69 70
 		}
70 71
 
71 72
 		// If we didn't have a member... leave.
72
-		if (empty($author))
73
-			return true;
73
+		if (empty($author)) {
74
+					return true;
75
+		}
74 76
 
75 77
 		// If the person who sent the notification is the person whose content it is, do nothing.
76
-		if ($author == $this->_details['sender_id'])
77
-			return true;
78
+		if ($author == $this->_details['sender_id']) {
79
+					return true;
80
+		}
78 81
 
79 82
 		// If the person who sent the notification is on this person's ignore list, do nothing.
80 83
 		if (!empty($ignored_members) && in_array($this->_details['sender_id'], $ignored_members)) {
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 		// As a result, the value should really just be non empty.
89 92
 
90 93
 		// Check the value. If no value or it's empty, they didn't want alerts, oh well.
91
-		if (empty($prefs[$author][$this->_details['content_type'] . '_like']))
92
-			return true;
94
+		if (empty($prefs[$author][$this->_details['content_type'] . '_like'])) {
95
+					return true;
96
+		}
93 97
 
94 98
 		// Don't spam the alerts: if there is an existing unread alert of the
95 99
 		// requested type for the target user from the sender, don't make a new one.
@@ -109,8 +113,9 @@  discard block
 block discarded – undo
109 113
 			)
110 114
 		);
111 115
 
112
-		if ($smcFunc['db_num_rows']($request) > 0)
113
-			return true;
116
+		if ($smcFunc['db_num_rows']($request) > 0) {
117
+					return true;
118
+		}
114 119
 		$smcFunc['db_free_result']($request);
115 120
 
116 121
 		// Issue, update, move on.
Please login to merge, or discard this patch.
Themes/default/ManageBoards.template.php 1 patch
Braces   +99 added lines, -68 removed lines patch added patch discarded remove patch
@@ -25,18 +25,20 @@  discard block
 block discarded – undo
25 25
 		</div>
26 26
 		<div class="windowbg2 noup">';
27 27
 
28
-	if (!empty($context['move_board']))
29
-		echo '
28
+	if (!empty($context['move_board'])) {
29
+			echo '
30 30
 		<div class="noticebox">
31 31
 			', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=manageboards">', $txt['mboards_cancel_moving'], '</a>]', '
32 32
 		</div>';
33
+	}
33 34
 
34 35
 	// No categories so show a label.
35
-	if (empty($context['categories']))
36
-		echo '
36
+	if (empty($context['categories'])) {
37
+			echo '
37 38
 		<div class="windowbg centertext">
38 39
 			', $txt['mboards_no_cats'], '
39 40
 		</div>';
41
+	}
40 42
 
41 43
 	// Loop through every category, listing the boards in each as we go.
42 44
 	foreach ($context['categories'] as $category)
@@ -54,9 +56,10 @@  discard block
 block discarded – undo
54 56
 		<form action="', $scripturl, '?action=admin;area=manageboards;sa=newboard;cat=', $category['id'], '" method="post" accept-charset="', $context['character_set'], '">
55 57
 				<ul id="category_', $category['id'], '" class="nolist">';
56 58
 
57
-		if (!empty($category['move_link']))
58
-			echo '
59
+		if (!empty($category['move_link'])) {
60
+					echo '
59 61
 					<li><a href="', $category['move_link']['href'], '" title="', $category['move_link']['label'], '"><span class="generic_icons select_above"></span></a></li>';
62
+		}
60 63
 
61 64
 		$recycle_board = '<a href="' . $scripturl . '?action=admin;area=manageboards;sa=settings"> <img src="' . $settings['images_url'] . '/post/recycled.png" alt="' . $txt['recycle_board'] . '" title="' . $txt['recycle_board'] . '"></a>';
62 65
 		$redirect_board = '<img src="' . $settings['images_url'] . '/new_redirect.png" alt="' . $txt['redirect_board_desc'] . '" title="' . $txt['redirect_board_desc'] . '">';
@@ -81,9 +84,10 @@  discard block
 block discarded – undo
81 84
 				echo '
82 85
 					<li class="windowbg" style="padding-', $context['right_to_left'] ? 'right' : 'left', ': ', 5 + 30 * $board['move_links'][0]['child_level'], 'px;">';
83 86
 
84
-				foreach ($board['move_links'] as $link)
85
-					echo '
87
+				foreach ($board['move_links'] as $link) {
88
+									echo '
86 89
 						<a href="', $link['href'], '" class="move_links" title="', $link['label'], '"><span class="generic_icons select_', $link['class'], '" title="', $link['label'], '"></span></a>';
90
+				}
87 91
 
88 92
 				echo '
89 93
 					</li>';
@@ -132,9 +136,10 @@  discard block
 block discarded – undo
132 136
 						<select name="cat_order">';
133 137
 
134 138
 		// Print every existing category into a select box.
135
-		foreach ($context['category_order'] as $order)
136
-			echo '
139
+		foreach ($context['category_order'] as $order) {
140
+					echo '
137 141
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
142
+		}
138 143
 		echo '
139 144
 						</select>
140 145
 					</dd>';
@@ -169,14 +174,15 @@  discard block
 block discarded – undo
169 174
 	{
170 175
 		foreach ($context['custom_category_settings'] as $catset_id => $catset)
171 176
 		{
172
-			if (!empty($catset['dt']) && !empty($catset['dd']))
173
-				echo '
177
+			if (!empty($catset['dt']) && !empty($catset['dd'])) {
178
+							echo '
174 179
 						<dt class="clear', !is_numeric($catset_id) ? ' catset_' . $catset_id : '', '">
175 180
 							', $catset['dt'], '
176 181
 						</dt>
177 182
 						<dd', !is_numeric($catset_id) ? ' class="catset_' . $catset_id . '"' : '', '>
178 183
 							', $catset['dd'], '
179 184
 						</dd>';
185
+			}
180 186
 		}
181 187
 	}
182 188
 
@@ -184,21 +190,23 @@  discard block
 block discarded – undo
184 190
 	echo '
185 191
 				</dl>';
186 192
 
187
-	if (isset($context['category']['is_new']))
188
-		echo '
193
+	if (isset($context['category']['is_new'])) {
194
+			echo '
189 195
 					<input type="submit" name="add" value="', $txt['mboards_add_cat_button'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">';
190
-	else
191
-		echo '
196
+	} else {
197
+			echo '
192 198
 					<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.cat_name);" tabindex="', $context['tabindex']++, '" class="button_submit">
193 199
 					<input type="submit" name="delete" value="', $txt['mboards_delete_cat'], '" data-confirm="', $txt['catConfirm'], '" class="button_submit you_sure">';
200
+	}
194 201
 	echo '
195 202
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
196 203
 					<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
197 204
 
198 205
 	// If this category is empty we don't bother with the next confirmation screen.
199
-	if ($context['category']['is_empty'])
200
-		echo '
206
+	if ($context['category']['is_empty']) {
207
+			echo '
201 208
 					<input type="hidden" name="empty" value="1">';
209
+	}
202 210
 
203 211
 	echo '
204 212
 			</div>
@@ -225,9 +233,10 @@  discard block
 block discarded – undo
225 233
 				<p>', $txt['mboards_delete_cat_contains'], ':</p>
226 234
 				<ul>';
227 235
 
228
-	foreach ($context['category']['children'] as $child)
229
-		echo '
236
+	foreach ($context['category']['children'] as $child) {
237
+			echo '
230 238
 					<li>', $child, '</li>';
239
+	}
231 240
 
232 241
 	echo '
233 242
 				</ul>
@@ -241,10 +250,11 @@  discard block
 block discarded – undo
241 250
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', count($context['category_order']) == 1 ? ' disabled' : '', '>', $txt['mboards_delete_option2'], '</label>:
242 251
 					<select name="cat_to"', count($context['category_order']) == 1 ? ' disabled' : '', '>';
243 252
 
244
-	foreach ($context['category_order'] as $cat)
245
-		if ($cat['id'] != 0)
253
+	foreach ($context['category_order'] as $cat) {
254
+			if ($cat['id'] != 0)
246 255
 			echo '
247 256
 						<option value="', $cat['id'], '">', $cat['true_name'], '</option>';
257
+	}
248 258
 
249 259
 	echo '
250 260
 					</select>
@@ -288,9 +298,10 @@  discard block
 block discarded – undo
288 298
 					</dt>
289 299
 					<dd>
290 300
 						<select name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">';
291
-		foreach ($context['categories'] as $category)
292
-			echo '
301
+		foreach ($context['categories'] as $category) {
302
+					echo '
293 303
 							<option', $category['selected'] ? ' selected' : '', ' value="', $category['id'], '">', $category['name'], '</option>';
304
+		}
294 305
 		echo '
295 306
 						</select>
296 307
 					</dd>';
@@ -317,9 +328,10 @@  discard block
 block discarded – undo
317 328
 	echo '
318 329
 						<select id="board_order" name="board_order"', !isset($context['board']['is_new']) ? ' disabled' : '', '>
319 330
 							', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '';
320
-	foreach ($context['board_order'] as $order)
321
-		echo '
331
+	foreach ($context['board_order'] as $order) {
332
+			echo '
322 333
 							<option', $order['selected'] ? ' selected' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
334
+	}
323 335
 	echo '
324 336
 						</select>
325 337
 					</dd>';
@@ -348,13 +360,15 @@  discard block
 block discarded – undo
348 360
 					<dd>
349 361
 						<select name="profile">';
350 362
 
351
-	if (isset($context['board']['is_new']))
352
-		echo '
363
+	if (isset($context['board']['is_new'])) {
364
+			echo '
353 365
 							<option value="-1">[', $txt['permission_profile_inherit'], ']</option>';
366
+	}
354 367
 
355
-	foreach ($context['profiles'] as $id => $profile)
356
-		echo '
368
+	foreach ($context['profiles'] as $id => $profile) {
369
+			echo '
357 370
 							<option value="', $id, '"', $id == $context['board']['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
371
+	}
358 372
 
359 373
 	echo '
360 374
 						</select>
@@ -367,8 +381,8 @@  discard block
 block discarded – undo
367 381
 					</dt>
368 382
 					<dd>';
369 383
 
370
-	if (!empty($modSettings['deny_boards_access']))
371
-		echo '
384
+	if (!empty($modSettings['deny_boards_access'])) {
385
+			echo '
372 386
 						<table>
373 387
 							<tr>
374 388
 								<td></td>
@@ -376,10 +390,11 @@  discard block
 block discarded – undo
376 390
 								<th>', $txt['permissions_option_off'], '</th>
377 391
 								<th>', $txt['permissions_option_deny'], '</th>
378 392
 							</tr>';
393
+	}
379 394
 
380 395
 	// List all the membergroups so the user can choose who may access this board.
381
-	foreach ($context['groups'] as $group)
382
-		if (empty($modSettings['deny_boards_access']))
396
+	foreach ($context['groups'] as $group) {
397
+			if (empty($modSettings['deny_boards_access']))
383 398
 			echo '
384 399
 						<label for="groups_', $group['id'], '">
385 400
 							<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', in_array($group['id'], $context['board_managers']) ? ' checked disabled' : ($group['allow'] ? ' checked' : ''), ' class="input_check">
@@ -387,8 +402,9 @@  discard block
 block discarded – undo
387 402
 								', $group['name'], '
388 403
 							</span>
389 404
 						</label><br>';
390
-		else
391
-			echo '
405
+	}
406
+		else {
407
+					echo '
392 408
 							<tr>
393 409
 								<td>
394 410
 									<label for="groups_', $group['id'], '_a">
@@ -408,16 +424,17 @@  discard block
 block discarded – undo
408 424
 								</td>
409 425
 								<td></td>
410 426
 							</tr>';
427
+		}
411 428
 
412
-	if (empty($modSettings['deny_boards_access']))
413
-		echo '
429
+	if (empty($modSettings['deny_boards_access'])) {
430
+			echo '
414 431
 						<span class="select_all_box">
415 432
 							<em>', $txt['check_all'], '</em> <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'groups[\');">
416 433
 						</span>
417 434
 						<br><br>
418 435
 					</dd>';
419
-	else
420
-		echo '
436
+	} else {
437
+			echo '
421 438
 							<tr class="select_all_box">
422 439
 								<td>
423 440
 								</td>
@@ -436,6 +453,7 @@  discard block
 block discarded – undo
436 453
 							</tr>
437 454
 						</table>
438 455
 					</dd>';
456
+	}
439 457
 
440 458
 	// Options to choose moderators, specify as announcement board and choose whether to count posts here.
441 459
 	echo '
@@ -490,8 +508,8 @@  discard block
 block discarded – undo
490 508
 					</dl>
491 509
 				</div>';
492 510
 
493
-		if ($context['board']['redirect'])
494
-			echo '
511
+		if ($context['board']['redirect']) {
512
+					echo '
495 513
 				<div id="reset_redirect_div">
496 514
 					<dl class="settings">
497 515
 						<dt>
@@ -504,6 +522,7 @@  discard block
 block discarded – undo
504 522
 						</dd>
505 523
 					</dl>
506 524
 				</div>';
525
+		}
507 526
 	}
508 527
 
509 528
 	echo '
@@ -531,9 +550,10 @@  discard block
 block discarded – undo
531 550
 							<select name="boardtheme" id="boardtheme" onchange="refreshOptions();">
532 551
 								<option value="0"', $context['board']['theme'] == 0 ? ' selected' : '', '>', $txt['mboards_theme_default'], '</option>';
533 552
 
534
-	foreach ($context['themes'] as $theme)
535
-		echo '
553
+	foreach ($context['themes'] as $theme) {
554
+			echo '
536 555
 									<option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>';
556
+	}
537 557
 
538 558
 	echo '
539 559
 							</select>
@@ -562,14 +582,15 @@  discard block
 block discarded – undo
562 582
 
563 583
 		foreach ($context['custom_board_settings'] as $cbs_id => $cbs)
564 584
 		{
565
-			if (!empty($cbs['dt']) && !empty($cbs['dd']))
566
-				echo '
585
+			if (!empty($cbs['dt']) && !empty($cbs['dd'])) {
586
+							echo '
567 587
 						<dt class="clear', !is_numeric($cbs_id) ? ' cbs_' . $cbs_id : '', '">
568 588
 							', $cbs['dt'], '
569 589
 						</dt>
570 590
 						<dd', !is_numeric($cbs_id) ? ' class="cbs_' . $cbs_id . '"' : '', '>
571 591
 							', $cbs['dd'], '
572 592
 						</dd>';
593
+			}
573 594
 		}
574 595
 
575 596
 		echo '
@@ -577,9 +598,10 @@  discard block
 block discarded – undo
577 598
 				</div>';
578 599
 	}
579 600
 
580
-	if (!empty($context['board']['is_recycle']))
581
-		echo '
601
+	if (!empty($context['board']['is_recycle'])) {
602
+			echo '
582 603
 				<div class="noticebox">', $txt['mboards_recycle_disabled_delete'], '</div>';
604
+	}
583 605
 
584 606
 	echo '
585 607
 				<input type="hidden" name="rid" value="', $context['redirect_location'], '">
@@ -587,21 +609,24 @@  discard block
 block discarded – undo
587 609
 				<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '">';
588 610
 
589 611
 	// If this board has no children don't bother with the next confirmation screen.
590
-	if ($context['board']['no_children'])
591
-		echo '
612
+	if ($context['board']['no_children']) {
613
+			echo '
592 614
 				<input type="hidden" name="no_children" value="1">';
615
+	}
593 616
 
594
-	if (isset($context['board']['is_new']))
595
-		echo '
617
+	if (isset($context['board']['is_new'])) {
618
+			echo '
596 619
 				<input type="hidden" name="cur_cat" value="', $context['board']['category'], '">
597 620
 				<input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
598
-	else
599
-		echo '
621
+	} else {
622
+			echo '
600 623
 				<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit">';
624
+	}
601 625
 
602
-	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle']))
603
-		echo '
626
+	if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) {
627
+			echo '
604 628
 				<input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" data-confirm="', $txt['boardConfirm'], '" class="button_submit you_sure">';
629
+	}
605 630
 	echo '
606 631
 			</div>
607 632
 		</form>
@@ -622,12 +647,13 @@  discard block
 block discarded – undo
622 647
 		sItemListContainerId: \'moderator_container\',
623 648
 		aListItems: [';
624 649
 
625
-	foreach ($context['board']['moderators'] as $id_member => $member_name)
626
-		echo '
650
+	foreach ($context['board']['moderators'] as $id_member => $member_name) {
651
+			echo '
627 652
 					{
628 653
 						sItemId: ', JavaScriptEscape($id_member), ',
629 654
 						sItemName: ', JavaScriptEscape($member_name), '
630 655
 					}', $id_member == $context['board']['last_moderator_id'] ? '' : ',';
656
+	}
631 657
 
632 658
 	echo '
633 659
 		]
@@ -647,12 +673,13 @@  discard block
 block discarded – undo
647 673
 		sItemListContainerId: \'moderator_group_container\',
648 674
 		aListItems: [';
649 675
 
650
-	foreach ($context['board']['moderator_groups'] as $id_group => $group_name)
651
-		echo '
676
+	foreach ($context['board']['moderator_groups'] as $id_group => $group_name) {
677
+			echo '
652 678
 					{
653 679
 						sItemId: ', JavaScriptEscape($id_group), ',
654 680
 						sItemName: ', JavaScriptEscape($group_name), '
655 681
 					}', $id_group == $context['board']['last_moderator_group_id'] ? '' : ',';
682
+	}
656 683
 
657 684
 		echo '
658 685
 			]
@@ -678,17 +705,19 @@  discard block
 block discarded – undo
678 705
 		echo '
679 706
 			document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";';
680 707
 
681
-		if ($context['board']['redirect'])
682
-			echo '
708
+		if ($context['board']['redirect']) {
709
+					echo '
683 710
 			document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";';
711
+		}
684 712
 	}
685 713
 
686 714
 	// Include any JavaScript added by mods using the 'integrate_edit_board' hook.
687 715
 	if (!empty($context['custom_refreshOptions']) && is_array($context['custom_refreshOptions']))
688 716
 	{
689
-		foreach ($context['custom_refreshOptions'] as $refreshOption)
690
-			echo '
717
+		foreach ($context['custom_refreshOptions'] as $refreshOption) {
718
+					echo '
691 719
 			', $refreshOption;
720
+		}
692 721
 	}
693 722
 
694 723
 	echo '
@@ -717,9 +746,10 @@  discard block
 block discarded – undo
717 746
 				<p>', $txt['mboards_delete_board_contains'], '</p>
718 747
 					<ul>';
719 748
 
720
-	foreach ($context['children'] as $child)
721
-		echo '
749
+	foreach ($context['children'] as $child) {
750
+			echo '
722 751
 						<li>', $child['node']['name'], '</li>';
752
+	}
723 753
 
724 754
 	echo '
725 755
 					</ul>
@@ -733,10 +763,11 @@  discard block
 block discarded – undo
733 763
 					<label for="delete_action1"><input type="radio" id="delete_action1" name="delete_action" value="1" class="input_radio"', empty($context['can_move_children']) ? ' disabled' : '', '>', $txt['mboards_delete_board_option2'], '</label>:
734 764
 					<select name="board_to"', empty($context['can_move_children']) ? ' disabled' : '', '>';
735 765
 
736
-	foreach ($context['board_order'] as $board)
737
-		if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
766
+	foreach ($context['board_order'] as $board) {
767
+			if ($board['id'] != $context['board']['id'] && empty($board['is_child']))
738 768
 			echo '
739 769
 						<option value="', $board['id'], '">', $board['name'], '</option>';
770
+	}
740 771
 
741 772
 	echo '
742 773
 					</select>
Please login to merge, or discard this patch.
Themes/default/Display.template.php 1 patch
Braces   +221 added lines, -151 removed lines patch added patch discarded remove patch
@@ -51,11 +51,13 @@  discard block
 block discarded – undo
51 51
 				<p>';
52 52
 
53 53
 		// Show just numbers...?
54
-		if ($settings['display_who_viewing'] == 1)
55
-				echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
54
+		if ($settings['display_who_viewing'] == 1) {
55
+						echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
56
+		}
56 57
 		// Or show the actual people viewing the topic?
57
-		else
58
-			echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
58
+		else {
59
+					echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
60
+		}
59 61
 
60 62
 		// Now show how many guests are here too.
61 63
 		echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
@@ -93,10 +95,11 @@  discard block
 block discarded – undo
93 95
 						<dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
94 96
 						<dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">';
95 97
 
96
-				if ($context['allow_results_view'])
97
-					echo '
98
+				if ($context['allow_results_view']) {
99
+									echo '
98 100
 							', $option['bar_ndt'], '
99 101
 							<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
102
+				}
100 103
 
101 104
 				echo '
102 105
 						</dd>';
@@ -105,9 +108,10 @@  discard block
 block discarded – undo
105 108
 			echo '
106 109
 					</dl>';
107 110
 
108
-			if ($context['allow_results_view'])
109
-				echo '
111
+			if ($context['allow_results_view']) {
112
+							echo '
110 113
 						<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
114
+			}
111 115
 		}
112 116
 		// They are allowed to vote! Go to it!
113 117
 		else
@@ -116,17 +120,19 @@  discard block
 block discarded – undo
116 120
 						<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
117 121
 
118 122
 			// Show a warning if they are allowed more than one option.
119
-			if ($context['poll']['allowed_warning'])
120
-				echo '
123
+			if ($context['poll']['allowed_warning']) {
124
+							echo '
121 125
 							<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
126
+			}
122 127
 
123 128
 			echo '
124 129
 							<ul class="options">';
125 130
 
126 131
 			// Show each option with its button - a radio likely.
127
-			foreach ($context['poll']['options'] as $option)
128
-				echo '
132
+			foreach ($context['poll']['options'] as $option) {
133
+							echo '
129 134
 								<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
135
+			}
130 136
 
131 137
 			echo '
132 138
 							</ul>
@@ -138,9 +144,10 @@  discard block
 block discarded – undo
138 144
 		}
139 145
 
140 146
 		// Is the clock ticking?
141
-		if (!empty($context['poll']['expire_time']))
142
-			echo '
147
+		if (!empty($context['poll']['expire_time'])) {
148
+					echo '
143 149
 						<p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>';
150
+		}
144 151
 
145 152
 		echo '
146 153
 					</div>
@@ -170,11 +177,13 @@  discard block
 block discarded – undo
170 177
 					<li>
171 178
 						<b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>';
172 179
 
173
-			if ($event['can_edit'])
174
-				echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
180
+			if ($event['can_edit']) {
181
+							echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>';
182
+			}
175 183
 
176
-			if ($event['can_export'])
177
-				echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
184
+			if ($event['can_export']) {
185
+							echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>';
186
+			}
178 187
 
179 188
 			echo '
180 189
 						<br>';
@@ -182,14 +191,14 @@  discard block
 block discarded – undo
182 191
 			if (!empty($event['allday']))
183 192
 			{
184 193
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : '';
185
-			}
186
-			else
194
+			} else
187 195
 			{
188 196
 				// Display event info relative to user's local timezone
189 197
 				echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
190 198
 
191
-				if ($event['start_date_local'] != $event['end_date_local'])
192
-					echo trim($event['end_date_local']) . ', ';
199
+				if ($event['start_date_local'] != $event['end_date_local']) {
200
+									echo trim($event['end_date_local']) . ', ';
201
+				}
193 202
 
194 203
 				echo trim($event['end_time_local']);
195 204
 
@@ -198,23 +207,27 @@  discard block
 block discarded – undo
198 207
 				{
199 208
 					echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">';
200 209
 
201
-					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig'])
202
-						echo trim($event['start_date_orig']), ', ';
210
+					if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) {
211
+											echo trim($event['start_date_orig']), ', ';
212
+					}
203 213
 
204 214
 					echo trim($event['start_time_orig']), '</time> &ndash; <time datetime="' . $event['end_iso_gmdate'] . '">';
205 215
 
206
-					if ($event['start_date_orig'] != $event['end_date_orig'])
207
-						echo trim($event['end_date_orig']) . ', ';
216
+					if ($event['start_date_orig'] != $event['end_date_orig']) {
217
+											echo trim($event['end_date_orig']) . ', ';
218
+					}
208 219
 
209 220
 					echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)';
210 221
 				}
211 222
 				// Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion
212
-				else
213
-					echo ' ', $event['tz_abbrev'], '</time>';
223
+				else {
224
+									echo ' ', $event['tz_abbrev'], '</time>';
225
+				}
214 226
 			}
215 227
 
216
-			if (!empty($event['location']))
217
-				echo '<br>', $event['location'];
228
+			if (!empty($event['location'])) {
229
+							echo '<br>', $event['location'];
230
+			}
218 231
 
219 232
 			echo '
220 233
 					</li>';
@@ -252,8 +265,9 @@  discard block
 block discarded – undo
252 265
 	$context['removableMessageIDs'] = array();
253 266
 
254 267
 	// Get all the messages...
255
-	while ($message = $context['get_message']())
256
-		template_single_post($message);
268
+	while ($message = $context['get_message']()) {
269
+			template_single_post($message);
270
+	}
257 271
 
258 272
 	echo '
259 273
 				</form>
@@ -290,8 +304,9 @@  discard block
 block discarded – undo
290 304
 			<div id="display_jump_to">&nbsp;</div>';
291 305
 
292 306
 	// Show quickreply
293
-	if ($context['can_reply'])
294
-	template_quickreply();
307
+	if ($context['can_reply']) {
308
+		template_quickreply();
309
+	}
295 310
 
296 311
 	// User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device.
297 312
 	echo '
@@ -304,8 +319,8 @@  discard block
 block discarded – undo
304 319
 			</div>';
305 320
 
306 321
 	// Show the moderation button & pop only if user can moderate
307
-	if ($context['can_moderate_forum'] || $context['user']['is_mod'])
308
-		echo '
322
+	if ($context['can_moderate_forum'] || $context['user']['is_mod']) {
323
+			echo '
309 324
 			<div id="mobile_moderation" class="popup_container">
310 325
 				<div class="popup_window description">
311 326
 					<div class="popup_heading">', $txt['mobile_moderation'], '
@@ -315,6 +330,7 @@  discard block
 block discarded – undo
315 330
 					</div>
316 331
 				</div>
317 332
 			</div>';
333
+	}
318 334
 
319 335
 		echo '
320 336
 				<script>';
@@ -438,9 +454,10 @@  discard block
 block discarded – undo
438 454
 						});
439 455
 					}';
440 456
 
441
-	if (!empty($context['ignoredMsgs']))
442
-		echo '
457
+	if (!empty($context['ignoredMsgs'])) {
458
+			echo '
443 459
 					ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
460
+	}
444 461
 
445 462
 	echo '
446 463
 				</script>';
@@ -457,8 +474,9 @@  discard block
 block discarded – undo
457 474
 
458 475
 	$ignoring = false;
459 476
 
460
-	if ($message['can_remove'])
461
-		$context['removableMessageIDs'][] = $message['id'];
477
+	if ($message['can_remove']) {
478
+			$context['removableMessageIDs'][] = $message['id'];
479
+	}
462 480
 
463 481
 	// Are we ignoring this message?
464 482
 	if (!empty($message['is_ignored']))
@@ -484,9 +502,10 @@  discard block
 block discarded – undo
484 502
 							<div class="custom_fields_above_member">
485 503
 								<ul class="nolist">';
486 504
 
487
-		foreach ($message['custom_fields']['above_member'] as $custom)
488
-			echo '
505
+		foreach ($message['custom_fields']['above_member'] as $custom) {
506
+					echo '
489 507
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
508
+		}
490 509
 
491 510
 		echo '
492 511
 								</ul>
@@ -497,9 +516,10 @@  discard block
 block discarded – undo
497 516
 									<h4>';
498 517
 
499 518
 	// Show online and offline buttons?
500
-	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
501
-		echo '
519
+	if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
520
+			echo '
502 521
 								', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : '';
522
+	}
503 523
 
504 524
 
505 525
 	// Show a link to the member's profile.
@@ -512,51 +532,59 @@  discard block
 block discarded – undo
512 532
 
513 533
 
514 534
 	// Show the user's avatar.
515
-	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
516
-		echo '
535
+	if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
536
+			echo '
517 537
 								<li class="avatar">
518 538
 									<a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a>
519 539
 								</li>';
540
+	}
520 541
 
521 542
 	// Are there any custom fields below the avatar?
522
-	if (!empty($message['custom_fields']['below_avatar']))
523
-		foreach ($message['custom_fields']['below_avatar'] as $custom)
543
+	if (!empty($message['custom_fields']['below_avatar'])) {
544
+			foreach ($message['custom_fields']['below_avatar'] as $custom)
524 545
 			echo '
525 546
 								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
547
+	}
526 548
 
527 549
 	// Show the post group icons, but not for guests.
528
-	if (!$message['member']['is_guest'])
529
-		echo '
550
+	if (!$message['member']['is_guest']) {
551
+			echo '
530 552
 								<li class="icons">', $message['member']['group_icons'], '</li>';
553
+	}
531 554
 
532 555
 	// Show the member's primary group (like 'Administrator') if they have one.
533
-	if (!empty($message['member']['group']))
534
-		echo '
556
+	if (!empty($message['member']['group'])) {
557
+			echo '
535 558
 								<li class="membergroup">', $message['member']['group'], '</li>';
559
+	}
536 560
 
537 561
 	// Show the member's custom title, if they have one.
538
-	if (!empty($message['member']['title']))
539
-		echo '
562
+	if (!empty($message['member']['title'])) {
563
+			echo '
540 564
 								<li class="title">', $message['member']['title'], '</li>';
565
+	}
541 566
 
542 567
 	// Don't show these things for guests.
543 568
 	if (!$message['member']['is_guest'])
544 569
 	{
545 570
 
546 571
 		// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
547
-		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group']))
548
-			echo '
572
+		if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) {
573
+					echo '
549 574
 								<li class="postgroup">', $message['member']['post_group'], '</li>';
575
+		}
550 576
 
551 577
 		// Show how many posts they have made.
552
-		if (!isset($context['disabled_fields']['posts']))
553
-			echo '
578
+		if (!isset($context['disabled_fields']['posts'])) {
579
+					echo '
554 580
 								<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
581
+		}
555 582
 
556 583
 		// Show their personal text?
557
-		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb']))
558
-			echo '
584
+		if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) {
585
+					echo '
559 586
 								<li class="blurb">', $message['member']['blurb'], '</li>';
587
+		}
560 588
 
561 589
 		// Any custom fields to show as icons?
562 590
 		if (!empty($message['custom_fields']['icons']))
@@ -565,9 +593,10 @@  discard block
 block discarded – undo
565 593
 								<li class="im_icons">
566 594
 									<ol>';
567 595
 
568
-			foreach ($message['custom_fields']['icons'] as $custom)
569
-				echo '
596
+			foreach ($message['custom_fields']['icons'] as $custom) {
597
+							echo '
570 598
 										<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
599
+			}
571 600
 
572 601
 			echo '
573 602
 									</ol>
@@ -582,19 +611,22 @@  discard block
 block discarded – undo
582 611
 									<ol class="profile_icons">';
583 612
 
584 613
 			// Don't show an icon if they haven't specified a website.
585
-			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website']))
586
-				echo '
614
+			if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) {
615
+							echo '
587 616
 										<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
617
+			}
588 618
 
589 619
 			// Since we know this person isn't a guest, you *can* message them.
590
-			if ($context['can_send_pm'])
591
-				echo '
620
+			if ($context['can_send_pm']) {
621
+							echo '
592 622
 										<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
623
+			}
593 624
 
594 625
 			// Show the email if necessary
595
-			if (!empty($message['member']['email']) && $message['member']['show_email'])
596
-				echo '
626
+			if (!empty($message['member']['email']) && $message['member']['show_email']) {
627
+							echo '
597 628
 										<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
629
+			}
598 630
 
599 631
 				echo '
600 632
 									</ol>
@@ -602,48 +634,56 @@  discard block
 block discarded – undo
602 634
 		}
603 635
 
604 636
 		// Any custom fields for standard placement?
605
-		if (!empty($message['custom_fields']['standard']))
606
-			foreach ($message['custom_fields']['standard'] as $custom)
637
+		if (!empty($message['custom_fields']['standard'])) {
638
+					foreach ($message['custom_fields']['standard'] as $custom)
607 639
 				echo '
608 640
 								<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
641
+		}
609 642
 
610 643
 	}
611 644
 	// Otherwise, show the guest's email.
612
-	elseif (!empty($message['member']['email']) && $message['member']['show_email'])
613
-		echo '
645
+	elseif (!empty($message['member']['email']) && $message['member']['show_email']) {
646
+			echo '
614 647
 								<li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>';
648
+	}
615 649
 
616 650
 	// Show the IP to this user for this post - because you can moderate?
617
-	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
618
-		echo '
651
+	if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
652
+			echo '
619 653
 								<li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>';
654
+	}
620 655
 
621 656
 	// Or, should we show it because this is you?
622
-	elseif ($message['can_see_ip'])
623
-		echo '
657
+	elseif ($message['can_see_ip']) {
658
+			echo '
624 659
 								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>';
660
+	}
625 661
 
626 662
 	// Okay, are you at least logged in? Then we can show something about why IPs are logged...
627
-	elseif (!$context['user']['is_guest'])
628
-		echo '
663
+	elseif (!$context['user']['is_guest']) {
664
+			echo '
629 665
 								<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>';
666
+	}
630 667
 
631 668
 	// Otherwise, you see NOTHING!
632
-	else
633
-		echo '
669
+	else {
670
+			echo '
634 671
 								<li class="poster_ip">', $txt['logged'], '</li>';
672
+	}
635 673
 
636 674
 	// Are we showing the warning status?
637 675
 	// Don't show these things for guests.
638
-	if (!$message['member']['is_guest'] && $message['member']['can_see_warning'])
639
-		echo '
676
+	if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) {
677
+			echo '
640 678
 								<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
679
+	}
641 680
 
642 681
 	// Are there any custom fields to show at the bottom of the poster info?
643
-	if (!empty($message['custom_fields']['bottom_poster']))
644
-		foreach ($message['custom_fields']['bottom_poster'] as $custom)
682
+	if (!empty($message['custom_fields']['bottom_poster'])) {
683
+			foreach ($message['custom_fields']['bottom_poster'] as $custom)
645 684
 			echo '
646 685
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
686
+	}
647 687
 
648 688
 	// Poster info ends.
649 689
 	echo '
@@ -672,9 +712,10 @@  discard block
 block discarded – undo
672 712
 	echo '
673 713
 									<span class="smalltext modified floatright', !empty($modSettings['show_modify']) && !empty($message['modified']['name']) ? ' mvisible' : '','" id="modified_', $message['id'], '">';
674 714
 
675
-	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name']))
676
-		echo
715
+	if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) {
716
+			echo
677 717
 										$message['modified']['last_edit_text'];
718
+	}
678 719
 
679 720
 	echo '
680 721
 									</span>
@@ -683,22 +724,24 @@  discard block
 block discarded – undo
683 724
 							</div>';
684 725
 
685 726
 	// Ignoring this user? Hide the post.
686
-	if ($ignoring)
687
-		echo '
727
+	if ($ignoring) {
728
+			echo '
688 729
 							<div id="msg_', $message['id'], '_ignored_prompt">
689 730
 								', $txt['ignoring_user'], '
690 731
 								<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
691 732
 							</div>';
733
+	}
692 734
 
693 735
 	// Show the post itself, finally!
694 736
 	echo '
695 737
 							<div class="post">';
696 738
 
697
-	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id'])
698
-		echo '
739
+	if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
740
+			echo '
699 741
 								<div class="approve_post">
700 742
 									', $txt['post_awaiting_approval'], '
701 743
 								</div>';
744
+	}
702 745
 	echo '
703 746
 								<div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div>
704 747
 							</div>';
@@ -715,9 +758,9 @@  discard block
 block discarded – undo
715 758
 		foreach ($message['attachment'] as $attachment)
716 759
 		{
717 760
 			// Do we want this attachment to not be showed here?
718
-			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']]))
719
-				continue;
720
-			elseif (!$div_output)
761
+			if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) {
762
+							continue;
763
+			} elseif (!$div_output)
721 764
 			{
722 765
 				$div_output = true;
723 766
 
@@ -733,9 +776,10 @@  discard block
 block discarded – undo
733 776
 								<fieldset>
734 777
 									<legend>', $txt['attach_awaiting_approve'];
735 778
 
736
-				if ($context['can_approve'])
737
-					echo '
779
+				if ($context['can_approve']) {
780
+									echo '
738 781
 										&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
782
+				}
739 783
 
740 784
 				echo '
741 785
 									</legend>';
@@ -749,12 +793,13 @@  discard block
 block discarded – undo
749 793
 				echo '
750 794
 										<div class="attachments_top">';
751 795
 
752
-				if ($attachment['thumbnail']['has_thumb'])
753
-					echo '
796
+				if ($attachment['thumbnail']['has_thumb']) {
797
+									echo '
754 798
 											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>';
755
-				else
756
-					echo '
799
+				} else {
800
+									echo '
757 801
 											<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">';
802
+				}
758 803
 
759 804
 				echo '
760 805
 										</div>';
@@ -764,9 +809,10 @@  discard block
 block discarded – undo
764 809
 										<div class="attachments_bot">
765 810
 											<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*">&nbsp;' . $attachment['name'] . '</a> ';
766 811
 
767
-			if (!$attachment['is_approved'] && $context['can_approve'])
768
-				echo '
812
+			if (!$attachment['is_approved'] && $context['can_approve']) {
813
+							echo '
769 814
 											[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
815
+			}
770 816
 			echo '
771 817
 											<br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), '
772 818
 										</div>';
@@ -775,33 +821,38 @@  discard block
 block discarded – undo
775 821
 									</div>';
776 822
 
777 823
 			// Next attachment line ?
778
-			if (++$i % $attachments_per_line === 0)
779
-				echo '
824
+			if (++$i % $attachments_per_line === 0) {
825
+							echo '
780 826
 									<br>';
827
+			}
781 828
 		}
782 829
 
783 830
 		// If we had unapproved attachments clean up.
784
-		if ($last_approved_state == 0)
785
-			echo '
831
+		if ($last_approved_state == 0) {
832
+					echo '
786 833
 								</fieldset>';
834
+		}
787 835
 
788 836
 		// Only do this if we output a div above - otherwise it'll break things
789
-		if ($div_output)
790
-			echo '
837
+		if ($div_output) {
838
+					echo '
791 839
 							</div>';
840
+		}
792 841
 	}
793 842
 
794 843
 	// And stuff below the attachments.
795
-	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
796
-	echo '
844
+	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
845
+		echo '
797 846
 							<div class="under_message">';
847
+	}
798 848
 
799 849
 	// Maybe they want to report this post to the moderator(s)?
800
-	if ($context['can_report_moderator'])
801
-		echo '
850
+	if ($context['can_report_moderator']) {
851
+			echo '
802 852
 								<ul class="floatright smalltext">
803 853
 									<li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li>
804 854
 								</ul>';
855
+	}
805 856
 
806 857
 	// What about likes?
807 858
 	if (!empty($modSettings['enable_likes']))
@@ -842,78 +893,91 @@  discard block
 block discarded – undo
842 893
 								<ul class="quickbuttons">';
843 894
 
844 895
 		// Can they quote? if so they can select and quote as well!
845
-		if ($context['can_quote'])
846
-			echo '
896
+		if ($context['can_quote']) {
897
+					echo '
847 898
 									<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>
848 899
 									<li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>';
900
+		}
849 901
 
850 902
 		// Can the user modify the contents of this post? Show the modify inline image.
851
-		if ($message['can_modify'])
852
-			echo '
903
+		if ($message['can_modify']) {
904
+					echo '
853 905
 									<li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>';
906
+		}
854 907
 
855
-		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
856
-			echo '
908
+		if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
909
+					echo '
857 910
 									<li class="post_options">', $txt['post_options'];
911
+		}
858 912
 
859 913
 		echo '
860 914
 										<ul>';
861 915
 
862 916
 		// Can the user modify the contents of this post?
863
-		if ($message['can_modify'])
864
-			echo '
917
+		if ($message['can_modify']) {
918
+					echo '
865 919
 											<li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>';
920
+		}
866 921
 
867 922
 		// How about... even... remove it entirely?!
868
-		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id']))
869
-			echo '
923
+		if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) {
924
+					echo '
870 925
 											<li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>';
871
-		elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id']))
872
-			echo '
926
+		} elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) {
927
+					echo '
873 928
 											<li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>';
929
+		}
874 930
 
875 931
 		// What about splitting it off the rest of the topic?
876
-		if ($context['can_split'] && !empty($context['real_num_replies']))
877
-			echo '
932
+		if ($context['can_split'] && !empty($context['real_num_replies'])) {
933
+					echo '
878 934
 											<li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>';
935
+		}
879 936
 
880 937
 		// Can we issue a warning because of this post? Remember, we can't give guests warnings.
881
-		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest'])
882
-			echo '
938
+		if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
939
+					echo '
883 940
 											<li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>';
941
+		}
884 942
 
885 943
 		// Can we restore topics?
886
-		if ($context['can_restore_msg'])
887
-			echo '
944
+		if ($context['can_restore_msg']) {
945
+					echo '
888 946
 											<li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>';
947
+		}
889 948
 
890 949
 		// Maybe we can approve it, maybe we should?
891
-		if ($message['can_approve'])
892
-			echo '
950
+		if ($message['can_approve']) {
951
+					echo '
893 952
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>';
953
+		}
894 954
 
895 955
 		// Maybe we can unapprove it?
896
-		if ($message['can_unapprove'])
897
-			echo '
956
+		if ($message['can_unapprove']) {
957
+					echo '
898 958
 											<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>';
959
+		}
899 960
 
900 961
 		echo '
901 962
 										</ul>
902 963
 									</li>';
903 964
 
904 965
 		// Show a checkbox for quick moderation?
905
-		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
906
-			echo '
966
+		if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
967
+					echo '
907 968
 									<li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
969
+		}
908 970
 
909
-		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'])
910
-			echo '
971
+		if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
972
+					echo '
911 973
 								</ul>';
974
+		}
912 975
 	}
913 976
 
914
-	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote'])
915
-	echo '
977
+	if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) {
978
+		echo '
916 979
 							</div>';
980
+	}
917 981
 
918 982
 	echo '
919 983
 						</div>
@@ -926,9 +990,10 @@  discard block
 block discarded – undo
926 990
 							<div class="custom_fields_above_signature">
927 991
 								<ul class="nolist">';
928 992
 
929
-		foreach ($message['custom_fields']['above_signature'] as $custom)
930
-			echo '
993
+		foreach ($message['custom_fields']['above_signature'] as $custom) {
994
+					echo '
931 995
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
996
+		}
932 997
 
933 998
 		echo '
934 999
 								</ul>
@@ -936,9 +1001,10 @@  discard block
 block discarded – undo
936 1001
 	}
937 1002
 
938 1003
 	// Show the member's signature?
939
-	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
940
-		echo '
1004
+	if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
1005
+			echo '
941 1006
 							<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>';
1007
+	}
942 1008
 
943 1009
 
944 1010
 	// Are there any custom profile fields for below the signature?
@@ -948,9 +1014,10 @@  discard block
 block discarded – undo
948 1014
 							<div class="custom_fields_below_signature">
949 1015
 								<ul class="nolist">';
950 1016
 
951
-		foreach ($message['custom_fields']['below_signature'] as $custom)
952
-			echo '
1017
+		foreach ($message['custom_fields']['below_signature'] as $custom) {
1018
+					echo '
953 1019
 									<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
1020
+		}
954 1021
 
955 1022
 		echo '
956 1023
 								</ul>
@@ -998,8 +1065,8 @@  discard block
 block discarded – undo
998 1065
 						<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">';
999 1066
 
1000 1067
 		// Guests just need more.
1001
-		if ($context['user']['is_guest'])
1002
-			echo '
1068
+		if ($context['user']['is_guest']) {
1069
+					echo '
1003 1070
 						<dl id="post_header">
1004 1071
 							<dt>
1005 1072
 								', $txt['name'], ':
@@ -1014,6 +1081,7 @@  discard block
 block discarded – undo
1014 1081
 								<input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required>
1015 1082
 							</dd>
1016 1083
 						</dl>';
1084
+		}
1017 1085
 
1018 1086
 		echo '
1019 1087
 						', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
@@ -1061,8 +1129,8 @@  discard block
 block discarded – undo
1061 1129
 		<br class="clear">';
1062 1130
 
1063 1131
 	// draft autosave available and the user has it enabled?
1064
-	if (!empty($context['drafts_autosave']))
1065
-		echo '
1132
+	if (!empty($context['drafts_autosave'])) {
1133
+			echo '
1066 1134
 			<script>
1067 1135
 				var oDraftAutoSave = new smf_DraftAutoSave({
1068 1136
 					sSelf: \'oDraftAutoSave\',
@@ -1074,10 +1142,12 @@  discard block
 block discarded – undo
1074 1142
 					iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), '
1075 1143
 				});
1076 1144
 			</script>';
1145
+	}
1077 1146
 
1078
-	if ($context['show_spellchecking'])
1079
-		echo '
1147
+	if ($context['show_spellchecking']) {
1148
+			echo '
1080 1149
 			<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>';
1150
+	}
1081 1151
 
1082 1152
 	echo '
1083 1153
 				<script>
Please login to merge, or discard this patch.
Themes/default/index.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -72,9 +72,10 @@  discard block
 block discarded – undo
72 72
 
73 73
 	// Allow css/js files to be disable for this specific theme.
74 74
 	// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference.
75
-	if (!isset($settings['disable_files']))
76
-		$settings['disable_files'] = array();
77
-}
75
+	if (!isset($settings['disable_files'])) {
76
+			$settings['disable_files'] = array();
77
+	}
78
+	}
78 79
 
79 80
 /**
80 81
  * The main sub template above the content.
@@ -111,8 +112,9 @@  discard block
 block discarded – undo
111 112
 		echo '
112 113
 	<meta';
113 114
 
114
-		foreach ($meta_tag as $meta_key => $meta_value)
115
-			echo ' ', $meta_key, '="', $meta_value, '"';
115
+		foreach ($meta_tag as $meta_key => $meta_value) {
116
+					echo ' ', $meta_key, '="', $meta_value, '"';
117
+		}
116 118
 
117 119
 		echo '>';
118 120
 	}
@@ -123,14 +125,16 @@  discard block
 block discarded – undo
123 125
 	<meta name="theme-color" content="#557EA0">';
124 126
 
125 127
 	// Please don't index these Mr Robot.
126
-	if (!empty($context['robot_no_index']))
127
-		echo '
128
+	if (!empty($context['robot_no_index'])) {
129
+			echo '
128 130
 	<meta name="robots" content="noindex">';
131
+	}
129 132
 
130 133
 	// Present a canonical url for search engines to prevent duplicate content in their indices.
131
-	if (!empty($context['canonical_url']))
132
-		echo '
134
+	if (!empty($context['canonical_url'])) {
135
+			echo '
133 136
 	<link rel="canonical" href="', $context['canonical_url'], '">';
137
+	}
134 138
 
135 139
 	// Show all the relative links, such as help, search, contents, and the like.
136 140
 	echo '
@@ -139,10 +143,11 @@  discard block
 block discarded – undo
139 143
 	<link rel="search" href="' . $scripturl . '?action=search">' : '');
140 144
 
141 145
 	// If RSS feeds are enabled, advertise the presence of one.
142
-	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
143
-		echo '
146
+	if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged'])) {
147
+			echo '
144 148
 	<link rel="alternate feed" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?action=.xml;type=rss2', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">
145 149
 	<link rel="alternate feed" type="application/atom+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['atom'], '" href="', $scripturl, '?action=.xml;type=atom', !empty($context['current_board']) ? ';board=' . $context['current_board'] : '', '">';
150
+	}
146 151
 
147 152
 	// If we're viewing a topic, these should be the previous and next topics, respectively.
148 153
 	if (!empty($context['links']['next']))
@@ -158,9 +163,10 @@  discard block
 block discarded – undo
158 163
 	}
159 164
 
160 165
 	// If we're in a board, or a topic for that matter, the index will be the board's index.
161
-	if (!empty($context['current_board']))
162
-		echo '
166
+	if (!empty($context['current_board'])) {
167
+			echo '
163 168
 	<link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0">';
169
+	}
164 170
 
165 171
 	// Output any remaining HTML headers. (from mods, maybe?)
166 172
 	echo $context['html_headers'];
@@ -191,8 +197,9 @@  discard block
 block discarded – undo
191 197
 		<ul class="floatleft" id="top_info">
192 198
 			<li>
193 199
 				<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
194
-					if (!empty($context['user']['avatar']))
195
-						echo $context['user']['avatar']['image'];
200
+					if (!empty($context['user']['avatar'])) {
201
+											echo $context['user']['avatar']['image'];
202
+					}
196 203
 					echo $context['user']['name'], '</a>
197 204
 				<div id="profile_menu" class="top_menu"></div>
198 205
 			</li>';
@@ -220,17 +227,18 @@  discard block
 block discarded – undo
220 227
 	}
221 228
 	// Otherwise they're a guest. Ask them to either register or login.
222 229
 	else
223
-		if (empty($maintenance))
224
-			echo '
230
+		if (empty($maintenance)) {
231
+					echo '
225 232
 			<ul class="floatleft welcome">
226 233
 				<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li>
227 234
 			</ul>';
228
-		else
229
-			//In maintenance mode, only login is allowed and don't show OverlayDiv
235
+		} else {
236
+					//In maintenance mode, only login is allowed and don't show OverlayDiv
230 237
 			echo '
231 238
 			<ul class="floatleft welcome">
232 239
 				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
233 240
 			</ul>';
241
+		}
234 242
 
235 243
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
236 244
 	{
@@ -238,9 +246,10 @@  discard block
 block discarded – undo
238 246
 		<form id="languages_form" method="get" class="floatright">
239 247
 			<select id="language_select" name="language" onchange="this.form.submit()">';
240 248
 
241
-		foreach ($context['languages'] as $language)
242
-			echo '
249
+		foreach ($context['languages'] as $language) {
250
+					echo '
243 251
 				<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
252
+		}
244 253
 
245 254
 		echo '
246 255
 			</select>
@@ -264,31 +273,36 @@  discard block
 block discarded – undo
264 273
 				<option value="all"', ($selected == 'all' ? ' selected' : ''), '>', $txt['search_entireforum'], ' </option>';
265 274
 
266 275
 		// Can't limit it to a specific topic if we are not in one
267
-		if (!empty($context['current_topic']))
268
-			echo '
276
+		if (!empty($context['current_topic'])) {
277
+					echo '
269 278
 				<option value="topic"', ($selected == 'current_topic' ? ' selected' : ''), '>', $txt['search_thistopic'], '</option>';
279
+		}
270 280
 
271 281
 		// Can't limit it to a specific board if we are not in one
272
-		if (!empty($context['current_board']))
273
-			echo '
282
+		if (!empty($context['current_board'])) {
283
+					echo '
274 284
 				<option value="board"', ($selected == 'current_board' ? ' selected' : ''), '>', $txt['search_thisbrd'], '</option>';
285
+		}
275 286
 
276 287
 		// Can't search for members if we can't see the memberlist
277
-		if (!empty($context['allow_memberlist']))
278
-			echo '
288
+		if (!empty($context['allow_memberlist'])) {
289
+					echo '
279 290
 				<option value="members"', ($selected == 'members' ? ' selected' : ''), '>', $txt['search_members'], ' </option>';
291
+		}
280 292
 
281 293
 		echo '
282 294
 			</select>';
283 295
 
284 296
 		// Search within current topic?
285
-		if (!empty($context['current_topic']))
286
-			echo '
297
+		if (!empty($context['current_topic'])) {
298
+					echo '
287 299
 			<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
300
+		}
288 301
 		// If we're on a certain board, limit it to this board ;).
289
-		elseif (!empty($context['current_board']))
290
-			echo '
302
+		elseif (!empty($context['current_board'])) {
303
+					echo '
291 304
 			<input type="hidden" name="sd_brd" value="', $context['current_board'], '">';
305
+		}
292 306
 
293 307
 		echo '
294 308
 			<input type="submit" name="search2" value="', $txt['search'], '" class="button_submit">
@@ -318,12 +332,13 @@  discard block
 block discarded – undo
318 332
 						', $context['current_time'], '
319 333
 					</div>';
320 334
 	// Show a random news item? (or you could pick one from news_lines...)
321
-	if (!empty($settings['enable_news']) && !empty($context['random_news_line']))
322
-		echo '
335
+	if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
336
+			echo '
323 337
 					<div class="news">
324 338
 						<h2>', $txt['news'], ': </h2>
325 339
 						<p>', $context['random_news_line'], '</p>
326 340
 					</div>';
341
+	}
327 342
 
328 343
 	echo '
329 344
 					<hr class="clear">
@@ -386,9 +401,10 @@  discard block
 block discarded – undo
386 401
 		</ul>';
387 402
 
388 403
 	// Show the load time?
389
-	if ($context['show_load_time'])
390
-		echo '
404
+	if ($context['show_load_time']) {
405
+			echo '
391 406
 		<p>', sprintf($txt['page_created_full'], $context['load_time'], $context['load_queries']), '</p>';
407
+	}
392 408
 
393 409
 	echo '
394 410
 	</div>';
@@ -418,19 +434,21 @@  discard block
 block discarded – undo
418 434
 	global $context, $shown_linktree, $scripturl, $txt;
419 435
 
420 436
 	// If linktree is empty, just return - also allow an override.
421
-	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
422
-		return;
437
+	if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show)) {
438
+			return;
439
+	}
423 440
 
424 441
 	echo '
425 442
 				<div class="navigate_section">
426 443
 					<ul>';
427 444
 
428
-	if ($context['user']['is_logged'])
429
-	echo '
445
+	if ($context['user']['is_logged']) {
446
+		echo '
430 447
 						<li class="unread_links">
431 448
 							<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
432 449
 							<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
433 450
 						</li>';
451
+	}
434 452
 
435 453
 	// Each tree item has a URL and name. Some may have extra_before and extra_after.
436 454
 	foreach ($context['linktree'] as $link_num => $tree)
@@ -441,25 +459,29 @@  discard block
 block discarded – undo
441 459
 		// Don't show a separator for the first one.
442 460
 		// Better here. Always points to the next level when the linktree breaks to a second line.
443 461
 		// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
444
-		if ($link_num != 0)
445
-			echo '
462
+		if ($link_num != 0) {
463
+					echo '
446 464
 							<span class="dividers">', $context['right_to_left'] ? ' &#9668; ' : ' &#9658; ', '</span>';
465
+		}
447 466
 
448 467
 		// Show something before the link?
449
-		if (isset($tree['extra_before']))
450
-			echo $tree['extra_before'], ' ';
468
+		if (isset($tree['extra_before'])) {
469
+					echo $tree['extra_before'], ' ';
470
+		}
451 471
 
452 472
 		// Show the link, including a URL if it should have one.
453
-		if (isset($tree['url']))
454
-			echo '
473
+		if (isset($tree['url'])) {
474
+					echo '
455 475
 					<a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>';
456
-		else
457
-			echo '
476
+		} else {
477
+					echo '
458 478
 					<span>' . $tree['name'] . '</span>';
479
+		}
459 480
 
460 481
 		// Show something after the link...?
461
-		if (isset($tree['extra_after']))
462
-			echo ' ', $tree['extra_after'];
482
+		if (isset($tree['extra_after'])) {
483
+					echo ' ', $tree['extra_after'];
484
+		}
463 485
 
464 486
 		echo '
465 487
 						</li>';
@@ -509,13 +531,14 @@  discard block
 block discarded – undo
509 531
 					echo '
510 532
 									<ul>';
511 533
 
512
-					foreach ($childbutton['sub_buttons'] as $grandchildbutton)
513
-						echo '
534
+					foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
535
+											echo '
514 536
 										<li>
515 537
 											<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
516 538
 												', $grandchildbutton['title'], '
517 539
 											</a>
518 540
 										</li>';
541
+					}
519 542
 
520 543
 					echo '
521 544
 									</ul>';
@@ -546,8 +569,9 @@  discard block
 block discarded – undo
546 569
 {
547 570
 	global $context, $txt;
548 571
 
549
-	if (!is_array($strip_options))
550
-		$strip_options = array();
572
+	if (!is_array($strip_options)) {
573
+			$strip_options = array();
574
+	}
551 575
 
552 576
 	// Create the buttons...
553 577
 	$buttons = array();
@@ -556,8 +580,9 @@  discard block
 block discarded – undo
556 580
 		// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
557 581
 		if (!isset($value['test']) || !empty($context[$value['test']]))
558 582
 		{
559
-			if (!isset($value['id']))
560
-				$value['id'] = $key;
583
+			if (!isset($value['id'])) {
584
+							$value['id'] = $key;
585
+			}
561 586
 
562 587
 			$button = '
563 588
 				<a class="button button_strip_' . $key . (!empty($value['active']) ? ' active' : '') . (isset($value['class']) ? ' ' . $value['class'] : '') . '" ' . (!empty($value['url']) ? 'href="' . $value['url'] . '"' : '') . ' ' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';
@@ -570,13 +595,15 @@  discard block
 block discarded – undo
570 595
 							<div class="overview">';
571 596
 				foreach ($value['sub_buttons'] as $element)
572 597
 				{
573
-					if (isset($element['test']) && empty($context[$element['test']]))
574
-						continue;
598
+					if (isset($element['test']) && empty($context[$element['test']])) {
599
+											continue;
600
+					}
575 601
 
576 602
 					$button .= '
577 603
 								<a href="' . $element['url'] . '"><strong>' . $txt[$element['text']] . '</strong>';
578
-					if (isset($txt[$element['text'] . '_desc']))
579
-						$button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>';
604
+					if (isset($txt[$element['text'] . '_desc'])) {
605
+											$button .= '<br /><span>' . $txt[$element['text'] . '_desc'] . '</span>';
606
+					}
580 607
 					$button .= '</a>';
581 608
 				}
582 609
 				$button .= '
@@ -590,8 +617,9 @@  discard block
 block discarded – undo
590 617
 	}
591 618
 
592 619
 	// No buttons? No button strip either.
593
-	if (empty($buttons))
594
-		return;
620
+	if (empty($buttons)) {
621
+			return;
622
+	}
595 623
 
596 624
 	echo '
597 625
 		<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
Please login to merge, or discard this patch.
Sources/Subscriptions-PayPal.php 1 patch
Braces   +83 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 // This won't be dedicated without this - this must exist in each gateway!
15 15
 // SMF Payment Gateway: paypal
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Class for returning available form data for this gateway
@@ -118,8 +119,7 @@  discard block
 block discarded – undo
118 119
 		{
119 120
 			$return_data['hidden']['p3'] = 1;
120 121
 			$return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1));
121
-		}
122
-		else
122
+		} else
123 123
 		{
124 124
 			preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match);
125 125
 			$unit = $match[1];
@@ -130,14 +130,15 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		// If it's repeatable do some javascript to respect this idea.
133
-		if (!empty($sub_data['repeatable']))
134
-			$return_data['javascript'] = '
133
+		if (!empty($sub_data['repeatable'])) {
134
+					$return_data['javascript'] = '
135 135
 				document.write(\'<label for="do_paypal_recur"><input type="checkbox" name="do_paypal_recur" id="do_paypal_recur" checked onclick="switchPaypalRecur();" class="input_check">' . $txt['paid_make_recurring'] . '</label><br>\');
136 136
 
137 137
 				function switchPaypalRecur()
138 138
 				{
139 139
 					document.getElementById("paypal_cmd").value = document.getElementById("do_paypal_recur").checked ? "_xclick-subscriptions" : "_xclick";
140 140
 				}';
141
+		}
141 142
 
142 143
 		return $return_data;
143 144
 	}
@@ -160,20 +161,24 @@  discard block
 block discarded – undo
160 161
 		global $modSettings;
161 162
 
162 163
 		// Has the user set up an email address?
163
-		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email'])))
164
-			return false;
164
+		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) {
165
+					return false;
166
+		}
165 167
 		// Check the correct transaction types are even here.
166
-		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
167
-			return false;
168
+		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) {
169
+					return false;
170
+		}
168 171
 		// Correct email address?
169
-		if (!isset($_POST['business']))
170
-			$_POST['business'] = $_POST['receiver_email'];
172
+		if (!isset($_POST['business'])) {
173
+					$_POST['business'] = $_POST['receiver_email'];
174
+		}
171 175
 
172 176
 		// Are we testing?
173
-		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
174
-			return false;
175
-		elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails']))))
176
-			return false;
177
+		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
178
+					return false;
179
+		} elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) {
180
+					return false;
181
+		}
177 182
 		return true;
178 183
 	}
179 184
 
@@ -192,15 +197,17 @@  discard block
 block discarded – undo
192 197
 		global $modSettings, $txt;
193 198
 
194 199
 		// Put this to some default value.
195
-		if (!isset($_POST['txn_type']))
196
-			$_POST['txn_type'] = '';
200
+		if (!isset($_POST['txn_type'])) {
201
+					$_POST['txn_type'] = '';
202
+		}
197 203
 
198 204
 		// Build the request string - starting with the minimum requirement.
199 205
 		$requestString = 'cmd=_notify-validate';
200 206
 
201 207
 		// Now my dear, add all the posted bits in the order we got them
202
-		foreach ($_POST as $k => $v)
203
-			$requestString .= '&' . $k . '=' . urlencode($v);
208
+		foreach ($_POST as $k => $v) {
209
+					$requestString .= '&' . $k . '=' . urlencode($v);
210
+		}
204 211
 
205 212
 		// Can we use curl?
206 213
 		if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))
@@ -240,14 +247,16 @@  discard block
 block discarded – undo
240 247
 			$header .= 'Connection: close' . "\r\n\r\n";
241 248
 
242 249
 			// Open the connection.
243
-			if (!empty($modSettings['paidsubs_test']))
244
-				$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
245
-			else
246
-				$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
250
+			if (!empty($modSettings['paidsubs_test'])) {
251
+							$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
252
+			} else {
253
+							$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
254
+			}
247 255
 
248 256
 			// Did it work?
249
-			if (!$fp)
250
-				generateSubscriptionError($txt['paypal_could_not_connect']);
257
+			if (!$fp) {
258
+							generateSubscriptionError($txt['paypal_could_not_connect']);
259
+			}
251 260
 
252 261
 			// Put the data to the port.
253 262
 			fputs($fp, $header . $requestString);
@@ -256,8 +265,9 @@  discard block
 block discarded – undo
256 265
 			while (!feof($fp))
257 266
 			{
258 267
 				$this->return_data = fgets($fp, 1024);
259
-				if (strcmp(trim($this->return_data), 'VERIFIED') === 0)
260
-					break;
268
+				if (strcmp(trim($this->return_data), 'VERIFIED') === 0) {
269
+									break;
270
+				}
261 271
 			}
262 272
 
263 273
 			// Clean up.
@@ -265,28 +275,34 @@  discard block
 block discarded – undo
265 275
 		}
266 276
 
267 277
 		// If this isn't verified then give up...
268
-		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0)
269
-			exit;
278
+		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) {
279
+					exit;
280
+		}
270 281
 
271 282
 		// Check that this is intended for us.
272
-		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
273
-			exit;
283
+		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
284
+					exit;
285
+		}
274 286
 
275 287
 		// Is this a subscription - and if so is it a secondary payment that we need to process?
276 288
 		// If so, make sure we get it in the expected format. Seems PayPal sometimes sends it without urlencoding.
277
-		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false)
278
-			$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
279
-		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false))
280
-			// Calculate the subscription it relates to!
289
+		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) {
290
+					$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
291
+		}
292
+		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) {
293
+					// Calculate the subscription it relates to!
281 294
 			$this->_findSubscription();
295
+		}
282 296
 
283 297
 		// Verify the currency!
284
-		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code']))
285
-			exit;
298
+		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) {
299
+					exit;
300
+		}
286 301
 
287 302
 		// Can't exist if it doesn't contain anything.
288
-		if (empty($_POST['item_number']))
289
-			exit;
303
+		if (empty($_POST['item_number'])) {
304
+					exit;
305
+		}
290 306
 
291 307
 		// Return the id_sub and id_member
292 308
 		return explode('+', $_POST['item_number']);
@@ -299,10 +315,11 @@  discard block
 block discarded – undo
299 315
 	 */
300 316
 	public function isRefund()
301 317
 	{
302
-		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed'))
303
-			return true;
304
-		else
305
-			return false;
318
+		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) {
319
+					return true;
320
+		} else {
321
+					return false;
322
+		}
306 323
 	}
307 324
 
308 325
 	/**
@@ -312,10 +329,11 @@  discard block
 block discarded – undo
312 329
 	 */
313 330
 	public function isSubscription()
314 331
 	{
315
-		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed')
316
-			return true;
317
-		else
318
-			return false;
332
+		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') {
333
+					return true;
334
+		} else {
335
+					return false;
336
+		}
319 337
 	}
320 338
 
321 339
 	/**
@@ -325,10 +343,11 @@  discard block
 block discarded – undo
325 343
 	 */
326 344
 	public function isPayment()
327 345
 	{
328
-		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept')
329
-			return true;
330
-		else
331
-			return false;
346
+		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') {
347
+					return true;
348
+		} else {
349
+					return false;
350
+		}
332 351
 	}
333 352
 
334 353
 	/**
@@ -341,10 +360,11 @@  discard block
 block discarded – undo
341 360
 		// subscr_cancel is sent when the user cancels, subscr_eot is sent when the subscription reaches final payment
342 361
 		// Neither require us to *do* anything as per performCancel().
343 362
 		// subscr_eot, if sent, indicates an end of payments term.
344
-		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot')
345
-			return true;
346
-		else
347
-			return false;
363
+		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') {
364
+					return true;
365
+		} else {
366
+					return false;
367
+		}
348 368
 	}
349 369
 
350 370
 	/**
@@ -409,8 +429,9 @@  discard block
 block discarded – undo
409 429
 		global $smcFunc;
410 430
 
411 431
 		// Assume we have this?
412
-		if (empty($_POST['subscr_id']))
413
-			return false;
432
+		if (empty($_POST['subscr_id'])) {
433
+					return false;
434
+		}
414 435
 
415 436
 		// Do we have this in the database?
416 437
 		$request = $smcFunc['db_query']('', '
@@ -439,11 +460,12 @@  discard block
 block discarded – undo
439 460
 						'payer_email' => $_POST['payer_email'],
440 461
 					)
441 462
 				);
442
-				if ($smcFunc['db_num_rows']($request) === 0)
443
-					return false;
463
+				if ($smcFunc['db_num_rows']($request) === 0) {
464
+									return false;
465
+				}
466
+			} else {
467
+							return false;
444 468
 			}
445
-			else
446
-				return false;
447 469
 		}
448 470
 		list ($member_id, $subscription_id) = $smcFunc['db_fetch_row']($request);
449 471
 		$_POST['item_number'] = $member_id . '+' . $subscription_id;
Please login to merge, or discard this patch.
Themes/default/Post.template.php 1 patch
Braces   +89 added lines, -61 removed lines patch added patch discarded remove patch
@@ -22,22 +22,24 @@  discard block
 block discarded – undo
22 22
 		<script>';
23 23
 
24 24
 	// When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
25
-	if (isBrowser('is_firefox'))
26
-		echo '
25
+	if (isBrowser('is_firefox')) {
26
+			echo '
27 27
 			window.addEventListener("pageshow", reActivate, false);';
28
+	}
28 29
 
29 30
 	// Start with message icons - and any missing from this theme.
30 31
 	echo '
31 32
 			var icon_urls = {';
32
-	foreach ($context['icons'] as $icon)
33
-		echo '
33
+	foreach ($context['icons'] as $icon) {
34
+			echo '
34 35
 				\'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
36
+	}
35 37
 	echo '
36 38
 			};';
37 39
 
38 40
 	// If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
39
-	if ($context['make_poll'])
40
-		echo '
41
+	if ($context['make_poll']) {
42
+			echo '
41 43
 			var pollOptionNum = 0, pollTabIndex;
42 44
 			var pollOptionId = ', $context['last_choice_id'], ';
43 45
 			function addPollOption()
@@ -56,11 +58,13 @@  discard block
 block discarded – undo
56 58
 
57 59
 				setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text"></dd><p id="pollMoreOptions"></p>'), ');
58 60
 			}';
61
+	}
59 62
 
60 63
 	// If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
61
-	if ($context['make_event'])
62
-		echo '
64
+	if ($context['make_event']) {
65
+			echo '
63 66
 			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
67
+	}
64 68
 
65 69
 	// End of the javascript, start the form and display the link tree.
66 70
 	echo '
@@ -80,9 +84,10 @@  discard block
 block discarded – undo
80 84
 				</div>
81 85
 			</div><br>';
82 86
 
83
-	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
84
-		echo '
87
+	if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) {
88
+			echo '
85 89
 			<input type="hidden" name="eventid" value="', $context['event']['id'], '">';
90
+	}
86 91
 
87 92
 	// Start the main table.
88 93
 	echo '
@@ -117,18 +122,20 @@  discard block
 block discarded – undo
117 122
 	}
118 123
 
119 124
 	// If it's locked, show a message to warn the replier.
120
-	if (!empty($context['locked']))
121
-	echo '
125
+	if (!empty($context['locked'])) {
126
+		echo '
122 127
 					<p class="errorbox">
123 128
 						', $txt['topic_locked_no_reply'], '
124 129
 					</p>';
130
+	}
125 131
 
126
-	if (!empty($modSettings['drafts_post_enabled']))
127
-		echo '
132
+	if (!empty($modSettings['drafts_post_enabled'])) {
133
+			echo '
128 134
 					<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
129 135
 						sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), '
130 136
 						', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), '
131 137
 					</div>';
138
+	}
132 139
 
133 140
 	// The post header... important stuff
134 141
 	echo '
@@ -180,9 +187,10 @@  discard block
 block discarded – undo
180 187
 				{
181 188
 					echo '
182 189
 										<optgroup label="', $category['name'], '">';
183
-					foreach ($category['boards'] as $board)
184
-						echo '
190
+					foreach ($category['boards'] as $board) {
191
+											echo '
185 192
 											<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
193
+					}
186 194
 					echo '
187 195
 										</optgroup>';
188 196
 				}
@@ -218,9 +226,10 @@  discard block
 block discarded – undo
218 226
 									<span class="label">', $txt['calendar_timezone'], '</span>
219 227
 									<select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>';
220 228
 
221
-			foreach ($context['all_timezones'] as $tz => $tzname)
222
-				echo '
229
+			foreach ($context['all_timezones'] as $tz => $tzname) {
230
+							echo '
223 231
 										<option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>';
232
+			}
224 233
 
225 234
 			echo '
226 235
 									</select>
@@ -286,14 +295,15 @@  discard block
 block discarded – undo
286 295
 									<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', ' class="input_check">
287 296
 								</dd>';
288 297
 
289
-		if ($context['poll_options']['guest_vote_enabled'])
290
-			echo '
298
+		if ($context['poll_options']['guest_vote_enabled']) {
299
+					echo '
291 300
 								<dt>
292 301
 									<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
293 302
 								</dt>
294 303
 								<dd>
295 304
 									<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', ' class="input_check">
296 305
 								</dd>';
306
+		}
297 307
 
298 308
 		echo '
299 309
 								<dt>
@@ -314,8 +324,8 @@  discard block
 block discarded – undo
314 324
 					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
315 325
 
316 326
 	// If we're editing and displaying edit details, show a box where they can say why
317
-	if (isset($context['editing']) && $modSettings['show_modify'])
318
-		echo '
327
+	if (isset($context['editing']) && $modSettings['show_modify']) {
328
+			echo '
319 329
 					<dl>
320 330
 						<dt class="clear">
321 331
 							<span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span>
@@ -324,20 +334,23 @@  discard block
 block discarded – undo
324 334
 							<input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text">
325 335
 						</dd>
326 336
 					</dl>';
337
+	}
327 338
 
328 339
 	// If this message has been edited in the past - display when it was.
329
-	if (isset($context['last_modified']))
330
-		echo '
340
+	if (isset($context['last_modified'])) {
341
+			echo '
331 342
 					<div class="padding smalltext">
332 343
 						', $context['last_modified_text'], '
333 344
 					</div>';
345
+	}
334 346
 
335 347
 	// If the admin has enabled the hiding of the additional options - show a link and image for it.
336
-	if (!empty($modSettings['additional_options_collapsable']))
337
-		echo '
348
+	if (!empty($modSettings['additional_options_collapsable'])) {
349
+			echo '
338 350
 					<div id="postAdditionalOptionsHeader">
339 351
 						<strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
340 352
 					</div>';
353
+	}
341 354
 
342 355
 	echo '
343 356
 					<div id="postAdditionalOptions">';
@@ -369,19 +382,21 @@  discard block
 block discarded – undo
369 382
 								<input type="hidden" name="attach_del[]" value="0">
370 383
 								', $txt['uncheck_unwatchd_attach'], ':
371 384
 							</dd>';
372
-		foreach ($context['current_attachments'] as $attachment)
373
-			echo '
385
+		foreach ($context['current_attachments'] as $attachment) {
386
+					echo '
374 387
 							<dd class="smalltext">
375 388
 								<label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', ' class="input_check"> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''),
376 389
 								!empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label>
377 390
 							</dd>';
391
+		}
378 392
 
379 393
 		echo '
380 394
 						</dl>';
381 395
 
382
-		if (!empty($context['files_in_session_warning']))
383
-			echo '
396
+		if (!empty($context['files_in_session_warning'])) {
397
+					echo '
384 398
 						<div class="smalltext">', $context['files_in_session_warning'], '</div>';
399
+		}
385 400
 	}
386 401
 
387 402
 	// Is the user allowed to post any additional ones? If so give them the boxes to do it!
@@ -434,8 +449,8 @@  discard block
 block discarded – undo
434 449
 								', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '">');
435 450
 
436 451
 		// Show more boxes if they aren't approaching that limit.
437
-		if ($context['num_allowed_attachments'] > 1)
438
-			echo '
452
+		if ($context['num_allowed_attachments'] > 1) {
453
+					echo '
439 454
 										<script>
440 455
 											var allowed_attachments = ', $context['num_allowed_attachments'], ';
441 456
 											var current_attachment = 1;
@@ -456,9 +471,10 @@  discard block
 block discarded – undo
456 471
 									</div>
457 472
 								</div>
458 473
 							</dd>';
459
-		else
460
-			echo '
474
+		} else {
475
+					echo '
461 476
 							</dd>';
477
+		}
462 478
 
463 479
 		// Add any template changes for an alternative upload system here.
464 480
 		call_integration_hook('integrate_upload_template');
@@ -467,21 +483,25 @@  discard block
 block discarded – undo
467 483
 							<dd class="smalltext">';
468 484
 
469 485
 		// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
470
-		if (!empty($modSettings['attachmentCheckExtensions']))
471
-			echo '
486
+		if (!empty($modSettings['attachmentCheckExtensions'])) {
487
+					echo '
472 488
 								', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>';
489
+		}
473 490
 
474
-		if (!empty($context['attachment_restrictions']))
475
-			echo '
491
+		if (!empty($context['attachment_restrictions'])) {
492
+					echo '
476 493
 								', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>';
494
+		}
477 495
 
478
-		if ($context['num_allowed_attachments'] == 0)
479
-			echo '
496
+		if ($context['num_allowed_attachments'] == 0) {
497
+					echo '
480 498
 								', $txt['attach_limit_nag'], '<br>';
499
+		}
481 500
 
482
-		if (!$context['can_post_attachment_unapproved'])
483
-			echo '
501
+		if (!$context['can_post_attachment_unapproved']) {
502
+					echo '
484 503
 								<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>';
504
+		}
485 505
 
486 506
 		echo '
487 507
 							</dd>
@@ -504,10 +524,11 @@  discard block
 block discarded – undo
504 524
 							<dt><strong>', $txt['subject'], '</strong></dt>
505 525
 							<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
506 526
 
507
-		foreach ($context['drafts'] as $draft)
508
-			echo '
527
+		foreach ($context['drafts'] as $draft) {
528
+					echo '
509 529
 							<dt>', $draft['link'], '</dt>
510 530
 							<dd>', $draft['poster_time'], '</dd>';
531
+		}
511 532
 		echo '
512 533
 						</dl>
513 534
 					</div>';
@@ -532,9 +553,10 @@  discard block
 block discarded – undo
532 553
 						', template_control_richedit_buttons($context['post_box_name']);
533 554
 
534 555
 	// Option to delete an event if user is editing one.
535
-	if ($context['make_event'] && !$context['event']['new'])
536
-		echo '
556
+	if ($context['make_event'] && !$context['event']['new']) {
557
+			echo '
537 558
 						<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'] ,'" class="button_submit you_sure">';
559
+	}
538 560
 
539 561
 	echo '
540 562
 					</span>
@@ -543,9 +565,10 @@  discard block
 block discarded – undo
543 565
 			<br class="clear">';
544 566
 
545 567
 	// Assuming this isn't a new topic pass across the last message id.
546
-	if (isset($context['topic_last_message']))
547
-		echo '
568
+	if (isset($context['topic_last_message'])) {
569
+			echo '
548 570
 			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">';
571
+	}
549 572
 
550 573
 	echo '
551 574
 			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '">
@@ -687,9 +710,10 @@  discard block
 block discarded – undo
687 710
 
688 711
 						newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \'"><div id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';';
689 712
 
690
-	if ($context['can_quote'])
691
-		echo '
713
+	if ($context['can_quote']) {
714
+			echo '
692 715
 						newPostsHTML += \'<ul class="quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>', $txt['quote'], '</span><\' + \'/a></li></ul>\';';
716
+	}
693 717
 
694 718
 	echo '
695 719
 						newPostsHTML += \'<br class="clear">\';
@@ -732,8 +756,8 @@  discard block
 block discarded – undo
732 756
 			}';
733 757
 
734 758
 	// Code for showing and hiding additional options.
735
-	if (!empty($modSettings['additional_options_collapsable']))
736
-		echo '
759
+	if (!empty($modSettings['additional_options_collapsable'])) {
760
+			echo '
737 761
 			var oSwapAdditionalOptions = new smc_Toggle({
738 762
 				bToggleEnabled: true,
739 763
 				bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
@@ -761,10 +785,11 @@  discard block
 block discarded – undo
761 785
 					}
762 786
 				]
763 787
 			});';
788
+	}
764 789
 
765 790
 	// Code for showing and hiding drafts
766
-	if (!empty($context['drafts']))
767
-		echo '
791
+	if (!empty($context['drafts'])) {
792
+			echo '
768 793
 			var oSwapDraftOptions = new smc_Toggle({
769 794
 				bToggleEnabled: true,
770 795
 				bCurrentlyCollapsed: true,
@@ -786,6 +811,7 @@  discard block
 block discarded – undo
786 811
 					}
787 812
 				]
788 813
 			});';
814
+	}
789 815
 
790 816
 	echo '
791 817
 			var oEditorID = "', $context['post_box_name'] ,'";
@@ -806,8 +832,9 @@  discard block
 block discarded – undo
806 832
 		foreach ($context['previous_posts'] as $post)
807 833
 		{
808 834
 			$ignoring = false;
809
-			if (!empty($post['is_ignored']))
810
-				$ignored_posts[] = $ignoring = $post['id'];
835
+			if (!empty($post['is_ignored'])) {
836
+							$ignored_posts[] = $ignoring = $post['id'];
837
+			}
811 838
 
812 839
 			echo '
813 840
 			<div class="windowbg">
@@ -990,10 +1017,10 @@  discard block
 block discarded – undo
990 1017
 		<div id="temporary_posting_area" style="display: none;"></div>
991 1018
 		<script>';
992 1019
 
993
-	if ($context['close_window'])
994
-		echo '
1020
+	if ($context['close_window']) {
1021
+			echo '
995 1022
 			window.close();';
996
-	else
1023
+	} else
997 1024
 	{
998 1025
 		// Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
999 1026
 		echo '
@@ -1047,11 +1074,12 @@  discard block
 block discarded – undo
1047 1074
 				</p>
1048 1075
 				<ul>';
1049 1076
 
1050
-	foreach ($context['groups'] as $group)
1051
-		echo '
1077
+	foreach ($context['groups'] as $group) {
1078
+			echo '
1052 1079
 					<li>
1053 1080
 						<label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
1054 1081
 					</li>';
1082
+	}
1055 1083
 
1056 1084
 	echo '
1057 1085
 					<li>
Please login to merge, or discard this patch.
SSI.php 1 patch
Braces   +426 added lines, -304 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Don't do anything if SMF is already loaded.
15
-if (defined('SMF'))
15
+if (defined('SMF')) {
16 16
 	return true;
17
+}
17 18
 
18 19
 define('SMF', 'SSI');
19 20
 
@@ -28,16 +29,18 @@  discard block
 block discarded – undo
28 29
 $time_start = microtime();
29 30
 
30 31
 // Just being safe...
31
-foreach (array('db_character_set', 'cachedir') as $variable)
32
+foreach (array('db_character_set', 'cachedir') as $variable) {
32 33
 	if (isset($GLOBALS[$variable]))
33 34
 		unset($GLOBALS[$variable]);
35
+}
34 36
 
35 37
 // Get the forum's settings for database and file paths.
36 38
 require_once(dirname(__FILE__) . '/Settings.php');
37 39
 
38 40
 // Make absolutely sure the cache directory is defined.
39
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
41
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
40 42
 	$cachedir = $boarddir . '/cache';
43
+}
41 44
 
42 45
 $ssi_error_reporting = error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
43 46
 /* Set this to one of three values depending on what you want to happen in the case of a fatal error.
@@ -48,12 +51,14 @@  discard block
 block discarded – undo
48 51
 $ssi_on_error_method = false;
49 52
 
50 53
 // Don't do john didley if the forum's been shut down completely.
51
-if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true))
54
+if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) {
52 55
 	die($mmessage);
56
+}
53 57
 
54 58
 // Fix for using the current directory as a path.
55
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
59
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
56 60
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
61
+}
57 62
 
58 63
 // Load the important includes.
59 64
 require_once($sourcedir . '/QueryString.php');
@@ -78,34 +83,38 @@  discard block
 block discarded – undo
78 83
 cleanRequest();
79 84
 
80 85
 // Seed the random generator?
81
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
86
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
82 87
 	smf_seed_generator();
88
+}
83 89
 
84 90
 // Check on any hacking attempts.
85
-if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
91
+if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
86 92
 	die('No direct access...');
87
-elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme)
93
+} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) {
88 94
 	die('No direct access...');
89
-elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme)
95
+} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) {
90 96
 	die('No direct access...');
91
-elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers)
97
+} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) {
92 98
 	die('No direct access...');
93
-if (isset($_REQUEST['context']))
99
+}
100
+if (isset($_REQUEST['context'])) {
94 101
 	die('No direct access...');
102
+}
95 103
 
96 104
 // Gzip output? (because it must be boolean and true, this can't be hacked.)
97
-if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>='))
105
+if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) {
98 106
 	ob_start('ob_gzhandler');
99
-else
107
+} else {
100 108
 	$modSettings['enableCompressedOutput'] = '0';
109
+}
101 110
 
102 111
 // Primarily, this is to fix the URLs...
103 112
 ob_start('ob_sessrewrite');
104 113
 
105 114
 // Start the session... known to scramble SSI includes in cases...
106
-if (!headers_sent())
115
+if (!headers_sent()) {
107 116
 	loadSession();
108
-else
117
+} else
109 118
 {
110 119
 	if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()]))
111 120
 	{
@@ -139,12 +148,14 @@  discard block
 block discarded – undo
139 148
 loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
140 149
 
141 150
 // @todo: probably not the best place, but somewhere it should be set...
142
-if (!headers_sent())
151
+if (!headers_sent()) {
143 152
 	header('Content-Type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set']));
153
+}
144 154
 
145 155
 // Take care of any banning that needs to be done.
146
-if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true))
156
+if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) {
147 157
 	is_not_banned();
158
+}
148 159
 
149 160
 // Do we allow guests in here?
150 161
 if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php')
@@ -159,17 +170,19 @@  discard block
 block discarded – undo
159 170
 {
160 171
 	$context['template_layers'] = $ssi_layers;
161 172
 	template_header();
162
-}
163
-else
173
+} else {
164 174
 	setupThemeContext();
175
+}
165 176
 
166 177
 // Make sure they didn't muss around with the settings... but only if it's not cli.
167
-if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '')
178
+if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') {
168 179
 	trigger_error($txt['ssi_session_broken'], E_USER_NOTICE);
180
+}
169 181
 
170 182
 // Without visiting the forum this session variable might not be set on submit.
171
-if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote'))
183
+if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) {
172 184
 	$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
185
+}
173 186
 
174 187
 // Have the ability to easily add functions to SSI.
175 188
 call_integration_hook('integrate_SSI');
@@ -178,11 +191,13 @@  discard block
 block discarded – undo
178 191
 if (basename($_SERVER['PHP_SELF']) == 'SSI.php')
179 192
 {
180 193
 	// You shouldn't just access SSI.php directly by URL!!
181
-	if (!isset($_GET['ssi_function']))
182
-		die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
194
+	if (!isset($_GET['ssi_function'])) {
195
+			die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
196
+	}
183 197
 	// Call a function passed by GET.
184
-	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest']))
185
-		call_user_func('ssi_' . $_GET['ssi_function']);
198
+	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) {
199
+			call_user_func('ssi_' . $_GET['ssi_function']);
200
+	}
186 201
 	exit;
187 202
 }
188 203
 
@@ -199,9 +214,10 @@  discard block
 block discarded – undo
199 214
  */
200 215
 function ssi_shutdown()
201 216
 {
202
-	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown')
203
-		template_footer();
204
-}
217
+	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') {
218
+			template_footer();
219
+	}
220
+	}
205 221
 
206 222
 /**
207 223
  * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
@@ -214,15 +230,17 @@  discard block
 block discarded – undo
214 230
 
215 231
 	if ($output_method == 'echo')
216 232
 	{
217
-		if ($context['user']['is_guest'])
218
-			echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
219
-		else
220
-			echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
233
+		if ($context['user']['is_guest']) {
234
+					echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
235
+		} else {
236
+					echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
237
+		}
221 238
 	}
222 239
 	// Don't echo... then do what?!
223
-	else
224
-		return $context['user'];
225
-}
240
+	else {
241
+			return $context['user'];
242
+	}
243
+	}
226 244
 
227 245
 /**
228 246
  * Display a menu bar, like is displayed at the top of the forum.
@@ -233,12 +251,14 @@  discard block
 block discarded – undo
233 251
 {
234 252
 	global $context;
235 253
 
236
-	if ($output_method == 'echo')
237
-		template_menu();
254
+	if ($output_method == 'echo') {
255
+			template_menu();
256
+	}
238 257
 	// What else could this do?
239
-	else
240
-		return $context['menu_buttons'];
241
-}
258
+	else {
259
+			return $context['menu_buttons'];
260
+	}
261
+	}
242 262
 
243 263
 /**
244 264
  * Show a logout link.
@@ -250,20 +270,23 @@  discard block
 block discarded – undo
250 270
 {
251 271
 	global $context, $txt, $scripturl;
252 272
 
253
-	if ($redirect_to != '')
254
-		$_SESSION['logout_url'] = $redirect_to;
273
+	if ($redirect_to != '') {
274
+			$_SESSION['logout_url'] = $redirect_to;
275
+	}
255 276
 
256 277
 	// Guests can't log out.
257
-	if ($context['user']['is_guest'])
258
-		return false;
278
+	if ($context['user']['is_guest']) {
279
+			return false;
280
+	}
259 281
 
260 282
 	$link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>';
261 283
 
262
-	if ($output_method == 'echo')
263
-		echo $link;
264
-	else
265
-		return $link;
266
-}
284
+	if ($output_method == 'echo') {
285
+			echo $link;
286
+	} else {
287
+			return $link;
288
+	}
289
+	}
267 290
 
268 291
 /**
269 292
  * Recent post list:   [board] Subject by Poster    Date
@@ -279,17 +302,17 @@  discard block
 block discarded – undo
279 302
 	global $modSettings, $context;
280 303
 
281 304
 	// Excluding certain boards...
282
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
283
-		$exclude_boards = array($modSettings['recycle_board']);
284
-	else
285
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
305
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
306
+			$exclude_boards = array($modSettings['recycle_board']);
307
+	} else {
308
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
309
+	}
286 310
 
287 311
 	// What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter.
288 312
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
289 313
 	{
290 314
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
291
-	}
292
-	elseif ($include_boards != null)
315
+	} elseif ($include_boards != null)
293 316
 	{
294 317
 		$include_boards = array();
295 318
 	}
@@ -326,8 +349,9 @@  discard block
 block discarded – undo
326 349
 {
327 350
 	global $modSettings;
328 351
 
329
-	if (empty($post_ids))
330
-		return;
352
+	if (empty($post_ids)) {
353
+			return;
354
+	}
331 355
 
332 356
 	// Allow the user to request more than one - why not?
333 357
 	$post_ids = is_array($post_ids) ? $post_ids : array($post_ids);
@@ -362,8 +386,9 @@  discard block
 block discarded – undo
362 386
 	global $scripturl, $txt, $user_info;
363 387
 	global $modSettings, $smcFunc, $context;
364 388
 
365
-	if (!empty($modSettings['enable_likes']))
366
-		$context['can_like'] = allowedTo('likes_like');
389
+	if (!empty($modSettings['enable_likes'])) {
390
+			$context['can_like'] = allowedTo('likes_like');
391
+	}
367 392
 
368 393
 	// Find all the posts. Newer ones will have higher IDs.
369 394
 	$request = $smcFunc['db_query']('substring', '
@@ -429,12 +454,13 @@  discard block
 block discarded – undo
429 454
 		);
430 455
 
431 456
 		// Get the likes for each message.
432
-		if (!empty($modSettings['enable_likes']))
433
-			$posts[$row['id_msg']]['likes'] = array(
457
+		if (!empty($modSettings['enable_likes'])) {
458
+					$posts[$row['id_msg']]['likes'] = array(
434 459
 				'count' => $row['likes'],
435 460
 				'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])),
436 461
 				'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']),
437 462
 			);
463
+		}
438 464
 	}
439 465
 	$smcFunc['db_free_result']($request);
440 466
 
@@ -442,13 +468,14 @@  discard block
 block discarded – undo
442 468
 	call_integration_hook('integrate_ssi_queryPosts', array(&$posts));
443 469
 
444 470
 	// Just return it.
445
-	if ($output_method != 'echo' || empty($posts))
446
-		return $posts;
471
+	if ($output_method != 'echo' || empty($posts)) {
472
+			return $posts;
473
+	}
447 474
 
448 475
 	echo '
449 476
 		<table style="border: none" class="ssi_table">';
450
-	foreach ($posts as $post)
451
-		echo '
477
+	foreach ($posts as $post) {
478
+			echo '
452 479
 			<tr>
453 480
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
454 481
 					[', $post['board']['link'], ']
@@ -462,6 +489,7 @@  discard block
 block discarded – undo
462 489
 					', $post['time'], '
463 490
 				</td>
464 491
 			</tr>';
492
+	}
465 493
 	echo '
466 494
 		</table>';
467 495
 }
@@ -479,25 +507,26 @@  discard block
 block discarded – undo
479 507
 	global $settings, $scripturl, $txt, $user_info;
480 508
 	global $modSettings, $smcFunc, $context;
481 509
 
482
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
483
-		$exclude_boards = array($modSettings['recycle_board']);
484
-	else
485
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
510
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
511
+			$exclude_boards = array($modSettings['recycle_board']);
512
+	} else {
513
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
514
+	}
486 515
 
487 516
 	// Only some boards?.
488 517
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
489 518
 	{
490 519
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
491
-	}
492
-	elseif ($include_boards != null)
520
+	} elseif ($include_boards != null)
493 521
 	{
494 522
 		$output_method = $include_boards;
495 523
 		$include_boards = array();
496 524
 	}
497 525
 
498 526
 	$icon_sources = array();
499
-	foreach ($context['stable_icons'] as $icon)
500
-		$icon_sources[$icon] = 'images_url';
527
+	foreach ($context['stable_icons'] as $icon) {
528
+			$icon_sources[$icon] = 'images_url';
529
+	}
501 530
 
502 531
 	// Find all the posts in distinct topics.  Newer ones will have higher IDs.
503 532
 	$request = $smcFunc['db_query']('substring', '
@@ -522,13 +551,15 @@  discard block
 block discarded – undo
522 551
 		)
523 552
 	);
524 553
 	$topics = array();
525
-	while ($row = $smcFunc['db_fetch_assoc']($request))
526
-		$topics[$row['id_topic']] = $row;
554
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
555
+			$topics[$row['id_topic']] = $row;
556
+	}
527 557
 	$smcFunc['db_free_result']($request);
528 558
 
529 559
 	// Did we find anything? If not, bail.
530
-	if (empty($topics))
531
-		return array();
560
+	if (empty($topics)) {
561
+			return array();
562
+	}
532 563
 
533 564
 	$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
534 565
 
@@ -556,19 +587,22 @@  discard block
 block discarded – undo
556 587
 	while ($row = $smcFunc['db_fetch_assoc']($request))
557 588
 	{
558 589
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
559
-		if ($smcFunc['strlen']($row['body']) > 128)
560
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
590
+		if ($smcFunc['strlen']($row['body']) > 128) {
591
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
592
+		}
561 593
 
562 594
 		// Censor the subject.
563 595
 		censorText($row['subject']);
564 596
 		censorText($row['body']);
565 597
 
566 598
 		// Recycled icon
567
-		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board'])
568
-			$row['icon'] = 'recycled';
599
+		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) {
600
+					$row['icon'] = 'recycled';
601
+		}
569 602
 
570
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
571
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
603
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
604
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
605
+		}
572 606
 
573 607
 		// Build the array.
574 608
 		$posts[] = array(
@@ -607,13 +641,14 @@  discard block
 block discarded – undo
607 641
 	call_integration_hook('integrate_ssi_recentTopics', array(&$posts));
608 642
 
609 643
 	// Just return it.
610
-	if ($output_method != 'echo' || empty($posts))
611
-		return $posts;
644
+	if ($output_method != 'echo' || empty($posts)) {
645
+			return $posts;
646
+	}
612 647
 
613 648
 	echo '
614 649
 		<table style="border: none" class="ssi_table">';
615
-	foreach ($posts as $post)
616
-		echo '
650
+	foreach ($posts as $post) {
651
+			echo '
617 652
 			<tr>
618 653
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
619 654
 					[', $post['board']['link'], ']
@@ -627,6 +662,7 @@  discard block
 block discarded – undo
627 662
 					', $post['time'], '
628 663
 				</td>
629 664
 			</tr>';
665
+	}
630 666
 	echo '
631 667
 		</table>';
632 668
 }
@@ -651,27 +687,30 @@  discard block
 block discarded – undo
651 687
 		)
652 688
 	);
653 689
 	$return = array();
654
-	while ($row = $smcFunc['db_fetch_assoc']($request))
655
-		$return[] = array(
690
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
691
+			$return[] = array(
656 692
 			'id' => $row['id_member'],
657 693
 			'name' => $row['real_name'],
658 694
 			'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
659 695
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
660 696
 			'posts' => $row['posts']
661 697
 		);
698
+	}
662 699
 	$smcFunc['db_free_result']($request);
663 700
 
664 701
 	// If mods want to do somthing with this list of members, let them do that now.
665 702
 	call_integration_hook('integrate_ssi_topPoster', array(&$return));
666 703
 
667 704
 	// Just return all the top posters.
668
-	if ($output_method != 'echo')
669
-		return $return;
705
+	if ($output_method != 'echo') {
706
+			return $return;
707
+	}
670 708
 
671 709
 	// Make a quick array to list the links in.
672 710
 	$temp_array = array();
673
-	foreach ($return as $member)
674
-		$temp_array[] = $member['link'];
711
+	foreach ($return as $member) {
712
+			$temp_array[] = $member['link'];
713
+	}
675 714
 
676 715
 	echo implode(', ', $temp_array);
677 716
 }
@@ -703,8 +742,8 @@  discard block
 block discarded – undo
703 742
 		)
704 743
 	);
705 744
 	$boards = array();
706
-	while ($row = $smcFunc['db_fetch_assoc']($request))
707
-		$boards[] = array(
745
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
746
+			$boards[] = array(
708 747
 			'id' => $row['id_board'],
709 748
 			'num_posts' => $row['num_posts'],
710 749
 			'num_topics' => $row['num_topics'],
@@ -713,14 +752,16 @@  discard block
 block discarded – undo
713 752
 			'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
714 753
 			'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
715 754
 		);
755
+	}
716 756
 	$smcFunc['db_free_result']($request);
717 757
 
718 758
 	// If mods want to do somthing with this list of boards, let them do that now.
719 759
 	call_integration_hook('integrate_ssi_topBoards', array(&$boards));
720 760
 
721 761
 	// If we shouldn't output or have nothing to output, just jump out.
722
-	if ($output_method != 'echo' || empty($boards))
723
-		return $boards;
762
+	if ($output_method != 'echo' || empty($boards)) {
763
+			return $boards;
764
+	}
724 765
 
725 766
 	echo '
726 767
 		<table class="ssi_table">
@@ -729,13 +770,14 @@  discard block
 block discarded – undo
729 770
 				<th style="text-align: left">', $txt['board_topics'], '</th>
730 771
 				<th style="text-align: left">', $txt['posts'], '</th>
731 772
 			</tr>';
732
-	foreach ($boards as $sBoard)
733
-		echo '
773
+	foreach ($boards as $sBoard) {
774
+			echo '
734 775
 			<tr>
735 776
 				<td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td>
736 777
 				<td style="text-align: right">', comma_format($sBoard['num_topics']), '</td>
737 778
 				<td style="text-align: right">', comma_format($sBoard['num_posts']), '</td>
738 779
 			</tr>';
780
+	}
739 781
 	echo '
740 782
 		</table>';
741 783
 }
@@ -768,12 +810,13 @@  discard block
 block discarded – undo
768 810
 			)
769 811
 		);
770 812
 		$topic_ids = array();
771
-		while ($row = $smcFunc['db_fetch_assoc']($request))
772
-			$topic_ids[] = $row['id_topic'];
813
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
814
+					$topic_ids[] = $row['id_topic'];
815
+		}
773 816
 		$smcFunc['db_free_result']($request);
817
+	} else {
818
+			$topic_ids = array();
774 819
 	}
775
-	else
776
-		$topic_ids = array();
777 820
 
778 821
 	$request = $smcFunc['db_query']('', '
779 822
 		SELECT m.subject, m.id_topic, t.num_views, t.num_replies
@@ -812,8 +855,9 @@  discard block
 block discarded – undo
812 855
 	// If mods want to do somthing with this list of topics, let them do that now.
813 856
 	call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type));
814 857
 
815
-	if ($output_method != 'echo' || empty($topics))
816
-		return $topics;
858
+	if ($output_method != 'echo' || empty($topics)) {
859
+			return $topics;
860
+	}
817 861
 
818 862
 	echo '
819 863
 		<table class="ssi_table">
@@ -822,8 +866,8 @@  discard block
 block discarded – undo
822 866
 				<th style="text-align: left">', $txt['views'], '</th>
823 867
 				<th style="text-align: left">', $txt['replies'], '</th>
824 868
 			</tr>';
825
-	foreach ($topics as $sTopic)
826
-		echo '
869
+	foreach ($topics as $sTopic) {
870
+			echo '
827 871
 			<tr>
828 872
 				<td style="text-align: left">
829 873
 					', $sTopic['link'], '
@@ -831,6 +875,7 @@  discard block
 block discarded – undo
831 875
 				<td style="text-align: right">', comma_format($sTopic['num_views']), '</td>
832 876
 				<td style="text-align: right">', comma_format($sTopic['num_replies']), '</td>
833 877
 			</tr>';
878
+	}
834 879
 	echo '
835 880
 		</table>';
836 881
 }
@@ -866,12 +911,13 @@  discard block
 block discarded – undo
866 911
 {
867 912
 	global $txt, $context;
868 913
 
869
-	if ($output_method == 'echo')
870
-		echo '
914
+	if ($output_method == 'echo') {
915
+			echo '
871 916
 	', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>';
872
-	else
873
-		return $context['common_stats']['latest_member'];
874
-}
917
+	} else {
918
+			return $context['common_stats']['latest_member'];
919
+	}
920
+	}
875 921
 
876 922
 /**
877 923
  * Fetches a random member.
@@ -920,8 +966,9 @@  discard block
 block discarded – undo
920 966
 	}
921 967
 
922 968
 	// Just to be sure put the random generator back to something... random.
923
-	if ($random_type != '')
924
-		mt_srand(time());
969
+	if ($random_type != '') {
970
+			mt_srand(time());
971
+	}
925 972
 
926 973
 	return $result;
927 974
 }
@@ -934,8 +981,9 @@  discard block
 block discarded – undo
934 981
  */
935 982
 function ssi_fetchMember($member_ids = array(), $output_method = 'echo')
936 983
 {
937
-	if (empty($member_ids))
938
-		return;
984
+	if (empty($member_ids)) {
985
+			return;
986
+	}
939 987
 
940 988
 	// Can have more than one member if you really want...
941 989
 	$member_ids = is_array($member_ids) ? $member_ids : array($member_ids);
@@ -960,8 +1008,9 @@  discard block
 block discarded – undo
960 1008
  */
961 1009
 function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo')
962 1010
 {
963
-	if ($group_id === null)
964
-		return;
1011
+	if ($group_id === null) {
1012
+			return;
1013
+	}
965 1014
 
966 1015
 	$query_where = '
967 1016
 		id_group = {int:id_group}
@@ -988,8 +1037,9 @@  discard block
 block discarded – undo
988 1037
 {
989 1038
 	global $smcFunc, $memberContext;
990 1039
 
991
-	if ($query_where === null)
992
-		return;
1040
+	if ($query_where === null) {
1041
+			return;
1042
+	}
993 1043
 
994 1044
 	// Fetch the members in question.
995 1045
 	$request = $smcFunc['db_query']('', '
@@ -1002,12 +1052,14 @@  discard block
 block discarded – undo
1002 1052
 		))
1003 1053
 	);
1004 1054
 	$members = array();
1005
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1006
-		$members[] = $row['id_member'];
1055
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1056
+			$members[] = $row['id_member'];
1057
+	}
1007 1058
 	$smcFunc['db_free_result']($request);
1008 1059
 
1009
-	if (empty($members))
1010
-		return array();
1060
+	if (empty($members)) {
1061
+			return array();
1062
+	}
1011 1063
 
1012 1064
 	// If mods want to do somthing with this list of members, let them do that now.
1013 1065
 	call_integration_hook('integrate_ssi_queryMembers', array(&$members));
@@ -1016,23 +1068,25 @@  discard block
 block discarded – undo
1016 1068
 	loadMemberData($members);
1017 1069
 
1018 1070
 	// Draw the table!
1019
-	if ($output_method == 'echo')
1020
-		echo '
1071
+	if ($output_method == 'echo') {
1072
+			echo '
1021 1073
 		<table style="border: none" class="ssi_table">';
1074
+	}
1022 1075
 
1023 1076
 	$query_members = array();
1024 1077
 	foreach ($members as $member)
1025 1078
 	{
1026 1079
 		// Load their context data.
1027
-		if (!loadMemberContext($member))
1028
-			continue;
1080
+		if (!loadMemberContext($member)) {
1081
+					continue;
1082
+		}
1029 1083
 
1030 1084
 		// Store this member's information.
1031 1085
 		$query_members[$member] = $memberContext[$member];
1032 1086
 
1033 1087
 		// Only do something if we're echo'ing.
1034
-		if ($output_method == 'echo')
1035
-			echo '
1088
+		if ($output_method == 'echo') {
1089
+					echo '
1036 1090
 			<tr>
1037 1091
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
1038 1092
 					', $query_members[$member]['link'], '
@@ -1040,12 +1094,14 @@  discard block
 block discarded – undo
1040 1094
 					<br>', $query_members[$member]['avatar']['image'], '
1041 1095
 				</td>
1042 1096
 			</tr>';
1097
+		}
1043 1098
 	}
1044 1099
 
1045 1100
 	// End the table if appropriate.
1046
-	if ($output_method == 'echo')
1047
-		echo '
1101
+	if ($output_method == 'echo') {
1102
+			echo '
1048 1103
 		</table>';
1104
+	}
1049 1105
 
1050 1106
 	// Send back the data.
1051 1107
 	return $query_members;
@@ -1060,8 +1116,9 @@  discard block
 block discarded – undo
1060 1116
 {
1061 1117
 	global $txt, $scripturl, $modSettings, $smcFunc;
1062 1118
 
1063
-	if (!allowedTo('view_stats'))
1064
-		return;
1119
+	if (!allowedTo('view_stats')) {
1120
+			return;
1121
+	}
1065 1122
 
1066 1123
 	$totals = array(
1067 1124
 		'members' => $modSettings['totalMembers'],
@@ -1090,8 +1147,9 @@  discard block
 block discarded – undo
1090 1147
 	// If mods want to do somthing with the board stats, let them do that now.
1091 1148
 	call_integration_hook('integrate_ssi_boardStats', array(&$totals));
1092 1149
 
1093
-	if ($output_method != 'echo')
1094
-		return $totals;
1150
+	if ($output_method != 'echo') {
1151
+			return $totals;
1152
+	}
1095 1153
 
1096 1154
 	echo '
1097 1155
 		', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br>
@@ -1120,8 +1178,8 @@  discard block
 block discarded – undo
1120 1178
 	call_integration_hook('integrate_ssi_whosOnline', array(&$return));
1121 1179
 
1122 1180
 	// Add some redundancy for backwards compatibility reasons.
1123
-	if ($output_method != 'echo')
1124
-		return $return + array(
1181
+	if ($output_method != 'echo') {
1182
+			return $return + array(
1125 1183
 			'users' => $return['users_online'],
1126 1184
 			'guests' => $return['num_guests'],
1127 1185
 			'hidden' => $return['num_users_hidden'],
@@ -1129,29 +1187,35 @@  discard block
 block discarded – undo
1129 1187
 			'num_users' => $return['num_users_online'],
1130 1188
 			'total_users' => $return['num_users_online'] + $return['num_guests'],
1131 1189
 		);
1190
+	}
1132 1191
 
1133 1192
 	echo '
1134 1193
 		', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
1135 1194
 
1136 1195
 	$bracketList = array();
1137
-	if (!empty($user_info['buddies']))
1138
-		$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1139
-	if (!empty($return['num_spiders']))
1140
-		$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1141
-	if (!empty($return['num_users_hidden']))
1142
-		$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1196
+	if (!empty($user_info['buddies'])) {
1197
+			$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1198
+	}
1199
+	if (!empty($return['num_spiders'])) {
1200
+			$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1201
+	}
1202
+	if (!empty($return['num_users_hidden'])) {
1203
+			$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1204
+	}
1143 1205
 
1144
-	if (!empty($bracketList))
1145
-		echo ' (' . implode(', ', $bracketList) . ')';
1206
+	if (!empty($bracketList)) {
1207
+			echo ' (' . implode(', ', $bracketList) . ')';
1208
+	}
1146 1209
 
1147 1210
 	echo '<br>
1148 1211
 			', implode(', ', $return['list_users_online']);
1149 1212
 
1150 1213
 	// Showing membergroups?
1151
-	if (!empty($settings['show_group_key']) && !empty($return['membergroups']))
1152
-		echo '<br>
1214
+	if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) {
1215
+			echo '<br>
1153 1216
 			[' . implode(']&nbsp;&nbsp;[', $return['membergroups']) . ']';
1154
-}
1217
+	}
1218
+	}
1155 1219
 
1156 1220
 /**
1157 1221
  * Just like whosOnline except it also logs the online presence.
@@ -1162,11 +1226,12 @@  discard block
 block discarded – undo
1162 1226
 {
1163 1227
 	writeLog();
1164 1228
 
1165
-	if ($output_method != 'echo')
1166
-		return ssi_whosOnline($output_method);
1167
-	else
1168
-		ssi_whosOnline($output_method);
1169
-}
1229
+	if ($output_method != 'echo') {
1230
+			return ssi_whosOnline($output_method);
1231
+	} else {
1232
+			ssi_whosOnline($output_method);
1233
+	}
1234
+	}
1170 1235
 
1171 1236
 // Shows a login box.
1172 1237
 /**
@@ -1179,11 +1244,13 @@  discard block
 block discarded – undo
1179 1244
 {
1180 1245
 	global $scripturl, $txt, $user_info, $context;
1181 1246
 
1182
-	if ($redirect_to != '')
1183
-		$_SESSION['login_url'] = $redirect_to;
1247
+	if ($redirect_to != '') {
1248
+			$_SESSION['login_url'] = $redirect_to;
1249
+	}
1184 1250
 
1185
-	if ($output_method != 'echo' || !$user_info['is_guest'])
1186
-		return $user_info['is_guest'];
1251
+	if ($output_method != 'echo' || !$user_info['is_guest']) {
1252
+			return $user_info['is_guest'];
1253
+	}
1187 1254
 
1188 1255
 	// Create a login token
1189 1256
 	createToken('login');
@@ -1235,8 +1302,9 @@  discard block
 block discarded – undo
1235 1302
 
1236 1303
 	$boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote'));
1237 1304
 
1238
-	if (empty($boardsAllowed))
1239
-		return array();
1305
+	if (empty($boardsAllowed)) {
1306
+			return array();
1307
+	}
1240 1308
 
1241 1309
 	$request = $smcFunc['db_query']('', '
1242 1310
 		SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time
@@ -1269,12 +1337,14 @@  discard block
 block discarded – undo
1269 1337
 	$smcFunc['db_free_result']($request);
1270 1338
 
1271 1339
 	// This user has voted on all the polls.
1272
-	if (empty($row) || !is_array($row))
1273
-		return array();
1340
+	if (empty($row) || !is_array($row)) {
1341
+			return array();
1342
+	}
1274 1343
 
1275 1344
 	// If this is a guest who's voted we'll through ourselves to show poll to show the results.
1276
-	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))))
1277
-		return ssi_showPoll($row['id_topic'], $output_method);
1345
+	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) {
1346
+			return ssi_showPoll($row['id_topic'], $output_method);
1347
+	}
1278 1348
 
1279 1349
 	$request = $smcFunc['db_query']('', '
1280 1350
 		SELECT COUNT(DISTINCT id_member)
@@ -1338,8 +1408,9 @@  discard block
 block discarded – undo
1338 1408
 	// If mods want to do somthing with this list of polls, let them do that now.
1339 1409
 	call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead));
1340 1410
 
1341
-	if ($output_method != 'echo')
1342
-		return $return;
1411
+	if ($output_method != 'echo') {
1412
+			return $return;
1413
+	}
1343 1414
 
1344 1415
 	if ($allow_view_results)
1345 1416
 	{
@@ -1348,19 +1419,20 @@  discard block
 block discarded – undo
1348 1419
 			<strong>', $return['question'], '</strong><br>
1349 1420
 			', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1350 1421
 
1351
-		foreach ($return['options'] as $option)
1352
-			echo '
1422
+		foreach ($return['options'] as $option) {
1423
+					echo '
1353 1424
 			<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1425
+		}
1354 1426
 
1355 1427
 		echo '
1356 1428
 			<input type="submit" value="', $txt['poll_vote'], '" class="button_submit">
1357 1429
 			<input type="hidden" name="poll" value="', $return['id'], '">
1358 1430
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1359 1431
 		</form>';
1432
+	} else {
1433
+			echo $txt['poll_cannot_see'];
1434
+	}
1360 1435
 	}
1361
-	else
1362
-		echo $txt['poll_cannot_see'];
1363
-}
1364 1436
 
1365 1437
 /**
1366 1438
  * Shows the poll from the specified topic
@@ -1374,13 +1446,15 @@  discard block
 block discarded – undo
1374 1446
 
1375 1447
 	$boardsAllowed = boardsAllowedTo('poll_view');
1376 1448
 
1377
-	if (empty($boardsAllowed))
1378
-		return array();
1449
+	if (empty($boardsAllowed)) {
1450
+			return array();
1451
+	}
1379 1452
 
1380
-	if ($topic === null && isset($_REQUEST['ssi_topic']))
1381
-		$topic = (int) $_REQUEST['ssi_topic'];
1382
-	else
1383
-		$topic = (int) $topic;
1453
+	if ($topic === null && isset($_REQUEST['ssi_topic'])) {
1454
+			$topic = (int) $_REQUEST['ssi_topic'];
1455
+	} else {
1456
+			$topic = (int) $topic;
1457
+	}
1384 1458
 
1385 1459
 	$request = $smcFunc['db_query']('', '
1386 1460
 		SELECT
@@ -1401,17 +1475,18 @@  discard block
 block discarded – undo
1401 1475
 	);
1402 1476
 
1403 1477
 	// Either this topic has no poll, or the user cannot view it.
1404
-	if ($smcFunc['db_num_rows']($request) == 0)
1405
-		return array();
1478
+	if ($smcFunc['db_num_rows']($request) == 0) {
1479
+			return array();
1480
+	}
1406 1481
 
1407 1482
 	$row = $smcFunc['db_fetch_assoc']($request);
1408 1483
 	$smcFunc['db_free_result']($request);
1409 1484
 
1410 1485
 	// Check if they can vote.
1411 1486
 	$already_voted = false;
1412
-	if (!empty($row['expire_time']) && $row['expire_time'] < time())
1413
-		$allow_vote = false;
1414
-	elseif ($user_info['is_guest'])
1487
+	if (!empty($row['expire_time']) && $row['expire_time'] < time()) {
1488
+			$allow_vote = false;
1489
+	} elseif ($user_info['is_guest'])
1415 1490
 	{
1416 1491
 		// There's a difference between "allowed to vote" and "already voted"...
1417 1492
 		$allow_vote = $row['guest_vote'];
@@ -1421,10 +1496,9 @@  discard block
 block discarded – undo
1421 1496
 		{
1422 1497
 			$already_voted = true;
1423 1498
 		}
1424
-	}
1425
-	elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board']))
1426
-		$allow_vote = false;
1427
-	else
1499
+	} elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) {
1500
+			$allow_vote = false;
1501
+	} else
1428 1502
 	{
1429 1503
 		$request = $smcFunc['db_query']('', '
1430 1504
 			SELECT id_member
@@ -1506,8 +1580,9 @@  discard block
 block discarded – undo
1506 1580
 	// If mods want to do somthing with this poll, let them do that now.
1507 1581
 	call_integration_hook('integrate_ssi_showPoll', array(&$return));
1508 1582
 
1509
-	if ($output_method != 'echo')
1510
-		return $return;
1583
+	if ($output_method != 'echo') {
1584
+			return $return;
1585
+	}
1511 1586
 
1512 1587
 	if ($return['allow_vote'])
1513 1588
 	{
@@ -1516,17 +1591,17 @@  discard block
 block discarded – undo
1516 1591
 				<strong>', $return['question'], '</strong><br>
1517 1592
 				', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1518 1593
 
1519
-		foreach ($return['options'] as $option)
1520
-			echo '
1594
+		foreach ($return['options'] as $option) {
1595
+					echo '
1521 1596
 				<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1597
+		}
1522 1598
 
1523 1599
 		echo '
1524 1600
 				<input type="submit" value="', $txt['poll_vote'], '" class="button_submit">
1525 1601
 				<input type="hidden" name="poll" value="', $return['id'], '">
1526 1602
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1527 1603
 			</form>';
1528
-	}
1529
-	else
1604
+	} else
1530 1605
 	{
1531 1606
 		echo '
1532 1607
 			<div class="ssi_poll">
@@ -1606,27 +1681,32 @@  discard block
 block discarded – undo
1606 1681
 			'is_approved' => 1,
1607 1682
 		)
1608 1683
 	);
1609
-	if ($smcFunc['db_num_rows']($request) == 0)
1610
-		die;
1684
+	if ($smcFunc['db_num_rows']($request) == 0) {
1685
+			die;
1686
+	}
1611 1687
 	$row = $smcFunc['db_fetch_assoc']($request);
1612 1688
 	$smcFunc['db_free_result']($request);
1613 1689
 
1614
-	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time']))
1615
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1690
+	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) {
1691
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1692
+	}
1616 1693
 
1617 1694
 	// Too many options checked?
1618
-	if (count($_REQUEST['options']) > $row['max_votes'])
1619
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1695
+	if (count($_REQUEST['options']) > $row['max_votes']) {
1696
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1697
+	}
1620 1698
 
1621 1699
 	// It's a guest who has already voted?
1622 1700
 	if ($user_info['is_guest'])
1623 1701
 	{
1624 1702
 		// Guest voting disabled?
1625
-		if (!$row['guest_vote'])
1626
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1703
+		if (!$row['guest_vote']) {
1704
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1705
+		}
1627 1706
 		// Already voted?
1628
-		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))
1629
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1707
+		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) {
1708
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1709
+		}
1630 1710
 	}
1631 1711
 
1632 1712
 	$sOptions = array();
@@ -1680,11 +1760,13 @@  discard block
 block discarded – undo
1680 1760
 {
1681 1761
 	global $scripturl, $txt, $context;
1682 1762
 
1683
-	if (!allowedTo('search_posts'))
1684
-		return;
1763
+	if (!allowedTo('search_posts')) {
1764
+			return;
1765
+	}
1685 1766
 
1686
-	if ($output_method != 'echo')
1687
-		return $scripturl . '?action=search';
1767
+	if ($output_method != 'echo') {
1768
+			return $scripturl . '?action=search';
1769
+	}
1688 1770
 
1689 1771
 	echo '
1690 1772
 		<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -1706,8 +1788,9 @@  discard block
 block discarded – undo
1706 1788
 	// If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context.
1707 1789
 	call_integration_hook('integrate_ssi_news');
1708 1790
 
1709
-	if ($output_method != 'echo')
1710
-		return $context['random_news_line'];
1791
+	if ($output_method != 'echo') {
1792
+			return $context['random_news_line'];
1793
+	}
1711 1794
 
1712 1795
 	echo $context['random_news_line'];
1713 1796
 }
@@ -1721,8 +1804,9 @@  discard block
 block discarded – undo
1721 1804
 {
1722 1805
 	global $scripturl, $modSettings, $user_info;
1723 1806
 
1724
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view'))
1725
-		return;
1807
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) {
1808
+			return;
1809
+	}
1726 1810
 
1727 1811
 	$eventOptions = array(
1728 1812
 		'include_birthdays' => true,
@@ -1733,13 +1817,15 @@  discard block
 block discarded – undo
1733 1817
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1734 1818
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1735 1819
 
1736
-	if ($output_method != 'echo')
1737
-		return $return['calendar_birthdays'];
1820
+	if ($output_method != 'echo') {
1821
+			return $return['calendar_birthdays'];
1822
+	}
1738 1823
 
1739
-	foreach ($return['calendar_birthdays'] as $member)
1740
-		echo '
1824
+	foreach ($return['calendar_birthdays'] as $member) {
1825
+			echo '
1741 1826
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
1742
-}
1827
+	}
1828
+	}
1743 1829
 
1744 1830
 /**
1745 1831
  * Shows today's holidays.
@@ -1750,8 +1836,9 @@  discard block
 block discarded – undo
1750 1836
 {
1751 1837
 	global $modSettings, $user_info;
1752 1838
 
1753
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1754
-		return;
1839
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1840
+			return;
1841
+	}
1755 1842
 
1756 1843
 	$eventOptions = array(
1757 1844
 		'include_holidays' => true,
@@ -1762,8 +1849,9 @@  discard block
 block discarded – undo
1762 1849
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1763 1850
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1764 1851
 
1765
-	if ($output_method != 'echo')
1766
-		return $return['calendar_holidays'];
1852
+	if ($output_method != 'echo') {
1853
+			return $return['calendar_holidays'];
1854
+	}
1767 1855
 
1768 1856
 	echo '
1769 1857
 		', implode(', ', $return['calendar_holidays']);
@@ -1777,8 +1865,9 @@  discard block
 block discarded – undo
1777 1865
 {
1778 1866
 	global $modSettings, $user_info;
1779 1867
 
1780
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1781
-		return;
1868
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1869
+			return;
1870
+	}
1782 1871
 
1783 1872
 	$eventOptions = array(
1784 1873
 		'include_events' => true,
@@ -1789,14 +1878,16 @@  discard block
 block discarded – undo
1789 1878
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1790 1879
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1791 1880
 
1792
-	if ($output_method != 'echo')
1793
-		return $return['calendar_events'];
1881
+	if ($output_method != 'echo') {
1882
+			return $return['calendar_events'];
1883
+	}
1794 1884
 
1795 1885
 	foreach ($return['calendar_events'] as $event)
1796 1886
 	{
1797
-		if ($event['can_edit'])
1798
-			echo '
1887
+		if ($event['can_edit']) {
1888
+					echo '
1799 1889
 	<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1890
+		}
1800 1891
 		echo '
1801 1892
 	' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1802 1893
 	}
@@ -1811,8 +1902,9 @@  discard block
 block discarded – undo
1811 1902
 {
1812 1903
 	global $modSettings, $txt, $scripturl, $user_info;
1813 1904
 
1814
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1815
-		return;
1905
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1906
+			return;
1907
+	}
1816 1908
 
1817 1909
 	$eventOptions = array(
1818 1910
 		'include_birthdays' => allowedTo('profile_view'),
@@ -1825,19 +1917,22 @@  discard block
 block discarded – undo
1825 1917
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1826 1918
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1827 1919
 
1828
-	if ($output_method != 'echo')
1829
-		return $return;
1920
+	if ($output_method != 'echo') {
1921
+			return $return;
1922
+	}
1830 1923
 
1831
-	if (!empty($return['calendar_holidays']))
1832
-		echo '
1924
+	if (!empty($return['calendar_holidays'])) {
1925
+			echo '
1833 1926
 			<span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>';
1927
+	}
1834 1928
 	if (!empty($return['calendar_birthdays']))
1835 1929
 	{
1836 1930
 		echo '
1837 1931
 			<span class="birthday">' . $txt['birthdays_upcoming'] . '</span> ';
1838
-		foreach ($return['calendar_birthdays'] as $member)
1839
-			echo '
1932
+		foreach ($return['calendar_birthdays'] as $member) {
1933
+					echo '
1840 1934
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';
1935
+		}
1841 1936
 		echo '
1842 1937
 			<br>';
1843 1938
 	}
@@ -1847,9 +1942,10 @@  discard block
 block discarded – undo
1847 1942
 			<span class="event">' . $txt['events_upcoming'] . '</span> ';
1848 1943
 		foreach ($return['calendar_events'] as $event)
1849 1944
 		{
1850
-			if ($event['can_edit'])
1851
-				echo '
1945
+			if ($event['can_edit']) {
1946
+							echo '
1852 1947
 			<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1948
+			}
1853 1949
 			echo '
1854 1950
 			' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1855 1951
 		}
@@ -1873,25 +1969,29 @@  discard block
 block discarded – undo
1873 1969
 	loadLanguage('Stats');
1874 1970
 
1875 1971
 	// Must be integers....
1876
-	if ($limit === null)
1877
-		$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1878
-	else
1879
-		$limit = (int) $limit;
1880
-
1881
-	if ($start === null)
1882
-		$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1883
-	else
1884
-		$start = (int) $start;
1885
-
1886
-	if ($board !== null)
1887
-		$board = (int) $board;
1888
-	elseif (isset($_GET['board']))
1889
-		$board = (int) $_GET['board'];
1890
-
1891
-	if ($length === null)
1892
-		$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1893
-	else
1894
-		$length = (int) $length;
1972
+	if ($limit === null) {
1973
+			$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1974
+	} else {
1975
+			$limit = (int) $limit;
1976
+	}
1977
+
1978
+	if ($start === null) {
1979
+			$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1980
+	} else {
1981
+			$start = (int) $start;
1982
+	}
1983
+
1984
+	if ($board !== null) {
1985
+			$board = (int) $board;
1986
+	} elseif (isset($_GET['board'])) {
1987
+			$board = (int) $_GET['board'];
1988
+	}
1989
+
1990
+	if ($length === null) {
1991
+			$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1992
+	} else {
1993
+			$length = (int) $length;
1994
+	}
1895 1995
 
1896 1996
 	$limit = max(0, $limit);
1897 1997
 	$start = max(0, $start);
@@ -1909,17 +2009,19 @@  discard block
 block discarded – undo
1909 2009
 	);
1910 2010
 	if ($smcFunc['db_num_rows']($request) == 0)
1911 2011
 	{
1912
-		if ($output_method == 'echo')
1913
-			die($txt['ssi_no_guests']);
1914
-		else
1915
-			return array();
2012
+		if ($output_method == 'echo') {
2013
+					die($txt['ssi_no_guests']);
2014
+		} else {
2015
+					return array();
2016
+		}
1916 2017
 	}
1917 2018
 	list ($board) = $smcFunc['db_fetch_row']($request);
1918 2019
 	$smcFunc['db_free_result']($request);
1919 2020
 
1920 2021
 	$icon_sources = array();
1921
-	foreach ($context['stable_icons'] as $icon)
1922
-		$icon_sources[$icon] = 'images_url';
2022
+	foreach ($context['stable_icons'] as $icon) {
2023
+			$icon_sources[$icon] = 'images_url';
2024
+	}
1923 2025
 
1924 2026
 	if (!empty($modSettings['enable_likes']))
1925 2027
 	{
@@ -1943,12 +2045,14 @@  discard block
 block discarded – undo
1943 2045
 		)
1944 2046
 	);
1945 2047
 	$posts = array();
1946
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1947
-		$posts[] = $row['id_first_msg'];
2048
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2049
+			$posts[] = $row['id_first_msg'];
2050
+	}
1948 2051
 	$smcFunc['db_free_result']($request);
1949 2052
 
1950
-	if (empty($posts))
1951
-		return array();
2053
+	if (empty($posts)) {
2054
+			return array();
2055
+	}
1952 2056
 
1953 2057
 	// Find the posts.
1954 2058
 	$request = $smcFunc['db_query']('', '
@@ -1978,24 +2082,28 @@  discard block
 block discarded – undo
1978 2082
 			$last_space = strrpos($row['body'], ' ');
1979 2083
 			$last_open = strrpos($row['body'], '<');
1980 2084
 			$last_close = strrpos($row['body'], '>');
1981
-			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6)
1982
-				$cutoff = $last_open;
1983
-			elseif (empty($last_close) || $last_close < $last_open)
1984
-				$cutoff = $last_space;
2085
+			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) {
2086
+							$cutoff = $last_open;
2087
+			} elseif (empty($last_close) || $last_close < $last_open) {
2088
+							$cutoff = $last_space;
2089
+			}
1985 2090
 
1986
-			if ($cutoff !== false)
1987
-				$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2091
+			if ($cutoff !== false) {
2092
+							$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2093
+			}
1988 2094
 			$row['body'] .= '...';
1989 2095
 		}
1990 2096
 
1991 2097
 		$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
1992 2098
 
1993
-		if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
1994
-			$row['icon'] = 'recycled';
2099
+		if (!empty($recycle_board) && $row['id_board'] == $recycle_board) {
2100
+					$row['icon'] = 'recycled';
2101
+		}
1995 2102
 
1996 2103
 		// Check that this message icon is there...
1997
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
1998
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2104
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
2105
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2106
+		}
1999 2107
 
2000 2108
 		censorText($row['subject']);
2001 2109
 		censorText($row['body']);
@@ -2032,16 +2140,18 @@  discard block
 block discarded – undo
2032 2140
 	}
2033 2141
 	$smcFunc['db_free_result']($request);
2034 2142
 
2035
-	if (empty($return))
2036
-		return $return;
2143
+	if (empty($return)) {
2144
+			return $return;
2145
+	}
2037 2146
 
2038 2147
 	$return[count($return) - 1]['is_last'] = true;
2039 2148
 
2040 2149
 	// If mods want to do somthing with this list of posts, let them do that now.
2041 2150
 	call_integration_hook('integrate_ssi_boardNews', array(&$return));
2042 2151
 
2043
-	if ($output_method != 'echo')
2044
-		return $return;
2152
+	if ($output_method != 'echo') {
2153
+			return $return;
2154
+	}
2045 2155
 
2046 2156
 	foreach ($return as $news)
2047 2157
 	{
@@ -2093,9 +2203,10 @@  discard block
 block discarded – undo
2093 2203
 		echo '
2094 2204
 			</div>';
2095 2205
 
2096
-		if (!$news['is_last'])
2097
-			echo '
2206
+		if (!$news['is_last']) {
2207
+					echo '
2098 2208
 			<hr>';
2209
+		}
2099 2210
 	}
2100 2211
 }
2101 2212
 
@@ -2109,8 +2220,9 @@  discard block
 block discarded – undo
2109 2220
 {
2110 2221
 	global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc;
2111 2222
 
2112
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
2113
-		return;
2223
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
2224
+			return;
2225
+	}
2114 2226
 
2115 2227
 	// Find all events which are happening in the near future that the member can see.
2116 2228
 	$request = $smcFunc['db_query']('', '
@@ -2136,20 +2248,23 @@  discard block
 block discarded – undo
2136 2248
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2137 2249
 	{
2138 2250
 		// Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have.
2139
-		if (!empty($duplicates[$row['title'] . $row['id_topic']]))
2140
-			continue;
2251
+		if (!empty($duplicates[$row['title'] . $row['id_topic']])) {
2252
+					continue;
2253
+		}
2141 2254
 
2142 2255
 		// Censor the title.
2143 2256
 		censorText($row['title']);
2144 2257
 
2145
-		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false)))
2146
-			$date = strftime('%Y-%m-%d', forum_time(false));
2147
-		else
2148
-			$date = $row['start_date'];
2258
+		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) {
2259
+					$date = strftime('%Y-%m-%d', forum_time(false));
2260
+		} else {
2261
+					$date = $row['start_date'];
2262
+		}
2149 2263
 
2150 2264
 		// If the topic it is attached to is not approved then don't link it.
2151
-		if (!empty($row['id_first_msg']) && !$row['approved'])
2152
-			$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2265
+		if (!empty($row['id_first_msg']) && !$row['approved']) {
2266
+					$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2267
+		}
2153 2268
 
2154 2269
 		$allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false;
2155 2270
 
@@ -2175,24 +2290,27 @@  discard block
 block discarded – undo
2175 2290
 	}
2176 2291
 	$smcFunc['db_free_result']($request);
2177 2292
 
2178
-	foreach ($return as $mday => $array)
2179
-		$return[$mday][count($array) - 1]['is_last'] = true;
2293
+	foreach ($return as $mday => $array) {
2294
+			$return[$mday][count($array) - 1]['is_last'] = true;
2295
+	}
2180 2296
 
2181 2297
 	// If mods want to do somthing with this list of events, let them do that now.
2182 2298
 	call_integration_hook('integrate_ssi_recentEvents', array(&$return));
2183 2299
 
2184
-	if ($output_method != 'echo' || empty($return))
2185
-		return $return;
2300
+	if ($output_method != 'echo' || empty($return)) {
2301
+			return $return;
2302
+	}
2186 2303
 
2187 2304
 	// Well the output method is echo.
2188 2305
 	echo '
2189 2306
 			<span class="event">' . $txt['events'] . '</span> ';
2190
-	foreach ($return as $mday => $array)
2191
-		foreach ($array as $event)
2307
+	foreach ($return as $mday => $array) {
2308
+			foreach ($array as $event)
2192 2309
 		{
2193 2310
 			if ($event['can_edit'])
2194 2311
 				echo '
2195 2312
 				<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
2313
+	}
2196 2314
 
2197 2315
 			echo '
2198 2316
 				' . $event['link'] . (!$event['is_last'] ? ', ' : '');
@@ -2211,8 +2329,9 @@  discard block
 block discarded – undo
2211 2329
 	global $smcFunc;
2212 2330
 
2213 2331
 	// If $id is null, this was most likely called from a query string and should do nothing.
2214
-	if ($id === null)
2215
-		return;
2332
+	if ($id === null) {
2333
+			return;
2334
+	}
2216 2335
 
2217 2336
 	$request = $smcFunc['db_query']('', '
2218 2337
 		SELECT passwd, member_name, is_activated
@@ -2244,8 +2363,9 @@  discard block
 block discarded – undo
2244 2363
 	$attachments_boards = boardsAllowedTo('view_attachments');
2245 2364
 
2246 2365
 	// No boards?  Adios amigo.
2247
-	if (empty($attachments_boards))
2248
-		return array();
2366
+	if (empty($attachments_boards)) {
2367
+			return array();
2368
+	}
2249 2369
 
2250 2370
 	// Is it an array?
2251 2371
 	$attachment_ext = (array) $attachment_ext;
@@ -2329,8 +2449,9 @@  discard block
 block discarded – undo
2329 2449
 	call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments));
2330 2450
 
2331 2451
 	// So you just want an array?  Here you can have it.
2332
-	if ($output_method == 'array' || empty($attachments))
2333
-		return $attachments;
2452
+	if ($output_method == 'array' || empty($attachments)) {
2453
+			return $attachments;
2454
+	}
2334 2455
 
2335 2456
 	// Give them the default.
2336 2457
 	echo '
@@ -2341,14 +2462,15 @@  discard block
 block discarded – undo
2341 2462
 				<th style="text-align: left; padding: 2">', $txt['downloads'], '</th>
2342 2463
 				<th style="text-align: left; padding: 2">', $txt['filesize'], '</th>
2343 2464
 			</tr>';
2344
-	foreach ($attachments as $attach)
2345
-		echo '
2465
+	foreach ($attachments as $attach) {
2466
+			echo '
2346 2467
 			<tr>
2347 2468
 				<td>', $attach['file']['link'], '</td>
2348 2469
 				<td>', $attach['member']['link'], '</td>
2349 2470
 				<td style="text-align: center">', $attach['file']['downloads'], '</td>
2350 2471
 				<td>', $attach['file']['filesize'], '</td>
2351 2472
 			</tr>';
2473
+	}
2352 2474
 	echo '
2353 2475
 		</table>';
2354 2476
 }
Please login to merge, or discard this patch.