Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/MembersOnline.subs.php 1 patch
Braces   +28 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,13 +51,17 @@  discard block
 block discarded – undo
51 51
 
52 52
 	// Not allowed sort method? Bang! Error!
53 53
 	elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options))
54
-		trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE);
54
+	{
55
+			trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE);
56
+	}
55 57
 
56 58
 	// Get it from the cache and send it back.
57 59
 	$temp = array();
58 60
 	$cache = Cache::instance();
59 61
 	if ($cache->levelHigherThan(1) && $cache->getVar($temp, 'membersOnlineStats-' . $membersOnlineOptions['sort'], 240))
60
-		return filter_members_online($temp, empty($membersOnlineOptions['reverse_sort']) ? 'ksort' : 'krsort');
62
+	{
63
+			return filter_members_online($temp, empty($membersOnlineOptions['reverse_sort']) ? 'ksort' : 'krsort');
64
+	}
61 65
 
62 66
 	// Initialize the array that'll be returned later on.
63 67
 	$membersOnlineStats = array(
@@ -75,7 +79,9 @@  discard block
 block discarded – undo
75 79
 	$spiders = array();
76 80
 	$spider_finds = array();
77 81
 	if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache']))
78
-		$spiders = Util::unserialize($modSettings['spider_name_cache']);
82
+	{
83
+			$spiders = Util::unserialize($modSettings['spider_name_cache']);
84
+	}
79 85
 
80 86
 	// Load the users online right now.
81 87
 	$request = $db->query('', '
@@ -113,9 +119,12 @@  discard block
 block discarded – undo
113 119
 
114 120
 		// Some basic color coding...
115 121
 		if (!empty($row['online_color']))
116
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
117
-		else
118
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
122
+		{
123
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
124
+		}
125
+		else {
126
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
127
+		}
119 128
 
120 129
 		// Buddies get counted and highlighted.
121 130
 		$is_buddy = in_array($row['id_member'], $user_info['buddies']);
@@ -140,11 +149,13 @@  discard block
 block discarded – undo
140 149
 
141 150
 		// Store all distinct (primary) membergroups that are shown.
142 151
 		if (!isset($membersOnlineStats['online_groups'][$row['id_group']]))
143
-			$membersOnlineStats['online_groups'][$row['id_group']] = array(
152
+		{
153
+					$membersOnlineStats['online_groups'][$row['id_group']] = array(
144 154
 				'id' => $row['id_group'],
145 155
 				'name' => $row['group_name'],
146 156
 				'color' => $row['online_color']
147 157
 			);
158
+		}
148 159
 	}
149 160
 	$db->free_result($request);
150 161
 
@@ -234,10 +245,12 @@  discard block
 block discarded – undo
234 245
 
235 246
 	// More members on now than ever were?  Update it!
236 247
 	if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline'])
237
-		$settingsToUpdate = array(
248
+	{
249
+			$settingsToUpdate = array(
238 250
 			'mostOnline' => $total_users_online,
239 251
 			'mostDate' => time()
240 252
 		);
253
+	}
241 254
 
242 255
 	$date = Util::strftime('%Y-%m-%d', forum_time(false));
243 256
 
@@ -270,7 +283,9 @@  discard block
 block discarded – undo
270 283
 			list ($modSettings['mostOnlineToday']) = $db->fetch_row($request);
271 284
 
272 285
 			if ($total_users_online > $modSettings['mostOnlineToday'])
273
-				trackStats(array('most_on' => $total_users_online));
286
+			{
287
+							trackStats(array('most_on' => $total_users_online));
288
+			}
274 289
 
275 290
 			$total_users_online = max($total_users_online, $modSettings['mostOnlineToday']);
276 291
 		}
@@ -288,5 +303,7 @@  discard block
 block discarded – undo
288 303
 	}
289 304
 
290 305
 	if (!empty($settingsToUpdate))
291
-		updateSettings($settingsToUpdate);
292
-}
306
+	{
307
+			updateSettings($settingsToUpdate);
308
+	}
309
+	}
Please login to merge, or discard this patch.
sources/subs/TemplateLayers.class.php 1 patch
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 		parent::add($layer, $priority);
51 51
 
52 52
 		if (self::$_error_safe)
53
-			$this->_error_safe_layers[] = $layer;
53
+		{
54
+					$this->_error_safe_layers[] = $layer;
55
+		}
54 56
 	}
55 57
 
