Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/admin/ManageMembers.controller.php 2 patches
Braces   +153 added lines, -60 removed lines patch added patch discarded remove patch
@@ -99,9 +99,13 @@  discard block
 block discarded – undo
99 99
 		foreach ($context['activation_numbers'] as $activation_type => $total_members)
100 100
 		{
101 101
 			if (in_array($activation_type, array(0, 2)))
102
-				$context['awaiting_activation'] += $total_members;
102
+			{
103
+							$context['awaiting_activation'] += $total_members;
104
+			}
103 105
 			elseif (in_array($activation_type, array(3, 4, 5)))
104
-				$context['awaiting_approval'] += $total_members;
106
+			{
107
+							$context['awaiting_approval'] += $total_members;
108
+			}
105 109
 		}
106 110
 
107 111
 		// For the page header... do we show activation?
@@ -160,7 +164,9 @@  discard block
 block discarded – undo
160 164
 		if (!$context['show_approve'] && ($subAction !== 'browse' || $this->_req->query->type !== 'approve'))
161 165
 		{
162 166
 			if (!$context['show_activate'] && ($subAction !== 'browse' || $this->_req->query->type !== 'activate'))
163
-				$context['tabs']['search']['is_last'] = true;
167
+			{
168
+							$context['tabs']['search']['is_last'] = true;
169
+			}
164 170
 			unset($context['tabs']['approve']);
165 171
 		}
166 172
 
@@ -193,7 +199,9 @@  discard block
 block discarded – undo
193 199
 
194 200
 		// Are we performing a mass action?
195 201
 		if (isset($this->_req->post->maction_on_members, $this->_req->post->maction) && !empty($this->_req->post->members))
196
-			$this->_multiMembersAction();
202
+		{
203
+					$this->_multiMembersAction();
204
+		}
197 205
 
198 206
 		// Check input after a member search has been submitted.
199 207
 		if ($context['sub_action'] === 'query')
@@ -267,14 +275,18 @@  discard block
 block discarded – undo
267 275
 
268 276
 			$search_params = array();
269 277
 			if ($context['sub_action'] === 'query' && !empty($this->_req->query->params) && empty($this->_req->post->types))
270
-				$search_params = @json_decode(base64_decode($this->_req->query->params), true);
278
+			{
279
+							$search_params = @json_decode(base64_decode($this->_req->query->params), true);
280
+			}
271 281
 			elseif (!empty($this->_req->post))
272 282
 			{
273 283
 				$search_params['types'] = $this->_req->post->types;
274 284
 				foreach ($params as $param_name => $param_info)
275 285
 				{
276 286
 					if (isset($this->_req->post->{$param_name}))
277
-						$search_params[$param_name] = $this->_req->post->{$param_name};
287
+					{
288
+											$search_params[$param_name] = $this->_req->post->{$param_name};
289
+					}
278 290
 				}
279 291
 			}
280 292
 
@@ -288,17 +300,23 @@  discard block
 block discarded – undo
288 300
 			{
289 301
 				// Not filled in?
290 302
 				if (!isset($search_params[$param_name]) || $search_params[$param_name] === '')
291
-					continue;
303
+				{
304
+									continue;
305
+				}
292 306
 
293 307
 				// Make sure numeric values are really numeric.
294 308
 				if (in_array($param_info['type'], array('int', 'age')))
295
-					$search_params[$param_name] = (int) $search_params[$param_name];
309
+				{
310
+									$search_params[$param_name] = (int) $search_params[$param_name];
311
+				}
296 312
 				// Date values have to match the specified format.
297 313
 				elseif ($param_info['type'] === 'date')
298 314
 				{
299 315
 					// Check if this date format is valid.
300 316
 					if (preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $search_params[$param_name]) == 0)
301
-						continue;
317
+					{
318
+											continue;
319
+					}
302 320
 
303 321
 					$search_params[$param_name] = strtotime($search_params[$param_name]);
304 322
 				}
@@ -308,7 +326,9 @@  discard block
 block discarded – undo
308 326
 				{
309 327
 					// Default to '=', just in case...
310 328
 					if (empty($range_trans[$search_params['types'][$param_name]]))
311
-						$search_params['types'][$param_name] = '=';
329
+					{
330
+											$search_params['types'][$param_name] = '=';
331
+					}
312 332
 
313 333
 					// Handle special case 'age'.
314 334
 					if ($param_info['type'] === 'age')
@@ -337,15 +357,18 @@  discard block
 block discarded – undo
337 357
 					{
338 358
 						$query_parts[] = $param_info['db_fields'][0] . ' > ' . $search_params[$param_name] . ' AND ' . $param_info['db_fields'][0] . ' < ' . ($search_params[$param_name] + 86400);
339 359
 					}
340
-					else
341
-						$query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name];
360
+					else {
361
+											$query_parts[] = $param_info['db_fields'][0] . ' ' . $range_trans[$search_params['types'][$param_name]] . ' ' . $search_params[$param_name];
362
+					}
342 363
 				}
343 364
 				// Checkboxes.
344 365
 				elseif ($param_info['type'] === 'checkbox')
345 366
 				{
346 367
 					// Each checkbox or no checkbox at all is checked -> ignore.
347 368
 					if (!is_array($search_params[$param_name]) || count($search_params[$param_name]) == 0 || count($search_params[$param_name]) == count($param_info['values']))
348
-						continue;
369
+					{
370
+											continue;
371
+					}
349 372
 
350 373
 					$query_parts[] = ($param_info['db_fields'][0]) . ' IN ({array_string:' . $param_name . '_check})';
351 374
 					$where_params[$param_name . '_check'] = $search_params[$param_name];
@@ -356,9 +379,12 @@  discard block
 block discarded – undo
356 379
 					$parameter = strtolower(strtr(Util::htmlspecialchars($search_params[$param_name], ENT_QUOTES), array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_')));
357 380
 
358 381
 					if (defined('DB_CASE_SENSITIVE'))
359
-						$query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})';
360
-					else
361
-						$query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})';
382
+					{
383
+											$query_parts[] = '(LOWER(' . implode(') LIKE {string:' . $param_name . '_normal} OR LOWER(', $param_info['db_fields']) . ') LIKE {string:' . $param_name . '_normal})';
384
+					}
385
+					else {
386
+											$query_parts[] = '(' . implode(' LIKE {string:' . $param_name . '_normal} OR ', $param_info['db_fields']) . ' LIKE {string:' . $param_name . '_normal})';
387
+					}
362 388
 
363 389
 					$where_params[$param_name . '_normal'] = '%' . $parameter . '%';
364 390
 				}
@@ -376,15 +402,19 @@  discard block
 block discarded – undo
376 402
 
377 403
 			// Additional membergroups (these are only relevant if not all primary groups where selected!).
378 404
 			if (!empty($search_params['membergroups'][2]) && (empty($search_params['membergroups'][1]) || count($context['membergroups']) != count($search_params['membergroups'][1])))
379
-				foreach ($search_params['membergroups'][2] as $mg)
405
+			{
406
+							foreach ($search_params['membergroups'][2] as $mg)
380 407
 				{
381 408
 					$mg_query_parts[] = 'FIND_IN_SET({int:add_group_' . $mg . '}, mem.additional_groups) != 0';
409
+			}
382 410
 					$where_params['add_group_' . $mg] = $mg;
383 411
 				}
384 412
 
385 413
 			// Combine the one or two membergroup parts into one query part linked with an OR.
386 414
 			if (!empty($mg_query_parts))
387
-				$query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')';
415
+			{
416
+							$query_parts[] = '(' . implode(' OR ', $mg_query_parts) . ')';
417
+			}
388 418
 
389 419
 			// Get all selected post count related membergroups.
390 420
 			if (!empty($search_params['postgroups']) && count($search_params['postgroups']) != count($context['postgroups']))
@@ -397,8 +427,9 @@  discard block
 block discarded – undo
397 427
 			$where = empty($query_parts) ? '1=1' : implode('
398 428
 				AND ', $query_parts);
399 429
 		}
400
-		else
401
-			$search_url_params = null;
430
+		else {
431
+					$search_url_params = null;
432
+		}
402 433
 
403 434
 		// Construct the additional URL part with the query info in it.
404 435
 		$context['params_url'] = $context['sub_action'] === 'query' ? ';sa=query;params=' . $search_url_params : '';
@@ -523,7 +554,9 @@  discard block
 block discarded – undo
523 554
 
524 555
 							// Calculate number of days since last online.
525 556
 							if (empty($rowData['last_login']))
526
-								$difference = $txt['never'];
557
+							{
558
+															$difference = $txt['never'];
559
+							}
527 560
 							else
528 561
 							{
529 562
 								$difference = htmlTime($rowData['last_login']);
@@ -531,7 +564,9 @@  discard block
 block discarded – undo
531 564
 
532 565
 							// Show it in italics if they're not activated...
533 566
 							if ($rowData['is_activated'] % 10 != 1)
534
-								$difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference);
567
+							{
568
+															$difference = sprintf('<em title="%1$s">%2$s</em>', $txt['not_activated'], $difference);
569
+							}
535 570
 
536 571
 							return $difference;
537 572
 						},
@@ -584,7 +619,9 @@  discard block
 block discarded – undo
584 619
 
585 620
 		// Without enough permissions, don't show 'delete members' checkboxes.
586 621
 		if (!allowedTo('profile_remove_any'))
587
-			unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']);
622
+		{
623
+					unset($listOptions['cols']['check'], $listOptions['form'], $listOptions['additional_rows']);
624
+		}
588 625
 
589 626
 		createList($listOptions);
590 627
 
@@ -612,7 +649,9 @@  discard block
 block discarded – undo
612 649
 		{
613 650
 			// Don't delete yourself, idiot.
614 651
 			if ($this->_req->post->maction === 'delete' && $value == $user_info['id'])
615
-				continue;
652
+			{
653
+							continue;
654
+			}
616 655
 
617 656
 			$members[] = (int) $value;
618 657
 		}
@@ -620,7 +659,9 @@  discard block
 block discarded – undo
620 659
 
621 660
 		// No members, nothing to do.
622 661
 		if (empty($members))
623
-			return;
662
+		{
663
+					return;
664
+		}
624 665
 
625 666
 		// Are we performing a delete?
626 667
 		if ($this->_req->post->maction === 'delete' && allowedTo('profile_remove_any'))
@@ -641,15 +682,21 @@  discard block
 block discarded – undo
641 682
 				if ($this->_req->post->maction == $group . 'group' && !empty($this->_req->post->new_membergroup))
642 683
 				{
643 684
 					if ($group === 'p')
644
-						$type = 'force_primary';
645
-					else
646
-						$type = 'only_additional';
685
+					{
686
+											$type = 'force_primary';
687
+					}
688
+					else {
689
+											$type = 'only_additional';
690
+					}
647 691
 
648 692
 					// Change all the selected members' group.
649 693
 					if ($this->_req->post->new_membergroup != -1)
650
-						addMembersToGroup($members, $this->_req->post->new_membergroup, $type, true);
651
-					else
652
-						removeMembersFromGroups($members, null, true);
694
+					{
695
+											addMembersToGroup($members, $this->_req->post->new_membergroup, $type, true);
696
+					}
697
+					else {
698
+											removeMembersFromGroups($members, null, true);
699
+					}
653 700
 				}
654 701
 			}
655 702
 		}
@@ -679,11 +726,17 @@  discard block
 block discarded – undo
679 726
 			$suggestions = array();
680 727
 
681 728
 			if ($ban_email)
682
-				$suggestions[] = 'email';
729
+			{
730
+							$suggestions[] = 'email';
731
+			}
683 732
 			if ($ban_name)
684
-				$suggestions[] = 'user';
733
+			{
734
+							$suggestions[] = 'user';
735
+			}
685 736
 			if ($ban_ips)
686
-				$suggestions[] = 'main_ip';
737
+			{
738
+							$suggestions[] = 'main_ip';
739
+			}
687 740
 
688 741
 			$members_data = getBasicMemberData($members, array('moderation' => true));
689 742
 			foreach ($members_data as $member)
@@ -750,7 +803,9 @@  discard block
 block discarded – undo
750 803
 		$context['browse_type'] = isset($this->_req->query->type) ? $this->_req->query->type : (!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 ? 'activate' : 'approve');
751 804
 
752 805
 		if (isset($context['tabs'][$context['browse_type']]))
753
-			$context['tabs'][$context['browse_type']]['is_selected'] = true;
806
+		{
807
+					$context['tabs'][$context['browse_type']]['is_selected'] = true;
808
+		}
754 809
 
755 810
 		// Allowed filters are those we can have, in theory.
756 811
 		$context['allowed_filters'] = $context['browse_type'] === 'approve' ? array(3, 4, 5) : array(0, 2);
@@ -762,12 +817,14 @@  discard block
 block discarded – undo
