Passed
Push — patch_1-1-9 ( d927f0...e2616d )
by Spuds
01:06 queued 27s
created
ssi_examples.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 			</li>
135 135
 		</ul>
136 136
 		<?php if ($user_info['is_admin'])
137
-		{
137
+{
138 138
 			?>
139 139
 			<h3>Advanced Functions <i class="helpicon i-help" title="Functions that require additional tweaking, not just copy and paste."></i></h3>
140 140
 			<ul>
@@ -950,10 +950,12 @@  discard block
 block discarded – undo
950 950
 	$topics = ssi_recentTopics(8, null, null, 'array');
951 951
 
952 952
 	foreach ($topics as $topic)
953
-		echo '
953
+	{
954
+			echo '
954 955
 			<li>
955 956
 				<a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '
956 957
 			</li>';
958
+	}
957 959
 
958 960
 	unset($topics);
959 961
 
Please login to merge, or discard this patch.
emailtopic.php 1 patch
Braces   +2 added lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 
22 22
 // Only work for a pipe and direct calling
23 23
 if (!defined('STDIN'))
24
+{
24 25
 	return;
26
+}
25 27
 
26 28
 // Any output here is not good, it will be bounced as email
27 29
 error_reporting(0);
Please login to merge, or discard this patch.
subscriptions.php 1 patch
Braces   +37 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 // Start things rolling by getting the forum alive...
20 20
 if (!file_exists(dirname(__FILE__) . '/bootstrap.php'))
21
+{
21 22
 	die('Unable to initialize');
23
+}
22 24
 
23 25
 global $ssi_guest_access;
24 26
 
@@ -44,19 +46,23 @@  discard block
 block discarded – undo
44 46
 
45 47
 // I assume we're even active?
46 48
 if (empty($modSettings['paid_enabled']))
49
+{
47 50
 	exit;
51
+}
48 52
 
49 53
 // If we have some custom people who find out about problems load them here.
50 54
 $notify_users = array();
51 55
 if (!empty($modSettings['paid_email_to']))
52 56
 {
53 57
 	foreach (explode(',', $modSettings['paid_email_to']) as $email)
54
-		$notify_users[] = array(
58
+	{
59
+			$notify_users[] = array(
55 60
 			'email' => $email,
56 61
 			'name' => $txt['who_member'],
57 62
 			'id' => 0,
58 63
 		);
59
-}
64
+	}
65
+	}
60 66
 
61 67
 $db = database();
62 68
 
@@ -75,7 +81,9 @@  discard block
 block discarded – undo
75 81
 }
76 82
 
77 83
 if (empty($txnType))
84
+{
78 85
 	generateSubscriptionError($txt['paid_unknown_transaction_type']);
86
+}
79 87
 
80 88
 // Get the subscription and member ID amongst others...
81 89
 @list($subscription_id, $member_id) = $gatewayClass->precheck();
@@ -86,14 +94,18 @@  discard block
 block discarded – undo
86 94
 
87 95
 // This would be bad...
88 96
 if (empty($member_id))
97
+{
89 98
 	generateSubscriptionError($txt['paid_empty_member']);
99
+}
90 100
 
91 101
 // Verify the member.
92 102
 $member_info = getBasicMemberData($member_id);
93 103
 
94 104
 // Didn't find them?
95 105
 if (empty($member_info))
106
+{
96 107
 	generateSubscriptionError(sprintf($txt['paid_could_not_find_member'], $member_id));
108
+}
97 109
 
98 110
 // Get the subscription details.
99 111
 $request = $db->query('', '
@@ -107,7 +119,9 @@  discard block
 block discarded – undo
107 119
 
108 120
 // Didn't find it?
109 121
 if ($db->num_rows($request) === 0)
122
+{
110 123
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription'], $member_id, $subscription_id));
124
+}
111 125
 
112 126
 $subscription_info = $db->fetch_assoc($request);
113 127
 $db->free_result($request);
@@ -125,7 +139,9 @@  discard block
 block discarded – undo
125 139
 	)
126 140
 );
127 141
 if ($db->num_rows($request) == 0)
142
+{
128 143
 	generateSubscriptionError(sprintf($txt['paid_count_not_find_subscription_log'], $member_id, $subscription_id));
144
+}
129 145
 $subscription_info += $db->fetch_assoc($request);
130 146
 $db->free_result($request);
131 147
 
@@ -160,7 +176,9 @@  discard block
 block discarded – undo
160 176
 	{
161 177
 		$real_details = Util::unserialize($subscription_info['pending_details']);
162 178
 		if (empty($real_details))
163
-			generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
179
+		{
180
+					generateSubscriptionError(sprintf($txt['paid_count_not_find_outstanding_payment'], $member_id, $subscription_id));
181
+		}
164 182
 
165 183
 		// Now we just try to find anything pending.
166 184
 		// We don't really care which it is as security happens later.
@@ -168,7 +186,9 @@  discard block
 block discarded – undo
168 186
 		{
169 187
 			unset($real_details[$id]);
170 188
 			if ($detail[3] == 'payback' && $subscription_info['payments_pending'])
171
-				$subscription_info['payments_pending']--;
189
+			{
190
+							$subscription_info['payments_pending']--;
191
+			}
172 192
 			break;
173 193
 		}
174 194
 
@@ -186,9 +206,13 @@  discard block
 block discarded – undo
186 206
 		foreach ($cost as $duration => $value)
187 207
 		{
188 208
 			if ($duration == 'fixed')
189
-				continue;
209
+			{
210
+							continue;
211
+			}
190 212
 			elseif ((float) $value == (float) $total_cost)
191
-				$found_duration = strtoupper(substr($duration, 0, 1));
213
+			{
214
+							$found_duration = strtoupper(substr($duration, 0, 1));
215
+			}
192 216
 		}
193 217
 
194 218
 		// If we have the duration then we're done.
@@ -231,8 +255,10 @@  discard block
 block discarded – undo
231 255
 elseif ($gatewayClass->isCancellation())
232 256
 {
233 257
 	if (method_exists($gatewayClass, 'processCancelation'))
234
-		$gatewayClass->processCancelation($subscription_id, $member_id, $subscription_info);
235
-}
258
+	{
259
+			$gatewayClass->processCancelation($subscription_id, $member_id, $subscription_info);
260
+	}
261
+	}
236 262
 else
