Completed
Pull Request — release-2.1 (#3762)
by Rick
07:27
created
Themes/default/ManageMembergroups.template.php 1 patch
Braces   +92 added lines, -65 removed lines patch added patch discarded remove patch
@@ -52,9 +52,10 @@  discard block
 block discarded – undo
52 52
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
53 53
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
54 54
 
55
-		if ($context['allow_protected'])
56
-			echo '
55
+		if ($context['allow_protected']) {
56
+					echo '
57 57
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
58
+		}
58 59
 
59 60
 		echo '
60 61
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -64,14 +65,15 @@  discard block
 block discarded – undo
64 65
 					</dd>';
65 66
 	}
66 67
 
67
-	if ($context['post_group'] || $context['undefined_group'])
68
-		echo '
68
+	if ($context['post_group'] || $context['undefined_group']) {
69
+			echo '
69 70
 					<dt id="min_posts_text">
70 71
 						<strong>', $txt['membergroups_min_posts'], ':</strong>
71 72
 					</dt>
72 73
 					<dd>
73 74
 						<input type="number" name="min_posts" id="min_posts_input" size="5" class="input_text">
74 75
 					</dd>';
76
+	}
75 77
 	if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups']))
76 78
 	{
77 79
 		echo '
@@ -87,9 +89,10 @@  discard block
 block discarded – undo
87 89
 							<select name="inheritperm" id="inheritperm_select" onclick="document.getElementById(\'perm_type_inherit\').checked = true;">
88 90
 								<option value="-1">', $txt['membergroups_guests'], '</option>
89 91
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
90
-		foreach ($context['groups'] as $group)
91
-			echo '
92
+		foreach ($context['groups'] as $group) {
93
+					echo '
92 94
 								<option value="', $group['id'], '">', $group['name'], '</option>';
95
+		}
93 96
 		echo '
94 97
 							</select>
95 98
 							<br>
@@ -98,9 +101,10 @@  discard block
 block discarded – undo
98 101
 							<select name="copyperm" id="copyperm_select" onclick="document.getElementById(\'perm_type_copy\').checked = true;">
99 102
 								<option value="-1">', $txt['membergroups_guests'], '</option>
100 103
 								<option value="0" selected>', $txt['membergroups_members'], '</option>';
101
-		foreach ($context['groups'] as $group)
102
-			echo '
104
+		foreach ($context['groups'] as $group) {
105
+					echo '
103 106
 								<option value="', $group['id'], '">', $group['name'], '</option>';
107
+		}
104 108
 		echo '
105 109
 							</select>
106 110
 							<br>
@@ -173,8 +177,8 @@  discard block
 block discarded – undo
173 177
 						<input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30" class="input_text">
174 178
 					</dd>';
175 179
 
176
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
177
-		echo '
180
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
181
+			echo '
178 182
 
179 183
 					<dt id="group_desc_text">
180 184
 						<label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label>
@@ -182,6 +186,7 @@  discard block
 block discarded – undo
182 186
 					<dd>
183 187
 						<textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea>
184 188
 					</dd>';
189
+	}
185 190
 
186 191
 	// Group type...
187 192
 	if ($context['group']['allow_post_group'])
@@ -195,9 +200,10 @@  discard block
 block discarded – undo
195 200
 							<legend>', $txt['membergroups_edit_select_group_type'], '</legend>
196 201
 							<label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0"', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_private'], '</label><br>';
197 202
 
198
-		if ($context['group']['allow_protected'])
199
-			echo '
203
+		if ($context['group']['allow_protected']) {
204
+					echo '
200 205
 							<label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1"', $context['group']['type'] == 1 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_protected'], '</label><br>';
206
+		}
201 207
 
202 208
 		echo '
203 209
 							<label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2"', $context['group']['type'] == 2 ? ' checked' : '', ' class="input_radio" onclick="swapPostGroup(0);">', $txt['membergroups_group_type_request'], '</label><br>
@@ -207,8 +213,8 @@  discard block
 block discarded – undo
207 213
 					</dd>';
208 214
 	}
209 215
 
210
-	if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
211
-		echo '
216
+	if ($context['group']['id'] != 3 && $context['group']['id'] != 4) {
217
+			echo '
212 218
 					<dt id="group_moderators_text">
213 219
 						<label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label>
214 220
 					</dt>
@@ -226,6 +232,7 @@  discard block
 block discarded – undo
226 232
 							<option value="2"', $context['group']['hidden'] == 2 ? ' selected' : '', '>', $txt['membergroups_edit_hidden_all'], '</option>
227 233
 						</select>
228 234
 					</dd>';
235
+	}
229 236
 
230 237
 	// Can they inherit permissions?
231 238
 	if ($context['group']['id'] > 1 && $context['group']['id'] != 3)
@@ -242,9 +249,10 @@  discard block
 block discarded – undo
242 249
 							<option value="0"', $context['group']['inherited_from'] == 0 ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>';
243 250
 
244 251
 		// For all the inheritable groups show an option.
245
-		foreach ($context['inheritable_groups'] as $id => $group)
246
-			echo '
252
+		foreach ($context['inheritable_groups'] as $id => $group) {
253
+					echo '
247 254
 							<option value="', $id, '"', $context['group']['inherited_from'] == $id ? ' selected' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>';
255
+		}
248 256
 
249 257
 		echo '
250 258
 						</select>
@@ -252,8 +260,8 @@  discard block
 block discarded – undo
252 260
 					</dd>';
253 261
 	}
254 262
 
255
-	if ($context['group']['allow_post_group'])
256
-		echo '
263
+	if ($context['group']['allow_post_group']) {
264
+			echo '
257 265
 
258 266
 					<dt id="min_posts_text">
259 267
 						<label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label>
@@ -261,6 +269,7 @@  discard block
 block discarded – undo
261 269
 					<dd>
262 270
 						<input type="number" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6" class="input_text">
263 271
 					</dd>';
272
+	}
264 273
 	echo '
265 274
 					<dt>
266 275
 						<label for="online_color_input"><strong>', $txt['membergroups_online_color'], ':</strong></label>
@@ -301,9 +310,10 @@  discard block
 block discarded – undo
301 310
 	}
302 311
 
303 312
 	// No? Hide the entire control.
304
-	else
305
-		echo '
313
+	else {
314
+			echo '
306 315
 					<input type="hidden" name="icon_image" value="">';
316
+	}
307 317
 
308 318
 	echo '
309 319
 					<dt>
@@ -314,8 +324,8 @@  discard block
 block discarded – undo
314 324
 						<input type="text" name="max_messages" id="max_messages_input" value="', $context['group']['id'] == 1 ? 0 : $context['group']['max_messages'], '" size="6"', $context['group']['id'] == 1 ? ' disabled' : '', ' class="input_text">
315 325
 					</dd>';
316 326
 	//Force 2FA for this membergroup?
317
-	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2)
318
-	echo '
327
+	if (!empty($modSettings['tfa_mode']) && $modSettings['tfa_mode'] == 2) {
328
+		echo '
319 329
 					<dt>
320 330
 						<label for="group_tfa_force_input"><strong>', $txt['membergroups_tfa_force'], ':</strong></label><br>
321 331
 						<span class="smalltext">', $txt['membergroups_tfa_force_note'], '</span>
@@ -323,6 +333,7 @@  discard block
 block discarded – undo
323 333
 					<dd>
324 334
 						<input type="checkbox" name="group_tfa_force"', $context['group']['tfa_required'] ? ' checked' : '', ' class="input_check">
325 335
 					</dd>';
336
+	}
326 337
 
327 338
 	if (!empty($context['categories']))
328 339
 	{
@@ -332,10 +343,11 @@  discard block
 block discarded – undo
332 343
 						<span class="smalltext">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
333 344
 					</dt>
334 345
 					<dd>';
335
-		if (!empty($context['can_manage_boards']))
336
-			echo $txt['membergroups_can_manage_access'];
337
-		else
338
-			template_add_edit_group_boards_list();
346
+		if (!empty($context['can_manage_boards'])) {
347
+					echo $txt['membergroups_can_manage_access'];
348
+		} else {
349
+					template_add_edit_group_boards_list();
350
+		}
339 351
 
340 352
 		echo '
341 353
 					</dd>';
@@ -364,20 +376,21 @@  discard block
 block discarded – undo
364 376
 				sItemListContainerId: \'moderator_container\',
365 377
 				aListItems: [';
366 378
 
367
-			foreach ($context['group']['moderators'] as $id_member => $member_name)
368
-				echo '
379
+			foreach ($context['group']['moderators'] as $id_member => $member_name) {
380
+							echo '
369 381
 							{
370 382
 								sItemId: ', JavaScriptEscape($id_member), ',
371 383
 								sItemName: ', JavaScriptEscape($member_name), '
372 384
 							}', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
385
+			}
373 386
 
374 387
 			echo '
375 388
 				]
376 389
 			});
