Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/QueryAnalysis.class.php 1 patch
Braces   +27 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 
35 35
 		// Make the filenames look a bit better.
36 36
 		if (isset($query_data['f']))
37
-			$query_data['f'] = preg_replace('~^' . preg_quote(BOARDDIR, '~') . '~', '...', $query_data['f']);
37
+		{
38
+					$query_data['f'] = preg_replace('~^' . preg_quote(BOARDDIR, '~') . '~', '...', $query_data['f']);
39
+		}
38 40
 
39 41
 		$query_info = array(
40 42
 			'text' => nl2br(str_replace("\t", '   ', htmlspecialchars($query_data['q'], ENT_COMPAT, 'UTF-8'))),
@@ -43,12 +45,17 @@  discard block
 block discarded – undo
43 45
 		);
44 46
 
45 47
 		if (!empty($query_data['f']) && !empty($query_data['l']))
46
-			$query_info['position_time'] = sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']);
48
+		{
49
+					$query_info['position_time'] = sprintf($txt['debug_query_in_line'], $query_data['f'], $query_data['l']);
50
+		}
47 51
 
48 52
 		if (isset($query_data['s'], $query_data['t']) && isset($txt['debug_query_which_took_at']))
49
-			$query_info['position_time'] .= sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8));
50
-		else
51
-			$query_info['position_time'] .= sprintf($txt['debug_query_which_took'], round($query_data['t'], 8));
53
+		{
54
+					$query_info['position_time'] .= sprintf($txt['debug_query_which_took_at'], round($query_data['t'], 8), round($query_data['s'], 8));
55
+		}
56
+		else {
57
+					$query_info['position_time'] .= sprintf($txt['debug_query_which_took'], round($query_data['t'], 8));
58
+		}
52 59
 
53 60
 		return $query_info;
54 61
 	}
@@ -81,7 +88,9 @@  discard block
 block discarded – undo
81 88
 	public function doExplain()
82 89
 	{
83 90
 		if (empty($this->_select))
84
-			return array();
91
+		{
92
+					return array();
93
+		}
85 94
 
86 95
 		// db work...
87 96
 		$db = database();
@@ -109,7 +118,9 @@  discard block
 block discarded – undo
109 118
 
110 119
 			$db->data_seek($result, 0);
111 120
 			while ($row = $db->fetch_assoc($result))
112
-				$explain['body'][] = $row;
121
+			{
122
+							$explain['body'][] = $row;
123
+			}
113 124
 		}
114 125
 
115 126
 		return $explain;
@@ -130,10 +141,14 @@  discard block
 block discarded – undo
130 141
 		{
131 142
 			preg_match('/^(\t*)/', $line, $temp);
132 143
 			if (strlen($temp[0]) < $min_indent || $min_indent == 0)
133
-				$min_indent = strlen($temp[0]);
144
+			{
145
+							$min_indent = strlen($temp[0]);
146
+			}
134 147
 		}
135 148
 		foreach ($query as $l => $dummy)
136
-			$query[$l] = substr($dummy, $min_indent);
149
+		{
150
+					$query[$l] = substr($dummy, $min_indent);
151
+		}
137 152
 
138 153
 		return implode("\n", $query);
139 154
 	}
@@ -151,7 +166,9 @@  discard block
 block discarded – undo
151 166
 		$this->_select = '';
152 167
 
153 168
 		if ($is_select_query)
154
-			$this->_select = $query_data;
169
+		{
170
+					$this->_select = $query_data;
171
+		}
155 172
 		elseif (preg_match('~^INSERT(?: IGNORE)? INTO \w+(?:\s+\([^)]+\))?\s+(SELECT .+)$~s', trim($query_data), $matches) != 0)
156 173
 		{
157 174
 			$is_select_query = true;
Please login to merge, or discard this patch.
sources/subs/PaidSubscriptions.subs.php 1 patch
Braces   +118 added lines, -45 removed lines patch added patch discarded remove patch
@@ -83,7 +83,8 @@  discard block
 block discarded – undo
83 83
 	);
84 84
 	$subscribers = array();
85 85
 	while ($row = $db->fetch_assoc($request))
86
-		$subscribers[] = array(
86
+	{
87
+			$subscribers[] = array(
87 88
 			'id' => $row['id_sublog'],
88 89
 			'id_member' => $row['id_member'],
89 90
 			'name' => $row['name'],
@@ -93,6 +94,7 @@  discard block
 block discarded – undo
93 94
 			'status' => $row['status'],
94 95
 			'status_text' => $row['status'] == 0 ? ($row['payments_pending'] == 0 ? $txt['paid_finished'] : $txt['paid_pending']) : $txt['paid_active'],
95 96
 		);
97
+	}
96 98
 	$db->free_result($request);
97 99
 
98 100
 	return $subscribers;
@@ -109,7 +111,9 @@  discard block
 block discarded – undo
109 111
 
110 112
 	// Make it an array.
111 113
 	if (!is_array($users))
112
-		$users = array($users);
114
+	{
115
+			$users = array($users);
116
+	}
113 117
 
114 118
 	// Get all the members current groups.
115 119
 	$groups = array();
@@ -143,13 +147,17 @@  discard block
 block discarded – undo
143 147
 		{
144 148
 			// If this is changing - add the old one to the additional groups so it's not lost.
145 149
 			if ($row['id_group'] != $groups[$row['id_member']]['primary'])
146
-				$groups[$row['id_member']]['additional'][] = $groups[$row['id_member']]['primary'];
150
+			{
151
+							$groups[$row['id_member']]['additional'][] = $groups[$row['id_member']]['primary'];
152
+			}
147 153
 			$groups[$row['id_member']]['primary'] = $row['id_group'];
148 154
 		}
149 155
 
150 156
 		// Additional groups.
151 157
 		if (!empty($row['add_groups']))
152
-			$groups[$row['id_member']]['additional'] = array_merge($groups[$row['id_member']]['additional'], explode(',', $row['add_groups']));
158
+		{
159
+					$groups[$row['id_member']]['additional'] = array_merge($groups[$row['id_member']]['additional'], explode(',', $row['add_groups']));
160
+		}
153 161
 	}
154 162
 	$db->free_result($request);
155 163
 
@@ -159,8 +167,10 @@  discard block
 block discarded – undo
159 167
 		$group['additional'] = array_unique($group['additional']);
160 168
 		$addgroups = array();
161 169
 		foreach ($group['additional'] as $key => $value)
162
-			if (!empty($value))
170
+		{
171
+					if (!empty($value))
163 172
 				$addgroups[] = $value;
173
+		}
164 174
 
165 175
 		assignGroupsToMember($id, $group['primary'], $addgroups);
166 176
 	}
@@ -186,7 +196,9 @@  discard block
 block discarded – undo
186 196
 
187 197
 	// Exists, yes?
188 198
 	if (!isset($context['subscriptions'][$id_subscribe]))
189
-		return;
199
+	{
200
+			return;
201
+	}
190 202
 
191 203
 	$curSub = $context['subscriptions'][$id_subscribe];
192 204
 
@@ -235,15 +247,21 @@  discard block
 block discarded – undo
235 247
 
236 248
 		// If this has already expired but is active, extension means the period from now.
237 249
 		if ($endtime < time())
238
-			$endtime = time();
250
+		{
251
+					$endtime = time();
252
+		}
239 253
 		if ($starttime == 0)
240
-			$starttime = time();
254
+		{
255
+					$starttime = time();
256
+		}
241 257
 
242 258
 		// Work out the new expiry date.
243 259
 		$endtime += $duration;
244 260
 
245 261
 		if ($forceEndTime != 0)
246
-			$endtime = $forceEndTime;
262
+		{
263
+					$endtime = $forceEndTime;
264
+		}
247 265
 
248 266
 		// As everything else should be good, just update!
249 267
 		$db->query('', '
@@ -279,15 +297,20 @@  discard block
 block discarded – undo
279 297
 
280 298
 		// Ensure their old privileges are maintained.
281 299
 		if ($member['id_group'] != 0)
282
-			$newAddGroups[] = $member['id_group'];
300
+		{
301
+					$newAddGroups[] = $member['id_group'];
302
+		}
303
+	}
304
+	else {
305
+			$id_group = $member['id_group'];
283 306
 	}
284
-	else
285
-		$id_group = $member['id_group'];
286 307
 
287 308
 	// Yep, make sure it's unique, and no empties.
288 309
 	foreach ($newAddGroups as $k => $v)
289
-		if (empty($v))
310
+	{
311
+			if (empty($v))
290 312
 			unset($newAddGroups[$k]);
313
+	}
291 314
 	$newAddGroups = array_unique($newAddGroups);
292 315
 	$newAddGroups = implode(',', $newAddGroups);
293 316
 
@@ -314,15 +337,21 @@  discard block
 block discarded – undo
314 337
 
315 338
 		// If this has already expired but is active, extension means the period from now.
316 339
 		if ($endtime < time())
317
-			$endtime = time();
340
+		{
341
+					$endtime = time();
342
+		}
318 343
 		if ($starttime == 0)
319
-			$starttime = time();
344
+		{
345
+					$starttime = time();
346
+		}
320 347
 
321 348
 		// Work out the new expiry date.
322 349
 		$endtime += $duration;
323 350
 
324 351
 		if ($forceEndTime != 0)
325
-			$endtime = $forceEndTime;
352
+		{
353
+					$endtime = $forceEndTime;
354
+		}
326 355
 
327 356
 		// As everything else should be good, just update!
328 357
 		$db->query('', '
@@ -347,12 +376,17 @@  discard block
 block discarded – undo
347 376
 	// Otherwise a very simple insert.
348 377
 	$endtime = time() + $duration;
349 378
 	if ($forceEndTime != 0)
350
-		$endtime = $forceEndTime;
379
+	{
380
+			$endtime = $forceEndTime;
381
+	}
351 382
 
352 383
 	if ($forceStartTime == 0)
353
-		$starttime = time();
354
-	else
355
-		$starttime = $forceStartTime;
384
+	{
385
+			$starttime = time();
386
+	}
387
+	else {
388
+			$starttime = $forceStartTime;
389
+	}
356 390
 
357 391
 	$db->insert('',
358 392
 		'{db_prefix}log_subscribed',
@@ -429,7 +463,9 @@  discard block
 block discarded – undo
429 463
 	$db = database();
430 464
 
431 465
 	if (!empty($context['subscriptions']))
432
-		return;
466
+	{
467
+			return;
468
+	}
433 469
 
434 470
 	// Make sure this is loaded, just in case.
435 471
 	loadLanguage('ManagePaid');
@@ -448,9 +484,12 @@  discard block
 block discarded – undo
448 484
 		$costs = Util::unserialize($row['cost']);
449 485
 
450 486
 		if ($row['length'] != 'F' && !empty($modSettings['paid_currency_symbol']) && !empty($costs['fixed']))
451
-			$cost = sprintf($modSettings['paid_currency_symbol'], $costs['fixed']);
452
-		else
453
-			$cost = '???';
487
+		{
488
+					$cost = sprintf($modSettings['paid_currency_symbol'], $costs['fixed']);
489
+		}
490
+		else {
491
+					$cost = '???';
492
+		}
454 493
 
455 494
 		// Do the span.
456 495
 		$length = '??';
@@ -516,7 +555,9 @@  discard block
 block discarded – undo
516 555
 		$ind = $row['status'] == 0 ? 'finished' : 'total';
517 556
 
518 557
 		if (isset($context['subscriptions'][$row['id_subscribe']]))
519
-			$context['subscriptions'][$row['id_subscribe']][$ind] = $row['member_count'];
558
+		{
559
+					$context['subscriptions'][$row['id_subscribe']][$ind] = $row['member_count'];
560
+		}
520 561
 	}
521 562
 	$db->free_result($request);
522 563
 
@@ -532,7 +573,9 @@  discard block
 block discarded – undo
532 573
 	while ($row = $db->fetch_assoc($request))
533 574
 	{
534 575
 		if (isset($context['subscriptions'][$row['id_subscribe']]))
535
-			$context['subscriptions'][$row['id_subscribe']]['pending'] = $row['total_pending'];
576
+		{
577
+					$context['subscriptions'][$row['id_subscribe']]['pending'] = $row['total_pending'];
578
+		}
536 579
 	}
537 580
 	$db->free_result($request);
538 581
 }
@@ -564,7 +607,9 @@  discard block
 block discarded – undo
564 607
 	{
565 608
 		// The subscription must exist!
566 609
 		if (!isset($active_subscriptions[$row['id_subscribe']]))
567
-			continue;
610
+		{
611
+					continue;
612
+		}
568 613
 
569 614
 		$current[$row['id_subscribe']] = array(
570 615
 			'id' => $row['id_sublog'],
@@ -596,7 +641,9 @@  discard block
 block discarded – undo
596 641
 
597 642
 	// Need a subscription id
598 643
 	if (empty($sub_id))
599
-		return array();
644
+	{
645
+			return array();
646
+	}
600 647
 
601 648
 	// Find some basic information for each member that has subscribed
602 649
 	$request = $db->query('', '
@@ -651,7 +698,9 @@  discard block
 block discarded – undo
651 698
 			foreach ($members as $id_member => $member_data)
652 699
 			{
653 700
 				if ($member_data['old_id_group'] != $member_data['id_group'] && $member_data['id_group'] == $sub_detail['prim_group'])
654
-					$changes[$id_member]['id_group'] = $member_data['old_id_group'];
701
+				{
702
+									$changes[$id_member]['id_group'] = $member_data['old_id_group'];
703
+				}
655 704
 			}
656 705
 		}
657 706
 
@@ -665,7 +714,9 @@  discard block
 block discarded – undo
665 714
 
666 715
 				// If they have any of the subscription groups, remove them
667 716
 				if (implode(',', $non_sub_groups) != $member_data['additional_groups'])
668
-					$changes[$id_member]['additional_groups'] = $non_sub_groups;
717
+				{
718
+									$changes[$id_member]['additional_groups'] = $non_sub_groups;
719
+				}
669 720
 			}
670 721
 		}
671 722
 
@@ -674,7 +725,9 @@  discard block
 block discarded – undo
674 725
 		{
675 726
 			require_once(SUBSDIR . '/Members.subs.php');
676 727
 			foreach ($changes as $id_member => $new_values)
677
-				updateMemberData($id_member, $new_values);
728
+			{
729
+							updateMemberData($id_member, $new_values);
730
+			}
678 731
 		}
679 732
 	}
680 733
 
@@ -887,7 +940,9 @@  discard block
 block discarded – undo
887 940
 
888 941
 	// Humm this should not happen, if it does, boom
889 942
 	if ($sub_id === null)
890
-		throw new Elk_Exception('no_access', false);
943
+	{
944
+			throw new Elk_Exception('no_access', false);
945
+	}
891 946
 
892 947
 	return $sub_id;
893 948
 }
@@ -946,12 +1001,16 @@  discard block
 block discarded – undo
946 1001
 		)
947 1002
 	);
948 1003
 	if ($db->num_rows($request) !== 0)
949
-		list ($status['id_member'], $status['old_status']) = $db->fetch_row($request);
1004
+	{
1005
+			list ($status['id_member'], $status['old_status']) = $db->fetch_row($request);
1006
+	}
950 1007
 	$db->free_result($request);
951 1008
 
952 1009
 	// Nothing found?
953 1010
 	if (empty($status))
954
-		throw new Elk_Exception('no_access', false);
1011
+	{
1012
+			throw new Elk_Exception('no_access', false);
1013
+	}
955 1014
 
956 1015
 	return $status;
957 1016
 }
@@ -1257,14 +1316,18 @@  discard block
 block discarded – undo
1257 1316
 	while ($row = $db->fetch_assoc($request))
1258 1317
 	{
1259 1318
 		if (!isset($context['subscriptions'][$row['id_subscribe']]))
1260
-			continue;
1319
+		{
1320
+					continue;
1321
+		}
1261 1322
 
1262 1323
 		// The one we're removing?
1263 1324
 		if ($row['id_subscribe'] == $id_subscribe)
1264 1325
 		{
1265 1326
 			$removals = explode(',', $context['subscriptions'][$row['id_subscribe']]['add_groups']);
1266 1327
 			if ($context['subscriptions'][$row['id_subscribe']]['prim_group'] != 0)
1267
-				$removals[] = $context['subscriptions'][$row['id_subscribe']]['prim_group'];
1328
+			{
1329
+							$removals[] = $context['subscriptions'][$row['id_subscribe']]['prim_group'];
1330
+			}
1268 1331
 			$member['id_group'] = $row['old_id_group'];
1269 1332
 		}
1270 1333
 		// Otherwise things we allow.
@@ -1283,29 +1346,36 @@  discard block
 block discarded – undo
1283 1346
 	// Now, for everything we are removing check they definitely are not allowed it.
1284 1347
 	$existingGroups = explode(',', $member_info['additional_groups']);
1285 1348
 	foreach ($existingGroups as $key => $group)
1286
-		if (empty($group) || (in_array($group, $removals) && !in_array($group, $allowed)))
1349
+	{
1350
+			if (empty($group) || (in_array($group, $removals) && !in_array($group, $allowed)))
1287 1351
 			unset($existingGroups[$key]);
1352
+	}
1288 1353
 
1289 1354
 	// Finally, do something with the current primary group.
1290 1355
 	if (in_array($member_info['id_group'], $removals))
1291 1356
 	{
1292 1357
 		// If this primary group is actually allowed keep it.
1293 1358
 		if (in_array($member_info['id_group'], $allowed))
1294
-			$existingGroups[] = $member_info['id_group'];
1359
+		{
1360
+					$existingGroups[] = $member_info['id_group'];
1361
+		}
1295 1362
 
1296 1363
 		// Either way, change the id_group back.
1297 1364
 		if ($new_id_group < 1)
1298 1365
 		{
1299 1366
 			// If we revert to the old id-group we need to ensure it wasn't from a subscription.
1300 1367
 			foreach ($context['subscriptions'] as $id => $group)
1301
-				// It was? Make them a regular member then!
1368
+			{
1369
+							// It was? Make them a regular member then!
1302 1370
 				if ($group['prim_group'] == $member['id_group'])
1303 1371
 					$member['id_group'] = 0;
1372
+			}
1304 1373
 
1305 1374
 			$member_info['id_group'] = $member['id_group'];
1306 1375
 		}
1307
-		else
1308
-			$member_info['id_group'] = $new_id_group;
1376
+		else {
1377
+					$member_info['id_group'] = $new_id_group;
1378
+		}
1309 1379
 	}
1310 1380
 
1311 1381
 	// Crazy stuff, we seem to have our groups fixed, just make them unique
@@ -1316,7 +1386,8 @@  discard block
 block discarded – undo
1316 1386
 
1317 1387
 	// Disable the subscription.
1318 1388
 	if (!$delete)
1319
-		$db->query('', '
1389
+	{
1390
+			$db->query('', '
1320 1391
 			UPDATE {db_prefix}log_subscribed
1321 1392
 			SET status = {int:not_active}
1322 1393
 			WHERE id_member = {int:current_member}
@@ -1327,9 +1398,10 @@  discard block
 block discarded – undo
1327 1398
 				'current_subscription' => $id_subscribe,
1328 1399
 			)
1329 1400
 		);
1401
+	}
1330 1402
 	// Otherwise delete it!
1331
-	else
1332
-		$db->query('', '
1403
+	else {
1404
+			$db->query('', '
1333 1405
 			DELETE FROM {db_prefix}log_subscribed
1334 1406
 			WHERE id_member = {int:current_member}
1335 1407
 				AND id_subscribe = {int:current_subscription}',
@@ -1338,4 +1410,5 @@  discard block
 block discarded – undo
1338 1410
 				'current_subscription' => $id_subscribe,
1339 1411
 			)
1340 1412
 		);
1341
-}
1413
+	}
1414
+	}
Please login to merge, or discard this patch.
sources/subs/Maillist.subs.php 2 patches
Braces   +45 added lines, -18 removed lines patch added patch discarded remove patch
@@ -40,16 +40,24 @@  discard block
 block discarded – undo
40 40
 
41 41
 	// Work out the query
42 42
 	if ($approve_boards == array(0))
43
-		$approve_query = '';
43
+	{
44
+			$approve_query = '';
45
+	}
44 46
 	elseif (!empty($approve_boards))
45
-		$approve_query = ' AND e.id_board IN (' . implode(',', $approve_boards) . ')';
46
-	else
47
-		$approve_query = ' AND 0';
47
+	{
48
+			$approve_query = ' AND e.id_board IN (' . implode(',', $approve_boards) . ')';
49
+	}
50
+	else {
51
+			$approve_query = ' AND 0';
52
+	}
48 53
 
49 54
 	if ($id === 0)
50
-		$where_query = 'e.id_email > {int:id} AND (({query_see_board}' . $approve_query . ') OR e.id_board = -1)';
51
-	else
52
-		$where_query = 'e.id_email = {int:id} AND (({query_see_board}' . $approve_query . ') OR e.id_board = -1)';
55
+	{
56
+			$where_query = 'e.id_email > {int:id} AND (({query_see_board}' . $approve_query . ') OR e.id_board = -1)';
57
+	}
58
+	else {
59
+			$where_query = 'e.id_email = {int:id} AND (({query_see_board}' . $approve_query . ') OR e.id_board = -1)';
60
+	}
53 61
 
54 62
 	// Load them errors
55 63
 	$request = $db->query('', '
@@ -88,11 +96,17 @@  discard block
 block discarded – undo
88 96
 
89 97
 		// Build a link to the topic or message in case someone wants to take a look at that thread
90 98
 		if ($row['message_type'] === 't')
91
-			$postemail[$i]['link'] = $boardurl . '?topic=' . $row['message_id'];
99
+		{
100
+					$postemail[$i]['link'] = $boardurl . '?topic=' . $row['message_id'];
101
+		}
92 102
 		elseif ($row['message_type'] === 'm')
93
-			$postemail[$i]['link'] = $boardurl . '?msg=' . $row['message_id'];
103
+		{
104
+					$postemail[$i]['link'] = $boardurl . '?msg=' . $row['message_id'];
105
+		}
94 106
 		elseif ($row['message_type'] === 'p')
95
-			$postemail[$i]['subject'] = $txt['private'];
107
+		{
108
+					$postemail[$i]['subject'] = $txt['private'];
109
+		}
96 110
 
97 111
 		$i++;
98 112
 	}
