Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
sources/subs/Exception/ElkException.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,9 @@
 block discarded – undo
166 166
 		// Don't need to reload the language file if both the user and
167 167
 		// the forum share the same language.
168 168
 		if (!isset($language) || $language !== $user_info['language'])
169
-			loadLanguage($lang, $language);
169
+		{
170
+					loadLanguage($lang, $language);
171
+		}
170 172
 
171 173
 		if ($this->log !== false)
172 174
 		{
Please login to merge, or discard this patch.
sources/subs/Smileys.subs.php 1 patch
Braces   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 		)
36 36
 	);
37 37
 	while ($row = $db->fetch_assoc($request))
38
-		$found[] = $row['filename'];
38
+	{
39
+			$found[] = $row['filename'];
40
+	}
39 41
 	$db->free_result($request);
40 42
 
41 43
 	return $found;
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
 		)
65 67
 	);
66 68
 	if ($db->num_rows($request) > 0)
67
-		return true;
69
+	{
70
+			return true;
71
+	}
68 72
 	$db->free_result($request);
69 73
 
70 74
 	return false;
@@ -201,7 +205,9 @@  discard block
 block discarded – undo
201 205
 		)
202 206
 	);
203 207
 	if ($db->num_rows($request) != 1)
204
-		throw new Elk_Exception('smiley_not_found');
208
+	{
209
+			throw new Elk_Exception('smiley_not_found');
210
+	}
205 211
 	$current_smiley = $db->fetch_assoc($request);
206 212
 	$db->free_result($request);
207 213
 
@@ -492,20 +498,27 @@  discard block
 block discarded – undo
492 498
 	$sort_flag = strpos($sort, 'DESC') === false ? SORT_ASC : SORT_DESC;
493 499
 
494 500
 	if (substr($sort, 0, 4) === 'name')
495
-		array_multisort($cols['name'], $sort_flag, SORT_REGULAR, $cols['path'], $cols['selected'], $cols['id']);
501
+	{
502
+			array_multisort($cols['name'], $sort_flag, SORT_REGULAR, $cols['path'], $cols['selected'], $cols['id']);
503
+	}
496 504
 	elseif (substr($sort, 0, 4) === 'path')
497
-		array_multisort($cols['path'], $sort_flag, SORT_REGULAR, $cols['name'], $cols['selected'], $cols['id']);
498
-	else
499
-		array_multisort($cols['selected'], $sort_flag, SORT_REGULAR, $cols['path'], $cols['name'], $cols['id']);
505
+	{
506
+			array_multisort($cols['path'], $sort_flag, SORT_REGULAR, $cols['name'], $cols['selected'], $cols['id']);
507
+	}
508
+	else {
509
+			array_multisort($cols['selected'], $sort_flag, SORT_REGULAR, $cols['path'], $cols['name'], $cols['id']);
510
+	}
500 511
 
501 512
 	$smiley_sets = array();
502 513
 	foreach ($cols['id'] as $i => $id)
503
-		$smiley_sets[] = array(
514
+	{
515
+			$smiley_sets[] = array(
504 516
 			'id' => $id,
505 517
 			'path' => $cols['path'][$i],
506 518
 			'name' => $cols['name'][$i],
507 519
 			'selected' => $cols['path'][$i] == $modSettings['smiley_sets_default']
508 520
 		);
521
+	}
509 522
 
510 523
 	return $smiley_sets;
511 524
 }
@@ -541,7 +554,9 @@  discard block
 block discarded – undo
541 554
 	);
542 555
 	$smileys = array();
543 556
 	while ($row = $db->fetch_assoc($request))
544
-		$smileys[] = $row;
557
+	{
558
+			$smileys[] = $row;
559
+	}
545 560
 	$db->free_result($request);
546 561
 
547 562
 	return $smileys;
Please login to merge, or discard this patch.
sources/subs/NotificationsTask.class.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,12 +58,17 @@
 block discarded – undo
58 58
 		);
59 59
 
60 60
 		if (!isset($this->data['source_data']['status']))
61
-			$this->data['source_data']['status'] = 'new';
61
+		{
62
+					$this->data['source_data']['status'] = 'new';
63
+		}
62 64
 
63 65
 		if (isset($this->data['source_data']['id_members']))
64
-			$this->setMembers($this->data['source_data']['id_members']);
65
-		else
66
-			$this->setMembers(array());
66
+		{
67
+					$this->setMembers($this->data['source_data']['id_members']);
68
+		}
69
+		else {
70
+					$this->setMembers(array());
71
+		}
67 72
 	}
68 73
 