56 58
 	/**
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
 		parent::addBefore($layer, $following);
65 67
 
66 68
 		if (self::$_error_safe)
67
-			$this->_error_safe_layers[] = $layer;
69
+		{
70
+					$this->_error_safe_layers[] = $layer;
71
+		}
68 72
 	}
69 73
 
70 74
 	/**
@@ -78,7 +82,9 @@  discard block
 block discarded – undo
78 82
 		parent::addAfter($layer, $previous);
79 83
 
80 84
 		if (self::$_error_safe)
81
-			$this->_error_safe_layers[] = $layer;
85
+		{
86
+					$this->_error_safe_layers[] = $layer;
87
+		}
82 88
 	}
83 89
 
84 90
 	/**
@@ -92,7 +98,9 @@  discard block
 block discarded – undo
92 98
 		parent::addEnd($layer, $priority);
93 99
 
94 100
 		if (self::$_error_safe)
95
-			$this->_error_safe_layers[] = $layer;
101
+		{
102
+					$this->_error_safe_layers[] = $layer;
103
+		}
96 104
 	}
97 105
 
98 106
 	/**
@@ -106,7 +114,9 @@  discard block
 block discarded – undo
106 114
 		parent::addBegin($layer, $priority);
107 115
 
108 116
 		if (self::$_error_safe)
109
-			$this->_error_safe_layers[] = $layer;
117
+		{
118
+					$this->_error_safe_layers[] = $layer;
119
+		}
110 120
 	}
111 121
 
112 122
 	/**
@@ -129,7 +139,9 @@  discard block
 block discarded – undo
129 139
 			foreach ($dummy as $key => $val)
130 140
 			{
131 141
 				if (in_array($key, $this->_error_safe_layers))
132
-					$all_layers[$key] = $val;
142
+				{
143
+									$all_layers[$key] = $val;
144
+				}
133 145
 			}
134 146
 		}
135 147
 
@@ -147,7 +159,9 @@  discard block
 block discarded – undo
147 159
 	public function reverseLayers()
148 160
 	{
149 161
 		if ($this->_sorted_entities === null)
150
-			$this->prepareContext();
162
+		{
163
+					$this->prepareContext();
164
+		}
151 165
 
152 166
 		return array_reverse($this->_sorted_entities);
153 167
 	}
@@ -162,9 +176,12 @@  discard block
 block discarded – undo
162 176
 	public function hasLayers($base = false)
163 177
 	{
164 178
 		if (!$base)
165
-			return (!empty($this->_all_general) || !empty($this->_all_begin) || !empty($this->_all_end));
166
-		else
167
-			return array_diff_key(array_merge($this->_all_general, $this->_all_begin, $this->_all_end), array('body' => 0, 'html' => 0));
179
+		{
180
+					return (!empty($this->_all_general) || !empty($this->_all_begin) || !empty($this->_all_end));
181
+		}
182
+		else {
183
+					return array_diff_key(array_merge($this->_all_general, $this->_all_begin, $this->_all_end), array('body' => 0, 'html' => 0));
184
+		}
168 185
 	}
169 186
 
170 187
 	/**
@@ -193,7 +210,9 @@  discard block
 block discarded – undo
193 210
 	public static function instance($error_safe = false)
194 211
 	{
195 212
 		if (self::$_instance === null)
196
-			self::$_instance = new Template_Layers();
213
+		{
214
+					self::$_instance = new Template_Layers();
215
+		}
197 216
 
198 217
 		self::$_error_safe = $error_safe;
199 218
 
Please login to merge, or discard this patch.
sources/subs/Themes.subs.php 1 patch
Braces   +120 added lines, -43 removed lines patch added patch discarded remove patch
@@ -40,11 +40,13 @@  discard block
 block discarded – undo
40 40
 	while ($row = $db->fetch_assoc($request))
41 41
 	{
42 42
 		if (!isset($themes[$row['id_theme']]))
43
-			$themes[$row['id_theme']] = array(
43
+		{
44
+					$themes[$row['id_theme']] = array(
44 45
 				'id' => $row['id_theme'],
45 46
 				'num_default_options' => 0,
46 47
 				'num_members' => 0,
47 48
 			);
49
+		}
48 50
 		$themes[$row['id_theme']][$row['variable']] = $row['value'];
49 51
 	}
50 52
 	$db->free_result($request);
@@ -133,8 +135,10 @@  discard block
 block discarded – undo
133 135
 	{
134 136
 		// Find the right one.
135 137
 		foreach ($indexes as $index)
136
-			if (strpos($row['value'], $index) !== false)
138
+		{
139
+					if (strpos($row['value'], $index) !== false)
137 140
 				$themes[$row['id_theme']] = $index;
141
+		}
138 142
 	}
139 143
 	$db->free_result($request);
140 144
 
@@ -166,7 +170,9 @@  discard block
 block discarded – undo
166 170
 		)
167 171
 	);
168 172
 	while ($row = $db->fetch_assoc($request))
169
-		$themelist[$row['id_theme']] = $row['value'];
173
+	{
174
+			$themelist[$row['id_theme']] = $row['value'];
175
+	}
170 176
 
171 177
 	$db->free_result($request);
172 178
 
@@ -205,7 +211,9 @@  discard block
 block discarded – undo
205 211
 		),
206 212
 	);
207 213
 	while ($row = $db->fetch_assoc($request))
208
-		$themes[$row['id_theme']][$row['variable']] = $row['value'];
214
+	{
215
+			$themes[$row['id_theme']][$row['variable']] = $row['value'];
216
+	}
209 217
 	$db->free_result($request);
210 218
 
211 219
 	return $themes;
@@ -224,10 +232,14 @@  discard block
 block discarded – undo
224 232
 
225 233
 	// Nothing passed then we use the defaults
226 234
 	if (empty($theme_list))
227
-		$theme_list = explode(',', $modSettings['knownThemes']);
235
+	{
236
+			$theme_list = explode(',', $modSettings['knownThemes']);
237
+	}
228 238
 
229 239
 	if (!is_array($theme_list))
230
-		$theme_list = array($theme_list);
240
+	{
241
+			$theme_list = array($theme_list);
242
+	}
231 243
 
232 244
 	// Load up any themes we need the paths for
233 245
 	$request = $db->query('', '
@@ -244,7 +256,9 @@  discard block
 block discarded – undo
244 256
 	);
245 257
 	$theme_paths = array();
246 258
 	while ($row = $db->fetch_assoc($request))
247
-		$theme_paths[$row['id_theme']][$row['variable']] = $row['value'];
259
+	{
260
+			$theme_paths[$row['id_theme']][$row['variable']] = $row['value'];
261
+	}
248 262
 	$db->free_result($request);
249 263
 
250 264
 	return $theme_paths;
@@ -274,11 +288,13 @@  discard block
 block discarded – undo
274 288
 	);
275 289
 	$themes = array();
276 290
 	while ($row = $db->fetch_assoc($request))
277
-		$themes[] = array(
291
+	{
292
+			$themes[] = array(
278 293
 			'id' => $row['id_theme'],
279 294
 			'name' => $row['name'],
280 295
 			'known' => in_array($row['id_theme'], $knownThemes),
281 296
 		);
297
+	}
282 298
 	$db->free_result($request);
283 299
 
284 300
 	return $themes;
@@ -304,7 +320,9 @@  discard block
 block discarded – undo
304 320
 	);
305 321
 	$themes = array();
306 322
 	while ($row = $db->fetch_row($request))
307
-		$themes = explode(',', $row[0]);
323
+	{
324
+			$themes = explode(',', $row[0]);
325
+	}
308 326
 	$db->free_result($request);
309 327
 
310 328
 	return $themes;
@@ -328,13 +346,17 @@  discard block
 block discarded – undo
328 346
 
329 347
 	// Is it even a directory?
330 348
 	if (!is_dir($path))
331
-		throw new Elk_Exception('error_invalid_dir', 'critical');
349
+	{
350
+			throw new Elk_Exception('error_invalid_dir', 'critical');
351
+	}
332 352
 
333 353
 	// Read this directory's contents
334 354
 	$entries = array();
335 355
 	$dir = dir($path);
336 356
 	while ($entry = $dir->read())
337
-		$entries[] = $entry;
357
+	{
358
+			$entries[] = $entry;
359
+	}
338 360
 	$dir->close();
339 361
 
340 362
 	// Sort it so it looks natural to the user
@@ -347,11 +369,14 @@  discard block
 block discarded – undo
347 369
 	{
348 370
 		// Skip all dot files, including .htaccess.
349 371
 		if (substr($entry, 0, 1) === '.' || $entry === 'CVS')
350
-			continue;
372
+		{
373
+					continue;
374
+		}
351 375
 
352 376
 		// A directory entry
353 377
 		if (is_dir($path . '/' . $entry))
354
-			$listing1[] = array(
378
+		{
379
+					$listing1[] = array(
355 380
 				'filename' => $entry,
356 381
 				'is_writable' => is_writable($path . '/' . $entry),
357 382
 				'is_directory' => true,
@@ -361,6 +386,7 @@  discard block
 block discarded – undo
361 386
 				'href' => $scripturl . '?action=admin;area=theme;th=' . $_GET['th'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=browse;directory=' . $relative . $entry,
362 387
 				'size' => '',
363 388
 			);
389
+		}
364 390
 		// A file entry has some more checks
365 391
 		else
366 392
 		{
@@ -405,7 +431,9 @@  discard block
 block discarded – undo
405 431
 		)
406 432
 	);
407 433
 	while ($row = $db->fetch_assoc($request))
408
-		$themes[] = $row;
434
+	{
435
+			$themes[] = $row;
436
+	}
409 437
 	$db->free_result($request);
410 438
 
411 439
 	return($themes);
@@ -447,11 +475,13 @@  discard block
 block discarded – undo
447 475
 		while ($row = $db->fetch_assoc($request))
448 476
 		{
449 477
 			if (!isset($available_themes[$row['id_theme']]))
450
-				$available_themes[$row['id_theme']] = array(
478
+			{
479
+							$available_themes[$row['id_theme']] = array(
451 480
 					'id' => $row['id_theme'],
452 481
 					'selected' => $current_theme == $row['id_theme'],
453 482
 					'num_users' => 0
454 483
 				);
484
+			}
455 485
 			$available_themes[$row['id_theme']][$row['variable']] = $row['value'];
456 486
 		}
457 487
 		$db->free_result($request);
@@ -465,8 +495,9 @@  discard block
 block discarded – undo
465 495
 		);
466 496
 		$guest_theme = 0;
467 497
 	}
468
-	else
469
-		$guest_theme = $modSettings['theme_guests'];
498
+	else {
499
+			$guest_theme = $modSettings['theme_guests'];
500
+	}
470 501
 
471 502
 	$request = $db->query('', '
472 503
 		SELECT id_theme, COUNT(*) AS the_count
@@ -480,14 +511,21 @@  discard block
 block discarded – undo
480 511
 	{
481 512
 		// Figure out which theme it is they are REALLY using.
482 513
 		if (!empty($modSettings['knownThemes']) && !in_array($row['id_theme'], explode(',', $modSettings['knownThemes'])))
483
-			$row['id_theme'] = $guest_theme;
514
+		{
515
+					$row['id_theme'] = $guest_theme;
516
+		}
484 517
 		elseif (empty($modSettings['theme_allow']))
485
-			$row['id_theme'] = $guest_theme;
518
+		{
519
+					$row['id_theme'] = $guest_theme;
520
+		}
486 521
 
487 522
 		if (isset($available_themes[$row['id_theme']]))
488
-			$available_themes[$row['id_theme']]['num_users'] += $row['the_count'];
489
-		else
490
-			$available_themes[$guest_theme]['num_users'] += $row['the_count'];
523
+		{
524
+					$available_themes[$row['id_theme']]['num_users'] += $row['the_count'];
525
+		}
526
+		else {
527
+					$available_themes[$guest_theme]['num_users'] += $row['the_count'];
528
+		}
491 529
 	}
492 530
 	$db->free_result($request);
493 531
 
@@ -507,7 +545,9 @@  discard block
 block discarded – undo
507 545
 			)
508 546
 		);
509 547
 		while ($row = $db->fetch_assoc($request))
510
-			$variant_preferences[$row['id_theme']] = $row['value'];
548
+		{
549
+					$variant_preferences[$row['id_theme']] = $row['value'];
550
+		}
511 551
 		$db->free_result($request);
512 552
 	}
513 553
 
@@ -519,16 +559,22 @@  discard block
 block discarded – undo
519 559
 	{
520 560
 		// Don't try to load the forum or board default theme's data... it doesn't have any!
521 561
 		if ($id_theme == 0)
522
-			continue;
562
+		{
563
+					continue;
564
+		}
523 565
 
524 566
 		// The thumbnail needs the correct path.
525 567
 		$settings['images_url'] = &$theme_data['images_url'];
526 568
 		$theme_thumbnail_href = $theme_data['images_url'] . '/thumbnail.png';
527 569
 
528 570
 		if (file_exists($theme_data['theme_dir'] . '/languages/' . $user_info['language'] . '/Settings.' . $user_info['language'] . '.php'))
529
-			include($theme_data['theme_dir'] . '/languages/' . $user_info['language'] . '/Settings.' . $user_info['language'] . '.php');
571
+		{
572
+					include($theme_data['theme_dir'] . '/languages/' . $user_info['language'] . '/Settings.' . $user_info['language'] . '.php');
573
+		}
530 574
 		elseif (file_exists($theme_data['theme_dir'] . '/languages/' . $language . '/Settings.' . $language . '.php'))
531
-			include($theme_data['theme_dir'] . '/languages/' . $language . '/Settings.' . $language . '.php');
575
+		{
576
+					include($theme_data['theme_dir'] . '/languages/' . $language . '/Settings.' . $language . '.php');
577
+		}
532 578
 		else
533 579
 		{
534 580
 			$txt['theme_description'] = '';
@@ -556,14 +602,18 @@  discard block
 block discarded – undo
556 602
 
557 603
 					$available_themes[$id_theme]['variants'] = array();
558 604
 					foreach ($settings['theme_variants'] as $variant)
559
-						$available_themes[$id_theme]['variants'][$variant] = array(
605
+					{
606
+											$available_themes[$id_theme]['variants'][$variant] = array(
560 607
 							'label' => isset($txt['variant_' . $variant]) ? $txt['variant_' . $variant] : $variant,
561 608
 							'thumbnail' => !file_exists($theme_data['theme_dir'] . '/images/thumbnail.png') || file_exists($theme_data['theme_dir'] . '/images/thumbnail_' . $variant . '.png') ? $theme_data['images_url'] . '/thumbnail_' . $variant . '.png' : ($theme_data['images_url'] . '/thumbnail.png'),
562 609
 						);
610
+					}
563 611
 
564 612
 					$available_themes[$id_theme]['selected_variant'] = isset($_GET['vrt']) ? $_GET['vrt'] : (!empty($variant_preferences[$id_theme]) ? $variant_preferences[$id_theme] : (!empty($settings['default_variant']) ? $settings['default_variant'] : $settings['theme_variants'][0]));
565 613
 					if (!isset($available_themes[$id_theme]['variants'][$available_themes[$id_theme]['selected_variant']]['thumbnail']))
566
-						$available_themes[$id_theme]['selected_variant'] = $settings['theme_variants'][0];
614
+					{
615
+											$available_themes[$id_theme]['selected_variant'] = $settings['theme_variants'][0];
616
+					}
567 617
 
568 618
 					$available_themes[$id_theme]['thumbnail_href'] = $available_themes[$id_theme]['variants'][$available_themes[$id_theme]['selected_variant']]['thumbnail'];
569 619
 
@@ -601,7 +651,9 @@  discard block
 block discarded – undo
601 651
 		)
602 652
 	);
603 653
 	while ($row = $db->fetch_assoc($request))
604
-		$themes[] = $row;
654
+	{
655
+			$themes[] = $row;
656
+	}
605 657
 	$db->free_result($request);
606 658
 
607 659
 	return $themes;
@@ -631,39 +683,60 @@  discard block
 block discarded – undo
631 683
 
632 684
 	// The default theme is 1 (id_theme = 1)
633 685
 	if ($theme === 'default')
634
-		$query_param = array('theme_operator' => '=', 'theme' => 1);
686
+	{
687
+			$query_param = array('theme_operator' => '=', 'theme' => 1);
688
+	}
635 689
 	// All the themes that are not the default one (id_theme != 1)
636 690
 	// @todo 'non_default' would be more explicative, though it could be confused with the one in $membergroups
637 691
 	elseif ($theme === 'custom')
638
-		$query_param = array('theme_operator' => '!=', 'theme' => 1);
692
+	{
693
+			$query_param = array('theme_operator' => '!=', 'theme' => 1);
694
+	}
639 695
 	// If numeric means a specific theme
640 696
 	elseif (is_numeric($theme))
641
-		$query_param = array('theme_operator' => '=', 'theme' => (int) $theme);
697
+	{
698
+			$query_param = array('theme_operator' => '=', 'theme' => (int) $theme);
699
+	}
642 700
 
643 701
 	// Guests means id_member = -1
644 702
 	if ($membergroups === 'guests')
645
-		$query_param += array('member_operator' => '=', 'member' => -1);
703
+	{
704
+			$query_param += array('member_operator' => '=', 'member' => -1);
705
+	}
646 706
 	// Members means id_member > 0
647 707
 	elseif ($membergroups === 'members')
648
-		$query_param += array('member_operator' => '>', 'member' => 0);
708
+	{
709
+			$query_param += array('member_operator' => '>', 'member' => 0);
710
+	}
649 711
 	// Non default settings id_member != 0 (that is different from id_member > 0)
650 712
 	elseif ($membergroups === 'non_default')
651
-		$query_param += array('member_operator' => '!=', 'member' => 0);
713
+	{
714
+			$query_param += array('member_operator' => '!=', 'member' => 0);
715
+	}
652 716
 	// all it's all
653 717
 	elseif ($membergroups === 'all')
654
-		$query_param += array('member_operator' => '', 'member' => 0);
718
+	{
719
+			$query_param += array('member_operator' => '', 'member' => 0);
720
+	}
655 721
 	// If it is a number, then it means a specific member (id_member = (int))
656 722
 	elseif (is_numeric($membergroups))
657
-		$query_param += array('member_operator' => '=', 'member' => (int) $membergroups);
723
+	{
724
+			$query_param += array('member_operator' => '=', 'member' => (int) $membergroups);
725
+	}
658 726
 
659 727
 	// If array or string set up the query accordingly
660 728
 	if (is_array($old_settings))
661
-		$var = 'variable IN ({array_string:old_settings})';
729
+	{
730
+			$var = 'variable IN ({array_string:old_settings})';
731
+	}
662 732
 	elseif (!empty($old_settings))
663
-		$var = 'variable = {string:old_settings}';
733
+	{
734
+			$var = 'variable = {string:old_settings}';
735
+	}
664 736
 	// If empty then means any setting
665
-	else
666
-		$var = '1=1';
737
+	else {
738
+			$var = '1=1';
739
+	}
667 740
 
668 741
 	$db->query('', '
669 742
 		DELETE FROM {db_prefix}themes
@@ -733,7 +806,9 @@  discard block
 block discarded – undo
733 806
 
734 807
 	// Make sure we never ever delete the default theme!
735 808
 	if ($id === 1)
736
-		throw new Elk_Exception('no_access', false);
809
+	{
810
+			throw new Elk_Exception('no_access', false);
811
+	}
737 812
 
738 813
 	$db->query('', '
739 814
 		DELETE FROM {db_prefix}themes
@@ -891,7 +966,9 @@  discard block
 block discarded – undo
891 966
 		)
892 967
 	);
893 968
 	while ($row = $db->fetch_assoc($request))
894
-		$options[$row['variable']] = $row['value'];
969
+	{
970
+			$options[$row['variable']] = $row['value'];
971
+	}
895 972
 	$db->free_result($request);
896 973
 
897 974
 	return $options;
Please login to merge, or discard this patch.
sources/subs/ProfileOptions.subs.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,11 +110,15 @@
 block discarded – undo
110 110
 		// Can they edit their primary group?
111 111
 		if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1)
112 112
 			|| ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $current_groups)))
113
-			$context['can_edit_primary'] = true;
113
+		{
114
+					$context['can_edit_primary'] = true;
115
+		}
114 116
 
115 117
 		// If they can't manage (protected) groups, and it's not publicly joinable or already assigned, they can't see it.
116 118
 		if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group'])
117
-			continue;
119
+		{
120
+					continue;
121
+		}
118 122
 
119 123
 		$groups[in_array($row['id_group'], $current_groups) ? 'member' : 'available'][$row['id_group']] = array(
120 124
 			'id' => $row['id_group'],
Please login to merge, or discard this patch.
sources/subs/Logging.subs.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,8 +66,10 @@  discard block
 block discarded – undo
66 66
 
67 67
 	// Guess it got deleted.
68 68
 	if ($db->affected_rows() == 0)
69
-		$_SESSION['log_time'] = 0;
70
-}
69
+	{
70
+			$_SESSION['log_time'] = 0;
71
+	}
72
+	}
71 73
 
72 74
 /**
73 75
  * Update a users entry in the online log
@@ -83,7 +85,8 @@  discard block
 block discarded – undo
83 85
 	$db = database();
84 86
 
85 87
 	if ($do_delete || !empty($user_info['id']))
86
-		$db->query('', '
88
+	{
89
+			$db->query('', '
87 90
 			DELETE FROM {db_prefix}log_online
88 91
 			WHERE ' . ($do_delete ? 'log_time < {int:log_time}' : '') . ($do_delete && !empty($user_info['id']) ? ' OR ' : '') . (empty($user_info['id']) ? '' : 'id_member = {int:current_member}'),
89 92
 			array(
@@ -91,6 +94,7 @@  discard block
 block discarded – undo
91 94
 				'log_time' => time() - $modSettings['lastActive'] * 60,
92 95
 			)
93 96
 		);
97
+	}
94 98
 
95 99
 	$db->insert($do_delete ? 'ignore' : 'replace',
96 100
 		'{db_prefix}log_online',
@@ -263,7 +267,9 @@  discard block
 block discarded – undo
263 267
 	$db = database();
264 268
 
265 269
 	if (!is_array($ids))
266
-		$ids = array($ids);
270
+	{
271
+			$ids = array($ids);
272
+	}
267 273
 
268 274
 	if (empty($on))
269 275
 	{
Please login to merge, or discard this patch.
sources/subs/ManagePermissions.subs.php 2 patches
Braces   +82 added lines, -30 removed lines patch added patch discarded remove patch
@@ -186,15 +186,21 @@  discard block
 block discarded – undo
186 186
 	foreach ($groupLevels['global'][$level] as $k => $permission)
187 187
 	{
188 188
 		if (!empty($illegal_permissions) && in_array($permission, $illegal_permissions))
189
-			unset($groupLevels['global'][$level][$k]);
189
+		{
190
+					unset($groupLevels['global'][$level][$k]);
191
+		}
190 192
 
191 193
 		if ($group == -1 && in_array($permission, $illegal_guest_permissions))
192
-			unset($groupLevels['global'][$level][$k]);
194
+		{
195
+					unset($groupLevels['global'][$level][$k]);
196
+		}
193 197
 	}
194 198
 	if ($group == -1)
195
-		foreach ($groupLevels['board'][$level] as $k => $permission)
199
+	{
200
+			foreach ($groupLevels['board'][$level] as $k => $permission)
196 201
 			if (in_array($permission, $illegal_guest_permissions))
197 202
 				unset($groupLevels['board'][$level][$k]);
203
+	}
198 204
 
199 205
 	// Reset all cached permissions.
200 206
 	updateSettings(array('settings_updated' => time()));
@@ -205,7 +211,9 @@  discard block
 block discarded – undo
205 211
 		$group = (int) $group;
206 212
 
207 213
 		if (empty($groupLevels['global'][$level]))
208
-			return;
214
+		{
215
+					return;
216
+		}
209 217
 
210 218
 		$db->query('', '
211 219
 			DELETE FROM {db_prefix}permissions
@@ -228,7 +236,9 @@  discard block
 block discarded – undo
228 236
 
229 237
 		$groupInserts = array();
230 238
 		foreach ($groupLevels['global'][$level] as $permission)
231
-			$groupInserts[] = array($group, $permission);
239
+		{
240
+					$groupInserts[] = array($group, $permission);
241
+		}
232 242
 
233 243
 		$db->insert('insert',
234 244
 			'{db_prefix}permissions',
@@ -239,7 +249,9 @@  discard block
 block discarded – undo
239 249
 
240 250
 		$boardInserts = array();
241 251
 		foreach ($groupLevels['board'][$level] as $permission)
242
-			$boardInserts[] = array(1, $group, $permission);
252
+		{
253
+					$boardInserts[] = array(1, $group, $permission);
254
+		}
243 255
 
244 256
 		$db->insert('insert',
245 257
 			'{db_prefix}board_permissions',
@@ -271,7 +283,9 @@  discard block
 block discarded – undo
271 283
 		{
272 284
 			$boardInserts = array();
273 285
 			foreach ($groupLevels['board'][$level] as $permission)
274
-				$boardInserts[] = array($profile, $group, $permission);
286
+			{
287
+							$boardInserts[] = array($profile, $group, $permission);
288
+			}
275 289
 
276 290
 			$db->insert('insert',
277 291
 				'{db_prefix}board_permissions',
@@ -295,7 +309,9 @@  discard block
 block discarded – undo
295 309
 		);
296 310
 
297 311
 		if (empty($boardLevels[$level]))
298
-			return;
312
+		{
313
+					return;
314
+		}
299 315
 
300 316
 		// Get all the groups...
301 317
 		$query = $db->query('', '
@@ -314,7 +330,9 @@  discard block
 block discarded – undo
314 330
 
315 331
 			$boardInserts = array();
316 332
 			foreach ($boardLevels[$level] as $permission)
317
-				$boardInserts[] = array($profile, $group, $permission);
333
+			{
334
+							$boardInserts[] = array($profile, $group, $permission);
335
+			}
318 336
 
319 337
 			$db->insert('insert',
320 338
 				'{db_prefix}board_permissions',
@@ -328,7 +346,9 @@  discard block
 block discarded – undo
328 346
 		// Add permissions for ungrouped members.
329 347
 		$boardInserts = array();
330 348
 		foreach ($boardLevels[$level] as $permission)
331
-			$boardInserts[] = array($profile, 0, $permission);
349
+		{
350
+					$boardInserts[] = array($profile, 0, $permission);
351
+		}
332 352
 
333 353
 		$db->insert('insert',
334 354
 				'{db_prefix}board_permissions',
@@ -338,9 +358,10 @@  discard block
 block discarded – undo
338 358
 			);
339 359
 	}
340 360
 	// $profile and $group are both null!
341
-	else
342
-		throw new Elk_Exception('no_access', false);
343
-}
361
+	else {
362
+			throw new Elk_Exception('no_access', false);
363
+	}
364
+	}
344 365
 
345 366
 /**
346 367
  * Load permissions profiles.
@@ -365,9 +386,12 @@  discard block
 block discarded – undo
365 386
 	{
366 387
 		// Format the label nicely.
367 388
 		if (isset($txt['permissions_profile_' . $row['profile_name']]))
368
-			$name = $txt['permissions_profile_' . $row['profile_name']];
369
-		else
370
-			$name = $row['profile_name'];
389
+		{
390
+					$name = $txt['permissions_profile_' . $row['profile_name']];
391
+		}
392
+		else {
393
+					$name = $row['profile_name'];
394
+		}
371 395
 
372 396
 		$context['profiles'][$row['id_profile']] = array(
373 397
 			'id' => $row['id_profile'],
@@ -514,11 +538,17 @@  discard block
 block discarded – undo
514 538
 		$hiddenPermissions[] = 'calendar_edit';
515 539
 	}
516 540
 	if (!in_array('w', $context['admin_features']))
517
-		$hiddenPermissions[] = 'issue_warning';
541
+	{
542
+			$hiddenPermissions[] = 'issue_warning';
543
+	}
518 544
 	if (!in_array('k', $context['admin_features']))
519
-		$hiddenPermissions[] = 'karma_edit';
545
+	{
546
+			$hiddenPermissions[] = 'karma_edit';
547
+	}
520 548
 	if (!in_array('l', $context['admin_features']))
521
-		$hiddenPermissions[] = 'like_posts';
549
+	{
550
+			$hiddenPermissions[] = 'like_posts';
551
+	}
522 552
 	if (!in_array('pe', $context['admin_features']))
523 553
 	{
524 554
 		$hiddenPermissions[] = 'approve_emails';
@@ -740,8 +770,10 @@  discard block
 block discarded – undo
740 770
 		)
741 771
 	);
742 772
 	while ($row = $db->fetch_assoc($request))
743
-		if (isset($groups[(int) $row['id_group']]) && (!empty($row['add_deny']) || $row['id_group'] != -1))
773
+	{
774
+			if (isset($groups[(int) $row['id_group']]) && (!empty($row['add_deny']) || $row['id_group'] != -1))
744 775
 			$groups[$row['id_group']]['num_permissions'][empty($row['add_deny']) ? 'denied' : 'allowed'] += $row['num_permissions'];
776
+	}
745 777
 	$db->free_result($request);
746 778
 
747 779
 	return $groups;
@@ -794,18 +826,24 @@  discard block
 block discarded – undo
794 826
 	);
795 827
 	$target_perm = array();
796 828
 	while ($row = $db->fetch_assoc($request))
797
-		$target_perm[$row['permission']] = $row['add_deny'];
829
+	{
830
+			$target_perm[$row['permission']] = $row['add_deny'];
831
+	}
798 832
 	$db->free_result($request);
799 833
 
800 834
 	$inserts = array();
801 835
 	foreach ($groups as $group_id)
802
-		foreach ($target_perm as $perm => $add_deny)
836
+	{
837
+			foreach ($target_perm as $perm => $add_deny)
803 838
 		{
804 839
 			// No dodgy permissions please!
805 840
 			if (!empty($illegal_permissions) && in_array($perm, $illegal_permissions))
806 841
 				continue;
842
+	}
807 843
 			if ($group_id == -1 && in_array($perm, $non_guest_permissions))
808
-				continue;
844
+			{
845
+							continue;
846
+			}
809 847
 
810 848
 			if ($group_id != 1 && $group_id != 3)
811 849
 			{
@@ -858,7 +896,9 @@  discard block
 block discarded – undo
858 896
 	);
859 897
 	$target_perm = array();
860 898
 	while ($row = $db->fetch_assoc($request))
861
-		$target_perm[$row['permission']] = $row['add_deny'];
899
+	{
900
+			$target_perm[$row['permission']] = $row['add_deny'];
901
+	}
862 902
 	$db->free_result($request);
863 903
 
864 904
 	$inserts = array();
@@ -868,7 +908,9 @@  discard block
 block discarded – undo
868 908
 		{
869 909
 			// Are these for guests?
870 910
 			if ($group_id == -1 && in_array($perm, $non_guest_permissions))
871
-				continue;
911
+			{
912
+							continue;
913
+			}
872 914
 
873 915
 			$inserts[] = array($perm, $group_id, $add_deny, $profile_id);
874 916
 		}
@@ -1014,7 +1056,9 @@  discard block
 block discarded – undo
1014 1056
 		)
1015 1057
 	);
1016 1058
 	while ($row = $db->fetch_assoc($result))
1017
-		$permissions[empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['permission'];
1059
+	{
1060
+			$permissions[empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['permission'];
1061
+	}
1018 1062
 	$db->free_result($result);
1019 1063
 
1020 1064
 	return $permissions;
@@ -1048,7 +1092,9 @@  discard block
 block discarded – undo
1048 1092
 		)
1049 1093
 	);
1050 1094
 	while ($row = $db->fetch_assoc($result))
1051
-		$permissions[empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['permission'];
1095
+	{
1096
+			$permissions[empty($row['add_deny']) ? 'denied' : 'allowed'][] = $row['permission'];
1097
+	}
1052 1098
 	$db->free_result($result);
1053 1099
 
1054 1100
 	return $permissions;
@@ -1270,7 +1316,9 @@  discard block
 block discarded – undo
1270 1316
 		)
1271 1317
 	);
1272 1318
 	if ($db->num_rows($request) != 0)
1273
-		throw new Elk_Exception('no_access', false);
1319
+	{
1320
+			throw new Elk_Exception('no_access', false);
1321
+	}
1274 1322
 	$db->free_result($request);
1275 1323
 
1276 1324
 	// Oh well, delete.
@@ -1305,9 +1353,11 @@  discard block
 block discarded – undo
1305 1353
 		)
1306 1354
 	);
1307 1355
 	while ($row = $db->fetch_assoc($request))
1308
-		if (isset($profiles[$row['id_profile']]))
1356
+	{
1357
+			if (isset($profiles[$row['id_profile']]))
1309 1358
 		{
1310 1359
 			$profiles[$row['id_profile']]['in_use'] = true;
1360
+	}
1311 1361
 			$profiles[$row['id_profile']]['boards'] = $row['board_count'];
1312 1362
 			$profiles[$row['id_profile']]['boards_text'] = $row['board_count'] > 1 ? sprintf($txt['permissions_profile_used_by_many'], $row['board_count']) : $txt['permissions_profile_used_by_' . ($row['board_count'] ? 'one' : 'none')];
1313 1363
 		}
@@ -1388,7 +1438,9 @@  discard block
 block discarded – undo
1388 1438
 		)
1389 1439
 	);
1390 1440
 	while ($row = $db->fetch_assoc($request))
1391
-		$groups[$row['id_group']][$row['add_deny'] ? 'add' : 'deny'][] = $row['permission'];
1441
+	{
1442
+			$groups[$row['id_group']][$row['add_deny'] ? 'add' : 'deny'][] = $row['permission'];
1443
+	}
1392 1444
 
1393 1445
 	$db->free_result($request);
1394 1446
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		array(
1141 1141
 			'min_posts' => -1,
1142 1142
 		),
1143
-		function ($row)
1143
+		function($row)
1144 1144
 		{
1145 1145
 			return $row['id_group'];
1146 1146
 		}
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		array(
1206 1206
 			'copy_from' => $copy_from,
1207 1207
 		),
1208
-		function ($row) use ($profile_id)
1208
+		function($row) use ($profile_id)
1209 1209
 		{
1210 1210
 			return array($profile_id, $row['id_group'], $row['permission'], $row['add_deny']);
1211 1211
 		}
Please login to merge, or discard this patch.
sources/subs/ScheduledTask/PaidSubscriptions.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,8 @@  discard block
 block discarded – undo
106 106
 
107 107
 		// Mark the reminder as sent.
108 108
 		if (!empty($subs_reminded))
109
-			$db->query('', '
109
+		{
110
+					$db->query('', '
110 111
 				UPDATE {db_prefix}log_subscribed
111 112
 				SET reminder_sent = {int:reminder_sent}
112 113
 				WHERE id_sublog IN ({array_int:subscription_list})',
@@ -115,6 +116,7 @@  discard block
 block discarded – undo
115 116
 					'reminder_sent' => 1,
116 117
 				)
117 118
 			);
119
+		}
118 120
 
119 121
 		return true;
120 122
 	}
Please login to merge, or discard this patch.
sources/subs/ScheduledTask/AutoOptimize.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
 		// As a kind of hack, if the server load is too great delay, but only by a bit!
42 42
 		if (!empty($modSettings['load_average']) && !empty($modSettings['loadavg_auto_opt']) && $modSettings['load_average'] >= $modSettings['loadavg_auto_opt'])
43
-			$delay = true;
43
+		{
44
+					$delay = true;
45
+		}
44 46
 
45 47
 		// Otherwise are we restricting the number of people online for this?
46 48
 		if (!empty($modSettings['autoOptMaxOnline']))
@@ -55,18 +57,24 @@  discard block
 block discarded – undo
55 57
 			$db->free_result($request);
56 58
 
57 59
 			if ($dont_do_it > $modSettings['autoOptMaxOnline'])
58
-				$delay = true;
60
+			{
61
+							$delay = true;
62
+			}
59 63
 		}
60 64
 
61 65
 		// If we are gonna delay, do so now!
62 66
 		if ($delay)
63
-			return false;
67
+		{
68
+					return false;
69
+		}
64 70
 
65 71
 		// Get all the tables.
66 72
 		$tables = $db->db_list_tables(false, $db_prefix . '%');
67 73
 
68 74
 		foreach ($tables as $table)
69
-			$db_table->optimize($table);
75
+		{
76
+					$db_table->optimize($table);
77
+		}
70 78
 
71 79
 		// Return for the log...
72 80
 		return true;
Please login to merge, or discard this patch.
sources/subs/ScheduledTask/RemoveTopicRedirect.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
 			)
56 56
 		);
57 57
 		while ($row = $db->fetch_row($request))
58
-			$topics[] = $row[0];
58
+		{
59
+					$topics[] = $row[0];
60
+		}
59 61
 		$db->free_result($request);
60 62
 
61 63
 		// Zap, you're gone
Please login to merge, or discard this patch.