377 390
 		</script>';
378 391
 
379
-	if ($context['group']['allow_post_group'])
380
-		echo '
392
+	if ($context['group']['allow_post_group']) {
393
+			echo '
381 394
 		<script>
382 395
 			function swapPostGroup(isChecked)
383 396
 			{
@@ -425,7 +438,8 @@  discard block
 block discarded – undo
425 438
 
426 439
 			swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
427 440
 		</script>';
428
-}
441
+	}
442
+	}
429 443
 
430 444
 /**
431 445
  * The template for determining which boards a group has access to.
@@ -442,13 +456,13 @@  discard block
 block discarded – undo
442 456
 
443 457
 	foreach ($context['categories'] as $category)
444 458
 	{
445
-		if (empty($modSettings['deny_boards_access']))
446
-			echo '
459
+		if (empty($modSettings['deny_boards_access'])) {
460
+					echo '
447 461
 									<li class="category">
448 462
 										<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'new_group\'); return false;"><strong>', $category['name'], '</strong></a>
449 463
 									<ul style="width:100%">';
450
-		else
451
-			echo '
464
+		} else {
465
+					echo '
452 466
 									<li class="category">
453 467
 										<strong>', $category['name'], '</strong>
454 468
 										<span class="select_all_box">
@@ -461,16 +475,17 @@  discard block
 block discarded – undo
461 475
 											</select>
462 476
 										</span>
463 477
 										<ul style="width:100%" id="boards_list_', $category['id'], '">';
478
+		}
464 479
 
465 480
 		foreach ($category['boards'] as $board)
466 481
 		{
467
-			if (empty($modSettings['deny_boards_access']))
468
-				echo '
482
+			if (empty($modSettings['deny_boards_access'])) {
483
+							echo '
469 484
 										<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
470 485
 											<input type="checkbox" name="boardaccess[', $board['id'], ']" id="brd', $board['id'], '" value="allow"', $board['allow'] ? ' checked' : '', ' class="input_check"> <label for="brd', $board['id'], '">', $board['name'], '</label>
471 486
 										</li>';
472
-			else
473
-				echo '
487
+			} else {
488
+							echo '
474 489
 											<li class="board" style="width:100%">
475 490
 												<span style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">', $board['name'], ': </span>
476 491
 												<span style="width:50%;float:right">
@@ -479,6 +494,7 @@  discard block
 block discarded – undo
479 494
 													<input type="radio" name="boardaccess[', $board['id'], ']" id="deny_brd', $board['id'], '" value="deny"', $board['deny'] ? ' checked' : '', ' class="input_check"> <label for="deny_brd', $board['id'], '">', $txt['permissions_option_deny'], '</label>
480 495
 												</span>
481 496
 											</li>';
497
+			}
482 498
 		}
483 499
 
484 500
 		echo '
@@ -489,13 +505,13 @@  discard block
 block discarded – undo
489 505
 	echo '
490 506
 							</ul>';
491 507
 
492
-	if (empty($modSettings['deny_boards_access']))
493
-		echo '
508
+	if (empty($modSettings['deny_boards_access'])) {
509
+			echo '
494 510
 								<br class="clear"><br>
495 511
 								<input type="checkbox" id="checkall_check" class="input_check" onclick="invertAll(this, this.form, \'boardaccess\');"> <label for="checkall_check"><em>', $txt['check_all'], '</em></label>
496 512
 							</fieldset>';
497
-	else
498
-		echo '
513
+	} else {
514
+			echo '
499 515
 								<br class="clear">
500 516
 								<span class="select_all_box">
501 517
 									<em>', $txt['all'], ': </em>
@@ -511,15 +527,17 @@  discard block
 block discarded – undo
511 527
 									});
512 528
 								});
513 529
 							</script>';
530
+	}
514 531
 
515
-	if ($collapse)
516
-		echo '
532
+	if ($collapse) {
533
+			echo '
517 534
 							<a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a>
518 535
 							<script>
519 536
 								document.getElementById("visible_boards_link").style.display = "";
520 537
 								document.getElementById("visible_boards").style.display = "none";
521 538
 							</script>';
522
-}
539
+	}
540
+	}
523 541
 
524 542
 /**
525 543
  * Templatine for viewing the members of a group.
@@ -543,14 +561,15 @@  discard block
 block discarded – undo
543 561
 						<span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['icons'], '
544 562
 					</dd>';
545 563
 	//Any description to show?
546
-	if (!empty($context['group']['description']))
547
-		echo '
564
+	if (!empty($context['group']['description'])) {
565
+			echo '
548 566
 					<dt>
549 567
 						<strong>' . $txt['membergroups_members_description'] . ':</strong>
550 568
 					</dt>
551 569
 					<dd>
552 570
 						', $context['group']['description'] ,'
553 571
 					</dd>';
572
+	}
554 573
 
555 574
 	echo '
556 575
 					<dt>
@@ -563,8 +582,9 @@  discard block
 block discarded – undo
563 582
 	if (!empty($context['group']['moderators']))
564 583
 	{
565 584
 		$moderators = array();
566
-		foreach ($context['group']['moderators'] as $moderator)
567
-			$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
585
+		foreach ($context['group']['moderators'] as $moderator) {
586
+					$moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
587
+		}
568 588
 
569 589
 		echo '
570 590
 					<dt>
@@ -590,27 +610,30 @@  discard block
 block discarded – undo
590 610
 					<tr class="title_bar">
591 611
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
592 612
 
593
-	if ($context['can_send_email'])
594
-		echo '
613
+	if ($context['can_send_email']) {
614
+			echo '
595 615
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>';
616
+	}
596 617
 
597 618
 	echo '
598 619
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
599 620
 						<th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=registered', $context['sort_by'] == 'registered' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['date_registered'], $context['sort_by'] == 'registered' ? '<span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a></th>
600 621
 						<th ', empty($context['group']['assignable']) ? ' colspan="2"' : '', '><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '','</a></th>';
601
-	if (!empty($context['group']['assignable']))
602
-		echo '
622
+	if (!empty($context['group']['assignable'])) {
623
+			echo '
603 624
 						<th style="width: 4%"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);"></th>';
625
+	}
604 626
 	echo '
605 627
 					</tr>
606 628
 				</thead>
607 629
 				<tbody>';
608 630
 
609
-	if (empty($context['members']))
610
-		echo '
631
+	if (empty($context['members'])) {
632
+			echo '
611 633
 					<tr class="windowbg">
612 634
 						<td colspan="6">', $txt['membergroups_members_no_members'], '</td>
613 635
 					</tr>';
636
+	}
614 637
 
615 638
 	foreach ($context['members'] as $member)
616 639
 	{
@@ -629,9 +652,10 @@  discard block
 block discarded – undo
629 652
 						<td>', $member['last_online'], '</td>
630 653
 						<td>', $member['registered'], '</td>
631 654
 						<td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
632
-		if (!empty($context['group']['assignable']))
633
-			echo '
655
+		if (!empty($context['group']['assignable'])) {
656
+					echo '
634 657
 						<td style="width: 4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" class="input_check" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>';
658
+		}
635 659
 		echo '
636 660
 					</tr>';
637 661
 	}
@@ -640,11 +664,12 @@  discard block
 block discarded – undo
640 664
 				</tbody>
641 665
 			</table>';
642 666
 
643
-	if (!empty($context['group']['assignable']))
644
-		echo '
667
+	if (!empty($context['group']['assignable'])) {
668
+			echo '
645 669
 			<div class="floatright">
646 670
 				<input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit ">
647 671
 			</div>';
672
+	}
648 673
 
649 674
 	echo '
650 675
 			<div class="pagesection flow_hidden">
@@ -678,8 +703,8 @@  discard block
 block discarded – undo
678 703
 		</form>
679 704
 	</div>';
680 705
 
681
-	if (!empty($context['group']['assignable']))
682
-		echo '
706
+	if (!empty($context['group']['assignable'])) {
707
+			echo '
683 708
 		<script>
684 709
 			var oAddMemberSuggest = new smc_AutoSuggest({
685 710
 				sSelf: \'oAddMemberSuggest\',
@@ -695,7 +720,8 @@  discard block
 block discarded – undo
695 720
 				sItemListContainerId: \'toAddItemContainer\'
696 721
 			});
697 722
 		</script>';
698
-}
723
+	}
724
+	}
699 725
 
700 726
 /**
701 727
  * Allow the moderator to enter a reason to each user being rejected.
@@ -715,8 +741,8 @@  discard block
 block discarded – undo
715 741
 				<dl class="settings">';
716 742
 
717 743
 	// Loop through and print out a reason box for each...
718
-	foreach ($context['group_requests'] as $request)
719
-		echo '
744
+	foreach ($context['group_requests'] as $request) {
745
+			echo '
720 746
 					<dt>
721 747
 						<strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
722 748
 					</dt>
@@ -724,6 +750,7 @@  discard block
 block discarded – undo
724 750
 						<input type="hidden" name="groupr[]" value="', $request['id'], '">
725 751
 						<textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="min-width: 80%; max-width: 99%;"></textarea>
726 752
 					</dd>';
753
+	}
727 754
 
728 755
 	echo '
729 756
 				</dl>
Please login to merge, or discard this patch.
Themes/default/Who.template.php 1 patch
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@  discard block
 block discarded – undo
31 31
 					<div class="selectbox floatright" id="upper_show">', $txt['who_show1'], '
32 32
 						<select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
33 33
 
34
-	foreach ($context['show_methods'] as $value => $label)
35
-		echo '
34
+	foreach ($context['show_methods'] as $value => $label) {
35
+			echo '
36 36
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
37
+	}
37 38
 	echo '
38 39
 						</select>
39 40
 						<noscript>
@@ -71,9 +72,10 @@  discard block
 block discarded – undo
71 72
 									', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
72 73
 								</span>';
73 74
 
74
-		if (!empty($member['ip']))
75
-			echo '
75
+		if (!empty($member['ip'])) {
76
+					echo '
76 77
 								(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
78
+		}
77 79
 
78 80
 		echo '
79 81
 							</td>
@@ -103,9 +105,10 @@  discard block
 block discarded – undo
103 105
 					<div class="selectbox floatright">', $txt['who_show1'], '
104 106
 						<select name="show" onchange="document.forms.whoFilter.submit();">';
105 107
 
106
-	foreach ($context['show_methods'] as $value => $label)
107
-		echo '
108
+	foreach ($context['show_methods'] as $value => $label) {
109
+			echo '
108 110
 							<option value="', $value, '" ', $value == $context['show_by'] ? ' selected' : '', '>', $label, '</option>';
111
+	}
109 112
 	echo '
110 113
 						</select>
111 114
 						<noscript>
@@ -134,17 +137,19 @@  discard block
 block discarded – undo
134 137
 
135 138
 	foreach ($context['credits'] as $section)
136 139
 	{
137
-		if (isset($section['pretext']))
138
-		echo '
140
+		if (isset($section['pretext'])) {
141
+				echo '
139 142
 		<div class="windowbg noup">
140 143
 			<p>', $section['pretext'], '</p>
141 144
 		</div>';
145
+		}
142 146
 
143
-		if (isset($section['title']))
144
-		echo '
147
+		if (isset($section['title'])) {
148
+				echo '
145 149
 		<div class="cat_bar">
146 150
 			<h3 class="catbg">', $section['title'], '</h3>
147 151
 		</div>';
152
+		}
148 153
 
149 154
 		echo '
150 155
 		<div class="windowbg2 noup">
@@ -152,17 +157,18 @@  discard block
 block discarded – undo
152 157
 
153 158
 		foreach ($section['groups'] as $group)
154 159
 		{
155
-			if (isset($group['title']))
156
-				echo '
160
+			if (isset($group['title'])) {
161
+							echo '
157 162
 				<dt>
158 163
 					<strong>', $group['title'], '</strong>
159 164
 				</dt>
160 165
 				<dd>';
166
+			}
161 167
 
162 168
 			// Try to make this read nicely.
163
-			if (count($group['members']) <= 2)
164
-				echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
165
-			else
169
+			if (count($group['members']) <= 2) {
170
+							echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
171
+			} else
166 172
 			{
167 173
 				$last_peep = array_pop($group['members']);
168 174
 				echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
@@ -175,9 +181,10 @@  discard block
 block discarded – undo
175 181
 		echo '
176 182
 			</dl>';
177 183
 
178
-		if (isset($section['posttext']))
179
-			echo '
184
+		if (isset($section['posttext'])) {
185
+					echo '
180 186
 				<p class="posttext">', $section['posttext'], '</p>';
187
+		}
181 188
 
182 189
 		echo '
183 190
 		</div>';
@@ -192,26 +199,29 @@  discard block
 block discarded – undo
192 199
 		</div>
193 200
 		<div class="windowbg noup">';
194 201
 
195
-		if (!empty($context['credits_software_graphics']['graphics']))
196
-			echo '
202
+		if (!empty($context['credits_software_graphics']['graphics'])) {
203
+					echo '
197 204
 			<dl>
198 205
 				<dt><strong>', $txt['credits_graphics'], '</strong></dt>
199 206
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['graphics']), '</dd>
200 207
 			</dl>';
208
+		}
201 209
 
202
-		if (!empty($context['credits_software_graphics']['software']))
203
-			echo '
210
+		if (!empty($context['credits_software_graphics']['software'])) {
211
+					echo '
204 212
 			<dl>
205 213
 				<dt><strong>', $txt['credits_software'], '</strong></dt>
206 214
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['software']), '</dd>
207 215
 			</dl>';
216
+		}
208 217
 
209
-		if (!empty($context['credits_software_graphics']['fonts']))
210
-			echo '
218
+		if (!empty($context['credits_software_graphics']['fonts'])) {
219
+					echo '
211 220
 			<dl>
212 221
 				<dt><strong>', $txt['credits_fonts'], '</strong></dt>
213 222
 				<dd>', implode('</dd><dd>', $context['credits_software_graphics']['fonts']), '</dd>
214 223
 			</dl>';
224
+		}
215 225
 		echo '
216 226
 		</div>';
217 227
 	}
@@ -226,16 +236,18 @@  discard block
 block discarded – undo
226 236
 		<div class="windowbg noup">';
227 237
 
228 238
 		// Display the credits.
229
-		if (!empty($context['credits_modifications']))
230
-			echo '
239
+		if (!empty($context['credits_modifications'])) {
240
+					echo '
231 241
 			', implode('
232 242
 			<br>', $context['credits_modifications']);
243
+		}
233 244
 
234 245
 		// Legacy.
235
-		if (!empty($context['copyrights']['mods']))
236
-			echo (empty($context['credits_modifications']) ? '<br>' : ''),
246
+		if (!empty($context['copyrights']['mods'])) {
247
+					echo (empty($context['credits_modifications']) ? '<br>' : ''),
237 248
 			implode('
238 249
 			<br>', $context['copyrights']['mods']);
250
+		}
239 251
 
240 252
 		echo '
241 253
 		</div>';
Please login to merge, or discard this patch.
Themes/default/ManageSearch.template.php 1 patch
Braces   +23 added lines, -18 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 			<div class="windowbg2 noup">
112 112
 				<dl class="settings">';
113 113
 
114
-	if (!empty($context['table_info']))
115
-		echo '
114
+	if (!empty($context['table_info'])) {
115
+			echo '
116 116
 					<dt>
117 117
 						<strong>', $txt['search_method_messages_table_space'], ':</strong>
118 118
 					</dt>
@@ -125,6 +125,7 @@  discard block
 block discarded – undo
125 125
 					<dd>
126 126
 						', $context['table_info']['index_length'], '
127 127
 					</dd>';
128
+	}
128 129
 	echo '
129 130
 				</dl>
130 131
 				', $context['double_index'] ? '<div class="noticebox">
@@ -146,16 +147,17 @@  discard block
 block discarded – undo
146 147
 						<dd>
147 148
 
148 149
 							<span class="smalltext">';
149
-	if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext']))
150
-		echo '
150
+	if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) {
151
+			echo '
151 152
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]';
152
-	elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext']))
153
-		echo '
153
+	} elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) {
154
+			echo '
154 155
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create'];
155
-	else
156
-		echo '
156
+	} else {
157
+			echo '
157 158
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br>
158 159
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length'];
160
+	}
159 161
 	echo '
160 162
 								</span>
161 163
 						</dd>';
@@ -168,25 +170,27 @@  discard block
 block discarded – undo
168 170
 						</dt>
169 171
 						<dd>
170 172
 							<span class="smalltext">';
171
-	if ($context['custom_index'])
172
-		echo '
173
+	if ($context['custom_index']) {
174
+			echo '
173 175
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br>
174 176
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
175
-	elseif ($context['partial_custom_index'])
176
-		echo '
177
+	} elseif ($context['partial_custom_index']) {
178
+			echo '
177 179
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br>
178 180
 								<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
179
-	else
180
-		echo '
181
+	} else {
182
+			echo '
181 183
 								<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]';
184
+	}
182 185
 	echo '
183 186
 							</span>
184 187
 						</dd>';
185 188
 
186 189
 	foreach ($context['search_apis'] as $api)
187 190
 	{
188
-		if (empty($api['label']) || $api['has_template'])
189
-			continue;
191
+		if (empty($api['label']) || $api['has_template']) {
192
+					continue;
193
+		}
190 194
 
191 195
 		echo '
192 196
 						<dt>
@@ -194,12 +198,13 @@  discard block
 block discarded – undo
194 198
 							', $api['label'] ,'
195 199
 						</dt>';
196 200
 
197
-	if ($api['desc'])
198
-		echo '
201
+	if ($api['desc']) {
202
+			echo '
199 203
 						<dd>
200 204
 							<span class="smalltext">', $api['desc'], '</span>
201 205
 						</dd>';
202 206
 	}
207
+	}
203 208
 
204 209
 	echo '
205 210
 					</dl>
Please login to merge, or discard this patch.
Themes/default/Stats.template.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
 				<dt>', $txt['users_online_today'], ':</dt>
45 45
 				<dd>', $context['online_today'], '</dd>';
46 46
 
47
-	if (!empty($modSettings['hitStats']))
48
-		echo '
47
+	if (!empty($modSettings['hitStats'])) {
48
+			echo '
49 49
 				<dt>', $txt['num_hits'], ':</dt>
50 50
 				<dd>', $context['num_hits'], '</dd>';
51
+	}
51 52
 
52 53
 	echo '
53 54
 			</dl>
@@ -71,17 +72,19 @@  discard block
 block discarded – undo
71 72
 				<dt>', $txt['gender_stats'], ':</dt>
72 73
 				<dd>';
73 74
 
74
-		foreach ($context['gender'] as $g => $n)
75
-			echo $g, ': ', $n, '<br>';
75
+		foreach ($context['gender'] as $g => $n) {
76
+					echo $g, ': ', $n, '<br>';
77
+		}
76 78
 
77 79
 		echo '
78 80
 				</dd>';
79 81
 	}
80 82
 
81
-	if (!empty($modSettings['hitStats']))
82
-		echo '
83
+	if (!empty($modSettings['hitStats'])) {
84
+			echo '
83 85
 				<dt>', $txt['average_hits'], ':</dt>
84 86
 				<dd>', $context['average_hits'], '</dd>';
87
+	}
85 88
 
86 89
 	echo '
87 90
 			</dl>';
@@ -105,14 +108,15 @@  discard block
 block discarded – undo
105 108
 						</dt>
106 109
 						<dd class="statsbar">';
107 110
 
108
-			if (!empty($item['percent']))
109
-				echo '
111
+			if (!empty($item['percent'])) {
112
+							echo '
110 113
 							<div class="bar" style="width: ', $item['percent'], '%;">
111 114
 								<span class="righttext">', $item['num'], '</span>
112 115
 							</div>';
113
-			else
114
-				echo '
116
+			} else {
117
+							echo '
115 118
 							<div class="bar empty"><span class="righttext">', $item['num'], '</span></div>';
119
+			}
116 120
 
117 121
 			echo '
118 122
 						</dd>';
@@ -144,9 +148,10 @@  discard block
 block discarded – undo
144 148
 					<th>', $txt['stats_new_members'], '</th>
145 149
 					<th>', $txt['most_online'], '</th>';
146 150
 
147
-		if (!empty($modSettings['hitStats']))
148
-			echo '
151
+		if (!empty($modSettings['hitStats'])) {
152
+					echo '
149 153
 					<th>', $txt['page_views'], '</th>';
154
+		}
150 155
 
151 156
 		echo '
152 157
 				</tr>
@@ -165,9 +170,10 @@  discard block
 block discarded – undo
165 170
 					<th>', $year['new_members'], '</th>
166 171
 					<th>', $year['most_members_online'], '</th>';
167 172
 
168
-			if (!empty($modSettings['hitStats']))
169
-				echo '
173
+			if (!empty($modSettings['hitStats'])) {
174
+							echo '
170 175
 					<th>', $year['hits'], '</th>';
176
+			}
171 177
 
172 178
 			echo '
173 179
 				</tr>';
@@ -184,9 +190,10 @@  discard block
 block discarded – undo
184 190
 					<th>', $month['new_members'], '</th>
185 191
 					<th>', $month['most_members_online'], '</th>';
186 192
 
187
-				if (!empty($modSettings['hitStats']))
188
-					echo '
193
+				if (!empty($modSettings['hitStats'])) {
194
+									echo '
189 195
 					<th>', $month['hits'], '</th>';
196
+				}
190 197
 
191 198
 				echo '
192 199
 				</tr>';
@@ -203,9 +210,10 @@  discard block
 block discarded – undo
203 210
 					<td>', $day['new_members'], '</td>
204 211
 					<td>', $day['most_members_online'], '</td>';
205 212
 
206
-						if (!empty($modSettings['hitStats']))
207
-							echo '
213
+						if (!empty($modSettings['hitStats'])) {
214
+													echo '
208 215
 					<td>', $day['hits'], '</td>';
216
+						}
209 217
 
210 218
 						echo '
211 219
 				</tr>';
Please login to merge, or discard this patch.
cron.php 1 patch
Braces   +36 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,37 +41,43 @@  discard block
 block discarded – undo
41 41
 define('TIME_START', microtime(true));
42 42
 
43 43
 // Just being safe...
44
-foreach (array('db_character_set', 'cachedir') as $variable)
44
+foreach (array('db_character_set', 'cachedir') as $variable) {
45 45
 	if (isset($GLOBALS[$variable]))
46 46
 		unset($GLOBALS[$variable]);
47
+}
47 48
 
48 49
 // Get the forum's settings for database and file paths.
49 50
 require_once(dirname(__FILE__) . '/Settings.php');
50 51
 
51 52
 // Make absolutely sure the cache directory is defined.
52
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
53
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
53 54
 	$cachedir = $boarddir . '/cache';
55
+}
54 56
 
55 57
 // Don't do john didley if the forum's been shut down competely.
56
-if ($maintenance == 2)
58
+if ($maintenance == 2) {
57 59
 	die($mmessage);
60
+}
58 61
 
59 62
 // Fix for using the current directory as a path.
60
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
63
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
61 64
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
65
+}
62 66
 
63 67
 // Have we already turned this off? If so, exist gracefully.
64
-if (file_exists($cachedir . '/cron.lock'))
68
+if (file_exists($cachedir . '/cron.lock')) {
65 69
 	obExit_cron();
70
+}
66 71
 
67 72
 // Before we go any further, if this is not a CLI request, we need to do some checking.
68 73
 if (!FROM_CLI)
69 74
 {
70 75
 	// We will clean up $_GET shortly. But we want to this ASAP.
71 76
 	$ts = isset($_GET['ts']) ? (int) $_GET['ts'] : 0;
72
-	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20)
73
-		obExit_cron();
74
-}
77
+	if ($ts <= 0 || $ts % 15 != 0 || time() - $ts < 0 || time() - $ts > 20) {
78
+			obExit_cron();
79
+	}
80
+	}
75 81
 
76 82
 // Load the most important includes. In general, a background should be loading its own dependencies.
77 83
 require_once($sourcedir . '/Errors.php');
@@ -123,8 +129,9 @@  discard block
 block discarded – undo
123 129
 	global $smcFunc;
124 130
 
125 131
 	// Check we haven't run over our time limit.
126
-	if (microtime(true) - TIME_START > MAX_CRON_TIME)
127
-		return false;
132
+	if (microtime(true) - TIME_START > MAX_CRON_TIME) {
133
+			return false;
134
+	}
128 135
 
129 136
 	// Try to find a task. Specifically, try to find one that hasn't been claimed previously, or failing that,
130 137
 	// a task that was claimed but failed for whatever reason and failed long enough ago. We should not care
@@ -159,14 +166,12 @@  discard block
 block discarded – undo
159 166
 			// Update the time and go back.
160 167
 			$row['claimed_time'] = time();
161 168
 			return $row;
162
-		}
163
-		else
169
+		} else
164 170
 		{
165 171
 			// Uh oh, we just missed it. Try to claim another one, and let it fall through if there aren't any.
166 172
 			return fetch_task();
167 173
 		}
168
-	}
169
-	else
174
+	} else
170 175
 	{
171 176
 		// No dice. Clean up and go home.
172 177
 		$smcFunc['db_free_result']($request);
@@ -187,8 +192,9 @@  discard block
 block discarded – undo
187 192
 	if (!empty($task_details['task_file']))
188 193
 	{
189 194
 		$include = strtr(trim($task_details['task_file']), array('$boarddir' => $boarddir, '$sourcedir' => $sourcedir));
190
-		if (file_exists($include))
191
-			require_once($include);
195
+		if (file_exists($include)) {
196
+					require_once($include);
197
+		}
192 198
 	}
193 199
 
194 200
 	if (empty($task_details['task_class']))
@@ -204,8 +210,7 @@  discard block
 block discarded – undo
204 210
 		$details = empty($task_details['task_data']) ? array() : json_decode($task_details['task_data'], true);
205 211
 		$bgtask = new $task_details['task_class']($details);
206 212
 		return $bgtask->execute();
207
-	}
208
-	else
213
+	} else
209 214
 	{
210 215
 		log_error('Invalid background task specified: (class: ' . $task_details['task_class'] . ', ' . (empty($task_details['task_file']) ? ' no file' : ' to load ' . $task_details['task_file']) . ')');
211 216
 		return true; // So we clear it from the queue.
@@ -224,8 +229,9 @@  discard block
 block discarded – undo
224 229
 	$scripturl = $boardurl . '/index.php';
225 230
 
226 231
 	// These keys shouldn't be set...ever.
227
-	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
228
-		die('Invalid request variable.');
232
+	if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
233
+			die('Invalid request variable.');
234
+	}
229 235
 
230 236
 	// Save some memory.. (since we don't use these anyway.)
231 237
 	unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_VARS']);
@@ -246,26 +252,28 @@  discard block
 block discarded – undo
246 252
 	global $modSettings;
247 253
 
248 254
 	// Ignore errors if we're ignoring them or they are strict notices from PHP 5 (which cannot be solved without breaking PHP 4.)
249
-	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging'])))
250
-		return;
255
+	if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && !empty($modSettings['enableErrorLogging']))) {
256
+			return;
257
+	}
251 258
 
252 259
 	$error_type = 'cron';
253 260
 
254 261
 	log_error($error_level . ': ' . $error_string, $error_type, $file, $line);
255 262
 
256 263
 	// If this is an E_ERROR or E_USER_ERROR.... die.  Violently so.
257
-	if ($error_level % 255 == E_ERROR)
258
-		die('No direct access...');
259
-}
264
+	if ($error_level % 255 == E_ERROR) {
265
+			die('No direct access...');
266
+	}
267
+	}
260 268
 
261 269
 /**
262 270
  * The exit function
263 271
  */