@@ -117,11 +131,16 @@  discard block
 block discarded – undo
117 131
 
118 132
 	// Work out the query
119 133
 	if ($approve_boards == array(0))
120
-		$approve_query = '';
134
+	{
135
+			$approve_query = '';
136
+	}
121 137
 	elseif (!empty($approve_boards))
122
-		$approve_query = ' AND e.id_board IN (' . implode(',', $approve_boards) . ')';
123
-	else
124
-		$approve_query = ' AND 0';
138
+	{
139
+			$approve_query = ' AND e.id_board IN (' . implode(',', $approve_boards) . ')';
140
+	}
141
+	else {
142
+			$approve_query = ' AND 0';
143
+	}
125 144
 
126 145
 	// Get the total count of failed emails, needed for pages
127 146
 	$request = $db->query('', '
@@ -179,7 +198,9 @@  discard block
 block discarded – undo
179 198
 
180 199
 	// Init
181 200
 	if (empty($sort))
182
-		$sort = 'id_filter ASC';
201
+	{
202
+			$sort = 'id_filter ASC';
203
+	}
183 204
 
184 205
 	// Define $email_filters
185 206
 	$email_filters = array();
@@ -282,7 +303,9 @@  discard block
 block discarded – undo
282 303
 
283 304
 	// Check that the filter does exist
284 305
 	if (empty($row))
285
-		throw new Elk_Exception('email_error_no_filter');
306
+	{
307
+			throw new Elk_Exception('email_error_no_filter');
308
+	}
286 309
 
287 310
 	return $row;
288 311
 }
@@ -332,7 +355,9 @@  discard block
 block discarded – undo
332 355
 	$result = array();
333 356
 	$result[0] = '';
334 357
 	while ($row = $db->fetch_row($request))
335
-		$result[$row[0]] = $row[1];
358
+	{
359
+			$result[$row[0]] = $row[1];
360
+	}
336 361
 	$db->free_result($request);
337 362
 
338 363
 	return $result;
@@ -392,7 +417,9 @@  discard block
 block discarded – undo
392 417
 			);
393 418
 
394 419
 			if ($subject !== null)
395
-				$template['subject'] = $subject;
420
+			{
421
+							$template['subject'] = $subject;
422
+			}
396 423
 
397 424
 			return $template;
398 425
 		}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -384,7 +384,7 @@
 block discarded – undo
384 384
 			'generic' => 0,
385 385
 			'current_member' => $user_info['id'],
386 386
 		),
387
-		function ($row) use ($subject)
387
+		function($row) use ($subject)
388 388
 		{
389 389
 			$template = array(
390 390
 				'title' => $row['template_title'],
Please login to merge, or discard this patch.
sources/subs/Karma.subs.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,9 @@  discard block
 block discarded – undo
56 56
 		)
57 57
 	);
58 58
 	if ($db->num_rows($request) > 0)
59
-		list ($action) = $db->fetch_row($request);
59
+	{
60
+			list ($action) = $db->fetch_row($request);
61
+	}
60 62
 	$db->free_result($request);
61 63
 
62 64
 	return isset($action) ? $action : null;
@@ -116,7 +118,10 @@  discard block
 block discarded – undo
116 118
 	// It was recently changed the OTHER way... so... reverse it!
117 119
 	require_once(SUBSDIR . '/Members.subs.php');
118 120
 	if ($direction == 1)
119
-		updateMemberData($_REQUEST['uid'], array('karma_good' => '+', 'karma_bad' => '-'));
120
-	else
121
-		updateMemberData($_REQUEST['uid'], array('karma_bad' => '+', 'karma_good' => '-'));
122
-}
123 121
\ No newline at end of file
122
+	{
123
+			updateMemberData($_REQUEST['uid'], array('karma_good' => '+', 'karma_bad' => '-'));
124
+	}
125
+	else {
126
+			updateMemberData($_REQUEST['uid'], array('karma_bad' => '+', 'karma_good' => '-'));
127
+	}
128
+	}
124 129
\ No newline at end of file
Please login to merge, or discard this patch.
sources/subs/Likes.subs.php 2 patches
Braces   +64 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		// You can't like your own stuff, no matter how brilliant you think you are
31 31
 		if ($liked_message['id_member'] == $id_liker && empty($modSettings['likeAllowSelf']))
32
-			return $txt['cant_like_yourself'];
32
+		{
33
+					return $txt['cant_like_yourself'];
34
+		}
33 35
 		else
34 36
 		{
35 37
 			updateLike($id_liker, $liked_message, $direction);
@@ -53,10 +55,14 @@  discard block
 block discarded – undo
53 55
 	$likes = array();
54 56
 
55 57
 	if (empty($messages))
56
-		return $likes;
58
+	{
59
+			return $likes;
60
+	}
57 61
 
58 62
 	if (!is_array($messages))
59
-		$messages = (array((int) $messages));
63
+	{
64
+			$messages = (array((int) $messages));
65
+	}
60 66
 
61 67
 	// Load up them likes from the db
62 68
 	$request = $db->query('', '
@@ -71,16 +77,22 @@  discard block
 block discarded – undo
71 77
 		)
72 78
 	);
73 79
 	while ($row = $db->fetch_assoc($request))
74
-		$likes[$row['id_msg']]['member'][$row['id_member']] = $row['real_name'];
80
+	{
81
+			$likes[$row['id_msg']]['member'][$row['id_member']] = $row['real_name'];
82
+	}
75 83
 
76 84
 	// Total likes for this group
77 85
 	foreach ($likes as $msg_id => $like)
78
-		$likes[$msg_id]['count'] = count($like['member']);
86
+	{
87
+			$likes[$msg_id]['count'] = count($like['member']);
88
+	}
79 89
 
80 90
 	$db->free_result($request);
81 91
 
82 92
 	if ($prepare)
83
-		$likes = prepareLikes($likes);
93
+	{
94
+			$likes = prepareLikes($likes);
95
+	}
84 96
 
85 97
 	return $likes;
86 98
 }
@@ -108,7 +120,9 @@  discard block
 block discarded – undo
108 120
 		// Did they like this message ?
109 121
 		$you_liked = isset($like['member'][$user_info['id']]);
110 122
 		if ($you_liked)
111
-			unset($likes[$msg_id]['member'][$user_info['id']]);
123
+		{
124
+					unset($likes[$msg_id]['member'][$user_info['id']]);
125
+		}
112 126
 
113 127
 		// Any limits on how many to display
114 128
 		$limit = isset($modSettings['likeDisplayLimit']) ? $modSettings['likeDisplayLimit'] : 0;
@@ -122,7 +136,9 @@  discard block
 block discarded – undo
122 136
 
123 137
 			// Trick, member id's below $limit will cause a wrong +x others due to the slice above
124 138
 			if ($user_info['id'] <= $limit)
125
-				$like['count'] += 1;
139
+			{
140
+							$like['count'] += 1;
141
+			}
126 142
 
127 143
 			// How many others liked this
128 144
 			$likes[$msg_id]['member'][] = sprintf('%+d %s', ($like['count'] - $limit), $txt['liked_more']);
@@ -130,7 +146,9 @@  discard block
 block discarded – undo
130 146
 
131 147
 		// Top billing just for you, the big lights, the grand stage, plus we need that key returned
132 148
 		if ($you_liked)
133
-			$likes[$msg_id]['member'] = array($user_info['id'] => $txt['liked_you']) + $likes[$msg_id]['member'];
149
+		{
150
+					$likes[$msg_id]['member'] = array($user_info['id'] => $txt['liked_you']) + $likes[$msg_id]['member'];
151
+		}
134 152
 	}
135 153
 
136 154
 	return $likes;
@@ -173,7 +191,9 @@  discard block
 block discarded – undo
173 191
 	global $modSettings;
174 192
 
175 193
 	if (empty($modSettings['likeWaitCount']))
176
-		return true;
194
+	{
195
+			return true;
196
+	}
177 197
 
178 198
 	// Find out if, and how many, this user has done recently...
179 199
 	$db = database();
@@ -231,7 +251,9 @@  discard block
 block discarded – undo
231 251
 
232 252
 		// If we are liking the first message in a topic, we are de facto liking the topic
233 253
 		if ($liked_message['id_msg'] === $liked_message['id_first_msg'])
234
-			increaseTopicLikes($liked_message['id_topic'], $direction);
254
+		{
255
+					increaseTopicLikes($liked_message['id_topic'], $direction);
256
+		}
235 257
 
236 258
 		// And update the stats
237 259
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -253,7 +275,9 @@  discard block
 block discarded – undo
253 275
 
254 276
 		// If we are unliking the first message in a topic, we are de facto unliking the topic
255 277
 		if ($liked_message['id_msg'] === $liked_message['id_first_msg'])
256
-			increaseTopicLikes($liked_message['id_topic'], $direction);
278
+		{
279
+					increaseTopicLikes($liked_message['id_topic'], $direction);
280
+		}
257 281
 
258 282
 		// And update the stats
259 283
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -307,7 +331,9 @@  discard block
 block discarded – undo
307 331
 
308 332
 	// Give is a given, received takes a query so its only the unique messages
309 333
 	if ($given === true)
310
-		$likes = $user_profile[$memberID]['likes_given'];
334
+	{
335
+			$likes = $user_profile[$memberID]['likes_given'];
336
+	}
311 337
 	else
312 338
 	{
313 339
 		$request = $db->query('', '
@@ -441,7 +467,9 @@  discard block
 block discarded – undo
441 467
 	$likes = array();
442 468
 
443 469
 	if (empty($messageID))
444
-		return $likes;
470
+	{
471
+			return $likes;
472
+	}
445 473
 
446 474
 	// Load up the likes for this message
447 475
 	return $db->fetchQueryCallback('
@@ -492,7 +520,9 @@  discard block
 block discarded – undo
492 520
 	$total = 0;
493 521
 
494 522
 	if (empty($message))
495
-		return $total;
523
+	{
524
+			return $total;
525
+	}
496 526
 
497 527
 	// Count up the likes for this message
498 528
 	$request = $db->query('', '
@@ -1087,7 +1117,9 @@  discard block
 block discarded – undo
1087 1117
 
1088 1118
 	// Only a single message
1089 1119
 	if (is_numeric($messages))
1090
-		$messages = array($messages);
1120
+	{
1121
+			$messages = array($messages);
1122
+	}
1091 1123
 
1092 1124
 	// Load the members who liked and who posted for this group of messages
1093 1125
 	$request = $db->query('', '
@@ -1111,7 +1143,9 @@  discard block
 block discarded – undo
1111 1143
 
1112 1144
 	// No one?
1113 1145
 	if (empty($posters) && empty($likers))
1114
-		return;
1146
+	{
1147
+			return;
1148
+	}
1115 1149
 
1116 1150
 	// Re-count the "likes given" totals for the likers
1117 1151
 	if (!empty($likers))
@@ -1128,7 +1162,9 @@  discard block
 block discarded – undo
1128 1162
 		);
1129 1163
 		// All who liked these messages have their "likes given" reduced
1130 1164
 		while ($row = $db->fetch_assoc($request))
1131
-			$update_given[$row['id_member']] = $row['likes'] - $likers[$row['id_member']];
1165
+		{
1166
+					$update_given[$row['id_member']] = $row['likes'] - $likers[$row['id_member']];
1167
+		}
1132 1168
 		$db->free_result($request);
1133 1169
 	}
1134 1170
 
@@ -1147,7 +1183,9 @@  discard block
 block discarded – undo
1147 1183
 		);
1148 1184
 		// The message posters have their "likes received" reduced
1149 1185
 		while ($row = $db->fetch_assoc($request))
1150
-			$update_received[$row['id_poster']] = $row['likes'] - $posters[$row['id_poster']];
1186
+		{
1187
+					$update_received[$row['id_poster']] = $row['likes'] - $posters[$row['id_poster']];
1188
+		}
1151 1189
 		$db->free_result($request);
1152 1190
 	}
1153 1191
 
@@ -1155,8 +1193,12 @@  discard block
 block discarded – undo
1155 1193
 	require_once(SUBSDIR . '/Members.subs.php');
1156 1194
 
1157 1195
 	foreach ($update_given as $id_member => $total)
1158
-		updateMemberData($id_member, array('likes_given' => (int) $total));
1196
+	{
1197
+			updateMemberData($id_member, array('likes_given' => (int) $total));
1198
+	}
1159 1199
 
1160 1200
 	foreach ($update_received as $id_member => $total)
1161
-		updateMemberData($id_member, array('likes_received' => (int) $total));
1162
-}
1201
+	{
1202
+			updateMemberData($id_member, array('likes_received' => (int) $total));
1203
+	}
1204
+	}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			'start' => $start,
363 363
 			'per_page' => $items_per_page,
364 364
 		),
