Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/Sound.subs.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
 		$sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8);
66 66
 		switch ($word[$i] === 's' ? 0 : mt_rand(0, 2))
67 67
 		{
68
-			case 0:
69
-				for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
68
+			case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
70 69
 				for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
71 70
 					$sound_word .= $word[$i] === 's' ? $sound_letter[$j] : chr(mt_rand(max(ord($sound_letter[$j]) - 1, 0x00), min(ord($sound_letter[$j]) + 1, 0xFF)));
72 71
 			break;
Please login to merge, or discard this patch.
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 	// Allow max 2 requests per 20 seconds.
34 34
 	if (($ip = $cache->get('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = $cache->get('wave_file/' . $user_info['ip2'], 20)) > 2)
35
-		die(header('HTTP/1.1 400 Bad Request'));
35
+	{
36
+			die(header('HTTP/1.1 400 Bad Request'));
37
+	}
36 38
 
37 39
 	$cache->put('wave_file/' . $user_info['ip'], $ip ? $ip + 1 : 1, 20);
38 40
 	$cache->put('wave_file/' . $user_info['ip2'], $ip2 ? $ip2 + 1 : 1, 20);
@@ -42,13 +44,18 @@  discard block
 block discarded – undo
42 44
 
43 45
 	// Try to see if there's a sound font in the user's language.
44 46
 	if (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.' . $user_info['language'] . '.wav'))
45
-		$sound_language = $user_info['language'];
47
+	{
48
+			$sound_language = $user_info['language'];
49
+	}
46 50
 	// English should be there.
47 51
 	elseif (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.english.wav'))
48
-		$sound_language = 'english';
52
+	{
53
+			$sound_language = 'english';
54
+	}
49 55
 	// Guess not...
50
-	else
51
-		return false;
56
+	else {
57
+			return false;
58
+	}
52 59
 
53 60
 	// File names are in lower case so lets make sure that we are only using a lower case string
54 61
 	$word = strtolower($word);
@@ -60,20 +67,29 @@  discard block
 block discarded – undo
60 67
 	{
61 68
 		$sound_letter = implode('', file($settings['default_theme_dir'] . '/fonts/sound/' . $word[$i] . '.' . $sound_language . '.wav'));
62 69
 		if (strpos($sound_letter, 'data') === false)
63
-			return false;
70
+		{
71
+					return false;
72
+		}
64 73
 
65 74
 		$sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8);
66 75
 		switch ($word[$i] === 's' ? 0 : mt_rand(0, 2))
67 76
 		{
68 77
 			case 0:
69 78
 				for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
70
-				for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
71
-					$sound_word .= $word[$i] === 's' ? $sound_letter[$j] : chr(mt_rand(max(ord($sound_letter[$j]) - 1, 0x00), min(ord($sound_letter[$j]) + 1, 0xFF)));
79
+				{
80
+								for ($k = 0, $m = round(mt_rand(15, 25) / 10);
81
+				}
82
+				$k < $m; $k++)
83
+				{
84
+									$sound_word .= $word[$i] === 's' ? $sound_letter[$j] : chr(mt_rand(max(ord($sound_letter[$j]) - 1, 0x00), min(ord($sound_letter[$j]) + 1, 0xFF)));
85
+				}
72 86
 			break;
73 87
 
74 88
 			case 1:
75 89
 				for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2)
76
-					$sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter[$j]) . (mt_rand(0, 3) === 0 ? $sound_letter[$j + 1] : $sound_letter[$j]) . (mt_rand(0, 3) === 0 ? $sound_letter[$j] : $sound_letter[$j + 1]) . $sound_letter[$j + 1] . (mt_rand(0, 3) == 0 ? $sound_letter[$j + 1] : '');
90
+				{
91
+									$sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter[$j]) . (mt_rand(0, 3) === 0 ? $sound_letter[$j + 1] : $sound_letter[$j]) . (mt_rand(0, 3) === 0 ? $sound_letter[$j] : $sound_letter[$j + 1]) . $sound_letter[$j + 1] . (mt_rand(0, 3) == 0 ? $sound_letter[$j + 1] : '');
92
+				}
77 93
 				$sound_word .= str_repeat($sound_letter[$n], 2);
78 94
 			break;
79 95
 
@@ -82,9 +98,13 @@  discard block
 block discarded – undo
82 98
 				for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
83 99
 				{
84 100
 					if (mt_rand(0, 10) === 0)
85
-						$shift += mt_rand(-3, 3);
101
+					{
102
+											$shift += mt_rand(-3, 3);
103
+					}
86 104
 					for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
87
-						$sound_word .= chr(min(max(ord($sound_letter[$j]) + $shift, 0x00), 0xFF));
105
+					{
106
+											$sound_word .= chr(min(max(ord($sound_letter[$j]) + $shift, 0x00), 0xFF));
107
+					}
88 108
 				}
89 109
 			break;
90 110
 		}
@@ -112,7 +132,9 @@  discard block
 block discarded – undo
112 132
 
113 133
 	// Clear anything in the buffers
114 134
 	while (@ob_get_level() > 0)
115
-		@ob_end_clean();
135
+	{
136
+			@ob_end_clean();
137
+	}
116 138
 
117 139
 	// Set up our headers
118 140
 	header('Content-Encoding: none');
Please login to merge, or discard this patch.
sources/subs/BBC/BBCParser.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1205,7 +1205,7 @@
 block discarded – undo
1205 1205
 		// If we have footnotes, add them in at the end of the message
1206 1206
 		if (!empty($fn_num))
1207 1207
 		{
1208
-			$this->message .=  $this->smiley_marker . '<div class="bbc_footnotes">' . implode('', $this->fn_content) . '</div>' . $this->smiley_marker;
1208
+			$this->message .= $this->smiley_marker . '<div class="bbc_footnotes">' . implode('', $this->fn_content) . '</div>' . $this->smiley_marker;
1209 1209
 		}
1210 1210
 	}
1211 1211
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -750,7 +750,9 @@  discard block
 block discarded – undo
750 750
 	protected function handleItemCode()
751 751
 	{
752 752
 		if (!isset($this->item_codes[$this->message[$this->pos + 1]]))
753
-			return;
753
+		{
754
+					return;
755
+		}
754 756
 
755 757
 		$tag = $this->item_codes[$this->message[$this->pos + 1]];
756 758
 
@@ -1351,7 +1353,9 @@  discard block
 block discarded – undo
1351 1353
 			$control_order[$index] = $index;
1352 1354
 
1353 1355
 			if ($this->tag_possible['optionals'][$index])
1354
-				$control_order[$index] = $index + $this->tag_possible['regex_size'];
1356
+			{
1357
+							$control_order[$index] = $index + $this->tag_possible['regex_size'];
1358
+			}
1355 1359
 		}
1356 1360
 
1357 1361
 		array_multisort($control_order, SORT_ASC, $this->tag_possible['regex_cache']);
@@ -1382,9 +1386,12 @@  discard block
 block discarded – undo
1382 1386
 			if ($optional)
1383 1387
 			{
1384 1388
 				if ($param_exists)
1385
-					$this->tag_possible['optionals'][$index] = false;
1386
-				else
1387
-					$this->tag_possible['regex_cache'][$index] .= '?';
1389
+				{
1390
+									$this->tag_possible['optionals'][$index] = false;
1391
+				}
1392
+				else {
1393
+									$this->tag_possible['regex_cache'][$index] .= '?';
1394
+				}
1388 1395
 			}
1389 1396
 		}
1390 1397
 	}
Please login to merge, or discard this patch.
sources/subs/MessageIndex.subs.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 			$indexOptions['custom_selects'] = array_merge($indexOptions['custom_selects'], array('ml.body AS last_body', 'mf.body AS first_body'));
87 87
 		// Default: a SUBSTRING
88 88
 		elseif (!empty($indexOptions['previews']))
89
-			$indexOptions['custom_selects'] =  array_merge($indexOptions['custom_selects'], array('SUBSTRING(ml.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS last_body', 'SUBSTRING(mf.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS first_body'));
89
+			$indexOptions['custom_selects'] = array_merge($indexOptions['custom_selects'], array('SUBSTRING(ml.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS last_body', 'SUBSTRING(mf.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS first_body'));
90 90
 
91 91
 		if (!empty($indexOptions['include_avatars']))
92 92
 		{
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
 		);
74 74
 		$topic_ids = array();
75 75
 		while ($row = $db->fetch_assoc($request))
76
-			$topic_ids[] = $row['id_topic'];
76
+		{
77
+					$topic_ids[] = $row['id_topic'];
78
+		}
77 79
 		$db->free_result($request);
78 80
 	}
79 81
 
@@ -83,10 +85,14 @@  discard block
 block discarded – undo
83 85
 	{
84 86
 		// If -1 means preview the whole body
85 87
 		if ($indexOptions['previews'] === -1)
86
-			$indexOptions['custom_selects'] = array_merge($indexOptions['custom_selects'], array('ml.body AS last_body', 'mf.body AS first_body'));
88
+		{
89
+					$indexOptions['custom_selects'] = array_merge($indexOptions['custom_selects'], array('ml.body AS last_body', 'mf.body AS first_body'));
90
+		}
87 91
 		// Default: a SUBSTRING
88 92
 		elseif (!empty($indexOptions['previews']))
89
-			$indexOptions['custom_selects'] =  array_merge($indexOptions['custom_selects'], array('SUBSTRING(ml.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS last_body', 'SUBSTRING(mf.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS first_body'));
93
+		{
94
+					$indexOptions['custom_selects'] =  array_merge($indexOptions['custom_selects'], array('SUBSTRING(ml.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS last_body', 'SUBSTRING(mf.body, 1, ' . ($indexOptions['previews'] + 256) . ') AS first_body'));
95
+		}
90 96
 
91 97
 		if (!empty($indexOptions['include_avatars']))
92 98
 		{
@@ -141,7 +147,9 @@  discard block
 block discarded – undo
141 147
 
142 148
 		// Lets take the results
143 149
 		while ($row = $db->fetch_assoc($request))
144
-			$topics[$row['id_topic']] = $row;
150
+		{
151
+					$topics[$row['id_topic']] = $row;
152
+		}
145 153
 
146 154
 		$db->free_result($request);
147 155
 	}
@@ -196,7 +204,9 @@  discard block
 block discarded – undo
196 204
 		)
197 205
 	);
198 206
 	while ($row = $db->fetch_assoc($result))
199
-		$topics[] = $row;
207
+	{
208
+			$topics[] = $row;
209
+	}
200 210
 
201 211
 	$db->free_result($result);
202 212
 
@@ -235,7 +245,9 @@  discard block
 block discarded – undo
235 245
 
236 246
 	$icon_sources = array();
237 247
 	foreach ($stable_icons as $icon)
238
-		$icon_sources[$icon] = 'images_url';
248
+	{
249
+			$icon_sources[$icon] = 'images_url';
250
+	}
239 251
 
240 252
 	return $icon_sources;
241 253
 }