264 272
 function obExit_cron()
265 273
 {
266
-	if (FROM_CLI)
267
-		die(0);
268
-	else
274
+	if (FROM_CLI) {
275
+			die(0);
276
+	} else
269 277
 	{
270 278
 		header('Content-Type: image/gif');
271 279
 		die("\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B");
Please login to merge, or discard this patch.
subscriptions.php 1 patch
Braces   +38 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 // Start things rolling by getting SMF alive...
18 18
 $ssi_guest_access = true;
19
-if (!file_exists(dirname(__FILE__) . '/SSI.php'))
19
+if (!file_exists(dirname(__FILE__) . '/SSI.php')) {
20 20
 	die('Cannot find SSI.php');
21
+}
21 22
 
22 23
 require_once(dirname(__FILE__) . '/SSI.php');
23 24
 require_once($sourcedir . '/ManagePaid.php');
@@ -35,20 +36,22 @@  discard block
 block discarded – undo
35 36
 }
36 37
 
37 38
 // I assume we're even active?
38
-if (empty($modSettings['paid_enabled']))
39
+if (empty($modSettings['paid_enabled'])) {
39 40
 	exit;
41
+}
40 42
 
41 43
 // If we have some custom people who find out about problems load them here.
42 44
 $notify_users = array();
43 45
 if (!empty($modSettings['paid_email_to']))
44 46
 {
45
-	foreach (explode(',', $modSettings['paid_email_to']) as $email)
46
-		$notify_users[] = array(
47
+	foreach (explode(',', $modSettings['paid_email_to']) as $email) {
48
+			$notify_users[] = array(
47 49
 			'email' => $email,
48 50
 			'name' => $txt['who_member'],
49 51
 			'id' => 0,
50 52
 		);
51
-}
53
+	}
54
+	}
52 55
 
53 56
 // We need to see whether we can find the correct payment gateway,
54 57
 // we'll going to go through all our gateway scripts and find out
@@ -65,8 +68,9 @@  discard block
 block discarded – undo
65 68
 	}