365
-		function ($row) use ($scripturl, $context)
365
+		function($row) use ($scripturl, $context)
366 366
 		{
367 367
 			return array(
368 368
 				'subject' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>',
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			'start' => $start,
412 412
 			'per_page' => $items_per_page,
413 413
 		),
414
-		function ($row) use ($scripturl)
414
+		function($row) use ($scripturl)
415 415
 		{
416 416
 			return array(
417 417
 				'subject' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>',
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			'start' => $start,
463 463
 			'per_page' => $items_per_page,
464 464
 		),
465
-		function ($row) use ($scripturl, $simple)
465
+		function($row) use ($scripturl, $simple)
466 466
 		{
467 467
 			$like = array(
468 468
 				'real_name' => $row['real_name'],
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 			'limit' => $limit,
648 648
 			'type_avatar' => 1,
649 649
 		),
650
-		function ($row) use ($scripturl, $bbc_parser)
650
+		function($row) use ($scripturl, $bbc_parser)
651 651
 		{
652 652
 			// Censor those naughty words
653 653
 			$row['body'] = censor($row['body']);
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 			'id_member' => $id_member,
924 924
 			'limit' => $limit
925 925
 		),
926
-		function ($row) use ($bbc_parser)
926
+		function($row) use ($bbc_parser)
927 927
 		{
928 928
 			// Censor those naughty words
929 929
 			$row['body'] = censor($row['body']);
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 			'id_member' => $id_liker,
1041 1041
 			'limit' => $limit
1042 1042
 		),
1043
-		function ($row) use ($bbc_parser)
1043
+		function($row) use ($bbc_parser)
1044 1044
 		{
1045 1045
 			// Censor those $%#^&% words
1046 1046
 			$row['body'] = censor($row['body']);
Please login to merge, or discard this patch.
sources/subs/MessagesDelete.class.php 1 patch
Braces   +168 added lines, -65 removed lines patch added patch discarded remove patch
@@ -60,9 +60,12 @@  discard block
 block discarded – undo
60 60
 	public function __construct($recycle_enabled = false, $recycle_board = null)
61 61
 	{
62 62
 		if ($recycle_enabled)
63
-			$this->_recycle_board = (int) $recycle_board;
64
-		else
65
-			$this->_recycle_board = null;
63
+		{
64
+					$this->_recycle_board = (int) $recycle_board;
65
+		}
66
+		else {
67
+					$this->_recycle_board = null;
68
+		}
66 69
 	}
67 70
 
68 71
 	/**
@@ -80,11 +83,15 @@  discard block
 block discarded – undo
80 83
 		{
81 84
 			$msg = (int) $msg;
82 85
 			if (!empty($msg))
83
-				$msgs[] = $msg;
86
+			{
87
+							$msgs[] = $msg;
88
+			}
84 89
 		}
85 90
 
86 91
 		if (empty($msgs))
87
-			return;
92
+		{
93
+					return;
94
+		}
88 95
 
89 96
 		$db = database();
90 97
 
@@ -122,7 +129,8 @@  discard block
 block discarded – undo
122 129
 
123 130
 			$previous_topics[] = $row['id_previous_topic'];
124 131
 			if (empty($actioned_messages[$row['id_previous_topic']]))
125
-				$actioned_messages[$row['id_previous_topic']] = array(
132
+			{
133
+							$actioned_messages[$row['id_previous_topic']] = array(
126 134
 					'msgs' => array(),
127 135
 					'count_posts' => $row['count_posts'],
128 136
 					'subject' => $row['subject'],
@@ -132,10 +140,13 @@  discard block
 block discarded – undo
132 140
 					'current_board' => $row['id_board'],
133 141
 					'members' => array(),
134 142
 				);
143
+			}
135 144
 
136 145
 			$actioned_messages[$row['id_previous_topic']]['msgs'][$row['id_msg']] = $row['subject'];
137 146
 			if ($row['id_member'])
138
-				$actioned_messages[$row['id_previous_topic']]['members'][] = $row['id_member'];
147
+			{
148
+							$actioned_messages[$row['id_previous_topic']]['members'][] = $row['id_member'];
149
+			}
139 150
 		}
140 151
 		$db->free_result($request);
141 152
 
@@ -143,7 +154,9 @@  discard block
 block discarded – undo
143 154
 		foreach ($actioned_messages as $topic => $data)
144 155
 		{
145 156
 			if (in_array($topic, $this->_topics_to_restore))
146
-				unset($actioned_messages[$topic]);
157
+			{
158
+							unset($actioned_messages[$topic]);
159
+			}
147 160
 		}
148 161
 
149 162
 		// Load any previous topics to check they exist.
@@ -160,10 +173,12 @@  discard block
 block discarded – undo
160 173
 			);
161 174
 			$previous_topics = array();
162 175
 			while ($row = $db->fetch_assoc($request))
163
-				$previous_topics[$row['id_topic']] = array(
176
+			{
177
+							$previous_topics[$row['id_topic']] = array(
164 178
 					'board' => $row['id_board'],
165 179
 					'subject' => $row['subject'],
166 180
 				);
181
+			}
167 182
 			$db->free_result($request);
168 183
 		}
169 184
 
@@ -190,7 +205,9 @@  discard block
 block discarded – undo
190 205
 			else
191 206
 			{
192 207
 				foreach ($data['msgs'] as $msg)
193
-					$this->_unfound_messages[$msg['id']] = $msg['subject'];
208
+				{
209
+									$this->_unfound_messages[$msg['id']] = $msg['subject'];
210
+				}
194 211
 			}
195 212
 		}
196 213
 
@@ -222,7 +239,9 @@  discard block
 block discarded – undo
222 239
 		{
223 240
 			$topic = (int) $topic;
224 241
 			if (!empty($topic))
225
-				$this->_topics_to_restore[] = $topic;
242
+			{
243
+							$this->_topics_to_restore[] = $topic;
244
+			}
226 245
 		}
227 246
 	}
228 247
 
@@ -232,7 +251,9 @@  discard block
 block discarded – undo
232 251
 	public function doRestore()
233 252
 	{
234 253
 		if (empty($this->_topics_to_restore))
235
-			return;
254
+		{
255
+					return;
256
+		}
236 257
 
237 258
 		$db = database();
238 259
 
@@ -292,7 +313,9 @@  discard block
 block discarded – undo
292 313
 
293 314
 				require_once(SUBSDIR . '/Members.subs.php');
294 315
 				while ($member = $db->fetch_assoc($request2))
295
-					updateMemberData($member['id_member'], array('posts' => 'posts + ' . $member['post_count']));
316
+				{
317
+									updateMemberData($member['id_member'], array('posts' => 'posts + ' . $member['post_count']));
318
+				}
296 319
 				$db->free_result($request2);
297 320
 			}
298 321
 
@@ -312,9 +335,12 @@  discard block
 block discarded – undo
312 335
 	public function unfoundRestoreMessages($return_msg = false)
313 336
 	{
314 337
 		if ($return_msg)
315
-			return $this->_unfound_messages;
316
-		else
317
-			return !empty($this->_unfound_messages);
338
+		{
339
+					return $this->_unfound_messages;
340
+		}
341
+		else {
342
+					return !empty($this->_unfound_messages);
343
+		}
318 344
 	}
319 345
 
320 346
 	/**
@@ -343,7 +369,9 @@  discard block
 block discarded – undo
343 369
 		$message = (int) $message;
344 370
 
345 371
 		if (empty($message))
346
-			return false;
372
+		{
373
+					return false;
374
+		}
347 375
 
348 376
 		$request = $db->query('', '
349 377
 			SELECT
@@ -361,7 +389,9 @@  discard block
 block discarded – undo
361 389
 			)
362 390
 		);
363 391
 		if ($db->num_rows($request) == 0)
364
-			return false;
392
+		{
393
+					return false;
394
+		}
365 395
 		$row = $db->fetch_assoc($request);
366 396
 		$db->free_result($request);
367 397
 
@@ -377,12 +407,16 @@  discard block
 block discarded – undo
377 407
 				return true;
378 408
 			}
379 409
 			elseif ($check == 'exit')
380
-				return false;
410
+			{
411
+							return false;
412
+			}
381 413
 		}
382 414
 
383 415
 		// Deleting a recycled message can not lower anyone's post count.
384 416
 		if ($row['icon'] == 'recycled')
385
-			$decreasePostCount = false;
417
+		{
418
+					$decreasePostCount = false;
419
+		}
386 420
 
387 421
 		// This is the last post, update the last post on the board.
388 422
 		if ($row['id_last_msg'] == $message)
@@ -421,8 +455,8 @@  discard block
 block discarded – undo
421 455
 			);
422 456
 		}
423 457
 		// Only decrease post counts.
424
-		else
425
-			$db->query('', '
458
+		else {
459
+					$db->query('', '
426 460
 				UPDATE {db_prefix}topics
427 461
 				SET ' . ($row['approved'] ? '
428 462
 					num_replies = CASE WHEN num_replies = {int:no_replies} THEN 0 ELSE num_replies - 1 END' : '
@@ -434,6 +468,7 @@  discard block
 block discarded – undo
434 468
 					'id_topic' => $row['id_topic'],
435 469
 				)
436 470
 			);
471
+		}
437 472
 
438 473
 		// Default recycle to false.
439 474
 		$recycle = false;
@@ -454,7 +489,9 @@  discard block
 block discarded – undo
454 489
 				)
455 490
 			);
456 491
 			if ($db->num_rows($request) == 0)
457
-				throw new Elk_Exception('recycle_no_valid_board');
492
+			{
493
+							throw new Elk_Exception('recycle_no_valid_board');
494
+			}
458 495
 			list ($isRead, $last_board_msg) = $db->fetch_row($request);
459 496
 			$db->free_result($request);
460 497
 
@@ -474,7 +511,8 @@  discard block
 block discarded – undo
474 511
 
475 512
 			// Insert a new topic in the recycle board if $id_recycle_topic is empty.
476 513
 			if (empty($id_recycle_topic))
477
-				$db->insert('',
514
+			{
515
+							$db->insert('',
478 516
 					'{db_prefix}topics',
479 517
 					array(
480 518
 						'id_board' => 'int', 'id_member_started' => 'int', 'id_member_updated' => 'int', 'id_first_msg' => 'int',
@@ -486,6 +524,7 @@  discard block
 block discarded – undo
486 524
 					),
487 525
 					array('id_topic')
488 526
 				);
527
+			}
489 528
 
490 529
 			// Capture the ID of the new topic...
491 530
 			$topicID = empty($id_recycle_topic) ? $db->insert_id('{db_prefix}topics', 'id_topic') : $id_recycle_topic;
@@ -557,7 +596,8 @@  discard block
 block discarded – undo
557 596
 
558 597
 				// Lets increase the num_replies, and the first/last message ID as appropriate.
559 598
 				if (!empty($id_recycle_topic))
560
-					$db->query('', '
599
+				{
600
+									$db->query('', '
561 601
 						UPDATE {db_prefix}topics
562 602
 						SET num_replies = num_replies + 1' .
563 603
 							($message > $last_topic_msg ? ', id_last_msg = {int:id_merged_msg}' : '') .
@@ -568,6 +608,7 @@  discard block
 block discarded – undo
568 608
 							'id_merged_msg' => $message,
569 609
 						)
570 610
 					);
611
+				}
571 612
 
572 613
 				// Make sure this message isn't getting deleted later on.
573 614
 				$recycle = true;
@@ -579,7 +620,8 @@  discard block
 block discarded – undo
579 620
 
580 621
 			// If it wasn't approved don't keep it in the queue.
581 622
 			if (!$row['approved'])
582
-				$db->query('', '
623
+			{
624
+							$db->query('', '
583 625
 					DELETE FROM {db_prefix}approval_queue
584 626
 					WHERE id_msg = {int:id_msg}
585 627
 						AND id_attach = {int:id_attach}',
@@ -588,6 +630,7 @@  discard block
 block discarded – undo
588 630
 						'id_attach' => 0,
589 631
 					)
590 632
 				);
633
+			}
591 634
 		}
592 635
 
593 636
 		$db->query('', '
@@ -644,7 +687,8 @@  discard block
 block discarded – undo
644 687
 				$customIndexSettings = Util::unserialize($modSettings['search_custom_index_config']);
645 688
 				$words = text2words($row['body'], $customIndexSettings['bytes_per_word'], true);
646 689
 				if (!empty($words))
647
-					$db->query('', '
690
+				{
691
+									$db->query('', '
648 692
 						DELETE FROM {db_prefix}log_search_words
649 693
 						WHERE id_word IN ({array_int:word_list})
650 694
 							AND id_msg = {int:id_msg}',
@@ -653,6 +697,7 @@  discard block
 block discarded – undo
653 697
 							'id_msg' => $message,
654 698
 						)
655 699
 					);
700
+				}
656 701
 			}
657 702
 
658 703
 			// Delete attachment(s) if they exist.
@@ -693,9 +738,12 @@  discard block
 block discarded – undo
693 738
 		// And now to update the last message of each board we messed with.
694 739
 		require_once(SUBSDIR . '/Post.subs.php');
695 740
 		if ($recycle)
696
-			updateLastMessages(array($row['id_board'], $this->_recycle_board));
697
-		else
698
-			updateLastMessages($row['id_board']);
741
+		{
742
+					updateLastMessages(array($row['id_board'], $this->_recycle_board));
743
+		}
744
+		else {
745
+					updateLastMessages($row['id_board']);
746
+		}
699 747
 
700 748
 		// Close any moderation reports for this message.
701 749
 		require_once(SUBSDIR . '/Moderation.subs.php');
@@ -708,7 +756,9 @@  discard block
 block discarded – undo
708 756
 
709 757
 		// Add it to the mod log.
710 758
 		if (allowedTo('delete_any') && (!allowedTo('delete_own') || $row['id_member'] != $user_info['id']))
711
-			logAction('delete', array('topic' => $row['id_topic'], 'subject' => $row['subject'], 'member' => $row['id_member'], 'board' => $row['id_board']));
759
+		{
760
+					logAction('delete', array('topic' => $row['id_topic'], 'subject' => $row['subject'], 'member' => $row['id_member'], 'board' => $row['id_board']));
761
+		}
712 762
 
713 763
 		return false;
714 764
 	}
@@ -796,21 +846,29 @@  discard block
 block discarded – undo
796 846
 						if ($row['id_member_poster'] == $user_info['id'])
797 847
 						{
798 848
 							if (!$delete_replies)
799
-								throw new Elk_Exception('cannot_delete_replies', 'permission');
849
+							{
850
+															throw new Elk_Exception('cannot_delete_replies', 'permission');
851
+							}
852
+						}
853
+						else {
854
+													throw new Elk_Exception('cannot_delete_own', 'permission');
800 855
 						}
801
-						else
802
-							throw new Elk_Exception('cannot_delete_own', 'permission');
803 856
 					}
804 857
 					elseif (($row['id_member_poster'] != $user_info['id'] || !$delete_replies) && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time())
805
-						throw new Elk_Exception('modify_post_time_passed', false);
858
+					{
859
+											throw new Elk_Exception('modify_post_time_passed', false);
860
+					}
806 861
 				}
807 862
 				elseif ($row['id_member_poster'] == $user_info['id'])
808 863
 				{
809 864
 					if (!$delete_replies)
810
-						throw new Elk_Exception('cannot_delete_replies', 'permission');
865
+					{
866
+											throw new Elk_Exception('cannot_delete_replies', 'permission');
867
+					}
868
+				}
869
+				else {
870
+									throw new Elk_Exception('cannot_delete_any', 'permission');
811 871
 				}
812
-				else
813
-					throw new Elk_Exception('cannot_delete_any', 'permission');
814 872
 			}
815 873
 
816 874
 			// Can't delete an unapproved message, if you can't see it!
@@ -818,7 +876,9 @@  discard block
 block discarded – undo
818 876
 			{
819 877
 				$approve_posts = !empty($user_info['mod_cache']['ap']) ? $user_info['mod_cache']['ap'] : boardsAllowedTo('approve_posts');
820 878
 				if (!in_array(0, $approve_posts) && !in_array($row['id_board'], $approve_posts))
821
-					return 'exit';
879
+				{
880
+									return 'exit';
881
+				}
822 882
 			}
823 883
 		}
824 884
 		else
@@ -829,20 +889,31 @@  discard block
 block discarded – undo
829 889
 				if (!allowedTo('delete_own'))
830 890
 				{
831 891
 					if ($row['id_member_poster'] == $user_info['id'] && !allowedTo('delete_any'))
832
-						isAllowedTo('delete_replies');
892
+					{
893
+											isAllowedTo('delete_replies');
894
+					}
833 895
 					elseif (!allowedTo('delete_any'))
834
-						isAllowedTo('delete_own');
896
+					{
897
+											isAllowedTo('delete_own');
898
+					}
835 899
 				}
836 900
 				elseif (!allowedTo('delete_any') && ($row['id_member_poster'] != $user_info['id'] || !allowedTo('delete_replies')) && !empty($modSettings['edit_disable_time']) && $row['poster_time'] + $modSettings['edit_disable_time'] * 60 < time())
837
-					throw new Elk_Exception('modify_post_time_passed', false);
901
+				{
902
+									throw new Elk_Exception('modify_post_time_passed', false);
903
+				}
838 904
 			}
839 905
 			elseif ($row['id_member_poster'] == $user_info['id'] && !allowedTo('delete_any'))
840
-				isAllowedTo('delete_replies');
841
-			else
842
-				isAllowedTo('delete_any');
906
+			{
907
+							isAllowedTo('delete_replies');
908
+			}
909
+			else {
910
+							isAllowedTo('delete_any');
911
+			}
843 912
 
844 913
 			if ($modSettings['postmod_active'] && !$row['approved'] && $row['id_member'] != $user_info['id'] && !allowedTo('delete_own'))
845
-				isAllowedTo('approve_posts');
914
+			{
915
+							isAllowedTo('approve_posts');
916
+			}
846 917
 		}
847 918
 
848 919
 		// Delete the *whole* topic, but only if the topic consists of one message.
@@ -861,22 +932,32 @@  discard block
 block discarded – undo
861 932
 				}
862 933
 
863 934
 				if ($row['id_member'] != $user_info['id'] && !$remove_any)
864
-					throw new Elk_Exception('cannot_remove_any', 'permission');
935
+				{
936
+									throw new Elk_Exception('cannot_remove_any', 'permission');
937
+				}
865 938
 				elseif (!$remove_any && !$remove_own)
866
-					throw new Elk_Exception('cannot_remove_own', 'permission');
939
+				{
940
+									throw new Elk_Exception('cannot_remove_own', 'permission');
941
+				}
867 942
 			}
868 943
 			else
869 944
 			{
870 945
 				// Check permissions to delete a whole topic.
871 946
 				if ($row['id_member'] != $user_info['id'])
872
-					isAllowedTo('remove_any');
947
+				{
948
+									isAllowedTo('remove_any');
949
+				}
873 950
 				elseif (!allowedTo('remove_any'))
874
-					isAllowedTo('remove_own');
951
+				{
952
+									isAllowedTo('remove_own');
953
+				}
875 954
 			}
876 955
 
877 956
 			// ...if there is only one post.
878 957
 			if (!empty($row['num_replies']))
879
-				throw new Elk_Exception('delFirstPost', false);
958
+			{
959
+							throw new Elk_Exception('delFirstPost', false);
960
+			}
880 961
 
881 962
 			return true;
882 963
 		}
@@ -898,11 +979,15 @@  discard block
 block discarded – undo
898 979
 
899 980
 		// Is it an array?
900 981
 		if (!is_array($msgs))
901
-			$msgs = array($msgs);
982
+		{
983
+					$msgs = array($msgs);
984
+		}
902 985
 
903 986
 		// Lets make sure they are int.
904 987
 		foreach ($msgs as $key => $msg)
905
-			$msgs[$key] = (int) $msg;
988
+		{
989
+					$msgs[$key] = (int) $msg;
990
+		}
906 991
 
907 992
 		// Get the source information.
908 993
 		$request = $db->query('', '
@@ -947,7 +1032,9 @@  discard block
 block discarded – undo
947 1032
 
948 1033
 			require_once(SUBSDIR . '/Members.subs.php');
949 1034
 			while ($row = $db->fetch_assoc($request))
950
-				updateMemberData($row['id_member'], array('posts' => '+'));
1035
+			{
1036
+							updateMemberData($row['id_member'], array('posts' => '+'));
1037
+			}
951 1038
 		}
952 1039
 
953 1040
 		// Time to move the messages.
@@ -986,13 +1073,18 @@  discard block
 block discarded – undo
986 1073
 		while ($row = $db->fetch_assoc($request))
987 1074
 		{
988 1075
 			if ($row['id_first_msg'] < $target_topic_data['id_first_msg'])
989
-				$target_topic_data['id_first_msg'] = $row['id_first_msg'];
1076
+			{
1077
+							$target_topic_data['id_first_msg'] = $row['id_first_msg'];
1078
+			}
990 1079
 			$target_topic_data['id_last_msg'] = $row['id_last_msg'];
991 1080
 
992 1081
 			if (!$row['approved'])
993
-				$target_topic_data['unapproved_posts'] = $row['message_count'];
994
-			else
995
-				$target_topic_data['num_replies'] = max(0, $row['message_count'] - 1);
1082
+			{
1083
+							$target_topic_data['unapproved_posts'] = $row['message_count'];
1084
+			}
1085
+			else {
1086
+							$target_topic_data['num_replies'] = max(0, $row['message_count'] - 1);
1087
+			}
996 1088
 		}
997 1089
 		$db->free_result($request);
998 1090
 
@@ -1047,12 +1139,17 @@  discard block
 block discarded – undo
1047 1139
 			while ($row = $db->fetch_assoc($request))
1048 1140
 			{
1049 1141
 				if ($row['id_first_msg'] < $source_topic_data['id_first_msg'])
1050
-					$source_topic_data['id_first_msg'] = $row['id_first_msg'];
1142
+				{
1143
+									$source_topic_data['id_first_msg'] = $row['id_first_msg'];
1144
+				}
1051 1145
 				$source_topic_data['id_last_msg'] = $row['id_last_msg'];
1052 1146
 				if (!$row['approved'])
1053
-					$source_topic_data['unapproved_posts'] = $row['message_count'];
1054
-				else
1055
-					$source_topic_data['num_replies'] = max(0, $row['message_count'] - 1);
1147
+				{
1148
+									$source_topic_data['unapproved_posts'] = $row['message_count'];
1149
+				}
1150
+				else {
1151
+									$source_topic_data['num_replies'] = max(0, $row['message_count'] - 1);
1152
+				}
1056 1153
 			}
1057 1154
 			$db->free_result($request);
1058 1155
 
@@ -1091,10 +1188,14 @@  discard block
 block discarded – undo
1091 1188
 		// Subject cache?
1092 1189
 		$cache_updates = array();
1093 1190
 		if ($target_first_msg != $target_topic_data['id_first_msg'])
1094
-			$cache_updates[] = $target_topic_data['id_first_msg'];
1191
+		{
1192
+					$cache_updates[] = $target_topic_data['id_first_msg'];
1193
+		}
1095 1194
 
1096 1195
 		if (!empty($source_topic_data['id_first_msg']) && $from_first_msg != $source_topic_data['id_first_msg'])
1097
-			$cache_updates[] = $source_topic_data['id_first_msg'];
1196
+		{
1197
+					$cache_updates[] = $source_topic_data['id_first_msg'];
1198
+		}
1098 1199
 
1099 1200
 		if (!empty($cache_updates))
1100 1201
 		{
@@ -1108,7 +1209,9 @@  discard block
 block discarded – undo
1108 1209
 			);
1109 1210
 			require_once(SUBSDIR . '/Messages.subs.php');
1110 1211
 			while ($row = $db->fetch_assoc($request))
1111
-				updateSubjectStats($row['id_topic'], $row['subject']);
1212
+			{
1213
+							updateSubjectStats($row['id_topic'], $row['subject']);
1214
+			}
1112 1215
 			$db->free_result($request);
1113 1216
 		}
1114 1217
 
Please login to merge, or discard this patch.
sources/subs/GenericList.class.php 1 patch
Braces   +81 added lines, -29 removed lines patch added patch discarded remove patch
@@ -137,12 +137,16 @@  discard block
 block discarded – undo
137 137
 		if (!isset($context['sub_template']))
138 138
 		{
139 139
 			if (function_exists('template_' . $this->listOptions['id']))
140
-				$context['sub_template'] = $this->listOptions['id'];
140
+			{
141
+							$context['sub_template'] = $this->listOptions['id'];
142
+			}
141 143
 			else
142 144
 			{
143 145
 				$context['sub_template'] = 'show_list';
144 146
 				if (!isset($context['default_list']))
145
-					$context['default_list'] = $this->listOptions['id'];
147
+				{
148
+									$context['default_list'] = $this->listOptions['id'];
149
+				}
146 150
 			}
147 151
 		}
148 152
 	}
@@ -220,7 +224,9 @@  discard block
 block discarded – undo
220 224
 		{
221 225
 			// First get an impression of how many items to expect.
222 226
 			if (isset($this->listOptions['get_count']['file']))
223
-				require_once($this->listOptions['get_count']['file']);
227
+			{
228
+							require_once($this->listOptions['get_count']['file']);
229
+			}
224 230
 
225 231
 			$this->context['total_num_items'] = call_user_func_array($this->listOptions['get_count']['function'], empty($this->listOptions['get_count']['params']) ? array() : $this->listOptions['get_count']['params']);
226 232
 
@@ -230,7 +236,9 @@  discard block
 block discarded – undo
230 236
 
231 237
 			// Then create a page index.
232 238
 			if ($this->context['total_num_items'] > $this->context['items_per_page'])
233
-				$this->context['page_index'] = constructPageIndex($this->listOptions['base_href'] . (empty($this->context['sort']) ? '' : ';' . $this->sortVar . '=' . $this->context['sort']['id'] . ($this->context['sort']['desc'] ? ';' . $this->descVar : '')) . ($this->context['start_var_name'] != 'start' ? ';' . $this->context['start_var_name'] . '=%1$d' : ''), $this->context['start'], $this->context['total_num_items'], $this->context['items_per_page'], $this->context['start_var_name'] != 'start');
239
+			{
240
+							$this->context['page_index'] = constructPageIndex($this->listOptions['base_href'] . (empty($this->context['sort']) ? '' : ';' . $this->sortVar . '=' . $this->context['sort']['id'] . ($this->context['sort']['desc'] ? ';' . $this->descVar : '')) . ($this->context['start_var_name'] != 'start' ? ';' . $this->context['start_var_name'] . '=%1$d' : ''), $this->context['start'], $this->context['total_num_items'], $this->context['items_per_page'], $this->context['start_var_name'] != 'start');
241
+			}
234 242
 		}
235 243
 	}
236 244
 
@@ -273,7 +281,9 @@  discard block
 block discarded – undo
273 281
 
274 282
 		// Get the file with the function for the item list.
275 283
 		if (isset($this->listOptions['get_items']['file']))
276
-			require_once($this->listOptions['get_items']['file']);
284
+		{
285
+					require_once($this->listOptions['get_items']['file']);
286
+		}
277 287
 
278 288
 		// Call the function and include which items we want and in what order.
279 289
 		$this->listItems = call_user_func_array($this->listOptions['get_items']['function'], array_merge(array($this->context['start'], $this->context['items_per_page'], $this->sort), empty($this->listOptions['get_items']['params']) ? array() : $this->listOptions['get_items']['params']));
@@ -304,46 +314,66 @@  discard block
 block discarded – undo
304 314
 
305 315
 				// A value straight from the database?
306 316
 				if (isset($column['data']['db']))
307
-					$cur_data['value'] = $list_item[$column['data']['db']];
317
+				{
318
+									$cur_data['value'] = $list_item[$column['data']['db']];
319
+				}
308 320
 				// Take the value from the database and make it HTML safe.
309 321
 				elseif (isset($column['data']['db_htmlsafe']))
310
-					$cur_data['value'] = htmlspecialchars($list_item[$column['data']['db_htmlsafe']], ENT_COMPAT, 'UTF-8');
322
+				{
323
+									$cur_data['value'] = htmlspecialchars($list_item[$column['data']['db_htmlsafe']], ENT_COMPAT, 'UTF-8');
324
+				}
311 325
 				// Using sprintf is probably the most readable way of injecting data.
312 326
 				elseif (isset($column['data']['sprintf']))
313 327
 				{
314 328
 					$params = array();
315 329
 					foreach ($column['data']['sprintf']['params'] as $sprintf_param => $htmlsafe)
316
-						$params[] = $htmlsafe ? htmlspecialchars($list_item[$sprintf_param], ENT_COMPAT, 'UTF-8') : $list_item[$sprintf_param];
330
+					{
331
+											$params[] = $htmlsafe ? htmlspecialchars($list_item[$sprintf_param], ENT_COMPAT, 'UTF-8') : $list_item[$sprintf_param];
332
+					}
317 333
 					$cur_data['value'] = vsprintf($column['data']['sprintf']['format'], $params);
318 334
 				}
319 335
 				// The most flexible way probably is applying a custom function.
320 336
 				elseif (isset($column['data']['function']))
321
-					$cur_data['value'] = $column['data']['function']($list_item);
337
+				{
338
+									$cur_data['value'] = $column['data']['function']($list_item);
339
+				}
322 340
 				// A literal value.
323 341
 				elseif (isset($column['data']['value']))
324
-					$cur_data['value'] = $column['data']['value'];
342
+				{
343
+									$cur_data['value'] = $column['data']['value'];
344
+				}
325 345
 				// Empty value.
326
-				else
327
-					$cur_data['value'] = '';
346
+				else {
347
+									$cur_data['value'] = '';
348
+				}
328 349
 
329 350
 				// Allow for basic formatting.
330 351
 				if (!empty($column['data']['comma_format']))
331
-					$cur_data['value'] = comma_format($cur_data['value']);
352
+				{
353
+									$cur_data['value'] = comma_format($cur_data['value']);
354
+				}
332 355
 				elseif (!empty($column['data']['timeformat']))
333 356
 				{
334 357
 					// Maybe we need a relative time?
335 358
 					if ($column['data']['timeformat'] == 'html_time')
336
-						$cur_data['value'] = htmlTime($cur_data['value']);
337
-					else
338
-						$cur_data['value'] = standardTime($cur_data['value']);
359
+					{
360
+											$cur_data['value'] = htmlTime($cur_data['value']);
361
+					}
362
+					else {
363
+											$cur_data['value'] = standardTime($cur_data['value']);
364
+					}
339 365
 				}
340 366
 				// Set a style class for this column?
341 367
 				if (isset($column['data']['class']))
342
-					$cur_data['class'] = $column['data']['class'];
368
+				{
369
+									$cur_data['class'] = $column['data']['class'];
370
+				}
343 371
 
344 372
 				// Fully customized styling for the cells in this column only.
345 373
 				if (isset($column['data']['style']))
346
-					$cur_data['style'] = $column['data']['style'];
374
+				{
375
+									$cur_data['style'] = $column['data']['style'];
376
+				}
347 377
 
348 378
 				// Add the data cell properties to the current row.
349 379
 				$cur_row[$column_id] = $cur_data;
@@ -355,10 +385,14 @@  discard block
 block discarded – undo
355 385
 			if (isset($this->listOptions['data_check']))
356 386
 			{
357 387
 				if (isset($this->listOptions['data_check']['class']))
358
-					$this->context['rows'][$item_id]['class'] = ' ' . $this->listOptions['data_check']['class']($list_item);
388
+				{
389
+									$this->context['rows'][$item_id]['class'] = ' ' . $this->listOptions['data_check']['class']($list_item);
390
+				}
359 391
 
360 392
 				if (isset($this->listOptions['data_check']['style']))
361
-					$this->context['rows'][$item_id]['style'] = ' style="' . $this->listOptions['data_check']['style']($list_item) . '"';
393
+				{
394
+									$this->context['rows'][$item_id]['style'] = ' style="' . $this->listOptions['data_check']['style']($list_item) . '"';
395
+				}
362 396
 			}
363 397
 
364 398
 			// Insert the row into the list.
@@ -378,7 +412,9 @@  discard block
 block discarded – undo
378 412
 
379 413
 			// And the icon is optional for the title
380 414
 			if (isset($this->listOptions['icon']))
381
-				$this->context['icon'] = $this->listOptions['icon'];
415
+			{
416
+							$this->context['icon'] = $this->listOptions['icon'];
417
+			}
382 418
 		}
383 419
 	}
384 420
 
@@ -397,18 +433,24 @@  discard block
 block discarded – undo
397 433
 			$this->context['form'] = $this->listOptions['form'];
398 434
 
399 435
 			if (!isset($this->context['form']['hidden_fields']))
400
-				$this->context['form']['hidden_fields'] = array();
436
+			{
437
+							$this->context['form']['hidden_fields'] = array();
438
+			}
401 439
 
402 440
 			// Always add a session check field.
403 441
 			$this->context['form']['hidden_fields'][$context['session_var']] = $context['session_id'];
404 442
 
405 443
 			// Will this do a token check?
406 444
 			if (isset($this->listOptions['form']['token']))
407
-				$this->context['form']['hidden_fields'][$context[$this->listOptions['form']['token'] . '_token_var']] = $context[$this->listOptions['form']['token'] . '_token'];
445
+			{
446
+							$this->context['form']['hidden_fields'][$context[$this->listOptions['form']['token'] . '_token_var']] = $context[$this->listOptions['form']['token'] . '_token'];
447
+			}
408 448
 
409 449
 			// Include the starting page as hidden field?
410 450
 			if (!empty($this->context['form']['include_start']) && !empty($this->context['start']))
411
-				$this->context['form']['hidden_fields'][$this->context['start_var_name']] = $this->context['start'];
451
+			{
452
+							$this->context['form']['hidden_fields'][$this->context['start_var_name']] = $this->context['start'];
453
+			}
412 454
 
413 455
 			// If sorting needs to be the same after submitting, add the parameter.
414 456
 			if (!empty($this->context['form']['include_sort']) && !empty($this->context['sort']))
@@ -416,7 +458,9 @@  discard block
 block discarded – undo
416 458
 				$this->context['form']['hidden_fields']['sort'] = $this->context['sort']['id'];
417 459
 
418 460
 				if ($this->context['sort']['desc'])
419
-					$this->context['form']['hidden_fields']['desc'] = 1;
461
+				{
462
+									$this->context['form']['hidden_fields']['desc'] = 1;
463
+				}
420 464
 			}
421 465
 		}
422 466
 	}
@@ -447,10 +491,14 @@  discard block
 block discarded – undo
447 491
 			foreach ($this->listOptions['additional_rows'] as $row)
448 492
 			{
449 493
 				if (empty($row))
450
-					continue;
494
+				{
495
+									continue;
496
+				}
451 497
 
452 498
 				if (!isset($this->context['additional_rows'][$row['position']]))
453
-					$this->context['additional_rows'][$row['position']] = array();
499
+				{
500
+									$this->context['additional_rows'][$row['position']] = array();
501
+				}
454 502
 
455 503
 				$this->context['additional_rows'][$row['position']][] = $row;
456 504
 			}
@@ -463,7 +511,9 @@  discard block
 block discarded – undo
463 511
 	protected function prepareJavascript()
464 512
 	{
465 513
 		if (isset($this->listOptions['javascript']))
466
-			addInlineJavascript($this->listOptions['javascript'], true);
514
+		{
515
+					addInlineJavascript($this->listOptions['javascript'], true);
516
+		}
467 517
 	}
468 518
 
469 519
 	/**
@@ -474,7 +524,9 @@  discard block
 block discarded – undo
474 524
 		if (isset($this->listOptions['list_menu']))
475 525
 		{
476 526
 			if (!isset($this->listOptions['list_menu']['position']))
477
-				$this->listOptions['list_menu']['position'] = 'left';
527
+			{
528
+							$this->listOptions['list_menu']['position'] = 'left';
529
+			}
478 530
 
479 531
 			$this->context['list_menu'] = $this->listOptions['list_menu'];
480 532
 		}
Please login to merge, or discard this patch.
sources/subs/Boards.subs.php 2 patches
Braces   +209 added lines, -79 removed lines patch added patch discarded remove patch
@@ -32,13 +32,18 @@  discard block
 block discarded – undo
32 32
 
33 33
 	// Force $boards to be an array.
34 34
 	if (!is_array($boards))
35
-		$boards = array($boards);
36
-	else
37
-		$boards = array_unique($boards);
35
+	{
36
+			$boards = array($boards);
37
+	}
38
+	else {
39
+			$boards = array_unique($boards);
40
+	}
38 41
 
39 42
 	// No boards, nothing to mark as read.
40 43
 	if (empty($boards))
41
-		return;
44
+	{
45
+			return;
46
+	}
42 47
 
43 48
 	// Allow the user to mark a board as unread.
44 49
 	if ($unread)
@@ -69,7 +74,9 @@  discard block
 block discarded – undo
69 74
 	{
70 75
 		$markRead = array();
71 76
 		foreach ($boards as $board)
72
-			$markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $board);
77
+		{
78
+					$markRead[] = array($modSettings['maxMsgID'], $user_info['id'], $board);
79
+		}
73 80
 
74 81
 		$db->insert('replace',
75 82
 			'{db_prefix}log_boards',
@@ -95,12 +102,14 @@  discard block
 block discarded – undo
95 102
 		// Update log_mark_read and log_boards.
96 103
 		// @todo check this condition <= I think I did, but better double check
97 104
 		if (!$unread && !empty($markRead))
98
-			$db->insert('replace',
105
+		{
106
+					$db->insert('replace',
99 107
 				'{db_prefix}log_mark_read',
100 108
 				array('id_msg' => 'int', 'id_member' => 'int', 'id_board' => 'int'),
101 109
 				$markRead,
102 110
 				array('id_board', 'id_member')
103 111
 			);
112
+		}
104 113
 
105 114
 		$result = $db->query('', '
106 115
 			SELECT MIN(id_topic)
@@ -114,7 +123,9 @@  discard block
 block discarded – undo
114 123
 		$db->free_result($result);
115 124
 
116 125
 		if (empty($lowest_topic))
117
-			return;
126
+		{
127
+					return;
128
+		}
118 129
 
119 130
 		// @todo SLOW This query seems to eat it sometimes.
120 131
 		$delete_topics = array();
@@ -134,19 +145,23 @@  discard block
 block discarded – undo
134 145
 			function ($row) use (&$delete_topics, &$update_topics, $user_info, $modSettings)
135 146
 			{
136 147
 				if (!empty($row['unwatched']))
137
-					$update_topics[] = array(
148
+				{
149
+									$update_topics[] = array(
138 150
 						$user_info['id'],
139 151
 						$modSettings['maxMsgID'],
140 152
 						$row['id_topic'],
141 153
 						1,
142 154
 					);
143
-				else
144
-					$delete_topics[] = $row['id_topic'];
155
+				}
156
+				else {
157
+									$delete_topics[] = $row['id_topic'];
158
+				}
145 159
 			}
146 160
 		);
147 161
 
148 162
 		if (!empty($update_topics))
149
-			$db->insert('replace',
163
+		{
164
+					$db->insert('replace',
150 165
 				'{db_prefix}log_topics',
151 166
 				array(
152 167
 					'id_member' => 'int',
@@ -157,9 +172,11 @@  discard block
 block discarded – undo
157 172
 				$update_topics,
158 173
 				array('id_topic', 'id_member')
159 174
 			);
175
+		}
160 176
 
161 177
 		if (!empty($delete_topics))
162
-			$db->query('', '
178
+		{
179
+					$db->query('', '
163 180
 				DELETE FROM {db_prefix}log_topics
164 181
 				WHERE id_member = {int:current_member}
165 182
 					AND id_topic IN ({array_int:topic_list})',
@@ -168,6 +185,7 @@  discard block
 block discarded – undo
168 185
 					'topic_list' => $delete_topics,
169 186
 				)
170 187
 			);
188
+		}
171 189
 	}
172 190
 }
173 191
 
@@ -209,7 +227,9 @@  discard block
 block discarded – undo
209 227
 
210 228
 	// Make sure given boards and categories exist.
211 229
 	if (!isset($boards[$board_id]) || (isset($boardOptions['target_board']) && !isset($boards[$boardOptions['target_board']])) || (isset($boardOptions['target_category']) && !isset($cat_tree[$boardOptions['target_category']])))
212
-		throw new Elk_Exception('no_board');
230
+	{
231
+			throw new Elk_Exception('no_board');
232
+	}
213 233
 
214 234
 	// All things that will be updated in the database will be in $boardUpdates.
215 235
 	$boardUpdates = array();
@@ -235,7 +255,9 @@  discard block
 block discarded – undo
235 255
 			$id_parent = 0;
236 256
 			$after = 0;
237 257
 			foreach ($cat_tree[$id_cat]['children'] as $id_board => $dummy)
238
-				$after = max($after, $boards[$id_board]['order']);
258
+			{
259
+							$after = max($after, $boards[$id_board]['order']);
260
+			}
239 261
 		}
240 262
 
241 263
 		// Make the board a child of a given board.
@@ -247,16 +269,22 @@  discard block
 block discarded – undo
247 269
 
248 270
 			// People can be creative, in many ways...
249 271
 			if (isChildOf($id_parent, $board_id))
250
-				throw new Elk_Exception('mboards_parent_own_child_error', false);
272
+			{
273
+							throw new Elk_Exception('mboards_parent_own_child_error', false);
274
+			}
251 275
 			elseif ($id_parent == $board_id)
252
-				throw new Elk_Exception('mboards_board_own_child_error', false);
276
+			{
277
+							throw new Elk_Exception('mboards_board_own_child_error', false);
278
+			}
253 279
 
254 280
 			$after = $boards[$boardOptions['target_board']]['order'];
255 281
 
256 282
 			// Check if there are already children and (if so) get the max board order.
257 283
 			if (!empty($boards[$id_parent]['tree']['children']) && empty($boardOptions['move_first_child']))
258
-				foreach ($boards[$id_parent]['tree']['children'] as $childBoard_id => $dummy)
284
+			{
285
+							foreach ($boards[$id_parent]['tree']['children'] as $childBoard_id => $dummy)
259 286
 					$after = max($after, $boards[$childBoard_id]['order']);
287
+			}
260 288
 		}
261 289
 
262 290
 		// Place a board before or after another board, on the same child level.
@@ -269,8 +297,9 @@  discard block
 block discarded – undo
269 297
 		}
270 298
 
271 299
 		// Oops...?
272
-		else
273
-			trigger_error('modifyBoard(): The move_to value \'' . $boardOptions['move_to'] . '\' is incorrect', E_USER_ERROR);
300
+		else {
301
+					trigger_error('modifyBoard(): The move_to value \'' . $boardOptions['move_to'] . '\' is incorrect', E_USER_ERROR);
302
+		}
274 303
 
275 304
 		// Get a list of children of this board.
276 305
 		$childList = array();
@@ -280,13 +309,18 @@  discard block
 block discarded – undo
280 309
 		$childUpdates = array();
281 310
 		$levelDiff = $child_level - $boards[$board_id]['level'];
282 311
 		if ($levelDiff != 0)
283
-			$childUpdates[] = 'child_level = child_level ' . ($levelDiff > 0 ? '+ ' : '') . '{int:level_diff}';
312
+		{
313
+					$childUpdates[] = 'child_level = child_level ' . ($levelDiff > 0 ? '+ ' : '') . '{int:level_diff}';
314
+		}
284 315
 		if ($id_cat != $boards[$board_id]['category'])
285
-			$childUpdates[] = 'id_cat = {int:category}';
316
+		{
317
+					$childUpdates[] = 'id_cat = {int:category}';
318
+		}
286 319
 
287 320
 		// Fix the children of this board.
288 321
 		if (!empty($childList) && !empty($childUpdates))
289
-			$db->query('', '
322
+		{
323
+					$db->query('', '
290 324
 				UPDATE {db_prefix}boards
291 325
 				SET ' . implode(',
292 326
 					', $childUpdates) . '
@@ -297,6 +331,7 @@  discard block
 block discarded – undo
297 331
 					'level_diff' => $levelDiff,
298 332
 				)
299 333
 			);
334
+		}
300 335
 
301 336
 		// Make some room for this spot.
302 337
 		$db->query('', '
@@ -392,7 +427,8 @@  discard block
 block discarded – undo
392 427
 
393 428
 	// Do the updates (if any).
394 429
 	if (!empty($boardUpdates))
395
-		$db->query('', '
430
+	{
431
+			$db->query('', '
396 432
 			UPDATE {db_prefix}boards
397 433
 			SET
398 434
 				' . implode(',
@@ -402,6 +438,7 @@  discard block
 block discarded – undo
402 438
 				'selected_board' => $board_id,
403 439
 			))
404 440
 		);
441
+	}
405 442
 
406 443
 	// Set moderators of this board.
407 444
 	if (isset($boardOptions['moderators']) || isset($boardOptions['moderator_string']))
@@ -427,12 +464,16 @@  discard block
 block discarded – undo
427 464
 				$moderators[$k] = trim($moderators[$k]);
428 465
 
429 466
 				if (strlen($moderators[$k]) == 0)
430
-					unset($moderators[$k]);
467
+				{
468
+									unset($moderators[$k]);
469
+				}
431 470
 			}
432 471
 
433 472
 			// Find all the id_member's for the member_name's in the list.
434 473
 			if (empty($boardOptions['moderators']))
435
-				$boardOptions['moderators'] = array();
474
+			{
475
+							$boardOptions['moderators'] = array();
476
+			}
436 477
 			if (!empty($moderators))
437 478
 			{
438 479
 				$boardOptions['moderators'] = $db->fetchQueryCallback('
@@ -456,7 +497,9 @@  discard block
 block discarded – undo
456 497
 		{
457 498
 			$inserts = array();
458 499
 			foreach ($boardOptions['moderators'] as $moderator)
459
-				$inserts[] = array($board_id, $moderator);
500
+			{
501
+							$inserts[] = array($board_id, $moderator);
502
+			}
460 503
 
461 504
 			$db->insert('insert',
462 505
 				'{db_prefix}moderators',
@@ -471,13 +514,17 @@  discard block
 block discarded – undo
471 514
 	}
472 515
 
473 516
 	if (isset($boardOptions['move_to']))
474
-		reorderBoards();
517
+	{
518
+			reorderBoards();
519
+	}
475 520
 
476 521
 	clean_cache('data');
477 522
 
478 523
 	if (empty($boardOptions['dont_log']))
479
-		logAction('edit_board', array('board' => $board_id), 'admin');
480
-}
524
+	{
525
+			logAction('edit_board', array('board' => $board_id), 'admin');
526
+	}
527
+	}
481 528
 
482 529
 /**
483 530
  * Create a new board and set its properties and position.
@@ -499,10 +546,14 @@  discard block
 block discarded – undo
499 546
 
500 547
 	// Trigger an error if one of the required values is not set.
501 548
 	if (!isset($boardOptions['board_name']) || trim($boardOptions['board_name']) == '' || !isset($boardOptions['move_to']) || !isset($boardOptions['target_category']))
502
-		trigger_error('createBoard(): One or more of the required options is not set', E_USER_ERROR);
549
+	{
550
+			trigger_error('createBoard(): One or more of the required options is not set', E_USER_ERROR);
551
+	}
503 552
 
504 553
 	if (in_array($boardOptions['move_to'], array('child', 'before', 'after')) && !isset($boardOptions['target_board']))
505
-		trigger_error('createBoard(): Target board is not set', E_USER_ERROR);
554
+	{
555
+			trigger_error('createBoard(): Target board is not set', E_USER_ERROR);
556
+	}
506 557
 
507 558
 	// Set every optional value to its default value.
508 559
 	$boardOptions += array(
@@ -535,7 +586,9 @@  discard block
 block discarded – undo
535 586
 	$board_id = $db->insert_id('{db_prefix}boards', 'id_board');
536 587
 
537 588
 	if (empty($board_id))
538
-		return 0;
589
+	{
590
+			return 0;
591
+	}
539 592
 
540 593
 	// Change the board according to the given specifications.
541 594
 	modifyBoard($board_id, $boardOptions);
@@ -594,7 +647,9 @@  discard block
 block discarded – undo
594 647
 
595 648
 	// No boards to delete? Return!
596 649
 	if (empty($boards_to_remove))
597
-		return;
650
+	{
651
+			return;
652
+	}
598 653
 
599 654
 	getBoardTree();
600 655
 
@@ -606,11 +661,15 @@  discard block
 block discarded – undo
606 661
 		// Get a list of the sub-boards that will also be removed.
607 662
 		$child_boards_to_remove = array();
608 663
 		foreach ($boards_to_remove as $board_to_remove)
609
-			recursiveBoards($child_boards_to_remove, $boards[$board_to_remove]['tree']);
664
+		{
665
+					recursiveBoards($child_boards_to_remove, $boards[$board_to_remove]['tree']);
666
+		}
610 667
 
611 668
 		// Merge the children with their parents.
612 669
 		if (!empty($child_boards_to_remove))
613
-			$boards_to_remove = array_unique(array_merge($boards_to_remove, $child_boards_to_remove));
670
+		{
671
+					$boards_to_remove = array_unique(array_merge($boards_to_remove, $child_boards_to_remove));
672
+		}
614 673
 	}
615 674
 	// Move the children to a safe home.
616 675
 	else
@@ -619,9 +678,12 @@  discard block
 block discarded – undo
619 678
 		{
620 679
 			// @todo Separate category?
621 680
 			if ($moveChildrenTo === 0)
622
-				fixChildren($id_board, 0, 0);
623
-			else
624
-				fixChildren($id_board, $boards[$moveChildrenTo]['level'] + 1, $moveChildrenTo);
681
+			{
682
+							fixChildren($id_board, 0, 0);
683
+			}
684
+			else {
685
+							fixChildren($id_board, $boards[$moveChildrenTo]['level'] + 1, $moveChildrenTo);
686
+			}
625 687
 		}
626 688
 	}
627 689
 
@@ -714,7 +776,9 @@  discard block
 block discarded – undo
714 776
 
715 777
 	// Let's do some serious logging.
716 778
 	foreach ($boards_to_remove as $id_board)
717
-		logAction('delete_board', array('boardname' => $boards[$id_board]['name']), 'admin');
779
+	{
780
+			logAction('delete_board', array('boardname' => $boards[$id_board]['name']), 'admin');
781
+	}
718 782
 
719 783
 	reorderBoards();
720 784
 }
@@ -739,7 +803,8 @@  discard block
 block discarded – undo
739 803
 	foreach ($cat_tree as $catID => $dummy)
740 804
 	{
741 805
 		foreach ($boardList[$catID] as $boardID)
742
-			if ($boards[$boardID]['order'] != ++$board_order)
806
+		{
807
+					if ($boards[$boardID]['order'] != ++$board_order)
743 808
 				$db->query('', '
744 809
 					UPDATE {db_prefix}boards
745 810
 					SET board_order = {int:new_order}
@@ -749,6 +814,7 @@  discard block
 block discarded – undo
749 814
 						'selected_board' => $boardID,
750 815
 					)
751 816
 				);
817
+		}
752 818
 	}
753 819
 
754 820
 	// Sort the records of the boards table on the board_order value.
@@ -803,8 +869,10 @@  discard block
 block discarded – undo
803 869
 
804 870
 	// Recursively fix the children of the children.
805 871
 	foreach ($children as $child)
806
-		fixChildren($child, $newLevel + 1, $child);
807
-}
872
+	{
873
+			fixChildren($child, $newLevel + 1, $child);
874
+	}
875
+	}
808 876
 
809 877
 /**
810 878
  * Load a lot of useful information regarding the boards and categories.
@@ -867,7 +935,9 @@  discard block
 block discarded – undo
867 935
 		if (!empty($row['id_board']))
868 936
 		{
869 937
 			if ($row['child_level'] != $curLevel)
870
-				$prevBoard = 0;
938
+			{
939
+							$prevBoard = 0;
940
+			}
871 941
 
872 942
 			$boards[$row['id_board']] = array(
873 943
 				'id' => $row['id_board'],
@@ -904,11 +974,14 @@  discard block
 block discarded – undo
904 974
 			{
905 975
 				// Parent doesn't exist!
906 976
 				if (!isset($boards[$row['id_parent']]['tree']))
907
-					throw new Elk_Exception('no_valid_parent', false, array($row['board_name']));
977
+				{
978
+									throw new Elk_Exception('no_valid_parent', false, array($row['board_name']));
979
+				}
908 980
 
909 981
 				// Wrong childlevel...we can silently fix this...
910 982
 				if ($boards[$row['id_parent']]['tree']['node']['level'] != $row['child_level'] - 1)
911
-					$db->query('', '
983
+				{
984
+									$db->query('', '
912 985
 						UPDATE {db_prefix}boards
913 986
 						SET child_level = {int:new_child_level}
914 987
 						WHERE id_board = {int:selected_board}',
@@ -917,6 +990,7 @@  discard block
 block discarded – undo
917 990
 							'selected_board' => $row['id_board'],
918 991
 						)
919 992
 					);
993
+				}
920 994
 
921 995
 				$boards[$row['id_parent']]['tree']['children'][$row['id_board']] = array(
922 996
 					'node' => &$boards[$row['id_board']],
@@ -961,7 +1035,9 @@  discard block
 block discarded – undo
961 1035
 	$db = database();
962 1036
 
963 1037
 	if ((isset($boardListOptions['excluded_boards']) || isset($boardListOptions['allowed_to'])) && isset($boardListOptions['included_boards']))
964
-		trigger_error('getBoardList(): Setting both excluded_boards and included_boards is not allowed.', E_USER_ERROR);
1038
+	{
1039
+			trigger_error('getBoardList(): Setting both excluded_boards and included_boards is not allowed.', E_USER_ERROR);
1040
+	}
965 1041
 
966 1042
 	$where = array();
967 1043
 	$join = array();
@@ -980,7 +1056,9 @@  discard block
 block discarded – undo
980 1056
 	{
981 1057
 		$boardListOptions['included_boards'] = boardsAllowedTo($boardListOptions['allowed_to']);
982 1058
 		if (in_array(0, $boardListOptions['included_boards']))
983
-			unset($boardListOptions['included_boards']);
1059
+		{
1060
+					unset($boardListOptions['included_boards']);
1061
+		}
984 1062
 	}
985 1063
 
986 1064
 	// Just want to include certain boards in the query
@@ -1016,10 +1094,14 @@  discard block
 block discarded – undo
1016 1094
 	}
1017 1095
 
1018 1096
 	if (!empty($boardListOptions['ignore_boards']) && empty($boardListOptions['override_permissions']))
1019
-		$where[] = '{query_wanna_see_board}';
1097
+	{
1098
+			$where[] = '{query_wanna_see_board}';
1099
+	}
1020 1100
 
1021 1101
 	elseif (empty($boardListOptions['override_permissions']))
1022
-		$where[] = '{query_see_board}';
1102
+	{
1103
+			$where[] = '{query_see_board}';
1104
+	}
1023 1105
 
1024 1106
 	if (!empty($boardListOptions['not_redirection']))
1025 1107
 	{
@@ -1082,11 +1164,13 @@  discard block
 block discarded – undo
1082 1164
 		{
1083 1165
 			// This category hasn't been set up yet..
1084 1166
 			if (!isset($return_value['categories'][$row['id_cat']]))
1085
-				$return_value['categories'][$row['id_cat']] = array(
1167
+			{
1168
+							$return_value['categories'][$row['id_cat']] = array(
1086 1169
 					'id' => $row['id_cat'],
1087 1170
 					'name' => $row['cat_name'],
1088 1171
 					'boards' => array(),
1089 1172
 				);
1173
+			}
1090 1174
 
1091 1175
 			// Shortcuts are useful to keep things simple
1092 1176
 			$this_cat = &$return_value['categories'][$row['id_cat']];
@@ -1114,7 +1198,9 @@  discard block
 block discarded – undo
1114 1198
 
1115 1199
 				// If a board wasn't checked that probably should have been ensure the board selection is selected, yo!
1116 1200
 				if (!empty($this_cat['boards'][$row['id_board']]['selected']) && (empty($modSettings['recycle_enable']) || $row['id_board'] != $modSettings['recycle_board']))
1117
-					$return_value['boards_check_all'] = false;
1201
+				{
1202
+									$return_value['boards_check_all'] = false;
1203
+				}
1118 1204
 			}
1119 1205
 
1120 1206
 			// Do we want moderation information?
@@ -1146,7 +1232,9 @@  discard block
 block discarded – undo
1146 1232
 function recursiveBoards(&$_boardList, &$_tree)
1147 1233
 {
1148 1234
 	if (empty($_tree['children']))
1149
-		return;
1235
+	{
1236
+			return;
1237
+	}
1150 1238
 
1151 1239
 	foreach ($_tree['children'] as $id => $node)
1152 1240
 	{
@@ -1169,10 +1257,14 @@  discard block
 block discarded – undo
1169 1257
 	global $boards;
1170 1258
 
1171 1259
 	if (empty($boards[$child]['parent']))
1172
-		return false;
1260
+	{
1261
+			return false;
1262
+	}
1173 1263
 
1174 1264
 	if ($boards[$child]['parent'] == $parent)
1175
-		return true;
1265
+	{
1266
+			return true;
1267
+	}
1176 1268
 
1177 1269
 	return isChildOf($boards[$child]['parent'], $parent);
1178 1270
 }
@@ -1277,13 +1369,17 @@  discard block
 block discarded – undo
1277 1369
 		);
1278 1370
 		// nothing to do
1279 1371
 		if ($db->num_rows($request) == 0)
1280
-			return false;
1372
+		{
1373
+					return false;
1374
+		}
1281 1375
 		$sent = $db->fetch_row($request);
1282 1376
 		$db->free_result($request);
1283 1377
 
1284 1378
 		// not sent already? No need to stay around then
1285 1379
 		if (empty($sent))
1286
-			return true;
1380
+		{
1381
+					return true;
1382
+		}
1287 1383
 	}
1288 1384
 
1289 1385
 	// Reset 'sent' status.
@@ -1388,7 +1484,9 @@  discard block
 block discarded – undo
1388 1484
 	}
1389 1485
 
1390 1486
 	while ($row = $db->fetch_assoc($request))
1391
-		$boards[] = $row['id_board'];
1487
+	{
1488
+			$boards[] = $row['id_board'];
1489
+	}
1392 1490
 	$db->free_result($request);
1393 1491
 
1394 1492
 	return $boards;
@@ -1510,7 +1608,9 @@  discard block
 block discarded – undo
1510 1608
 	while ($row = $db->fetch_assoc($request))
1511 1609
 	{
1512 1610
 		if ($new_board && $row['min_posts'] == -1)
1513
-			$curBoard['member_groups'][] = $row['id_group'];
1611
+		{
1612
+					$curBoard['member_groups'][] = $row['id_group'];
1613
+		}
1514 1614
 
1515 1615
 		$groups[(int) $row['id_group']] = array(
1516 1616
 			'id' => $row['id_group'],
@@ -1550,7 +1650,9 @@  discard block
 block discarded – undo
1550 1650
 			)
1551 1651
 		);
1552 1652
 		while ($row = $db->fetch_assoc($request))
1553
-			$moderators[] = $row['id_member'];
1653
+		{
1654
+					$moderators[] = $row['id_member'];
1655
+		}
1554 1656
 	}
1555 1657
 	else
1556 1658
 	{
@@ -1565,7 +1667,9 @@  discard block
 block discarded – undo
1565 1667
 		);
1566 1668
 
1567 1669
 		while ($row = $db->fetch_assoc($request))
1568
-			$moderators[$row['id_member']] = $row['real_name'];
1670
+		{
1671
+					$moderators[$row['id_member']] = $row['real_name'];
1672
+		}
1569 1673
 	}
1570 1674
 	$db->free_result($request);
1571 1675
 
@@ -1587,27 +1691,33 @@  discard block
 block discarded – undo
1587 1691
 	$moderators = array();
1588 1692
 
1589 1693
 	if ($only_id)
1590
-		$request = $db->query('', '
1694
+	{
1695
+			$request = $db->query('', '
1591 1696
 			SELECT id_board, id_member
1592 1697
 			FROM {db_prefix}moderators',
1593 1698
 			array(
1594 1699
 			)
1595 1700
 		);
1596
-	else
1597
-		$request = $db->query('', '
1701
+	}
1702
+	else {
1703
+			$request = $db->query('', '
1598 1704
 			SELECT mods.id_board, mods.id_member, mem.real_name
1599 1705
 			FROM {db_prefix}moderators AS mods
1600 1706
 				INNER JOIN {db_prefix}members AS mem ON (mem.id_member = mods.id_member)',
1601 1707
 			array(
1602 1708
 			)
1603 1709
 		);
1710
+	}
1604 1711
 
1605 1712
 	while ($row = $db->fetch_assoc($request))
1606 1713
 	{
1607 1714
 		if ($only_id)
1608
-			$moderators[$row['id_member']][] = $row;
1609
-		else
1610
-			$moderators[$row['id_board']][] = $row;
1715
+		{
1716
+					$moderators[$row['id_member']][] = $row;
1717
+		}
1718
+		else {
1719
+					$moderators[$row['id_board']][] = $row;
1720
+		}
1611 1721
 	}
1612 1722
 	$db->free_result($request);
1613 1723
 
@@ -1725,7 +1835,9 @@  discard block
 block discarded – undo
1725 1835
 	}
1726 1836
 
1727 1837
 	if (empty($clauses))
1728
-		return array();
1838
+	{
1839
+			return array();
1840
+	}
1729 1841
 
1730 1842
 	$request = $db->query('', '
1731 1843
 		SELECT b.id_board, b.num_posts
@@ -1737,7 +1849,9 @@  discard block
 block discarded – undo
1737 1849
 	);
1738 1850
 	$return = array();
1739 1851
 	while ($row = $db->fetch_assoc($request))
1740
-		$return[$row['id_board']] = $row['num_posts'];
1852
+	{
1853
+			$return[$row['id_board']] = $row['num_posts'];
1854
+	}
1741 1855
 	$db->free_result($request);
1742 1856
 
1743 1857
 	return $return;
@@ -1806,9 +1920,12 @@  discard block
 block discarded – undo
1806 1920
 	);
1807 1921
 
1808 1922
 	if (!empty($params['sort_by']) && in_array($params['sort_by'], $allowed_sort))
1809
-		$sort_by = 'ORDER BY ' . $params['sort_by'];
1810
-	else
1811
-		$sort_by = '';
1923
+	{
1924
+			$sort_by = 'ORDER BY ' . $params['sort_by'];
1925
+	}
1926
+	else {
1927
+			$sort_by = '';
1928
+	}
1812 1929
 
1813 1930
 	// @todo: memos for optimization
1814 1931
 	/*
@@ -1855,13 +1972,18 @@  discard block
 block discarded – undo
1855 1972
 		}
1856 1973
 
1857 1974
 		if ($params['override_permissions'])
1858
-			$security = '1=1';
1859
-		else
1860
-			$security = $params['wanna_see_board'] ? '{query_wanna_see_board}' : '{query_see_board}';
1975
+		{
1976
+					$security = '1=1';
1977
+		}
1978
+		else {
1979
+					$security = $params['wanna_see_board'] ? '{query_wanna_see_board}' : '{query_see_board}';
1980
+		}
1861 1981
 
1862 1982
 		// Prevent a bad query, from a triggered scheduled task or some other issue.
1863 1983
 		if (empty($security))
1864
-			return array();
1984
+		{
1985
+					return array();
1986
+		}
1865 1987
 
1866 1988
 		$request = $db->query('', '
1867 1989
 			SELECT ' . $select . '
@@ -1879,7 +2001,9 @@  discard block
 block discarded – undo
1879 2001
 	}
1880 2002
 	$return = array();
1881 2003
 	while ($row = $db->fetch_assoc($request))
1882
-		$return[$row['id_board']] = $row;
2004
+	{
2005
+			$return[$row['id_board']] = $row;
2006
+	}
1883 2007
 
1884 2008
 	$db->free_result($request);
1885 2009
 
@@ -1968,7 +2092,9 @@  discard block
 block discarded – undo
1968 2092
 	}
1969 2093
 
1970 2094
 	if (empty($set))
1971
-		return;
2095
+	{
2096
+			return;
2097
+	}
1972 2098
 
1973 2099
 	$db->query('', '
1974 2100
 		UPDATE {db_prefix}boards
@@ -2012,7 +2138,9 @@  discard block
 block discarded – undo
2012 2138
 	}
2013 2139
 
2014 2140
 	if (empty($set))
2015
-		return;
2141
+	{
2142
+			return;
2143
+	}
2016 2144
 
2017 2145
 	$db->query('', '
2018 2146
 		UPDATE {db_prefix}boards
@@ -2087,7 +2215,8 @@  discard block
 block discarded – undo
2087 2215
 		)
2088 2216
 	);
2089 2217
 	while ($row = $db->fetch_assoc($request))
2090
-		$notification_boards[] = array(
2218
+	{
2219
+			$notification_boards[] = array(
2091 2220
 			'id' => $row['id_board'],
2092 2221
 			'name' => $row['name'],
2093 2222
 			'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
@@ -2095,6 +2224,7 @@  discard block
 block discarded – undo
2095 2224
 			'new' => $row['board_read'] < $row['id_msg_updated'],
2096 2225
 			'checked' => '',
2097 2226
 		);
2227
+	}
2098 2228
 	$db->free_result($request);
2099 2229
 
2100 2230
 	return $notification_boards;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				'board_list' => $boards,
132 132
 				'lowest_topic' => $lowest_topic,
133 133
 			),
134
-			function ($row) use (&$delete_topics, &$update_topics, $user_info, $modSettings)
134
+			function($row) use (&$delete_topics, &$update_topics, $user_info, $modSettings)
135 135
 			{
136 136
 				if (!empty($row['unwatched']))
137 137
 					$update_topics[] = array(
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 					array(
444 444
 						'moderator_list' => $moderators,
445 445
 					),
446
-					function ($row)
446
+					function($row)
447 447
 					{
448 448
 						return $row['id_member'];
449 449
 					}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 		array(
784 784
 			'parent_board' => $parent,
785 785
 		),
786
-		function ($row)
786
+		function($row)
787 787
 		{
788 788
 			return $row['id_board'];
789 789
 		}
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 		array(
1421 1421
 			'recycle_board' => (int) $modSettings['recycle_board'],
1422 1422
 		),
1423
-		function ($row)
1423
+		function($row)
1424 1424
 		{
1425 1425
 			return $row['id_board'];
1426 1426
 		}
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 		array(
1633 1633
 			'current_member' => $id_member,
1634 1634
 		),
1635
-		function ($row)
1635
+		function($row)
1636 1636
 		{
1637 1637
 			return $row['id_board'];
1638 1638
 		}
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 			'current_member' => $user_info['id'],
2058 2058
 			'selected_member' => $memID,
2059 2059
 		),
2060
-		function ($row) use ($scripturl)
2060
+		function($row) use ($scripturl)
2061 2061
 		{
2062 2062
 			return array(
2063 2063
 				'id' => $row['id_board'],
Please login to merge, or discard this patch.
sources/subs/Profile.subs.php 2 patches
Braces   +524 added lines, -199 removed lines patch added patch discarded remove patch
@@ -31,17 +31,24 @@  discard block
 block discarded – undo
31 31
 
32 32
 	// If we already know who we're dealing with
33 33
 	if (isset($memID) && !$reload_id)
34
-		return $memID;
34
+	{
35
+			return $memID;
36
+	}
35 37
 
36 38
 	// Did we get the user by name...
37 39
 	if (isset($_REQUEST['user']))
38
-		$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
40
+	{
41
+			$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
42
+	}
39 43
 	// ... or by id_member?
40 44
 	elseif (!empty($_REQUEST['u']))
41
-		$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
45
+	{
46
+			$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
47
+	}
42 48
 	// If it was just ?action=profile, edit your own profile.
43
-	else
44
-		$memberResult = loadMemberData($user_info['id'], false, 'profile');
49
+	else {
50
+			$memberResult = loadMemberData($user_info['id'], false, 'profile');
51
+	}
45 52
 
46 53
 	// Check if loadMemberData() has returned a valid result.
47 54
 	if (!is_array($memberResult))
@@ -50,9 +57,12 @@  discard block
 block discarded – undo
50 57
 		is_not_guest('', $fatal);
51 58
 
52 59
 		if ($fatal)
53
-			throw new Elk_Exception('not_a_user', false);
54
-		else
55
-			return false;
60
+		{
61
+					throw new Elk_Exception('not_a_user', false);
62
+		}
63
+		else {
64
+					return false;
65
+		}
56 66
 	}
57 67
 
58 68
 	// If all went well, we have a valid member ID!
@@ -72,15 +82,19 @@  discard block
 block discarded – undo
72 82
 	global $profile_fields, $context, $cur_profile, $txt;
73 83
 
74 84
 	if (!empty($hook))
75
-		call_integration_hook('integrate_' . $hook . '_profile_fields', array(&$fields));
85
+	{
86
+			call_integration_hook('integrate_' . $hook . '_profile_fields', array(&$fields));
87
+	}
76 88
 
77 89
 	// Make sure we have this!
78 90
 	loadProfileFields(true);
79 91
 
80 92
 	// First check for any linked sets.
81 93
 	foreach ($profile_fields as $key => $field)
82
-		if (isset($field['link_with']) && in_array($field['link_with'], $fields))
94
+	{
95
+			if (isset($field['link_with']) && in_array($field['link_with'], $fields))
83 96
 			$fields[] = $key;
97
+	}
84 98
 
85 99
 	// Some default bits.
86 100
 	$context['profile_prehtml'] = '';
@@ -98,17 +112,23 @@  discard block
 block discarded – undo
98 112
 
99 113
 			// Does it have a preload and does that preload succeed?
100 114
 			if (isset($cur_field['preload']) && !$cur_field['preload']())
101
-				continue;
115
+			{
116
+							continue;
117
+			}
102 118
 
103 119
 			// If this is anything but complex we need to do more cleaning!
104 120
 			if ($cur_field['type'] !== 'callback' && $cur_field['type'] !== 'hidden')
105 121
 			{
106 122
 				if (!isset($cur_field['label']))
107
-					$cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field;
123
+				{
124
+									$cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field;
125
+				}
108 126
 
109 127
 				// Everything has a value!
110 128
 				if (!isset($cur_field['value']))
111
-					$cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : '';
129
+				{
130
+									$cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : '';
131
+				}
112 132
 
113 133
 				// Any input attributes?
114 134
 				$cur_field['input_attr'] = !empty($cur_field['input_attr']) ? implode(',', $cur_field['input_attr']) : '';
@@ -116,21 +136,33 @@  discard block
 block discarded – undo
116 136
 
117 137
 			// Was there an error with this field on posting?
118 138
 			if (isset($context['post_errors'][$field]))
119
-				$cur_field['is_error'] = true;
139
+			{
140
+							$cur_field['is_error'] = true;
141
+			}
120 142
 
121 143
 			// Any javascript stuff?
122 144
 			if (!empty($cur_field['js_submit']))
123
-				$context['profile_onsubmit_javascript'] .= $cur_field['js_submit'];
145
+			{
146
+							$context['profile_onsubmit_javascript'] .= $cur_field['js_submit'];
147
+			}
124 148
 			if (!empty($cur_field['js']))
125
-				addInlineJavascript($cur_field['js']);
149
+			{
150
+							addInlineJavascript($cur_field['js']);
151
+			}
126 152
 			if (!empty($cur_field['js_load']))
127
-				loadJavascriptFile($cur_field['js_load']);
153
+			{
154
+							loadJavascriptFile($cur_field['js_load']);
155
+			}
128 156
 
129 157
 			// Any template stuff?
130 158
 			if (!empty($cur_field['prehtml']))
131
-				$context['profile_prehtml'] .= $cur_field['prehtml'];
159
+			{
160
+							$context['profile_prehtml'] .= $cur_field['prehtml'];
161
+			}
132 162
 			if (!empty($cur_field['posthtml']))
133
-				$context['profile_posthtml'] .= $cur_field['posthtml'];
163
+			{
164
+							$context['profile_posthtml'] .= $cur_field['posthtml'];
165
+			}
134 166
 
135 167
 			// Finally put it into context?
136 168
 			if ($cur_field['type'] !== 'hidden')
@@ -171,15 +203,22 @@  discard block
 block discarded – undo
171 203
 	{
172 204
 		// If it's the owner they can see two types of private fields, regardless.
173 205
 		if ($memID == $user_info['id'])
174
-			$where .= $area === 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
175
-		else
176
-			$where .= $area === 'summary' ? ' AND private < 2' : ' AND private = 0';
206
+		{
207
+					$where .= $area === 'summary' ? ' AND private < 3' : ' AND (private = 0 OR private = 2)';
208
+		}
209
+		else {
210
+					$where .= $area === 'summary' ? ' AND private < 2' : ' AND private = 0';
211
+		}
177 212
 	}
178 213
 
179 214
 	if ($area === 'register')
180
-		$where .= ' AND show_reg != 0';
215
+	{
216
+			$where .= ' AND show_reg != 0';
217
+	}
181 218
 	elseif ($area !== 'summary')
182
-		$where .= ' AND show_profile = {string:area}';
219
+	{
220
+			$where .= ' AND show_profile = {string:area}';
221
+	}
183 222
 
184 223
 	// Load all the relevant fields - and data.
185 224
 	// The fully-qualified name for rows is here because it's a reserved word in Mariadb 10.2.4+ and quoting would be different for MySQL/Mariadb and PSQL
@@ -274,10 +313,14 @@  discard block
 block discarded – undo
274 313
 
275 314
 		// Parse BBCode
276 315
 		if ($row['bbc'])
277
-			$output_html = $bbc_parser->parseCustomFields($output_html);
316
+		{
317
+					$output_html = $bbc_parser->parseCustomFields($output_html);
318
+		}
278 319
 		// Allow for newlines at least
279 320
 		elseif ($row['field_type'] === 'textarea')
280
-			$output_html = strtr($output_html, array("\n" => '<br />'));
321
+		{
322
+					$output_html = strtr($output_html, array("\n" => '<br />'));
323
+		}
281 324
 
282 325
 		// Enclosing the user input within some other text?
283 326
 		if (!empty($row['enclose']) && !empty($output_html))
@@ -333,7 +376,9 @@  discard block
 block discarded – undo
333 376
 
334 377
 	// Don't load this twice!
335 378
 	if (!empty($profile_fields) && !$force_reload)
336
-		return;
379
+	{
380
+			return;
381
+	}
337 382
 
338 383
 	/**
339 384
 	 * This horrific array defines all the profile fields in the whole world!
@@ -414,12 +459,16 @@  discard block
 block discarded – undo
414 459
 				{
415 460
 					// Set to blank?
416 461
 					if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1)
417
-						$value = '0001-01-01';
418
-					else
419
-						$value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01';
462
+					{
463
+											$value = '0001-01-01';
464
+					}
465
+					else {
466
+											$value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01';
467
+					}
468
+				}
469
+				else {
470
+									$value = '0001-01-01';
420 471
 				}
421
-				else
422
-					$value = '0001-01-01';
423 472
 
424 473
 				$profile_vars['birthdate'] = $value;
425 474
 				$cur_profile['birthdate'] = $value;
@@ -463,9 +512,12 @@  discard block
 block discarded – undo
463 512
 				}
464 513
 				// As long as it doesn't equal "N/A"...
465 514
 				elseif ($value != $txt['not_applicable'] && $value != strtotime(Util::strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600)))
466
-					$value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
467
-				else
468
-					$value = $cur_profile['date_registered'];
515
+				{
516
+									$value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
517
+				}
518
+				else {
519
+									$value = $cur_profile['date_registered'];
520
+				}
469 521
 
470 522
 				return true;
471 523
 			},
@@ -480,7 +532,9 @@  discard block
 block discarded – undo
480 532
 				global $context, $old_profile, $profile_vars, $modSettings;
481 533
 
482 534
 				if (strtolower($value) == strtolower($old_profile['email_address']))
483
-					return false;
535
+				{
536
+									return false;
537
+				}
484 538
 
485 539
 				$isValid = profileValidateEmail($value, $context['id_member']);
486 540
 
@@ -595,7 +649,9 @@  discard block
 block discarded – undo
595 649
 				if (isset($context['profile_languages'][$value]))
596 650
 				{
597 651
 					if ($context['user']['is_owner'] && empty($context['password_auth_failed']))
598
-						$_SESSION['language'] = $value;
652
+					{
653
+											$_SESSION['language'] = $value;
654
+					}
599 655
 					return true;
600 656
 				}
601 657
 				else
@@ -641,14 +697,18 @@  discard block
 block discarded – undo
641 697
 
642 698
 						// No errors we can proceed normally
643 699
 						if (!$errors->hasErrors())
644
-							updateMemberData($context['id_member'], array('member_name' => $value));
700
+						{
701
+													updateMemberData($context['id_member'], array('member_name' => $value));
702
+						}
645 703
 						else
646 704
 						{
647 705
 							// If there are "important" errors and you are not an admin: log the first error
648 706
 							// Otherwise grab all of them and do not log anything
649 707
 							$error_severity = $errors->hasErrors(1) && !$user_info['is_admin'] ? 1 : null;
650 708
 							foreach ($errors->prepareErrors($error_severity) as $error)
651
-								throw new Elk_Exception($error, $error_severity === null ? false : 'general');
709
+							{
710
+															throw new Elk_Exception($error, $error_severity === null ? false : 'general');
711
+							}
652 712
 						}
653 713
 					}
654 714
 				}
@@ -670,11 +730,15 @@  discard block
 block discarded – undo
670 730
 
671 731
 				// If we didn't try it then ignore it!
672 732
 				if ($value == '')
673
-					return false;
733
+				{
734
+									return false;
735
+				}
674 736
 
675 737
 				// Do the two entries for the password even match?
676 738
 				if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2'])
677
-					return 'bad_new_password';
739
+				{
740
+									return 'bad_new_password';
741
+				}
678 742
 
679 743
 				// Let's get the validation function into play...
680 744
 				require_once(SUBSDIR . '/Auth.subs.php');
@@ -682,7 +746,9 @@  discard block
 block discarded – undo
682 746
 
683 747
 				// Were there errors?
684 748
 				if ($passwordErrors !== null)
685
-					return 'password_' . $passwordErrors;
749
+				{
750
+									return 'password_' . $passwordErrors;
751
+				}
686 752
 
687 753
 				// Set up the new password variable... ready for storage.
688 754
 				require_once(SUBSDIR . '/Auth.subs.php');
@@ -771,9 +837,12 @@  discard block
 block discarded – undo
771 837
 			'permission' => 'moderate_forum',
772 838
 			'input_validate' => function (&$value) {
773 839
 				if (!is_numeric($value))
774
-					return 'digits_only';
775
-				else
776
-					$value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0;
840
+				{
841
+									return 'digits_only';
842
+				}
843
+				else {
844
+									$value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0;
845
+				}
777 846
 				return true;
778 847
 			},
779 848
 		),
@@ -791,14 +860,20 @@  discard block
 block discarded – undo
791 860
 				$value = trim(preg_replace('~[\s]~u', ' ', $value));
792 861
 
793 862
 				if (trim($value) == '')
794
-					return 'no_name';
863
+				{
864
+									return 'no_name';
865
+				}
795 866
 				elseif (Util::strlen($value) > 60)
796
-					return 'name_too_long';
867
+				{
868
+									return 'name_too_long';
869
+				}
797 870
 				elseif ($cur_profile['real_name'] != $value)
798 871
 				{
799 872
 					require_once(SUBSDIR . '/Members.subs.php');
800 873
 					if (isReservedName($value, $context['id_member']))
801
-						return 'name_taken';
874
+					{
875
+											return 'name_taken';
876
+					}
802 877
 				}
803 878
 				return true;
804 879
 			},
@@ -877,7 +952,9 @@  discard block
 block discarded – undo
877 952
 					);
878 953
 
879 954
 					if ($context['smiley_sets'][$i]['selected'])
880
-						$context['member']['smiley_set']['name'] = $set_names[$i];
955
+					{
956
+											$context['member']['smiley_set']['name'] = $set_names[$i];
957
+					}
881 958
 				}
882 959
 				return true;
883 960
 			},
@@ -886,7 +963,9 @@  discard block
 block discarded – undo
886 963
 
887 964
 				$smiley_sets = explode(',', $modSettings['smiley_sets_known']);
888 965
 				if (!in_array($value, $smiley_sets) && $value !== 'none')
889
-					$value = '';
966
+				{
967
+									$value = '';
968
+				}
890 969
 				return true;
891 970
 			},
892 971
 		),
@@ -904,7 +983,9 @@  discard block
 block discarded – undo
904 983
 				// Can they disable censoring?
905 984
 				$context['allow_no_censored'] = false;
906 985
 				if ($user_info['is_admin'] || $context['user']['is_owner'])
907
-					$context['allow_no_censored'] = allowedTo('disable_censor');
986
+				{
987
+									$context['allow_no_censored'] = allowedTo('disable_censor');
988
+				}
908 989
 
909 990
 				return true;
910 991
 			},
@@ -947,7 +1028,9 @@  discard block
 block discarded – undo
947 1028
 				$value = (float) strtr($value, ',', '.');
948 1029
 
949 1030
 				if ($value < -23.5 || $value > 23.5)
950
-					return 'bad_offset';
1031
+				{
1032
+									return 'bad_offset';
1033
+				}
951 1034
 
952 1035
 				return true;
953 1036
 			},
@@ -962,7 +1045,9 @@  discard block
 block discarded – undo
962 1045
 			'enabled' => !empty($modSettings['titlesEnable']),
963 1046
 			'input_validate' => function (&$value) {
964 1047
 				if (Util::strlen($value) > 50)
965
-					return 'user_title_too_long';
1048
+				{
1049
+									return 'user_title_too_long';
1050
+				}
966 1051
 
967 1052
 				return true;
968 1053
 			},
@@ -986,7 +1071,9 @@  discard block
 block discarded – undo
986 1071
 
987 1072
 				$value = addProtocol($value, array('http://', 'https://', 'ftp://', 'ftps://'));
988 1073
 				if (strlen($value) < 8)
989
-					$value = '';
1074
+				{
1075
+									$value = '';
1076
+				}
990 1077
 				return true;
991 1078
 			},
992 1079
 			'link_with' => 'website',
@@ -1005,15 +1092,21 @@  discard block
 block discarded – undo
1005 1092
 	{
1006 1093
 		// Do we have permission to do this?
1007 1094
 		if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission']))
1008
-			unset($profile_fields[$key]);
1095
+		{
1096
+					unset($profile_fields[$key]);
1097
+		}
1009 1098
 
1010 1099
 		// Is it enabled?
1011 1100
 		if (isset($field['enabled']) && !$field['enabled'])
1012
-			unset($profile_fields[$key]);
1101
+		{
1102
+					unset($profile_fields[$key]);
1103
+		}
1013 1104
 
1014 1105
 		// Is it specifically disabled?
1015 1106
 		if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields)))
1016
-			unset($profile_fields[$key]);
1107
+		{
1108
+					unset($profile_fields[$key]);
1109
+		}
1017 1110
 	}
1018 1111
 }
1019 1112
 
@@ -1029,7 +1122,9 @@  discard block
 block discarded – undo
1029 1122
 	global $profile_fields, $profile_vars, $context, $old_profile, $post_errors, $cur_profile;
1030 1123
 
1031 1124
 	if (!empty($hook))
1032
-		call_integration_hook('integrate_' . $hook . '_profile_fields', array(&$fields));
1125
+	{
1126
+			call_integration_hook('integrate_' . $hook . '_profile_fields', array(&$fields));
1127
+	}
1033 1128
 
1034 1129
 	// Load them up.
1035 1130
 	loadProfileFields();
@@ -1041,7 +1136,9 @@  discard block
 block discarded – undo
1041 1136
 	// - by default just to reload their settings
1042 1137
 	$context['profile_execute_on_save'] = array();
1043 1138
 	if ($context['user']['is_owner'])
1044
-		$context['profile_execute_on_save']['reload_user'] = 'profileReloadUser';
1139
+	{
1140
+			$context['profile_execute_on_save']['reload_user'] = 'profileReloadUser';
1141
+	}
1045 1142
 
1046 1143
 	// Assume we log nothing.
1047 1144
 	$context['log_changes'] = array();
@@ -1057,7 +1154,9 @@  discard block
 block discarded – undo
1057 1154
 		$field = $profile_fields[$key];
1058 1155
 
1059 1156
 		if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key === 'signature'))
1060
-			continue;
1157
+		{
1158
+					continue;
1159
+		}
1061 1160
 
1062 1161
 		// What gets updated?
1063 1162
 		$db_key = isset($field['save_key']) ? $field['save_key'] : $key;
@@ -1088,11 +1187,17 @@  discard block
 block discarded – undo
1088 1187
 
1089 1188
 		// Finally, clean up certain types.
1090 1189
 		if ($field['cast_type'] === 'int')
1091
-			$_POST[$key] = (int) $_POST[$key];
1190
+		{
1191
+					$_POST[$key] = (int) $_POST[$key];
1192
+		}
1092 1193
 		elseif ($field['cast_type'] === 'float')
1093
-			$_POST[$key] = (float) $_POST[$key];
1194
+		{
1195
+					$_POST[$key] = (float) $_POST[$key];
1196
+		}
1094 1197
 		elseif ($field['cast_type'] === 'check')
1095
-			$_POST[$key] = !empty($_POST[$key]) ? 1 : 0;
1198
+		{
1199
+					$_POST[$key] = !empty($_POST[$key]) ? 1 : 0;
1200
+		}
1096 1201
 
1097 1202
 		// If we got here we're doing OK.
1098 1203
 		if ($field['type'] !== 'hidden' && (!isset($old_profile[$key]) || $_POST[$key] != $old_profile[$key]))
@@ -1105,10 +1210,12 @@  discard block
 block discarded – undo
1105 1210
 
1106 1211
 			// Are we logging it?
1107 1212
 			if (!empty($field['log_change']) && isset($old_profile[$key]))
1108
-				$context['log_changes'][$key] = array(
1213
+			{
1214
+							$context['log_changes'][$key] = array(
1109 1215
 					'previous' => $old_profile[$key],
1110 1216
 					'new' => $_POST[$key],
1111 1217
 				);
1218
+			}
1112 1219
 		}
1113 1220
 
1114 1221
 		// Logging group changes are a bit different...
@@ -1142,9 +1249,12 @@  discard block
 block discarded – undo
1142 1249
 					foreach ($groups as $id => $group)
1143 1250
 					{
1144 1251
 						if (isset($context['member_groups'][$group]))
1145
-							$additional_groups[$type][$id] = $context['member_groups'][$group]['name'];
1146
-						else
1147
-							unset($additional_groups[$type][$id]);
1252
+						{
1253
+													$additional_groups[$type][$id] = $context['member_groups'][$group]['name'];
1254
+						}
1255
+						else {
1256
+													unset($additional_groups[$type][$id]);
1257
+						}
1148 1258
 					}
1149 1259
 					$additional_groups[$type] = implode(', ', $additional_groups[$type]);
1150 1260
 				}
@@ -1156,15 +1266,20 @@  discard block
 block discarded – undo
1156 1266
 
1157 1267
 	// @todo Temporary
1158 1268
 	if ($context['user']['is_owner'])
1159
-		$changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
1160
-	else
1161
-		$changeOther = allowedTo('profile_extra_any');
1269
+	{
1270
+			$changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
1271
+	}
1272
+	else {
1273
+			$changeOther = allowedTo('profile_extra_any');
1274
+	}
1162 1275
 
1163 1276
 	if ($changeOther && empty($post_errors))
1164 1277
 	{
1165 1278
 		makeThemeChanges($context['id_member'], isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']);
1166 1279
 		if (!empty($_REQUEST['sa']))
1167
-			makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false);
1280
+		{
1281
+					makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false);
1282
+		}
1168 1283
 	}
1169 1284
 
1170 1285
 	// Free memory!
@@ -1185,9 +1300,12 @@  discard block
 block discarded – undo
1185 1300
 	$check = array();
1186 1301
 	$check['email'] = strtr($email, array('&#039;' => '\''));
1187 1302
 	if (Data_Validator::is_valid($check, array('email' => 'valid_email|required'), array('email' => 'trim')))
1188
-		$email = $check['email'];
1189
-	else
1190
-		return empty($check['email']) ? 'no_email' : 'bad_email';
1303
+	{
1304
+			$email = $check['email'];
1305
+	}
1306
+	else {
1307
+			return empty($check['email']) ? 'no_email' : 'bad_email';
1308
+	}
1191 1309
 
1192 1310
 	// Email addresses should be and stay unique.
1193 1311
 	$request = $db->query('', '
@@ -1223,9 +1341,12 @@  discard block
 block discarded – undo
1223 1341
 
1224 1342
 	// Permissions...
1225 1343
 	if ($context['user']['is_owner'])
1226
-		$changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
1227
-	else
1228
-		$changeOther = allowedTo('profile_extra_any');
1344
+	{
1345
+			$changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
1346
+	}
1347
+	else {
1348
+			$changeOther = allowedTo('profile_extra_any');
1349
+	}
1229 1350
 
1230 1351
 	// Arrays of all the changes - makes things easier.
1231 1352
 	$profile_bools = array(
@@ -1249,7 +1370,9 @@  discard block
 block discarded – undo
1249 1370
 	call_integration_hook('integrate_save_profile_changes', array(&$profile_bools, &$profile_ints, &$profile_floats, &$profile_strings));
1250 1371
 
1251 1372
 	if (isset($_POST['sa']) && $_POST['sa'] === 'ignoreboards' && empty($_POST['ignore_brd']))
1252
-		$_POST['ignore_brd'] = array();
1373
+	{
1374
+			$_POST['ignore_brd'] = array();
1375
+	}
1253 1376
 
1254 1377
 	// Whatever it is set to is a dirty filthy thing.  Kinda like our minds.
1255 1378
 	unset($_POST['ignore_boards']);
@@ -1257,15 +1380,20 @@  discard block
 block discarded – undo
1257 1380
 	if (isset($_POST['ignore_brd']))
1258 1381
 	{
1259 1382
 		if (!is_array($_POST['ignore_brd']))
1260
-			$_POST['ignore_brd'] = array($_POST['ignore_brd']);
1383
+		{
1384
+					$_POST['ignore_brd'] = array($_POST['ignore_brd']);
1385
+		}
1261 1386
 
1262 1387
 		foreach ($_POST['ignore_brd'] as $k => $d)
1263 1388
 		{
1264 1389
 			$d = (int) $d;
1265 1390
 			if ($d != 0)
1266
-				$_POST['ignore_brd'][$k] = $d;
1267
-			else
1268
-				unset($_POST['ignore_brd'][$k]);
1391
+			{
1392
+							$_POST['ignore_brd'][$k] = $d;
1393
+			}
1394
+			else {
1395
+							unset($_POST['ignore_brd'][$k]);
1396
+			}
1269 1397
 		}
1270 1398
 		$_POST['ignore_boards'] = implode(',', $_POST['ignore_brd']);
1271 1399
 		unset($_POST['ignore_brd']);
@@ -1277,20 +1405,30 @@  discard block
 block discarded – undo
1277 1405
 		makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']);
1278 1406
 		makeNotificationChanges($memID);
1279 1407
 		if (!empty($_REQUEST['sa']))
1280
-			makeCustomFieldChanges($memID, $_REQUEST['sa'], false);
1408
+		{
1409
+					makeCustomFieldChanges($memID, $_REQUEST['sa'], false);
1410
+		}
1281 1411
 
1282 1412
 		foreach ($profile_bools as $var)
1283
-			if (isset($_POST[$var]))
1413
+		{
1414
+					if (isset($_POST[$var]))
1284 1415
 				$profile_vars[$var] = empty($_POST[$var]) ? '0' : '1';
1416
+		}
1285 1417
 		foreach ($profile_ints as $var)
1286
-			if (isset($_POST[$var]))
1418
+		{
1419
+					if (isset($_POST[$var]))
1287 1420
 				$profile_vars[$var] = $_POST[$var] != '' ? (int) $_POST[$var] : '';
1421
+		}
1288 1422
 		foreach ($profile_floats as $var)
1289
-			if (isset($_POST[$var]))
1423
+		{
1424
+					if (isset($_POST[$var]))
1290 1425
 				$profile_vars[$var] = (float) $_POST[$var];
1426
+		}
1291 1427
 		foreach ($profile_strings as $var)
1292
-			if (isset($_POST[$var]))
1428
+		{
1429
+					if (isset($_POST[$var]))
1293 1430
 				$profile_vars[$var] = $_POST[$var];
1431
+		}
1294 1432
 	}
1295 1433
 }
1296 1434
 
@@ -1329,7 +1467,9 @@  discard block
 block discarded – undo
1329 1467
 
1330 1468
 	// Can't change reserved vars.
1331 1469
 	if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0))
1332
-		throw new Elk_Exception('no_access', false);
1470
+	{
1471
+			throw new Elk_Exception('no_access', false);
1472
+	}
1333 1473
 
1334 1474
 	// Don't allow any overriding of custom fields with default or non-default options.
1335 1475
 	$request = $db->query('', '
@@ -1342,7 +1482,9 @@  discard block
 block discarded – undo
1342 1482
 	);
1343 1483
 	$custom_fields = array();
1344 1484
 	while ($row = $db->fetch_assoc($request))
1345
-		$custom_fields[] = $row['col_name'];
1485
+	{
1486
+			$custom_fields[] = $row['col_name'];
1487
+	}
1346 1488
 	$db->free_result($request);
1347 1489
 
1348 1490
 	// These are the theme changes...
@@ -1352,14 +1494,20 @@  discard block
 block discarded – undo
1352 1494
 		foreach ($_POST['options'] as $opt => $val)
1353 1495
 		{
1354 1496
 			if (in_array($opt, $custom_fields))
1355
-				continue;
1497
+			{
1498
+							continue;
1499
+			}
1356 1500
 
1357 1501
 			// These need to be controlled.
1358 1502
 			if ($opt === 'topics_per_page' || $opt === 'messages_per_page')
1359
-				$val = max(0, min($val, 50));
1503
+			{
1504
+							$val = max(0, min($val, 50));
1505
+			}
1360 1506
 			// We don't set this per theme anymore.
1361 1507
 			elseif ($opt === 'allow_no_censored')
1362
-				continue;
1508
+			{
1509
+							continue;
1510
+			}
1363 1511
 
1364 1512
 			$themeSetArray[] = array($id_theme, $memID, $opt, is_array($val) ? implode(',', $val) : $val);
1365 1513
 		}
@@ -1371,14 +1519,20 @@  discard block
 block discarded – undo
1371 1519
 		foreach ($_POST['default_options'] as $opt => $val)
1372 1520
 		{
1373 1521
 			if (in_array($opt, $custom_fields))
1374
-				continue;
1522
+			{
1523
+							continue;
1524
+			}
1375 1525
 
1376 1526
 			// These need to be controlled.
1377 1527
 			if ($opt === 'topics_per_page' || $opt === 'messages_per_page')
1378
-				$val = max(0, min($val, 50));
1528
+			{
1529
+							$val = max(0, min($val, 50));
1530
+			}
1379 1531
 			// Only let admins and owners change the censor.
1380 1532
 			elseif ($opt === 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner'])
1381
-				continue;
1533
+			{
1534
+							continue;
1535
+			}
1382 1536
 
1383 1537
 			$themeSetArray[] = array(1, $memID, $opt, is_array($val) ? implode(',', $val) : $val);
1384 1538
 			$erase_options[] = $opt;
@@ -1390,14 +1544,20 @@  discard block
 block discarded – undo
1390 1544
 	{
1391 1545
 		require_once(SUBSDIR . '/Themes.subs.php');
1392 1546
 		if (!empty($themeSetArray))
1393
-			updateThemeOptions($themeSetArray);
1547
+		{
1548
+					updateThemeOptions($themeSetArray);
1549
+		}
1394 1550
 
1395 1551
 		if (!empty($erase_options))
1396
-			removeThemeOptions('custom', $memID, $erase_options);
1552
+		{
1553
+					removeThemeOptions('custom', $memID, $erase_options);
1554
+		}
1397 1555
 
1398 1556
 		$themes = explode(',', $modSettings['knownThemes']);
1399 1557
 		foreach ($themes as $t)
1400
-			Cache::instance()->remove('theme_settings-' . $t . ':' . $memID);
1558
+		{
1559
+					Cache::instance()->remove('theme_settings-' . $t . ':' . $memID);
1560
+		}
1401 1561
 	}
1402 1562
 }
1403 1563
 
@@ -1419,8 +1579,9 @@  discard block
 block discarded – undo
1419 1579
 			{
1420 1580
 				$to_save[$mention] = (int) $_POST['notify'][$mention]['method'];
1421 1581
 			}
1422
-			else
1423
-				$to_save[$mention] = 0;
1582
+			else {
1583
+							$to_save[$mention] = 0;
1584
+			}
1424 1585
 		}
1425 1586
 		saveUserNotificationsPreferences($memID, $to_save);
1426 1587
 	}
@@ -1429,11 +1590,15 @@  discard block
 block discarded – undo
1429 1590
 	if (isset($_POST['edit_notify_boards']))
1430 1591
 	{
1431 1592
 		if (!isset($_POST['notify_boards']))
1432
-			$_POST['notify_boards'] = array();
1593
+		{
1594
+					$_POST['notify_boards'] = array();
1595
+		}
1433 1596
 
1434 1597
 		// Make sure only integers are added/deleted.
1435 1598
 		foreach ($_POST['notify_boards'] as $index => $id)
1436
-			$_POST['notify_boards'][$index] = (int) $id;
1599
+		{
1600
+					$_POST['notify_boards'][$index] = (int) $id;
1601
+		}
1437 1602
 
1438 1603
 		// id_board = 0 is reserved for topic notifications only
1439 1604
 		$notification_wanted = array_diff($_POST['notify_boards'], array(0));
@@ -1451,13 +1616,16 @@  discard block
 block discarded – undo
1451 1616
 		);
1452 1617
 		$notification_current = array();
1453 1618
 		while ($row = $db->fetch_assoc($request))
1454
-			$notification_current[] = $row['id_board'];
1619
+		{
1620
+					$notification_current[] = $row['id_board'];
1621
+		}
1455 1622
 		$db->free_result($request);
1456 1623
 
1457 1624
 		// And remove what they no longer want
1458 1625
 		$notification_deletes = array_diff($notification_current, $notification_wanted);
1459 1626
 		if (!empty($notification_deletes))
1460
-			$db->query('', '
1627
+		{
1628
+					$db->query('', '
1461 1629
 				DELETE FROM {db_prefix}log_notify
1462 1630
 				WHERE id_board IN ({array_int:board_list})
1463 1631
 					AND id_member = {int:selected_member}',
@@ -1466,19 +1634,24 @@  discard block
 block discarded – undo
1466 1634
 					'selected_member' => $memID,
1467 1635
 				)
1468 1636
 			);
1637
+		}
1469 1638
 
1470 1639
 		// Now add in what they do want
1471 1640
 		$notification_inserts = array();
1472 1641
 		foreach ($notification_wanted as $id)
1473
-			$notification_inserts[] = array($memID, $id);
1642
+		{
1643
+					$notification_inserts[] = array($memID, $id);
1644
+		}
1474 1645
 
1475 1646
 		if (!empty($notification_inserts))
1476
-			$db->insert('ignore',
1647
+		{
1648
+					$db->insert('ignore',
1477 1649
 				'{db_prefix}log_notify',
1478 1650
 				array('id_member' => 'int', 'id_board' => 'int'),
1479 1651
 				$notification_inserts,
1480 1652
 				array('id_member', 'id_board')
1481 1653
 			);
1654
+		}
1482 1655
 	}
1483 1656
 
1484 1657
 	// We are editing topic notifications......
@@ -1486,7 +1659,9 @@  discard block
 block discarded – undo
1486 1659
 	{
1487 1660
 		$edit_notify_topics = array();
1488 1661
 		foreach ($_POST['notify_topics'] as $index => $id)
1489
-			$edit_notify_topics[$index] = (int) $id;
1662
+		{
1663
+					$edit_notify_topics[$index] = (int) $id;
1664
+		}
1490 1665
 
1491 1666
 		// Make sure there are no zeros left.
1492 1667
 		$edit_notify_topics = array_diff($edit_notify_topics, array(0));
@@ -1517,7 +1692,9 @@  discard block
 block discarded – undo
1517 1692
 	$db = database();
1518 1693
 
1519 1694
 	if ($sanitize && isset($_POST['customfield']))
1520
-		$_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']);
1695
+	{
1696
+			$_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']);
1697
+	}
1521 1698
 
1522 1699
 	$where = $area === 'register' ? 'show_reg != 0' : 'show_profile = {string:area}';
1523 1700
 
@@ -1543,11 +1720,15 @@  discard block
 block discarded – undo
1543 1720
 			- The area isn't registration, and if it is that the field is not supposed to be shown there.
1544 1721
 		*/
1545 1722
 		if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area !== 'register' || $row['show_reg'] == 0))
1546
-			continue;
1723
+		{
1724
+					continue;
1725
+		}
1547 1726
 
1548 1727
 		// Validate the user data.
1549 1728
 		if ($row['field_type'] === 'check')
1550
-			$value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0;
1729
+		{
1730
+					$value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0;
1731
+		}
1551 1732
 		elseif (in_array($row['field_type'], array('radio', 'select')))
1552 1733
 		{
1553 1734
 			$value = $row['default_value'];
@@ -1584,7 +1765,9 @@  discard block
 block discarded – undo
1584 1765
 			}
1585 1766
 
1586 1767
 			if ($row['mask'] === 'number')
1587
-				$value = (int) $value;
1768
+			{
1769
+							$value = (int) $value;
1770
+			}
1588 1771
 		}
1589 1772
 
1590 1773
 		// Did it change or has it been set?
@@ -1628,7 +1811,9 @@  discard block
 block discarded – undo
1628 1811
 		);