762 817
 		{
763 818
 			// We have some of these...
764 819
 			if (in_array($type, $context['allowed_filters']) && $amount > 0)
765
-				$context['available_filters'][] = array(
820
+			{
821
+							$context['available_filters'][] = array(
766 822
 					'type' => $type,
767 823
 					'amount' => $amount,
768 824
 					'desc' => isset($txt['admin_browse_filter_type_' . $type]) ? $txt['admin_browse_filter_type_' . $type] : '?',
769 825
 					'selected' => $type == $context['current_filter']
770 826
 				);
827
+			}
771 828
 		}
772 829
 
773 830
 		// If the filter was not sent, set it to whatever has people in it!
@@ -791,7 +848,9 @@  discard block
 block discarded – undo
791 848
 
792 849
 		// Are we showing duplicate information?
793 850
 		if (isset($this->_req->query->showdupes))
794
-			$_SESSION['showdupes'] = (int) $this->_req->query->showdupes;
851
+		{
852
+					$_SESSION['showdupes'] = (int) $this->_req->query->showdupes;
853
+		}
795 854
 		$context['show_duplicates'] = !empty($_SESSION['showdupes']);
796 855
 
797 856
 		// Determine which actions we should allow on this page.
@@ -799,27 +858,32 @@  discard block
 block discarded – undo
799 858
 		{
800 859
 			// If we are approving deleted accounts we have a slightly different list... actually a mirror ;)
801 860
 			if ($context['current_filter'] == 4)
802
-				$context['allowed_actions'] = array(
861
+			{
862
+							$context['allowed_actions'] = array(
803 863
 					'reject' => $txt['admin_browse_w_approve_deletion'],
804 864
 					'ok' => $txt['admin_browse_w_reject'],
805 865
 				);
806
-			else
807
-				$context['allowed_actions'] = array(
866
+			}
867
+			else {
868
+							$context['allowed_actions'] = array(
808 869
 					'ok' => $txt['admin_browse_w_approve'],
809 870
 					'okemail' => $txt['admin_browse_w_approve'] . ' ' . $txt['admin_browse_w_email'],
810 871
 					'require_activation' => $txt['admin_browse_w_approve_require_activate'],
811 872
 					'reject' => $txt['admin_browse_w_reject'],
812 873
 					'rejectemail' => $txt['admin_browse_w_reject'] . ' ' . $txt['admin_browse_w_email'],
813 874
 				);
875
+			}
814 876
 		}
815 877
 		elseif ($context['browse_type'] === 'activate')
816
-			$context['allowed_actions'] = array(
878
+		{
879
+					$context['allowed_actions'] = array(
817 880
 				'ok' => $txt['admin_browse_w_activate'],
818 881
 				'okemail' => $txt['admin_browse_w_activate'] . ' ' . $txt['admin_browse_w_email'],
819 882
 				'delete' => $txt['admin_browse_w_delete'],
820 883
 				'deleteemail' => $txt['admin_browse_w_delete'] . ' ' . $txt['admin_browse_w_email'],
821 884
 				'remind' => $txt['admin_browse_w_remind'] . ' ' . $txt['admin_browse_w_email'],
822 885
 			);
886
+		}
823 887
 
824 888
 		// Create an option list for actions allowed to be done with selected members.
825 889
 		$allowed_actions = '
@@ -827,8 +891,10 @@  discard block
 block discarded – undo
827 891
 				<option value="" disabled="disabled">' . str_repeat('&#8212;', strlen($txt['admin_browse_with_selected'])) . '</option>';
828 892
 
829 893
 		foreach ($context['allowed_actions'] as $key => $desc)
830
-			$allowed_actions .= '
894
+		{
895
+					$allowed_actions .= '
831 896
 				<option value="' . $key . '">' . '&#10148;&nbsp;' . $desc . '</option>';
897
+		}
832 898
 
833 899
 		// Setup the Javascript function for selecting an action for the list.
834 900
 		$javascript = '
@@ -841,14 +907,16 @@  discard block
 block discarded – undo
841 907
 
842 908
 		// We have special messages for approving deletion of accounts - it's surprisingly logical - honest.
843 909
 		if ($context['current_filter'] == 4)
844
-			$javascript .= '
910
+		{
911
+					$javascript .= '
845 912
 				if (document.forms.postForm.todo.value.indexOf("reject") != -1)
846 913
 					message = "' . $txt['admin_browse_w_delete'] . '";
847 914
 				else
848 915
 					message = "' . $txt['admin_browse_w_reject'] . '";';
916
+		}
849 917
 		// Otherwise a nice standard message.
850
-		else
851
-			$javascript .= '
918
+		else {
919
+					$javascript .= '
852 920
 				if (document.forms.postForm.todo.value.indexOf("delete") != -1)
853 921
 					message = "' . $txt['admin_browse_w_delete'] . '";
854 922
 				else if (document.forms.postForm.todo.value.indexOf("reject") != -1)
@@ -857,6 +925,7 @@  discard block
 block discarded – undo
857 925
 					message = "' . $txt['admin_browse_w_remind'] . '";
858 926
 				else
859 927
 					message = "' . ($context['browse_type'] === 'approve' ? $txt['admin_browse_w_approve'] : $txt['admin_browse_w_activate']) . '";';
928
+		}
860 929
 		$javascript .= '
861 930
 				if (confirm(message + " ' . $txt['admin_browse_warn'] . '"))
862 931
 					document.forms.postForm.submit();
@@ -990,9 +1059,12 @@  discard block
 block discarded – undo
990 1059
 							foreach ($rowData['duplicate_members'] as $member)
991 1060
 							{
992 1061
 								if ($member['id'])
993
-									$member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="alert"' : '') . '>' . $member['name'] . '</a>';
994
-								else
995
-									$member_links[] = $member['name'] . ' (' . $txt['guest'] . ')';
1062
+								{
1063
+																	$member_links[] = '<a href="' . $scripturl . '?action=profile;u=' . $member['id'] . '" ' . (!empty($member['is_banned']) ? 'class="alert"' : '') . '>' . $member['name'] . '</a>';
1064
+								}
1065
+								else {
1066
+																	$member_links[] = $member['name'] . ' (' . $txt['guest'] . ')';
1067
+								}
996 1068
 							}
997 1069
 							return implode(', ', $member_links);
998 1070
 						},
@@ -1045,13 +1117,18 @@  discard block
 block discarded – undo
1045 1117
 
1046 1118
 		// Pick what column to actually include if we're showing duplicates.
1047 1119
 		if ($context['show_duplicates'])
1048
-			unset($listOptions['columns']['email']);
1049
-		else
1050
-			unset($listOptions['columns']['duplicates']);
1120
+		{
1121
+					unset($listOptions['columns']['email']);
1122
+		}
1123
+		else {
1124
+					unset($listOptions['columns']['duplicates']);
1125
+		}
1051 1126
 
1052 1127
 		// Only show hostname on duplicates as it takes a lot of time.
1053 1128
 		if (!$context['show_duplicates'] || !empty($modSettings['disableHostnameLookup']))
1054
-			unset($listOptions['columns']['hostname']);
1129
+		{
1130
+					unset($listOptions['columns']['hostname']);
1131
+		}
1055 1132
 
1056 1133
 		// Is there any need to show filters?
1057 1134
 		if (isset($context['available_filters']))
@@ -1062,11 +1139,13 @@  discard block
 block discarded – undo
1062 1139
 			);
1063 1140
 
1064 1141
 			foreach ($context['available_filters'] as $filter)
1065
-				$listOptions['list_menu']['links'][] = array(
1142
+			{
1143
+							$listOptions['list_menu']['links'][] = array(
1066 1144
 					'is_selected' => $filter['selected'],
1067 1145
 					'href' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=' . $context['browse_type'] . ';filter=' . $filter['type'],
1068 1146
 					'label' => $filter['desc'] . ' - ' . $filter['amount'] . ' ' . ($filter['amount'] == 1 ? $txt['user'] : $txt['users'])
1069 1147
 				);
1148
+			}
1070 1149
 		}
1071 1150
 
1072 1151
 		// Now that we have all the options, create the list.
@@ -1104,26 +1183,36 @@  discard block
 block discarded – undo
1104 1183
 
1105 1184
 		// If we are applying a filter do just that - then redirect.
1106 1185
 		if (isset($this->_req->post->filter) && $this->_req->post->filter != $this->_req->post->orig_filter)
1107
-			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->query->type . ';sort=' . $this->_req->sort . ';filter=' . $this->_req->post->filter . ';start=' . $this->_req->start);
1186
+		{
1187
+					redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->query->type . ';sort=' . $this->_req->sort . ';filter=' . $this->_req->post->filter . ';start=' . $this->_req->start);
1188
+		}
1108 1189
 
1109 1190
 		// Nothing to do?
1110 1191
 		if (!isset($this->_req->post->todoAction) && !isset($this->_req->post->time_passed))
1111
-			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->query->type . ';sort=' . $this->_req->sort . ';filter=' . $current_filter . ';start=' . $this->_req->start);
1192
+		{
1193
+					redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->query->type . ';sort=' . $this->_req->sort . ';filter=' . $current_filter . ';start=' . $this->_req->start);
1194
+		}
1112 1195
 
1113 1196
 		// Are we dealing with members who have been waiting for > set amount of time?
1114 1197
 		if (isset($this->_req->post->time_passed))
1115
-			$this->conditions['time_before'] = time() - 86400 * (int) $this->_req->post->time_passed;
1198
+		{
1199
+					$this->conditions['time_before'] = time() - 86400 * (int) $this->_req->post->time_passed;
1200
+		}
1116 1201
 		// Coming from checkboxes - validate the members passed through to us.
1117 1202
 		else
1118 1203
 		{
1119 1204
 			$this->conditions['members'] = array();
1120 1205
 			foreach ($this->_req->post->todoAction as $id)
1121
-				$this->conditions['members'][] = (int) $id;
1206
+			{
1207
+							$this->conditions['members'][] = (int) $id;
1208
+			}
1122 1209
 		}
1123 1210
 
1124 1211
 		$data = retrieveMemberData($this->conditions);
1125 1212
 		if ($data['member_count'] == 0)
1126
-			redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->post->type . ';sort=' . $this->_req->sort . ';filter=' . $current_filter . ';start=' . $this->_req->start);
1213
+		{
1214
+					redirectexit('action=admin;area=viewmembers;sa=browse;type=' . $this->_req->post->type . ';sort=' . $this->_req->sort . ';filter=' . $current_filter . ';start=' . $this->_req->start);
1215
+		}
1127 1216
 
1128 1217
 		$this->member_info = $data['member_info'];
1129 1218
 		$this->conditions['members'] = $data['members'];
@@ -1162,12 +1251,16 @@  discard block
 block discarded – undo
1162 1251
 			$log_action = $this->_req->post->todo === 'remind' ? 'remind_member' : 'approve_member';
1163 1252
 
1164 1253
 			foreach ($this->member_info as $member)
1165
-				logAction($log_action, array('member' => $member['id']), 'admin');
1254
+			{
1255
+							logAction($log_action, array('member' => $member['id']), 'admin');
1256
+			}
1166 1257
 		}
1167 1258
 
1168 1259
 		// Although updateMemberStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers).
1169 1260
 		if (in_array($current_filter, array(3, 4)))
1170
-			updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $data['member_count'] ? $modSettings['unapprovedMembers'] - $data['member_count'] : 0)));
1261
+		{
1262
+					updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > $data['member_count'] ? $modSettings['unapprovedMembers'] - $data['member_count'] : 0)));
1263
+		}
1171 1264
 
1172 1265
 		// Update the member's stats. (but, we know the member didn't change their name.)
1173 1266
 		require_once(SUBSDIR . '/Members.subs.php');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 						'value' => $txt['viewmembers_online'],
517 517
 					),