66 69
 }
67 70
 
68
-if (empty($txnType))
71
+if (empty($txnType)) {
69 72
 	generateSubscriptionError($txt['paid_unknown_transaction_type']);
73
+}
70 74
 
71 75
 // Get the subscription and member ID amoungst others...
72 76
 @list($subscription_id, $member_id) = $gatewayClass->precheck();
@@ -76,8 +80,9 @@  discard block
 block discarded – undo
76 80
 $member_id = (int) $member_id;
77 81
 
78 82
 // This would be bad...
79
-if (empty($member_id))
83
+if (empty($member_id)) {
80 84
 	generateSubscriptionError($txt['paid_empty_member']);
85
+}
81 86
 
82 87
 // Verify the member.
83 88
 $request = $smcFunc['db_query']('', '
@@ -89,8 +94,9 @@  discard block
 block discarded – undo
89 94
 	)
90 95
 );
91 96
 // Didn't find them?
92
-if ($smcFunc['db_num_rows']($request) === 0)
97
+if ($smcFunc['db_num_rows']($request) === 0) {
93 98
 	generateSubscriptionError(sprintf($txt['paid_could_not_find_member'], $member_id));
99
+}
94 100
 $member_info = $smcFunc['db_fetch_assoc']($request);
95 101
 $smcFunc['db_free_result']($request);