1629 1812
 
1630 1813
 		if (!empty($log_changes) && !empty($modSettings['modlog_enabled']))
1631
-			logActions($log_changes);
1814
+		{
1815
+					logActions($log_changes);
1816
+		}
1632 1817
 	}
1633 1818
 }
1634 1819
 
@@ -1648,18 +1833,26 @@  discard block
 block discarded – undo
1648 1833
 {
1649 1834
 	// Is it too long?
1650 1835
 	if ($field['field_length'] && $field['field_length'] < Util::strlen($value))
1651
-		return 'custom_field_too_long';
1836
+	{
1837
+			return 'custom_field_too_long';
1838
+	}
1652 1839
 
1653 1840
 	// Any masks to apply?
1654 1841
 	if ($field['field_type'] === 'text' && !empty($field['mask']) && $field['mask'] !== 'none')
1655 1842
 	{
1656 1843
 		// @todo We never error on this - just ignore it at the moment...
1657 1844
 		if ($field['mask'] === 'email' && !isValidEmail($value))
1658
-			return 'custom_field_invalid_email';
1845
+		{
1846
+					return 'custom_field_invalid_email';
1847
+		}
1659 1848
 		elseif ($field['mask'] === 'number' && preg_match('~[^\d]~', $value))
1660
-			return 'custom_field_not_number';
1849
+		{
1850
+					return 'custom_field_not_number';
1851
+		}
1661 1852
 		elseif (substr($field['mask'], 0, 5) === 'regex' && trim($value) !== '' && preg_match(substr($field['mask'], 5), $value) === 0)
1662
-			return 'custom_field_inproper_format';
1853
+		{
1854
+					return 'custom_field_inproper_format';
1855
+		}
1663 1856
 	}
1664 1857
 
1665 1858
 	return true;
@@ -1676,7 +1869,9 @@  discard block
 block discarded – undo
1676 1869
 
1677 1870
 	// Shouldn't happen but just in case.
1678 1871
 	if (empty($profile_vars['email_address']))
1679
-		return;
1872
+	{
1873
+			return;
1874
+	}
1680 1875
 
1681 1876
 	$replacements = array(
1682 1877
 		'ACTIVATIONLINK' => $scripturl . '?action=register;sa=activate;u=' . $context['id_member'] . ';code=' . $old_profile['validation_code'],
@@ -1695,7 +1890,9 @@  discard block
 block discarded – undo
1695 1890
 	$_SESSION['login_' . $cookiename] = serialize(array(0, '', 0));
1696 1891
 
1697 1892
 	if (isset($_COOKIE[$cookiename]))
1698
-		$_COOKIE[$cookiename] = '';
1893
+	{
1894
+			$_COOKIE[$cookiename] = '';
1895
+	}
1699 1896
 
1700 1897
 	loadUserSettings();
1701 1898
 
@@ -1743,16 +1940,24 @@  discard block
 block discarded – undo
1743 1940
 	// Warning message for signature image limits?
1744 1941
 	$context['signature_warning'] = '';
1745 1942
 	if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height'])
1746
-		$context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']);
1943
+	{
1944
+			$context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']);
1945
+	}
1747 1946
 	elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height'])
1748
-		$context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']);
1947
+	{
1948
+			$context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']);
1949
+	}
1749 1950
 
1750 1951
 	$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
1751 1952
 	if ($context['show_spellchecking'])
1752
-		loadJavascriptFile('spellcheck.js', array('defer' => true));
1953
+	{
1954
+			loadJavascriptFile('spellcheck.js', array('defer' => true));
1955
+	}
1753 1956
 
1754 1957
 	if (empty($context['do_preview']))
1755
-		$context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br />', '<', '>', '"', '\''), array("\n", '&lt;', '&gt;', '&quot;', '&#039;'), $cur_profile['signature']);
1958
+	{
1959
+			$context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br />', '<', '>', '"', '\''), array("\n", '&lt;', '&gt;', '&quot;', '&#039;'), $cur_profile['signature']);
1960
+	}
1756 1961
 	else
1757 1962
 	{
1758 1963
 		$signature = !empty($_POST['signature']) ? $_POST['signature'] : '';
@@ -1765,7 +1970,9 @@  discard block
 block discarded – undo
1765 1970
 
1766 1971
 		$context['post_errors'][] = 'signature_not_yet_saved';
1767 1972
 		if ($validation !== true && $validation !== false)
1768
-			$context['post_errors'][] = $validation;
1973
+		{
1974
+					$context['post_errors'][] = $validation;
1975
+		}
1769 1976
 
1770 1977
 		$context['member']['signature'] = censor($context['member']['signature']);
1771 1978
 		$context['member']['current_signature'] = $context['member']['signature'];
@@ -1794,9 +2001,12 @@  discard block
 block discarded – undo
1794 2001
 
1795 2002
 	// @todo Temporary
1796 2003
 	if ($context['user']['is_owner'])
1797
-		$allowedChange = allowedTo('profile_set_avatar') && allowedTo(array('profile_extra_any', 'profile_extra_own'));
1798
-	else
1799
-		$allowedChange = allowedTo('profile_set_avatar') && allowedTo('profile_extra_any');
2004
+	{
2005
+			$allowedChange = allowedTo('profile_set_avatar') && allowedTo(array('profile_extra_any', 'profile_extra_own'));
2006
+	}
2007
+	else {
2008
+			$allowedChange = allowedTo('profile_set_avatar') && allowedTo('profile_extra_any');
2009
+	}
1800 2010
 
1801 2011
 	// Default context.
1802 2012
 	$context['member']['avatar'] += array(
@@ -1820,29 +2030,36 @@  discard block
 block discarded – undo
1820 2030
 		$context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename'];
1821 2031
 	}
1822 2032
 	elseif ($valid_protocol && $context['member']['avatar']['allow_external'])
1823
-		$context['member']['avatar'] += array(
2033
+	{
2034
+			$context['member']['avatar'] += array(
1824 2035
 			'choice' => 'external',
1825 2036
 			'server_pic' => 'blank.png',
1826 2037
 			'external' => $cur_profile['avatar']
1827 2038
 		);
2039
+	}
1828 2040
 	elseif ($cur_profile['avatar'] === 'gravatar' && $context['member']['avatar']['allow_gravatar'])
1829
-		$context['member']['avatar'] += array(
2041
+	{
2042
+			$context['member']['avatar'] += array(
1830 2043
 			'choice' => 'gravatar',
1831 2044
 			'server_pic' => 'blank.png',
1832 2045
 			'external' => 'https://'
1833 2046
 		);
2047
+	}
1834 2048
 	elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored'])
1835
-		$context['member']['avatar'] += array(
2049
+	{
2050
+			$context['member']['avatar'] += array(
1836 2051
 			'choice' => 'server_stored',
1837 2052
 			'server_pic' => $cur_profile['avatar'] == '' ? 'blank.png' : $cur_profile['avatar'],
1838 2053
 			'external' => $schema
1839 2054
 		);
1840
-	else
1841
-		$context['member']['avatar'] += array(
2055
+	}
2056
+	else {
2057
+			$context['member']['avatar'] += array(
1842 2058
 			'choice' => 'none',
1843 2059
 			'server_pic' => 'blank.png',
1844 2060
 			'external' => $schema
1845 2061
 		);
2062
+	}
1846 2063
 
1847 2064
 	// Get a list of all the avatars.
1848 2065
 	if ($context['member']['avatar']['allow_server_stored'])
@@ -1881,7 +2098,9 @@  discard block
 block discarded – undo
1881 2098
 	{
1882 2099
 		// Registered member was already taken care before
1883 2100
 		if ($id_group == 0)
1884
-			continue;
2101
+		{
2102
+					continue;
2103
+		}
1885 2104
 
1886 2105
 		$context['member_groups'][$id_group]['is_primary'] = $cur_profile['id_group'] == $id_group;
1887 2106
 		$context['member_groups'][$id_group]['is_additional'] = in_array($id_group, $curGroups);
@@ -1908,7 +2127,9 @@  discard block
 block discarded – undo
1908 2127
 
1909 2128
 	// Setup our languages.
1910 2129
 	foreach ($languages as $lang)
1911
-		$context['profile_languages'][$lang['filename']] = $lang['name'];
2130
+	{
2131
+			$context['profile_languages'][$lang['filename']] = $lang['name'];
2132
+	}
1912 2133
 
1913 2134
 	ksort($context['profile_languages']);
1914 2135
 
@@ -1982,7 +2203,9 @@  discard block
 block discarded – undo
1982 2203
 
1983 2204
 		$smiley_count = substr_count(strtolower($smiley_parsed), '<img') - substr_count(strtolower($unparsed_signature), '<img');
1984 2205
 		if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0)
1985
-			return 'signature_allow_smileys';
2206
+		{
2207
+					return 'signature_allow_smileys';
2208
+		}
1986 2209
 		elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4])
1987 2210
 		{
1988 2211
 			$txt['profile_error_signature_max_smileys'] = sprintf($txt['profile_error_signature_max_smileys'], $sig_limits[4]);
@@ -2008,13 +2231,21 @@  discard block
 block discarded – undo
2008 2231
 
2009 2232
 				// Attempt to allow all sizes of abuse, so to speak.
2010 2233
 				if ($matches[2][$ind] === 'px' && $size > $sig_limits[7])
2011
-					$limit_broke = $sig_limits[7] . 'px';
2234
+				{
2235
+									$limit_broke = $sig_limits[7] . 'px';
2236
+				}
2012 2237
 				elseif ($matches[2][$ind] === 'pt' && $size > ($sig_limits[7] * 0.75))
2013
-					$limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt';
2238
+				{
2239
+									$limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt';
2240
+				}
2014 2241
 				elseif ($matches[2][$ind] === 'em' && $size > ((float) $sig_limits[7] / 14))
2015
-					$limit_broke = ((float) $sig_limits[7] / 14) . 'em';
2242
+				{
2243
+									$limit_broke = ((float) $sig_limits[7] / 14) . 'em';
2244
+				}
2016 2245
 				elseif ($matches[2][$ind] !== 'px' && $matches[2][$ind] !== 'pt' && $matches[2][$ind] !== 'em' && $sig_limits[7] < 18)
2017
-					$limit_broke = 'large';
2246
+				{
2247
+									$limit_broke = 'large';
2248
+				}
2018 2249
 
2019 2250
 				if ($limit_broke)
2020 2251
 				{
@@ -2061,7 +2292,9 @@  discard block
 block discarded – undo
2061 2292
 
2062 2293
 					// Does it have predefined restraints? Width first.
2063 2294
 					if ($matches[6][$key])
2064
-						$matches[2][$key] = $matches[6][$key];
2295
+					{
2296
+											$matches[2][$key] = $matches[6][$key];
2297
+					}
2065 2298
 
2066 2299
 					if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5])
2067 2300
 					{
@@ -2069,17 +2302,23 @@  discard block
 block discarded – undo
2069 2302
 						$matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]);
2070 2303
 					}
2071 2304
 					elseif ($matches[2][$key])
2072
-						$width = $matches[2][$key];
2305
+					{
2306
+											$width = $matches[2][$key];
2307
+					}
2073 2308
 
2074 2309
 					// ... and height.
2075 2310
 					if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6])
2076 2311
 					{
2077 2312
 						$height = $sig_limits[6];
2078 2313
 						if ($width != -1)
2079
-							$width = $width * ($height / $matches[4][$key]);
2314
+						{
2315
+													$width = $width * ($height / $matches[4][$key]);
2316
+						}
2080 2317
 					}
2081 2318
 					elseif ($matches[4][$key])
2082
-						$height = $matches[4][$key];
2319
+					{
2320
+											$height = $matches[4][$key];
2321
+					}
2083 2322
 
2084 2323
 					// If the dimensions are still not fixed - we need to check the actual image.
2085 2324
 					if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6]))