242 254
\ No newline at end of file
Please login to merge, or discard this patch.
themes/default/Theme.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1144,7 +1144,7 @@
 block discarded – undo
1144 1144
 			// Variant icon definitions?
1145 1145
 			if (file_exists($settings['theme_dir'] . '/css/' . $context['theme_variant'] . '/icons_svg' . $context['theme_variant'] . '.css'))
1146 1146
 			{
1147
-				loadCSSFile($context['theme_variant'] .  '/icons_svg' . $context['theme_variant'] . '.css');
1147
+				loadCSSFile($context['theme_variant'] . '/icons_svg' . $context['theme_variant'] . '.css');
1148 1148
 			}
1149 1149
 
1150 1150
 			// Load a theme variant custom CSS
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -316,7 +316,9 @@  discard block
 block discarded – undo
316 316
 		if (!empty($this->js_vars) && !$do_deferred)
317 317
 		{
318 318
 			foreach ($this->js_vars as $var => $value)
319
-				$js_vars[] = $var . ' = ' . $value;
319
+			{
320
+							$js_vars[] = $var . ' = ' . $value;
321
+			}
320 322
 
321 323
 			// Newlines and tabs are here to make it look nice in the page source view, stripped if minimized though
322 324
 			$this->js_inline['standard'][] = 'var ' . implode(",\n\t\t\t", $js_vars) . ';';
@@ -383,14 +385,18 @@  discard block
 block discarded – undo
383 385
 				}
384 386
 
385 387
 				foreach ($combiner->getSpares() as $id => $file)
386
-					echo '
388
+				{
389
+									echo '
387 390
 	<link rel="stylesheet" href="', $file['filename'], '" id="', $id, '" />';
391
+				}
388 392
 			}
389 393
 			else
390 394
 			{
391 395
 				foreach ($this->css_files as $id => $file)
392
-					echo '
396
+				{
397
+									echo '
393 398
 	<link rel="stylesheet" href="', $file['filename'], '" id="', $id, '" />';
399
+				}
394 400
 			}
395 401
 		}
396 402
 	}
@@ -766,7 +772,9 @@  discard block
 block discarded – undo
766 772
 		// Since it's nice to have avatars all of the same size, and in some cases the size detection may fail,
767 773
 		// let's add the css in any case
768 774
 		if (!isset($context['html_headers']))
769
-			$context['html_headers'] = '';
775
+		{
776
+					$context['html_headers'] = '';
777
+		}
770 778
 
771 779
 		if (!empty($modSettings['avatar_max_width']) || !empty($modSettings['avatar_max_height']))
772 780
 		{
@@ -1097,7 +1105,9 @@  discard block
 block discarded – undo
1097 1105
 
1098 1106
 			// Load each template...
1099 1107
 			foreach ($templates as $template)
1100
-				$this->templates->load($template);
1108
+			{
1109
+							$this->templates->load($template);
1110
+			}
1101 1111
 
1102 1112
 			// ...and attempt to load their associated language files.
1103 1113
 			$required_files = implode('+', array_merge($templates, array('Addons')));
Please login to merge, or discard this patch.
sources/subs/Who.subs.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@
 block discarded – undo
503 503
 			'<a href="http://jqueryui.com/">JQuery UI</a> | &copy; jQuery Foundation and other contributors | Licensed under <a href="http://opensource.org/licenses/MIT">The MIT License (MIT)</a>',
504 504
 			'<a href="https://github.com/tchwork/jsqueeze">Jsqueeze</a> &copy Nicolas Grekas| Licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>',
505 505
 			'<a href="https://github.com/mailcheck">MailCheck</a> | &copy; Received Inc | Licensed under <a href="http://opensource.org/licenses/MIT">The MIT License (MIT)</a>',
506
-			'<a href="https://github.com/michelf/php-markdown">PHP Markdown Lib</a> | &copy; Michel Fortin | Licensed under <a href="https://github.com/michelf/php-markdown/blob/lib/License.md">BSD-style open source</a>',			'<a href="http://www.openwall.com/phpass/">PH Pass</a> | Author: Solar Designer | Placed in the public domain</a>',
506
+			'<a href="https://github.com/michelf/php-markdown">PHP Markdown Lib</a> | &copy; Michel Fortin | Licensed under <a href="https://github.com/michelf/php-markdown/blob/lib/License.md">BSD-style open source</a>', '<a href="http://www.openwall.com/phpass/">PH Pass</a> | Author: Solar Designer | Placed in the public domain</a>',
507 507
 			'<a href="http://www.sceditor.com/">SCEditor</a> | &copy; Sam Clarke | Licensed under <a href="http://opensource.org/licenses/MIT">The MIT License (MIT)</a>',
508 508
 			'<a href="http://sourceforge.net/projects/simplehtmldom/">Simple HTML DOM</a> | Licensed under <a href="http://opensource.org/licenses/MIT">The MIT License (MIT)</a>',
509 509
 			'<a href="http://www.simplemachines.org/">Simple Machines</a> | &copy; Simple Machines | Licensed under <a href="http://www.simplemachines.org/about/smf/license.php">The BSD License</a>',
Please login to merge, or discard this patch.
Braces   +103 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 	// Make sure we have a default value
27 27
 	if (!in_array($type, array('topic', 'board')))
28
-		$type = 'topic';
28
+	{
29
+			$type = 'topic';
30
+	}
29 31
 
30 32
 	$viewers = array();
31 33
 	$request = $db->query('', '
@@ -80,17 +82,24 @@  discard block
 block discarded – undo
80 82
 
81 83
 		// it's a member. We format them with links 'n stuff.
82 84
 		if (!empty($viewer['online_color']))
83
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $viewer['id_member'] . '" style="color: ' . $viewer['online_color'] . ';">' . $viewer['real_name'] . '</a>';
84
-		else
85
-			$link = '<a href="' . $scripturl . '?action=profile;u=' . $viewer['id_member'] . '">' . $viewer['real_name'] . '</a>';
85
+		{
86
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $viewer['id_member'] . '" style="color: ' . $viewer['online_color'] . ';">' . $viewer['real_name'] . '</a>';
87
+		}
88
+		else {
89
+					$link = '<a href="' . $scripturl . '?action=profile;u=' . $viewer['id_member'] . '">' . $viewer['real_name'] . '</a>';
90
+		}
86 91
 
87 92
 		$is_buddy = in_array($viewer['id_member'], $user_info['buddies']);
88 93
 		if ($is_buddy)
89
-			$link = '<strong>' . $link . '</strong>';
94
+		{
95
+					$link = '<strong>' . $link . '</strong>';
96
+		}
90 97
 
91 98
 		// fill the summary list
92 99
 		if (!empty($viewer['show_online']) || allowedTo('moderate_forum'))
93
-			$context['view_members_list'][$viewer['log_time'] . $viewer['member_name']] = empty($viewer['show_online']) ? '<em>' . $link . '</em>' : $link;
100
+		{
101
+					$context['view_members_list'][$viewer['log_time'] . $viewer['member_name']] = empty($viewer['show_online']) ? '<em>' . $link . '</em>' : $link;
102
+		}
94 103
 
95 104
 		// fill the detailed list
96 105
 		$context['view_members'][$viewer['log_time'] . $viewer['member_name']] = array(
@@ -106,7 +115,9 @@  discard block
 block discarded – undo
106 115
 
107 116
 		// add the hidden members to the count (and don't show them in the template)
108 117
 		if (empty($viewer['show_online']))
109
-			$context['view_num_hidden']++;
118
+		{
119
+					$context['view_num_hidden']++;
120
+		}
110 121
 	}
111 122
 
112 123
 	// Sort them out.
@@ -193,7 +204,9 @@  discard block
 block discarded – undo
193 204
 	$db = database();
194 205
 
195 206
 	if (!allowedTo('who_view'))
196
-		return array();
207
+	{
208
+			return array();
209
+	}
197 210
 
198 211
 	loadLanguage('Who');
199 212
 
@@ -224,9 +237,12 @@  discard block
 block discarded – undo
224 237
 	call_integration_hook('integrate_whos_online_allowed', array(&$allowedActions));
225 238
 
226 239
 	if (!is_array($urls))
227
-		$url_list = array(array($urls, $user_info['id']));
228
-	else
229
-		$url_list = $urls;
240
+	{
241
+			$url_list = array(array($urls, $user_info['id']));
242
+	}
243
+	else {
244
+			$url_list = $urls;
245
+	}
230 246
 
231 247
 	// These are done to query these in large chunks. (instead of one by one.)
232 248
 	$topic_ids = array();
@@ -239,11 +255,15 @@  discard block
 block discarded – undo
239 255
 		// Get the request parameters..
240 256
 		$actions = Util::unserialize($url[0]);
241 257
 		if ($actions === false)
242
-			continue;
258
+		{
259
+					continue;
260
+		}
243 261
 
244 262
 		// If it's the admin or moderation center, and there is an area set, use that instead.
245 263
 		if (isset($actions['action']) && ($actions['action'] == 'admin' || $actions['action'] == 'moderate') && isset($actions['area']))
246
-			$actions['action'] = $actions['area'];
264
+		{
265
+					$actions['action'] = $actions['area'];
266
+		}
247 267
 
248 268
 		// Check if there was no action or the action is display.
249 269
 		if (!isset($actions['action']) || $actions['action'] == 'display')
@@ -263,12 +283,15 @@  discard block
 block discarded – undo
263 283
 				$board_ids[$actions['board']][$k] = $txt['who_board'];
264 284
 			}
265 285
 			// It's the board index!!  It must be!
266
-			else
267
-				$data[$k] = replaceBasicActionUrl($txt['who_index']);
286
+			else {
287
+							$data[$k] = replaceBasicActionUrl($txt['who_index']);
288
+			}
268 289
 		}
269 290
 		// Probably an error or some goon?
270 291
 		elseif ($actions['action'] == '')
271
-			$data[$k] = replaceBasicActionUrl($txt['who_index']);
292
+		{
293
+					$data[$k] = replaceBasicActionUrl($txt['who_index']);
294
+		}
272 295
 		// Some other normal action...?
273 296
 		else
274 297
 		{
@@ -282,9 +305,12 @@  discard block
 block discarded – undo
282 305
 					$memID = currentMemberID();
283 306
 
284 307
 					if ($memID == $user_info['id'])
285
-						$actions['u'] = $url[1];
286
-					else
287
-						$actions['u'] = $memID;
308
+					{
309
+											$actions['u'] = $url[1];
310
+					}
311
+					else {
312
+											$actions['u'] = $memID;
313
+					}
288 314
 				}
289 315
 
290 316
 				$data[$k] = $txt['who_hidden'];
@@ -295,16 +321,23 @@  discard block
 block discarded – undo
295 321
 			{
296 322
 				$data[$k] = $txt['who_hidden'];
297 323
 				if ($actions['action'] == 'topicbyemail')
298
-					$board_ids[(int) $actions['board']][$k] = $txt['who_topicbyemail'];
299
-				else
300
-					$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
324
+				{
325
+									$board_ids[(int) $actions['board']][$k] = $txt['who_topicbyemail'];
326
+				}
327
+				else {
328
+									$board_ids[(int) $actions['board']][$k] = isset($actions['poll']) ? $txt['who_poll'] : $txt['who_post'];
329
+				}
301 330
 			}