96 102
 
@@ -105,8 +111,9 @@  discard block
 block discarded – undo
105 111
 );
106 112
 
107 113
 // Didn't find it?
108
-if ($smcFunc['db_num_rows']($request) === 0)
114
+if ($smcFunc['db_num_rows']($request) === 0) {
109 115
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription'], $member_id, $subscription_id));
116
+}
110 117
 
111 118
 $subscription_info = $smcFunc['db_fetch_assoc']($request);
112 119
 $smcFunc['db_free_result']($request);
@@ -123,8 +130,9 @@  discard block
 block discarded – undo
123 130
 		'current_member' => $member_id,
124 131
 	)
125 132
 );
126
-if ($smcFunc['db_num_rows']($request) === 0)
133
+if ($smcFunc['db_num_rows']($request) === 0) {
127 134
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription_log'], $member_id, $subscription_id));
135
+}
128 136
 $subscription_info += $smcFunc['db_fetch_assoc']($request);
129 137
 $smcFunc['db_free_result']($request);
130 138
 
@@ -139,8 +147,7 @@  discard block
 block discarded – undo
139 147
 		removeSubscription($subscription_id, $member_id);
140 148
 		$subscription_act = time();
141 149
 		$status = 0;
142
-	}
143
-	else
150
+	} else
144 151
 	{
145 152
 		loadSubscriptions();
146 153
 		$subscription_act = $subscription_info['end_time'] - $context['subscriptions'][$subscription_id]['num_length'];
@@ -188,16 +195,18 @@  discard block
 block discarded – undo
188 195
 	if (!$gatewayClass->isSubscription())
189 196
 	{
190 197
 		$real_details = json_decode($subscription_info['pending_details'], true);
191
-		if (empty($real_details))
192
-			generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
198
+		if (empty($real_details)) {
199
+					generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
200
+		}
193 201
 
194 202
 		// Now we just try to find anything pending.
195 203
 		// We don't really care which it is as security happens later.
196 204
 		foreach ($real_details as $id => $detail)
197 205
 		{
198 206
 			unset($real_details[$id]);
199
-			if ($detail[3] == 'payback' && $subscription_info['payments_pending'])
200
-				$subscription_info['payments_pending']--;
207
+			if ($detail[3] == 'payback' && $subscription_info['payments_pending']) {
208
+							$subscription_info['payments_pending']--;
209
+			}
201 210
 			break;
202 211
 		}
203 212
 
@@ -223,10 +232,11 @@  discard block
 block discarded – undo
223 232
 		// This is a little harder, can we find the right duration?
224 233
 		foreach ($cost as $duration => $value)
225 234
 		{
226
-			if ($duration == 'fixed')
227
-				continue;
228
-			elseif ((float) $value == (float) $total_cost)
229
-				$found_duration = strtoupper(substr($duration, 0, 1));
235
+			if ($duration == 'fixed') {
236
+							continue;
237
+			} elseif ((float) $value == (float) $total_cost) {
238
+							$found_duration = strtoupper(substr($duration, 0, 1));
239
+			}
230 240
 		}
231 241
 
232 242
 		// If we have the duration then we're done.
@@ -235,8 +245,7 @@  discard block
 block discarded – undo
235 245
 			$notify = true;
236 246
 			addSubscription($subscription_id, $member_id, $found_duration);
237 247
 		}
238
-	}
239
-	else
248
+	} else
240 249
 	{
241 250
 		$actual_cost = $cost['fixed'];
242 251
 
@@ -268,10 +277,10 @@  discard block
 block discarded – undo
268 277
 // Maybe they're cancelling. Some subscriptions may require actively doing something, but PayPal doesn't, for example.
269 278
 elseif ($gatewayClass->isCancellation())
270 279
 {
271
-	if (method_exists($gatewayClass, 'performCancel'))
272
-		$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
273
-}
274
-else
280
+	if (method_exists($gatewayClass, 'performCancel')) {
281
+			$gatewayClass->performCancel($subscription_id, $member_id, $subscription_info);
282
+	}
283
+	} else
275 284
 {
276 285
 	// Some other "valid" transaction such as:
277 286
 	//
@@ -308,8 +317,9 @@  discard block
 block discarded – undo
308 317
 	// Maybe we can try to give them the post data?
309 318
 	if (!empty($_POST))
310 319
 	{
311
-		foreach ($_POST as $key => $val)
312
-			$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
320
+		foreach ($_POST as $key => $val) {
321
+					$text .= '<br>' . $smcFunc['htmlspecialchars']($key) . ': ' . $smcFunc['htmlspecialchars']($val);
322
+		}
313 323
 	}
314 324
 
315 325
 	// Then just log and die.
Please login to merge, or discard this patch.
Sources/Subs-Categories.php 1 patch
Braces   +44 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Edit the position and properties of a category.
@@ -42,8 +43,9 @@  discard block
 block discarded – undo
42 43
 		$cat_order = array();
43 44
 
44 45
 		// Setting 'move_after' to '0' moves the category to the top.
45
-		if ($catOptions['move_after'] == 0)
46
-			$cats[] = $category_id;
46
+		if ($catOptions['move_after'] == 0) {
47
+					$cats[] = $category_id;
48
+		}
47 49
 
48 50
 		// Grab the categories sorted by cat_order.
49 51
 		$request = $smcFunc['db_query']('', '
@@ -55,17 +57,19 @@  discard block
 block discarded – undo
55 57
 		);
56 58
 		while ($row = $smcFunc['db_fetch_assoc']($request))
57 59
 		{
58
-			if ($row['id_cat'] != $category_id)
59
-				$cats[] = $row['id_cat'];
60
-			if ($row['id_cat'] == $catOptions['move_after'])
61
-				$cats[] = $category_id;
60
+			if ($row['id_cat'] != $category_id) {
61
+							$cats[] = $row['id_cat'];
62
+			}
63
+			if ($row['id_cat'] == $catOptions['move_after']) {
64
+							$cats[] = $category_id;
65
+			}
62 66
 			$cat_order[$row['id_cat']] = $row['cat_order'];
63 67
 		}
64 68
 		$smcFunc['db_free_result']($request);
65 69
 
66 70
 		// Set the new order for the categories.
67
-		foreach ($cats as $index => $cat)
68
-			if ($index != $cat_order[$cat])
71
+		foreach ($cats as $index => $cat) {
72
+					if ($index != $cat_order[$cat])
69 73
 				$smcFunc['db_query']('', '
70 74
 					UPDATE {db_prefix}categories
71 75
 					SET cat_order = {int:new_order}
@@ -75,6 +79,7 @@  discard block
 block discarded – undo
75 79
 						'current_category' => $cat,
76 80
 					)
77 81
 				);
82
+		}
78 83
 