@@ -2100,21 +2339,29 @@  discard block
 block discarded – undo
2100 2339
 							{
2101 2340
 								$height = $sig_limits[6];
2102 2341
 								if ($width == -1)
2103
-									$width = $sizes[0];
2342
+								{
2343
+																	$width = $sizes[0];
2344
+								}
2104 2345
 								$width = $width * ($height / $sizes[1]);
2105 2346
 							}
2106 2347
 							elseif ($width != -1)
2107
-								$height = $sizes[1];
2348
+							{
2349
+															$height = $sizes[1];
2350
+							}
2108 2351
 						}
2109 2352
 					}
2110 2353
 
2111 2354
 					// Did we come up with some changes? If so remake the string.
2112 2355
 					if ($width != -1 || $height != -1)
2113
-						$replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]';
2356
+					{
2357
+											$replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]';
2358
+					}
2114 2359
 				}
2115 2360
 
2116 2361
 				if (!empty($replaces))
2117
-					$value = str_replace(array_keys($replaces), array_values($replaces), $value);
2362
+				{
2363
+									$value = str_replace(array_keys($replaces), array_values($replaces), $value);
2364
+				}
2118 2365
 			}
2119 2366
 		}
2120 2367
 
@@ -2166,7 +2413,9 @@  discard block
 block discarded – undo