518 518
 					'data' => array(
519
-						'function' => function ($rowData) {
519
+						'function' => function($rowData) {
520 520
 							global $txt;
521 521
 
522 522
 							require_once(SUBSDIR . '/Members.subs.php');
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 						'class' => 'centertext',
560 560
 					),
561 561
 					'data' => array(
562
-						'function' => function ($rowData) {
562
+						'function' => function($rowData) {
563 563
 							global $user_info;
564 564
 
565 565
 							return '<input type="checkbox" name="members[]" value="' . $rowData['id_member'] . '" class="input_check" ' . ($rowData['id_member'] == $user_info['id'] || $rowData['id_group'] == 1 || in_array(1, explode(',', $rowData['additional_groups'])) ? 'disabled="disabled"' : '') . ' />';
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 						'value' => $txt['hostname'],
955 955
 					),
956 956
 					'data' => array(
957
-						'function' => function ($rowData) {
957
+						'function' => function($rowData) {
958 958
 							return host_from_ip($rowData['member_ip']);
959 959
 						},
960 960
 						'class' => 'smalltext',
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 						'value' => $context['current_filter'] == 4 ? $txt['viewmembers_online'] : $txt['date_registered'],
966 966
 					),
967 967
 					'data' => array(
968
-						'function' => function ($rowData) {
968
+						'function' => function($rowData) {
969 969
 							global $context;
970 970
 
971 971
 							return standardTime($rowData['' . ($context['current_filter'] == 4 ? 'last_login' : 'date_registered') . '']);
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 						'style' => 'width: 20%;',
984 984
 					),
985 985
 					'data' => array(
986
-						'function' => function ($rowData) {
986
+						'function' => function($rowData) {
987 987
 							global $scripturl, $txt;
988 988
 
989 989
 							$member_links = array();
Please login to merge, or discard this patch.
sources/admin/ManageServer.controller.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -219,10 +219,14 @@  discard block
 block discarded – undo
219 219
 
220 220
 			// Its either local or global cookies
221 221
 			if (!empty($this->_req->post->localCookies) && empty($this->_req->post->globalCookies))
222
-				unset($this->_req->post->globalCookies);
222
+			{
223
+							unset($this->_req->post->globalCookies);
224
+			}
223 225
 
224 226
 			if (!empty($this->_req->post->globalCookiesDomain) && strpos($boardurl, $this->_req->post->globalCookiesDomain) === false)
225
-				throw new Elk_Exception('invalid_cookie_domain', false);
227
+			{
228
+							throw new Elk_Exception('invalid_cookie_domain', false);
229
+			}
226 230
 
227 231
 			$settingsForm->setConfigValues((array) $this->_req->post);
228 232
 			$settingsForm->save();
@@ -347,13 +351,21 @@  discard block
 block discarded – undo
347 351
 			foreach ($this->_req->post as $key => $value)
348 352
 			{
349 353
 				if (strpos($key, 'loadavg') === 0 || $key === 'loadavg_enable')
350
-					continue;
354
+				{
355
+									continue;
356
+				}
351 357
 				elseif ($key === 'loadavg_auto_opt' && $value <= 1)
352
-					$this->_req->post->loadavg_auto_opt = '1.0';
358
+				{
359
+									$this->_req->post->loadavg_auto_opt = '1.0';
360
+				}
353 361
 				elseif ($key === 'loadavg_forum' && $value < 10)
354
-					$this->_req->post->loadavg_forum = '10.0';
362
+				{
363
+									$this->_req->post->loadavg_forum = '10.0';
364
+				}
355 365
 				elseif ($value < 2)
356
-					$this->_req->{$key} = '2.0';
366
+				{
367
+									$this->_req->{$key} = '2.0';
368
+				}
357 369
 			}
358 370
 
359 371
 			call_integration_hook('integrate_save_loadavg_settings');
@@ -401,17 +413,25 @@  discard block
 block discarded – undo
401 413
 		foreach ($info_lines as $line)
402 414
 		{
403 415
 			if (preg_match('~(' . $remove . ')~', $line))
404
-				continue;
416
+			{
417
+							continue;
418
+			}
405 419
 
406 420
 			// New category?
407 421
 			if (strpos($line, '<h2>') !== false)
408
-				$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
422
+			{
423
+							$category = preg_match('~<h2>(.*)</h2>~', $line, $title) ? $category = $title[1] : $category;
424
+			}
409 425
 
410 426
 			// Load it as setting => value or the old setting local master
411 427
 			if (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
412
-				$pinfo[$category][$val[1]] = $val[2];
428
+			{
429
+							$pinfo[$category][$val[1]] = $val[2];
430
+			}
413 431
 			elseif (preg_match('~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~', $line, $val))
414
-				$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
432
+			{
433
+							$pinfo[$category][$val[1]] = array($txt['phpinfo_localsettings'] => $val[2], $txt['phpinfo_defaultsettings'] => $val[3]);
434
+			}
415 435
 		}
416 436
 
417 437
 		// Load it in to context and display it
@@ -564,7 +584,9 @@  discard block
 block discarded – undo
564 584
 			$supported = $value->isAvailable();
565 585
 
566 586
 			if (!empty($supported))
567
-				$detected_supported[$key] = $value->title();
587
+			{
588
+							$detected_supported[$key] = $value->title();
589
+			}
568 590
 		}
569 591
 
570 592
 		$txt['caching_information'] = str_replace('{supported_accelerators}', '<i>' . implode(', ', $detected_names) . '</i><br />', $txt['caching_information']);
@@ -618,7 +640,9 @@  discard block
 block discarded – undo
618 640
 
619 641
 		// Don't say you're using that win-thing, no cookies for you :P
620 642
 		if (stripos(PHP_OS, 'win') === 0)
621
-			$context['settings_message'] = $txt['loadavg_disabled_windows'];
643
+		{
644
+					$context['settings_message'] = $txt['loadavg_disabled_windows'];
645
+		}
622 646
 		else
623 647
 		{
624 648
 			require_once(SUBSDIR . '/Server.subs.php');
Please login to merge, or discard this patch.
sources/admin/ManageSecurity.controller.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -203,7 +203,9 @@  discard block
 block discarded – undo
203 203
 
204 204
 			// Guest requiring verification!
205 205
 			if (empty($this->_req->post->posts_require_captcha) && !empty($this->_req->post->guests_require_captcha))
206
-				$this->_req->post->posts_require_captcha = -1;
206
+			{
207
+							$this->_req->post->posts_require_captcha = -1;
208
+			}
207 209
 
208 210
 			unset($config_vars['pm1'], $config_vars['pm2'], $config_vars['pm3'], $config_vars['guest_verify']);
209 211
 
@@ -227,7 +229,9 @@  discard block
 block discarded – undo
227 229
 
228 230
 		// Some minor javascript for the guest post setting.
229 231
 		if ($modSettings['posts_require_captcha'])
230
-			addInlineJavascript('document.getElementById(\'guests_require_captcha\').disabled = true;', true);
232
+		{
233
+					addInlineJavascript('document.getElementById(\'guests_require_captcha\').disabled = true;', true);
234
+		}
231 235
 
232 236
 		$context['post_url'] = $scripturl . '?action=admin;area=securitysettings;save;sa=spam';
233 237
 		$context['settings_title'] = $txt['antispam_Settings'];
@@ -259,7 +263,9 @@  discard block
 block discarded – undo
259 263
 
260 264
 		// Have we blocked anything in the last 7 days?
261 265
 		if (!empty($modSettings['badbehavior_enabled']))
262
-			$context['settings_message'][] = bb2_insert_stats(true) . ' <a class="linkbutton" href="' . $boardurl . '/index.php?action=admin;area=logs;sa=badbehaviorlog;desc">' . $txt['badbehavior_details'] . '</a>';
266
+		{
267
+					$context['settings_message'][] = bb2_insert_stats(true) . ' <a class="linkbutton" href="' . $boardurl . '/index.php?action=admin;area=logs;sa=badbehaviorlog;desc">' . $txt['badbehavior_details'] . '</a>';
268
+		}
263 269
 
264 270
 		// Current whitelist data
265 271
 		$whitelist = array('badbehavior_ip_wl', 'badbehavior_useragent_wl', 'badbehavior_url_wl');
@@ -269,10 +275,14 @@  discard block
 block discarded – undo
269 275
 			$context[$list . '_desc'] = array();
270 276
 
271 277
 			if (!empty($modSettings[$list]))
272
-				$context[$list] = Util::unserialize($modSettings[$list]);
278
+			{
279
+							$context[$list] = Util::unserialize($modSettings[$list]);
280
+			}
273 281
 
274 282
 			if (!empty($modSettings[$list . '_desc']))
275
-				$context[$list . '_desc'] = Util::unserialize($modSettings[$list . '_desc']);
283
+			{
284
+							$context[$list . '_desc'] = Util::unserialize($modSettings[$list . '_desc']);
285
+			}
276 286
 		}
277 287
 
278 288
 		// Saving?
@@ -430,7 +440,9 @@  discard block
 block discarded – undo
430 440
 
431 441
 		// Cannot use moderation if post moderation is not enabled.
432 442
 		if (!$modSettings['postmod_active'])
433
-			unset($config_vars['moderate']);
443
+		{
444
+					unset($config_vars['moderate']);
445
+		}
434 446
 
435 447
 		require_once(SUBSDIR . '/VerificationControls.class.php');
436 448
 		$known_verifications = loadVerificationControls();
@@ -442,8 +454,10 @@  discard block
 block discarded – undo
442 454
 
443 455
 			$new_settings = $current_instance->settings();
444 456
 			if (!empty($new_settings) && is_array($new_settings))
445
-				foreach ($new_settings as $new_setting)
457
+			{
458
+							foreach ($new_settings as $new_setting)
446 459
 				$config_vars[] = $new_setting;
460
+			}
447 461
 		}
448 462
 
449 463
 		// @todo: it may be removed, it may stay, the two hooks may have different functions
Please login to merge, or discard this patch.
sources/admin/ManageFeatures.controller.php 2 patches
Braces   +80 added lines, -28 removed lines patch added patch discarded remove patch
@@ -168,7 +168,9 @@  discard block
 block discarded – undo
168 168
 
169 169
 			// Prevent absurd boundaries here - make it a day tops.
170 170
 			if (isset($this->_req->post->lastActive))
171
-				$this->_req->post->lastActive = min((int) $this->_req->post->lastActive, 1440);
171
+			{
172
+							$this->_req->post->lastActive = min((int) $this->_req->post->lastActive, 1440);
173
+			}
172 174
 
173 175
 			call_integration_hook('integrate_save_basic_settings');
174 176
 
@@ -420,7 +422,9 @@  discard block
 block discarded – undo
420 422
 
421 423
 					// Something like enableModule('mentions', array('post', 'display');
422 424
 					foreach ($modules as $key => $val)
423
-						$function($key, $val);
425
+					{
426
+											$function($key, $val);
427
+					}
424 428
 				}
425 429
 			}
426 430
 
@@ -499,7 +503,9 @@  discard block
 block discarded – undo
499 503
 
500 504
 		// Temporarily make each setting a modSetting!
501 505
 		foreach ($context['signature_settings'] as $key => $value)
502
-			$modSettings['signature_' . $key] = $value;
506
+		{
507
+					$modSettings['signature_' . $key] = $value;
508
+		}
503 509
 
504 510
 		// Make sure we check the right tags!
505 511
 		$modSettings['bbc_disabled_signature_bbc'] = $disabledTags;
@@ -514,17 +520,25 @@  discard block
 block discarded – undo
514 520
 			$bbcTags = $codes->getTags();
515 521
 
516 522
 			if (!isset($this->_req->post->signature_bbc_enabledTags))
517
-				$this->_req->post->signature_bbc_enabledTags = array();
523
+			{
524
+							$this->_req->post->signature_bbc_enabledTags = array();
525
+			}
518 526
 			elseif (!is_array($this->_req->post->signature_bbc_enabledTags))
519
-				$this->_req->post->signature_bbc_enabledTags = array($this->_req->post->signature_bbc_enabledTags);
527
+			{
528
+							$this->_req->post->signature_bbc_enabledTags = array($this->_req->post->signature_bbc_enabledTags);
529
+			}
520 530
 
521 531
 			$sig_limits = array();
522 532
 			foreach ($context['signature_settings'] as $key => $value)
523 533
 			{
524 534
 				if ($key == 'allow_smileys')
525
-					continue;
535
+				{
536
+									continue;
537
+				}
526 538
 				elseif ($key == 'max_smileys' && empty($this->_req->post->signature_allow_smileys))
527
-					$sig_limits[] = -1;
539
+				{
540
+									$sig_limits[] = -1;
541
+				}
528 542
 				else
529 543
 				{
530 544
 					$current_key = $this->_req->getPost('signature_' . $key, 'intval');
@@ -606,7 +620,9 @@  discard block
 block discarded – undo
606 620
 				foreach ($this->_req->post->reg as $value)
607 621
 				{
608 622
 					if (in_array($value, $standard_fields) && !isset($disable_fields[$value]))
609
-						$reg_fields[] = $value;
623
+					{
624
+											$reg_fields[] = $value;
625
+					}
610 626
 				}
611 627
 			}
612 628
 
@@ -614,7 +630,9 @@  discard block
 block discarded – undo
614 630
 			$changes['registration_fields'] = empty($reg_fields) ? '' : implode(',', $reg_fields);
615 631
 
616 632
 			if (!empty($changes))
617
-				updateSettings($changes);
633
+			{
634
+							updateSettings($changes);
635
+			}
618 636
 		}
619 637
 
620 638
 		createToken('admin-scp');
@@ -874,7 +892,9 @@  discard block
 block discarded – undo
874 892
 			loadLanguage('Errors');
875 893
 
876 894
 			if (isset($txt['custom_option_' . $this->_req->query->msg]))
877
-				$context['custom_option__error'] = $txt['custom_option_' . $this->_req->query->msg];
895
+			{
896
+							$context['custom_option__error'] = $txt['custom_option_' . $this->_req->query->msg];
897
+			}
878 898
 		}
879 899
 
880 900
 		// Load the profile language for section names.
@@ -928,9 +948,12 @@  discard block
 block discarded – undo
928 948
 
929 949
 			// Enable and disable custom fields as required.
930 950
 			$enabled = array(0);
931
-			if(isset($this->_req->post->cust) && is_array($this->_req->post->cust)) {
951
+			if(isset($this->_req->post->cust) && is_array($this->_req->post->cust))
952
+			{
932 953
 				foreach ($this->_req->post->cust as $id)
933
-					$enabled[] = (int) $id;
954
+				{
955
+									$enabled[] = (int) $id;
956
+				}
934 957
 			}
935 958
 
936 959
 			updateRenamedProfileStatus($enabled);
@@ -943,11 +966,15 @@  discard block
 block discarded – undo
943 966
 
944 967
 			// Everyone needs a name - even the (bracket) unknown...
945 968
 			if (trim($this->_req->post->field_name) == '')
946
-				redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $this->_req->query->fid . ';msg=need_name');
969
+			{
970
+							redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $this->_req->query->fid . ';msg=need_name');
971
+			}
947 972
 
948 973
 			// Regex you say?  Do a very basic test to see if the pattern is valid
949 974
 			if (!empty($this->_req->post->regex) && @preg_match($this->_req->post->regex, 'dummy') === false)
950
-				redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $this->_req->query->fid . ';msg=regex_error');
975
+			{
976
+							redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $this->_req->query->fid . ';msg=regex_error');
977
+			}
951 978
 
952 979
 			$this->_req->post->field_name = $this->_req->getPost('field_name', 'Util::htmlspecialchars');
953 980
 			$this->_req->post->field_desc = $this->_req->getPost('field_desc', 'Util::htmlspecialchars');
@@ -968,7 +995,9 @@  discard block
 block discarded – undo
968 995
 			// Some masking stuff...
969 996
 			$mask = $this->_req->getPost('mask', 'strval', '');
970 997
 			if ($mask == 'regex' && isset($this->_req->post->regex))
971
-				$mask .= $this->_req->post->regex;
998
+			{
999
+							$mask .= $this->_req->post->regex;
1000
+			}
972 1001
 
973 1002
 			$field_length = $this->_req->getPost('max_length', 'intval', 255);
974 1003
 			$enclose = $this->_req->getPost('enclose', 'strval', '');
@@ -998,7 +1027,9 @@  discard block
 block discarded – undo
998 1027
 
999 1028
 							// Nada, zip, etc...
1000 1029
 							if (trim($v) == '')
1001
-								continue;
1030
+							{
1031
+															continue;
1032
+							}
1002 1033
 
1003 1034
 							// Otherwise, save it boy.
1004 1035
 							$field_options .= $v . ',';
@@ -1014,7 +1045,9 @@  discard block
 block discarded – undo
1014 1045
 						}
1015 1046
 
1016 1047
 						if (isset($_POST['default_select']) && $_POST['default_select'] == 'no_default')
1017
-							$default = 'no_default';
1048
+						{
1049
+													$default = 'no_default';
1050
+						}
1018 1051
 
1019 1052
 						$field_options = substr($field_options, 0, -1);
1020 1053
 					}
@@ -1035,15 +1068,20 @@  discard block
 block discarded – undo
1035 1068
 
1036 1069
 				// If there is nothing to the name, then let's start our own - for foreign languages etc.
1037 1070
 				if (isset($matches[1]))
1038
-					$colname = $initial_colname = 'cust_' . strtolower($matches[1]);
1039
-				else
1040
-					$colname = $initial_colname = 'cust_' . mt_rand(1, 999999);
1071
+				{
1072
+									$colname = $initial_colname = 'cust_' . strtolower($matches[1]);
1073
+				}
1074
+				else {
1075
+									$colname = $initial_colname = 'cust_' . mt_rand(1, 999999);
1076
+				}
1041 1077
 
1042 1078
 				$unique = ensureUniqueProfileField($colname, $initial_colname);
1043 1079
 
1044 1080
 				// Still not a unique column name? Leave it up to the user, then.
1045 1081
 				if (!$unique)
1046
-					throw new Elk_Exception('custom_option_not_unique');
1082
+				{
1083
+									throw new Elk_Exception('custom_option_not_unique');
1084
+				}
1047 1085
 
1048 1086
 				// And create a new field
1049 1087
 				$new_field = array(
@@ -1091,7 +1129,9 @@  discard block
 block discarded – undo
1091 1129
 					foreach ($context['field']['options'] as $k => $option)
1092 1130
 					{
1093 1131
 						if (trim($option) == '')
1094
-							continue;
1132
+						{
1133
+													continue;
1134
+						}
1095 1135
 
1096 1136
 						// Still exists?
1097 1137
 						if (in_array($option, $newOptions))
@@ -1106,7 +1146,9 @@  discard block
 block discarded – undo
1106 1146
 					{
1107 1147
 						// Just been renamed?
1108 1148
 						if (!in_array($k, $takenKeys) && !empty($newOptions[$k]))
1109
-							updateRenamedProfileField($k, $newOptions, $context['field']['colname'], $option);
1149
+						{
1150
+													updateRenamedProfileField($k, $newOptions, $context['field']['colname'], $option);
1151
+						}
1110 1152
 					}
1111 1153
 				}
1112 1154
 				// @todo Maybe we should adjust based on new text length limits?
@@ -1139,7 +1181,9 @@  discard block
 block discarded – undo
1139 1181
 
1140 1182
 				// Just clean up any old selects - these are a pain!
1141 1183
 				if (($this->_req->post->field_type == 'select' || $this->_req->post->field_type == 'radio') && !empty($newOptions))
1142
-					deleteOldProfileFieldSelects($newOptions, $context['field']['colname']);
1184
+				{
1185
+									deleteOldProfileFieldSelects($newOptions, $context['field']['colname']);
1186
+				}
1143 1187
 			}
1144 1188
 		}