69 74
 	/**
Please login to merge, or discard this patch.
sources/subs/Search/API/Custom.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@  discard block
 block discarded – undo
64 64
 		}
65 65
 
66 66
 		if (empty($modSettings['search_custom_index_config']))
67
-			return;
67
+		{
68
+					return;
69
+		}
68 70
 
69 71
 		$this->indexSettings = \Util::unserialize($modSettings['search_custom_index_config']);
70 72
 
@@ -115,11 +117,15 @@  discard block
 block discarded – undo
115 117
 		$subwords = text2words($word, $this->min_word_length, true);
116 118
 
117 119
 		if (empty($modSettings['search_force_index']))
118
-			$wordsSearch['words'][] = $word;
120
+		{
121
+					$wordsSearch['words'][] = $word;
122
+		}
119 123
 
120 124
 		// Excluded phrases don't benefit from being split into subwords.
121 125
 		if (count($subwords) > 1 && $isExcluded)
122
-			return;
126
+		{
127
+					return;
128
+		}
123 129
 		else
124 130
 		{
125 131
 			foreach ($subwords as $subword)
@@ -128,7 +134,9 @@  discard block
 block discarded – undo
128 134
 				{
129 135
 					$wordsSearch['indexed_words'][] = $subword;
130 136
 					if ($isExcluded)
131
-						$wordsExclude[] = $subword;
137
+					{
138
+											$wordsExclude[] = $subword;
139
+					}
132 140
 				}
133 141
 			}
134 142
 		}
@@ -158,7 +166,9 @@  discard block
 block discarded – undo
158 166
 		$query_params = $search_data['params'];
159 167
 
160 168
 		if ($query_params['id_search'])
161
-			$query_select['id_search'] = '{int:id_search}';
169
+		{
170
+					$query_select['id_search'] = '{int:id_search}';
171
+		}
162 172
 
163 173
 		$count = 0;
164 174
 		foreach ($words['words'] as $regularWord)
@@ -168,15 +178,25 @@  discard block
 block discarded – undo
168 178
 		}
169 179
 
170 180
 		if ($query_params['user_query'])
171
-			$query_where[] = '{raw:user_query}';
181
+		{
182
+					$query_where[] = '{raw:user_query}';
183
+		}
172 184
 		if ($query_params['board_query'])
173
-			$query_where[] = 'm.id_board {raw:board_query}';
185
+		{
186
+					$query_where[] = 'm.id_board {raw:board_query}';
187
+		}
174 188
 		if ($query_params['topic'])
175
-			$query_where[] = 'm.id_topic = {int:topic}';
189
+		{
190
+					$query_where[] = 'm.id_topic = {int:topic}';
191
+		}
176 192
 		if ($query_params['min_msg_id'])
177
-			$query_where[] = 'm.id_msg >= {int:min_msg_id}';
193
+		{
194
+					$query_where[] = 'm.id_msg >= {int:min_msg_id}';
195
+		}
178 196
 		if ($query_params['max_msg_id'])
179
-			$query_where[] = 'm.id_msg <= {int:max_msg_id}';
197
+		{
198
+					$query_where[] = 'm.id_msg <= {int:max_msg_id}';
199
+		}
180 200
 
181 201
 		$count = 0;
182 202
 		if (!empty($query_params['excluded_phrases']) && empty($modSettings['search_force_index']))
@@ -251,15 +271,19 @@  discard block
 block discarded – undo
251 271
 
252 272
 		$inserts = array();
253 273
 		foreach (text2words($msgOptions['body'], $customIndexSettings['bytes_per_word'], true) as $word)
254
-			$inserts[] = array($word, $msgOptions['id']);
274
+		{
275
+					$inserts[] = array($word, $msgOptions['id']);
276
+		}
255 277
 
256 278
 		if (!empty($inserts))
257
-			$db->insert('ignore',
279
+		{
280
+					$db->insert('ignore',
258 281
 				'{db_prefix}log_search_words',
259 282
 				array('id_word' => 'int', 'id_msg' => 'int'),
260 283
 				$inserts,
261 284
 				array('id_word', 'id_msg')
262 285
 			);
286
+		}
263 287
 	}
264 288
 
265 289
 	/**
@@ -309,7 +333,9 @@  discard block
 block discarded – undo
309 333
 			{
310 334
 				$inserts = array();
311 335
 				foreach ($inserted_words as $word)
312
-					$inserts[] = array($word, $msgOptions['id']);
336
+				{
337
+									$inserts[] = array($word, $msgOptions['id']);
338
+				}
313 339
 				$db->insert('insert',
314 340
 					'{db_prefix}log_search_words',
315 341
 					array('id_word' => 'string', 'id_msg' => 'int'),
Please login to merge, or discard this patch.
sources/subs/Search/API/Fulltext.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -324,7 +324,9 @@
 block discarded – undo
324 324
 			$words['indexed_words'] = array_diff($words['indexed_words'], $words['complex_words']);
325 325
 
326 326
 			foreach ($words['indexed_words'] as $fulltextWord)
327
-				$query_params['boolean_match'] .= (in_array($fulltextWord, $query_params['excluded_index_words']) ? '-' : '+') . $fulltextWord . ' ';
327
+			{
328
+							$query_params['boolean_match'] .= (in_array($fulltextWord, $query_params['excluded_index_words']) ? '-' : '+') . $fulltextWord . ' ';
329
+			}
328 330
 			$query_params['boolean_match'] = substr($query_params['boolean_match'], 0, -1);
329 331
 
330 332
 			// If we have bool terms to search, add them in
Please login to merge, or discard this patch.
sources/subs/FtpConnection.class.php 1 patch
Braces   +93 added lines, -34 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@  discard block
 block discarded – undo
62 62
 		$this->pasv = array();
63 63
 
64 64
 		if ($ftp_server !== null)
65
-			$this->connect($ftp_server, $ftp_port, $ftp_user, $ftp_pass);
65
+		{
66
+					$this->connect($ftp_server, $ftp_port, $ftp_user, $ftp_pass);
67
+		}
66 68
 	}
67 69
 
68 70
 	/**
@@ -76,11 +78,17 @@  discard block
 block discarded – undo
76 78
 	public function connect($ftp_server, $ftp_port = 21, $ftp_user = 'anonymous', $ftp_pass = '[email protected]')
77 79
 	{
78 80
 		if (strpos($ftp_server, 'ftp://') === 0)
79
-			$ftp_server = substr($ftp_server, 6);
81
+		{
82
+					$ftp_server = substr($ftp_server, 6);
83
+		}
80 84
 		elseif (strpos($ftp_server, 'ftps://') === 0)
81
-			$ftp_server = 'ssl://' . substr($ftp_server, 7);
85
+		{
86
+					$ftp_server = 'ssl://' . substr($ftp_server, 7);
87
+		}
82 88
 		if (strpos($ftp_server, 'http://') === 0)
83
-			$ftp_server = substr($ftp_server, 7);
89
+		{
90
+					$ftp_server = substr($ftp_server, 7);
91
+		}
84 92
 		$ftp_server = strtr($ftp_server, array('/' => '', ':' => '', '@' => ''));
85 93
 
86 94
 		// Connect to the FTP server.
@@ -124,11 +132,15 @@  discard block
 block discarded – undo
124 132
 	public function chdir($ftp_path)
125 133
 	{
126 134
 		if (!is_resource($this->connection))
127
-			return false;
135
+		{
136
+					return false;
137
+		}
128 138
 
129 139
 		// No slash on the end, please...
130 140
 		if ($ftp_path !== '/' && substr($ftp_path, -1) === '/')
131
-			$ftp_path = substr($ftp_path, 0, -1);
141
+		{
142
+					$ftp_path = substr($ftp_path, 0, -1);
143
+		}
132 144
 
133 145
 		fwrite($this->connection, 'CWD ' . $ftp_path . "\r\n");
134 146
 		if (!$this->check_response(250))
@@ -150,10 +162,14 @@  discard block
 block discarded – undo
150 162
 	public function chmod($ftp_file, $chmod)
151 163
 	{
152 164
 		if (!is_resource($this->connection))
153
-			return false;
165
+		{
166
+					return false;
167
+		}
154 168
 
155 169
 		if ($ftp_file == '')
156
-			$ftp_file = '.';
170
+		{
171
+					$ftp_file = '.';
172
+		}
157 173
 
158 174
 		// Convert the chmod value from octal (0777) to text ("777").
159 175
 		fwrite($this->connection, 'SITE CHMOD ' . decoct($chmod) . ' ' . $ftp_file . "\r\n");
@@ -176,7 +192,9 @@  discard block
 block discarded – undo
176 192
 	{
177 193
 		// We are actually connected, right?
178 194
 		if (!is_resource($this->connection))
179
-			return false;
195
+		{
196
+					return false;
197
+		}
180 198
 
181 199
 		// Delete file X.
182 200
 		fwrite($this->connection, 'DELE ' . $ftp_file . "\r\n");
@@ -222,7 +240,9 @@  discard block
 block discarded – undo
222 240
 	{
223 241
 		// We can't create a passive data connection without a primary one first being there.
224 242
 		if (!is_resource($this->connection))
225
-			return false;
243
+		{
244
+					return false;
245
+		}
226 246
 
227 247
 		// Request a passive connection - this means, we'll talk to you, you don't talk to us.
228 248
 		@fwrite($this->connection, 'PASV' . "\r\n");
@@ -262,11 +282,15 @@  discard block
 block discarded – undo
262 282
 	{
263 283
 		// First, we have to be connected... very important.
264 284
 		if (!is_resource($this->connection))
265
-			return false;
285
+		{
286
+					return false;
287
+		}
266 288
 
267 289
 		// I'd like one passive mode, please!
268 290
 		if (!$this->passive())
269
-			return false;
291
+		{
292
+					return false;
293
+		}
270 294
 
271 295
 		// Seems logical enough, so far...
272 296
 		fwrite($this->connection, 'STOR ' . $ftp_file . "\r\n");
@@ -302,11 +326,15 @@  discard block
 block discarded – undo
302 326
 	{
303 327
 		// Are we even connected...?
304 328
 		if (!is_resource($this->connection))
305
-			return false;
329
+		{
330
+					return false;
331
+		}
306 332
 
307 333
 		// Passive... non-aggressive...
308 334
 		if (!$this->passive())
309
-			return false;
335
+		{
336
+					return false;
337
+		}
310 338
 
311 339
 		// Get the listing!
312 340
 		fwrite($this->connection, 'LIST -1' . ($search ? 'R' : '') . ($ftp_path == '' ? '' : ' ' . $ftp_path) . "\r\n");
@@ -323,7 +351,9 @@  discard block
 block discarded – undo
323 351
 		// Read in the file listing.
324 352
 		$data = '';
325 353
 		while (!feof($fp))
326
-			$data .= fread($fp, 4096);
354
+		{
355
+					$data .= fread($fp, 4096);
356
+		}
327 357
 		fclose($fp);
328 358
 
329 359
 		// Everything go okay?
@@ -346,7 +376,9 @@  discard block
 block discarded – undo
346 376
 	public function locate($file, $listing = null)
347 377
 	{
348 378
 		if ($listing === null)
349
-			$listing = $this->list_dir('', true);
379
+		{
380
+					$listing = $this->list_dir('', true);
381
+		}
350 382
 		$listing = explode("\n", $listing);
351 383
 
352 384
 		@fwrite($this->connection, 'PWD' . "\r\n");
@@ -358,9 +390,12 @@  discard block
 block discarded – undo
358 390
 
359 391
 		// Check for 257!
360 392
 		if (preg_match('~^257 "(.+?)" ~', $response, $match) != 0)
361
-			$current_dir = strtr($match[1], array('""' => '"'));
362
-		else
363
-			$current_dir = '';
393
+		{
394
+					$current_dir = strtr($match[1], array('""' => '"'));
395
+		}
396
+		else {
397
+					$current_dir = '';
398
+		}
364 399
 
365 400
 		for ($i = 0, $n = count($listing); $i < $n; $i++)
366 401
 		{
@@ -374,11 +409,17 @@  discard block
 block discarded – undo
374 409
 			$listing[$i] = $current_dir . '/' . trim(strlen($listing[$i]) > 30 ? strrchr($listing[$i], ' ') : $listing[$i]);
375 410
 
376 411
 			if ($file[0] == '*' && substr($listing[$i], -(strlen($file) - 1)) == substr($file, 1))
377
-				return $listing[$i];
412
+			{
413
+							return $listing[$i];
414
+			}
378 415
 			if (substr($file, -1) == '*' && substr($listing[$i], 0, strlen($file) - 1) == substr($file, 0, -1))
379
-				return $listing[$i];
416
+			{
417
+							return $listing[$i];
418
+			}
380 419
 			if (basename($listing[$i]) == $file || $listing[$i] == $file)
381
-				return $listing[$i];
420
+			{
421
+							return $listing[$i];
422
+			}
382 423
 		}
383 424
 
384 425
 		return false;
@@ -394,7 +435,9 @@  discard block
 block discarded – undo
394 435
 	{
395 436
 		// We must be connected to the server to do something.
396 437
 		if (!is_resource($this->connection))
397
-			return false;
438
+		{
439
+					return false;
440
+		}
398 441
 
399 442
 		// Make this new beautiful directory!
400 443
 		fwrite($this->connection, 'MKD ' . $ftp_dir . "\r\n");
@@ -427,34 +470,50 @@  discard block
 block discarded – undo
427 470
 				$path = strtr($_SERVER['DOCUMENT_ROOT'], array('/home/' . $match[1] . '/' => '', '/home2/' . $match[1] . '/' => ''));
428 471
 
429 472
 				if (substr($path, -1) == '/')
430
-					$path = substr($path, 0, -1);
473
+				{
474
+									$path = substr($path, 0, -1);
475
+				}
431 476
 
432 477
 				if (strlen(dirname($_SERVER['PHP_SELF'])) > 1)
433
-					$path .= dirname($_SERVER['PHP_SELF']);
478
+				{
479
+									$path .= dirname($_SERVER['PHP_SELF']);
480
+				}
434 481
 			}
435 482
 			elseif (strpos($filesystem_path, '/var/www/') === 0)
436
-				$path = substr($filesystem_path, 8);
437
-			else
438
-				$path = strtr(strtr($filesystem_path, array('\\' => '/')), array($_SERVER['DOCUMENT_ROOT'] => ''));
483
+			{
484
+							$path = substr($filesystem_path, 8);
485
+			}
486
+			else {
487
+							$path = strtr(strtr($filesystem_path, array('\\' => '/')), array($_SERVER['DOCUMENT_ROOT'] => ''));
488
+			}
489
+		}
490
+		else {
491
+					$path = '';
439 492
 		}
440
-		else
441
-			$path = '';
442 493
 
443 494
 		if (is_resource($this->connection) && $this->list_dir($path) == '')
444 495
 		{
445 496
 			$data = $this->list_dir('', true);
446 497
 
447 498
 			if ($lookup_file === null)
448
-				$lookup_file = $_SERVER['PHP_SELF'];
499
+			{
500
+							$lookup_file = $_SERVER['PHP_SELF'];
501
+			}
449 502
 
450 503
 			$found_path = dirname($this->locate('*' . basename(dirname($lookup_file)) . '/' . basename($lookup_file), $data));
451 504
 			if ($found_path === false)
452
-				$found_path = dirname($this->locate(basename($lookup_file)));
505
+			{
506
+							$found_path = dirname($this->locate(basename($lookup_file)));
507
+			}
453 508
 			if ($found_path !== false)
454
-				$path = $found_path;
509
+			{
510
+							$path = $found_path;
511
+			}
455 512
 		}
456 513
 		elseif (is_resource($this->connection))
457
-			$found_path = true;
514
+		{
515
+					$found_path = true;
516
+		}
458 517
 
459 518
 		return array($username, $path, isset($found_path));
460 519
 	}
Please login to merge, or discard this patch.
sources/subs/Auth.subs.php 2 patches
Braces   +132 added lines, -51 removed lines patch added patch discarded remove patch
@@ -70,7 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
 	// If subdomain-independent cookies are on, unset the subdomain-dependent cookie too.
72 72
 	if (empty($id) && !empty($modSettings['globalCookies']))
73
-		elk_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], '');
73
+	{
74
+			elk_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], '');
75
+	}
74 76
 
75 77
 	// Any alias URLs?  This is mainly for use with frames, etc.
76 78
 	if (!empty($modSettings['forum_alias_urls']))
@@ -87,7 +89,9 @@  discard block
 block discarded – undo
87 89
 			$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
88 90
 
89 91
 			if ($cookie_url[0] == '')
90
-				$cookie_url[0] = strtok($alias, '/');
92
+			{
93
+							$cookie_url[0] = strtok($alias, '/');
94
+			}
91 95
 
92 96
 			elk_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], $cookie_url[0]);
93 97
 		}
@@ -142,22 +146,32 @@  discard block
 block discarded – undo
142 146
 
143 147
 	// Is local cookies off?
144 148
 	if (empty($parsed_url['path']) || !$local)
145
-		$parsed_url['path'] = '';
149
+	{
150
+			$parsed_url['path'] = '';
151
+	}
146 152
 
147 153
 	if (!empty($modSettings['globalCookiesDomain']) && strpos($boardurl, $modSettings['globalCookiesDomain']) !== false)
148
-		$parsed_url['host'] = $modSettings['globalCookiesDomain'];
154
+	{
155
+			$parsed_url['host'] = $modSettings['globalCookiesDomain'];
156
+	}
149 157
 
150 158
 	// Globalize cookies across domains (filter out IP-addresses)?
151 159
 	elseif ($global && preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']) == 0 && preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
152
-		$parsed_url['host'] = '.' . $parts[1];
160
+	{
161
+			$parsed_url['host'] = '.' . $parts[1];
162
+	}
153 163
 
154 164
 	// We shouldn't use a host at all if both options are off.
155 165
 	elseif (!$local && !$global)
156
-		$parsed_url['host'] = '';
166
+	{
167
+			$parsed_url['host'] = '';
168
+	}
157 169
 
158 170
 	// The host also shouldn't be set if there aren't any dots in it.
159 171
 	elseif (!isset($parsed_url['host']) || strpos($parsed_url['host'], '.') === false)
160
-		$parsed_url['host'] = '';
172
+	{
173
+			$parsed_url['host'] = '';
174
+	}
161 175
 
162 176
 	return array($parsed_url['host'], $parsed_url['path'] . '/');
163 177
 }
@@ -197,9 +211,13 @@  discard block
 block discarded – undo
197 211
 		Errors::instance()->log_error($txt['security_wrong'], 'critical');
198 212
 
199 213
 		if (isset($_POST[$type . '_hash_pass']))
200
-			unset($_POST[$type . '_hash_pass']);
214
+		{
215
+					unset($_POST[$type . '_hash_pass']);
216
+		}
201 217
 		if (isset($_POST[$type . '_pass']))
202
-			unset($_POST[$type . '_pass']);
218
+		{
219
+					unset($_POST[$type . '_pass']);
220
+		}
203 221
 
204 222
 		$context['incorrect_password'] = true;
205 223
 	}
@@ -213,14 +231,18 @@  discard block
 block discarded – undo
213 231
 	// Now go through $_POST.  Make sure the session hash is sent.
214 232
 	$_POST[$context['session_var']] = $context['session_id'];
215 233
 	foreach ($_POST as $k => $v)
216
-		$context['post_data'] .= adminLogin_outputPostVars($k, $v);
234
+	{
235
+			$context['post_data'] .= adminLogin_outputPostVars($k, $v);
236
+	}
217 237
 
218 238
 	// Now we'll use the admin_login sub template of the Login template.
219 239
 	$context['sub_template'] = 'admin_login';
220 240
 
221 241
 	// And title the page something like "Login".
222 242
 	if (!isset($context['page_title']))
223
-		$context['page_title'] = $txt['admin_login'];
243
+	{
244
+			$context['page_title'] = $txt['admin_login'];
245
+	}
224 246
 
225 247
 	// The type of action.
226 248
 	$context['sessionCheckType'] = $type;
@@ -245,13 +267,17 @@  discard block
 block discarded – undo
245 267
 function adminLogin_outputPostVars($k, $v)
246 268
 {
247 269
 	if (!is_array($v))
248
-		return '
270
+	{
271
+			return '
249 272
 <input type="hidden" name="' . htmlspecialchars($k, ENT_COMPAT, 'UTF-8') . '" value="' . strtr($v, array('"' => '&quot;', '<' => '&lt;', '>' => '&gt;')) . '" />';
273
+	}
250 274
 	else
251 275
 	{
252 276
 		$ret = '';
253 277
 		foreach ($v as $k2 => $v2)
254
-			$ret .= adminLogin_outputPostVars($k . '[' . $k2 . ']', $v2);
278
+		{
279
+					$ret .= adminLogin_outputPostVars($k . '[' . $k2 . ']', $v2);
280
+		}
255 281
 
256 282
 		return $ret;
257 283
 	}
@@ -280,17 +306,23 @@  discard block
 block discarded – undo
280 306
 		{
281 307
 			// Only if it's not already in the $scripturl!
282 308
 			if (!isset($temp[$k]))
283
-				$query_string .= urlencode($k) . '=' . urlencode($v) . ';';
309
+			{
310
+							$query_string .= urlencode($k) . '=' . urlencode($v) . ';';
311
+			}
284 312
 			// If it changed, put it out there, but with an ampersand.
285 313
 			elseif ($temp[$k] != $get[$k])
286
-				$query_string .= urlencode($k) . '=' . urlencode($v) . '&amp;';
314
+			{
315
+							$query_string .= urlencode($k) . '=' . urlencode($v) . '&amp;';
316
+			}
287 317
 		}
288 318
 	}
289 319
 	else
290 320
 	{
291 321
 		// Add up all the data from $_GET into get_data.
292 322
 		foreach ($get as $k => $v)
293
-			$query_string .= urlencode($k) . '=' . urlencode($v) . ';';
323
+		{
324
+					$query_string .= urlencode($k) . '=' . urlencode($v) . ';';
325
+		}
294 326
 	}
295 327
 
296 328
 	$query_string = substr($query_string, 0, -1);
@@ -320,7 +352,9 @@  discard block
 block discarded – undo
320 352
 
321 353
 	// If it's not already an array, make it one.
322 354
 	if (!is_array($names))
323
-		$names = explode(',', $names);
355
+	{
356
+			$names = explode(',', $names);
357
+	}
324 358
 
325 359
 	$maybe_email = false;
326 360
 	foreach ($names as $i => $name)
@@ -332,9 +366,12 @@  discard block
 block discarded – undo
332 366
 
333 367
 		// Make it so standard wildcards will work. (* and ?)
334 368
 		if ($use_wildcards)
335
-			$names[$i] = strtr($names[$i], array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_', '\'' => '&#039;'));
336
-		else
337
-			$names[$i] = strtr($names[$i], array('\'' => '&#039;'));
369
+		{
370
+					$names[$i] = strtr($names[$i], array('%' => '\%', '_' => '\_', '*' => '%', '?' => '_', '\'' => '&#039;'));
371
+		}
372
+		else {
373
+					$names[$i] = strtr($names[$i], array('\'' => '&#039;'));
374
+		}
338 375
 		$names[$i] = $db->quote('{string:name}', array('name' => $names[$i]));
339 376
 	}
340 377
 
@@ -348,10 +385,13 @@  discard block
 block discarded – undo
348 385
 	$email_condition = allowedTo('moderate_forum') ? '' : 'hide_email = 0 AND ';
349 386
 
350 387
 	if ($use_wildcards || $maybe_email)
351
-		$email_condition = '
388
+	{
389
+			$email_condition = '
352 390
 			OR (' . $email_condition . 'email_address ' . $comparison . ' ' . implode( ') OR (' . $email_condition . ' email_address ' . $comparison . ' ', $names) . ')';
353
-	else
354
-		$email_condition = '';
391
+	}
392
+	else {
393
+			$email_condition = '';
394
+	}
355 395
 
356 396
 	// Get the case of the columns right - but only if we need to as things like MySQL will go slow needlessly otherwise.
357 397
 	$member_name = defined('DB_CASE_SENSITIVE') ? 'LOWER(member_name)' : 'member_name';
@@ -451,13 +491,16 @@  discard block
 block discarded – undo
451 491
 		// Otherwise grab all of them and don't log anything
452 492
 		$error_severity = $errors->hasErrors(1) && !$user_info['is_admin'] ? 1 : null;
453 493
 		foreach ($errors->prepareErrors($error_severity) as $error)
454
-			throw new Elk_Exception($error, $error_severity === null ? false : 'general');
494
+		{
495
+					throw new Elk_Exception($error, $error_severity === null ? false : 'general');
496
+		}
455 497
 
456 498
 		// Update the database...
457 499
 		updateMemberData($memID, array('member_name' => $user, 'passwd' => $db_hash));
458 500
 	}
459
-	else
460
-		updateMemberData($memID, array('passwd' => $db_hash));
501
+	else {
502
+			updateMemberData($memID, array('passwd' => $db_hash));
503
+	}
461 504
 
462 505
 	call_integration_hook('integrate_reset_pass', array($old_user, $user, $newPassword));
463 506
 
@@ -494,24 +537,34 @@  discard block
 block discarded – undo
494 537
 
495 538
 	// Don't use too long a name.
496 539
 	if (Util::strlen($username) > 25)
497
-		$errors->addError('error_long_name');
540
+	{
541
+			$errors->addError('error_long_name');
542
+	}
498 543
 
499 544
 	// No name?!  How can you register with no name?
500 545
 	if ($username == '')
501
-		$errors->addError('need_username');
546
+	{
547
+			$errors->addError('need_username');
548
+	}
502 549
 
503 550
 	// Only these characters are permitted.
504 551
 	if (in_array($username, array('_', '|')) || preg_match('~[<>&"\'=\\\\]~', preg_replace('~&#(?:\\d{1,7}|x[0-9a-fA-F]{1,6});~', '', $username)) != 0 || strpos($username, '[code') !== false || strpos($username, '[/code') !== false)
505
-		$errors->addError('error_invalid_characters_username');
552
+	{
553
+			$errors->addError('error_invalid_characters_username');
554
+	}
506 555
 
507 556
 	if (stristr($username, $txt['guest_title']) !== false)
508
-		$errors->addError(array('username_reserved', array($txt['guest_title'])), 1);
557
+	{
558
+			$errors->addError(array('username_reserved', array($txt['guest_title'])), 1);
559
+	}
509 560
 
510 561
 	if ($check_reserved_name)
511 562
 	{
512 563
 		require_once(SUBSDIR . '/Members.subs.php');
513 564
 		if (isReservedName($username, $memID, false, $fatal))
514
-			$errors->addError(array('name_in_use', array(htmlspecialchars($username, ENT_COMPAT, 'UTF-8'))));
565
+		{
566
+					$errors->addError(array('name_in_use', array(htmlspecialchars($username, ENT_COMPAT, 'UTF-8'))));
567
+		}
515 568
 	}
516 569
 }
517 570
 
@@ -545,17 +598,25 @@  discard block
 block discarded – undo
545 598
 
546 599
 	// Is this enough?
547 600
 	if (empty($modSettings['password_strength']))
548
-		return null;
601
+	{
602
+			return null;
603
+	}
549 604
 
550 605
 	// Otherwise, perform the medium strength test - checking if password appears in the restricted string.
551 606
 	if (preg_match('~\b' . preg_quote($password, '~') . '\b~', implode(' ', $restrict_in)) != 0)
552
-		return 'restricted_words';
607
+	{
608
+			return 'restricted_words';
609
+	}
553 610
 	elseif (Util::strpos($password, $username) !== false)
554
-		return 'restricted_words';
611
+	{
612
+			return 'restricted_words';
613
+	}
555 614
 
556 615
 	// If just medium, we're done.
557 616
 	if ($modSettings['password_strength'] == 1)
558
-		return null;
617
+	{
618
+			return null;
619
+	}
559 620
 
560 621
 	// Otherwise, hard test next, check for numbers and letters, uppercase too.
561 622
 	$good = preg_match('~(\D\d|\d\D)~', $password) != 0;
@@ -596,7 +657,9 @@  discard block
 block discarded – undo
596 657
 
597 658
 	// If the password is not 64 characters, lets make it a (SHA-256)
598 659
 	if (strlen($password) !== 64)
599
-		$password = hash('sha256', Util::strtolower($user) . un_htmlspecialchars($password));
660
+	{
661
+			$password = hash('sha256', Util::strtolower($user) . un_htmlspecialchars($password));
662
+	}
600 663
 
601 664
 	// They need a password hash, something to save in the db?
602 665
 	if ($returnhash)
@@ -605,11 +668,14 @@  discard block
 block discarded – undo
605 668
 
606 669
 		// Something is not right, we can not generate a valid hash that's <20 characters
607 670
 		if (strlen($passhash) < 20)
608
-			$passhash = false;
671
+		{
672
+					$passhash = false;
673
+		}
609 674
 	}
610 675
 	// Or doing a password check?
611
-	else
612
-		$passhash = (bool) $hasher->CheckPassword($password, $hash);
676
+	else {
677
+			$passhash = (bool) $hasher->CheckPassword($password, $hash);
678
+	}
613 679
 
614 680
 	unset($hasher);
615 681
 
@@ -651,9 +717,12 @@  discard block
 block discarded – undo
651 717
 		);
652 718
 
653 719
 		if (empty($groups))
654
-			$group_query = '0=1';
655
-		else
656
-			$group_query = 'id_group IN (' . implode(',', $groups) . ')';
720
+		{
721
+					$group_query = '0=1';
722
+		}
723
+		else {
724
+					$group_query = 'id_group IN (' . implode(',', $groups) . ')';
725
+		}
657 726
 	}
658 727
 
659 728
 	// Then, same again, just the boards this time!
@@ -664,9 +733,12 @@  discard block
 block discarded – undo
664 733
 		$boards = boardsAllowedTo('moderate_board', true);
665 734
 
666 735
 		if (empty($boards))
667
-			$board_query = '0=1';
668
-		else
669
-			$board_query = 'id_board IN (' . implode(',', $boards) . ')';
736
+		{
737
+					$board_query = '0=1';
738
+		}
739
+		else {
740
+					$board_query = 'id_board IN (' . implode(',', $boards) . ')';
741
+		}
670 742
 	}
671 743
 
672 744
 	// What boards are they the moderator of?
@@ -717,9 +789,13 @@  discard block
 block discarded – undo
717 789
 
718 790
 	// In case a customization wants to override the default settings
719 791
 	if ($httponly === null)
720
-		$httponly = !empty($modSettings['httponlyCookies']);
792
+	{
793
+			$httponly = !empty($modSettings['httponlyCookies']);
794
+	}
721 795
 	if ($secure === null)
722
-		$secure = !empty($modSettings['secureCookies']);
796
+	{
797
+			$secure = !empty($modSettings['secureCookies']);
798
+	}
723 799
 
724 800
 	// Default value in modern browsers is Lax
725 801
 	$samesite = (empty($samesite)) ? 'Lax' : $samesite;
@@ -801,9 +877,12 @@  discard block
 block discarded – undo
801 877
 		if ($db->num_rows($request) == 0)
802 878
 		{
803 879
 			if ($fatal)
804
-				throw new Elk_Exception('no_user_with_email', false);
805
-			else
806
-				return false;
880
+			{
881
+							throw new Elk_Exception('no_user_with_email', false);
882
+			}
883
+			else {
884
+							return false;
885
+			}
807 886
 		}
808 887
 	}
809 888
 
@@ -914,7 +993,9 @@  discard block
 block discarded – undo
914 993
 
915 994
 	// Nothing? Ah the horror...
916 995
 	if ($db->num_rows($request) == 0)
917
-		$user_settings = false;
996
+	{
997
+			$user_settings = false;
998
+	}
918 999
 	else
919 1000
 	{
920 1001
 		$user_settings = $db->fetch_assoc($request);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 	if (isset($_COOKIE[$cookiename]))
47 47
 	{
48
-		$array = serializeToJson($_COOKIE[$cookiename], function ($array_from) use ($cookiename) {
48
+		$array = serializeToJson($_COOKIE[$cookiename], function($array_from) use ($cookiename) {
49 49
 			global $modSettings;
50 50
 
51 51
 			require_once(SUBSDIR . '/Auth.subs.php');
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
 	if ($use_wildcards || $maybe_email)
351 351
 		$email_condition = '
352
-			OR (' . $email_condition . 'email_address ' . $comparison . ' ' . implode( ') OR (' . $email_condition . ' email_address ' . $comparison . ' ', $names) . ')';
352
+			OR (' . $email_condition . 'email_address ' . $comparison . ' ' . implode(') OR (' . $email_condition . ' email_address ' . $comparison . ' ', $names) . ')';
353 353
 	else
354 354
 		$email_condition = '';
355 355
 
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 		LIMIT {int:limit}',
369 369
 		array(
370 370
 			'buddy_list' => $user_info['buddies'],
371
-			'member_name_search' => $member_name . ' ' . $comparison . ' ' . implode( ' OR ' . $member_name . ' ' . $comparison . ' ', $names) . '',
372
-			'real_name_search' => $real_name . ' ' . $comparison . ' ' . implode( ' OR ' . $real_name . ' ' . $comparison . ' ', $names) . '',
371
+			'member_name_search' => $member_name . ' ' . $comparison . ' ' . implode(' OR ' . $member_name . ' ' . $comparison . ' ', $names) . '',
372
+			'real_name_search' => $real_name . ' ' . $comparison . ' ' . implode(' OR ' . $real_name . ' ' . $comparison . ' ', $names) . '',
373 373
 			'email_condition' => $email_condition,
374 374
 			'limit' => $max,
375 375
 		)
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			array(
645 645
 				'current_member' => $user_info['id'],
646 646
 			),
647
-			function ($row)
647
+			function($row)
648 648
 			{
649 649
 				return $row['id_group'];
650 650
 			}
Please login to merge, or discard this patch.
sources/subs/Compat.subs.php 1 patch
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,14 +26,18 @@  discard block
 block discarded – undo
26 26
 {
27 27
 	// If we have mhash loaded in, use it instead!
28 28
 	if (function_exists('mhash') && defined('MHASH_SHA1'))
29
-		return bin2hex(mhash(MHASH_SHA1, $str));
29
+	{
30
+			return bin2hex(mhash(MHASH_SHA1, $str));
31
+	}
30 32
 
31 33
 	$nblk = (strlen($str) + 8 >> 6) + 1;
32 34
 	$blks = array_pad(array(), $nblk * 16, 0);
33 35
 
34 36
 	$str_len = strlen($str);
35 37
 	for ($i = 0; $i < $str_len; $i++)
36
-		$blks[$i >> 2] |= ord($str[$i]) << (24 - ($i % 4) * 8);
38
+	{
39
+			$blks[$i >> 2] |= ord($str[$i]) << (24 - ($i % 4) * 8);
40
+	}
37 41
 
38 42
 	$blks[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8);
39 43
 
@@ -69,9 +73,12 @@  discard block
 block discarded – undo
69 73
 		for ($j = 0; $j < 80; $j++)
70 74
 		{
71 75
 			if ($j < 16)
72
-				$w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0;
73
-			else
74
-				$w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1);
76
+			{
77
+							$w[$j] = isset($x[$i + $j]) ? $x[$i + $j] : 0;
78
+			}
79
+			else {
80
+							$w[$j] = sha1_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1);
81
+			}
75 82
 
76 83
 			$t = sha1_rol($a, 5) + sha1_ft($j, $b, $c, $d) + $e + $w[$j] + sha1_kt($j);
77 84
 			$e = $d;
@@ -102,11 +109,17 @@  discard block
 block discarded – undo
102 109
 function sha1_ft($t, $b, $c, $d)
103 110
 {
104 111
 	if ($t < 20)
105
-		return ($b & $c) | ((~$b) & $d);
112
+	{
113
+			return ($b & $c) | ((~$b) & $d);
114
+	}
106 115
 	if ($t < 40)
107
-		return $b ^ $c ^ $d;
116
+	{
117
+			return $b ^ $c ^ $d;
118
+	}
108 119
 	if ($t < 60)
109
-		return ($b & $c) | ($b & $d) | ($c & $d);
120
+	{
121
+			return ($b & $c) | ($b & $d) | ($c & $d);
122
+	}
110 123
 
111 124
 	return $b ^ $c ^ $d;
112 125
 }
@@ -131,9 +144,12 @@  discard block
 block discarded – undo
131 144
 {
132 145
 	// Unfortunately, PHP uses unsigned 32-bit longs only.  So we have to kludge it a bit.
133 146
 	if ($num & 0x80000000)
134
-		$a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt);
135
-	else
136
-		$a = $num >> (32 - $cnt);
147
+	{
148
+			$a = ($num >> 1 & 0x7fffffff) >> (31 - $cnt);
149
+	}
150
+	else {
151
+			$a = $num >> (32 - $cnt);
152
+	}
137 153
 
138 154
 	return ($num << $cnt) | $a;
139 155
 }
Please login to merge, or discard this patch.
sources/subs/Notification.subs.php 2 patches
Braces   +173 added lines, -63 removed lines patch added patch discarded remove patch
@@ -40,16 +40,22 @@  discard block
 block discarded – undo
40 40
 
41 41
 	// Can't do it if there's no topics.
42 42
 	if (empty($topics))
43
-		return;
43
+	{
44
+			return;
45
+	}
44 46
 
45 47
 	// It must be an array - it must!
46 48
 	if (!is_array($topics))
47
-		$topics = array($topics);
49
+	{
50
+			$topics = array($topics);
51
+	}
48 52
 
49 53
 	// I hope we are not sending one of those silly moderation notices
50 54
 	$maillist = !empty($modSettings['maillist_enabled']) && !empty($modSettings['pbe_post_enabled']);
51 55
 	if ($type !== 'reply' && !empty($maillist) && !empty($modSettings['pbe_no_mod_notices']))
52
-		return;
56
+	{
57
+			return;
58
+	}
53 59
 
54 60
 	// Load in our dependencies
55 61
 	require_once(SUBSDIR . '/Emailpost.subs.php');
@@ -98,23 +104,31 @@  discard block
 block discarded – undo
98 104
 
99 105
 	// Work out any exclusions...
100 106
 	foreach ($topics as $key => $id)
101
-		if (isset($topicData[$id]) && !empty($exclude[$key]))
107
+	{
108
+			if (isset($topicData[$id]) && !empty($exclude[$key]))
102 109
 			$topicData[$id]['exclude'] = (int) $exclude[$key];
110
+	}
103 111
 
104 112
 	// Nada?
105 113
 	if (empty($topicData))
106
-		trigger_error('sendNotifications(): topics not found', E_USER_NOTICE);
114
+	{
115
+			trigger_error('sendNotifications(): topics not found', E_USER_NOTICE);
116
+	}
107 117
 
108 118
 	$topics = array_keys($topicData);
109 119
 
110 120
 	// Just in case they've gone walkies.
111 121
 	if (empty($topics))
112
-		return;
122
+	{
123
+			return;
124
+	}
113 125
 
114 126
 	// Insert all of these items into the digest log for those who want notifications later.
115 127
 	$digest_insert = array();
116 128
 	foreach ($topicData as $id => $data)
117
-		$digest_insert[] = array($data['topic'], $data['last_id'], $type, (int) $data['exclude']);
129
+	{
130
+			$digest_insert[] = array($data['topic'], $data['last_id'], $type, (int) $data['exclude']);
131
+	}
118 132
 
119 133
 	$db->insert('',
120 134
 		'{db_prefix}log_digest',
@@ -162,28 +176,39 @@  discard block
 block discarded – undo
162 176
 			// If they are not the poster do they want to know?
163 177
 			// @todo maybe if they posted via email?
164 178
 			if ($type !== 'reply' && $row['notify_types'] == 2)
165
-				continue;
179
+			{
180
+							continue;
181
+			}
166 182
 
167 183
 			// for this member/board, loop through the topics and see if we should send it
168 184
 			foreach ($topicData as $id => $data)
169 185
 			{
170 186
 				// Don't send it if its not from the right board
171 187
 				if ($data['board'] !== $row['id_board'])
172
-					continue;
173
-				else
174
-					$data['board_name'] = $row['name'];
188
+				{
189
+									continue;
190
+				}
191
+				else {
192
+									$data['board_name'] = $row['name'];
193
+				}
175 194
 
176 195
 				// Don't do the excluded...
177 196
 				if ($data['exclude'] === $row['id_member'])
178
-					continue;
197
+				{
198
+									continue;
199
+				}
179 200
 
180 201
 				$email_perm = true;
181 202
 				if (validateNotificationAccess($row, $maillist, $email_perm) === false)
182
-					continue;
203
+				{
204
+									continue;
205
+				}
183 206
 
184 207
 				$needed_language = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
185 208
 				if (empty($current_language) || $current_language != $needed_language)
186
-					$current_language = loadLanguage('Post', $needed_language, false);
209
+				{
210
+									$current_language = loadLanguage('Post', $needed_language, false);
211
+				}
187 212
 
188 213
 				$message_type = 'notification_' . $type;
189 214
 				$replacements = array(
@@ -199,7 +224,9 @@  discard block
 block discarded – undo
199 224
 				);
200 225
 
201 226
 				if ($type === 'remove')
202
-					unset($replacements['TOPICLINK'], $replacements['UNSUBSCRIBELINK']);
227
+				{
228
+									unset($replacements['TOPICLINK'], $replacements['UNSUBSCRIBELINK']);
229
+				}
203 230
 
204 231
 				// Do they want the body of the message sent too?
205 232
 				if (!empty($row['notify_send_body']) && $type === 'reply')
@@ -209,11 +236,15 @@  discard block
 block discarded – undo
209 236
 
210 237
 					// Any attachments? if so lets make a big deal about them!
211 238
 					if ($data['attachments'] != 0)
212
-						$replacements['MESSAGE'] .= "\n\n" . sprintf($txt['message_attachments'], $data['attachments'], $replacements['TOPICLINK']);
239
+					{
240
+											$replacements['MESSAGE'] .= "\n\n" . sprintf($txt['message_attachments'], $data['attachments'], $replacements['TOPICLINK']);
241
+					}
213 242
 				}
214 243
 
215 244
 				if (!empty($row['notify_regularity']) && $type === 'reply')
216
-					$message_type .= '_once';
245
+				{
246
+									$message_type .= '_once';
247
+				}
217 248
 
218 249
 				// Give them a way to add in their own replacements
219 250
 				call_integration_hook('integrate_notification_replacements', array(&$replacements, $row, $type, $current_language));
@@ -234,8 +265,9 @@  discard block
 block discarded – undo
234 265
 						$from_wrapper = !empty($modSettings['maillist_mail_from']) ? $modSettings['maillist_mail_from'] : (empty($modSettings['maillist_sitename_address']) ? $webmaster_email : $modSettings['maillist_sitename_address']);
235 266
 						sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], $emailfrom, 'm' . $data['last_id'], false, 3, null, false, $from_wrapper, $id);
236 267
 					}
237
-					else
238
-						sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $data['last_id']);
268
+					else {
269
+											sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $data['last_id']);
270
+					}
239 271
 
240 272
 					$sent++;
241 273
 
@@ -278,24 +310,34 @@  discard block
 block discarded – undo
278 310
 	{
279 311
 		// Don't do the excluded...
280 312
 		if ($topicData[$row['id_topic']]['exclude'] == $row['id_member'])
281
-			continue;
313
+		{
314
+					continue;
315
+		}
282 316
 
283 317
 		// Don't do the ones that were sent via board notification, you only get one notice
284 318
 		if (isset($boards[$row['id_member']][$row['id_topic']]))
285
-			continue;
319
+		{
320
+					continue;
321
+		}
286 322
 
287 323
 		// Easier to check this here... if they aren't the topic poster do they really want to know?
288 324
 		// @todo perhaps just if they posted by email?
289 325
 		if ($type != 'reply' && $row['notify_types'] == 2 && $row['id_member'] != $row['id_member_started'])
290
-			continue;
326
+		{
327
+					continue;
328
+		}
291 329
 
292 330
 		$email_perm = true;
293 331
 		if (validateNotificationAccess($row, $maillist, $email_perm) === false)
294
-			continue;
332
+		{
333
+					continue;
334
+		}
295 335
 
296 336
 		$needed_language = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
297 337
 		if (empty($current_language) || $current_language != $needed_language)
298
-			$current_language = loadLanguage('Post', $needed_language, false);
338
+		{
339
+					$current_language = loadLanguage('Post', $needed_language, false);
340
+		}
299 341
 
300 342
 		$message_type = 'notification_' . $type;
301 343
 		$replacements = array(
@@ -311,7 +353,9 @@  discard block
 block discarded – undo
311 353
 		);
312 354
 
313 355
 		if ($type == 'remove')
314
-			unset($replacements['TOPICLINK'], $replacements['UNSUBSCRIBELINK']);
356
+		{
357
+					unset($replacements['TOPICLINK'], $replacements['UNSUBSCRIBELINK']);
358
+		}
315 359
 
316 360
 		// Do they want the body of the message sent too?
317 361
 		if (!empty($row['notify_send_body']) && $type == 'reply')
@@ -320,7 +364,9 @@  discard block
 block discarded – undo
320 364
 			$replacements['MESSAGE'] = $topicData[$row['id_topic']]['body'];
321 365
 		}
322 366
 		if (!empty($row['notify_regularity']) && $type == 'reply')
323
-			$message_type .= '_once';
367
+		{
368
+					$message_type .= '_once';
369
+		}
324 370
 
325 371
 		// Send only if once is off or it's on and it hasn't been sent.
326 372
 		if ($type != 'reply' || empty($row['notify_regularity']) || empty($row['sent']))
@@ -335,8 +381,9 @@  discard block
 block discarded – undo
335 381
 				$from_wrapper = !empty($modSettings['maillist_mail_from']) ? $modSettings['maillist_mail_from'] : (empty($modSettings['maillist_sitename_address']) ? $webmaster_email : $modSettings['maillist_sitename_address']);
336 382
 				sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], $emailfrom, 'm' . $data['last_id'], false, 3, null, false, $from_wrapper, $row['id_topic']);
337 383
 			}
338
-			else
339
-				sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $topicData[$row['id_topic']]['last_id']);
384
+			else {
385
+							sendmail($row['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $topicData[$row['id_topic']]['last_id']);
386
+			}
340 387
 
341 388
 			$sent++;
342 389
 		}
@@ -344,11 +391,14 @@  discard block
 block discarded – undo
344 391
 	$db->free_result($members);
345 392
 
346 393
 	if (isset($current_language) && $current_language != $user_language)
347
-		loadLanguage('Post');
394
+	{
395
+			loadLanguage('Post');
396
+	}
348 397
 
349 398
 	// Sent!
350 399
 	if ($type == 'reply' && !empty($sent))
351
-		$db->query('', '
400
+	{
401
+			$db->query('', '
352 402
 			UPDATE {db_prefix}log_notify
353 403
 			SET sent = {int:is_sent}
354 404
 			WHERE id_topic IN ({array_int:topic_list})
@@ -359,6 +409,7 @@  discard block
 block discarded – undo
359 409
 				'is_sent' => 1,
360 410
 			)
361 411
 		);
412
+	}
362 413
 
363 414
 	// For approvals we need to unsend the exclusions (This *is* the quickest way!)
364 415
 	if (!empty($sent) && !empty($exclude))
@@ -404,7 +455,9 @@  discard block
 block discarded – undo
404 455
 
405 456
 	// Do we have one or lots of topics?
406 457
 	if (isset($topicData['body']))
407
-		$topicData = array($topicData);
458
+	{
459
+			$topicData = array($topicData);
460
+	}
408 461
 
409 462
 	// Using the post to email functions?
410 463
 	$maillist = !empty($modSettings['maillist_enabled']) && !empty($modSettings['pbe_post_enabled']);
@@ -414,7 +467,9 @@  discard block
 block discarded – undo
414 467
 	foreach ($topicData as $key => $topic)
415 468
 	{
416 469
 		if (!empty($topic['board']))
417
-			$boards[$topic['board']][] = $key;
470
+		{
471
+					$boards[$topic['board']][] = $key;
472
+		}
418 473
 		else
419 474
 		{
420 475
 			unset($topic[$key]);
@@ -428,7 +483,9 @@  discard block
 block discarded – undo
428 483
 	// Just the board numbers.
429 484
 	$board_index = array_unique(array_keys($boards));
430 485
 	if (empty($board_index))
431
-		return;
486
+	{
487
+			return;
488
+	}
432 489
 
433 490
 	// Load the actual board names
434 491
 	require_once(SUBSDIR . '/Boards.subs.php');
@@ -437,7 +494,9 @@  discard block
 block discarded – undo
437 494
 	// Yea, we need to add this to the digest queue.
438 495
 	$digest_insert = array();
439 496
 	foreach ($topicData as $id => $data)
440
-		$digest_insert[] = array($data['topic'], $data['msg'], 'topic', $user_info['id']);
497
+	{
498
+			$digest_insert[] = array($data['topic'], $data['msg'], 'topic', $user_info['id']);
499
+	}
441 500
 	$db->insert('',
442 501
 		'{db_prefix}log_digest',
443 502
 		array(
@@ -475,13 +534,17 @@  discard block
 block discarded – undo
475 534
 	{
476 535
 		$email_perm = true;
477 536
 		if (validateNotificationAccess($rowmember, $maillist, $email_perm) === false)
478
-			continue;
537
+		{
538
+					continue;
539
+		}
479 540
 
480 541
 		$langloaded = loadLanguage('index', empty($rowmember['lngfile']) || empty($modSettings['userLanguage']) ? $language : $rowmember['lngfile'], false);
481 542
 
482 543
 		// Now loop through all the notifications to send for this board.
483 544
 		if (empty($boards[$rowmember['id_board']]))
484
-			continue;
545
+		{
546
+					continue;
547
+		}
485 548
 
486 549
 		$sentOnceAlready = 0;
487 550
 
@@ -491,7 +554,9 @@  discard block
 block discarded – undo
491 554
 			// Don't notify the guy who started the topic!
492 555
 			// @todo In this case actually send them a "it's approved hooray" email :P
493 556
 			if ($topicData[$key]['poster'] == $rowmember['id_member'])
494
-				continue;
557
+			{
558
+							continue;
559
+			}
495 560
 
496 561
 			// Setup the string for adding the body to the message, if a user wants it.
497 562
 			$send_body = $maillist || (empty($modSettings['disallow_sendBody']) && !empty($rowmember['notify_send_body']));
@@ -513,9 +578,13 @@  discard block
 block discarded – undo
513 578
 
514 579
 			// Send only if once is off or it's on and it hasn't been sent.
515 580
 			if (!empty($rowmember['notify_regularity']) && !$sentOnceAlready && empty($rowmember['sent']))
516
-				$emailtype = 'notify_boards_once';
581
+			{
582
+							$emailtype = 'notify_boards_once';
583
+			}
517 584
 			elseif (empty($rowmember['notify_regularity']))
518
-				$emailtype = 'notify_boards';
585
+			{
586
+							$emailtype = 'notify_boards';
587
+			}
519 588
 
520 589
 			if (!empty($emailtype))
521 590
 			{
@@ -530,8 +599,9 @@  discard block
 block discarded – undo
530 599
 					$from_wrapper = !empty($modSettings['maillist_mail_from']) ? $modSettings['maillist_mail_from'] : (empty($modSettings['maillist_sitename_address']) ? $webmaster_email : $modSettings['maillist_sitename_address']);
531 600
 					sendmail($rowmember['email_address'], $emaildata['subject'], $emaildata['body'], $emailname, 't' . $topicData[$key]['topic'], false, 3, null, false, $from_wrapper, $topicData[$key]['topic']);
532 601
 				}
533
-				else
534
-					sendmail($rowmember['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 3);
602
+				else {
603
+									sendmail($rowmember['email_address'], $emaildata['subject'], $emaildata['body'], null, null, false, 3);
604
+				}
535 605
 			}
536 606
 
537 607
 			$sentOnceAlready = 1;
@@ -569,7 +639,9 @@  discard block
 block discarded – undo
569 639
 
570 640
 	// Clean up the data...
571 641
 	if (!is_array($topicData) || empty($topicData))
572
-		return;
642
+	{
643
+			return;
644
+	}
573 645
 
574 646
 	// Email ahoy
575 647
 	require_once(SUBSDIR . '/Mail.subs.php');
@@ -634,12 +706,16 @@  discard block
 block discarded – undo
634 706
 			$row['additional_groups'][] = $row['id_post_group'];
635 707
 
636 708
 			if (count(array_intersect($allowed, $row['additional_groups'])) == 0)
637
-				continue;
709
+			{
710
+							continue;
711
+			}
638 712
 		}
639 713
 
640 714
 		$needed_language = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
641 715
 		if (empty($current_language) || $current_language != $needed_language)
642
-			$current_language = loadLanguage('Post', $needed_language, false);
716
+		{
717
+					$current_language = loadLanguage('Post', $needed_language, false);
718
+		}
643 719
 
644 720
 		$sent_this_time = false;
645 721
 		$replacements = array(
@@ -666,7 +742,9 @@  discard block
 block discarded – undo
666 742
 			}
667 743
 
668 744
 			if (!empty($row['notify_regularity']))
669
-				$message_type .= '_once';
745
+			{
746
+							$message_type .= '_once';
747
+			}
670 748
 
671 749
 			// Send only if once is off or it's on and it hasn't been sent.
672 750
 			if (empty($row['notify_regularity']) || (empty($row['sent']) && !$sent_this_time))
@@ -682,11 +760,14 @@  discard block
 block discarded – undo
682 760
 	$db->free_result($members);
683 761
 
684 762
 	if (isset($current_language) && $current_language != $user_info['language'])
685
-		loadLanguage('Post');
763
+	{
764
+			loadLanguage('Post');
765
+	}
686 766
 
687 767
 	// Sent!
688 768
 	if (!empty($sent))
689
-		$db->query('', '
769
+	{
770
+			$db->query('', '
690 771
 			UPDATE {db_prefix}log_notify
691 772
 			SET sent = {int:is_sent}
692 773
 			WHERE id_topic IN ({array_int:topic_list})
@@ -697,7 +778,8 @@  discard block
 block discarded – undo
697 778
 				'is_sent' => 1,
698 779
 			)
699 780
 		);
700
-}
781
+	}
782
+	}
701 783
 
702 784
 /**
703 785
  * This simple function gets a list of all administrators and sends them an email
@@ -720,7 +802,9 @@  discard block
 block discarded – undo
720 802
 
721 803
 	// If the setting isn't enabled then just exit.
722 804
 	if (empty($modSettings['notify_new_registration']))
723
-		return;
805
+	{
806
+			return;
807
+	}
724 808
 
725 809
 	// Needed to notify admins, or anyone
726 810
 	require_once(SUBSDIR . '/Mail.subs.php');
@@ -750,7 +834,9 @@  discard block
 block discarded – undo
750 834
 		)
751 835
 	);
752 836
 	while ($row = $db->fetch_assoc($request))
753
-		$groups[] = $row['id_group'];
837
+	{
838
+			$groups[] = $row['id_group'];
839
+	}
754 840
 	$db->free_result($request);
755 841
 
756 842
 	// Add administrators too...
@@ -795,8 +881,10 @@  discard block
 block discarded – undo
795 881
 	$db->free_result($request);
796 882
 
797 883
 	if (isset($current_language) && $current_language != $user_info['language'])
798
-		loadLanguage('Login');
799
-}
884
+	{
885
+			loadLanguage('Login');
886
+	}
887
+	}
800 888
 
801 889
 /**
802 890
  * Checks if a user has the correct access to get notifications
@@ -826,18 +914,24 @@  discard block
 block discarded – undo
826 914
 
827 915
 	// No need to check for you ;)
828 916
 	if ($row['id_group'] == 1 || in_array('1', $row['additional_groups']))
829
-		return $email_perm;
917
+	{
918
+			return $email_perm;
919
+	}
830 920
 
831 921
 	// They do have access to this board?
832 922
 	if (count(array_intersect($allowed, $row['additional_groups'])) === 0)
833
-		return false;
923
+	{
924
+			return false;
925
+	}
834 926
 
835 927
 	// If using maillist, see if they should get a reply-able message
836 928
 	if ($maillist)
837 929
 	{
838 930
 		// Perhaps they don't require a security key in the message
839 931
 		if (!empty($modSettings['postmod_active']) && !empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $row['warning'])
840
-			$email_perm = false;
932
+		{
933
+					$email_perm = false;
934
+		}
841 935
 		else
842 936
 		{
843 937
 			if (!isset($board_profile[$row['id_board']]))
@@ -848,12 +942,16 @@  discard block
 block discarded – undo
848 942
 
849 943
 			// In a group that has email posting permissions on this board
850 944
 			if (count(array_intersect($board_profile[$row['id_board']]['allowed'], $row['additional_groups'])) === 0)
851
-				$email_perm = false;
945
+			{
946
+							$email_perm = false;
947
+			}
852 948
 
853 949
 			// And not specifically denied?
854 950
 			if ($email_perm && !empty($modSettings['permission_enable_deny'])
855 951
 				&& count(array_intersect($row['additional_groups'], $board_profile[$row['id_board']]['denied'])) !== 0)
856
-				$email_perm = false;
952
+			{
953
+							$email_perm = false;
954
+			}
857 955
 		}
858 956
 	}
859 957
 
@@ -889,7 +987,9 @@  discard block
 block discarded – undo
889 987
 	while ($row = $db->fetch_assoc($request))
890 988
 	{
891 989
 		if (!isset($results[$row['id_member']]))
892
-			$results[$row['id_member']] = array();
990
+		{
991
+					$results[$row['id_member']] = array();
992
+		}
893 993
 
894 994
 		$results[$row['id_member']][$row['mention_type']] = (int) $row['notification_level'];
895 995
 	}
@@ -911,7 +1011,9 @@  discard block
 block discarded – undo
911 1011
 	{
912 1012
 		$preferences[$member] = $defaults;
913 1013
 		if (isset($results[$member]))
914
-		$preferences[$member] = array_merge($preferences[$member], $results[$member]);
1014
+		{
1015
+				$preferences[$member] = array_merge($preferences[$member], $results[$member]);
1016
+		}
915 1017
 	}
916 1018
 
917 1019
 	return $preferences;
@@ -949,7 +1051,9 @@  discard block
 block discarded – undo
949 1051
 	}
950 1052
 
951 1053
 	if (empty($inserts))
952
-		return;
1054
+	{
1055
+			return;
1056
+	}
953 1057
 
954 1058
 	$db->insert('',
955 1059
 		'{db_prefix}notifications_pref',
@@ -975,13 +1079,17 @@  discard block
 block discarded – undo
975 1079
 	$unserialized = getConfiguredNotificationMethods($type);
976 1080
 
977 1081
 	if (empty($unserialized))
978
-		return array();
1082
+	{
1083
+			return array();
1084
+	}
979 1085
 
980 1086
 	$allowed = array();
981 1087
 	foreach ($possible_methods as $key => $val)
982 1088
 	{
983 1089
 		if (isset($unserialized[$val]))
984
-			$allowed[$key] = $val;
1090
+		{
1091
+					$allowed[$key] = $val;
1092
+		}
985 1093
 	}
986 1094
 
987 1095
 	return $allowed;
@@ -999,7 +1107,9 @@  discard block
 block discarded – undo
999 1107
 	static $unserialized = null;
1000 1108
 
1001 1109
 	if ($unserialized === null)
1002
-		$unserialized = unserialize($modSettings['notification_methods']);
1110
+	{
1111
+			$unserialized = unserialize($modSettings['notification_methods']);
1112
+	}
1003 1113
 
1004 1114
 	if (isset($unserialized[$type]))
1005 1115
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1074,7 +1074,7 @@
 block discarded – undo
1074 1074
 		return false;
1075 1075
 	}
1076 1076
 
1077
-	$blowfish_salt = '$2a$07$' . $memSalt . $modSettings['unsubscribe_site_salt']. '$';
1077
+	$blowfish_salt = '$2a$07$' . $memSalt . $modSettings['unsubscribe_site_salt'] . '$';
1078 1078
 	$expected = substr($blowfish_salt, 0, 28) . $hash;
1079 1079
 	$check = crypt($area . $memEmail . $memSalt, $blowfish_salt);
1080 1080
 
Please login to merge, or discard this patch.