79 84
 		// If the category order changed, so did the board order.
80 85
 		require_once($sourcedir . '/Subs-Boards.php');
@@ -117,8 +122,9 @@  discard block
 block discarded – undo
117 122
 			))
118 123
 		);
119 124
 
120
-		if (empty($catOptions['dont_log']))
121
-			logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
125
+		if (empty($catOptions['dont_log'])) {
126
+					logAction('edit_cat', array('catname' => isset($catOptions['cat_name']) ? $catOptions['cat_name'] : $category_id), 'admin');
127
+		}
122 128
 	}
123 129
 }
124 130
 
@@ -135,16 +141,20 @@  discard block
 block discarded – undo
135 141
 	global $smcFunc;
136 142
 
137 143
 	// Check required values.
138
-	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '')
139
-		trigger_error('createCategory(): A category name is required', E_USER_ERROR);
144
+	if (!isset($catOptions['cat_name']) || trim($catOptions['cat_name']) == '') {
145
+			trigger_error('createCategory(): A category name is required', E_USER_ERROR);
146
+	}
140 147
 
141 148
 	// Set default values.
142
-	if (!isset($catOptions['cat_desc']))
143
-		$catOptions['cat_desc'] = '';
144
-	if (!isset($catOptions['move_after']))
145
-		$catOptions['move_after'] = 0;
146
-	if (!isset($catOptions['is_collapsible']))
147
-		$catOptions['is_collapsible'] = true;
149
+	if (!isset($catOptions['cat_desc'])) {
150
+			$catOptions['cat_desc'] = '';
151
+	}
152
+	if (!isset($catOptions['move_after'])) {
153
+			$catOptions['move_after'] = 0;
154
+	}
155
+	if (!isset($catOptions['is_collapsible'])) {
156
+			$catOptions['is_collapsible'] = true;
157
+	}
148 158
 	// Don't log an edit right after.
149 159
 	$catOptions['dont_log'] = true;
150 160
 
@@ -212,21 +222,24 @@  discard block
 block discarded – undo
212 222
 			)
213 223
 		);
214 224
 		$boards_inside = array();
215
-		while ($row = $smcFunc['db_fetch_assoc']($request))
216
-			$boards_inside[] = $row['id_board'];
225
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
226
+					$boards_inside[] = $row['id_board'];
227
+		}
217 228
 		$smcFunc['db_free_result']($request);
218 229
 
219
-		if (!empty($boards_inside))
220
-			deleteBoards($boards_inside, null);
230
+		if (!empty($boards_inside)) {
231
+					deleteBoards($boards_inside, null);
232
+		}
221 233
 	}
222 234
 
223 235
 	// Make sure the safe category is really safe.
224
-	elseif (in_array($moveBoardsTo, $categories))
225
-		trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
236
+	elseif (in_array($moveBoardsTo, $categories)) {
237
+			trigger_error('deleteCategories(): You cannot move the boards to a category that\'s being deleted', E_USER_ERROR);
238
+	}
226 239
 
227 240
 	// Move the boards inside the categories to a safe category.
228
-	else
229
-		$smcFunc['db_query']('', '
241
+	else {
242
+			$smcFunc['db_query']('', '
230 243
 			UPDATE {db_prefix}boards
231 244
 			SET id_cat = {int:new_parent_cat}
232 245
 			WHERE id_cat IN ({array_int:category_list})',
@@ -235,6 +248,7 @@  discard block
 block discarded – undo
235 248
 				'new_parent_cat' => $moveBoardsTo,
236 249
 			)
237 250
 		);
251
+	}
238 252
 
239 253
 	// Do the deletion of the category itself
240 254
 	$smcFunc['db_query']('', '
@@ -246,8 +260,9 @@  discard block
 block discarded – undo
246 260
 	);
247 261
 
248 262
 	// Log what we've done.
249
-	foreach ($categories as $category)
250
-		logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
263
+	foreach ($categories as $category) {
264
+			logAction('delete_cat', array('catname' => $cat_tree[$category]['node']['name']), 'admin');
265
+	}
251 266
 
252 267
 	// Get all boards back into the right order.
253 268
 	reorderBoards();
Please login to merge, or discard this patch.
Sources/Who.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 						'Shitiz &quot;Dragooon&quot; Garg',
591 591
 						'Karl &quot;RegularExpression&quot; Benson',
592 592
 						'Matthew &quot;Labradoodle-360&quot; Kerle',
593
-						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf': 'Grudge',
593
+						$user_info['is_admin'] ? 'Matt &quot;Grudge&quot; Wolf' : 'Grudge',
594 594
 						'Michael &quot;Thantos&quot; Miller',
595 595
 						'Norv',
596 596
 						'Peter "Arantor" Spicer',
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
 			$credit_info = smf_json_decode($row['credits'], true);
814 814
 
815 815
 			$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' &copy; ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
816
-			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
816
+			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
817 817
 			$version = $txt['credits_version'] . ' ' . $row['version'];
818 818
 			$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
819 819
 
820 820
 			// build this one out and stash it away
821 821
 			$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
822
-			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license  : '') . (!empty($copyright) ? ' | ' . $copyright  : '');
822
+			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
823 823
 		}
824 824
 		cache_put_data('mods_credits', $mods, 86400);
825 825
 	}
Please login to merge, or discard this patch.
Braces   +126 added lines, -95 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 3
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Who's online, and what are they doing?
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 	isAllowedTo('who_view');
36 37
 
37 38
 	// You can't do anything if this is off.
38
-	if (empty($modSettings['who_enabled']))
39
-		fatal_lang_error('who_off', false);
39
+	if (empty($modSettings['who_enabled'])) {
40
+			fatal_lang_error('who_off', false);
41
+	}
40 42
 