1145 1189
 		// Deleting?
@@ -1197,7 +1241,9 @@  discard block
 block discarded – undo
1197 1241
 			foreach ($context['pm_limits'] as $group_id => $group)
1198 1242
 			{
1199 1243
 				if (isset($this->_req->post->group[$group_id]) && $this->_req->post->group[$group_id] != $group['max_messages'])
1200
-					updateMembergroupProperties(array('current_group' => $group_id, 'max_messages' => $this->_req->post->group[$group_id]));
1244
+				{
1245
+									updateMembergroupProperties(array('current_group' => $group_id, 'max_messages' => $this->_req->post->group[$group_id]));
1246
+				}
1201 1247
 			}
1202 1248
 
1203 1249
 			call_integration_hook('integrate_save_pmsettings_settings');
@@ -1260,12 +1306,16 @@  discard block
 block discarded – undo
1260 1306
 		// Get all the time zones.
1261 1307
 		$all_zones = timezone_identifiers_list();
1262 1308
 		if ($all_zones === false)
1263
-			unset($config_vars['default_timezone']);
1309
+		{
1310
+					unset($config_vars['default_timezone']);
1311
+		}
1264 1312
 		else
1265 1313
 		{
1266 1314
 			// Make sure we set the value to the same as the printed value.
1267 1315
 			foreach ($all_zones as $zone)
1268
-				$config_vars['default_timezone'][2][$zone] = $zone;
1316
+			{
1317
+							$config_vars['default_timezone'][2][$zone] = $zone;
1318
+			}
1269 1319
 		}
1270 1320
 
1271 1321
 		call_integration_hook('integrate_modify_basic_settings', array(&$config_vars));
@@ -1565,7 +1615,9 @@  discard block
 block discarded – undo
1565 1615
 
1566 1616
 	// Have we exhausted all the time we allowed?
1567 1617
 	if (time() - array_sum(explode(' ', $sig_start)) < 3)
1568
-		return;
1618
+	{
1619
+			return;
1620
+	}
1569 1621
 
1570 1622
 	$context['continue_get_data'] = '?action=admin;area=featuresettings;sa=sig;apply;step=' . $applied_sigs . ';' . $context['session_var'] . '=' . $context['session_id'];
1571 1623
 	$context['page_title'] = $txt['not_done_title'];
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 						'class' => 'centertext',
658 658
 					),