237 263
 {
238 264
 	// Some other "valid" transaction such as:
@@ -271,7 +297,9 @@  discard block
 block discarded – undo
271 297
 	if (!empty($_POST))
272 298
 	{
273 299
 		foreach ($_POST as $key => $val)
274
-			$text .= '<br />' . Util::htmlspecialchars($key) . ': ' . Util::htmlspecialchars($val);
300
+		{
301
+					$text .= '<br />' . Util::htmlspecialchars($key) . ': ' . Util::htmlspecialchars($val);
302
+		}
275 303
 	}
276 304
 
277 305
 	// Then just log and die.
Please login to merge, or discard this patch.
emailpost.php 1 patch
Braces   +2 added lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 
22 22
 // Only do something for a pipe and direct calling
23 23
 if (!defined('STDIN'))
24
+{
24 25
 	return;
26
+}
25 27
 
26 28
 // Any output here is not good
27 29
 error_reporting(0);
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,14 +23,18 @@  discard block
 block discarded – undo
23 23
 
24 24
 // Turn on output buffering if it isn't already on (via php.ini for example)
25 25
 if (!ob_get_level())
26
+{
26 27
 	ob_start();
28
+}
27 29
 
28 30
 // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out!
29 31
 if (isset($_GET['scheduled']))
30 32
 {
31 33
 	// Don't make people wait on us if we can help it.
32 34
 	if (function_exists('fastcgi_finish_request'))
33
-		fastcgi_finish_request();
35
+	{
36
+			fastcgi_finish_request();
37
+	}
34 38
 
35 39
 	$controller = new ScheduledTasks_Controller();
36 40
 	$controller->action_autotask();
@@ -41,7 +45,9 @@  discard block
 block discarded – undo
41 45
 {
42 46
 	// If zlib is being used, turn off output compression.
43 47
 	if (detectServer()->outPutCompressionEnabled())
44
-		$modSettings['enableCompressedOutput'] = 0;
48
+	{
49
+			$modSettings['enableCompressedOutput'] = 0;
50
+	}
45 51
 	else
46 52
 	{
47 53
 		@ob_end_clean();
@@ -126,7 +132,9 @@  discard block
 block discarded – undo
126 132
 
127 133
 			// Track forum statistics and hits...?
128 134
 			if (!empty($modSettings['hitStats']))
129
-				trackStats(array('hits' => '+'));
135
+			{
136
+							trackStats(array('hits' => '+'));
137
+			}
130 138
 		}
131 139
 
132 140
 		// Show where we came from, and go
Please login to merge, or discard this patch.
sources/subs/EmailFormat.class.php 1 patch
Braces   +81 added lines, -32 removed lines patch added patch discarded remove patch
@@ -162,7 +162,9 @@  discard block
 block discarded – undo
162 162
 	{
163 163
 		// Un-wordwrap the email, create a line by line array broken on the newlines
164 164
 		if ($bbc_br === true)
165
-			$data = str_replace('[br]', "\n", $data);
165
+		{
166
+					$data = str_replace('[br]', "\n", $data);
167
+		}
166 168
 		$temp = explode("\n", $data);
167 169
 
168 170
 		// Remove any 'stuck' whitespace using the trim value function on all lines
@@ -219,19 +221,24 @@  discard block
 block discarded – undo
219 221
 					$this->_body_array[$i - 1]['content'] = $this->_body_array[$i - 1]['content'] . "\n";
220 222
 					$this->_in_list = 0;
221 223
 				}
222
-				else
223
-					$this->_body_array[$i]['content'] = ' ' . trim($this->_body_array[$i]['content']);
224
+				else {
225
+									$this->_body_array[$i]['content'] = ' ' . trim($this->_body_array[$i]['content']);
226
+				}
224 227
 			}
225 228
 
226 229
 			// Long line in a sig ... but not a link then lets bail out might be a ps or something
227 230
 			if ($this->_found_sig && ($this->_body_array[$i]['length'] > $this->_sig_longline) && (substr($this->_body_array[$i]['content'], 0, 4) !== 'www.'))
228
-				$this->_found_sig = false;
231
+			{
232
+							$this->_found_sig = false;
233
+			}
229 234
 
230 235
 			// Blank line, if its not two in a row and not the start of a bbc code then insert a newline
231 236
 			if ($this->_body_array[$i]['content'] == '')
232 237
 			{
233 238
 				if ((isset($this->_body_array[$i - 1])) && ($this->_body_array[$i - 1]['content'] !== "\n") && (substr($this->_body_array[$i - 1]['content'], 0, 1) !== '[') && ($this->_body_array[$i - 1]['length'] > $this->_maillist_short_line))
234
-					$this->_body_array[$i]['content'] = "\n\n";
239
+				{
240
+									$this->_body_array[$i]['content'] = "\n\n";
241
+				}
235 242
 			}
236 243
 			// Lists like a. a) 1. 1)
237 244
 			elseif ($this->_body_array[$i]['list_item'])
@@ -249,9 +256,12 @@  discard block
 block discarded – undo
249 256
 			elseif (!empty($this->_maillist_leftover_remove) && preg_match('~^((\[b\]){0,2}(' . $this->_maillist_leftover_remove . ')(\[\/b\]){0,2})~', $this->_body_array[$i]['content']))
250 257
 			{
251 258
 				if ($this->_in_quote)
252
-					$this->_body_array[$i]['content'] = "\n";
253
-				else
254
-					$this->_body_array[$i]['content'] = $this->_body_array[$i]['content'] . "\n";
259
+				{
260
+									$this->_body_array[$i]['content'] = "\n";
261
+				}
262
+				else {
263
+									$this->_body_array[$i]['content'] = $this->_body_array[$i]['content'] . "\n";
264
+				}
255 265
 			}
256 266
 			// Line starts with a link .....
257 267
 			elseif (in_array(substr($this->_body_array[$i]['content'], 0, 4), array('www.', 'WWW.', 'http', 'HTTP')))
@@ -270,9 +280,12 @@  discard block
 block discarded – undo
270 280
 			{
271 281
 				// Its a wrap ... maybe
272 282
 				if ($i > 0)
273
-					$para_check = $this->_body_array[$i]['length'] - $this->_body_array[$i - 1]['length'];
274
-				else
275
-					$para_check = 1;
283
+				{
284
+									$para_check = $this->_body_array[$i]['length'] - $this->_body_array[$i - 1]['length'];
285
+				}
286
+				else {
287
+									$para_check = 1;
288
+				}
276 289
 
277 290
 				// If this line is longer than the line above it we need to do some extra checks
278 291
 				if (($i > 0) && ($this->_body_array[$i - 1]['length'] > $this->_maillist_short_line) && !$this->_found_sig && !$this->_in_code && !$this->_in_bbclist)
@@ -280,28 +293,40 @@  discard block
 block discarded – undo
280 293
 					// If the previous short line did not end in a period or it did and the next line does not start
281 294
 					// with a capital and passes para check then it wraps
282 295
 					if ((substr($this->_body_array[$i - 1]['content'], -1) !== '.') || (substr($this->_body_array[$i - 1]['content'], -1) === '.' && $para_check < $this->_para_check && ($this->_body_array[$i]['content'][0] !== strtoupper($this->_body_array[$i]['content'][0]))))
283
-						$this->_body_array[$i]['content'] .= '';
284
-					else
285
-						$this->_body_array[$i]['content'] = "\n" . $this->_body_array[$i]['content'];
296
+					{
297
+											$this->_body_array[$i]['content'] .= '';
298
+					}
299
+					else {
300
+											$this->_body_array[$i]['content'] = "\n" . $this->_body_array[$i]['content'];
301
+					}
286 302
 				}
287 303
 				elseif ($para_check < 5)
288
-					$this->_body_array[$i]['content'] = "\n" . $this->_body_array[$i]['content'];
304
+				{
305
+									$this->_body_array[$i]['content'] = "\n" . $this->_body_array[$i]['content'];
306
+				}
289 307
 				// A very short line (but not a empty one) followed by a very long line
290 308
 				elseif (isset($this->_body_array[$i - 1]) && !empty($this->_body_array[$i - 1]['content']) && $para_check > $this->_sig_longline && $this->_body_array[$i - 1]['length'] < 3)
291
-					$this->_body_array[$i]['content'] .= '';
292
-				else
293
-					$this->_body_array[$i]['content'] = "\n\n" . $this->_body_array[$i]['content'];
309
+				{
310
+									$this->_body_array[$i]['content'] .= '';
311
+				}
312
+				else {
313
+									$this->_body_array[$i]['content'] = "\n\n" . $this->_body_array[$i]['content'];
314
+				}
294 315
 			}
295 316
 		}