41 43
 	// Load the 'Who' template.
42 44
 	loadTemplate('Who');
@@ -71,9 +73,9 @@  discard block
 block discarded – undo
71 73
 		$show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
72 74
 		$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
73 75
 		$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
76
+	} elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') {
77
+			unset($_SESSION['who_online_filter']);
74 78
 	}
75
-	elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders')
76
-		unset($_SESSION['who_online_filter']);
77 79
 
78 80
 	// Does the user prefer a different sort direction?
79 81
 	if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']]))
@@ -97,20 +99,24 @@  discard block
 block discarded – undo
97 99
 	$context['sort_direction'] = isset($_REQUEST['asc']) || (isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc') ? 'up' : 'down';
98 100
 
99 101
 	$conditions = array();
100
-	if (!allowedTo('moderate_forum'))
101
-		$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
102
+	if (!allowedTo('moderate_forum')) {
103
+			$conditions[] = '(COALESCE(mem.show_online, 1) = 1)';
104
+	}
102 105
 
103 106
 	// Fallback to top filter?
104
-	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top']))
105
-		$_REQUEST['show'] = $_REQUEST['show_top'];
107
+	if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) {
108
+			$_REQUEST['show'] = $_REQUEST['show_top'];
109
+	}
106 110
 	// Does the user wish to apply a filter?
107
-	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']]))
108
-		$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
111
+	if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) {
112
+			$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
113
+	}
109 114
 	// Perhaps we saved a filter earlier in the session?
110
-	elseif (isset($_SESSION['who_online_filter']))
111
-		$context['show_by'] = $_SESSION['who_online_filter'];
112
-	else
113
-		$context['show_by'] = 'members';
115
+	elseif (isset($_SESSION['who_online_filter'])) {
116
+			$context['show_by'] = $_SESSION['who_online_filter'];
117
+	} else {
118
+			$context['show_by'] = 'members';
119
+	}
114 120
 
115 121
 	$conditions[] = $show_methods[$context['show_by']];
116 122
 
@@ -156,8 +162,9 @@  discard block
 block discarded – undo
156 162
 	while ($row = $smcFunc['db_fetch_assoc']($request))
157 163
 	{
158 164
 		$actions = smf_json_decode($row['url'], true);
159
-		if ($actions === false)
160
-			continue;
165
+		if ($actions === false) {
166
+					continue;
167
+		}
161 168
 
162 169
 		// Send the information to the template.
163 170
 		$context['members'][$row['session']] = array(
@@ -195,8 +202,8 @@  discard block
 block discarded – undo
195 202
 	$spiderContext = array();
196 203
 	if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
197 204
 	{
198
-		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name)
199
-			$spiderContext[$id] = array(
205
+		foreach (smf_json_decode($modSettings['spider_name_cache'], true) as $id => $name) {
206
+					$spiderContext[$id] = array(
200 207
 				'id' => 0,
201 208
 				'name' => $name,
202 209
 				'group' => $txt['spiders'],
@@ -205,6 +212,7 @@  discard block
 block discarded – undo
205 212
 				'email' => $name,
206 213
 				'is_guest' => true
207 214
 			);
215
+		}
208 216
 	}
209 217
 
210 218
 	$url_data = determineActions($url_data);
@@ -219,16 +227,18 @@  discard block
 block discarded – undo
219 227
 	// Put it in the context variables.
220 228
 	foreach ($context['members'] as $i => $member)
221 229
 	{
222
-		if ($member['id'] != 0)
223
-			$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
230
+		if ($member['id'] != 0) {
231
+					$member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
232
+		}
224 233
 
225 234
 		// Keep the IP that came from the database.
226 235
 		$memberContext[$member['id']]['ip'] = $member['ip'];
227 236
 		$context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
228
-		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']]))
229
-			$context['members'][$i] += $spiderContext[$member['id_spider']];
230
-		else
231
-			$context['members'][$i] += $memberContext[$member['id']];
237
+		if ($member['id'] == 0 && isset($spiderContext[$member['id_spider']])) {
238
+					$context['members'][$i] += $spiderContext[$member['id_spider']];
239
+		} else {
240
+					$context['members'][$i] += $memberContext[$member['id']];
241
+		}
232 242
 	}
233 243
 
234 244
 	// Some people can't send personal messages...
@@ -263,8 +273,9 @@  discard block
 block discarded – undo
263 273
 {
264 274
 	global $txt, $user_info, $modSettings, $smcFunc;
265 275
 
266
-	if (!allowedTo('who_view'))
267
-		return array();
276
+	if (!allowedTo('who_view')) {
277
+			return array();
278
+	}
268 279
 	loadLanguage('Who');
269 280
 
270 281
 	// Actions that require a specific permission level.
@@ -292,10 +303,11 @@  discard block
 block discarded – undo
292 303
 	);
293 304
 	call_integration_hook('who_allowed', array(&$allowedActions));
294 305
 
295
-	if (!is_array($urls))
296
-		$url_list = array(array($urls, $user_info['id']));
297
-	else
298
-		$url_list = $urls;
306
+	if (!is_array($urls)) {
307
+			$url_list = array(array($urls, $user_info['id']));
308
+	} else {
309
+			$url_list = $urls;
310
+	}
299 311
 
300 312
 	// These are done to later query these in large chunks. (instead of one by one.)
301 313
 	$topic_ids = array();
@@ -307,12 +319,14 @@  discard block
 block discarded – undo
307 319
 	{
308 320
 		// Get the request parameters..
309 321
 		$actions = smf_json_decode($url[0], true);
310
-		if ($actions === false)
311
-			continue;
322
+		if ($actions === false) {
323
+					continue;
324
+		}
312 325
 
313 326
 		// If it's the admin or moderation center, and there is an area set, use that instead.
314
-		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area']))
315
-			$actions['action'] = $actions['area'];
327
+		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area'])) {
328
+					$actions['action'] = $actions['area'];
329
+		}
316 330
 
317 331
 		// Check if there was no action or the action is display.
318 332
 		if (!isset($actions['action']) || $actions['action'] == 'display')
@@ -332,12 +346,14 @@  discard block
 block discarded – undo
332 346
 				$board_ids[$actions['board']][$k] = $txt['who_board'];
333 347
 			}
334 348
 			// It's the board index!!  It must be!
335
-			else
336
-				$data[$k] = $txt['who_index'];
349
+			else {
350
+							$data[$k] = $txt['who_index'];
351
+			}
337 352
 		}
338 353
 		// Probably an error or some goon?
339
-		elseif ($actions['action'] == '')
340
-			$data[$k] = $txt['who_index'];
354
+		elseif ($actions['action'] == '') {
355
+					$data[$k] = $txt['who_index'];
356
+		}
341 357
 		// Some other normal action...?
342 358
 		else
343 359
 		{
@@ -345,23 +361,25 @@  discard block
 block discarded – undo
345 361
 			if ($actions['action'] == 'profile')
346 362
 			{
347 363
 				// Whose?  Their own?
348
-				if (empty($actions['u']))
349
-					$actions['u'] = $url[1];
364
+				if (empty($actions['u'])) {
365
+									$actions['u'] = $url[1];
366
+				}
350 367
 
351 368
 				$data[$k] = $txt['who_hidden'];
352 369
 				$profile_ids[(int) $actions['u']][$k] = $actions['u'] == $url[1] ? $txt['who_viewownprofile'] : $txt['who_viewprofile'];
353
-			}
354
-			elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
370
+			} elseif (($actions['action'] == 'post' || $actions['action'] == 'post2') && empty($actions['topic']) && isset($actions['board']))
355 371
 			{
356 372
 				$data[$k] = $txt['who_hidden'];
357 373
 				$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
358 374
 			}
359 375
 			// A subaction anyone can view... if the language string is there, show it.
360
-			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']]))
361
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
376
+			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']])) {
377
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
378
+			}
362 379
 			// An action any old fellow can look at. (if ['whoall_' . $action] exists, we know everyone can see it.)
363
-			elseif (isset($txt['whoall_' . $actions['action']]))
364
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
380
+			elseif (isset($txt['whoall_' . $actions['action']])) {
381
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : $txt['whoall_' . $actions['action']];
382
+			}
365 383
 			// Viewable if and only if they can see the board...
366 384
 			elseif (isset($txt['whotopic_' . $actions['action']]))