302 331
 			// A subaction anyone can view... if the language string is there, show it.
303 332
 			elseif (isset($actions['sa']) && isset($txt['whoall_' . $actions['action'] . '_' . $actions['sa']]))
304
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
333
+			{
334
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']]) ? $txt[$preferred_prefix . $actions['action'] . '_' . $actions['sa']] : $txt['whoall_' . $actions['action'] . '_' . $actions['sa']];
335
+			}
305 336
 			// An action any old fellow can look at. (if $txt['whoall_' . $action] exists, we know everyone can see it.)
306 337
 			elseif (isset($txt['whoall_' . $actions['action']]))
307
-				$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : replaceBasicActionUrl($txt['whoall_' . $actions['action']]);
338
+			{
339
+							$data[$k] = $preferred_prefix && isset($txt[$preferred_prefix . $actions['action']]) ? $txt[$preferred_prefix . $actions['action']] : replaceBasicActionUrl($txt['whoall_' . $actions['action']]);
340
+			}
308 341
 			// Viewable if and only if they can see the board...
309 342
 			elseif (isset($txt['whotopic_' . $actions['action']]))
310 343
 			{
@@ -347,34 +380,49 @@  discard block
 block discarded – undo
347 380
 				$db->free_result($result);
348 381
 
349 382
 				if (empty($id_topic))
350
-					$data[$k] = $txt['who_hidden'];
383
+				{
384
+									$data[$k] = $txt['who_hidden'];
385
+				}
351 386
 			}
352 387
 			// Viewable only by administrators.. (if it starts with whoadmin, it's admin only!)
353 388
 			elseif (allowedTo('moderate_forum') && isset($txt['whoadmin_' . $actions['action']]))
354
-				$data[$k] = $txt['whoadmin_' . $actions['action']];
389
+			{
390
+							$data[$k] = $txt['whoadmin_' . $actions['action']];
391
+			}
355 392
 			// Viewable by permission level.
356 393
 			elseif (isset($allowedActions[$actions['action']]))
357 394
 			{
358 395
 				if (allowedTo($allowedActions[$actions['action']]))
359 396
 				{
360 397
 					if (isset($actions['sa']) && isset($txt['whoallow_' . $actions['action'] . '_' . $actions['sa']]))
361
-						$data[$k] = replaceBasicActionUrl($txt['whoallow_' . $actions['action'] . '_' . $actions['sa']]);
362
-					else
363
-						$data[$k] = replaceBasicActionUrl($txt['whoallow_' . $actions['action']]);
398
+					{
399
+											$data[$k] = replaceBasicActionUrl($txt['whoallow_' . $actions['action'] . '_' . $actions['sa']]);
400
+					}
401
+					else {
402
+											$data[$k] = replaceBasicActionUrl($txt['whoallow_' . $actions['action']]);
403
+					}
364 404
 				}
365 405
 				elseif (in_array('moderate_forum', $allowedActions[$actions['action']]))
366
-					$data[$k] = $txt['who_moderate'];
406
+				{
407
+									$data[$k] = $txt['who_moderate'];
408
+				}
367 409
 				elseif (in_array('admin_forum', $allowedActions[$actions['action']]))
368
-					$data[$k] = $txt['who_admin'];
369
-				else
370
-					$data[$k] = $txt['who_hidden'];
410
+				{
411
+									$data[$k] = $txt['who_admin'];
412
+				}
413
+				else {
414
+									$data[$k] = $txt['who_hidden'];
415
+				}
371 416
 			}
372 417
 			// Something we don't have details about, but it is an action, maybe an addon
373 418
 			elseif (!empty($actions['action']))
374
-				$data[$k] = sprintf($txt['who_generic'], $actions['action']);
419
+			{
420
+							$data[$k] = sprintf($txt['who_generic'], $actions['action']);
421
+			}
375 422
 			// We just don't know
376
-			else
377
-				$data[$k] = $txt['who_unknown'];
423
+			else {
424
+							$data[$k] = $txt['who_unknown'];
425
+			}
378 426
 		}
379 427
 
380 428
 		// Maybe the action is integrated into another system?
@@ -403,7 +451,9 @@  discard block
 block discarded – undo
403 451
 		{
404 452
 			// Show the topic's subject for each of the members looking at this...
405 453
 			foreach ($topic_ids[$topic['id_topic']] as $k => $session_text)
406
-				$data[$k] = sprintf($session_text, $scripturl . '?topic=' . $topic['id_topic'] . '.0', $topic['subject']);
454
+			{
455
+							$data[$k] = sprintf($session_text, $scripturl . '?topic=' . $topic['id_topic'] . '.0', $topic['subject']);
456
+			}
407 457
 		}
408 458
 	}
409 459
 
@@ -417,7 +467,9 @@  discard block
 block discarded – undo
417 467
 		{
418 468
 			// Put the board name into the string for each member...
419 469
 			foreach ($board_ids[$board['id_board']] as $k => $session_text)
420
-				$data[$k] = sprintf($session_text, $scripturl . '?board=' . $board['id_board'] . '.0', $board['board_name']);
470
+			{
471
+							$data[$k] = sprintf($session_text, $scripturl . '?board=' . $board['id_board'] . '.0', $board['board_name']);
472
+			}
421 473
 		}
422 474
 	}
423 475
 
@@ -430,19 +482,26 @@  discard block
 block discarded – undo
430 482
 		{
431 483
 			// If they aren't allowed to view this person's profile, skip it.
432 484
 			if (!allowedTo('profile_view_any') && $user_info['id'] != $row['id_member'])
433
-				continue;
485
+			{
486
+							continue;
487
+			}
434 488
 
435 489
 			// Set their action on each - session/text to sprintf.
436 490
 			foreach ($profile_ids[$row['id_member']] as $k => $session_text)
437
-				$data[$k] = sprintf($session_text, $scripturl . '?action=profile;u=' . $row['id_member'], $row['real_name']);
491
+			{
492
+							$data[$k] = sprintf($session_text, $scripturl . '?action=profile;u=' . $row['id_member'], $row['real_name']);
493
+			}
438 494
 		}
439 495
 	}
440 496
 
441 497
 	if (!is_array($urls))
442
-		return isset($data[0]) ? $data[0] : false;
443
-	else
444
-		return $data;
445
-}
498
+	{
499
+			return isset($data[0]) ? $data[0] : false;
500
+	}
501
+	else {
502
+			return $data;
503
+	}
504
+	}
446 505
 