296 317
 
297 318
 		// Close any open quotes we may have left behind
298 319
 		for ($quotes = 1; $quotes <= $this->_in_quote; $quotes++)
299
-			$this->_body_array[$i + $quotes]['content'] = '[/quote]';
320
+		{
321
+					$this->_body_array[$i + $quotes]['content'] = '[/quote]';
322
+		}
300 323
 
301 324
 		// Join the message back together while dropping null index's
302 325
 		$temp = array();
303 326
 		foreach ($this->_body_array as $key => $values)
304
-			$temp[] = $values['content'];
327
+		{
328
+					$temp[] = $values['content'];
329
+		}
305 330
 		$this->_body = trim(implode(' ', array_values($temp)));
306 331
 	}
307 332
 
@@ -354,7 +379,9 @@  discard block
 block discarded – undo
354 379
 
355 380
 		// Any htmlenties that we want to remove, like ms smart ones?
356 381
 		if (preg_match('~&#8220;|&#8221;|&#8211;|&#8212;|&#8216|&#8217;~', $this->_body))
357
-			$this->_body = html_entity_decode($this->_body, ENT_QUOTES, 'UTF-8');
382
+		{
383
+					$this->_body = html_entity_decode($this->_body, ENT_QUOTES, 'UTF-8');
384
+		}
358 385
 
359 386
 		// Avoid double encoding later on
360 387
 		$this->_body = htmlspecialchars_decode($this->_body, ENT_QUOTES);
@@ -364,7 +391,9 @@  discard block
 block discarded – undo
364 391
 
365 392
 		// And its 1252 variants
366 393
 		if (strcasecmp($charset, 'UTF-8') !== 0)
367
-			$this->_body = strtr($this->_body, array(chr(145) => "'", chr(146) => "'", chr(147) => '"', chr(148) => '"', chr(150) => '-', chr(151) => '--', chr(133) => '...'));
394
+		{
395
+					$this->_body = strtr($this->_body, array(chr(145) => "'", chr(146) => "'", chr(147) => '"', chr(148) => '"', chr(150) => '-', chr(151) => '--', chr(133) => '...'));
396
+		}
368 397
 	}
369 398
 