659 659
 					'data' => array(
660
-						'function' => function ($rowData) {
660
+						'function' => function($rowData) {
661 661
 							$isChecked = $rowData['disabled'] ? '' : ' checked="checked"';
662 662
 							$onClickHandler = $rowData['can_show_register'] ? sprintf('onclick="document.getElementById(\'reg_%1$s\').disabled = !this.checked;"', $rowData['id']) : '';
663 663
 							return sprintf('<input type="checkbox" name="active[]" id="active_%1$s" value="%1$s" class="input_check" %2$s %3$s />', $rowData['id'], $isChecked, $onClickHandler);
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 						'class' => 'centertext',
673 673
 					),
674 674
 					'data' => array(
675
-						'function' => function ($rowData) {
675
+						'function' => function($rowData) {
676 676
 							$isChecked = $rowData['on_register'] && !$rowData['disabled'] ? ' checked="checked"' : '';
677 677
 							$isDisabled = $rowData['can_show_register'] ? '' : ' disabled="disabled"';
678 678
 							return sprintf('<input type="checkbox" name="reg[]" id="reg_%1$s" value="%1$s" class="input_check" %2$s %3$s />', $rowData['id'], $isChecked, $isDisabled);
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 						'value' => $txt['custom_profile_fieldname'],
735 735
 					),
736 736
 					'data' => array(
737
-						'function' => function ($rowData) {
737
+						'function' => function($rowData) {
738 738
 							global $scripturl;
739 739
 
740 740
 							return sprintf('<a href="%1$s?action=admin;area=featuresettings;sa=profileedit;fid=%2$d">%3$s</a><div class="smalltext">%4$s</div>', $scripturl, $rowData['id_field'], $rowData['field_name'], $rowData['field_desc']);
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 						'value' => $txt['custom_profile_fieldtype'],
752 752
 					),
753 753
 					'data' => array(
754
-						'function' => function ($rowData) {
754
+						'function' => function($rowData) {
755 755
 							global $txt;
756 756
 
757 757
 							$textKey = sprintf('custom_profile_type_%1$s', $rowData['field_type']);
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 						'class' => 'centertext',
771 771
 					),
772 772
 					'data' => array(
773
-						'function' => function ($rowData) {
773
+						'function' => function($rowData) {
774 774
 							$isChecked = $rowData['active'] ? ' checked="checked"' : '';
775 775
 							return sprintf('<input type="checkbox" name="cust[]" id="cust_%1$s" value="%1$s" class="input_check"%2$s />', $rowData['id_field'], $isChecked);
776 776
 						},
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 						'value' => $txt['custom_profile_placement'],
788 788
 					),
789 789
 					'data' => array(
790
-						'function' => function ($rowData) {
790
+						'function' => function($rowData) {
791 791
 							global $txt;
792 792
 							$placement = 'custom_profile_placement_';
793 793
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 
940 940
 			// Enable and disable custom fields as required.
941 941
 			$enabled = array(0);
942
-			if(isset($this->_req->post->cust) && is_array($this->_req->post->cust)) {
942
+			if (isset($this->_req->post->cust) && is_array($this->_req->post->cust)) {
943 943
 				foreach ($this->_req->post->cust as $id)
944 944
 					$enabled[] = (int) $id;
945 945
 			}
Please login to merge, or discard this patch.
sources/admin/ManageBoards.controller.php 1 patch
Braces   +126 added lines, -49 removed lines patch added patch discarded remove patch
@@ -147,18 +147,21 @@  discard block
 block discarded – undo
147 147
 
148 148
 			// Top is special, its the top!
149 149
 			if ($this->_req->query->move_to === 'top')
150
-				$boardOptions = array(
150
+			{
151
+							$boardOptions = array(
151 152
 					'move_to' => $this->_req->query->move_to,
152 153
 					'target_category' => (int) $this->_req->query->target_cat,
153 154
 					'move_first_child' => true,
154 155
 				);
156
+			}
155 157
 			// Moving it after another board
156
-			else
157
-				$boardOptions = array(
158
+			else {
159
+							$boardOptions = array(
158 160
 					'move_to' => $this->_req->query->move_to,
159 161
 					'target_board' => (int) $this->_req->query->target_board,
160 162
 					'move_first_child' => true,
161 163
 				);
164
+			}
162 165
 
163 166
 			// Use modifyBoard to perform the action
164 167
 			modifyBoard((int) $this->_req->query->src_board, $boardOptions);
@@ -210,14 +213,17 @@  discard block
 block discarded – undo
210 213
 				foreach ($boardList[$catid] as $boardid)
211 214
 				{
212 215
 					if (!isset($context['categories'][$catid]['move_link']))
213
-						$context['categories'][$catid]['move_link'] = array(
216
+					{
217
+											$context['categories'][$catid]['move_link'] = array(
214 218
 							'child_level' => 0,
215 219
 							'label' => $txt['mboards_order_before'] . ' \'' . htmlspecialchars($boards[$boardid]['name'], ENT_COMPAT, 'UTF-8') . '\'',
216 220
 							'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_board=' . $boardid . ';move_to=before;' . $security,
217 221
 						);
222
+					}
218 223
 
219 224
 					if (!$context['categories'][$catid]['boards'][$boardid]['move'])
220
-					$context['categories'][$catid]['boards'][$boardid]['move_links'] = array(
225
+					{
226
+										$context['categories'][$catid]['boards'][$boardid]['move_links'] = array(
221 227
 						array(
222 228
 							'child_level' => $boards[$boardid]['level'],
223 229
 							'label' => $txt['mboards_order_after'] . '\'' . htmlspecialchars($boards[$boardid]['name'], ENT_COMPAT, 'UTF-8') . '\'',
@@ -229,18 +235,25 @@  discard block
 block discarded – undo
229 235
 							'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_board=' . $boardid . ';move_to=child;' . $security,
230 236
 						),
231 237
 					);
238
+					}
232 239
 
233 240
 					$difference = $boards[$boardid]['level'] - $prev_child_level;
234 241
 					if ($difference == 1)
235
-						array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null);
242
+					{
243
+											array_push($stack, !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']) ? array_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']) : null);
244
+					}
236 245
 					elseif ($difference < 0)
237 246
 					{
238 247
 						if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links']))
239
-							$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array();
248
+						{
249
+													$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array();
250
+						}
240 251
 
241 252
 						for ($i = 0; $i < -$difference; $i++)
242
-							if (($temp = array_pop($stack)) !== null)
253
+						{
254
+													if (($temp = array_pop($stack)) !== null)
243 255
 								array_unshift($context['categories'][$catid]['boards'][$prev_board]['move_links'], $temp);
256
+						}
244 257
 					}
245 258
 
246 259
 					$prev_board = $boardid;
@@ -249,16 +262,22 @@  discard block
 block discarded – undo
249 262
 				}
250 263
 
251 264
 				if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']))
252
-					$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']);
265
+				{
266
+									$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack, $context['categories'][$catid]['boards'][$prev_board]['move_links']);
267
+				}
253 268
 				elseif (!empty($stack))
254
-					$context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack;
269
+				{
270
+									$context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack;
271
+				}
255 272
 
256 273
 				if (empty($boardList[$catid]))
257
-					$context['categories'][$catid]['move_link'] = array(
274
+				{
275
+									$context['categories'][$catid]['move_link'] = array(
258 276
 						'child_level' => 0,
259 277
 						'label' => $txt['mboards_order_before'] . ' \'' . htmlspecialchars($tree['node']['name'], ENT_COMPAT, 'UTF-8') . '\'',
260 278
 						'href' => $scripturl . '?action=admin;area=manageboards;sa=move;src_board=' . $context['move_board'] . ';target_cat=' . $catid . ';move_to=top;' . $security,
261 279
 					);
280
+				}
262 281
 			}
263 282
 		}
264 283
 
@@ -317,7 +336,9 @@  discard block
 block discarded – undo
317 336
 		}
318 337
 		// Category doesn't exist, man... sorry.
319 338
 		elseif (!isset($cat_tree[$this->cat]))
320
-			redirectexit('action=admin;area=manageboards');
339
+		{
340
+					redirectexit('action=admin;area=manageboards');
341
+		}
321 342
 		else
322 343
 		{
323 344
 			$context['category'] = array(
@@ -330,21 +351,27 @@  discard block
 block discarded – undo
330 351
 			);
331 352
 
332 353
 			foreach ($boardList[$this->cat] as $child_board)
333
-				$context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name'];
354
+			{
355
+							$context['category']['children'][] = str_repeat('-', $boards[$child_board]['level']) . ' ' . $boards[$child_board]['name'];
356
+			}
334 357
 		}
335 358
 
336 359
 		$prevCat = 0;
337 360
 		foreach ($cat_tree as $catid => $tree)
338 361
 		{
339 362
 			if ($catid == $this->cat && $prevCat > 0)
340
-				$context['category_order'][$prevCat]['selected'] = true;
363
+			{
364
+							$context['category_order'][$prevCat]['selected'] = true;
365
+			}
341 366
 			elseif ($catid != $this->cat)
342
-				$context['category_order'][$catid] = array(
367
+			{
368
+							$context['category_order'][$catid] = array(
343 369
 					'id' => $catid,
344 370
 					'name' => $txt['mboards_order_after'] . $tree['node']['name'],
345 371
 					'selected' => false,
346 372
 					'true_name' => $tree['node']['name']
347 373
 				);
374
+			}
348 375
 
349 376
 			$prevCat = $catid;
350 377
 		}
@@ -393,7 +420,9 @@  discard block
 block discarded – undo
393 420
 			$catOptions = array();
394 421
 
395 422
 			if (isset($this->_req->post->cat_order))
396
-				$catOptions['move_after'] = (int) $this->_req->post->cat_order;
423
+			{
424
+							$catOptions['move_after'] = (int) $this->_req->post->cat_order;
425
+			}
397 426
 
398 427
 			// Change "This & That" to "This &amp; That" but don't change "&cent" to "&amp;cent;"...
399 428
 			$catOptions['cat_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~', '&amp;$1', $this->_req->post->cat_name);
@@ -401,9 +430,12 @@  discard block
 block discarded – undo
401 430
 			$catOptions['is_collapsible'] = isset($this->_req->post->collapse);
402 431
 
403 432
 			if (isset($this->_req->post->add))
404
-				createCategory($catOptions);
405
-			else
406
-				modifyCategory($this->cat, $catOptions);
433
+			{
434
+							createCategory($catOptions);
435
+			}
436
+			else {
437
+							modifyCategory($this->cat, $catOptions);
438
+			}
407 439
 		}
408 440
 		// If they want to delete - first give them confirmation.
409 441
 		elseif (isset($this->_req->post->delete) && !isset($this->_req->post->confirmation) && !isset($this->_req->post->empty))
@@ -418,12 +450,15 @@  discard block
 block discarded – undo
418 450
 			if (isset($this->_req->post->delete_action) && $this->_req->post->delete_action == 1)
419 451
 			{
420 452
 				if (empty($this->_req->post->cat_to))
421
-					throw new Elk_Exception('mboards_delete_error');
453
+				{
454
+									throw new Elk_Exception('mboards_delete_error');
455
+				}
422 456
 
423 457
 				deleteCategories(array($this->cat), (int) $this->_req->post->cat_to);
424 458
 			}
425
-			else
426
-				deleteCategories(array($this->cat));
459
+			else {
460
+							deleteCategories(array($this->cat));
461
+			}
427 462
 		}
428 463
 
429 464
 		redirectexit('action=admin;area=manageboards');
@@ -470,7 +505,9 @@  discard block
 block discarded – undo
470 505
 
471 506
 			// Category doesn't exist, man... sorry.
472 507
 			if (empty($this->cat))
473
-				redirectexit('action=admin;area=manageboards');
508
+			{
509
+							redirectexit('action=admin;area=manageboards');
510
+			}
474 511
 
475 512
 			// Some things that need to be setup for a new board.
476 513
 			$curBoard = array(
@@ -534,7 +571,9 @@  discard block
 block discarded – undo
534 571
 
535 572
 		// Category doesn't exist, man... sorry.
536 573
 		if (!isset($boardList[$curBoard['category']]))
537
-			redirectexit('action=admin;area=manageboards');
574
+		{
575
+					redirectexit('action=admin;area=manageboards');
576
+		}
538 577
 
539 578
 		foreach ($boardList[$curBoard['category']] as $boardid)
540 579
 		{
@@ -566,24 +605,30 @@  discard block
 block discarded – undo
566 605
 			$context['can_move_children'] = false;
567 606
 			$context['children'] = $boards[$this->boardid]['tree']['children'];
568 607
 			foreach ($context['board_order'] as $board)
569
-				if ($board['is_child'] === false && $board['selected'] === false)
608
+			{
609
+							if ($board['is_child'] === false && $board['selected'] === false)
570 610
 					$context['can_move_children'] = true;
611
+			}
571 612
 		}
572 613
 
573 614
 		// Get other available categories.
574 615
 		$context['categories'] = array();
575 616
 		foreach ($cat_tree as $catID => $tree)
576
-			$context['categories'][] = array(
617
+		{
618
+					$context['categories'][] = array(
577 619
 				'id' => $catID == $curBoard['category'] ? 0 : $catID,
578 620
 				'name' => $tree['node']['name'],
579 621
 				'selected' => $catID == $curBoard['category']
580 622
 			);
623
+		}
581 624
 
582 625
 		$context['board']['moderators'] = getBoardModerators($this->boardid);
583 626
 		$context['board']['moderator_list'] = empty($context['board']['moderators']) ? '' : '&quot;' . implode('&quot;, &quot;', $context['board']['moderators']) . '&quot;';
584 627
 
585 628
 		if (!empty($context['board']['moderators']))
586
-			list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1);
629
+		{
630
+					list ($context['board']['last_moderator_id']) = array_slice(array_keys($context['board']['moderators']), -1);
631
+		}
587 632
 
588 633
 		$context['themes'] = getAllThemes();
589 634
 
@@ -646,7 +691,9 @@  discard block
 block discarded – undo
646 691
 			elseif (!empty($this->_req->post->placement) && !empty($this->_req->post->board_order))
647 692
 			{
648 693
 				if (!in_array($this->_req->post->placement, array('before', 'after', 'child')))
649
-					throw new Elk_Exception('mangled_post', false);
694
+				{
695
+									throw new Elk_Exception('mangled_post', false);
696
+				}
650 697
 
651 698
 				$boardOptions['move_to'] = $this->_req->post->placement;
652 699
 				$boardOptions['target_board'] = (int) $this->_req->post->board_order;
@@ -664,14 +711,20 @@  discard block
 block discarded – undo
664 711
 				foreach ($this->_req->post->groups as $group => $action)
665 712
 				{
666 713
 					if ($action == 'allow')
667
-						$boardOptions['access_groups'][] = (int) $group;
714
+					{
715
+											$boardOptions['access_groups'][] = (int) $group;
716
+					}
668 717
 					elseif ($action == 'deny')
669
-						$boardOptions['deny_groups'][] = (int) $group;
718
+					{
719
+											$boardOptions['deny_groups'][] = (int) $group;
720
+					}
670 721
 				}
671 722
 			}
672 723
 
673 724
 			if (strlen(implode(',', $boardOptions['access_groups'])) > 255 || strlen(implode(',', $boardOptions['deny_groups'])) > 255)
674
-				throw new Elk_Exception('too_many_groups', false);
725
+			{
726
+							throw new Elk_Exception('too_many_groups', false);
727
+			}
675 728
 
676 729
 			// Change '1 & 2' to '1 &amp; 2', but not '&amp;' to '&amp;amp;'...
677 730
 			$boardOptions['board_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~', '&amp;$1', $this->_req->post->board_name);
@@ -685,7 +738,9 @@  discard block
 block discarded – undo
685 738
 			{
686 739
 				$moderators = array();
687 740
 				foreach ($this->_req->post->moderator_list as $moderator)
688
-					$moderators[(int) $moderator] = (int) $moderator;
741
+				{
742
+									$moderators[(int) $moderator] = (int) $moderator;
743
+				}
689 744
 
690 745
 				$boardOptions['moderators'] = $moderators;
691 746
 			}
@@ -704,13 +759,19 @@  discard block
 block discarded – undo
704 759
 
705 760
 				// If we're turning redirection on check the board doesn't have posts in it - if it does don't make it a redirection board.
706 761
 				if ($boardOptions['redirect'] && empty($properties['oldRedirect']) && $properties['numPosts'])
707
-					unset($boardOptions['redirect']);
762
+				{
763
+									unset($boardOptions['redirect']);
764
+				}
708 765
 				// Reset the redirection count when switching on/off.
709 766
 				elseif (empty($boardOptions['redirect']) != empty($properties['oldRedirect']))
710
-					$boardOptions['num_posts'] = 0;
767
+				{
768
+									$boardOptions['num_posts'] = 0;
769
+				}
711 770
 				// Resetting the count?
712 771
 				elseif ($boardOptions['redirect'] && !empty($this->_req->post->reset_redirect))
713
-					$boardOptions['num_posts'] = 0;
772
+				{
773
+									$boardOptions['num_posts'] = 0;
774
+				}
714 775
 			}
715 776
 
716 777
 			call_integration_hook('integrate_save_board', array($board_id, &$boardOptions));
@@ -720,22 +781,29 @@  discard block
 block discarded – undo
720 781
 			{
721 782
 				// New boards by default go to the bottom of the category.
722 783
 				if (empty($this->_req->post->new_cat))
723
-					$boardOptions['target_category'] = (int) $this->_req->post->cur_cat;
784
+				{
785
+									$boardOptions['target_category'] = (int) $this->_req->post->cur_cat;
786
+				}
724 787
 				if (!isset($boardOptions['move_to']))
725
-					$boardOptions['move_to'] = 'bottom';
788
+				{
789
+									$boardOptions['move_to'] = 'bottom';
790
+				}
726 791
 
727 792
 				createBoard($boardOptions);
728 793
 			}
729 794
 			// ...or update an existing board.
730
-			else
731
-				modifyBoard($board_id, $boardOptions);
795
+			else {
796
+							modifyBoard($board_id, $boardOptions);
797
+			}
732 798
 		}
733 799
 		elseif (isset($this->_req->post->delete) && !isset($this->_req->post->confirmation) && !isset($this->_req->post->no_children))
734 800
 		{
735
-			if ($posts) {
801
+			if ($posts)
802
+			{
736 803
 				throw new Elk_Exception('mboards_delete_board_has_posts');
737 804
 			}
738
-			else {
805
+			else
806
+			{
739 807
 				$this->action_board();
740 808
 			}
741 809
 			return;
@@ -743,25 +811,32 @@  discard block
 block discarded – undo
743 811
 		elseif (isset($this->_req->post->delete))
744 812
 		{
745 813
 			// First, check if our board still has posts or topics.
746
-			if ($posts) {
814
+			if ($posts)
815
+			{
747 816
 				throw new Elk_Exception('mboards_delete_board_has_posts');
748 817
 			}
749 818
 			else if (isset($this->_req->post->delete_action) && $this->_req->post->delete_action == 1)
750 819
 			{
751 820
 				// Check if we are moving all the current sub-boards first - before we start deleting!
752 821
 				if (empty($this->_req->post->board_to))
753
-					throw new Elk_Exception('mboards_delete_board_error');
822
+				{
823
+									throw new Elk_Exception('mboards_delete_board_error');
824
+				}
754 825
 
755 826
 				deleteBoards(array($board_id), (int) $this->_req->post->board_to);
756 827
 			}
757
-			else
758
-				deleteBoards(array($board_id), 0);
828
+			else {
829
+							deleteBoards(array($board_id), 0);
830
+			}
759 831
 		}
760 832
 
761 833
 		if (isset($this->_req->query->rid) && $this->_req->query->rid == 'permissions')
762
-			redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']);
763
-		else
764
-			redirectexit('action=admin;area=manageboards');
834
+		{
835
+					redirectexit('action=admin;area=permissions;sa=board;' . $context['session_var'] . '=' . $context['session_id']);
836
+		}
837
+		else {
838
+					redirectexit('action=admin;area=manageboards');
839
+		}
765 840
 	}
766 841
 
767 842
 	/**
@@ -826,7 +901,9 @@  discard block
 block discarded – undo
826 901
 		$boards = getBoardList(array('override_permissions' => true, 'not_redirection' => true), true);
827 902
 		$recycle_boards = array('');
828 903
 		foreach ($boards as $board)
829
-			$recycle_boards[$board['id_board']] = $board['cat_name'] . ' - ' . $board['board_name'];
904
+		{
905
+					$recycle_boards[$board['id_board']] = $board['cat_name'] . ' - ' . $board['board_name'];
906
+		}
830 907
 
831 908
 		// Here and the board settings...
832 909
 		$config_vars = array(
Please login to merge, or discard this patch.
sources/admin/ManageCalendarModule.controller.php 2 patches
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -242,14 +242,19 @@  discard block
 block discarded – undo
242 242
 			$this->_req->post->holiday = $this->_req->getPost('holiday', 'intval', 0);
243 243
 
244 244
 			if (isset($this->_req->post->delete))
245
-				removeHolidays($this->_req->post->holiday);
245
+			{
246
+							removeHolidays($this->_req->post->holiday);
247
+			}
246 248
 			else
247 249
 			{
248 250
 				$date = Util::strftime($this->_req->post->year <= 4 ? '0004-%m-%d' : '%Y-%m-%d', mktime(0, 0, 0, $this->_req->post->month, $this->_req->post->day, $this->_req->post->year));
249 251
 				if (isset($this->_req->post->edit))
250
-					editHoliday($this->_req->post->holiday, $date, $this->_req->post->title);
251
-				else
252
-					insertHoliday($date, $this->_req->post->title);
252
+				{
253
+									editHoliday($this->_req->post->holiday, $date, $this->_req->post->title);
254
+				}
255
+				else {
256
+									insertHoliday($date, $this->_req->post->title);
257
+				}
253 258
 			}
254 259
 
255 260
 			redirectexit('action=admin;area=managecalendar;sa=holidays');
@@ -267,8 +272,9 @@  discard block
 block discarded – undo
267 272
 			);
268 273
 		}
269 274
 		// If it's not new load the data.
270
-		else
271
-			$context['holiday'] = getHoliday($this->_req->query->holiday);
275
+		else {
276
+					$context['holiday'] = getHoliday($this->_req->query->holiday);
277
+		}
272 278
 
273 279
 		// Last day for the drop down?
274 280
 		$context['holiday']['last_day'] = (int) Util::strftime('%d', mktime(0, 0, 0, $context['holiday']['month'] == 12 ? 1 : $context['holiday']['month'] + 1, 0, $context['holiday']['month'] == 12 ? $context['holiday']['year'] + 1 : $context['holiday']['year']));
@@ -337,7 +343,9 @@  discard block
 block discarded – undo
337 343
 		$boards_list = getBoardList(array('override_permissions' => true, 'not_redirection' => true), true);
338 344
 		$boards = array('');
339 345
 		foreach ($boards_list as $board)
340
-			$boards[$board['id_board']] = $board['cat_name'] . ' - ' . $board['board_name'];
346
+		{
347
+					$boards[$board['id_board']] = $board['cat_name'] . ' - ' . $board['board_name'];
348
+		}
341 349
 
342 350
 		// Look, all the calendar settings - of which there are many!
343 351
 		$config_vars = array(
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 			'settings' => array(
43 43
 				'cal_enabled' => 1,
44 44
 			),
45
-			'setting_callback' => function ($value) {
45
+			'setting_callback' => function($value) {
46 46
 				if ($value)
47 47
 				{
48 48
 					enableModules('calendar', array('admin', 'post', 'boardindex', 'display'));
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 						'value' => $txt['date'],
165 165
 					),
166 166
 					'data' => array(
167
-						'function' => function ($rowData) {
167
+						'function' => function($rowData) {
168 168
 							global $txt;
169 169
 
170 170
 							// Recurring every year or just a single year?
Please login to merge, or discard this patch.
sources/admin/ManageScheduledTasks.controller.php 2 patches
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
 			foreach ($this->_req->post->enable_task as $id => $enabled)
108 108
 			{
109 109
 				if ($enabled)
110
-					$enablers[] = (int) $id;
110
+				{
111
+									$enablers[] = (int) $id;
112
+				}
111 113
 			}
112 114
 
113 115
 			// Do the update!
@@ -123,7 +125,9 @@  discard block
 block discarded – undo
123 125
 			// Lets figure out which ones they want to run.
124 126
 			$tasks = array();
125 127
 			foreach ($this->_req->post->run_task as $task => $dummy)
126
-				$tasks[] = (int) $task;
128
+			{
129
+							$tasks[] = (int) $task;
130
+			}
127 131
 
128 132
 			// Load up the tasks.
129 133
 			$nextTasks = loadTasks($tasks);
@@ -135,11 +139,15 @@  discard block
 block discarded – undo
135 139
 			ignore_user_abort(true);
136 140
 
137 141
 			foreach ($nextTasks as $task_id => $taskname)
138
-				run_this_task($task_id, $taskname);
142
+			{
143
+							run_this_task($task_id, $taskname);
144
+			}
139 145
 
140 146
 			// Things go as expected?  If not save the error in session
141 147
 			if (!empty($context['scheduled_errors']))
142
-				$_SESSION['st_error'] = $context['scheduled_errors'];
148
+			{
149
+							$_SESSION['st_error'] = $context['scheduled_errors'];
150
+			}
143 151
 
144 152
 			redirectexit('action=admin;area=scheduledtasks;done');
145 153
 		}
@@ -273,7 +281,9 @@  discard block
 block discarded – undo
273 281
 
274 282
 		// Cleaning...
275 283
 		if (!isset($this->_req->query->tid))
276
-			throw new Elk_Exception('no_access', false);
284
+		{
285
+					throw new Elk_Exception('no_access', false);
286
+		}
277 287
 		$this->_req->query->tid = (int) $this->_req->query->tid;
278 288
 
279 289
 		// Saving?
@@ -287,9 +297,13 @@  discard block
 block discarded – undo
287 297
 
288 298
 			// If a half is empty then assume zero offset!
289 299
 			if (!isset($matches[2]) || $matches[2] > 59)
290
-				$matches[2] = 0;
300
+			{
301
+							$matches[2] = 0;
302
+			}
291 303
 			if (!isset($matches[1]) || $matches[1] > 23)
292
-				$matches[1] = 0;
304
+			{
305
+							$matches[1] = 0;
306
+			}
293 307
 
294 308
 			// Now the offset is easy; easy peasy - except we need to offset by a few hours...
295 309
 			$offset = $matches[1] * 3600 + $matches[2] * 60 - date('Z');
@@ -300,7 +314,9 @@  discard block
 block discarded – undo
300 314
 
301 315
 			// Don't allow one minute intervals.
302 316
 			if ($interval == 1 && $unit === 'm')
303
-				$interval = 2;
317
+			{
318
+							$interval = 2;
319
+			}
304 320
 
305 321
 			// Is it disabled?
306 322
 			$disabled = !isset($this->_req->post->enabled) ? 1 : 0;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 						'value' => $txt['scheduled_log_time_run'],
375 375
 					),
376 376
 					'data' => array(
377
-						'function' => function ($rowData) {
377
+						'function' => function($rowData) {
378 378
 							return standardTime($rowData['time_run'], true);
379 379
 						},
380 380
 					),
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 						'value' => $txt['scheduled_log_completed'],
406 406
 					),
407 407
 					'data' => array(
408
-						'function' => function ($rowData) {
408
+						'function' => function($rowData) {
409 409
 							global $txt;
410 410
 
411 411
 							return '<i class="icon ' . ($rowData['task_completed'] ? 'i-check' : 'i-fail') . '" title="' . sprintf($txt[$rowData['task_completed'] ? 'maintain_done' : 'maintain_fail'], $rowData['name']) . '" />';
Please login to merge, or discard this patch.
sources/admin/CoreFeatures.controller.php 2 patches
Braces   +63 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,15 +76,20 @@  discard block
 block discarded – undo
76 76
 				$tokenValidation = validateToken('admin-core', 'post', false);
77 77
 
78 78
 				if (empty($tokenValidation))
79
-					return 'token_verify_fail';
79
+				{
80
+									return 'token_verify_fail';
81
+				}
82
+			}
83
+			else {
84
+							validateToken('admin-core');
80 85
 			}
81
-			else
82
-				validateToken('admin-core');
83 86
 
84 87
 			$this->_save_core_features($core_features);
85 88
 
86 89
 			if (!isset($this->_req->query->xml))
87
-				redirectexit('action=admin;area=corefeatures;' . $context['session_var'] . '=' . $context['session_id']);
90
+			{
91
+							redirectexit('action=admin;area=corefeatures;' . $context['session_var'] . '=' . $context['session_id']);
92
+			}
88 93
 		}
89 94
 
90 95
 		// Put them in context.
@@ -96,11 +101,15 @@  discard block
 block discarded – undo
96 101
 
97 102
 		// Don't show them this twice!
98 103
 		if ($context['is_new_install'])
99
-			updateSettings(array('admin_features' => ''));
104
+		{
105
+					updateSettings(array('admin_features' => ''));
106
+		}
100 107
 
101 108
 		// sub_template is already generic_xml and the token is created somewhere else
102 109
 		if (isset($this->_req->query->xml))
103
-			return true;
110
+		{
111
+					return true;
112
+		}
104 113
 
105 114
 		$context['sub_template'] = 'core_features';
106 115
 		$context['page_title'] = $txt['core_settings_title'];
@@ -137,13 +146,16 @@  discard block
 block discarded – undo
137 146
 				'save_callback' => 'custom_profiles_toggle_callback',
138 147
 				'setting_callback' => function ($value) {
139 148
 					if (!$value)
140
-						return array(
149
+					{
150
+											return array(
141 151
 							'disabled_profile_fields' => '',
142 152
 							'registration_fields' => '',
143 153
 							'displayFields' => '',
144 154
 						);
145
-					else
146
-						return array();
155
+					}
156
+					else {
157
+											return array();
158
+					}
147 159
 				},
148 160
 			),
149 161
 			// k = karma.
@@ -171,9 +183,12 @@  discard block
 block discarded – undo
171 183
 					$current = !empty($modSettings['enabled_mentions']) ? explode(',', $modSettings['enabled_mentions']) : array();
172 184
 
173 185
 					if (!empty($value))
174
-						return array('enabled_mentions' => implode(',', array_merge($current, array('likemsg', 'rlikemsg'))));
175
-					else
176
-						return array('enabled_mentions' => implode(',', array_diff($current, array('likemsg', 'rlikemsg'))));
186
+					{
187
+											return array('enabled_mentions' => implode(',', array_merge($current, array('likemsg', 'rlikemsg'))));
188
+					}
189
+					else {
190
+											return array('enabled_mentions' => implode(',', array_diff($current, array('likemsg', 'rlikemsg'))));
191
+					}
177 192
 				},
178 193
 			),
179 194
 			// ml = moderation log.
@@ -205,8 +220,9 @@  discard block
 block discarded – undo
205 220
 
206 221
 						return array('warning_moderate' => 0);
207 222
 					}
208
-					else
209
-						return array();
223
+					else {
224
+											return array();
225
+					}
210 226
 				},
211 227
 			),
212 228
 			// ps = Paid Subscriptions.
@@ -245,8 +261,9 @@  discard block
 block discarded – undo
245 261
 							'warning_mute' => 60,
246 262
 						);
247 263
 					}
248
-					else
249
-						$returnSettings = array();
264
+					else {
265
+											$returnSettings = array();
266
+					}
250 267
 
251 268
 					$returnSettings['warning_settings'] = $warning_settings;
252 269
 					return $returnSettings;
@@ -261,7 +278,9 @@  discard block
 block discarded – undo
261 278
 				'setting_callback' => function ($value) {
262 279
 					// Turn off the spider group if disabling.
263 280
 					if (!$value)
264
-						return array('spider_group' => 0, 'show_spider_online' => 0);
281
+					{
282
+											return array('spider_group' => 0, 'show_spider_online' => 0);
283
+					}
265 284
 				},
266 285
 				'on_save' => function () {
267 286
 					require_once(SUBSDIR . '/SearchEngines.subs.php');
@@ -293,7 +312,9 @@  discard block
 block discarded – undo
293 312
 			$class = $file->getBasename('.controller.php') . '_Controller';
294 313
 
295 314
 			if (method_exists($class, 'addCoreFeature'))
296
-				$class::addCoreFeature($core_features);
315
+			{
316
+							$class::addCoreFeature($core_features);
317
+			}
297 318
 		}
298 319
 
299 320
 		$integrations = Hooks::instance()->discoverIntegrations(ADDONSDIR);
@@ -339,7 +360,9 @@  discard block
 block discarded – undo
339 360
 
340 361
 		// Convert this to a format that admin search will understand
341 362
 		foreach ($core_features as $id => $data)
342
-			$return_data[] = array('switch', isset($data['title']) ? $data['title'] : $txt['core_settings_item_' . $id]);
363
+		{
364
+					$return_data[] = array('switch', isset($data['title']) ? $data['title'] : $txt['core_settings_item_' . $id]);
365
+		}
343 366
 
344 367
 		return $return_data;
345 368
 	}
@@ -366,9 +389,13 @@  discard block
 block discarded – undo
366 389
 
367 390
 		// By default do the basic settings.
368 391
 		if (isset($this->_req->query->sa, $subActions[$this->_req->query->sa]))
369
-			$context['sub_action'] = $this->_req->query->sa;
392
+		{
393
+					$context['sub_action'] = $this->_req->query->sa;
394
+		}
370 395
 		elseif (!empty($defaultAction))
371
-			$context['sub_action'] = $defaultAction;
396
+		{
397
+					$context['sub_action'] = $defaultAction;
398
+		}
372 399
 		else
373 400
 		{
374 401
 			$temp = array_keys($subActions);
@@ -395,7 +422,9 @@  discard block
 block discarded – undo
395 422
 
396 423
 			// Enabled?
397 424
 			if (!empty($feature_id))
398
-				$setting_changes['admin_features'][] = $id;
425
+			{
426
+							$setting_changes['admin_features'][] = $id;
427
+			}
399 428
 
400 429
 			// Setting values to change?
401 430
 			if (isset($feature['settings']))
@@ -403,7 +432,9 @@  discard block
 block discarded – undo
403 432
 				foreach ($feature['settings'] as $key => $value)
404 433
 				{
405 434
 					if (empty($feature_id) || (!empty($feature_id) && ($value < 2 || empty($modSettings[$key]))))
406
-						$setting_changes[$key] = !empty($feature_id) ? $value : !$value;
435
+					{
436
+											$setting_changes[$key] = !empty($feature_id) ? $value : !$value;
437
+					}
407 438
 				}
408 439
 			}
409 440
 
@@ -412,12 +443,16 @@  discard block
 block discarded – undo
412 443
 			{
413 444
 				$returned_settings = $feature['setting_callback'](!empty($feature_id));
414 445
 				if (!empty($returned_settings))
415
-					$setting_changes = array_merge($setting_changes, $returned_settings);
446
+				{
447
+									$setting_changes = array_merge($setting_changes, $returned_settings);
448
+				}
416 449
 			}
417 450
 
418 451
 			// Standard save callback?
419 452
 			if (isset($feature['on_save']))
420
-				$feature['on_save']();
453
+			{
454
+							$feature['on_save']();
455
+			}
421 456
 		}
422 457
 
423 458
 		// Make sure this one setting is a string!
@@ -428,7 +463,9 @@  discard block
 block discarded – undo
428 463
 
429 464
 		// This is needed to let menus appear if cache > 2
430 465
 		if ($modSettings['cache_enable'] > 2)
431
-			clean_cache('data');
466
+		{
467
+					clean_cache('data');
468
+		}
432 469
 
433 470
 		// Any post save things?
434 471
 		foreach ($core_features as $id => $feature)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			'cp' => array(
136 136
 				'url' => 'action=admin;area=featuresettings;sa=profile',
137 137
 				'save_callback' => 'custom_profiles_toggle_callback',
138
-				'setting_callback' => function ($value) {
138
+				'setting_callback' => function($value) {
139 139
 					if (!$value)
140 140
 						return array(
141 141
 							'disabled_profile_fields' => '',
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				'settings' => array(
160 160
 					'likes_enabled' => 1,
161 161
 				),
162
-				'setting_callback' => function ($value) {
162
+				'setting_callback' => function($value) {
163 163
 					global $modSettings;
164 164
 
165 165
 					require_once(SUBSDIR . '/Mentions.subs.php');
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			// pm = post moderation.
197 197
 			'pm' => array(
198 198
 				'url' => 'action=admin;area=permissions;sa=postmod',
199
-				'setting_callback' => function ($value) {
199
+				'setting_callback' => function($value) {
200 200
 					// Cannot use warning post moderation if disabled!
201 201
 					if (!$value)
202 202
 					{
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			// w = warning.
225 225
 			'w' => array(
226 226
 				'url' => 'action=admin;area=securitysettings;sa=moderation',
227
-				'setting_callback' => function ($value) {
227
+				'setting_callback' => function($value) {
228 228
 					global $modSettings;
229 229
 
230 230
 					list ($modSettings['warning_enable'], $modSettings['user_limit'], $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']);
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 				'settings' => array(
259 259
 					'spider_mode' => 1,
260 260
 				),
261
-				'setting_callback' => function ($value) {
261
+				'setting_callback' => function($value) {
262 262
 					// Turn off the spider group if disabling.
263 263
 					if (!$value)
264 264
 						return array('spider_group' => 0, 'show_spider_online' => 0);
265 265
 				},
266
-				'on_save' => function () {
266
+				'on_save' => function() {
267 267
 					require_once(SUBSDIR . '/SearchEngines.subs.php');
268 268
 				},
269 269
 			),
@@ -308,14 +308,14 @@  discard block
 block discarded – undo
308 308
 
309 309
 			if (method_exists($integration['class'], 'setting_callback'))
310 310
 			{
311
-				$core_features[$integration['id']]['setting_callback'] = function ($value) use ($integration) {
311
+				$core_features[$integration['id']]['setting_callback'] = function($value) use ($integration) {
312 312
 					$integration['class']::setting_callback($value);
313 313
 				};
314 314
 			}
315 315
 
316 316
 			if (method_exists($integration['class'], 'on_save'))
317 317
 			{
318
-				$core_features[$integration['id']]['on_save'] = function () use ($integration) {
318
+				$core_features[$integration['id']]['on_save'] = function() use ($integration) {
319 319
 					$integration['class']::on_save();
320 320
 				};
321 321
 			}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		}
467 467
 
468 468
 		// Sort by title attribute
469
-		uasort($features, function ($a, $b) {
469
+		uasort($features, function($a, $b) {
470 470
 			return strcmp(strtolower($a['title']), strtolower($b['title']));
471 471
 		});
472 472
 
Please login to merge, or discard this patch.
sources/admin/ManagePermissions.controller.php 2 patches
Braces   +183 added lines, -69 removed lines patch added patch discarded remove patch
@@ -175,7 +175,9 @@  discard block
 block discarded – undo
175 175
 
176 176
 		// pid = profile id
177 177
 		if (!empty($this->_req->query->pid))
178
-			$this->_pid = (int) $this->_req->query->pid;
178
+		{
179
+					$this->_pid = (int) $this->_req->query->pid;
180
+		}
179 181
 
180 182
 		// Needed for <5.4 due to lack of $this support in closures
181 183
 		$_pid = isset($this->_pid) ? $this->_pid : null;
@@ -219,7 +221,9 @@  discard block
 block discarded – undo
219 221
 							// Since the moderator group has no explicit members, no link is needed.
220 222
 							// Since guests and regular members are not groups, no link is needed.
221 223
 							if (in_array($rowData['id_group'], array(-1, 0, 3)))
222
-								$group_name = $rowData['group_name'];
224
+							{
225
+															$group_name = $rowData['group_name'];
226
+							}
223 227
 							else
224 228
 							{
225 229
 								$group_name = sprintf('<a href="%1$s?action=admin;area=membergroups;sa=members;group=%2$d">%3$s</a>', $scripturl, $rowData['id_group'], $rowData['group_name_color']);
@@ -227,12 +231,16 @@  discard block
 block discarded – undo
227 231
 
228 232
 							// Add a help option for guests, regular members, moderator and administrator.
229 233
 							if (!empty($rowData['help']))
230
-								$group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=' . $rowData['help'] . '" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl);
234
+							{
235
+															$group_name .= sprintf(' (<a href="%1$s?action=quickhelp;help=' . $rowData['help'] . '" onclick="return reqOverlayDiv(this.href);" class="helpicon i-help"></a>)', $scripturl);
236
+							}
231 237
 
232 238
 							if (!empty($rowData['children']))
233
-								$group_name .= '
239
+							{
240
+															$group_name .= '
234 241
 									<br />
235 242
 									<span class="smalltext">' . $txt['permissions_includes_inherited'] . ': &quot;' . implode('&quot;, &quot;', $rowData['children']) . '&quot;</span>';
243
+							}
236 244
 
237 245
 							return $group_name;
238 246
 						},
@@ -253,11 +261,16 @@  discard block
 block discarded – undo
253 261
 
254 262
 							// No explicit members for guests and the moderator group.
255 263
 							if (in_array($rowData['id_group'], array(-1, 3)))
256
-								return $txt['membergroups_guests_na'];
264
+							{
265
+															return $txt['membergroups_guests_na'];
266
+							}
257 267
 							elseif ($rowData['can_search'])
258
-								return '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=' . $rowData['id_group'] . '">' . comma_format($rowData['num_members']) . '</a>';
259
-							else
260
-								return comma_format($rowData['num_members']);
268
+							{
269
+															return '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=' . $rowData['id_group'] . '">' . comma_format($rowData['num_members']) . '</a>';
270
+							}
271
+							else {
272
+															return comma_format($rowData['num_members']);
273
+							}
261 274
 						},
262 275
 					),
263 276
 					'sort' => array(
@@ -298,7 +311,9 @@  discard block
 block discarded – undo
298 311
 							global $scripturl, $txt;
299 312
 
300 313
 							if ($rowData['id_group'] != 1)
301
-								return '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $rowData['id_group'] . '' . (isset($_pid) ? ';pid=' . $_pid : '') . '">' . $txt['membergroups_modify'] . '</a>';
314
+							{
315
+															return '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $rowData['id_group'] . '' . (isset($_pid) ? ';pid=' . $_pid : '') . '">' . $txt['membergroups_modify'] . '</a>';
316
+							}
302 317
 
303 318
 							return '';
304 319
 						},
@@ -313,7 +328,9 @@  discard block
 block discarded – undo
313 328
 					'data' => array(
314 329
 						'function' => function ($rowData) {
315 330
 							if ($rowData['id_group'] != 1)
316
-								return '<input type="checkbox" name="group[]" value="' . $rowData['id_group'] . '" class="input_check" />';
331
+							{
332
+															return '<input type="checkbox" name="group[]" value="' . $rowData['id_group'] . '" class="input_check" />';
333
+							}
317 334
 
318 335
 							return '';
319 336
 						},
@@ -391,9 +408,12 @@  discard block
 block discarded – undo
391 408
 								global $scripturl;
392 409
 
393 410
 								if ($rowData['can_search'])
394
-									return '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=' . $rowData['id_group'] . '">' . comma_format($rowData['num_members']) . '</a>';
395
-								else
396
-									return comma_format($rowData['num_members']);
411
+								{
412
+																	return '<a href="' . $scripturl . '?action=moderate;area=viewgroups;sa=members;group=' . $rowData['id_group'] . '">' . comma_format($rowData['num_members']) . '</a>';
413
+								}
414
+								else {
415
+																	return comma_format($rowData['num_members']);
416
+								}
397 417
 							},
398 418
 						),
399 419
 						'sort' => array(
@@ -434,11 +454,14 @@  discard block
 block discarded – undo
434 454
 								global $scripturl, $txt;
435 455
 
436 456
 								if ($rowData['id_parent'] == -2)
437
-										return '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $rowData['id_group'] . (isset($_pid) ? ';pid=' . $_pid : '') . '">' . $txt['membergroups_modify'] . '</a>';
438
-									else
439
-										return '<span class="smalltext">' . $txt['permissions_includes_inherited_from'] . '&quot;' . $rowData['parent_name'] . '&quot;</span>
457
+								{
458
+																		return '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $rowData['id_group'] . (isset($_pid) ? ';pid=' . $_pid : '') . '">' . $txt['membergroups_modify'] . '</a>';
459
+								}
460
+									else {
461
+																			return '<span class="smalltext">' . $txt['permissions_includes_inherited_from'] . '&quot;' . $rowData['parent_name'] . '&quot;</span>
440 462
 											<br />
441 463
 											<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $rowData['id_parent'] . (isset($_pid) ? ';pid=' . $_pid : '') . '">' . $txt['membergroups_modify_parent'] . '</a>';
464
+									}
442 465
 							}
443 466
 						),
444 467
 					),
@@ -468,7 +491,9 @@  discard block
 block discarded – undo
468 491
 		if (!empty($this->_pid))
469 492
 		{
470 493
 			if (!isset($context['profiles'][$this->_pid]))
471
-				throw new Elk_Exception('no_access', false);
494
+			{
495
+							throw new Elk_Exception('no_access', false);
496
+			}
472 497
 
473 498
 			// Change the selected tab to better reflect that this really is a board profile.
474 499
 			$context[$context['admin_menu_name']]['current_subsection'] = 'profiles';
@@ -506,12 +531,16 @@  discard block
 block discarded – undo
506 531
 
507 532
 			$changes = array();
508 533
 			foreach ($this->_req->post->boardprofile as $board => $profile)
509
-				$changes[(int) $profile][] = (int) $board;
534
+			{
535
+							$changes[(int) $profile][] = (int) $board;
536
+			}
510 537
 
511 538
 			if (!empty($changes))
512 539
 			{
513 540
 				foreach ($changes as $profile => $boards)
514
-					assignPermissionProfileToBoard($profile, $boards);
541
+				{
542
+									assignPermissionProfileToBoard($profile, $boards);
543
+				}
515 544
 			}
516 545
 
517 546
 			$context['edit_all'] = false;
@@ -524,7 +553,9 @@  discard block
 block discarded – undo
524 553
 		{
525 554
 			$js = 'new Array(';
526 555
 			foreach ($context['profiles'] as $id => $profile)
527
-				$js .= '{name: ' . JavaScriptEscape($profile['name']) . ', id: ' . $id . '},';
556
+			{
557
+							$js .= '{name: ' . JavaScriptEscape($profile['name']) . ', id: ' . $id . '},';
558
+			}
528 559
 
529 560
 			addJavascriptVar(array(
530 561
 				'permission_profiles' => substr($js, 0, -1) . ')',
@@ -551,7 +582,9 @@  discard block
 block discarded – undo
551 582
 				$boards[$boardid]['description'] = $bbc_parser->parseBoard($boards[$boardid]['description']);
552 583
 
553 584
 				if (!isset($context['profiles'][$boards[$boardid]['profile']]))
554
-					$boards[$boardid]['profile'] = 1;
585
+				{
586
+									$boards[$boardid]['profile'] = 1;
587
+				}
555 588
 
556 589
 				$context['categories'][$catid]['boards'][$boardid] = array(
557 590
 					'id' => &$boards[$boardid]['id'],
@@ -583,14 +616,20 @@  discard block
 block discarded – undo
583 616
 
584 617
 		// Make sure only one of the quick options was selected.
585 618
 		if ((!empty($this->_req->post->predefined) && ((isset($this->_req->post->copy_from) && $this->_req->post->copy_from !== 'empty') || !empty($this->_req->post->permissions))) || (!empty($this->_req->post->copy_from) && $this->_req->post->copy_from !== 'empty' && !empty($this->_req->post->permissions)))
586
-			throw new Elk_Exception('permissions_only_one_option', false);
619
+		{
620
+					throw new Elk_Exception('permissions_only_one_option', false);
621
+		}
587 622
 
588 623
 		if (empty($this->_req->post->group) || !is_array($this->_req->post->group))
589
-			$this->_req->post->group = array();
624
+		{
625
+					$this->_req->post->group = array();
626
+		}
590 627
 
591 628
 		// Only accept numeric values for selected membergroups.
592 629
 		foreach ($this->_req->post->group as $id => $group_id)
593
-			$this->_req->post->group[$id] = (int) $group_id;
630
+		{
631
+					$this->_req->post->group[$id] = (int) $group_id;
632
+		}
594 633
 		$this->_req->post->group = array_unique($this->_req->post->group);
595 634
 
596 635
 		$this->_pid = $this->_req->getQuery('pid', 'intval', 0);
@@ -600,28 +639,37 @@  discard block
 block discarded – undo
600 639
 
601 640
 		// No modifying the predefined profiles.
602 641
 		if ($this->_pid > 1 && $this->_pid < 5)
603
-			throw new Elk_Exception('no_access', false);
642
+		{
643
+					throw new Elk_Exception('no_access', false);
644
+		}
604 645
 
605 646
 		// Clear out any cached authority.
606 647
 		updateSettings(array('settings_updated' => time()));
607 648
 
608 649
 		// No groups where selected.
609 650
 		if (empty($this->_req->post->group))
610
-			redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
651
+		{
652
+					redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
653
+		}
611 654
 
612 655
 		// Set a predefined permission profile.
613 656
 		if (!empty($this->_req->post->predefined))
614 657
 		{
615 658
 			// Make sure it's a predefined permission set we expect.
616 659
 			if (!in_array($this->_req->post->predefined, array('restrict', 'standard', 'moderator', 'maintenance')))
617
-				redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
660
+			{
661
+							redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
662
+			}
618 663
 
619 664
 			foreach ($this->_req->post->group as $group_id)
620 665
 			{
621 666
 				if (!empty($this->_pid))
622
-					setPermissionLevel($this->_req->post->predefined, $group_id, $this->_pid);
623
-				else
624
-					setPermissionLevel($this->_req->post->predefined, $group_id);
667
+				{
668
+									setPermissionLevel($this->_req->post->predefined, $group_id, $this->_pid);
669
+				}
670
+				else {
671
+									setPermissionLevel($this->_req->post->predefined, $group_id);
672
+				}
625 673
 			}
626 674
 		}
627 675
 		// Set a permission profile based on the permissions of a selected group.
@@ -629,17 +677,23 @@  discard block
 block discarded – undo
629 677
 		{
630 678
 			// Just checking the input.
631 679
 			if (!is_numeric($this->_req->post->copy_from))
632
-				redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
680
+			{
681
+							redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
682
+			}
633 683
 
634 684
 			// Make sure the group we're copying to is never included.
635 685
 			$this->_req->post->group = array_diff($this->_req->post->group, array($this->_req->post->copy_from));
636 686
 
637 687
 			// No groups left? Too bad.
638 688
 			if (empty($this->_req->post->group))
639
-				redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
689
+			{
690
+							redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
691
+			}
640 692
 
641 693
 			if (empty($this->_pid))
642
-				copyPermission($this->_req->post->copy_from, $this->_req->post->group, $this->illegal_permissions, $this->illegal_guest_permissions);
694
+			{
695
+							copyPermission($this->_req->post->copy_from, $this->_req->post->group, $this->illegal_permissions, $this->illegal_guest_permissions);
696
+			}
643 697
 
644 698
 			// Now do the same for the board permissions.
645 699
 			copyBoardPermission($this->_req->post->copy_from, $this->_req->post->group, $bid, $this->illegal_guest_permissions);
@@ -655,14 +709,19 @@  discard block
 block discarded – undo
655 709
 
656 710
 			// Check whether our input is within expected range.
657 711
 			if (!in_array($this->_req->post->add_remove, array('add', 'clear', 'deny')) || !in_array($permissionType, array('membergroup', 'board')))
658
-				redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
712
+			{
713
+							redirectexit('action=admin;area=permissions;pid=' . $this->_pid);
714
+			}
659 715
 
660 716
 			if ($this->_req->post->add_remove === 'clear')
661 717
 			{
662 718
 				if ($permissionType === 'membergroup')
663
-					deletePermission($this->_req->post->group, $permission, $this->illegal_permissions);
664
-				else
665
-					deleteBoardPermission($this->_req->post->group, $bid, $permission);
719
+				{
720
+									deletePermission($this->_req->post->group, $permission, $this->illegal_permissions);
721
+				}
722
+				else {
723
+									deleteBoardPermission($this->_req->post->group, $bid, $permission);
724
+				}
666 725
 			}
667 726
 			// Add a permission (either 'set' or 'deny').
668 727
 			else
@@ -672,21 +731,30 @@  discard block
 block discarded – undo
672 731
 				foreach ($this->_req->post->group as $groupID)
673 732
 				{
674 733
 					if ($groupID == -1 && in_array($permission, $this->illegal_guest_permissions))
675
-						continue;
734
+					{
735
+											continue;
736
+					}
676 737
 
677 738
 					if ($permissionType === 'membergroup' && $groupID != 1 && $groupID != 3 && (empty($this->illegal_permissions) || !in_array($permission, $this->illegal_permissions)))
678
-						$permChange[] = array($permission, $groupID, $add_deny);
739
+					{
740
+											$permChange[] = array($permission, $groupID, $add_deny);
741
+					}
679 742
 					elseif ($permissionType !== 'membergroup')
680
-						$permChange[] = array($permission, $groupID, $add_deny, $bid);
743
+					{
744
+											$permChange[] = array($permission, $groupID, $add_deny, $bid);
745
+					}
681 746
 				}
682 747
 
683 748
 				if (!empty($permChange))
684 749
 				{
685 750
 					if ($permissionType === 'membergroup')
686
-						replacePermission($permChange);
751
+					{
752
+											replacePermission($permChange);
753
+					}
687 754
 					// Board permissions go into the other table.
688
-					else
689
-						replaceBoardPermission($permChange);
755
+					else {
756
+											replaceBoardPermission($permChange);
757
+					}
690 758
 				}
691 759
 			}
692 760
 
@@ -705,14 +773,18 @@  discard block
 block discarded – undo
705 773
 		global $context, $txt;
706 774
 
707 775
 		if (!isset($this->_req->query->group))
708
-			throw new Elk_Exception('no_access', false);
776
+		{
777
+					throw new Elk_Exception('no_access', false);
778
+		}
709 779
 
710 780
 		require_once(SUBSDIR . '/ManagePermissions.subs.php');
711 781
 		$context['group']['id'] = (int) $this->_req->query->group;
712 782
 
713 783
 		// It's not likely you'd end up here with this setting disabled.
714 784
 		if ($this->_req->query->group == 1)
715
-			redirectexit('action=admin;area=permissions');
785
+		{
786
+					redirectexit('action=admin;area=permissions');
787
+		}
716 788
 
717 789
 		loadAllPermissions();
718 790
 		loadPermissionProfiles();
@@ -727,12 +799,17 @@  discard block
 block discarded – undo
727 799
 
728 800
 			// Cannot edit an inherited group!
729 801
 			if ($parent != -2)
730
-				throw new Elk_Exception('cannot_edit_permissions_inherited');
802
+			{
803
+							throw new Elk_Exception('cannot_edit_permissions_inherited');
804
+			}
731 805
 		}
732 806
 		elseif ($context['group']['id'] == -1)
733
-			$context['group']['name'] = $txt['membergroups_guests'];
734
-		else
735
-			$context['group']['name'] = $txt['membergroups_members'];
807
+		{
808
+					$context['group']['name'] = $txt['membergroups_guests'];
809
+		}
810
+		else {
811
+					$context['group']['name'] = $txt['membergroups_members'];
812
+		}
736 813
 
737 814
 		$context['profile']['id'] = $this->_req->getQuery('pid', 'intval', 0);
738 815
 
@@ -763,7 +840,9 @@  discard block
 block discarded – undo
763 840
 
764 841
 		// General permissions?
765 842
 		if ($context['permission_type'] === 'membergroup')
766
-			$permissions['membergroup'] = fetchPermissions($this->_req->query->group);
843
+		{
844
+					$permissions['membergroup'] = fetchPermissions($this->_req->query->group);
845
+		}
767 846
 
768 847
 		// Fetch current board permissions...
769 848
 		$permissions['board'] = fetchBoardPermissions($context['group']['id'], $context['permission_type'], $context['profile']['id']);
@@ -785,8 +864,9 @@  discard block
 block discarded – undo
785 864
 							$curPerm['any']['select'] = in_array($perm['id'] . '_any', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_any', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
786 865
 							$curPerm['own']['select'] = in_array($perm['id'] . '_own', $permissions[$permissionType]['allowed']) ? 'on' : (in_array($perm['id'] . '_own', $permissions[$permissionType]['denied']) ? 'denied' : 'off');
787 866
 						}
788
-						else
789
-							$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'denied' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
867
+						else {
868
+													$curPerm['select'] = in_array($perm['id'], $permissions[$permissionType]['denied']) ? 'denied' : (in_array($perm['id'], $permissions[$permissionType]['allowed']) ? 'on' : 'off');
869
+						}
790 870
 					}
791 871
 				}
792 872
 			}
@@ -814,11 +894,15 @@  discard block
 block discarded – undo
814 894
 
815 895
 		// Cannot modify predefined profiles.
816 896
 		if ($this->_pid > 1 && $this->_pid < 5)
817
-			throw new Elk_Exception('no_access', false);
897
+		{
898
+					throw new Elk_Exception('no_access', false);
899
+		}
818 900
 
819 901
 		// Verify this isn't inherited.
820 902
 		if ($current_group_id == -1 || $current_group_id == 0)
821
-			$parent = -2;
903
+		{
904
+					$parent = -2;
905
+		}
822 906
 		else
823 907
 		{
824 908
 			require_once(SUBSDIR . '/Membergroups.subs.php');
@@ -827,7 +911,9 @@  discard block
 block discarded – undo
827 911
 		}
828 912
 
829 913
 		if ($parent != -2)
830
-			throw new Elk_Exception('cannot_edit_permissions_inherited');
914
+		{
915
+					throw new Elk_Exception('cannot_edit_permissions_inherited');
916
+		}
831 917
 
832 918
 		$givePerms = array('membergroup' => array(), 'board' => array());
833 919
 
@@ -845,11 +931,13 @@  discard block
 block discarded – undo
845 931
 				if (is_array($perm_array))
846 932
 				{
847 933
 					foreach ($perm_array as $permission => $value)
848
-						if ($value === 'on' || $value === 'deny')
934
+					{
935
+											if ($value === 'on' || $value === 'deny')
849 936
 						{
850 937
 							// Don't allow people to escalate themselves!
851 938
 							if (in_array($permission, $this->illegal_permissions))
852 939
 								continue;
940
+					}
853 941
 
854 942
 							$givePerms[$perm_type][] = array($permission, $current_group_id, $value === 'deny' ? 0 : 1);
855 943
 						}
@@ -863,7 +951,9 @@  discard block
 block discarded – undo
863 951
 			deleteInvalidPermissions($current_group_id, $this->illegal_permissions);
864 952
 
865 953
 			if (!empty($givePerms['membergroup']))
866
-				replacePermission($givePerms['membergroup']);
954
+			{
955
+							replacePermission($givePerms['membergroup']);
956
+			}
867 957
 		}
868 958
 
869 959
 		// Insert the boardpermissions.
@@ -873,7 +963,9 @@  discard block
 block discarded – undo
873 963
 		if (!empty($givePerms['board']))
874 964
 		{
875 965
 			foreach ($givePerms['board'] as $k => $v)
876
-				$givePerms['board'][$k][] = $profileid;
966
+			{
967
+							$givePerms['board'][$k][] = $profileid;
968
+			}
877 969
 			replaceBoardPermission($givePerms['board']);
878 970
 		}
879 971
 
@@ -918,11 +1010,15 @@  discard block
 block discarded – undo
918 1010
 
919 1011
 			// Clear all deny permissions...if we want that.
920 1012
 			if (empty($modSettings['permission_enable_deny']))
921
-				clearDenyPermissions();
1013
+			{
1014
+							clearDenyPermissions();
1015
+			}
922 1016
 
923 1017
 			// Make sure there are no postgroup based permissions left.
924 1018
 			if (empty($modSettings['permission_enable_postgroups']))
925
-				clearPostgroupPermissions();
1019
+			{
1020
+							clearPostgroupPermissions();
1021
+			}
926 1022
 
927 1023
 			redirectexit('action=admin;area=permissions;sa=settings');
928 1024
 		}
@@ -993,11 +1089,15 @@  discard block
 block discarded – undo
993 1089
 
994 1090
 			// Just showing the boxes?
995 1091
 			if (!isset($this->_req->post->rename_profile))
996
-				$context['show_rename_boxes'] = true;
1092
+			{
1093
+							$context['show_rename_boxes'] = true;
1094
+			}
997 1095
 			else
998 1096
 			{
999 1097
 				foreach ($this->_req->post->rename_profile as $id => $name)
1000
-					renamePermissionProfile($id, $name);
1098
+				{
1099
+									renamePermissionProfile($id, $name);
1100
+				}
1001 1101
 			}
1002 1102
 		}
1003 1103
 		// Deleting?
@@ -1008,8 +1108,10 @@  discard block
 block discarded – undo
1008 1108
 
1009 1109
 			$profiles = array();
1010 1110
 			foreach ($this->_req->post->delete_profile as $profile)
1011
-				if ($profile > 4)
1111
+			{
1112
+							if ($profile > 4)
1012 1113
 					$profiles[] = (int) $profile;
1114
+			}
1013 1115
 
1014 1116
 			deletePermissionProfiles($profiles);
1015 1117
 		}
@@ -1027,7 +1129,9 @@  discard block
 block discarded – undo
1027 1129
 			// Can't delete special ones.
1028 1130
 			$context['profiles'][$id]['can_edit'] = isset($txt['permissions_profile_' . $profile['unformatted_name']]) ? false : true;
1029 1131
 			if ($context['profiles'][$id]['can_edit'])
1030
-				$context['can_edit_something'] = true;
1132
+			{
1133
+							$context['can_edit_something'] = true;
1134
+			}
1031 1135
 
1032 1136
 			// You can only delete it if you can edit it AND it's not in use.
1033 1137
 			$context['profiles'][$id]['can_delete'] = $context['profiles'][$id]['can_edit'] && empty($profile['in_use']) ? true : false;
@@ -1078,7 +1182,9 @@  discard block
 block discarded – undo
1078 1182
 		// What are the permissions we are querying?
1079 1183
 		$all_permissions = array();
1080 1184
 		foreach ($mappings as $perm_set)
1081
-			$all_permissions = array_merge($all_permissions, $perm_set);
1185
+		{
1186
+					$all_permissions = array_merge($all_permissions, $perm_set);
1187
+		}
1082 1188
 
1083 1189
 		// If we're saving the changes then do just that - save them.
1084 1190
 		if (!empty($this->_req->post->save_changes) && ($context['current_profile'] == 1 || $context['current_profile'] > 4))
@@ -1104,14 +1210,18 @@  discard block
 block discarded – undo
1104 1210
 							$new_permissions[] = array($context['current_profile'], $group['id'], $data[1], 1);
1105 1211
 						}
1106 1212
 						elseif ($temp[$group['id']] === 'moderate')
1107
-							$new_permissions[] = array($context['current_profile'], $group['id'], $data[1], 1);
1213
+						{
1214
+													$new_permissions[] = array($context['current_profile'], $group['id'], $data[1], 1);
1215
+						}
1108 1216
 					}
1109 1217
 				}
1110 1218
 			}
1111 1219
 
1112 1220
 			// Insert new permissions.
1113 1221
 			if (!empty($new_permissions))
1114
-				insertBoardPermission($new_permissions);
1222
+			{
1223
+							insertBoardPermission($new_permissions);
1224
+			}
1115 1225
 		}
1116 1226
 
1117 1227
 		// Now get all the permissions!
@@ -1128,10 +1238,14 @@  discard block
 block discarded – undo
1128 1238
 					{
1129 1239
 						// Full allowance?
1130 1240
 						if ($index == 0)
1131
-							$context['profile_groups'][$id_group][$key] = 'allow';
1241
+						{
1242
+													$context['profile_groups'][$id_group][$key] = 'allow';
1243
+						}
1132 1244
 						// Otherwise only bother with moderate if not on allow.
1133 1245
 						elseif ($context['profile_groups'][$id_group][$key] !== 'allow')
1134
-							$context['profile_groups'][$id_group][$key] = 'moderate';
1246
+						{
1247
+													$context['profile_groups'][$id_group][$key] = 'moderate';
1248
+						}
1135 1249
 					}
1136 1250
 				}
1137 1251
 			}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 						'value' => $txt['membergroups_name'],
214 214
 					),
215 215
 					'data' => array(
216
-						'function' => function ($rowData) {
216
+						'function' => function($rowData) {
217 217
 							global $scripturl, $txt;
218 218
 
219 219
 							// Since the moderator group has no explicit members, no link is needed.
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 						'class' => 'grid17',
249 249
 					),
250 250
 					'data' => array(
251
-						'function' => function ($rowData) {
251
+						'function' => function($rowData) {
252 252
 							global $txt, $scripturl;
253 253
 
254 254
 							// No explicit members for guests and the moderator group.
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 						'class' => 'grid17',
272 272
 					),
273 273
 					'data' => array(
274
-						'function' => function ($rowData) {
274
+						'function' => function($rowData) {
275 275
 							return $rowData['num_permissions']['allowed'];
276 276
 						},
277 277
 					),
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 						'class' => 'grid17',
284 284
 					),
285 285
 					'data' => array(
286
-						'function' => function ($rowData) {
286
+						'function' => function($rowData) {
287 287
 							return $rowData['num_permissions']['denied'];
288 288
 						},
289 289
 					),
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 						'class' => 'grid17',
295 295
 					),
296 296
 					'data' => array(
297
-						'function' => function ($rowData) use ($_pid) {
297
+						'function' => function($rowData) use ($_pid) {
298 298
 							global $scripturl, $txt;
299 299
 
300 300
 							if ($rowData['id_group'] != 1)
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 						'style' => 'width:4%;',
312 312
 					),
313 313
 					'data' => array(
314
-						'function' => function ($rowData) {
314
+						'function' => function($rowData) {
315 315
 							if ($rowData['id_group'] != 1)
316 316
 								return '<input type="checkbox" name="group[]" value="' . $rowData['id_group'] . '" class="input_check" />';
317 317
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 							'class' => 'grid25',
358 358
 						),
359 359
 						'data' => array(
360
-							'function' => function ($rowData) {
360
+							'function' => function($rowData) {
361 361
 								global $scripturl;
362 362
 
363 363
 								return sprintf('<a href="%1$s?action=admin;area=permissions;sa=members;group=%2$d">%3$s</a>', $scripturl, $rowData['id_group'], $rowData['group_name_color']);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 							'class' => 'grid10',
388 388
 						),
389 389
 						'data' => array(
390
-							'function' => function ($rowData) {
390
+							'function' => function($rowData) {
391 391
 								global $scripturl;
392 392
 
393 393
 								if ($rowData['can_search'])
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 							'class' => 'grid8',
408 408
 						),
409 409
 						'data' => array(
410
-							'function' => function ($rowData) {
410
+							'function' => function($rowData) {
411 411
 								return $rowData['num_permissions']['allowed'];
412 412
 							},
413 413
 						),
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 							'class' => 'grid8',
420 420
 						),
421 421
 						'data' => array(
422
-							'function' => function ($rowData) {
422
+							'function' => function($rowData) {
423 423
 								return $rowData['num_permissions']['denied'];
424 424
 							},
425 425
 						),
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 							'class' => 'grid17',
431 431
 						),
432 432
 						'data' => array(
433
-							'function' => function ($rowData) use ($_pid) {
433
+							'function' => function($rowData) use ($_pid) {
434 434
 								global $scripturl, $txt;
435 435
 
436 436
 								if ($rowData['id_parent'] == -2)
Please login to merge, or discard this patch.