2166 2413
 
2167 2414
 	$memID = $context['id_member'];
2168 2415
 	if (empty($memID) && !empty($context['password_auth_failed']))
2169
-		return false;
2416
+	{
2417
+			return false;
2418
+	}
2170 2419
 
2171 2420
 	// We need to know where we're going to be putting it..
2172 2421
 	require_once(SUBSDIR . '/Attachments.subs.php');
@@ -2181,7 +2430,9 @@  discard block
 block discarded – undo
2181 2430
 	{
2182 2431
 		loadLanguage('Post');
2183 2432
 		if (!is_writable($uploadDir))
2184
-			throw new Elk_Exception('attachments_no_write', 'critical');
2433
+		{
2434
+					throw new Elk_Exception('attachments_no_write', 'critical');
2435
+		}
2185 2436
 
2186 2437
 		require_once(SUBSDIR . '/Package.subs.php');
2187 2438
 
@@ -2248,10 +2499,14 @@  discard block
 block discarded – undo
2248 2499
 		$profile_vars['avatar'] = str_replace(' ', '%20', preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $_POST['userpicpersonal']));
2249 2500
 
2250 2501
 		if (preg_match('~^https?:///?$~i', $profile_vars['avatar']) === 1)
2251
-			$profile_vars['avatar'] = '';
2502
+		{
2503
+					$profile_vars['avatar'] = '';
2504
+		}
2252 2505
 		// Trying to make us do something we'll regret?