370 399
 	/**
@@ -381,10 +410,14 @@  discard block
 block discarded – undo
381 410
 		{
382 411
 			// Make sure it is not a single line quote
383 412
 			if (!preg_match('~\[/quote\]?~', $var))
384
-				$this->_in_quote++;
413
+			{
414
+							$this->_in_quote++;
415
+			}
385 416
 		}
386 417
 		elseif (preg_match('~\[/quote\]?~', $var))
387
-			$this->_in_quote--;
418
+		{
419
+					$this->_in_quote--;
420
+		}
388 421
 	}
389 422
 
390 423
 	/**
@@ -396,13 +429,19 @@  discard block
 block discarded – undo
396 429
 	{
397 430
 		// Not in a sig yet, the line starts with a sig key as defined by the ACP, and its a short line of text
398 431
 		if (!$this->_found_sig && !empty($this->_maillist_sig_keys) && (preg_match('~^(' . $this->_maillist_sig_keys . ')~i', $this->_body_array[$i]['content']) && ($this->_body_array[$i]['length'] < $this->_maillist_short_line)))
399
-			return true;
432
+		{
433
+					return true;
434
+		}
400 435
 		// The line is simply just their name
401 436
 		elseif (($this->_body_array[$i]['content'] === $this->_real_name) && !$this->_found_sig)
402
-			return true;
437
+		{
438
+					return true;
439
+		}
403 440
 		// check for universal sig dashes
404 441
 		elseif (!$this->_found_sig && preg_match('~^-- \n~m', $this->_body_array[$i]['content']))
405
-			return true;
442
+		{
443
+					return true;
444
+		}
406 445
 
407 446
 		return false;
408 447
 	}
@@ -421,10 +460,14 @@  discard block
 block discarded – undo
421 460
 		{
422 461
 			// Make sure it is not a single line code
423 462
 			if (!preg_match('~\[/code\]?~', $var))
424
-				$this->_in_code++;
463
+			{
464
+							$this->_in_code++;
465
+			}
425 466
 		}
426 467
 		elseif (preg_match('~\[/code\]?~', $var))
427
-			$this->_in_code--;
468
+		{
469
+					$this->_in_code--;
470
+		}
428 471
 	}
429 472
 
430 473
 	/**
@@ -438,10 +481,14 @@  discard block
 block discarded – undo
438 481
 	{
439 482
 		// Starting a bbc list
440 483
 		if (preg_match('~\[list\]?~', $var))
441
-			$this->_in_bbclist++;
484
+		{
485
+					$this->_in_bbclist++;
486
+		}
442 487
 		// Ending a bbc list
443 488
 		elseif (preg_match('~\[\/list\]?~', $var))
444
-			$this->_in_bbclist--;
489
+		{
490
+					$this->_in_bbclist--;
491
+		}
445 492
 	}
446 493
 
447 494
 	/**
@@ -460,7 +507,9 @@  discard block
 block discarded – undo
460 507
 			|| preg_match('~' . chr(187) . '~', $var)
461 508
 			|| preg_match('~^[ \t]?\* ?~m', $var)
462 509
 		)
463
-			$this->_in_plainlist++;
510
+		{
511
+					$this->_in_plainlist++;
512
+		}
464 513
 
465 514
 		return $this->_in_plainlist !== $temp;
466 515
 	}
Please login to merge, or discard this patch.
sources/subs/EmailParse.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1383,7 +1383,9 @@
 block discarded – undo
1383 1383
 		{
1384 1384
 			$string = base64_decode($string);
1385 1385
 			if (isset($this->headers['content-type']) && strpos($this->headers['content-type'], 'text/') === false)
1386
-				return $string;
1386
+			{
1387
+							return $string;
1388
+			}
1387 1389
 		}
1388 1390
 
1389 1391
 		// Convert this to utf-8 if needed.
Please login to merge, or discard this patch.
sources/controllers/Emailpost.controller.php 1 patch
Braces   +150 added lines, -54 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
 		// The function is not even on ...
56 56
 		if (empty($modSettings['maillist_enabled']))
57
-			return false;
57
+		{
58
+					return false;
59
+		}
58 60
 
59 61
 		// Our mail parser and our main subs
60 62
 		require_once(SUBSDIR . '/Emailpost.subs.php');
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 		$email_message = new Email_Parse();
68 70
 		$email_message->read_data($data, BOARDDIR);
69 71
 		if (!$email_message->raw_message)
70
-			return false;
72
+		{
73
+					return false;
74
+		}
71 75
 
72 76
 		// Ask for an html version (if available) and some needed details
73 77
 		$email_message->read_email(true, $email_message->raw_message);
@@ -101,11 +105,15 @@  discard block
 block discarded – undo
101 105
 
102 106
 		// If the feature is on but the post/pm function is not enabled, just log the message.
103 107
 		if (empty($modSettings['pbe_post_enabled']) && empty($modSettings['pbe_pm_enabled']))
104
-			return pbe_emailError('error_email_notenabled', $email_message);
108
+		{
109
+					return pbe_emailError('error_email_notenabled', $email_message);
110
+		}
105 111
 
106 112
 		// Spam I am?
107 113
 		if ($email_message->load_spam() && !$force)
108
-			return pbe_emailError('error_found_spam', $email_message);
114
+		{
115
+					return pbe_emailError('error_found_spam', $email_message);
116
+		}
109 117
 
110 118
 		// Load the user from the database based on the sending email address
111 119
 		$email_message->email['from'] = !empty($email_message->email['from']) ? strtolower($email_message->email['from']) : '';
@@ -113,11 +121,15 @@  discard block
 block discarded – undo
113 121
 
114 122
 		// Can't find this email in our database, a non-user, a spammer, a looser, a poser or even worse?
115 123
 		if (empty($pbe))
116
-			return pbe_emailError('error_not_find_member', $email_message);
124
+		{
125
+					return pbe_emailError('error_not_find_member', $email_message);
126
+		}
117 127
 
118 128
 		// Find the message security key, without it we are not going anywhere ever
119 129
 		if (empty($email_message->message_key_id))
120
-			return pbe_emailError('error_missing_key', $email_message);
130
+		{
131
+					return pbe_emailError('error_missing_key', $email_message);
132
+		}
121 133
 
122 134
 		require_once(SUBSDIR . '/Emailpost.subs.php');
123 135
 		// Good we have a key, who was it sent to?
@@ -126,15 +138,21 @@  discard block
 block discarded – undo
126 138
 		// Can't find this key in the database, either
127 139
 		// a) spam attempt or b) replying with an expired/consumed key
128 140
 		if (empty($key_owner) && !$force)
129
-			return pbe_emailError('error_' . ($email_message->message_type === 'p' ? 'pm_' : '') . 'not_find_entry', $email_message);
141
+		{
142
+					return pbe_emailError('error_' . ($email_message->message_type === 'p' ? 'pm_' : '') . 'not_find_entry', $email_message);
143
+		}
130 144
 
131 145
 		// The key received was not sent to this member ... how we love those email aggregators
132 146
 		if (strtolower($key_owner) !== $email_message->email['from'] && !$force)
133
-			return pbe_emailError('error_key_sender_match', $email_message);
147
+		{
148
+					return pbe_emailError('error_key_sender_match', $email_message);
149
+		}
134 150
 
135 151
 		// In maintenance mode, just log it for now
136 152
 		if (!empty($maintenance) && $maintenance !== 2 && !$pbe['user_info']['is_admin'] && !$user_info['is_admin'])
137
-			return pbe_emailError('error_in_maintenance_mode', $email_message);
153
+		{
154
+					return pbe_emailError('error_in_maintenance_mode', $email_message);
155
+		}
138 156
 
139 157
 		// The email looks valid, now on to check the actual user trying to make the post/pm
140 158
 		// lets load the topic/message info and any additional permissions we need
@@ -145,7 +163,9 @@  discard block
 block discarded – undo
145 163
 			// Load the message/topic details
146 164
 			$topic_info = query_load_message($email_message->message_type, $email_message->message_id, $pbe);
147 165
 			if (empty($topic_info))
148
-				return pbe_emailError('error_topic_gone', $email_message);
166
+			{
167
+							return pbe_emailError('error_topic_gone', $email_message);
168
+			}
149 169
 
150 170
 			// Load board permissions
151 171
 			query_load_permissions('board', $pbe, $topic_info);
@@ -170,7 +190,9 @@  discard block
 block discarded – undo
170 190
 
171 191
 		// Load in the correct Re: for the language
172 192
 		if ($language === $pbe['user_info']['language'])
173
-			$pbe['response_prefix'] = $txt['response_prefix'];
193
+		{
194
+					$pbe['response_prefix'] = $txt['response_prefix'];
195
+		}
174 196
 		else
175 197
 		{
176 198
 			loadLanguage('index', $language, false);
@@ -194,10 +216,14 @@  discard block
 block discarded – undo
194 216
 
195 217
 		// Time to make a Post or a PM, first up topic and message replies
196 218
 		if ($email_message->message_type === 't' || $email_message->message_type === 'm')
197
-			$result = pbe_create_post($pbe, $email_message, $topic_info);
219
+		{
220
+					$result = pbe_create_post($pbe, $email_message, $topic_info);
221
+		}
198 222
 		// Must be a PM then
199 223
 		elseif ($email_message->message_type === 'p')
200
-			$result = pbe_create_pm($pbe, $email_message, $pm_info);
224
+		{
225
+					$result = pbe_create_pm($pbe, $email_message, $pm_info);
226
+		}
201 227
 
202 228
 		if (!empty($result))
203 229
 		{
@@ -230,7 +256,9 @@  discard block
 block discarded – undo
230 256
 
231 257
 		// The function is not even on ...
232 258
 		if (empty($modSettings['maillist_enabled']))
233
-			return false;
259
+		{
260
+					return false;
261
+		}
234 262
 
235 263
 		// Our mail parser and our main subs
236 264
 		require_once(SUBSDIR . '/Emailpost.subs.php');
@@ -243,7 +271,9 @@  discard block
 block discarded – undo
243 271
 		$email_message = new Email_Parse();
244 272
 		$email_message->read_data($data, BOARDDIR);
245 273
 		if (!$email_message->raw_message)
246
-			return false;
274
+		{
275
+					return false;
276
+		}
247 277
 
248 278
 		// Parse the header and some needed details
249 279
 		$email_message->read_email(true, $email_message->raw_message);
@@ -284,7 +314,9 @@  discard block
 block discarded – undo
284 314
 
285 315
 		// If the feature is on but the post/pm function is not enabled, just log the message.
286 316
 		if (empty($modSettings['pbe_post_enabled']))
287
-			return pbe_emailError('error_email_notenabled', $email_message);
317
+		{
318
+					return pbe_emailError('error_email_notenabled', $email_message);
319
+		}
288 320
 
289 321
 		// Load the user from the database based on the sending email address
290 322
 		$email_message->email['from'] = !empty($email_message->email['from']) ? strtolower($email_message->email['from']) : '';
@@ -292,20 +324,28 @@  discard block
 block discarded – undo
292 324
 
293 325
 		// Can't find this email as one of our users?
294 326
 		if (empty($pbe))
295
-			return pbe_emailError('error_not_find_member', $email_message);
327
+		{
328
+					return pbe_emailError('error_not_find_member', $email_message);
329
+		}
296 330
 
297 331
 		// Getting hammy with it?
298 332
 		if ($email_message->load_spam())
299
-			return pbe_emailError('error_found_spam', $email_message);
333
+		{
334
+					return pbe_emailError('error_found_spam', $email_message);
335
+		}
300 336
 
301 337
 		// The board that this email address corresponds to
302 338
 		$board_number = pbe_find_board_number($email_message);
303 339
 		if (empty($board_number))
304
-			return pbe_emailError('error_not_find_board', $email_message);
340
+		{
341
+					return pbe_emailError('error_not_find_board', $email_message);
342
+		}
305 343
 
306 344
 		// In maintenance mode so just save it for the moderators to deal with
307 345
 		if (!empty($maintenance) && $maintenance !== 2 && !$pbe['user_info']['is_admin'] && !$user_info['is_admin'])
308
-			return pbe_emailError('error_in_maintenance_mode', $email_message);
346
+		{
347
+					return pbe_emailError('error_in_maintenance_mode', $email_message);
348
+		}
309 349
 
310 350
 		// Any additional spam / security checking
311 351
 		call_integration_hook('integrate_mailist_checks_before', array($email_message, $pbe));
@@ -313,7 +353,9 @@  discard block
 block discarded – undo
313 353
 		// To post a NEW topic, we need some board details for where it goes
314 354
 		$board_info = query_load_board_details($board_number, $pbe);
315 355
 		if (empty($board_info))
316
-			return pbe_emailError('error_board_gone', $email_message);
356
+		{
357
+					return pbe_emailError('error_board_gone', $email_message);
358
+		}
317 359
 
318 360
 		// Load up this users permissions for that board
319 361
 		query_load_permissions('board', $pbe, $board_info);
@@ -353,7 +395,9 @@  discard block
 block discarded – undo
353 395
 		$email_message = new Email_Parse();
354 396
 		$email_message->read_data($data, BOARDDIR);
355 397
 		if (!$email_message->raw_message)
356
-			return false;
398
+		{
399
+					return false;
400
+		}
357 401
 
358 402
 		// Ask for an html version (if available) and some needed details
359 403
 		$email_message->read_email(true, $email_message->raw_message);
@@ -369,13 +413,18 @@  discard block
 block discarded – undo
369 413
 		if (!empty($email_message->attachments) && !empty($modSettings['maillist_allow_attachments']) && !empty($modSettings['attachmentEnable']) && $modSettings['attachmentEnable'] == 1)
370 414
 		{
371 415
 			if ($email_message->message_type === 'p')
372
-				$text .= "\n\n" . $txt['error_no_pm_attach'] . "\n";
373
-			else
374
-				$attachment_count = count($email_message->attachments);
416
+			{
417
+							$text .= "\n\n" . $txt['error_no_pm_attach'] . "\n";
418
+			}
419
+			else {
420
+							$attachment_count = count($email_message->attachments);
421
+			}
375 422
 		}
376 423
 
377 424
 		if ($attachment_count)
378
-			$text .= "\n\n" . sprintf($txt['email_attachments'], $attachment_count);
425
+		{
426
+					$text .= "\n\n" . sprintf($txt['email_attachments'], $attachment_count);
427
+		}
379 428
 
380 429
 		// Return the parsed and formatted body and who it was sent to for the template
381 430
 		return array('body' => $text, 'to' => implode(' & ', $email_message->email['to']) . (!empty($email_message->email['cc']) ? ', ' . implode(' & ', $email_message->email['cc']) : ''));
@@ -404,37 +453,54 @@  discard block
 block discarded – undo
404 453
 	// Validate they have permission to reply
405 454
 	$becomesApproved = true;
406 455
 	if (!in_array('postby_email', $pbe['user_info']['permissions']) && !$pbe['user_info']['is_admin'])
407
-		return pbe_emailError('error_permission', $email_message);
456
+	{
457
+			return pbe_emailError('error_permission', $email_message);
458
+	}
408 459
 	elseif ($topic_info['locked'] && !$pbe['user_info']['is_admin'] && !in_array('moderate_forum', $pbe['user_info']['permissions']))
409
-		return pbe_emailError('error_locked', $email_message);
460
+	{
461
+			return pbe_emailError('error_locked', $email_message);
462
+	}
410 463
 	elseif ($topic_info['id_member_started'] === $pbe['profile']['id_member'] && !$pbe['user_info']['is_admin'])
411 464
 	{
412 465
 		if ($modSettings['postmod_active'] && in_array('post_unapproved_replies_any', $pbe['user_info']['permissions']) && (!in_array('post_reply_any', $pbe['user_info']['permissions'])))
413
-			$becomesApproved = false;
466
+		{
467
+					$becomesApproved = false;
468
+		}
414 469
 		elseif (!in_array('post_reply_own', $pbe['user_info']['permissions']))
415
-			return pbe_emailError('error_cant_reply', $email_message);
470
+		{
471
+					return pbe_emailError('error_cant_reply', $email_message);
472
+		}
416 473
 	}
417 474
 	elseif (!$pbe['user_info']['is_admin'])
418 475
 	{
419 476
 		if ($modSettings['postmod_active'] && in_array('post_unapproved_replies_any', $pbe['user_info']['permissions']) && (!in_array('post_reply_any', $pbe['user_info']['permissions'])))
420
-			$becomesApproved = false;
477
+		{
478
+					$becomesApproved = false;
479
+		}
421 480
 		elseif (!in_array('post_reply_any', $pbe['user_info']['permissions']))
422
-			return pbe_emailError('error_cant_reply', $email_message);
481
+		{
482
+					return pbe_emailError('error_cant_reply', $email_message);
483
+		}
423 484
 	}
424 485
 
425 486
 	// Convert to BBC and Format the message
426 487
 	$html = $email_message->html_found;
427 488
 	$text = pbe_load_text($html, $email_message, $pbe);
428 489
 	if (empty($text))
429
-		return pbe_emailError('error_no_message', $email_message);
490
+	{
491
+			return pbe_emailError('error_no_message', $email_message);
492
+	}
430 493
 
431 494
 	// Seriously? Attachments?
432 495
 	if (!empty($email_message->attachments) && !empty($modSettings['maillist_allow_attachments']) && !empty($modSettings['attachmentEnable']) && $modSettings['attachmentEnable'] == 1)
433 496
 	{
434 497
 		if (($modSettings['postmod_active'] && in_array('post_unapproved_attachments', $pbe['user_info']['permissions'])) || in_array('post_attachment', $pbe['user_info']['permissions']))
435
-			$attachIDs = pbe_email_attachments($pbe, $email_message);
436
-		else
437
-			$text .= "\n\n" . $txt['error_no_attach'] . "\n";
498
+		{
499
+					$attachIDs = pbe_email_attachments($pbe, $email_message);
500
+		}
501
+		else {
502
+					$text .= "\n\n" . $txt['error_no_attach'] . "\n";
503
+		}
438 504
 	}
439 505
 
440 506
 	// Setup the post variables.
@@ -511,17 +577,23 @@  discard block
 block discarded – undo
511 577
 
512 578
 	// Can they send?
513 579
 	if (!$pbe['user_info']['is_admin'] && !in_array('pm_send', $pbe['user_info']['permissions']))
514
-		return pbe_emailError('error_pm_not_allowed', $email_message);
580
+	{
581
+			return pbe_emailError('error_pm_not_allowed', $email_message);
582
+	}
515 583
 
516 584
 	// Convert the PM to BBC and Format the message
517 585
 	$html = $email_message->html_found;
518 586
 	$text = pbe_load_text($html, $email_message, $pbe);
519 587
 	if (empty($text))
520
-		return pbe_emailError('error_no_message', $email_message);
588
+	{
589
+			return pbe_emailError('error_no_message', $email_message);
590
+	}
521 591
 
522 592
 	// If they tried to attach a file, just say sorry
523 593
 	if (!empty($email_message->attachments) && !empty($modSettings['maillist_allow_attachments']) && !empty($modSettings['attachmentEnable']) && $modSettings['attachmentEnable'] == 1)
524
-		$text .= "\n\n" . $txt['error_no_pm_attach'] . "\n";
594
+	{
595
+			$text .= "\n\n" . $txt['error_no_pm_attach'] . "\n";
596
+	}
525 597
 
526 598
 	// For sending the message...
527 599
 	$from = array(
@@ -538,7 +610,9 @@  discard block
 block discarded – undo
538 610
 
539 611
 	// Assuming all went well, mark this as read, replied to and update the unread counter
540 612
 	if (!empty($pm_result))
541
-		query_mark_pms($email_message, $pbe);
613
+	{
614
+			query_mark_pms($email_message, $pbe);
615
+	}
542 616
 
543 617
 	return !empty($pm_result);
544 618
 }
@@ -568,23 +642,33 @@  discard block
 block discarded – undo
568 642
 
569 643
 	// It does not work like that
570 644
 	if (empty($pbe) || empty($email_message))
571
-		return false;
645
+	{
646
+			return false;
647
+	}
572 648
 
573 649
 	// We have the board info, and their permissions - do they have a right to start a new topic?
574 650
 	$becomesApproved = true;
575 651
 	if (!$pbe['user_info']['is_admin'])
576 652
 	{
577 653
 		if (!in_array('postby_email', $pbe['user_info']['permissions']))
578
-			return pbe_emailError('error_permission', $email_message);
654
+		{
655
+					return pbe_emailError('error_permission', $email_message);
656
+		}
579 657
 		elseif ($modSettings['postmod_active'] && in_array('post_unapproved_topics', $pbe['user_info']['permissions']) && (!in_array('post_new', $pbe['user_info']['permissions'])))
580
-			$becomesApproved = false;
658
+		{
659
+					$becomesApproved = false;
660
+		}
581 661
 		elseif (!in_array('post_new', $pbe['user_info']['permissions']))
582
-			return pbe_emailError('error_cant_start', $email_message);
662
+		{
663
+					return pbe_emailError('error_cant_start', $email_message);
664
+		}
583 665
 	}
584 666
 
585 667
 	// Approving all new topics by email anyway, smart admin this one is ;)
586 668
 	if (!empty($modSettings['maillist_newtopic_needsapproval']))
587
-		$becomesApproved = false;
669
+	{
670
+			$becomesApproved = false;
671
+	}
588 672
 
589 673
 	// First on the agenda the subject
590 674
 	$subject = pbe_clean_email_subject($email_message->subject);
@@ -592,23 +676,32 @@  discard block
 block discarded – undo
592 676
 
593 677
 	// Not to long not to short
594 678
 	if (Util::strlen($subject) > 100)
595
-		$subject = Util::substr($subject, 0, 100);
679
+	{
680
+			$subject = Util::substr($subject, 0, 100);
681
+	}
596 682
 	elseif ($subject == '')
597
-		return pbe_emailError('error_no_subject', $email_message);
683
+	{
684
+			return pbe_emailError('error_no_subject', $email_message);
685
+	}
598 686
 
599 687
 	// The message itself will need a bit of work
600 688
 	$html = $email_message->html_found;
601 689
 	$text = pbe_load_text($html, $email_message, $pbe);
602 690
 	if (empty($text))
603
-		return pbe_emailError('error_no_message', $email_message);
691
+	{
692
+			return pbe_emailError('error_no_message', $email_message);
693
+	}
604 694
 
605 695
 	// Build the attachment array if needed
606 696
 	if (!empty($email_message->attachments) && !empty($modSettings['maillist_allow_attachments']) && !empty($modSettings['attachmentEnable']) && $modSettings['attachmentEnable'] == 1)
607 697
 	{
608 698
 		if (($modSettings['postmod_active'] && in_array('post_unapproved_attachments', $pbe['user_info']['permissions'])) || in_array('post_attachment', $pbe['user_info']['permissions']))
609
-			$attachIDs = pbe_email_attachments($pbe, $email_message);
610
-		else
611
-			$text .= "\n\n" . $txt['error_no_attach'] . "\n";
699
+		{
700
+					$attachIDs = pbe_email_attachments($pbe, $email_message);
701
+		}
702
+		else {
703
+					$text .= "\n\n" . $txt['error_no_attach'] . "\n";
704
+		}
612 705
 	}
613 706
 
614 707
 	// If we get to this point ... then its time to play, lets start a topic !
@@ -688,8 +781,9 @@  discard block
 block discarded – undo
688 781
 		$text = $email_message->plain_body;
689 782
 		$html = false;
690 783
 	}
691
-	else
692
-		$text = un_htmlspecialchars($email_message->body);
784
+	else {
785
+			$text = un_htmlspecialchars($email_message->body);
786
+	}
693 787
 
694 788
 	// Run filters now, before the data is manipulated
695 789
 	$text = pbe_filter_email_message($text);
@@ -703,7 +797,9 @@  discard block
 block discarded – undo
703 797
 	// Do we even have a message left to post?
704 798
 	$text = Util::htmltrim($text);
705 799
 	if (empty($text))
706
-		return '';
800
+	{
801
+			return '';
802
+	}
707 803
 
708 804
 	// This will be taken care of by sendpm
709 805
 	if ($email_message->message_type !== 'p')
Please login to merge, or discard this patch.
sources/controllers/ProfileHistory.controller.php 1 patch
Braces   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -95,7 +95,9 @@  discard block
 block discarded – undo
95 95
 		$context['last_ip'] = $user_profile[$this->_memID]['member_ip'];
96 96
 
97 97
 		if ($context['last_ip'] != $user_profile[$this->_memID]['member_ip2'])
98
-			$context['last_ip2'] = $user_profile[$this->_memID]['member_ip2'];
98
+		{
99
+					$context['last_ip2'] = $user_profile[$this->_memID]['member_ip2'];
100
+		}
99 101
 
100 102
 		$context['member']['name'] = $user_profile[$this->_memID]['real_name'];
101 103
 
@@ -184,10 +186,14 @@  discard block
 block discarded – undo
184 186
 		$context['error_ips'] = array();
185 187
 
186 188
 		foreach ($ips['message_ips'] as $ip)
187
-			$context['ips'][] = '<a href="' . $scripturl . '?action=profile;area=history;sa=ip;searchip=' . $ip . ';u=' . $this->_memID . '">' . $ip . '</a>';
189
+		{
190
+					$context['ips'][] = '<a href="' . $scripturl . '?action=profile;area=history;sa=ip;searchip=' . $ip . ';u=' . $this->_memID . '">' . $ip . '</a>';
191
+		}
188 192
 
189 193
 		foreach ($ips['error_ips'] as $ip)
190
-			$context['error_ips'][] = '<a href="' . $scripturl . '?action=profile;area=history;sa=ip;searchip=' . $ip . ';u=' . $this->_memID . '">' . $ip . '</a>';
194
+		{
195
+					$context['error_ips'][] = '<a href="' . $scripturl . '?action=profile;area=history;sa=ip;searchip=' . $ip . ';u=' . $this->_memID . '">' . $ip . '</a>';
196
+		}
191 197
 
192 198
 		// Find other users that might use the same IP.
193 199
 		$context['members_in_range'] = array();
@@ -197,7 +203,9 @@  discard block
 block discarded – undo
197 203
 		{
198 204
 			$members_in_range = getMembersInRange($all_ips, $this->_memID);
199 205
 			foreach ($members_in_range as $row)
200
-				$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
206
+			{
207
+							$context['members_in_range'][$row['id_member']] = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
208
+			}
201 209
 		}
202 210
 
203 211
 		loadTemplate('ProfileHistory');
@@ -234,7 +242,9 @@  discard block
 block discarded – undo
234 242
 
235 243
 		// Searching?
236 244
 		if (isset($this->_req->query->searchip))
237
-			$context['ip'] = trim($this->_req->query->searchip);
245
+		{
246
+					$context['ip'] = trim($this->_req->query->searchip);
247
+		}
238 248
 
239 249
 		if (preg_match('/^\d{1,3}\.(\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)$/', $context['ip']) == 0
240 250
 			&& isValidIPv6($context['ip']) === false)
@@ -246,7 +256,9 @@  discard block
 block discarded – undo
246 256
 		$ip_string = strpos($ip_var, '%') === false ? '= {string:ip_address}' : 'LIKE {string:ip_address}';
247 257
 
248 258
 		if (empty($context['history_area']))
249
-			$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
259
+		{
260
+					$context['page_title'] = $txt['trackIP'] . ' - ' . $context['ip'];
261
+		}
250 262
 
251 263
 		// Fetch the members that are associated with the ip's
252 264
 		require_once(SUBSDIR . '/Members.subs.php');
@@ -471,9 +483,12 @@  discard block
 block discarded – undo
471 483
 		global $scripturl, $txt, $context;
472 484
 
473 485
 		if ($this->_memID == 0)
474
-			$context['base_url'] = $scripturl . '?action=trackip';
475
-		else
476
-			$context['base_url'] = $scripturl . '?action=profile;area=history;sa=ip;u=' . $this->_memID;
486
+		{
487
+					$context['base_url'] = $scripturl . '?action=trackip';
488
+		}
489
+		else {
490
+					$context['base_url'] = $scripturl . '?action=profile;area=history;sa=ip;u=' . $this->_memID;
491
+		}
477 492
 
478 493
 		// Start with the user messages.
479 494
 		$listOptions = array(
Please login to merge, or discard this patch.