447 506
 /**
448 507
  * Prepare credits for display.
Please login to merge, or discard this patch.
sources/subs/BoardsList.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@
 block discarded – undo
369 369
 			if ($row_board['subject'] != '')
370 370
 			{
371 371
 				$this_last_post['href'] = $this->_scripturl . '?topic=' . $row_board['id_topic'] . '.msg' . ($this->_user['is_guest'] ? $row_board['id_msg'] : $row_board['new_from']) . (empty($row_board['is_read']) ? ';boardseen' : '') . '#new';
372
-				$this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . Util::htmlspecialchars($row_board['subject']). '">' . $row_board['short_subject'] . '</a>';
372
+				$this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . Util::htmlspecialchars($row_board['subject']) . '">' . $row_board['short_subject'] . '</a>';
373 373
 				/* The board's and children's 'last_post's have:
374 374
 				time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
375 375
 				link, href, subject, start (where they should go for the first unread post.),
Please login to merge, or discard this patch.
Braces   +51 added lines, -20 removed lines patch added patch discarded remove patch
@@ -136,16 +136,23 @@  discard block
 block discarded – undo
136 136
 
137 137
 		// Start with an empty array.
138 138
 		if ($this->_options['include_categories'])
139
-			$this->_categories = array();
140
-		else
141
-			$this->_current_boards = array();
139
+		{
140
+					$this->_categories = array();
141
+		}
142
+		else {
143
+					$this->_current_boards = array();
144
+		}
142 145
 
143 146
 		// For performance, track the latest post while going through the boards.
144 147
 		if (!empty($this->_options['set_latest_post']))
145
-			$this->_latest_post = array('timestamp' => 0);
148
+		{
149
+					$this->_latest_post = array('timestamp' => 0);
150
+		}
146 151
 
147 152
 		if (!empty($modSettings['recycle_enable']))
148
-			$this->_recycle_board = $modSettings['recycle_board'];
153
+		{
154
+					$this->_recycle_board = $modSettings['recycle_board'];
155
+		}
149 156
 	}
150 157
 
151 158
 	/**
@@ -230,14 +237,18 @@  discard block
 block discarded – undo
230 237
 
231 238
 				// If this board has new posts in it (and isn't the recycle bin!) then the category is new.
232 239
 				if ($this->_recycle_board != $row_board['id_board'])
233
-					$this->_categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
240
+				{
241
+									$this->_categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
242
+				}
234 243
 
235 244
 				// Avoid showing category unread link where it only has redirection boards.
236 245
 				$this->_categories[$row_board['id_cat']]['show_unread'] = !empty($this->_categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect'];
237 246
 
238 247
 				// Collapsed category - don't do any of this.
239 248
 				if ($this->_categories[$row_board['id_cat']]['is_collapsed'])
240
-					continue;
249
+				{
250
+									continue;
251
+				}
241 252
 
242 253
 				// Let's save some typing.  Climbing the array might be slower, anyhow.
243 254
 				$this->_current_boards = &$this->_categories[$row_board['id_cat']]['boards'];
@@ -313,13 +324,17 @@  discard block
 block discarded – undo
313 324
 			{
314 325
 				// @todo why this is not initialized outside the loop?
315 326
 				if (!isset($parent_map))
316
-					$parent_map = array();
327
+				{
328
+									$parent_map = array();
329
+				}
317 330
 
318 331
 				if (!isset($parent_map[$row_board['id_parent']]))
319
-					foreach ($this->_current_boards as $id => $board)
332
+				{
333
+									foreach ($this->_current_boards as $id => $board)
320 334
 					{
321 335
 						if (!isset($board['children'][$row_board['id_parent']]))
322 336
 							continue;
337
+				}
323 338
 
324 339
 						$parent_map[$row_board['id_parent']] = array(&$this->_current_boards[$id], &$this->_current_boards[$id]['children'][$row_board['id_parent']]);
325 340
 						$parent_map[$row_board['id_board']] = array(&$this->_current_boards[$id], &$this->_current_boards[$id]['children'][$row_board['id_parent']]);
@@ -340,8 +355,9 @@  discard block
 block discarded – undo
340 355
 				continue;
341 356
 			}
342 357
 			// Found a child of a child - skip.
343
-			else
344
-				continue;
358
+			else {
359
+							continue;
360
+			}
345 361
 
346 362
 			// Prepare the subject, and make sure it's not too long.
347 363
 			$row_board['subject'] = censor($row_board['subject']);
@@ -364,7 +380,9 @@  discard block
 block discarded – undo
364 380
 			);
365 381
 
366 382
 			if ($this->_options['avatars_on_indexes'])
367
-				$this_last_post['member']['avatar'] = determineAvatar($row_board);
383
+			{
384
+							$this_last_post['member']['avatar'] = determineAvatar($row_board);
385
+			}
368 386
 
369 387
 			// Provide the href and link.
370 388
 			if ($row_board['subject'] != '')
@@ -386,7 +404,9 @@  discard block
 block discarded – undo
386 404
 
387 405
 			// Set the last post in the parent board.
388 406
 			if ($row_board['id_parent'] == $this->_options['parent_id'] || ($isChild && !empty($row_board['poster_time']) && $this->_current_boards[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])))
389
-				$this->_current_boards[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
407
+			{
408
+							$this->_current_boards[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
409
+			}
390 410
 			// Just in the child...?
391 411
 			if ($isChild)
392 412
 			{
@@ -397,16 +417,22 @@  discard block
 block discarded – undo
397 417
 			}
398 418
 			// No last post for this board?  It's not new then, is it..?
399 419
 			elseif ($row_board['poster_name'] == '')
400
-				$this->_current_boards[$row_board['id_board']]['new'] = false;
420
+			{
421
+							$this->_current_boards[$row_board['id_board']]['new'] = false;
422
+			}
401 423
 
402 424
 			// Determine a global most recent topic.
403 425
 			if ($this->_options['set_latest_post'] && !empty($row_board['poster_time']) && $row_board['poster_time'] > $this->_latest_post['timestamp'] && !$ignoreThisBoard)
404
-				$this->_latest_post = &$this->_current_boards[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'];
426
+			{
427
+							$this->_latest_post = &$this->_current_boards[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'];
428
+			}
405 429
 		}
406 430
 		$this->_db->free_result($result_boards);
407 431
 
408 432
 		if ($this->_options['get_moderators'] && !empty($this->_boards))
409
-			$this->_getBoardModerators();
433
+		{
434
+					$this->_getBoardModerators();
435
+		}
410 436
 
411 437
 		return $this->_options['include_categories'] ? $this->_categories : $this->_current_boards;
412 438
 	}
@@ -419,9 +445,12 @@  discard block
 block discarded – undo
419 445
 	public function getLatestPost()
420 446
 	{
421 447
 		if (empty($this->_latest_post) || empty($this->_latest_post['link']))
422
-			return array();
423
-		else
424
-			return $this->_latest_post;
448
+		{
449
+					return array();
450
+		}
451
+		else {
452
+					return $this->_latest_post;
453
+		}
425 454
 	}
426 455
 
427 456
 	/**
@@ -451,7 +480,9 @@  discard block
 block discarded – undo
451 480
 		foreach ($mod_cached as $row_mods)
452 481
 		{
453 482
 			if ($this->_options['include_categories'])
454
-				$this->_current_boards = &$this->_categories[$this->_boards[$row_mods['id_board']]]['boards'];
483
+			{
484
+							$this->_current_boards = &$this->_categories[$this->_boards[$row_mods['id_board']]]['boards'];
485
+			}
455 486
 
456 487
 			$this->_current_boards[$row_mods['id_board']]['moderators'][$row_mods['id_moderator']] = array(
457 488
 				'id' => $row_mods['id_moderator'],
Please login to merge, or discard this patch.
sources/subs/Unread.class.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	private function _getUnreadReplies($start, $limit, $include_avatars = false)
360 360
 	{
361
-        $request = $this->_db->query('unread_replies', '
361
+		$request = $this->_db->query('unread_replies', '
362 362
 				SELECT DISTINCT t.id_topic
363 363
 				FROM {db_prefix}topics AS t
364 364
 					INNER JOIN {db_prefix}messages AS m ON (m.id_topic = t.id_topic AND m.id_member = {int:current_member})' . (strpos($this->_sort_query, 'ms.') === false ? '' : '
@@ -369,19 +369,19 @@  discard block
 block discarded – undo
369 369
 				WHERE t.id_board IN ({array_int:boards})
370 370
 					AND t.id_last_msg >= {int:min_message}
371 371
 					AND COALESCE(lt.id_msg, lmr.id_msg, 0) < t.id_last_msg' .
372
-            ($this->_post_mod ? ' AND t.approved = {int:is_approved}' : '') .
373
-            ($this->_unwatch ? ' AND COALESCE(lt.unwatched, 0) != 1' : '') . '
372
+			($this->_post_mod ? ' AND t.approved = {int:is_approved}' : '') .
373
+			($this->_unwatch ? ' AND COALESCE(lt.unwatched, 0) != 1' : '') . '
374 374
 				ORDER BY {raw:order}
375 375
 				LIMIT {int:offset}, {int:limit}',
376
-            array_merge($this->_query_parameters, array(
377
-                'current_member' => $this->_user_id,
378
-                'min_message' => $this->_min_message,
379
-                'is_approved' => 1,
380
-                'order' => $this->_sort_query . ($this->_ascending ? '' : ' DESC'),
381
-                'offset' => $start,
382
-                'limit' => $limit,
383
-            ))
384
-        );
376
+			array_merge($this->_query_parameters, array(
377
+				'current_member' => $this->_user_id,
378
+				'min_message' => $this->_min_message,
379
+				'is_approved' => 1,
380
+				'order' => $this->_sort_query . ($this->_ascending ? '' : ' DESC'),
381
+				'offset' => $start,
382
+				'limit' => $limit,
383
+			))
384
+		);
385 385
 
386 386
 		$topics = array();
387 387
 		while ($row = $this->_db->fetch_assoc($request))
Please login to merge, or discard this patch.
Braces   +57 added lines, -25 removed lines patch added patch discarded remove patch
@@ -80,9 +80,12 @@  discard block
 block discarded – undo
80 80
 	public function setBoards($boards)
81 81
 	{
82 82
 		if (is_array($boards))
83
-			$this->_query_parameters['boards'] = $boards;
84
-		else
85
-			$this->_query_parameters['boards'] = array($boards);
83
+		{
84
+					$this->_query_parameters['boards'] = $boards;
85
+		}
86
+		else {
87
+					$this->_query_parameters['boards'] = array($boards);
88
+		}
86 89
 	}
87 90
 
88 91
 	/**
@@ -93,7 +96,9 @@  discard block
 block discarded – undo
93 96
 	public function setAction($action)
94 97
 	{
95 98
 		if (in_array($action, array(self::UNREAD, self::UNREADREPLIES)))
96
-			$this->_action = $action;
99
+		{
100
+					$this->_action = $action;
101
+		}
97 102
 	}
98 103
 
99 104
 	/**
@@ -139,9 +144,12 @@  discard block
 block discarded – undo
139 144
 	public function bodyPreview($chars)
140 145
 	{
141 146
 		if ($chars === true)
142
-			$this->_preview_bodies = 'all';
143
-		else
144
-			$this->_preview_bodies = (int) $chars;
147
+		{
148
+					$this->_preview_bodies = 'all';
149
+		}
150
+		else {
151
+					$this->_preview_bodies = (int) $chars;
152
+		}
145 153
 	}
146 154
 
147 155
 	/**
@@ -153,9 +161,12 @@  discard block
 block discarded – undo
153 161
 	public function numUnreads($first_login = false, $id_msg_last_visit = 0)
154 162
 	{
155 163
 		if ($this->_action === self::UNREAD)
156
-			$this->_countRecentTopics($first_login, $id_msg_last_visit);
157
-		else
158
-			$this->_countUnreadReplies();
164
+		{
165
+					$this->_countRecentTopics($first_login, $id_msg_last_visit);
166
+		}
167
+		else {
168
+					$this->_countUnreadReplies();
169
+		}
159 170
 
160 171
 		return $this->_num_topics;
161 172
 	}
@@ -174,9 +185,12 @@  discard block
 block discarded – undo
174 185
 	public function getUnreads($join, $start, $limit, $include_avatars)
175 186
 	{
176 187
 		if ($this->_action === self::UNREAD)
177
-			return $this->_getUnreadTopics($join, $start, $limit, $include_avatars);
178
-		else
179
-			return $this->_getUnreadReplies($start, $limit, $include_avatars);
188
+		{
189
+					return $this->_getUnreadTopics($join, $start, $limit, $include_avatars);
190
+		}
191
+		else {
192
+					return $this->_getUnreadReplies($start, $limit, $include_avatars);
193
+		}
180 194
 	}
181 195
 
182 196
 	/**
@@ -194,15 +208,20 @@  discard block
 block discarded – undo
194 208
 	private function _getUnreadTopics($join, $start, $limit, $include_avatars = false)
195 209
 	{
196 210
 		if ($this->_preview_bodies == 'all')
197
-			$body_query = 'ml.body AS last_body, ms.body AS first_body,';
211
+		{
212
+					$body_query = 'ml.body AS last_body, ms.body AS first_body,';
213
+		}
198 214
 		else
199 215
 		{
200 216
 			// If empty, no preview at all
201 217
 			if (empty($this->_preview_bodies))
202
-				$body_query = '';
218
+			{
219
+							$body_query = '';
220
+			}
203 221
 			// Default: a SUBSTRING
204
-			else
205
-				$body_query = 'SUBSTRING(ml.body, 1, ' . ($this->_preview_bodies + 256) . ') AS last_body, SUBSTRING(ms.body, 1, ' . ($this->_preview_bodies + 256) . ') AS first_body,';
222
+			else {
223
+							$body_query = 'SUBSTRING(ml.body, 1, ' . ($this->_preview_bodies + 256) . ') AS last_body, SUBSTRING(ms.body, 1, ' . ($this->_preview_bodies + 256) . ') AS first_body,';
224
+			}
206 225
 		}
207 226
 
208 227
 		if (!empty($include_avatars))
@@ -265,7 +284,9 @@  discard block
 block discarded – undo
265 284
 		);
266 285
 		$topics = array();
267 286
 		while ($row = $this->_db->fetch_assoc($request))
268
-			$topics[] = $row;
287
+		{
288
+					$topics[] = $row;
289
+		}
269 290
 		$this->_db->free_result($request);
270 291
 
271 292
 		return Topic_Util::prepareContext($topics, true, ((int) $this->_preview_bodies) + 128);
@@ -365,23 +386,32 @@  discard block
 block discarded – undo
365 386
 
366 387
 		$topics = array();
367 388
 		while ($row = $this->_db->fetch_assoc($request))
368
-			$topics[] = $row['id_topic'];
389
+		{
390
+					$topics[] = $row['id_topic'];
391
+		}
369 392
 		$this->_db->free_result($request);
370 393
 
371 394
 		// Sanity... where have you gone?
372 395
 		if (empty($topics))
373
-			return false;
396
+		{
397
+					return false;
398
+		}
374 399
 
375 400
 		if ($this->_preview_bodies == 'all')
376
-			$body_query = 'ml.body AS last_body, ms.body AS first_body,';
401
+		{
402
+					$body_query = 'ml.body AS last_body, ms.body AS first_body,';
403
+		}
377 404
 		else
378 405
 		{
379 406
 			// If empty, no preview at all
380 407
 			if (empty($this->_preview_bodies))
381
-				$body_query = '';
408
+			{
409
+							$body_query = '';
410
+			}
382 411
 			// Default: a SUBSTRING
383
-			else
384
-				$body_query = 'SUBSTRING(ml.body, 1, ' . ($this->_preview_bodies + 256) . ') AS last_body, SUBSTRING(ms.body, 1, ' . ($this->_preview_bodies + 256) . ') AS first_body,';
412
+			else {
413
+							$body_query = 'SUBSTRING(ml.body, 1, ' . ($this->_preview_bodies + 256) . ') AS last_body, SUBSTRING(ms.body, 1, ' . ($this->_preview_bodies + 256) . ') AS first_body,';
414
+			}
385 415
 		}
386 416
 
387 417
 		if (!empty($include_avatars))
@@ -437,7 +467,9 @@  discard block
 block discarded – undo
437 467
 		);
438 468
 		$return = array();
439 469
 		while ($row = $this->_db->fetch_assoc($request))
440
-			$return[] = $row;
470
+		{
471
+					$return[] = $row;
472
+		}
441 473
 		$this->_db->free_result($request);
442 474
 
443 475
 		return Topic_Util::prepareContext($return, true, ((int) $this->_preview_bodies) + 128);
Please login to merge, or discard this patch.
sources/subs/Topic.subs.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 	$db = database();
1592 1592
 
1593 1593
 	// Get the messages and stick them into an array.
1594
-    $request = $db->query('', '
1594
+	$request = $db->query('', '
1595 1595
 		SELECT 
1596 1596
 			m.subject, COALESCE(mem.real_name, m.poster_name) AS real_name, m.poster_time, m.body, 
1597 1597
 			m.id_msg, m.smileys_enabled, m.id_member 
@@ -1610,17 +1610,17 @@  discard block
 block discarded – undo
1610 1610
 		JOIN {db_prefix}messages as m ON o.id_msg=m.id_msg 
1611 1611
 		LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
1612 1612
 		ORDER BY m.id_msg DESC',
1613
-        array(
1614
-            'current_topic' => $topic,
1615
-            'no_split_msgs' => !empty($messages['excluded']) ? $messages['excluded'] : array(),
1616
-            'split_msgs' => !empty($messages['included']) ? $messages['included'] : array(),
1617
-            'is_approved' => 1,
1618
-            'start' => $start,
1619
-            'messages_per_page' => $items_per_page,
1620
-            'msg_before' => !empty($messages['before']) ? (int) $messages['before'] : 0,
1621
-            'msg_after' => !empty($messages['after']) ? (int) $messages['after'] : 0,
1622
-        )
1623
-    );
1613
+		array(
1614
+			'current_topic' => $topic,
1615
+			'no_split_msgs' => !empty($messages['excluded']) ? $messages['excluded'] : array(),
1616
+			'split_msgs' => !empty($messages['included']) ? $messages['included'] : array(),
1617
+			'is_approved' => 1,
1618
+			'start' => $start,
1619
+			'messages_per_page' => $items_per_page,
1620
+			'msg_before' => !empty($messages['before']) ? (int) $messages['before'] : 0,
1621
+			'msg_after' => !empty($messages['after']) ? (int) $messages['after'] : 0,
1622
+		)
1623
+	);
1624 1624
 
1625 1625
 	$messages = array();
1626 1626
 	$parser = \BBC\ParserWrapper::instance();
@@ -2176,9 +2176,9 @@  discard block
 block discarded – undo
2176 2176
 	);
2177 2177
 
2178 2178
 	// When evaluating potentially huge offsets, grab the ids only, first.
2179
-    // The performance impact is still significant going from three columns to one.
2179
+	// The performance impact is still significant going from three columns to one.
2180 2180
 	$postMod = $modSettings['postmod_active'] && allowedTo('approve_posts');
2181
-    $request = $db->query('display_get_post_poster', '
2181
+	$request = $db->query('display_get_post_poster', '
2182 2182
 		SELECT 
2183 2183
 			m.id_msg, m.id_member
2184 2184
 		FROM (
@@ -2191,13 +2191,13 @@  discard block
 block discarded – undo
2191 2191
 			LIMIT ' . $limit['start'] . ', ' . $limit['offset']) . ') AS o 
2192 2192
 		JOIN {db_prefix}messages as m ON o.id_msg=m.id_msg
2193 2193
 		ORDER BY m.id_msg ' . ($sort ? '' : 'DESC'),
2194
-        array(
2195
-            'current_member' => $user_info['id'],
2196
-            'current_topic' => $topic,
2197
-            'is_approved' => 1,
2198
-            'blank_id_member' => 0,
2199
-        )
2200
-    );
2194
+		array(
2195
+			'current_member' => $user_info['id'],
2196
+			'current_topic' => $topic,
2197
+			'is_approved' => 1,
2198
+			'blank_id_member' => 0,
2199
+		)
2200
+	);
2201 2201
 	while ($row = $db->fetch_assoc($request))
2202 2202
 	{
2203 2203
 		if (!empty($row['id_member']))
Please login to merge, or discard this patch.
Braces   +271 added lines, -96 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		// Skip if we have to test the owner *and* the user is not the owner
40 40
 		if ($test_owner && $row['id_member_started'] != $user_info['id'])
41
-			continue;
41
+		{
42
+					continue;
43
+		}
42 44
 
43 45
 		$removeCache[] = $row['id_topic'];
44 46
 		$removeCacheBoards[$row['id_topic']] = $row['id_board'];
@@ -46,8 +48,10 @@  discard block
 block discarded – undo
46 48
 
47 49
 	// Maybe *none* were their own topics.
48 50
 	if (!empty($removeCache))
49
-		removeTopics($removeCache, true, false, true, $removeCacheBoards);
50
-}
51
+	{
52
+			removeTopics($removeCache, true, false, true, $removeCacheBoards);
53
+	}
54
+	}
51 55
 
52 56
 /**
53 57
  * Removes the passed id_topic's.
@@ -67,14 +71,18 @@  discard block
 block discarded – undo
67 71
 
68 72
 	// Nothing to do?
69 73
 	if (empty($topics))
70
-		return;
74
+	{
75
+			return;
76
+	}
71 77
 
72 78
 	$db = database();
73 79
 	$cache = Cache::instance();
74 80
 
75 81
 	// Only a single topic.
76 82
 	if (!is_array($topics))
77
-		$topics = array($topics);
83
+	{
84
+			$topics = array($topics);
85
+	}
78 86
 
79 87
 	if ($log)
80 88
 	{
@@ -110,7 +118,9 @@  discard block
 block discarded – undo
110 118
 		{
111 119
 			require_once(SUBSDIR . '/Members.subs.php');
112 120
 			while ($rowMembers = $db->fetch_assoc($requestMembers))
113
-				updateMemberData($rowMembers['id_member'], array('posts' => 'posts - ' . $rowMembers['posts']));
121
+			{
122
+							updateMemberData($rowMembers['id_member'], array('posts' => 'posts - ' . $rowMembers['posts']));
123
+			}
114 124
 		}
115 125
 		$db->free_result($requestMembers);
116 126
 	}
@@ -130,7 +140,9 @@  discard block
 block discarded – undo
130 140
 			{
131 141
 				// If it's already in the recycle board do nothing
132 142
 				if ($row['id_board'] == $modSettings['recycle_board'])
133
-					continue;
143
+				{
144
+									continue;
145
+				}
134 146
 
135 147
 				$recycleTopics[] = $row['id_topic'];
136 148
 
@@ -182,7 +194,9 @@  discard block
 block discarded – undo
182 194
 
183 195
 	// Still topics left to delete?
184 196
 	if (empty($topics))
185
-		return;
197
+	{
198
+			return;
199
+	}
186 200
 
187 201
 	$adjustBoards = array();
188 202
 
@@ -217,9 +231,12 @@  discard block
 block discarded – undo
217 231
 
218 232
 		// Add the topics to the right type.
219 233
 		if ($row['approved'])
220
-			$adjustBoards[$row['id_board']]['num_topics'] += $row['num_topics'];
221
-		else
222
-			$adjustBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics'];
234
+		{
235
+					$adjustBoards[$row['id_board']]['num_topics'] += $row['num_topics'];
236
+		}
237
+		else {
238
+					$adjustBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics'];
239
+		}
223 240
 	}
224 241
 	$db->free_result($request);
225 242
 
@@ -251,7 +268,9 @@  discard block
 block discarded – undo
251 268
 	foreach ($possible_polls as $row)
252 269
 	{
253 270
 		if (!empty($row['id_poll']))
254
-			$polls[] = $row['id_poll'];
271
+		{
272
+					$polls[] = $row['id_poll'];
273
+		}
255 274
 	}
256 275
 
257 276
 	if (!empty($polls))
@@ -313,7 +332,8 @@  discard block
 block discarded – undo
313 332
 		$words = array_unique($words);
314 333
 
315 334
 		if (!empty($words) && !empty($messages))
316
-			$db->query('', '
335
+		{
336
+					$db->query('', '
317 337
 				DELETE FROM {db_prefix}log_search_words
318 338
 				WHERE id_word IN ({array_int:word_list})
319 339
 					AND id_msg IN ({array_int:message_list})',
@@ -322,11 +342,14 @@  discard block
 block discarded – undo
322 342
 					'message_list' => $messages,
323 343
 				)
324 344
 			);
345
+		}
325 346
 	}
326 347
 
327 348
 	// Reuse the message array if available
328 349
 	if (empty($messages))
329
-		$messages = messagesInTopics($topics);
350
+	{
351
+			$messages = messagesInTopics($topics);
352
+	}
330 353
 
331 354
 	// If there are messages left in this topic
332 355
 	if (!empty($messages))
@@ -407,7 +430,9 @@  discard block
 block discarded – undo
407 430
 	removeFollowUpsByTopic($topics);
408 431
 
409 432
 	foreach ($topics as $topic_id)
410
-		$cache->remove('topic_board-' . $topic_id);
433
+	{
434
+			$cache->remove('topic_board-' . $topic_id);
435
+	}
411 436
 
412 437
 	// Maybe there's an addon that wants to delete topic related data of its own
413 438
 	call_integration_hook('integrate_remove_topics', array($topics));
@@ -423,7 +448,9 @@  discard block
 block discarded – undo
423 448
 	require_once(SUBSDIR . '/Post.subs.php');
424 449
 	$updates = array();
425 450
 	foreach ($adjustBoards as $stats)
426
-		$updates[] = $stats['id_board'];
451
+	{
452
+			$updates[] = $stats['id_board'];
453
+	}
427 454
 	updateLastMessages($updates);
428 455
 }
429 456
 
@@ -460,13 +487,17 @@  discard block
 block discarded – undo
460 487
 		$to = $moveCache[1][$row['id_topic']];
461 488
 
462 489
 		if (empty($to))
463
-			continue;
490
+		{
491
+					continue;
492
+		}
464 493
 
465 494
 		// Does this topic's board count the posts or not?
466 495
 		$countPosts[$row['id_topic']] = empty($row['count_posts']);
467 496
 
468 497
 		if (!isset($moveTos[$to]))
469
-			$moveTos[$to] = array();
498
+		{
499
+					$moveTos[$to] = array();
500
+		}
470 501
 
471 502
 		$moveTos[$to][] = $row['id_topic'];
472 503
 
@@ -477,7 +508,9 @@  discard block
 block discarded – undo
477 508
 
478 509
 	// Do the actual moves...
479 510
 	foreach ($moveTos as $to => $topics)
480
-		moveTopics($topics, $to, true);
511
+	{
512
+			moveTopics($topics, $to, true);
513
+	}
481 514
 
482 515
 	// Does the post counts need to be updated?
483 516
 	if (!empty($moveTos))
@@ -512,7 +545,9 @@  discard block
 block discarded – undo
512 545
 			{
513 546
 				$post_adj = 0;
514 547
 				foreach ($topics as $id_topic)
515
-					$post_adj += $topicRecounts[$id_topic];
548
+				{
549
+									$post_adj += $topicRecounts[$id_topic];
550
+				}
516 551
 
517 552
 				// And now update that member's post counts
518 553
 				if (!empty($post_adj))
@@ -545,13 +580,17 @@  discard block
 block discarded – undo
545 580
 
546 581
 	// No topics or no board?
547 582
 	if (empty($topics) || empty($toBoard))
548
-		return;
583
+	{
584
+			return;
585
+	}
549 586
 
550 587
 	$db = database();
551 588
 
552 589
 	// Only a single topic.
553 590
 	if (!is_array($topics))
554
-		$topics = array($topics);
591
+	{
592
+			$topics = array($topics);
593
+	}
555 594
 
556 595
 	$fromBoards = array();
557 596
 	$fromCacheBoards = array();
@@ -572,7 +611,9 @@  discard block
 block discarded – undo
572 611
 	);
573 612
 	// Num of rows = 0 -> no topics found. Num of rows > 1 -> topics are on multiple boards.
574 613
 	if ($db->num_rows($request) == 0)
575
-		return;
614
+	{
615
+			return;
616
+	}
576 617
 
577 618
 	while ($row = $db->fetch_assoc($request))
578 619
 	{
@@ -593,9 +634,12 @@  discard block
 block discarded – undo
593 634
 
594 635
 		// Add the topics to the right type.
595 636
 		if ($row['approved'])
596
-			$fromBoards[$row['id_board']]['num_topics'] += $row['num_topics'];
597
-		else
598
-			$fromBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics'];
637
+		{
638
+					$fromBoards[$row['id_board']]['num_topics'] += $row['num_topics'];
639
+		}
640
+		else {
641
+					$fromBoards[$row['id_board']]['unapproved_topics'] += $row['num_topics'];
642
+		}
599 643
 	}
600 644
 	$db->free_result($request);
601 645
 
@@ -713,12 +757,15 @@  discard block
 block discarded – undo
713 757
 		);
714 758
 		$approval_msgs = array();
715 759
 		while ($row = $db->fetch_assoc($request))
716
-			$approval_msgs[] = $row['id_msg'];
760
+		{
761
+					$approval_msgs[] = $row['id_msg'];
762
+		}
717 763
 		$db->free_result($request);
718 764
 
719 765
 		// Empty the approval queue for these, as we're going to approve them next.
720 766
 		if (!empty($approval_msgs))
721
-			$db->query('', '
767
+		{
768
+					$db->query('', '
722 769
 				DELETE FROM {db_prefix}approval_queue
723 770
 				WHERE id_msg IN ({array_int:message_list})
724 771
 					AND id_attach = {int:id_attach}',
@@ -727,6 +774,7 @@  discard block
 block discarded – undo
727 774
 					'id_attach' => 0,
728 775
 				)
729 776
 			);
777
+		}
730 778
 
731 779
 		// Get all the current max and mins.
732 780
 		$topicAttribute = topicAttribute($topics, array('id_topic', 'id_first_msg', 'id_last_msg'));
@@ -753,10 +801,12 @@  discard block
 block discarded – undo
753 801
 		{
754 802
 			// If not, update.
755 803
 			if ($row['first_msg'] != $topicMaxMin[$row['id_topic']]['min'] || $row['last_msg'] != $topicMaxMin[$row['id_topic']]['max'])
756
-				setTopicAttribute($row['id_topic'], array(
804
+			{
805
+							setTopicAttribute($row['id_topic'], array(
757 806
 					'id_first_msg' => $row['first_msg'],
758 807
 					'id_last_msg' => $row['last_msg'],
759 808
 				));
809
+			}
760 810
 		}
761 811
 		$db->free_result($request);
762 812
 	}
@@ -813,7 +863,9 @@  discard block
 block discarded – undo
813 863
 	$cache = Cache::instance();
814 864
 	// Update the cache?
815 865
 	foreach ($topics as $topic_id)
816
-		$cache->remove('topic_board-' . $topic_id);
866
+	{
867
+			$cache->remove('topic_board-' . $topic_id);
868
+	}
817 869
 
818 870
 	require_once(SUBSDIR . '/Post.subs.php');
819 871
 
@@ -861,17 +913,27 @@  discard block
 block discarded – undo
861 913
 
862 914
 	// @deprecated since 1.1
863 915
 	if ($move_from === null && isset($_GET['current_board']))
864
-		$move_from = (int) $_GET['current_board'];
916
+	{
917
+			$move_from = (int) $_GET['current_board'];
918
+	}
865 919
 	if ($id_board === null && !empty($board))
866
-		$id_board = $board;
920
+	{
921
+			$id_board = $board;
922
+	}
867 923
 	if ($id_topic === null && !empty($topic))
868
-		$id_topic = $topic;
924
+	{
925
+			$id_topic = $topic;
926
+	}
869 927
 
870 928
 	if (empty($move_from) || empty($id_board) || empty($id_topic))
871
-		return true;
929
+	{
930
+			return true;
931
+	}
872 932
 
873 933
 	if ($move_from == $id_board)
874
-		return true;
934
+	{
935
+			return true;
936
+	}
875 937
 	else
876 938
 	{
877 939
 		$request = $db->query('', '
@@ -957,7 +1019,9 @@  discard block
 block discarded – undo
957 1019
 	$db = database();
958 1020
 
959 1021
 	if (!is_array($mark_topics))
960
-		return;
1022
+	{
1023
+			return;
1024
+	}
961 1025
 
962 1026
 	$db->insert($was_set ? 'replace' : 'ignore',
963 1027
 		'{db_prefix}log_topics',
@@ -1000,7 +1064,9 @@  discard block
 block discarded – undo
1000 1064
 	{
1001 1065
 		// Find if this topic is marked for notification...
1002 1066
 		if (!empty($row['id_topic']))
1003
-			$context['is_marked_notify'] = true;
1067
+		{
1068
+					$context['is_marked_notify'] = true;
1069
+		}
1004 1070
 
1005 1071
 		// Only do this once, but mark the notifications as "not sent yet" for next time.
1006 1072
 		if (!empty($row['sent']))
@@ -1283,15 +1349,19 @@  discard block
 block discarded – undo
1283 1349
 
1284 1350
 	// Nothing to do
1285 1351
 	if (empty($topic_parameters))
1286
-		return false;
1352
+	{
1353
+			return false;
1354
+	}
1287 1355
 
1288 1356
 	// Build what we can with what we were given
1289 1357
 	if (!is_array($topic_parameters))
1290
-		$topic_parameters = array(
1358
+	{
1359
+			$topic_parameters = array(
1291 1360
 			'topic' => $topic_parameters,
1292 1361
 			'member' => $user_info['id'],
1293 1362
 			'board' => (int) $board,
1294 1363
 		);
1364
+	}
1295 1365
 
1296 1366
 	$messages_table = $full === 'message' || $full === 'all' || $full === 'starter';
1297 1367
 	$members_table = $full === 'starter';
@@ -1322,7 +1392,9 @@  discard block
 block discarded – undo
1322 1392
 	);
1323 1393
 	$topic_info = array();
1324 1394
 	if ($request !== false)
1325
-		$topic_info = $db->fetch_assoc($request);
1395
+	{
1396
+			$topic_info = $db->fetch_assoc($request);
1397
+	}
1326 1398
 	$db->free_result($request);
1327 1399
 
1328 1400
 	return $topic_info;
@@ -1342,7 +1414,9 @@  discard block
 block discarded – undo
1342 1414
 
1343 1415
 	// Nothing to do
1344 1416
 	if (empty($topic))
1345
-		return false;
1417
+	{
1418
+			return false;
1419
+	}
1346 1420
 
1347 1421
 	$db = database();
1348 1422
 
@@ -1433,7 +1507,9 @@  discard block
 block discarded – undo
1433 1507
 	);
1434 1508
 	$topics = array();
1435 1509
 	while ($row = $db->fetch_assoc($request))
1436
-		$topics[] = $row['id_topic'];
1510
+	{
1511
+			$topics[] = $row['id_topic'];
1512
+	}
1437 1513
 	$db->free_result($request);
1438 1514
 
1439 1515
 	removeTopics($topics, false, true);
@@ -1459,7 +1535,9 @@  discard block
 block discarded – undo
1459 1535
 		);
1460 1536
 	$topicIDs = array();
1461 1537
 	while ($row = $db->fetch_assoc($request))
1462
-		$topicIDs[] = $row['id_topic'];
1538
+	{
1539
+			$topicIDs[] = $row['id_topic'];
1540
+	}
1463 1541
 	$db->free_result($request);
1464 1542
 
1465 1543
 	return $topicIDs;
@@ -1496,7 +1574,9 @@  discard block
 block discarded – undo
1496 1574
 	);
1497 1575
 	$messages = array();
1498 1576
 	while ($row = $db->fetch_assoc($request))
1499
-		$messages[] = $row['id_msg'];
1577
+	{
1578
+			$messages[] = $row['id_msg'];
1579
+	}
1500 1580
 	$db->free_result($request);
1501 1581
 
1502 1582
 	return $messages;
@@ -1519,7 +1599,9 @@  discard block
 block discarded – undo
1519 1599
 
1520 1600
 	// Give us something to work with
1521 1601
 	if (empty($id_topic) || empty($id_msg))
1522
-		return false;
1602
+	{
1603
+			return false;
1604
+	}
1523 1605
 
1524 1606
 	$request = $db->query('', '
1525 1607
 		SELECT COUNT(*)
@@ -1738,7 +1820,9 @@  discard block
 block discarded – undo
1738 1820
 	{
1739 1821
 		$temp[$row['id_attach']] = $row;
1740 1822
 		if (!isset($printattach[$row['id_msg']]))
1741
-			$printattach[$row['id_msg']] = array();
1823
+		{
1824
+					$printattach[$row['id_msg']] = array();
1825
+		}
1742 1826
 	}
1743 1827
 	$db->free_result($request);
1744 1828
 	ksort($temp);
@@ -1789,7 +1873,9 @@  discard block
 block discarded – undo
1789 1873
 
1790 1874
 	// not all guests are the same!
1791 1875
 	if (empty($id_member))
1792
-		return array();
1876
+	{
1877
+			return array();
1878
+	}
1793 1879
 
1794 1880
 	$request = $db->query('', '
1795 1881
 			SELECT COUNT(id_member) AS my_unapproved_posts
@@ -1850,7 +1936,8 @@  discard block
 block discarded – undo
1850 1936
 	// If the new topic isn't approved ensure the first message flags
1851 1937
 	// this just in case.
1852 1938
 	if (!$options['split2_approved'])
1853
-		$db->query('', '
1939
+	{
1940
+			$db->query('', '
1854 1941
 			UPDATE {db_prefix}messages
1855 1942
 			SET approved = {int:approved}
1856 1943
 			WHERE id_msg = {int:id_msg}
@@ -1861,6 +1948,7 @@  discard block
 block discarded – undo
1861 1948
 				'id_topic' => $options['split2_ID_TOPIC'],
1862 1949
 			)
1863 1950
 		);
1951
+	}
1864 1952
 
1865 1953
 	// The board has more topics now (Or more unapproved ones!).
1866 1954
 	$db->query('', '
@@ -1921,7 +2009,9 @@  discard block
 block discarded – undo
1921 2009
 	}
1922 2010
 
1923 2011
 	if (empty($update))
1924
-		return false;
2012
+	{
2013
+			return false;
2014
+	}
1925 2015
 
1926 2016
 	$attributes['current_topic'] = (array) $topic;
1927 2017
 
@@ -1967,7 +2057,9 @@  discard block
 block discarded – undo
1967 2057
 	{
1968 2058
 		$status = array();
1969 2059
 		while ($row = $db->fetch_assoc($request))
1970
-			$status[] = $row;
2060
+		{
2061
+					$status[] = $row;
2062
+		}
1971 2063
 	}
1972 2064
 	else
1973 2065
 	{
@@ -2105,7 +2197,9 @@  discard block
 block discarded – undo
2105 2197
 	);
2106 2198
 	$logged_topics = array();
2107 2199
 	while ($row = $db->fetch_assoc($request))
2108
-		$logged_topics[$row['id_topic']] = $row;
2200
+	{
2201
+			$logged_topics[$row['id_topic']] = $row;
2202
+	}
2109 2203
 	$db->free_result($request);
2110 2204
 
2111 2205
 	return $logged_topics;
@@ -2122,7 +2216,9 @@  discard block
 block discarded – undo
2122 2216
 
2123 2217
 	// you have to want *something* from this function
2124 2218
 	if (empty($topic_ids))
2125
-		return array();
2219
+	{
2220
+			return array();
2221
+	}
2126 2222
 
2127 2223
 	$db = database();
2128 2224
 
@@ -2201,7 +2297,9 @@  discard block
 block discarded – undo
2201 2297
 	while ($row = $db->fetch_assoc($request))
2202 2298
 	{
2203 2299
 		if (!empty($row['id_member']))
2204
-			$topic_details['all_posters'][$row['id_msg']] = $row['id_member'];
2300
+		{
2301
+					$topic_details['all_posters'][$row['id_msg']] = $row['id_member'];
2302
+		}
2205 2303
 
2206 2304
 		$topic_details['messages'][] = $row['id_msg'];
2207 2305
 	}
@@ -2267,7 +2365,9 @@  discard block
 block discarded – undo
2267 2365
 
2268 2366
 		// and tell the world about it again
2269 2367
 		foreach ($messages as $post)
2270
-			logAction('approve', array('topic' => $messageDetails[$post]['topic'], 'subject' => $messageDetails[$post]['subject'], 'member' => $messageDetails[$post]['member'], 'board' => $messageDetails[$post]['board']));
2368
+		{
2369
+					logAction('approve', array('topic' => $messageDetails[$post]['topic'], 'subject' => $messageDetails[$post]['subject'], 'member' => $messageDetails[$post]['member'], 'board' => $messageDetails[$post]['board']));
2370
+		}
2271 2371
 	}
2272 2372
 }
2273 2373
 
@@ -2284,10 +2384,14 @@  discard block
 block discarded – undo
2284 2384
 	global $board;
2285 2385
 
2286 2386
 	if (!is_array($topics))
2287
-		$topics = array($topics);
2387
+	{
2388
+			$topics = array($topics);
2389
+	}
2288 2390
 
2289 2391
 	if (empty($topics))
2290
-		return false;
2392
+	{
2393
+			return false;
2394
+	}
2291 2395
 
2292 2396
 	$db = database();
2293 2397
 
@@ -2330,7 +2434,9 @@  discard block
 block discarded – undo
2330 2434
 	);
2331 2435
 	$msgs = array();
2332 2436
 	while ($row = $db->fetch_assoc($request))
2333
-		$msgs[] = $row['id_msg'];
2437
+	{
2438
+			$msgs[] = $row['id_msg'];
2439
+	}
2334 2440
 	$db->free_result($request);
2335 2441
 
2336 2442
 	require_once(SUBSDIR . '/Post.subs.php');
@@ -2352,7 +2458,9 @@  discard block
 block discarded – undo
2352 2458
 
2353 2459
 	// Should be in the boardwide language.
2354 2460
 	if ($user_info['language'] != $language)
2355
-		loadLanguage('index', $language);
2461
+	{
2462
+			loadLanguage('index', $language);
2463
+	}
2356 2464
 
2357 2465
 	preparsecode($reason);
2358 2466
 
@@ -2408,7 +2516,9 @@  discard block
 block discarded – undo
2408 2516
 
2409 2517
 	// Nothing to split?
2410 2518
 	if (empty($splitMessages))
2411
-		throw new Elk_Exception('no_posts_selected', false);
2519
+	{
2520
+			throw new Elk_Exception('no_posts_selected', false);
2521
+	}
2412 2522
 
2413 2523
 	// Get some board info.
2414 2524
 	$topicAttribute = topicAttribute($split1_ID_TOPIC, array('id_board', 'approved'));
@@ -2433,7 +2543,9 @@  discard block
 block discarded – undo
2433 2543
 	);
2434 2544
 	// You can't select ALL the messages!
2435 2545
 	if ($db->num_rows($request) == 0)
2436
-		throw new Elk_Exception('selected_all_posts', false);
2546
+	{
2547
+			throw new Elk_Exception('selected_all_posts', false);
2548
+	}
2437 2549
 
2438 2550
 	$split1_first_msg = null;
2439 2551
 	$split1_last_msg = null;
@@ -2442,10 +2554,14 @@  discard block
 block discarded – undo
2442 2554
 	{
2443 2555
 		// Get the right first and last message dependant on approved state...
2444 2556
 		if (empty($split1_first_msg) || $row['myid_first_msg'] < $split1_first_msg)
2445
-			$split1_first_msg = $row['myid_first_msg'];
2557
+		{
2558
+					$split1_first_msg = $row['myid_first_msg'];
2559
+		}
2446 2560
 
2447 2561
 		if (empty($split1_last_msg) || $row['approved'])
2448
-			$split1_last_msg = $row['myid_last_msg'];
2562
+		{
2563
+					$split1_last_msg = $row['myid_last_msg'];
2564
+		}
2449 2565
 
2450 2566
 		// Get the counts correct...
2451 2567
 		if ($row['approved'])
@@ -2456,10 +2572,14 @@  discard block
 block discarded – undo
2456 2572
 		else
2457 2573
 		{
2458 2574
 			if (!isset($split1_replies))
2459
-				$split1_replies = 0;
2575
+			{
2576
+							$split1_replies = 0;
2577
+			}
2460 2578
 			// If the topic isn't approved then num replies must go up by one... as first post wouldn't be counted.
2461 2579
 			elseif (!$split1_approved)
2462
-				$split1_replies++;
2580
+			{
2581
+							$split1_replies++;
2582
+			}
2463 2583
 
2464 2584
 			$split1_unapprovedposts = $row['message_count'];
2465 2585
 		}
@@ -2486,10 +2606,14 @@  discard block
 block discarded – undo
2486 2606
 	{
2487 2607
 		// As before get the right first and last message dependant on approved state...
2488 2608
 		if (empty($split2_first_msg) || $row['myid_first_msg'] < $split2_first_msg)
2489
-			$split2_first_msg = $row['myid_first_msg'];
2609
+		{
2610
+					$split2_first_msg = $row['myid_first_msg'];
2611
+		}
2490 2612
 
2491 2613
 		if (empty($split2_last_msg) || $row['approved'])
2492
-			$split2_last_msg = $row['myid_last_msg'];
2614
+		{
2615
+					$split2_last_msg = $row['myid_last_msg'];
2616
+		}
2493 2617
 
2494 2618
 		// Then do the counts again...
2495 2619
 		if ($row['approved'])
@@ -2502,13 +2626,19 @@  discard block
 block discarded – undo
2502 2626
 		{
2503 2627
 			// Should this one be approved??
2504 2628
 			if ($split2_first_msg == $row['myid_first_msg'])
2505
-				$split2_approved = false;
2629
+			{
2630
+							$split2_approved = false;
2631
+			}
2506 2632
 
2507 2633
 			if (!isset($split2_replies))
2508
-				$split2_replies = 0;
2634
+			{
2635
+							$split2_replies = 0;
2636
+			}
2509 2637
 			// As before, fix number of replies.
2510 2638
 			elseif (!$split2_approved)
2511
-				$split2_replies++;
2639
+			{
2640
+							$split2_replies++;
2641
+			}
2512 2642
 
2513 2643
 			$split2_unapprovedposts = $row['message_count'];
2514 2644
 		}
@@ -2519,11 +2649,15 @@  discard block
 block discarded – undo
2519 2649
 
2520 2650
 	// No database changes yet, so let's double check to see if everything makes at least a little sense.
2521 2651
 	if ($split1_first_msg <= 0 || $split1_last_msg <= 0 || $split2_first_msg <= 0 || $split2_last_msg <= 0 || $split1_replies < 0 || $split2_replies < 0 || $split1_unapprovedposts < 0 || $split2_unapprovedposts < 0 || !isset($split1_approved) || !isset($split2_approved))
2522
-		throw new Elk_Exception('cant_find_messages');
2652
+	{
2653
+			throw new Elk_Exception('cant_find_messages');
2654
+	}
2523 2655
 
2524 2656
 	// You cannot split off the first message of a topic.
2525 2657
 	if ($split1_first_msg > $split2_first_msg)
2526
-		throw new Elk_Exception('split_first_post', false);
2658
+	{
2659
+			throw new Elk_Exception('split_first_post', false);
2660
+	}
2527 2661
 
2528 2662
 	// The message that is starting the new topic may have likes, these become topic likes
2529 2663
 	require_once(SUBSDIR . '/Likes.subs.php');
@@ -2552,14 +2686,18 @@  discard block
 block discarded – undo
2552 2686
 	);
2553 2687
 	$split2_ID_TOPIC = $db->insert_id('{db_prefix}topics', 'id_topic');
2554 2688
 	if ($split2_ID_TOPIC <= 0)
2555
-		throw new Elk_Exception('cant_insert_topic');
2689
+	{
2690
+			throw new Elk_Exception('cant_insert_topic');
2691
+	}
2556 2692
 
2557 2693
 	// Move the messages over to the other topic.
2558 2694
 	$new_subject = strtr(Util::htmltrim(Util::htmlspecialchars($new_subject)), array("\r" => '', "\n" => '', "\t" => ''));
2559 2695
 
2560 2696
 	// Check the subject length.
2561 2697
 	if (Util::strlen($new_subject) > 100)
2562
-		$new_subject = Util::substr($new_subject, 0, 100);
2698
+	{
2699
+			$new_subject = Util::substr($new_subject, 0, 100);
2700
+	}
2563 2701
 
2564 2702
 	// Valid subject?
2565 2703
 	if ($new_subject != '')
@@ -2621,7 +2759,9 @@  discard block
 block discarded – undo
2621 2759
 	{
2622 2760
 		$replaceEntries = array();
2623 2761
 		while ($row = $db->fetch_assoc($request))
2624
-			$replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']);
2762
+		{
2763
+					$replaceEntries[] = array($row['id_member'], $split2_ID_TOPIC, $row['id_msg'], $row['unwatched']);
2764
+		}
2625 2765
 
2626 2766
 		require_once(SUBSDIR . '/Topic.subs.php');
2627 2767
 		markTopicsRead($replaceEntries, false);
@@ -2643,7 +2783,9 @@  discard block
 block discarded – undo
2643 2783
 	$search = new \ElkArte\Search\Search;
2644 2784
 	$searchAPI = $search->findSearchAPI();
2645 2785
 	if (is_callable(array($searchAPI, 'topicSplit')))
2646
-		$searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages);
2786
+	{
2787
+			$searchAPI->topicSplit($split2_ID_TOPIC, $splitMessages);
2788
+	}
2647 2789
 
2648 2790
 	// Return the ID of the newly created topic.
2649 2791
 	return $split2_ID_TOPIC;
@@ -2668,12 +2810,16 @@  discard block
 block discarded – undo
2668 2810
 	{
2669 2811
 		$doMove = false;
2670 2812
 		if (allowedTo('move_any'))
2671
-			$doMove = true;
2813
+		{
2814
+					$doMove = true;
2815
+		}
2672 2816
 		else
2673 2817
 		{
2674 2818
 			$new_topic = getTopicInfo($totopic);
2675 2819
 			if ($new_topic['id_member_started'] == $user_info['id'] && allowedTo('move_own'))
2676
-				$doMove = true;
2820
+			{
2821
+							$doMove = true;
2822
+			}
2677 2823
 		}
2678 2824
 
2679 2825
 		if ($doMove)
@@ -2696,7 +2842,9 @@  discard block
 block discarded – undo
2696 2842
 				while ($row = $db->fetch_assoc($request))
2697 2843
 				{
2698 2844
 					if (!isset($posters[$row['id_member']]))
2699
-						$posters[$row['id_member']] = 0;
2845
+					{
2846
+											$posters[$row['id_member']] = 0;
2847
+					}
2700 2848
 
2701 2849
 					$posters[$row['id_member']]++;
2702 2850
 				}
@@ -2707,18 +2855,22 @@  discard block
 block discarded – undo
2707 2855
 				{
2708 2856
 					// The board we're moving from counted posts, but not to.
2709 2857
 					if (empty($boards['current']['count_posts']))
2710
-						updateMemberData($id_member, array('posts' => 'posts - ' . $posts));
2858
+					{
2859
+											updateMemberData($id_member, array('posts' => 'posts - ' . $posts));
2860
+					}
2711 2861
 					// The reverse: from didn't, to did.
2712
-					else
2713
-						updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
2862
+					else {
2863
+											updateMemberData($id_member, array('posts' => 'posts + ' . $posts));
2864
+					}
2714 2865
 				}
2715 2866
 			}
2716 2867
 
2717 2868
 			// And finally move it!
2718 2869
 			moveTopics($totopic, $boards['destination']['id']);
2719 2870
 		}
2720
-		else
2721
-			$boards['destination'] = $boards['current'];
2871
+		else {
2872
+					$boards['destination'] = $boards['current'];
2873
+		}
2722 2874
 	}
2723 2875
 }
2724 2876
 
@@ -2736,19 +2888,26 @@  discard block
 block discarded – undo
2736 2888
 
2737 2889
 	$current_board = boardInfo($board, $topic);
2738 2890
 	if (empty($current_board))
2739
-		throw new Elk_Exception('no_board');
2891
+	{
2892
+			throw new Elk_Exception('no_board');
2893
+	}
2740 2894
 
2741 2895
 	if (!empty($toboard) && $board !== $toboard)
2742 2896
 	{
2743 2897
 		$destination_board = boardInfo($toboard);
2744 2898
 		if (empty($destination_board))
2745
-			throw new Elk_Exception('no_board');
2899
+		{
2900
+					throw new Elk_Exception('no_board');
2901
+		}
2746 2902
 	}
2747 2903
 
2748 2904
 	if (!isset($destination_board))
2749
-		$destination_board = array_merge($current_board, array('id' => $board));
2750
-	else
2751
-		$destination_board['id'] = $toboard;
2905
+	{
2906
+			$destination_board = array_merge($current_board, array('id' => $board));
2907
+	}
2908
+	else {
2909
+			$destination_board['id'] = $toboard;
2910
+	}
2752 2911
 
2753 2912
 	return array('current' => $current_board, 'destination' => $destination_board);
2754 2913
 }
@@ -2879,7 +3038,9 @@  discard block
 block discarded – undo
2879 3038
 	while ($row = $db->fetch_assoc($request))
2880 3039
 	{
2881 3040
 		if (!isset($posters[$row['id_member']]))
2882
-			$posters[$row['id_member']] = 0;
3041
+		{
3042
+					$posters[$row['id_member']] = 0;
3043
+		}
2883 3044
 
2884 3045
 		$posters[$row['id_member']]++;
2885 3046
 	}
@@ -2997,7 +3158,9 @@  discard block
 block discarded – undo
2997 3158
 	));
2998 3159
 	$messages = array();
2999 3160
 	while ($row = $db->fetch_assoc($request))
3000
-		$messages[] = $row['id_msg'];
3161
+	{
3162
+			$messages[] = $row['id_msg'];
3163
+	}
3001 3164
 	$db->free_result($request);
3002 3165
 
3003 3166
 	return $messages;
@@ -3023,7 +3186,9 @@  discard block
 block discarded – undo
3023 3186
 			'topic_list' => $topics,
3024 3187
 	));
3025 3188
 	while ($row = $db->fetch_assoc($request))
3026
-		$members[$row['id_member']][] = $row['id_topic'];
3189
+	{
3190
+			$members[$row['id_member']][] = $row['id_topic'];
3191
+	}
3027 3192
 	$db->free_result($request);
3028 3193
 
3029 3194
 	return $members;
@@ -3133,7 +3298,9 @@  discard block
 block discarded – undo
3133 3298
 	{
3134 3299
 		$replaceEntries = array();
3135 3300
 		while ($row = $db->fetch_assoc($request))
3136
-			$replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']);
3301
+		{
3302
+					$replaceEntries[] = array($row['id_member'], $id_topic, $row['new_id_msg'], $row['unwatched']);
3303
+		}
3137 3304
 
3138 3305
 		markTopicsRead($replaceEntries, true);
3139 3306
 		unset($replaceEntries);
@@ -3164,7 +3331,9 @@  discard block
 block discarded – undo
3164 3331
 		{
3165 3332
 			$replaceEntries = array();
3166 3333
 			while ($row = $db->fetch_assoc($request))
3167
-				$replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']);
3334
+			{
3335
+							$replaceEntries[] = array($row['id_member'], $id_topic, 0, $row['sent']);
3336
+			}
3168 3337
 
3169 3338
 			$db->insert('replace',
3170 3339
 					'{db_prefix}log_notify',
@@ -3216,7 +3385,9 @@  discard block
 block discarded – undo
3216 3385
 	);
3217 3386
 
3218 3387
 	if ($db->num_rows($request) == 0)
3219
-		throw new Elk_Exception('topic_gone', false);
3388
+	{
3389
+			throw new Elk_Exception('topic_gone', false);
3390
+	}
3220 3391
 
3221 3392
 	list ($subject) = $db->fetch_row($request);
3222 3393
 	$db->free_result($request);
@@ -3237,7 +3408,9 @@  discard block
 block discarded – undo
3237 3408
 	$db = database();
3238 3409
 
3239 3410
 	if ($increment === true)
3240
-		updateSettings(array('totalTopics' => true), true);
3411
+	{
3412
+			updateSettings(array('totalTopics' => true), true);
3413
+	}
3241 3414
 	else
3242 3415
 	{
3243 3416
 		// Get the number of topics - a SUM is better for InnoDB tables.
@@ -3280,7 +3453,9 @@  discard block
 block discarded – undo
3280 3453
 		// Skip the entry if it needs to be checked and the user is not the owen and
3281 3454
 		// the topic was not locked or locked by someone with more permissions
3282 3455
 		if ($needs_check && ($user_info['id'] != $row['id_member_started'] || !in_array($row['locked'], array(0, 2))))
3283
-			continue;
3456
+		{
3457
+					continue;
3458
+		}
3284 3459
 
3285 3460
 		$lockCache[] = $row['id_topic'];
3286 3461
 
Please login to merge, or discard this patch.
sources/controllers/Notify.controller.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@
 block discarded – undo
425 425
 		if ($valid)
426 426
 		{
427 427
 			$this->_unsubscribeToggle($member, $area, $extra);
428
-			$this->_prepareTemplateMessage( $area, $extra, $member['email_address']);
428
+			$this->_prepareTemplateMessage($area, $extra, $member['email_address']);
429 429
 
430 430
 			return true;
431 431
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,9 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// Make sure the topic has been specified.
87 87
 		if (empty($topic))
88
-			throw new Elk_Exception('not_a_topic', false);
88
+		{
89
+					throw new Elk_Exception('not_a_topic', false);
90
+		}
89 91
 
90 92
 		// What do we do?  Better ask if they didn't say..
91 93
 		if (empty($this->_req->query->sa))
@@ -210,7 +212,9 @@  discard block
 block discarded – undo
210 212
 
211 213
 		// You have to specify a board to turn notifications on!
212 214
 		if (empty($board))
213
-			throw new Elk_Exception('no_board', false);
215
+		{
216
+					throw new Elk_Exception('no_board', false);
217
+		}
214 218
 
215 219
 		// No subaction: find out what to do.
216 220
 		if (empty($this->_req->query->sa))
Please login to merge, or discard this patch.