2253 2506
 		elseif ((!$valid_http && !$valid_https) || ($valid_http && detectServer()->supportsSSL()))
2254
-			return 'bad_avatar';
2507
+		{
2508
+					return 'bad_avatar';
2509
+		}
2255 2510
 		// Should we check dimensions?
2256 2511
 		elseif (!empty($modSettings['avatar_max_height']) || !empty($modSettings['avatar_max_width']))
2257 2512
 		{
@@ -2262,7 +2517,9 @@  discard block
 block discarded – undo
2262 2517
 			{
2263 2518
 				// Houston, we have a problem. The avatar is too large!!
2264 2519
 				if ($modSettings['avatar_action_too_large'] === 'option_refuse')
2265
-					return 'bad_avatar';
2520
+				{
2521
+									return 'bad_avatar';
2522
+				}
2266 2523
 				elseif ($modSettings['avatar_action_too_large'] === 'option_download_and_resize')
2267 2524
 				{
2268 2525
 					// @todo remove this if appropriate
@@ -2274,8 +2531,9 @@  discard block
 block discarded – undo
2274 2531
 						$cur_profile['filename'] = $modSettings['new_avatar_data']['filename'];
2275 2532
 						$cur_profile['attachment_type'] = $modSettings['new_avatar_data']['type'];
2276 2533
 					}
2277
-					else
2278
-						return 'bad_avatar';
2534
+					else {
2535
+											return 'bad_avatar';
2536
+					}
2279 2537
 				}
2280 2538
 			}
2281 2539
 		}
@@ -2406,7 +2664,9 @@  discard block
 block discarded – undo
2406 2664
 				);
2407 2665
 
2408 2666
 				if (!empty($modSettings['attachment_webp_enable']))
2409
-					$extensions['18'] = 'webp';
2667
+				{
2668
+									$extensions['18'] = 'webp';
2669
+				}
2410 2670
 
2411 2671
 				$extension = isset($extensions[$sizes[2]]) ? $extensions[$sizes[2]] : 'jpg';
2412 2672
 				$mime_type = 'image/' . ($extension === 'jpg' ? 'jpeg' : $extension);
@@ -2450,14 +2710,18 @@  discard block
 block discarded – undo
2450 2710
 
2451 2711
 			// Delete any temporary file.
2452 2712
 			if (file_exists($_FILES['attachment']['tmp_name']))
2453
-				@unlink($_FILES['attachment']['tmp_name']);
2713
+			{
2714
+							@unlink($_FILES['attachment']['tmp_name']);
2715
+			}
2454 2716
 		}
2455 2717
 		// Selected the upload avatar option and had one already uploaded before or didn't upload one.
2456
-		else
2718
+		else {
2719
+					$profile_vars['avatar'] = '';
2720
+		}
2721
+	}
2722
+	else {
2457 2723
 			$profile_vars['avatar'] = '';
2458 2724
 	}
2459
-	else
2460
-		$profile_vars['avatar'] = '';
2461 2725
 
2462 2726
 	// Setup the profile variables so it shows things right on display!
2463 2727
 	$cur_profile['avatar'] = $profile_vars['avatar'];
@@ -2492,7 +2756,9 @@  discard block
 block discarded – undo
2492 2756
 		);
2493 2757
 		$protected_groups = array(1);
2494 2758
 		while ($row = $db->fetch_assoc($request))
2495
-			$protected_groups[] = $row['id_group'];
2759
+		{
2760
+					$protected_groups[] = $row['id_group'];
2761
+		}
2496 2762
 		$db->free_result($request);
2497 2763
 
2498 2764
 		$protected_groups = array_unique($protected_groups);
@@ -2500,10 +2766,13 @@  discard block
 block discarded – undo
2500 2766
 
2501 2767
 	// The account page allows the change of your id_group - but not to a protected group!