367 385
 			{
@@ -370,8 +388,7 @@  discard block
 block discarded – undo
370 388
 
371 389
 				$data[$k] = $txt['who_hidden'];
372 390
 				$topic_ids[$topic][$k] = $txt['whotopic_' . $actions['action']];
373
-			}
374
-			elseif (isset($txt['whopost_' . $actions['action']]))
391
+			} elseif (isset($txt['whopost_' . $actions['action']]))
375 392
 			{
376 393
 				// Find out what message they are accessing.
377 394
 				$msgid = (int) (isset($actions['msg']) ? $actions['msg'] : (isset($actions['quote']) ? $actions['quote'] : 0));
@@ -394,41 +411,46 @@  discard block
 block discarded – undo
394 411
 				$data[$k] = sprintf($txt['whopost_' . $actions['action']], $id_topic, $subject);
395 412
 				$smcFunc['db_free_result']($result);
396 413
 
397
-				if (empty($id_topic))
398
-					$data[$k] = $txt['who_hidden'];
414
+				if (empty($id_topic)) {
415
+									$data[$k] = $txt['who_hidden'];
416
+				}
399 417
 			}
400 418
 			// Viewable only by administrators.. (if it starts with whoadmin, it's admin only!)
401
-			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']]))
402
-				$data[$k] = $txt['whoadmin_' . $actions['action']];
419
+			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']])) {
420
+							$data[$k] = $txt['whoadmin_' . $actions['action']];
421
+			}
403 422
 			// Viewable by permission level.
404 423
 			elseif (isset($allowedActions[$actions['action']]))
405 424
 			{
406
-				if (allowedTo($allowedActions[$actions['action']]))
407
-					$data[$k] = $txt['whoallow_' . $actions['action']];
408
-				elseif (in_array('moderate_forum', $allowedActions[$actions['action']]))
409
-					$data[$k] = $txt['who_moderate'];
410
-				elseif (in_array('admin_forum', $allowedActions[$actions['action']]))
411
-					$data[$k] = $txt['who_admin'];
412
-				else
413
-					$data[$k] = $txt['who_hidden'];
425
+				if (allowedTo($allowedActions[$actions['action']])) {
426
+									$data[$k] = $txt['whoallow_' . $actions['action']];
427
+				} elseif (in_array('moderate_forum', $allowedActions[$actions['action']])) {
428
+									$data[$k] = $txt['who_moderate'];
429
+				} elseif (in_array('admin_forum', $allowedActions[$actions['action']])) {
430
+									$data[$k] = $txt['who_admin'];
431
+				} else {
432
+									$data[$k] = $txt['who_hidden'];
433
+				}
434
+			} elseif (!empty($actions['action'])) {
435
+							$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
436
+			} else {
437
+							$data[$k] = $txt['who_unknown'];
414 438
 			}
415
-			elseif (!empty($actions['action']))
416
-				$data[$k] = $txt['who_generic'] . ' ' . $actions['action'];
417
-			else
418
-				$data[$k] = $txt['who_unknown'];
419 439
 		}
420 440
 
421 441
 		if (isset($actions['error']))
422 442
 		{
423
-			if (isset($txt[$actions['error']]))
424
-				$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
425
-			elseif ($actions['error'] == 'guest_login')
426
-				$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
427
-			else
428
-				$error_message = str_replace('"', '&quot;', $actions['error']);
429
-
430
-			if (!empty($error_message))
431
-				$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
443
+			if (isset($txt[$actions['error']])) {
444
+							$error_message = str_replace('"', '&quot;', empty($actions['who_error_params']) ? $txt[$actions['error']] : vsprintf($txt[$actions['error']], $actions['who_error_params']));
445
+			} elseif ($actions['error'] == 'guest_login') {
446
+							$error_message = str_replace('"', '&quot;', $txt['who_guest_login']);
447
+			} else {
448
+							$error_message = str_replace('"', '&quot;', $actions['error']);
449
+			}
450
+
451
+			if (!empty($error_message)) {
452
+							$data[$k] .= ' <span class="generic_icons error" title="' . $error_message . '"></span>';
453
+			}
432 454
 		}
433 455
 
434 456
 		// Maybe the action is integrated into another system?
@@ -439,12 +461,15 @@  discard block
 block discarded – undo
439 461
 				if (!empty($integrate_action))
440 462
 				{
441 463
 					$data[$k] = $integrate_action;
442
-					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k]))
443
-						$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
444
-					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k]))
445
-						$board_ids[(int) $actions['board']][$k] = $integrate_action;
446
-					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k]))
447
-						$profile_ids[(int) $actions['u']][$k] = $integrate_action;
464
+					if (isset($actions['topic']) && isset($topic_ids[(int) $actions['topic']][$k])) {
465
+											$topic_ids[(int) $actions['topic']][$k] = $integrate_action;
466
+					}
467
+					if (isset($actions['board']) && isset($board_ids[(int) $actions['board']][$k])) {
468
+											$board_ids[(int) $actions['board']][$k] = $integrate_action;
469
+					}
470
+					if (isset($actions['u']) && isset($profile_ids[(int) $actions['u']][$k])) {
471
+											$profile_ids[(int) $actions['u']][$k] = $integrate_action;
472
+					}
448 473
 					break;
449 474
 				}
450 475
 			}
@@ -472,8 +497,9 @@  discard block
 block discarded – undo
472 497
 		while ($row = $smcFunc['db_fetch_assoc']($result))
473 498
 		{
474 499
 			// Show the topic's subject for each of the actions.
475
-			foreach ($topic_ids[$row['id_topic']] as $k => $session_text)
476
-				$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
500
+			foreach ($topic_ids[$row['id_topic']] as $k => $session_text) {
501
+							$data[$k] = sprintf($session_text, $row['id_topic'], censorText($row['subject']));
502
+			}
477 503
 		}
478 504
 		$smcFunc['db_free_result']($result);
479 505
 	}
@@ -495,8 +521,9 @@  discard block
 block discarded – undo
495 521
 		while ($row = $smcFunc['db_fetch_assoc']($result))
496 522
 		{
497 523
 			// Put the board name into the string for each member...
498
-			foreach ($board_ids[$row['id_board']] as $k => $session_text)
499
-				$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
524
+			foreach ($board_ids[$row['id_board']] as $k => $session_text) {
525
+							$data[$k] = sprintf($session_text, $row['id_board'], $row['name']);
526
+			}
500 527
 		}
501 528
 		$smcFunc['db_free_result']($result);
502 529
 	}
@@ -518,23 +545,26 @@  discard block
 block discarded – undo
518 545
 		while ($row = $smcFunc['db_fetch_assoc']($result))
519 546
 		{
520 547
 			// If they aren't allowed to view this person's profile, skip it.
521
-			if (!$allow_view_any && ($user_info['id'] != $row['id_member']))
522
-				continue;
548
+			if (!$allow_view_any && ($user_info['id'] != $row['id_member'])) {
549
+							continue;
550
+			}
523 551
 
524 552
 			// Set their action on each - session/text to sprintf.
525
-			foreach ($profile_ids[$row['id_member']] as $k => $session_text)
526
-				$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
553
+			foreach ($profile_ids[$row['id_member']] as $k => $session_text) {
554
+							$data[$k] = sprintf($session_text, $row['id_member'], $row['real_name']);
555
+			}
527 556
 		}
528 557
 		$smcFunc['db_free_result']($result);
529 558
 	}
530 559
 
531 560
 	call_integration_hook('whos_online_after', array(&$urls, &$data));
532 561
 
533
-	if (!is_array($urls))
534
-		return isset($data[0]) ? $data[0] : false;
535
-	else
536
-		return $data;
537
-}
562
+	if (!is_array($urls)) {
563
+			return isset($data[0]) ? $data[0] : false;
564
+	} else {
565
+			return $data;
566
+	}
567
+	}
538 568
 
539 569
 /**
540 570
  * It prepares credit and copyright information for the credits page or the admin page
@@ -709,8 +739,8 @@  discard block
 block discarded – undo
709 739
 	);
710 740
 
711 741
 	// Give the translators some credit for their hard work.
712
-	if (!empty($txt['translation_credits']))
713
-		$context['credits'][] = array(
742
+	if (!empty($txt['translation_credits'])) {
743
+			$context['credits'][] = array(
714 744
 			'title' => $txt['credits_groups_translation'],
715 745
 			'groups' => array(
716 746
 				array(
@@ -719,6 +749,7 @@  discard block
 block discarded – undo
719 749
 				),
720 750
 			),
721 751
 		);
752
+	}
722 753
 
723 754
 	$context['credits'][] = array(
724 755
 		'title' => $txt['credits_special'],
Please login to merge, or discard this patch.
Sources/Subs-Recent.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 3
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Get the latest posts of a forum.
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 		censorText($row['body']);
60 61
 
61 62
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
62
-		if ($smcFunc['strlen']($row['body']) > 128)
63
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
63
+		if ($smcFunc['strlen']($row['body']) > 128) {
64
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
65
+		}
64 66
 
65 67
 		// Build the array.
66 68
 		$posts[] = array(
Please login to merge, or discard this patch.