2502 2768
 	if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0)
2503
-		$value = (int) $value;
2769
+	{
2770
+			$value = (int) $value;
2771
+	}
2504 2772
 	// ... otherwise it's the old group sir.
2505
-	else
2506
-		$value = $old_profile['id_group'];
2773
+	else {
2774
+			$value = $old_profile['id_group'];
2775
+	}
2507 2776
 
2508 2777
 	// Find the additional membergroups (if any)
2509 2778
 	if (isset($_POST['additional_groups']) && is_array($_POST['additional_groups']))
@@ -2513,7 +2782,9 @@  discard block
 block discarded – undo
2513 2782
 		{
2514 2783
 			$group_id = (int) $group_id;
2515 2784
 			if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups)))
2516
-				$additional_groups[] = $group_id;
2785
+			{
2786
+							$additional_groups[] = $group_id;
2787
+			}
2517 2788
 		}
2518 2789
 
2519 2790
 		// Put the protected groups back in there if you don't have permission to take them away.
@@ -2521,7 +2792,9 @@  discard block
 block discarded – undo
2521 2792
 		foreach ($old_additional_groups as $group_id)
2522 2793
 		{
2523 2794
 			if (!empty($protected_groups) && in_array($group_id, $protected_groups))
2524
-				$additional_groups[] = $group_id;
2795
+			{
2796
+							$additional_groups[] = $group_id;
2797
+			}
2525 2798
 		}
2526 2799
 
2527 2800
 		if (implode(',', $additional_groups) !== $old_profile['additional_groups'])
@@ -2554,7 +2827,9 @@  discard block
 block discarded – undo
2554 2827
 			$db->free_result($request);
2555 2828
 
2556 2829
 			if (empty($another))
2557
-				throw new Elk_Exception('at_least_one_admin', 'critical');
2830
+			{
2831
+							throw new Elk_Exception('at_least_one_admin', 'critical');
2832
+			}
2558 2833
 		}
2559 2834
 	}
2560 2835
 
@@ -2562,9 +2837,12 @@  discard block
 block discarded – undo
2562 2837
 	if ($value != $old_profile['id_group'] || isset($profile_vars['additional_groups']))
2563 2838
 	{
2564 2839
 		if ($context['user']['is_owner'])
2565
-			$_SESSION['mc']['time'] = 0;
2566
-		else
2567
-			updateSettings(array('settings_updated' => time()));
2840
+		{
2841
+					$_SESSION['mc']['time'] = 0;
2842
+		}
2843
+		else {
2844
+					updateSettings(array('settings_updated' => time()));
2845
+		}
2568 2846
 	}
2569 2847
 
2570 2848
 	return true;
@@ -2665,7 +2943,9 @@  discard block
 block discarded – undo
2665 2943
 	$db = database();
2666 2944
 
2667 2945
 	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
2668
-		$exclude_boards = array($modSettings['recycle_board']);
2946
+	{
2947
+			$exclude_boards = array($modSettings['recycle_board']);
2948
+	}
2669 2949
 
2670 2950
 	// Retrieve some attachments.
2671 2951
 	$request = $db->query('', '
@@ -2702,9 +2982,12 @@  discard block
 block discarded – undo
2702 2982
 	while ($row = $db->fetch_assoc($request))
2703 2983
 	{
2704 2984
 		if (!$row['approved'])
2705
-			$row['filename'] = str_replace(array('{attachment_link}', '{txt_awaiting}'), array('<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $row['filename'] . '</a>', $txt['awaiting_approval']), $settings['attachments_awaiting_approval']);
2706
-		else
2707
-			$row['filename'] = '<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $row['filename'] . '</a>';
2985
+		{
2986
+					$row['filename'] = str_replace(array('{attachment_link}', '{txt_awaiting}'), array('<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $row['filename'] . '</a>', $txt['awaiting_approval']), $settings['attachments_awaiting_approval']);
2987
+		}
2988
+		else {
2989
+					$row['filename'] = '<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $row['filename'] . '</a>';
2990
+		}
2708 2991
 
2709 2992
 		$attachments[] = array(
2710 2993
 			'id' => $row['id_attach'],
@@ -2806,7 +3089,9 @@  discard block
 block discarded – undo
2806 3089
 	);
2807 3090
 	$topics = array();
2808 3091
 	while ($row = $db->fetch_assoc($request))
2809
-		$topics[] = $row['id_topic'];
3092
+	{
3093
+			$topics[] = $row['id_topic'];
3094
+	}
2810 3095
 	$db->free_result($request);
2811 3096
 
2812 3097
 	// Any topics found?
@@ -2826,7 +3111,9 @@  discard block
 block discarded – undo
2826 3111
 			)
2827 3112
 		);
2828 3113
 		while ($row = $db->fetch_assoc($request))
2829
-			$topicsInfo[] = $row;
3114
+		{
3115
+					$topicsInfo[] = $row;
3116
+		}
2830 3117
 		$db->free_result($request);
2831 3118
 	}
2832 3119
 
@@ -3058,14 +3345,19 @@  discard block
 block discarded – undo
3058 3345
 
3059 3346
 		// Did we get what we wanted, if so stop looking
3060 3347
 		if ($db->num_rows($request) === $count || empty($range_limit))
3061
-			break;
3062
-		else
3063
-			$range_limit = '';
3348
+		{
3349
+					break;
3350
+		}
3351
+		else {
3352
+					$range_limit = '';
3353
+		}
3064 3354
 	}
3065 3355
 
3066 3356
 	// Place them in the post array
3067 3357
 	while ($row = $db->fetch_assoc($request))
3068
-		$user_posts[] = $row;
3358
+	{
3359
+			$user_posts[] = $row;
3360
+	}
3069 3361
 	$db->free_result($request);
3070 3362
 
3071 3363
 	return $user_posts;
@@ -3123,14 +3415,19 @@  discard block
 block discarded – undo
3123 3415
 
3124 3416
 		// Did we get what we wanted, if so stop looking
3125 3417
 		if ($db->num_rows($request) === $count || empty($range_limit))
3126
-			break;
3127
-		else
3128
-			$range_limit = '';
3418
+		{
3419
+					break;
3420
+		}
3421
+		else {
3422
+					$range_limit = '';
3423
+		}
3129 3424
 	}
3130 3425
 
3131 3426
 	// Place them in the topic array
3132 3427
 	while ($row = $db->fetch_assoc($request))
3133
-		$user_topics[] = $row;
3428
+	{
3429
+			$user_topics[] = $row;
3430
+	}
3134 3431
 	$db->free_result($request);
3135 3432
 
3136 3433
 	return $user_topics;
@@ -3165,13 +3462,18 @@  discard block
 block discarded – undo
3165 3462
 	{
3166 3463
 		// We don't know about this permission, it doesn't exist :P.
3167 3464
 		if (!isset($txt['permissionname_' . $row['permission']]))
3168
-			continue;
3465
+		{
3466
+					continue;
3467
+		}
3169 3468
 
3170 3469
 		// Permissions that end with _own or _any consist of two parts.
3171 3470
 		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
3172
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
3173
-		else
3174
-			$name = $txt['permissionname_' . $row['permission']];
3471
+		{
3472
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
3473
+		}
3474
+		else {
3475
+					$name = $txt['permissionname_' . $row['permission']];
3476
+		}
3175 3477
 
3176 3478
 		// Add this permission if it doesn't exist yet.
3177 3479
 		if (!isset($general_permission[$row['permission']]))
@@ -3238,17 +3540,23 @@  discard block
 block discarded – undo
3238 3540
 	{
3239 3541
 		// We don't know about this permission, it doesn't exist :P.
3240 3542
 		if (!isset($txt['permissionname_' . $row['permission']]))
3241
-			continue;
3543
+		{
3544
+					continue;
3545
+		}
3242 3546
 
3243 3547
 		// The name of the permission using the format 'permission name' - 'own/any topic/event/etc.'.
3244 3548
 		if (in_array(substr($row['permission'], -4), array('_own', '_any')) && isset($txt['permissionname_' . substr($row['permission'], 0, -4)]))
3245
-			$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
3246
-		else
3247
-			$name = $txt['permissionname_' . $row['permission']];
3549
+		{
3550
+					$name = $txt['permissionname_' . substr($row['permission'], 0, -4)] . ' - ' . $txt['permissionname_' . $row['permission']];
3551
+		}
3552
+		else {
3553
+					$name = $txt['permissionname_' . $row['permission']];
3554
+		}
3248 3555
 
3249 3556
 		// Create the structure for this permission.
3250 3557
 		if (!isset($board_permission[$row['permission']]))
3251
-			$board_permission[$row['permission']] = array(
3558
+		{
3559
+					$board_permission[$row['permission']] = array(
3252 3560
 				'id' => $row['permission'],
3253 3561
 				'groups' => array(
3254 3562
 					'allowed' => array(),
@@ -3258,6 +3566,7 @@  discard block
 block discarded – undo
3258 3566
 				'is_denied' => false,
3259 3567
 				'is_global' => empty($board),
3260 3568
 			);
3569
+		}
3261 3570
 
3262 3571
 		$board_permission[$row['permission']]['groups'][empty($row['add_deny']) ? 'denied' : 'allowed'][$row['id_group']] = $row['id_group'] == 0 ? $txt['membergroups_members'] : $row['group_name'];
3263 3572
 		$board_permission[$row['permission']]['is_denied'] |= empty($row['add_deny']);
@@ -3319,7 +3628,9 @@  discard block
 block discarded – undo
3319 3628
 	);
3320 3629
 
3321 3630
 	while ($row = $db->fetch_assoc($request))
3322
-		$ips[] = $row['poster_ip'];
3631
+	{
3632
+			$ips[] = $row['poster_ip'];
3633
+	}
3323 3634
 
3324 3635
 	$db->free_result($request);
3325 3636
 
@@ -3337,7 +3648,9 @@  discard block
 block discarded – undo
3337 3648
 	$error_ips = array();
3338 3649
 
3339 3650
 	while ($row = $db->fetch_assoc($request))
3340
-		$error_ips[] = $row['ip'];
3651
+	{
3652
+			$error_ips[] = $row['ip'];
3653
+	}
3341 3654
 
3342 3655
 	$db->free_result($request);
3343 3656
 
@@ -3373,7 +3686,9 @@  discard block
 block discarded – undo
3373 3686
 	);
3374 3687
 
3375 3688
 	while ($row = $db->fetch_assoc($request))
3376
-		$message_members[] = $row['id_member'];
3689
+	{
3690
+			$message_members[] = $row['id_member'];
3691
+	}
3377 3692
 	$db->free_result($request);
3378 3693
 
3379 3694
 	// And then get the member ID's belong to other users
@@ -3388,7 +3703,9 @@  discard block
 block discarded – undo
3388 3703
 		)
3389 3704
 	);
3390 3705
 	while ($row = $db->fetch_assoc($request))
3391
-		$message_members[] = $row['id_member'];
3706
+	{
3707
+			$message_members[] = $row['id_member'];
3708
+	}
3392 3709
 	$db->free_result($request);
3393 3710
 
3394 3711
 	// Once the IDs are all combined, let's clean them up
@@ -3418,7 +3735,9 @@  discard block
 block discarded – undo
3418 3735
 	global $modSettings, $context;
3419 3736
 
3420 3737
 	if (empty($modSettings['enabled_mentions']))
3421
-		return array();
3738
+	{
3739
+			return array();
3740
+	}
3422 3741
 
3423 3742
 	require_once(SUBSDIR . '/Notification.subs.php');
3424 3743
 	Elk_Autoloader::instance()->register(SUBSDIR . '/MentionType', '\\ElkArte\\sources\\subs\\MentionType');
@@ -3438,14 +3757,20 @@  discard block
 block discarded – undo
3438 3757
 		{
3439 3758
 			$notif[$key] = array('id' => $val, 'enabled' => $user_preferences[$member_id][$type] === $key);
3440 3759
 			if ($user_preferences[$member_id][$type] > 0)
3441
-				$type_on = true;
3760
+			{
3761
+							$type_on = true;
3762
+			}
3442 3763
 
3443 3764
 			if (!$push_enabled && $val === 'notification' && $user_preferences[$member_id][$type] === $key)
3444
-				$push_enabled = true;
3765
+			{
3766
+							$push_enabled = true;
3767
+			}
3445 3768
 		}
3446 3769
 
3447 3770
 		if (!empty($notif))
3448
-			$mention_types[$type] = array('data' => $notif, 'enabled' => $type_on);
3771
+		{
3772
+					$mention_types[$type] = array('data' => $notif, 'enabled' => $type_on);
3773
+		}
3449 3774
 	}
3450 3775
 
3451 3776
 	// If they enabled notifications alert, then lets ask for browser permission to show them
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			'type' => 'callback',
395 395
 			'callback_func' => 'birthdate',
396 396
 			'permission' => 'profile_extra',
397
-			'preload' => function () {
397
+			'preload' => function() {
398 398
 				global $cur_profile, $context;
399 399
 
400 400
 				// Split up the birth date....
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
 				return true;
409 409
 			},
410
-			'input_validate' => function (&$value) {
410
+			'input_validate' => function(&$value) {
411 411
 				global $profile_vars, $cur_profile;
412 412
 
413 413
 				if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0)
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		'birthdate' => array(
431 431
 			'type' => 'hidden',
432 432
 			'permission' => 'profile_extra',
433
-			'input_validate' => function (&$value) {
433
+			'input_validate' => function(&$value) {
434 434
 				global $cur_profile;
435 435
 
436 436
 				// @todo Should we check for this year and tell them they made a mistake :P? (based on coppa at least?)
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 			'label' => $txt['date_registered'],
453 453
 			'log_change' => true,
454 454
 			'permission' => 'moderate_forum',
455
-			'input_validate' => function (&$value) {
455
+			'input_validate' => function(&$value) {
456 456
 				global $txt, $user_info, $modSettings, $cur_profile;
457 457
 
458 458
 				// Bad date!  Go try again - please?
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			'subtext' => $txt['valid_email'],
477 477
 			'log_change' => true,
478 478
 			'permission' => 'profile_identity',
479
-			'input_validate' => function (&$value) {
479
+			'input_validate' => function(&$value) {
480 480
 				global $context, $old_profile, $profile_vars, $modSettings;
481 481
 
482 482
 				if (strtolower($value) == strtolower($old_profile['email_address']))
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			'value' => empty($cur_profile['hide_email']) ? true : false,
504 504
 			'label' => $txt['allow_user_email'],
505 505
 			'permission' => 'profile_identity',
506
-			'input_validate' => function (&$value) {
506
+			'input_validate' => function(&$value) {
507 507
 				$value = $value == 0 ? 1 : 0;
508 508
 
509 509
 				return true;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 			'callback_func' => 'theme_pick',
524 524
 			'permission' => 'profile_extra',
525 525
 			'enabled' => empty($settings['disable_user_variant']) || !empty($modSettings['theme_allow']) || allowedTo('admin_forum'),
526
-			'preload' => function () {
526
+			'preload' => function() {
527 527
 				global $context, $cur_profile, $txt;
528 528
 
529 529
 				$db = database();
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 				);
548 548
 				return true;
549 549
 			},
550
-			'input_validate' => function (&$value) {
550
+			'input_validate' => function(&$value) {
551 551
 				$value = (int) $value;
552 552
 				return true;
553 553
 			},
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 			'callback_func' => 'karma_modify',
558 558
 			'permission' => 'admin_forum',
559 559
 			// Set karma_bad too!
560
-			'input_validate' => function (&$value) {
560
+			'input_validate' => function(&$value) {
561 561
 				global $profile_vars, $cur_profile;
562 562
 
563 563
 				$value = (int) $value;
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 				}
569 569
 				return true;
570 570
 			},
571
-			'preload' => function () {
571
+			'preload' => function() {
572 572
 				global $context, $cur_profile;
573 573
 
574 574
 				$context['member']['karma']['good'] = $cur_profile['karma_good'];
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			'preload' => 'profileLoadLanguages',
587 587
 			'enabled' => !empty($modSettings['userLanguage']),
588 588
 			'value' => empty($cur_profile['lngfile']) ? $language : $cur_profile['lngfile'],
589
-			'input_validate' => function (&$value) {
589
+			'input_validate' => function(&$value) {
590 590
 				global $context, $cur_profile;
591 591
 
592 592
 				// Load the languages.
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 			'log_change' => true,
614 614
 			'permission' => 'profile_identity',
615 615
 			'prehtml' => allowedTo('admin_forum') && isset($_GET['changeusername']) ? '<div class="warningbox">' . $txt['username_warning'] . '</div>' : '',
616
-			'input_validate' => function (&$value) {
616
+			'input_validate' => function(&$value) {
617 617
 				global $context, $user_info, $cur_profile;
618 618
 
619 619
 				if (allowedTo('admin_forum'))
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 			'permission' => 'profile_identity',
666 666
 			'save_key' => 'passwd',
667 667
 			// Note this will only work if passwrd2 also exists!
668
-			'input_validate' => function (&$value) {
668
+			'input_validate' => function(&$value) {
669 669
 				global $user_info, $cur_profile;
670 670
 
671 671
 				// If we didn't try it then ignore it!
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 			),
728 728
 			'subtext' => $txt['receive_from_description'],
729 729
 			'value' => empty($cur_profile['receive_from']) ? 0 : $cur_profile['receive_from'],
730
-			'input_validate' => function (&$value) {
730
+			'input_validate' => function(&$value) {
731 731
 				global $cur_profile, $profile_vars;
732 732
 
733 733
 				// Simple validate and apply the two "sub settings"
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 			'callback_func' => 'pm_settings',
745 745
 			'permission' => 'pm_read',
746 746
 			'save_key' => 'pm_prefs',
747
-			'preload' => function () {
747
+			'preload' => function() {
748 748
 				global $context, $cur_profile;
749 749
 
750 750
 				$context['display_mode'] = $cur_profile['pm_prefs'] & 3;
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 
753 753
 				return true;
754 754
 			},
755
-			'input_validate' => function (&$value) {
755
+			'input_validate' => function(&$value) {
756 756
 				global $cur_profile, $profile_vars;
757 757
 
758 758
 				// Simple validate and apply the two "sub settings"
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 			'log_change' => true,
770 770
 			'size' => 7,
771 771
 			'permission' => 'moderate_forum',
772
-			'input_validate' => function (&$value) {
772
+			'input_validate' => function(&$value) {
773 773
 				if (!is_numeric($value))
774 774
 					return 'digits_only';
775 775
 				else
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			'input_attr' => array('maxlength="60"'),
786 786
 			'permission' => 'profile_identity',
787 787
 			'enabled' => !empty($modSettings['allow_editDisplayName']) || allowedTo('moderate_forum'),
788
-			'input_validate' => function (&$value) {
788
+			'input_validate' => function(&$value) {
789 789
 				global $context, $cur_profile;
790 790
 
791 791
 				$value = trim(preg_replace('~[\s]~u', ' ', $value));
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 			'postinput' => '<span class="smalltext" style="margin-left: 4ex;">[<a href="' . $scripturl . '?action=quickhelp;help=secret_why_blank" onclick="return reqOverlayDiv(this.href);">' . $txt['secret_why_blank'] . '</a>]</span>',
819 819
 			'value' => '',
820 820
 			'permission' => 'profile_identity',
821
-			'input_validate' => function (&$value) {
821
+			'input_validate' => function(&$value) {
822 822
 				global $cur_profile;
823 823
 
824 824
 				if (empty($value))
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 			'callback_func' => 'smiley_pick',
863 863
 			'enabled' => !empty($modSettings['smiley_sets_enable']),
864 864
 			'permission' => 'profile_extra',
865
-			'preload' => function () {
865
+			'preload' => function() {
866 866
 				global $modSettings, $context, $txt, $cur_profile;
867 867
 
868 868
 				$context['member']['smiley_set']['id'] = empty($cur_profile['smiley_set']) ? '' : $cur_profile['smiley_set'];
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 				}
882 882
 				return true;
883 883
 			},
884
-			'input_validate' => function (&$value) {
884
+			'input_validate' => function(&$value) {
885 885
 				global $modSettings;
886 886
 
887 887
 				$smiley_sets = explode(',', $modSettings['smiley_sets_known']);
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 			'callback_func' => 'theme_settings',
897 897
 			'permission' => 'profile_extra',
898 898
 			'is_dummy' => true,
899
-			'preload' => function () {
899
+			'preload' => function() {
900 900
 				global $context, $user_info;
901 901
 
902 902
 				loadLanguage('Settings');
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 			'type' => 'callback',
914 914
 			'callback_func' => 'timeformat_modify',
915 915
 			'permission' => 'profile_extra',
916
-			'preload' => function () {
916
+			'preload' => function() {
917 917
 				global $context, $user_info, $txt, $cur_profile, $modSettings;
918 918
 
919 919
 				$context['easy_timeformats'] = array(
@@ -936,13 +936,13 @@  discard block
 block discarded – undo
936 936
 			'type' => 'callback',
937 937
 			'callback_func' => 'timeoffset_modify',
938 938
 			'permission' => 'profile_extra',
939
-			'preload' => function () {
939
+			'preload' => function() {
940 940
 				global $context, $cur_profile;
941 941
 
942 942
 				$context['member']['time_offset'] = $cur_profile['time_offset'];
943 943
 				return true;
944 944
 			},
945
-			'input_validate' => function (&$value) {
945
+			'input_validate' => function(&$value) {
946 946
 				// Validate the time_offset...
947 947
 				$value = (float) strtr($value, ',', '.');
948 948
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 			'size' => 50,
961 961
 			'permission' => 'profile_title',
962 962
 			'enabled' => !empty($modSettings['titlesEnable']),
963
-			'input_validate' => function (&$value) {
963
+			'input_validate' => function(&$value) {
964 964
 				if (Util::strlen($value) > 50)
965 965
 					return 'user_title_too_long';
966 966
 
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 			'size' => 50,
983 983
 			'permission' => 'profile_extra',
984 984
 			// Fix the URL...
985
-			'input_validate' => function (&$value) {
985
+			'input_validate' => function(&$value) {
986 986
 
987 987
 				$value = addProtocol($value, array('http://', 'https://', 'ftp://', 'ftps://'));
988 988
 				if (strlen($value) < 8)
Please login to merge, or discard this patch.