Completed
Pull Request — release-2.1 (#4446)
by Mathias
12:43
created
Sources/Subs-Sound.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
  * Used by VerificationCode() (Register.php).
25 25
  *
26 26
  * @param string $word
27
- * @return boolean false on failure
27
+ * @return null|false false on failure
28 28
  */
29 29
 
30 30
 function createWaveFile($word)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	cache_put_data('wave_file/' . $user_info['ip2'], $ip2 ? $ip2 + 1 : 1, 20);
39 39
 
40 40
 	// Fixate randomization for this word.
41
-    $tmp = unpack('n', md5($word . session_id()));
41
+	$tmp = unpack('n', md5($word . session_id()));
42 42
 	mt_srand(end($tmp));
43 43
 
44 44
 	// Try to see if there's a sound font in the user's language.
Please login to merge, or discard this patch.
Braces   +32 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
  * @version 2.1 Beta 4
16 16
  */
17 17
 
18
-if (!defined('SMF'))
18
+if (!defined('SMF')) {
19 19
 	die('No direct access...');
20
+}
20 21
 
21 22
 /**
22 23
  * Creates a wave file that spells the letters of $word.
@@ -32,8 +33,9 @@  discard block
 block discarded – undo
32 33
 	global $settings, $user_info;
33 34
 
34 35
 	// Allow max 2 requests per 20 seconds.
35
-	if (($ip = cache_get_data('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = cache_get_data('wave_file/' . $user_info['ip2'], 20)) > 2)
36
-		die(header('HTTP/1.1 400 Bad Request'));
36
+	if (($ip = cache_get_data('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = cache_get_data('wave_file/' . $user_info['ip2'], 20)) > 2) {
37
+			die(header('HTTP/1.1 400 Bad Request'));
38
+	}
37 39
 	cache_put_data('wave_file/' . $user_info['ip'], $ip ? $ip + 1 : 1, 20);
38 40
 	cache_put_data('wave_file/' . $user_info['ip2'], $ip2 ? $ip2 + 1 : 1, 20);
39 41
 
@@ -42,16 +44,19 @@  discard block
 block discarded – undo
42 44
 	mt_srand(end($tmp));
43 45
 
44 46
 	// Try to see if there's a sound font in the user's language.
45
-	if (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.' . $user_info['language'] . '.wav'))
46
-		$sound_language = $user_info['language'];
47
+	if (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.' . $user_info['language'] . '.wav')) {
48
+			$sound_language = $user_info['language'];
49
+	}
47 50
 
48 51
 	// English should be there.
49
-	elseif (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.english.wav'))
50
-		$sound_language = 'english';
52
+	elseif (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.english.wav')) {
53
+			$sound_language = 'english';
54
+	}
51 55
 
52 56
 	// Guess not...
53
-	else
54
-		return false;
57
+	else {
58
+			return false;
59
+	}
55 60
 
56 61
 	// File names are in lower case so lets make sure that we are only using a lower case string
57 62
 	$word = strtolower($word);
@@ -61,20 +66,25 @@  discard block
 block discarded – undo
61 66
 	for ($i = 0; $i < strlen($word); $i++)
62 67
 	{
63 68
 		$sound_letter = implode('', file($settings['default_theme_dir'] . '/fonts/sound/' . $word{$i} . '.' . $sound_language . '.wav'));
64
-		if (strpos($sound_letter, 'data') === false)
65
-			return false;
69
+		if (strpos($sound_letter, 'data') === false) {
70
+					return false;
71
+		}
66 72
 
67 73
 		$sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8);
68 74
 		switch ($word{$i} === 's' ? 0 : mt_rand(0, 2))
69 75
 		{
70
-			case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
71
-					for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
72
-						$sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF)));
76
+			case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) {
77
+								for ($k = 0, $m = round(mt_rand(15, 25) / 10);
78
+			}
79
+			$k < $m; $k++) {
80
+											$sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF)));
81
+					}
73 82
 			break;
74 83
 
75 84
 			case 1:
76
-				for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2)
77
-					$sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (mt_rand(0, 3) == 0 ? $sound_letter{$j + 1} : '');
85
+				for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2) {
86
+									$sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (mt_rand(0, 3) == 0 ? $sound_letter{$j + 1} : '');
87
+				}
78 88
 				$sound_word .= str_repeat($sound_letter{$n}, 2);
79 89
 			break;
80 90
 
@@ -82,10 +92,12 @@  discard block
 block discarded – undo
82 92
 				$shift = 0;
83 93
 				for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++)
84 94
 				{
85
-					if (mt_rand(0, 10) === 0)
86
-						$shift += mt_rand(-3, 3);
87
-					for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++)
88
-						$sound_word .= chr(min(max(ord($sound_letter{$j}) + $shift, 0x00), 0xFF));
95
+					if (mt_rand(0, 10) === 0) {
96
+											$shift += mt_rand(-3, 3);
97
+					}
98
+					for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) {
99
+											$sound_word .= chr(min(max(ord($sound_letter{$j}) + $shift, 0x00), 0xFF));
100
+					}
89 101
 				}
90 102
 			break;
91 103
 
Please login to merge, or discard this patch.
Sources/Subs-Themes.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@
 block discarded – undo
425 425
  *
426 426
  * This is a recursive function, it will call itself if there are subdirs inside the main directory.
427 427
  * @param string $path The absolute path to the directory to be removed
428
- * @return bool true when success, false on error.
428
+ * @return false|null true when success, false on error.
429 429
  */
430 430
 function remove_dir($path)
431 431
 {
Please login to merge, or discard this patch.
Braces   +67 added lines, -46 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * Gets a single theme's info.
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 	global $smcFunc, $modSettings;
28 29
 
29 30
 	// No data, no fun!
30
-	if (empty($id))
31
-		return false;
31
+	if (empty($id)) {
32
+			return false;
33
+	}
32 34
 
33 35
 	// Make sure $id is an int.
34 36
 	$id = (int) $id;
@@ -171,8 +173,9 @@  discard block
 block discarded – undo
171 173
 	global $smcFunc, $sourcedir, $forum_version, $txt, $scripturl, $context;
172 174
 	global $explicit_images;
173 175
 
174
-	if (empty($path))
175
-		return false;
176
+	if (empty($path)) {
177
+			return false;
178
+	}
176 179
 
177 180
 	$xml_data = array();
178 181
 	$explicit_images = false;
@@ -229,9 +232,10 @@  discard block
 block discarded – undo
229 232
 	);
230 233
 
231 234
 	// Assign the values to be stored.
232
-	foreach ($xml_elements as $var => $name)
233
-		if (!empty($theme_info_xml[$name]))
235
+	foreach ($xml_elements as $var => $name) {
236
+			if (!empty($theme_info_xml[$name]))
234 237
 			$xml_data[$var] = $theme_info_xml[$name];
238
+	}
235 239
 
236 240
 	// Add the supported versions.
237 241
 	$xml_data['install_for'] = $install_versions;
@@ -243,8 +247,9 @@  discard block
 block discarded – undo
243 247
 		$explicit_images = true;
244 248
 	}
245 249
 
246
-	if (!empty($theme_info_xml['extra']))
247
-		$xml_data += $smcFunc['json_decode']($theme_info_xml['extra'], true);
250
+	if (!empty($theme_info_xml['extra'])) {
251
+			$xml_data += $smcFunc['json_decode']($theme_info_xml['extra'], true);
252
+	}
248 253
 
249 254
 	return $xml_data;
250 255
 }
@@ -262,12 +267,14 @@  discard block
 block discarded – undo
262 267
 	global $settings, $explicit_images;
263 268
 
264 269
 	// External use? no problem!
265
-	if ($to_install)
266
-		$context['to_install'] = $to_install;
270
+	if ($to_install) {
271
+			$context['to_install'] = $to_install;
272
+	}
267 273
 
268 274
 	// One last check.
269
-	if (empty($context['to_install']['theme_dir']) || basename($context['to_install']['theme_dir']) == 'Themes')
270
-		fatal_lang_error('theme_install_invalid_dir', false);
275
+	if (empty($context['to_install']['theme_dir']) || basename($context['to_install']['theme_dir']) == 'Themes') {
276
+			fatal_lang_error('theme_install_invalid_dir', false);
277
+	}
271 278
 
272 279
 	// OK, is this a newer version of an already installed theme?
273 280
 	if (!empty($context['to_install']['version']))
@@ -291,8 +298,8 @@  discard block
 block discarded – undo
291 298
 		$smcFunc['db_free_result']($request);
292 299
 
293 300
 		// Got something, lets figure it out what to do next.
294
-		if (!empty($to_update) && !empty($to_update['version']))
295
-			switch (compareVersions($context['to_install']['version'], $to_update['version']))
301
+		if (!empty($to_update) && !empty($to_update['version'])) {
302
+					switch (compareVersions($context['to_install']['version'], $to_update['version']))
296 303
 			{
297 304
 				case 1: // Got a newer version, update the old entry.
298 305
 					$smcFunc['db_query']('', '
@@ -306,6 +313,7 @@  discard block
 block discarded – undo
306 313
 							'id_theme' => $to_update['id_theme'],
307 314
 						)
308 315
 					);
316
+		}
309 317
 
310 318
 					// Done with the update, tell the user about it.
311 319
 					$context['to_install']['updated'] = true;
@@ -371,13 +379,15 @@  discard block
 block discarded – undo
371 379
 				$context['to_install']['base_theme_url'] = $temp['theme_url'];
372 380
 				$context['to_install']['base_theme_dir'] = $temp['theme_dir'];
373 381
 
374
-				if (empty($explicit_images) && !empty($context['to_install']['base_theme_url']))
375
-					$context['to_install']['theme_url'] = $context['to_install']['base_theme_url'];
382
+				if (empty($explicit_images) && !empty($context['to_install']['base_theme_url'])) {
383
+									$context['to_install']['theme_url'] = $context['to_install']['base_theme_url'];
384
+				}
376 385
 			}
377 386
 
378 387
 			// Nope, sorry, couldn't find any theme already installed.
379
-			else
380
-				fatal_lang_error('package_get_error_theme_no_based_on_found', false, $context['to_install']['based_on']);
388
+			else {
389
+							fatal_lang_error('package_get_error_theme_no_based_on_found', false, $context['to_install']['based_on']);
390
+			}
381 391
 		}
382 392
 
383 393
 		unset($context['to_install']['based_on']);
@@ -400,16 +410,18 @@  discard block
 block discarded – undo
400 410
 	call_integration_hook('integrate_theme_install', array(&$context['to_install'], $id_theme));
401 411
 
402 412
 	$inserts = array();
403
-	foreach ($context['to_install'] as $var => $val)
404
-		$inserts[] = array($id_theme, $var, $val);
413
+	foreach ($context['to_install'] as $var => $val) {
414
+			$inserts[] = array($id_theme, $var, $val);
415
+	}
405 416
 
406
-	if (!empty($inserts))
407
-		$smcFunc['db_insert']('insert',
417
+	if (!empty($inserts)) {
418
+			$smcFunc['db_insert']('insert',
408 419
 			'{db_prefix}themes',
409 420
 			array('id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
410 421
 			$inserts,
411 422
 			array('id_theme', 'variable')
412 423
 		);
424
+	}
413 425
 
414 426
 	// Update the known and enable Theme's settings.
415 427
 	$known = strtr($modSettings['knownThemes'] . ',' . $id_theme, array(',,' => ','));
@@ -428,21 +440,24 @@  discard block
 block discarded – undo
428 440
  */
429 441
 function remove_dir($path)
430 442
 {
431
-	if (empty($path))
432
-		return false;
443
+	if (empty($path)) {
444
+			return false;
445
+	}
433 446
 
434 447
 	if (is_dir($path))
435 448
 	{
436 449
 		$objects = scandir($path);
437 450
 
438
-		foreach ($objects as $object)
439
-			if ($object != '.' && $object != '..')
451
+		foreach ($objects as $object) {
452
+					if ($object != '.' && $object != '..')
440 453
 			{
441 454
 				if (filetype($path . '/' . $object) == 'dir')
442 455
 					remove_dir($path . '/' . $object);
456
+		}
443 457
 
444
-				else
445
-					unlink($path . '/' . $object);
458
+				else {
459
+									unlink($path . '/' . $object);
460
+				}
446 461
 			}
447 462
 	}
448 463
 
@@ -461,8 +476,9 @@  discard block
 block discarded – undo
461 476
 	global $smcFunc, $modSettings;
462 477
 
463 478
 	// Can't delete the default theme, sorry!
464
-	if (empty($themeID) || $themeID == 1)
465
-		return false;
479
+	if (empty($themeID) || $themeID == 1) {
480
+			return false;
481
+	}
466 482
 
467 483
 	$known = explode(',', $modSettings['knownThemes']);
468 484
 	$enable = explode(',', $modSettings['enableThemes']);
@@ -512,8 +528,9 @@  discard block
 block discarded – undo
512 528
 	updateSettings(array('enableThemes' => $enable, 'knownThemes' => $known));
513 529
 
514 530
 	// Fix it if the theme was the overall default theme.
515
-	if ($modSettings['theme_guests'] == $themeID)
516
-		updateSettings(array('theme_guests' => '1'));
531
+	if ($modSettings['theme_guests'] == $themeID) {
532
+			updateSettings(array('theme_guests' => '1'));
533
+	}
517 534
 
518 535
 	return true;
519 536
 }
@@ -530,13 +547,15 @@  discard block
 block discarded – undo
530 547
 	global $scripturl, $txt, $context;
531 548
 
532 549
 	// Is it even a directory?
533
-	if (!is_dir($path))
534
-		fatal_lang_error('error_invalid_dir', 'critical');
550
+	if (!is_dir($path)) {
551
+			fatal_lang_error('error_invalid_dir', 'critical');
552
+	}
535 553
 
536 554
 	$dir = dir($path);
537 555
 	$entries = array();
538
-	while ($entry = $dir->read())
539
-		$entries[] = $entry;
556
+	while ($entry = $dir->read()) {
557
+			$entries[] = $entry;
558
+	}
540 559
 	$dir->close();
541 560
 
542 561
 	natcasesort($entries);
@@ -547,11 +566,12 @@  discard block
 block discarded – undo
547 566
 	foreach ($entries as $entry)
548 567
 	{
549 568
 		// Skip all dot files, including .htaccess.
550
-		if (substr($entry, 0, 1) == '.' || $entry == 'CVS')
551
-			continue;
569
+		if (substr($entry, 0, 1) == '.' || $entry == 'CVS') {
570
+					continue;
571
+		}
552 572
 
553
-		if (is_dir($path . '/' . $entry))
554
-			$listing1[] = array(
573
+		if (is_dir($path . '/' . $entry)) {
574
+					$listing1[] = array(
555 575
 				'filename' => $entry,
556 576
 				'is_writable' => is_writable($path . '/' . $entry),
557 577
 				'is_directory' => true,
@@ -561,13 +581,14 @@  discard block
 block discarded – undo
561 581
 				'href' => $scripturl . '?action=admin;area=theme;th=' . $_GET['th'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=edit;directory=' . $relative . $entry,
562 582
 				'size' => '',
563 583
 			);
564
-		else
584
+		} else
565 585
 		{
566 586
 			$size = filesize($path . '/' . $entry);
567
-			if ($size > 2048 || $size == 1024)
568
-				$size = comma_format($size / 1024) . ' ' . $txt['themeadmin_edit_kilobytes'];
569
-			else
570
-				$size = comma_format($size) . ' ' . $txt['themeadmin_edit_bytes'];
587
+			if ($size > 2048 || $size == 1024) {
588
+							$size = comma_format($size / 1024) . ' ' . $txt['themeadmin_edit_kilobytes'];
589
+			} else {
590
+							$size = comma_format($size) . ' ' . $txt['themeadmin_edit_bytes'];
591
+			}
571 592
 
572 593
 			$listing2[] = array(
573 594
 				'filename' => $entry,
Please login to merge, or discard this patch.
Sources/Subscriptions-PayPal.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -402,7 +402,7 @@
 block discarded – undo
402 402
 	 * A private function to find out the subscription details.
403 403
 	 *
404 404
 	 * @access private
405
-	 * @return boolean|void False on failure, otherwise just sets $_POST['item_number']
405
+	 * @return false|null False on failure, otherwise just sets $_POST['item_number']
406 406
 	 */
407 407
 	private function _findSubscription()
408 408
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
 			$header = 'POST /cgi-bin/webscr HTTP/1.1' . "\r\n";
237 237
 			$header .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
238 238
 			$header .= 'Host: www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'paypal.com' . "\r\n";
239
-			$header .= 'Content-Length: ' . strlen ($requestString) . "\r\n";
239
+			$header .= 'Content-Length: ' . strlen($requestString) . "\r\n";
240 240
 			$header .= 'Connection: close' . "\r\n\r\n";
241 241
 
242 242
 			// Open the connection.
Please login to merge, or discard this patch.
Braces   +83 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 // This won't be dedicated without this - this must exist in each gateway!
15 15
 // SMF Payment Gateway: paypal
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Class for returning available form data for this gateway
@@ -118,8 +119,7 @@  discard block
 block discarded – undo
118 119
 		{
119 120
 			$return_data['hidden']['p3'] = 1;
120 121
 			$return_data['hidden']['t3'] = strtoupper(substr($period, 0, 1));
121
-		}
122
-		else
122
+		} else
123 123
 		{
124 124
 			preg_match('~(\d*)(\w)~', $sub_data['real_length'], $match);
125 125
 			$unit = $match[1];
@@ -130,14 +130,15 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		// If it's repeatable do some javascript to respect this idea.
133
-		if (!empty($sub_data['repeatable']))
134
-			$return_data['javascript'] = '
133
+		if (!empty($sub_data['repeatable'])) {
134
+					$return_data['javascript'] = '
135 135
 				document.write(\'<label for="do_paypal_recur"><input type="checkbox" name="do_paypal_recur" id="do_paypal_recur" checked onclick="switchPaypalRecur();">' . $txt['paid_make_recurring'] . '</label><br>\');
136 136
 
137 137
 				function switchPaypalRecur()
138 138
 				{
139 139
 					document.getElementById("paypal_cmd").value = document.getElementById("do_paypal_recur").checked ? "_xclick-subscriptions" : "_xclick";
140 140
 				}';
141
+		}
141 142
 
142 143
 		return $return_data;
143 144
 	}
@@ -160,20 +161,24 @@  discard block
 block discarded – undo
160 161
 		global $modSettings;
161 162
 
162 163
 		// Has the user set up an email address?
163
-		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email'])))
164
-			return false;
164
+		if ((empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_email'])) || (!empty($modSettings['paidsubs_test']) && empty($modSettings['paypal_sandbox_email']))) {
165
+					return false;
166
+		}
165 167
 		// Check the correct transaction types are even here.
166
-		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
167
-			return false;
168
+		if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email']))) {
169
+					return false;
170
+		}
168 171
 		// Correct email address?
169
-		if (!isset($_POST['business']))
170
-			$_POST['business'] = $_POST['receiver_email'];
172
+		if (!isset($_POST['business'])) {
173
+					$_POST['business'] = $_POST['receiver_email'];
174
+		}
171 175
 
172 176
 		// Are we testing?
173
-		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
174
-			return false;
175
-		elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails']))))
176
-			return false;
177
+		if (empty($modSettings['paidsubs_test']) && strtolower($modSettings['paypal_sandbox_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
178
+					return false;
179
+		} elseif (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', $modSettings['paypal_additional_emails'])))) {
180
+					return false;
181
+		}
177 182
 		return true;
178 183
 	}
179 184
 
@@ -192,15 +197,17 @@  discard block
 block discarded – undo
192 197
 		global $modSettings, $txt;
193 198
 
194 199
 		// Put this to some default value.
195
-		if (!isset($_POST['txn_type']))
196
-			$_POST['txn_type'] = '';
200
+		if (!isset($_POST['txn_type'])) {
201
+					$_POST['txn_type'] = '';
202
+		}
197 203
 
198 204
 		// Build the request string - starting with the minimum requirement.
199 205
 		$requestString = 'cmd=_notify-validate';
200 206
 
201 207
 		// Now my dear, add all the posted bits in the order we got them
202
-		foreach ($_POST as $k => $v)
203
-			$requestString .= '&' . $k . '=' . urlencode($v);
208
+		foreach ($_POST as $k => $v) {
209
+					$requestString .= '&' . $k . '=' . urlencode($v);
210
+		}
204 211
 
205 212
 		// Can we use curl?
206 213
 		if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))
@@ -240,14 +247,16 @@  discard block
 block discarded – undo
240 247
 			$header .= 'Connection: close' . "\r\n\r\n";
241 248
 
242 249
 			// Open the connection.
243
-			if (!empty($modSettings['paidsubs_test']))
244
-				$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
245
-			else
246
-				$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
250
+			if (!empty($modSettings['paidsubs_test'])) {
251
+							$fp = fsockopen('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
252
+			} else {
253
+							$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
254
+			}
247 255
 
248 256
 			// Did it work?
249
-			if (!$fp)
250
-				generateSubscriptionError($txt['paypal_could_not_connect']);
257
+			if (!$fp) {
258
+							generateSubscriptionError($txt['paypal_could_not_connect']);
259
+			}
251 260
 
252 261
 			// Put the data to the port.
253 262
 			fputs($fp, $header . $requestString);
@@ -256,8 +265,9 @@  discard block
 block discarded – undo
256 265
 			while (!feof($fp))
257 266
 			{
258 267
 				$this->return_data = fgets($fp, 1024);
259
-				if (strcmp(trim($this->return_data), 'VERIFIED') === 0)
260
-					break;
268
+				if (strcmp(trim($this->return_data), 'VERIFIED') === 0) {
269
+									break;
270
+				}
261 271
 			}
262 272
 
263 273
 			// Clean up.
@@ -265,28 +275,34 @@  discard block
 block discarded – undo
265 275
 		}
266 276
 
267 277
 		// If this isn't verified then give up...
268
-		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0)
269
-			exit;
278
+		if (strcmp(trim($this->return_data), 'VERIFIED') !== 0) {
279
+					exit;
280
+		}
270 281
 
271 282
 		// Check that this is intended for us.
272
-		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails'])))))
273
-			exit;
283
+		if (strtolower($modSettings['paypal_email']) != strtolower($_POST['business']) && (empty($modSettings['paypal_additional_emails']) || !in_array(strtolower($_POST['business']), explode(',', strtolower($modSettings['paypal_additional_emails']))))) {
284
+					exit;
285
+		}
274 286
 
275 287
 		// Is this a subscription - and if so is it a secondary payment that we need to process?
276 288
 		// If so, make sure we get it in the expected format. Seems PayPal sometimes sends it without urlencoding.
277
-		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false)
278
-			$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
279
-		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false))
280
-			// Calculate the subscription it relates to!
289
+		if (!empty($_POST['item_number']) && strpos($_POST['item_number'], ' ') !== false) {
290
+					$_POST['item_number'] = str_replace(' ', '+', $_POST['item_number']);
291
+		}
292
+		if ($this->isSubscription() && (empty($_POST['item_number']) || strpos($_POST['item_number'], '+') === false)) {
293
+					// Calculate the subscription it relates to!
281 294
 			$this->_findSubscription();
295
+		}
282 296
 
283 297
 		// Verify the currency!
284
-		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code']))
285
-			exit;
298
+		if (strtolower($_POST['mc_currency']) !== strtolower($modSettings['paid_currency_code'])) {
299
+					exit;
300
+		}
286 301
 
287 302
 		// Can't exist if it doesn't contain anything.
288
-		if (empty($_POST['item_number']))
289
-			exit;
303
+		if (empty($_POST['item_number'])) {
304
+					exit;
305
+		}
290 306
 
291 307
 		// Return the id_sub and id_member
292 308
 		return explode('+', $_POST['item_number']);
@@ -299,10 +315,11 @@  discard block
 block discarded – undo
299 315
 	 */
300 316
 	public function isRefund()
301 317
 	{
302
-		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed'))
303
-			return true;
304
-		else
305
-			return false;
318
+		if ($_POST['payment_status'] === 'Refunded' || $_POST['payment_status'] === 'Reversed' || $_POST['txn_type'] === 'Refunded' || ($_POST['txn_type'] === 'reversal' && $_POST['payment_status'] === 'Completed')) {
319
+					return true;
320
+		} else {
321
+					return false;
322
+		}
306 323
 	}
307 324
 
308 325
 	/**
@@ -312,10 +329,11 @@  discard block
 block discarded – undo
312 329
 	 */
313 330
 	public function isSubscription()
314 331
 	{
315
-		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed')
316
-			return true;
317
-		else
318
-			return false;
332
+		if (substr($_POST['txn_type'], 0, 14) === 'subscr_payment' && $_POST['payment_status'] === 'Completed') {
333
+					return true;
334
+		} else {
335
+					return false;
336
+		}
319 337
 	}
320 338
 
321 339
 	/**
@@ -325,10 +343,11 @@  discard block
 block discarded – undo
325 343
 	 */
326 344
 	public function isPayment()
327 345
 	{
328
-		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept')
329
-			return true;
330
-		else
331
-			return false;
346
+		if ($_POST['payment_status'] === 'Completed' && $_POST['txn_type'] === 'web_accept') {
347
+					return true;
348
+		} else {
349
+					return false;
350
+		}
332 351
 	}
333 352
 
334 353
 	/**
@@ -341,10 +360,11 @@  discard block
 block discarded – undo
341 360
 		// subscr_cancel is sent when the user cancels, subscr_eot is sent when the subscription reaches final payment
342 361
 		// Neither require us to *do* anything as per performCancel().
343 362
 		// subscr_eot, if sent, indicates an end of payments term.
344
-		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot')
345
-			return true;
346
-		else
347
-			return false;
363
+		if (substr($_POST['txn_type'], 0, 13) === 'subscr_cancel' || substr($_POST['txn_type'], 0, 10) === 'subscr_eot') {
364
+					return true;
365
+		} else {
366
+					return false;
367
+		}
348 368
 	}
349 369
 
350 370
 	/**
@@ -408,8 +428,9 @@  discard block
 block discarded – undo
408 428
 		global $smcFunc;
409 429
 
410 430
 		// Assume we have this?
411
-		if (empty($_POST['subscr_id']))
412
-			return false;
431
+		if (empty($_POST['subscr_id'])) {
432
+					return false;
433
+		}
413 434
 
414 435
 		// Do we have this in the database?
415 436
 		$request = $smcFunc['db_query']('', '
@@ -438,11 +459,12 @@  discard block
 block discarded – undo
438 459
 						'payer_email' => $_POST['payer_email'],
439 460
 					)
440 461
 				);
441
-				if ($smcFunc['db_num_rows']($request) === 0)
442
-					return false;
462
+				if ($smcFunc['db_num_rows']($request) === 0) {
463
+									return false;
464
+				}
465
+			} else {
466
+							return false;
443 467
 			}
444
-			else
445
-				return false;
446 468
 		}
447 469
 		list ($member_id, $subscription_id) = $smcFunc['db_fetch_row']($request);
448 470
 		$_POST['item_number'] = $member_id . '+' . $subscription_id;
Please login to merge, or discard this patch.
Sources/tasks/EventNew-Notify.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 {
22 22
 	/**
23 23
      * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
24
-	 * @return bool Always returns true
24
+	 * @return boolean|null Always returns true
25 25
 	 */
26 26
 	public function execute()
27 27
  	{
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 		$members = membersAllowedTo('calendar_view');
33 33
 
34 34
 		// Don't alert the event creator
35
-		if (!empty($this->_details['sender_id']))
36
-			$members = array_diff($members, array($this->_details['sender_id']));
35
+		if (!empty($this->_details['sender_id'])) {
36
+					$members = array_diff($members, array($this->_details['sender_id']));
37
+		}
37 38
 
38 39
 		// Having successfully figured this out, now let's get the preferences of everyone.
39 40
 		require_once($sourcedir . '/Subs-Notify.php');
@@ -44,10 +45,11 @@  discard block
 block discarded – undo
44 45
 		if (!empty($this->_details['sender_id']) && empty($this->_details['sender_name']))
45 46
 		{
46 47
 			loadMemberData($this->_details['sender_id'], 'minimal');
47
-			if (!empty($user_profile[$this->_details['sender_id']]))
48
-				$this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name'];
49
-			else
50
-				$this->_details['sender_id'] = 0;
48
+			if (!empty($user_profile[$this->_details['sender_id']])) {
49
+							$this->_details['sender_name'] = $user_profile[$this->_details['sender_id']]['real_name'];
50
+			} else {
51
+							$this->_details['sender_id'] = 0;
52
+			}
51 53
 		}
52 54
 
53 55
 		// So now we find out who wants what.
@@ -59,9 +61,10 @@  discard block
 block discarded – undo
59 61
 
60 62
 		foreach ($prefs as $member => $pref_option)
61 63
 		{
62
-			foreach ($alert_bits as $type => $bitvalue)
63
-				if ($pref_option['event_new'] & $bitvalue)
64
+			foreach ($alert_bits as $type => $bitvalue) {
65
+							if ($pref_option['event_new'] & $bitvalue)
64 66
 					$notifies[$type][] = $member;
67
+			}
65 68
 		}
66 69
 
67 70
 		// Firstly, anyone who wants alerts.
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 class EventNew_Notify_Background extends SMF_BackgroundTask
21 21
 {
22 22
 	/**
23
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
24 24
 	 * @return bool Always returns true
25 25
 	 */
26 26
 	public function execute()
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 					'content_action' => empty($this->_details['sender_id']) ? 'new_guest' : 'new',
82 82
 					'is_read' => 0,
83 83
 					'extra' => $smcFunc['json_encode'](
84
-					    array(
85
-					        "event_id" => $this->_details['event_id'],
84
+						array(
85
+							"event_id" => $this->_details['event_id'],
86 86
 							"event_title" => $this->_details['event_title']
87 87
 						)
88 88
 					),
Please login to merge, or discard this patch.
Sources/Xml.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 /**
81 81
  * Handles retrieving previews of news items, newsletters, signatures and warnings.
82 82
  * Calls the appropriate function based on $_POST['item']
83
- * @return void|bool Returns false if $_POST['item'] isn't set or isn't valid
83
+ * @return false|null Returns false if $_POST['item'] isn't set or isn't valid
84 84
  */
85 85
 function RetrievePreview()
86 86
 {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -272,13 +272,13 @@
 block discarded – undo
272 272
 				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
273 273
 			// Add in few replacements.
274 274
 			/**
275
-			* These are the defaults:
276
-			* - {MEMBER} - Member Name. => current user for review
277
-			* - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced
278
-			* - {FORUMNAME} - Forum Name.
279
-			* - {SCRIPTURL} - Web address of forum.
280
-			* - {REGARDS} - Standard email sign-off.
281
-			*/
275
+			 * These are the defaults:
276
+			 * - {MEMBER} - Member Name. => current user for review
277
+			 * - {MESSAGE} - Link to Offending Post. (If Applicable) => not applicable here, so not replaced
278
+			 * - {FORUMNAME} - Forum Name.
279
+			 * - {SCRIPTURL} - Web address of forum.
280
+			 * - {REGARDS} - Standard email sign-off.
281
+			 */
282 282
 			$find = array(
283 283
 				'{MEMBER}',
284 284
 				'{FORUMNAME}',
Please login to merge, or discard this patch.
Braces   +55 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
  * @version 2.1 Beta 4
14 14
  */
15 15
 
16
-if (!defined('SMF'))
16
+if (!defined('SMF')) {
17 17
 	die('No direct access...');
18
+}
18 19
 
19 20
 /**
20 21
  * The main handler and designator for AJAX stuff - jumpto, message icons and previews
@@ -32,8 +33,9 @@  discard block
 block discarded – undo
32 33
 	// Easy adding of sub actions.
33 34
 	call_integration_hook('integrate_XMLhttpMain_subActions', array(&$subActions));
34 35
 
35
-	if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]))
36
-		fatal_lang_error('no_access', false);
36
+	if (!isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']])) {
37
+			fatal_lang_error('no_access', false);
38
+	}
37 39
 
38 40
 	call_helper($subActions[$_REQUEST['sa']]);
39 41
 }
@@ -57,8 +59,9 @@  discard block
 block discarded – undo
57 59
 	foreach ($context['jump_to'] as $id_cat => $cat)
58 60
 	{
59 61
 		$context['jump_to'][$id_cat]['name'] = un_htmlspecialchars(strip_tags($cat['name']));
60
-		foreach ($cat['boards'] as $id_board => $board)
61
-			$context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name']));
62
+		foreach ($cat['boards'] as $id_board => $board) {
63
+					$context['jump_to'][$id_cat]['boards'][$id_board]['name'] = un_htmlspecialchars(strip_tags($board['name']));
64
+		}
62 65
 	}
63 66
 
64 67
 	$context['sub_template'] = 'jump_to';
@@ -95,8 +98,9 @@  discard block
 block discarded – undo
95 98
 
96 99
 	$context['sub_template'] = 'generic_xml';
97 100
 
98
-	if (!isset($_POST['item']) || !in_array($_POST['item'], $items))
99
-		return false;
101
+	if (!isset($_POST['item']) || !in_array($_POST['item'], $items)) {
102
+			return false;
103
+	}
100 104
 
101 105
 	$_POST['item']();
102 106
 }
@@ -112,10 +116,11 @@  discard block
 block discarded – undo
112 116
 
113 117
 	$errors = array();
114 118
 	$news = !isset($_POST['news']) ? '' : $smcFunc['htmlspecialchars']($_POST['news'], ENT_QUOTES);
115
-	if (empty($news))
116
-		$errors[] = array('value' => 'no_news');
117
-	else
118
-		preparsecode($news);
119
+	if (empty($news)) {
120
+			$errors[] = array('value' => 'no_news');
121
+	} else {
122
+			preparsecode($news);
123
+	}
119 124
 
120 125
 	$context['xml_data'] = array(
121 126
 		'news' => array(
@@ -148,10 +153,12 @@  discard block
 block discarded – undo
148 153
 	$context['send_pm'] = !empty($_POST['send_pm']) ? 1 : 0;
149 154
 	$context['send_html'] = !empty($_POST['send_html']) ? 1 : 0;
150 155
 
151
-	if (empty($_POST['subject']))
152
-		$context['post_error']['messages'][] = $txt['error_no_subject'];
153
-	if (empty($_POST['message']))
154
-		$context['post_error']['messages'][] = $txt['error_no_message'];
156
+	if (empty($_POST['subject'])) {
157
+			$context['post_error']['messages'][] = $txt['error_no_subject'];
158
+	}
159
+	if (empty($_POST['message'])) {
160
+			$context['post_error']['messages'][] = $txt['error_no_message'];
161
+	}
155 162
 
156 163
 	prepareMailingForPreview();
157 164
 
@@ -196,38 +203,41 @@  discard block
 block discarded – undo
196 203
 		$preview_signature = !empty($_POST['signature']) ? $_POST['signature'] : $txt['no_signature_preview'];
197 204
 		$validation = profileValidateSignature($preview_signature);
198 205
 
199
-		if ($validation !== true && $validation !== false)
200
-			$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
206
+		if ($validation !== true && $validation !== false) {
207
+					$errors[] = array('value' => $txt['profile_error_' . $validation], 'attributes' => array('type' => 'error'));
208
+		}
201 209
 
202 210
 		censorText($preview_signature);
203 211
 		$preview_signature = parse_bbc($preview_signature, true, 'sig' . $user);
204
-	}
205
-	elseif (!$can_change)
212
+	} elseif (!$can_change)
206 213
 	{
207
-		if ($is_owner)
208
-			$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
209
-		else
210
-			$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
214
+		if ($is_owner) {
215
+					$errors[] = array('value' => $txt['cannot_profile_extra_own'], 'attributes' => array('type' => 'error'));
216
+		} else {
217
+					$errors[] = array('value' => $txt['cannot_profile_extra_any'], 'attributes' => array('type' => 'error'));
218
+		}
219
+	} else {
220
+			$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
211 221
 	}
212
-	else
213
-		$errors[] = array('value' => $txt['no_user_selected'], 'attributes' => array('type' => 'error'));
214 222
 
215 223
 	$context['xml_data']['signatures'] = array(
216 224
 			'identifier' => 'signature',
217 225
 			'children' => array()
218 226
 		);
219
-	if (isset($current_signature))
220
-		$context['xml_data']['signatures']['children'][] = array(
227
+	if (isset($current_signature)) {
228
+			$context['xml_data']['signatures']['children'][] = array(
221 229
 					'value' => $current_signature,
222 230
 					'attributes' => array('type' => 'current'),
223 231
 				);
224
-	if (isset($preview_signature))
225
-		$context['xml_data']['signatures']['children'][] = array(
232
+	}
233
+	if (isset($preview_signature)) {
234
+			$context['xml_data']['signatures']['children'][] = array(
226 235
 					'value' => $preview_signature,
227 236
 					'attributes' => array('type' => 'preview'),
228 237
 				);
229
-	if (!empty($errors))
230
-		$context['xml_data']['errors'] = array(
238
+	}
239
+	if (!empty($errors)) {
240
+			$context['xml_data']['errors'] = array(
231 241
 			'identifier' => 'error',
232 242
 			'children' => array_merge(
233 243
 				array(
@@ -239,7 +249,8 @@  discard block
 block discarded – undo
239 249
 				$errors
240 250
 			),
241 251
 		);
242
-}
252
+	}
253
+	}
243 254
 
244 255
 /**
245 256
  * Handles previewing user warnings
@@ -259,15 +270,17 @@  discard block
 block discarded – undo
259 270
 		$context['preview_subject'] = !empty($_POST['title']) ? trim($smcFunc['htmlspecialchars']($_POST['title'])) : '';
260 271
 		if (isset($_POST['issuing']))
261 272
 		{
262
-			if (empty($_POST['title']) || empty($_POST['body']))
263
-				$context['post_error']['messages'][] = $txt['warning_notify_blank'];
264
-		}
265
-		else
273
+			if (empty($_POST['title']) || empty($_POST['body'])) {
274
+							$context['post_error']['messages'][] = $txt['warning_notify_blank'];
275
+			}
276
+		} else
266 277
 		{
267
-			if (empty($_POST['title']))
268
-				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title'];
269
-			if (empty($_POST['body']))
270
-				$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
278
+			if (empty($_POST['title'])) {
279
+							$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_title'];
280
+			}
281
+			if (empty($_POST['body'])) {
282
+							$context['post_error']['messages'][] = $txt['mc_warning_template_error_no_body'];
283
+			}
271 284
 			// Add in few replacements.
272 285
 			/**
273 286
 			* These are the defaults:
@@ -298,9 +311,9 @@  discard block
 block discarded – undo
298 311
 			$warning_body = parse_bbc($warning_body, true);
299 312
 		}
300 313
 		$context['preview_message'] = $warning_body;
314
+	} else {
315
+			$context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
301 316
 	}
302
-	else
303
-		$context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
304 317
 
305 318
 	$context['sub_template'] = 'warning';
306 319
 }
Please login to merge, or discard this patch.
SSI.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 /**
1718 1718
  * Show today's birthdays.
1719 1719
  * @param string $output_method The output method. If 'echo', displays a list of users, otherwise returns an array of info about them.
1720
- * @return void|array Displays a list of users or returns an array of info about them depending on output_method.
1720
+ * @return null|string Displays a list of users or returns an array of info about them depending on output_method.
1721 1721
  */
1722 1722
 function ssi_todaysBirthdays($output_method = 'echo')
1723 1723
 {
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 /**
1747 1747
  * Shows today's holidays.
1748 1748
  * @param string $output_method The output method. If 'echo', displays a list of holidays, otherwise returns an array of info about them.
1749
- * @return void|array Displays a list of holidays or returns an array of info about them depending on output_method
1749
+ * @return null|string Displays a list of holidays or returns an array of info about them depending on output_method
1750 1750
  */
1751 1751
 function ssi_todaysHolidays($output_method = 'echo')
1752 1752
 {
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 
1774 1774
 /**
1775 1775
  * @param string $output_method The output method. If 'echo', displays a list of events, otherwise returns an array of info about them.
1776
- * @return void|array Displays a list of events or returns an array of info about them depending on output_method
1776
+ * @return null|string Displays a list of events or returns an array of info about them depending on output_method
1777 1777
  */
1778 1778
 function ssi_todaysEvents($output_method = 'echo')
1779 1779
 {
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 /**
1808 1808
  * Shows today's calendar items (events, birthdays and holidays)
1809 1809
  * @param string $output_method The output method. If 'echo', displays a list of calendar items, otherwise returns an array of info about them.
1810
- * @return void|array Displays a list of calendar items or returns an array of info about them depending on output_method
1810
+ * @return null|string Displays a list of calendar items or returns an array of info about them depending on output_method
1811 1811
  */
1812 1812
 function ssi_todaysCalendar($output_method = 'echo')
1813 1813
 {
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
  * @param int|string $id The ID or username of a user
2199 2199
  * @param string $password The password to check
2200 2200
  * @param bool $is_username If true, treats $id as a username rather than a user ID
2201
- * @return bool Whether or not the password is correct.
2201
+ * @return null|boolean Whether or not the password is correct.
2202 2202
  */
2203 2203
 function ssi_checkPassword($id = null, $password = null, $is_username = false)
2204 2204
 {
Please login to merge, or discard this patch.
Braces   +426 added lines, -304 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Don't do anything if SMF is already loaded.
15
-if (defined('SMF'))
15
+if (defined('SMF')) {
16 16
 	return true;
17
+}
17 18
 
18 19
 define('SMF', 'SSI');
19 20
 
@@ -28,16 +29,18 @@  discard block
 block discarded – undo
28 29
 $time_start = microtime(true);
29 30
 
30 31
 // Just being safe...
31
-foreach (array('db_character_set', 'cachedir') as $variable)
32
+foreach (array('db_character_set', 'cachedir') as $variable) {
32 33
 	if (isset($GLOBALS[$variable]))
33 34
 		unset($GLOBALS[$variable]);
35
+}
34 36
 
35 37
 // Get the forum's settings for database and file paths.
36 38
 require_once(dirname(__FILE__) . '/Settings.php');
37 39
 
38 40
 // Make absolutely sure the cache directory is defined.
39
-if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache'))
41
+if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) {
40 42
 	$cachedir = $boarddir . '/cache';
43
+}
41 44
 
42 45
 $ssi_error_reporting = error_reporting(E_ALL);
43 46
 /* Set this to one of three values depending on what you want to happen in the case of a fatal error.
@@ -48,12 +51,14 @@  discard block
 block discarded – undo
48 51
 $ssi_on_error_method = false;
49 52
 
50 53
 // Don't do john didley if the forum's been shut down completely.
51
-if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true))
54
+if ($maintenance == 2 && (!isset($ssi_maintenance_off) || $ssi_maintenance_off !== true)) {
52 55
 	die($mmessage);
56
+}
53 57
 
54 58
 // Fix for using the current directory as a path.
55
-if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.')
59
+if (substr($sourcedir, 0, 1) == '.' && substr($sourcedir, 1, 1) != '.') {
56 60
 	$sourcedir = dirname(__FILE__) . substr($sourcedir, 1);
61
+}
57 62
 
58 63
 // Load the important includes.
59 64
 require_once($sourcedir . '/QueryString.php');
@@ -78,34 +83,38 @@  discard block
 block discarded – undo
78 83
 cleanRequest();
79 84
 
80 85
 // Seed the random generator?
81
-if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69)
86
+if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) {
82 87
 	smf_seed_generator();
88
+}
83 89
 
84 90
 // Check on any hacking attempts.
85
-if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS']))
91
+if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
86 92
 	die('No direct access...');
87
-elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme)
93
+} elseif (isset($_REQUEST['ssi_theme']) && (int) $_REQUEST['ssi_theme'] == (int) $ssi_theme) {
88 94
 	die('No direct access...');
89
-elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme)
95
+} elseif (isset($_COOKIE['ssi_theme']) && (int) $_COOKIE['ssi_theme'] == (int) $ssi_theme) {
90 96
 	die('No direct access...');
91
-elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers)
97
+} elseif (isset($_REQUEST['ssi_layers'], $ssi_layers) && (@get_magic_quotes_gpc() ? stripslashes($_REQUEST['ssi_layers']) : $_REQUEST['ssi_layers']) == $ssi_layers) {
92 98
 	die('No direct access...');
93
-if (isset($_REQUEST['context']))
99
+}
100
+if (isset($_REQUEST['context'])) {
94 101
 	die('No direct access...');
102
+}
95 103
 
96 104
 // Gzip output? (because it must be boolean and true, this can't be hacked.)
97
-if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>='))
105
+if (isset($ssi_gzip) && $ssi_gzip === true && ini_get('zlib.output_compression') != '1' && ini_get('output_handler') != 'ob_gzhandler' && version_compare(PHP_VERSION, '4.2.0', '>=')) {
98 106
 	ob_start('ob_gzhandler');
99
-else
107
+} else {
100 108
 	$modSettings['enableCompressedOutput'] = '0';
109
+}
101 110
 
102 111
 // Primarily, this is to fix the URLs...
103 112
 ob_start('ob_sessrewrite');
104 113
 
105 114
 // Start the session... known to scramble SSI includes in cases...
106
-if (!headers_sent())
115
+if (!headers_sent()) {
107 116
 	loadSession();
108
-else
117
+} else
109 118
 {
110 119
 	if (isset($_COOKIE[session_name()]) || isset($_REQUEST[session_name()]))
111 120
 	{
@@ -139,12 +148,14 @@  discard block
 block discarded – undo
139 148
 loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
140 149
 
141 150
 // @todo: probably not the best place, but somewhere it should be set...
142
-if (!headers_sent())
151
+if (!headers_sent()) {
143 152
 	header('Content-Type: text/html; charset=' . (empty($modSettings['global_character_set']) ? (empty($txt['lang_character_set']) ? 'ISO-8859-1' : $txt['lang_character_set']) : $modSettings['global_character_set']));
153
+}
144 154
 
145 155
 // Take care of any banning that needs to be done.
146
-if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true))
156
+if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true)) {
147 157
 	is_not_banned();
158
+}
148 159
 
149 160
 // Do we allow guests in here?
150 161
 if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php')
@@ -159,17 +170,19 @@  discard block
 block discarded – undo
159 170
 {
160 171
 	$context['template_layers'] = $ssi_layers;
161 172
 	template_header();
162
-}
163
-else
173
+} else {
164 174
 	setupThemeContext();
175
+}
165 176
 
166 177
 // Make sure they didn't muss around with the settings... but only if it's not cli.
167
-if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '')
178
+if (isset($_SERVER['REMOTE_ADDR']) && !isset($_SERVER['is_cli']) && session_id() == '') {
168 179
 	trigger_error($txt['ssi_session_broken'], E_USER_NOTICE);
180
+}
169 181
 
170 182
 // Without visiting the forum this session variable might not be set on submit.
171
-if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote'))
183
+if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) {
172 184
 	$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
185
+}
173 186
 
174 187
 // Have the ability to easily add functions to SSI.
175 188
 call_integration_hook('integrate_SSI');
@@ -178,11 +191,13 @@  discard block
 block discarded – undo
178 191
 if (basename($_SERVER['PHP_SELF']) == 'SSI.php')
179 192
 {
180 193
 	// You shouldn't just access SSI.php directly by URL!!
181
-	if (!isset($_GET['ssi_function']))
182
-		die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
194
+	if (!isset($_GET['ssi_function'])) {
195
+			die(sprintf($txt['ssi_not_direct'], $user_info['is_admin'] ? '\'' . addslashes(__FILE__) . '\'' : '\'SSI.php\''));
196
+	}
183 197
 	// Call a function passed by GET.
184
-	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest']))
185
-		call_user_func('ssi_' . $_GET['ssi_function']);
198
+	if (function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) {
199
+			call_user_func('ssi_' . $_GET['ssi_function']);
200
+	}
186 201
 	exit;
187 202
 }
188 203
 
@@ -199,9 +214,10 @@  discard block
 block discarded – undo
199 214
  */
200 215
 function ssi_shutdown()
201 216
 {
202
-	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown')
203
-		template_footer();
204
-}
217
+	if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') {
218
+			template_footer();
219
+	}
220
+	}
205 221
 
206 222
 /**
207 223
  * Display a welcome message, like: Hey, User, you have 0 messages, 0 are new.
@@ -214,15 +230,17 @@  discard block
 block discarded – undo
214 230
 
215 231
 	if ($output_method == 'echo')
216 232
 	{
217
-		if ($context['user']['is_guest'])
218
-			echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
219
-		else
220
-			echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
233
+		if ($context['user']['is_guest']) {
234
+					echo sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup');
235
+		} else {
236
+					echo $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>', allowedTo('pm_read') ? ', ' . (empty($context['user']['messages']) ? $txt['msg_alert_no_messages'] : (($context['user']['messages'] == 1 ? sprintf($txt['msg_alert_one_message'], $scripturl . '?action=pm') : sprintf($txt['msg_alert_many_message'], $scripturl . '?action=pm', $context['user']['messages'])) . ', ' . ($context['user']['unread_messages'] == 1 ? $txt['msg_alert_one_new'] : sprintf($txt['msg_alert_many_new'], $context['user']['unread_messages'])))) : '';
237
+		}
221 238
 	}
222 239
 	// Don't echo... then do what?!
223
-	else
224
-		return $context['user'];
225
-}
240
+	else {
241
+			return $context['user'];
242
+	}
243
+	}
226 244
 
227 245
 /**
228 246
  * Display a menu bar, like is displayed at the top of the forum.
@@ -233,12 +251,14 @@  discard block
 block discarded – undo
233 251
 {
234 252
 	global $context;
235 253
 
236
-	if ($output_method == 'echo')
237
-		template_menu();
254
+	if ($output_method == 'echo') {
255
+			template_menu();
256
+	}
238 257
 	// What else could this do?
239
-	else
240
-		return $context['menu_buttons'];
241
-}
258
+	else {
259
+			return $context['menu_buttons'];
260
+	}
261
+	}
242 262
 
243 263
 /**
244 264
  * Show a logout link.
@@ -250,20 +270,23 @@  discard block
 block discarded – undo
250 270
 {
251 271
 	global $context, $txt, $scripturl;
252 272
 
253
-	if ($redirect_to != '')
254
-		$_SESSION['logout_url'] = $redirect_to;
273
+	if ($redirect_to != '') {
274
+			$_SESSION['logout_url'] = $redirect_to;
275
+	}
255 276
 
256 277
 	// Guests can't log out.
257
-	if ($context['user']['is_guest'])
258
-		return false;
278
+	if ($context['user']['is_guest']) {
279
+			return false;
280
+	}
259 281
 
260 282
 	$link = '<a href="' . $scripturl . '?action=logout;' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['logout'] . '</a>';
261 283
 
262
-	if ($output_method == 'echo')
263
-		echo $link;
264
-	else
265
-		return $link;
266
-}
284
+	if ($output_method == 'echo') {
285
+			echo $link;
286
+	} else {
287
+			return $link;
288
+	}
289
+	}
267 290
 
268 291
 /**
269 292
  * Recent post list:   [board] Subject by Poster    Date
@@ -279,17 +302,17 @@  discard block
 block discarded – undo
279 302
 	global $modSettings, $context;
280 303
 
281 304
 	// Excluding certain boards...
282
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
283
-		$exclude_boards = array($modSettings['recycle_board']);
284
-	else
285
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
305
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
306
+			$exclude_boards = array($modSettings['recycle_board']);
307
+	} else {
308
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
309
+	}
286 310
 
287 311
 	// What about including certain boards - note we do some protection here as pre-2.0 didn't have this parameter.
288 312
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
289 313
 	{
290 314
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
291
-	}
292
-	elseif ($include_boards != null)
315
+	} elseif ($include_boards != null)
293 316
 	{
294 317
 		$include_boards = array();
295 318
 	}
@@ -326,8 +349,9 @@  discard block
 block discarded – undo
326 349
 {
327 350
 	global $modSettings;
328 351
 
329
-	if (empty($post_ids))
330
-		return;
352
+	if (empty($post_ids)) {
353
+			return;
354
+	}
331 355
 
332 356
 	// Allow the user to request more than one - why not?
333 357
 	$post_ids = is_array($post_ids) ? $post_ids : array($post_ids);
@@ -362,8 +386,9 @@  discard block
 block discarded – undo
362 386
 	global $scripturl, $txt, $user_info;
363 387
 	global $modSettings, $smcFunc, $context;
364 388
 
365
-	if (!empty($modSettings['enable_likes']))
366
-		$context['can_like'] = allowedTo('likes_like');
389
+	if (!empty($modSettings['enable_likes'])) {
390
+			$context['can_like'] = allowedTo('likes_like');
391
+	}
367 392
 
368 393
 	// Find all the posts. Newer ones will have higher IDs.
369 394
 	$request = $smcFunc['db_query']('substring', '
@@ -429,12 +454,13 @@  discard block
 block discarded – undo
429 454
 		);
430 455
 
431 456
 		// Get the likes for each message.
432
-		if (!empty($modSettings['enable_likes']))
433
-			$posts[$row['id_msg']]['likes'] = array(
457
+		if (!empty($modSettings['enable_likes'])) {
458
+					$posts[$row['id_msg']]['likes'] = array(
434 459
 				'count' => $row['likes'],
435 460
 				'you' => in_array($row['id_msg'], prepareLikesContext($row['id_topic'])),
436 461
 				'can_like' => !$context['user']['is_guest'] && $row['id_member'] != $context['user']['id'] && !empty($context['can_like']),
437 462
 			);
463
+		}
438 464
 	}
439 465
 	$smcFunc['db_free_result']($request);
440 466
 
@@ -442,13 +468,14 @@  discard block
 block discarded – undo
442 468
 	call_integration_hook('integrate_ssi_queryPosts', array(&$posts));
443 469
 
444 470
 	// Just return it.
445
-	if ($output_method != 'echo' || empty($posts))
446
-		return $posts;
471
+	if ($output_method != 'echo' || empty($posts)) {
472
+			return $posts;
473
+	}
447 474
 
448 475
 	echo '
449 476
 		<table style="border: none" class="ssi_table">';
450
-	foreach ($posts as $post)
451
-		echo '
477
+	foreach ($posts as $post) {
478
+			echo '
452 479
 			<tr>
453 480
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
454 481
 					[', $post['board']['link'], ']
@@ -462,6 +489,7 @@  discard block
 block discarded – undo
462 489
 					', $post['time'], '
463 490
 				</td>
464 491
 			</tr>';
492
+	}
465 493
 	echo '
466 494
 		</table>';
467 495
 }
@@ -479,25 +507,26 @@  discard block
 block discarded – undo
479 507
 	global $settings, $scripturl, $txt, $user_info;
480 508
 	global $modSettings, $smcFunc, $context;
481 509
 
482
-	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
483
-		$exclude_boards = array($modSettings['recycle_board']);
484
-	else
485
-		$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
510
+	if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
511
+			$exclude_boards = array($modSettings['recycle_board']);
512
+	} else {
513
+			$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
514
+	}
486 515
 
487 516
 	// Only some boards?.
488 517
 	if (is_array($include_boards) || (int) $include_boards === $include_boards)
489 518
 	{
490 519
 		$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
491
-	}
492
-	elseif ($include_boards != null)
520
+	} elseif ($include_boards != null)
493 521
 	{
494 522
 		$output_method = $include_boards;
495 523
 		$include_boards = array();
496 524
 	}
497 525
 
498 526
 	$icon_sources = array();
499
-	foreach ($context['stable_icons'] as $icon)
500
-		$icon_sources[$icon] = 'images_url';
527
+	foreach ($context['stable_icons'] as $icon) {
528
+			$icon_sources[$icon] = 'images_url';
529
+	}
501 530
 
502 531
 	// Find all the posts in distinct topics.  Newer ones will have higher IDs.
503 532
 	$request = $smcFunc['db_query']('substring', '
@@ -522,13 +551,15 @@  discard block
 block discarded – undo
522 551
 		)
523 552
 	);
524 553
 	$topics = array();
525
-	while ($row = $smcFunc['db_fetch_assoc']($request))
526
-		$topics[$row['id_topic']] = $row;
554
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
555
+			$topics[$row['id_topic']] = $row;
556
+	}
527 557
 	$smcFunc['db_free_result']($request);
528 558
 
529 559
 	// Did we find anything? If not, bail.
530
-	if (empty($topics))
531
-		return array();
560
+	if (empty($topics)) {
561
+			return array();
562
+	}
532 563
 
533 564
 	$recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
534 565
 
@@ -556,19 +587,22 @@  discard block
 block discarded – undo
556 587
 	while ($row = $smcFunc['db_fetch_assoc']($request))
557 588
 	{
558 589
 		$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br>' => '&#10;')));
559
-		if ($smcFunc['strlen']($row['body']) > 128)
560
-			$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
590
+		if ($smcFunc['strlen']($row['body']) > 128) {
591
+					$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
592
+		}
561 593
 
562 594
 		// Censor the subject.
563 595
 		censorText($row['subject']);
564 596
 		censorText($row['body']);
565 597
 
566 598
 		// Recycled icon
567
-		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board'])
568
-			$row['icon'] = 'recycled';
599
+		if (!empty($recycle_board) && $topics[$row['id_topic']]['id_board']) {
600
+					$row['icon'] = 'recycled';
601
+		}
569 602
 
570
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
571
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
603
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
604
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
605
+		}
572 606
 
573 607
 		// Build the array.
574 608
 		$posts[] = array(
@@ -607,13 +641,14 @@  discard block
 block discarded – undo
607 641
 	call_integration_hook('integrate_ssi_recentTopics', array(&$posts));
608 642
 
609 643
 	// Just return it.
610
-	if ($output_method != 'echo' || empty($posts))
611
-		return $posts;
644
+	if ($output_method != 'echo' || empty($posts)) {
645
+			return $posts;
646
+	}
612 647
 
613 648
 	echo '
614 649
 		<table style="border: none" class="ssi_table">';
615
-	foreach ($posts as $post)
616
-		echo '
650
+	foreach ($posts as $post) {
651
+			echo '
617 652
 			<tr>
618 653
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
619 654
 					[', $post['board']['link'], ']
@@ -627,6 +662,7 @@  discard block
 block discarded – undo
627 662
 					', $post['time'], '
628 663
 				</td>
629 664
 			</tr>';
665
+	}
630 666
 	echo '
631 667
 		</table>';
632 668
 }
@@ -651,27 +687,30 @@  discard block
 block discarded – undo
651 687
 		)
652 688
 	);
653 689
 	$return = array();
654
-	while ($row = $smcFunc['db_fetch_assoc']($request))
655
-		$return[] = array(
690
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
691
+			$return[] = array(
656 692
 			'id' => $row['id_member'],
657 693
 			'name' => $row['real_name'],
658 694
 			'href' => $scripturl . '?action=profile;u=' . $row['id_member'],
659 695
 			'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
660 696
 			'posts' => $row['posts']
661 697
 		);
698
+	}
662 699
 	$smcFunc['db_free_result']($request);
663 700
 
664 701
 	// If mods want to do somthing with this list of members, let them do that now.
665 702
 	call_integration_hook('integrate_ssi_topPoster', array(&$return));
666 703
 
667 704
 	// Just return all the top posters.
668
-	if ($output_method != 'echo')
669
-		return $return;
705
+	if ($output_method != 'echo') {
706
+			return $return;
707
+	}
670 708
 
671 709
 	// Make a quick array to list the links in.
672 710
 	$temp_array = array();
673
-	foreach ($return as $member)
674
-		$temp_array[] = $member['link'];
711
+	foreach ($return as $member) {
712
+			$temp_array[] = $member['link'];
713
+	}
675 714
 
676 715
 	echo implode(', ', $temp_array);
677 716
 }
@@ -703,8 +742,8 @@  discard block
 block discarded – undo
703 742
 		)
704 743
 	);
705 744
 	$boards = array();
706
-	while ($row = $smcFunc['db_fetch_assoc']($request))
707
-		$boards[] = array(
745
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
746
+			$boards[] = array(
708 747
 			'id' => $row['id_board'],
709 748
 			'num_posts' => $row['num_posts'],
710 749
 			'num_topics' => $row['num_topics'],
@@ -713,14 +752,16 @@  discard block
 block discarded – undo
713 752
 			'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
714 753
 			'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>'
715 754
 		);
755
+	}
716 756
 	$smcFunc['db_free_result']($request);
717 757
 
718 758
 	// If mods want to do somthing with this list of boards, let them do that now.
719 759
 	call_integration_hook('integrate_ssi_topBoards', array(&$boards));
720 760
 
721 761
 	// If we shouldn't output or have nothing to output, just jump out.
722
-	if ($output_method != 'echo' || empty($boards))
723
-		return $boards;
762
+	if ($output_method != 'echo' || empty($boards)) {
763
+			return $boards;
764
+	}
724 765
 
725 766
 	echo '
726 767
 		<table class="ssi_table">
@@ -729,13 +770,14 @@  discard block
 block discarded – undo
729 770
 				<th style="text-align: left">', $txt['board_topics'], '</th>
730 771
 				<th style="text-align: left">', $txt['posts'], '</th>
731 772
 			</tr>';
732
-	foreach ($boards as $sBoard)
733
-		echo '
773
+	foreach ($boards as $sBoard) {
774
+			echo '
734 775
 			<tr>
735 776
 				<td>', $sBoard['link'], $sBoard['new'] ? ' <a href="' . $sBoard['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>' : '', '</td>
736 777
 				<td style="text-align: right">', comma_format($sBoard['num_topics']), '</td>
737 778
 				<td style="text-align: right">', comma_format($sBoard['num_posts']), '</td>
738 779
 			</tr>';
780
+	}
739 781
 	echo '
740 782
 		</table>';
741 783
 }
@@ -768,12 +810,13 @@  discard block
 block discarded – undo
768 810
 			)
769 811
 		);
770 812
 		$topic_ids = array();
771
-		while ($row = $smcFunc['db_fetch_assoc']($request))
772
-			$topic_ids[] = $row['id_topic'];
813
+		while ($row = $smcFunc['db_fetch_assoc']($request)) {
814
+					$topic_ids[] = $row['id_topic'];
815
+		}
773 816
 		$smcFunc['db_free_result']($request);
817
+	} else {
818
+			$topic_ids = array();
774 819
 	}
775
-	else
776
-		$topic_ids = array();
777 820
 
778 821
 	$request = $smcFunc['db_query']('', '
779 822
 		SELECT m.subject, m.id_topic, t.num_views, t.num_replies
@@ -812,8 +855,9 @@  discard block
 block discarded – undo
812 855
 	// If mods want to do somthing with this list of topics, let them do that now.
813 856
 	call_integration_hook('integrate_ssi_topTopics', array(&$topics, $type));
814 857
 
815
-	if ($output_method != 'echo' || empty($topics))
816
-		return $topics;
858
+	if ($output_method != 'echo' || empty($topics)) {
859
+			return $topics;
860
+	}
817 861
 
818 862
 	echo '
819 863
 		<table class="ssi_table">
@@ -822,8 +866,8 @@  discard block
 block discarded – undo
822 866
 				<th style="text-align: left">', $txt['views'], '</th>
823 867
 				<th style="text-align: left">', $txt['replies'], '</th>
824 868
 			</tr>';
825
-	foreach ($topics as $sTopic)
826
-		echo '
869
+	foreach ($topics as $sTopic) {
870
+			echo '
827 871
 			<tr>
828 872
 				<td style="text-align: left">
829 873
 					', $sTopic['link'], '
@@ -831,6 +875,7 @@  discard block
 block discarded – undo
831 875
 				<td style="text-align: right">', comma_format($sTopic['num_views']), '</td>
832 876
 				<td style="text-align: right">', comma_format($sTopic['num_replies']), '</td>
833 877
 			</tr>';
878
+	}
834 879
 	echo '
835 880
 		</table>';
836 881
 }
@@ -866,12 +911,13 @@  discard block
 block discarded – undo
866 911
 {
867 912
 	global $txt, $context;
868 913
 
869
-	if ($output_method == 'echo')
870
-		echo '
914
+	if ($output_method == 'echo') {
915
+			echo '
871 916
 	', sprintf($txt['welcome_newest_member'], $context['common_stats']['latest_member']['link']), '<br>';
872
-	else
873
-		return $context['common_stats']['latest_member'];
874
-}
917
+	} else {
918
+			return $context['common_stats']['latest_member'];
919
+	}
920
+	}
875 921
 
876 922
 /**
877 923
  * Fetches a random member.
@@ -920,8 +966,9 @@  discard block
 block discarded – undo
920 966
 	}
921 967
 
922 968
 	// Just to be sure put the random generator back to something... random.
923
-	if ($random_type != '')
924
-		mt_srand(time());
969
+	if ($random_type != '') {
970
+			mt_srand(time());
971
+	}
925 972
 
926 973
 	return $result;
927 974
 }
@@ -934,8 +981,9 @@  discard block
 block discarded – undo
934 981
  */
935 982
 function ssi_fetchMember($member_ids = array(), $output_method = 'echo')
936 983
 {
937
-	if (empty($member_ids))
938
-		return;
984
+	if (empty($member_ids)) {
985
+			return;
986
+	}
939 987
 
940 988
 	// Can have more than one member if you really want...
941 989
 	$member_ids = is_array($member_ids) ? $member_ids : array($member_ids);
@@ -960,8 +1008,9 @@  discard block
 block discarded – undo
960 1008
  */
961 1009
 function ssi_fetchGroupMembers($group_id = null, $output_method = 'echo')
962 1010
 {
963
-	if ($group_id === null)
964
-		return;
1011
+	if ($group_id === null) {
1012
+			return;
1013
+	}
965 1014
 
966 1015
 	$query_where = '
967 1016
 		id_group = {int:id_group}
@@ -988,8 +1037,9 @@  discard block
 block discarded – undo
988 1037
 {
989 1038
 	global $smcFunc, $memberContext;
990 1039
 
991
-	if ($query_where === null)
992
-		return;
1040
+	if ($query_where === null) {
1041
+			return;
1042
+	}
993 1043
 
994 1044
 	// Fetch the members in question.
995 1045
 	$request = $smcFunc['db_query']('', '
@@ -1002,12 +1052,14 @@  discard block
 block discarded – undo
1002 1052
 		))
1003 1053
 	);
1004 1054
 	$members = array();
1005
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1006
-		$members[] = $row['id_member'];
1055
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
1056
+			$members[] = $row['id_member'];
1057
+	}
1007 1058
 	$smcFunc['db_free_result']($request);
1008 1059
 
1009
-	if (empty($members))
1010
-		return array();
1060
+	if (empty($members)) {
1061
+			return array();
1062
+	}
1011 1063
 
1012 1064
 	// If mods want to do somthing with this list of members, let them do that now.
1013 1065
 	call_integration_hook('integrate_ssi_queryMembers', array(&$members));
@@ -1016,23 +1068,25 @@  discard block
 block discarded – undo
1016 1068
 	loadMemberData($members);
1017 1069
 
1018 1070
 	// Draw the table!
1019
-	if ($output_method == 'echo')
1020
-		echo '
1071
+	if ($output_method == 'echo') {
1072
+			echo '
1021 1073
 		<table style="border: none" class="ssi_table">';
1074
+	}
1022 1075
 
1023 1076
 	$query_members = array();
1024 1077
 	foreach ($members as $member)
1025 1078
 	{
1026 1079
 		// Load their context data.
1027
-		if (!loadMemberContext($member))
1028
-			continue;
1080
+		if (!loadMemberContext($member)) {
1081
+					continue;
1082
+		}
1029 1083
 
1030 1084
 		// Store this member's information.
1031 1085
 		$query_members[$member] = $memberContext[$member];
1032 1086
 
1033 1087
 		// Only do something if we're echo'ing.
1034
-		if ($output_method == 'echo')
1035
-			echo '
1088
+		if ($output_method == 'echo') {
1089
+					echo '
1036 1090
 			<tr>
1037 1091
 				<td style="text-align: right; vertical-align: top; white-space: nowrap">
1038 1092
 					', $query_members[$member]['link'], '
@@ -1040,12 +1094,14 @@  discard block
 block discarded – undo
1040 1094
 					<br>', $query_members[$member]['avatar']['image'], '
1041 1095
 				</td>
1042 1096
 			</tr>';
1097
+		}
1043 1098
 	}
1044 1099
 
1045 1100
 	// End the table if appropriate.
1046
-	if ($output_method == 'echo')
1047
-		echo '
1101
+	if ($output_method == 'echo') {
1102
+			echo '
1048 1103
 		</table>';
1104
+	}
1049 1105
 
1050 1106
 	// Send back the data.
1051 1107
 	return $query_members;
@@ -1060,8 +1116,9 @@  discard block
 block discarded – undo
1060 1116
 {
1061 1117
 	global $txt, $scripturl, $modSettings, $smcFunc;
1062 1118
 
1063
-	if (!allowedTo('view_stats'))
1064
-		return;
1119
+	if (!allowedTo('view_stats')) {
1120
+			return;
1121
+	}
1065 1122
 
1066 1123
 	$totals = array(
1067 1124
 		'members' => $modSettings['totalMembers'],
@@ -1090,8 +1147,9 @@  discard block
 block discarded – undo
1090 1147
 	// If mods want to do somthing with the board stats, let them do that now.
1091 1148
 	call_integration_hook('integrate_ssi_boardStats', array(&$totals));
1092 1149
 
1093
-	if ($output_method != 'echo')
1094
-		return $totals;
1150
+	if ($output_method != 'echo') {
1151
+			return $totals;
1152
+	}
1095 1153
 
1096 1154
 	echo '
1097 1155
 		', $txt['total_members'], ': <a href="', $scripturl . '?action=mlist">', comma_format($totals['members']), '</a><br>
@@ -1120,8 +1178,8 @@  discard block
 block discarded – undo
1120 1178
 	call_integration_hook('integrate_ssi_whosOnline', array(&$return));
1121 1179
 
1122 1180
 	// Add some redundancy for backwards compatibility reasons.
1123
-	if ($output_method != 'echo')
1124
-		return $return + array(
1181
+	if ($output_method != 'echo') {
1182
+			return $return + array(
1125 1183
 			'users' => $return['users_online'],
1126 1184
 			'guests' => $return['num_guests'],
1127 1185
 			'hidden' => $return['num_users_hidden'],
@@ -1129,29 +1187,35 @@  discard block
 block discarded – undo
1129 1187
 			'num_users' => $return['num_users_online'],
1130 1188
 			'total_users' => $return['num_users_online'] + $return['num_guests'],
1131 1189
 		);
1190
+	}
1132 1191
 
1133 1192
 	echo '
1134 1193
 		', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
1135 1194
 
1136 1195
 	$bracketList = array();
1137
-	if (!empty($user_info['buddies']))
1138
-		$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1139
-	if (!empty($return['num_spiders']))
1140
-		$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1141
-	if (!empty($return['num_users_hidden']))
1142
-		$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1196
+	if (!empty($user_info['buddies'])) {
1197
+			$bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
1198
+	}
1199
+	if (!empty($return['num_spiders'])) {
1200
+			$bracketList[] = comma_format($return['num_spiders']) . ' ' . ($return['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
1201
+	}
1202
+	if (!empty($return['num_users_hidden'])) {
1203
+			$bracketList[] = comma_format($return['num_users_hidden']) . ' ' . $txt['hidden'];
1204
+	}
1143 1205
 
1144
-	if (!empty($bracketList))
1145
-		echo ' (' . implode(', ', $bracketList) . ')';
1206
+	if (!empty($bracketList)) {
1207
+			echo ' (' . implode(', ', $bracketList) . ')';
1208
+	}
1146 1209
 
1147 1210
 	echo '<br>
1148 1211
 			', implode(', ', $return['list_users_online']);
1149 1212
 
1150 1213
 	// Showing membergroups?
1151
-	if (!empty($settings['show_group_key']) && !empty($return['membergroups']))
1152
-		echo '<br>
1214
+	if (!empty($settings['show_group_key']) && !empty($return['membergroups'])) {
1215
+			echo '<br>
1153 1216
 			[' . implode(']&nbsp;&nbsp;[', $return['membergroups']) . ']';
1154
-}
1217
+	}
1218
+	}
1155 1219
 
1156 1220
 /**
1157 1221
  * Just like whosOnline except it also logs the online presence.
@@ -1162,11 +1226,12 @@  discard block
 block discarded – undo
1162 1226
 {
1163 1227
 	writeLog();
1164 1228
 
1165
-	if ($output_method != 'echo')
1166
-		return ssi_whosOnline($output_method);
1167
-	else
1168
-		ssi_whosOnline($output_method);
1169
-}
1229
+	if ($output_method != 'echo') {
1230
+			return ssi_whosOnline($output_method);
1231
+	} else {
1232
+			ssi_whosOnline($output_method);
1233
+	}
1234
+	}
1170 1235
 
1171 1236
 // Shows a login box.
1172 1237
 /**
@@ -1179,11 +1244,13 @@  discard block
 block discarded – undo
1179 1244
 {
1180 1245
 	global $scripturl, $txt, $user_info, $context;
1181 1246
 
1182
-	if ($redirect_to != '')
1183
-		$_SESSION['login_url'] = $redirect_to;
1247
+	if ($redirect_to != '') {
1248
+			$_SESSION['login_url'] = $redirect_to;
1249
+	}
1184 1250
 
1185
-	if ($output_method != 'echo' || !$user_info['is_guest'])
1186
-		return $user_info['is_guest'];
1251
+	if ($output_method != 'echo' || !$user_info['is_guest']) {
1252
+			return $user_info['is_guest'];
1253
+	}
1187 1254
 
1188 1255
 	// Create a login token
1189 1256
 	createToken('login');
@@ -1235,8 +1302,9 @@  discard block
 block discarded – undo
1235 1302
 
1236 1303
 	$boardsAllowed = array_intersect(boardsAllowedTo('poll_view'), boardsAllowedTo('poll_vote'));
1237 1304
 
1238
-	if (empty($boardsAllowed))
1239
-		return array();
1305
+	if (empty($boardsAllowed)) {
1306
+			return array();
1307
+	}
1240 1308
 
1241 1309
 	$request = $smcFunc['db_query']('', '
1242 1310
 		SELECT p.id_poll, p.question, t.id_topic, p.max_votes, p.guest_vote, p.hide_results, p.expire_time
@@ -1269,12 +1337,14 @@  discard block
 block discarded – undo
1269 1337
 	$smcFunc['db_free_result']($request);
1270 1338
 
1271 1339
 	// This user has voted on all the polls.
1272
-	if (empty($row) || !is_array($row))
1273
-		return array();
1340
+	if (empty($row) || !is_array($row)) {
1341
+			return array();
1342
+	}
1274 1343
 
1275 1344
 	// If this is a guest who's voted we'll through ourselves to show poll to show the results.
1276
-	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))))
1277
-		return ssi_showPoll($row['id_topic'], $output_method);
1345
+	if ($user_info['is_guest'] && (!$row['guest_vote'] || (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))))) {
1346
+			return ssi_showPoll($row['id_topic'], $output_method);
1347
+	}
1278 1348
 
1279 1349
 	$request = $smcFunc['db_query']('', '
1280 1350
 		SELECT COUNT(DISTINCT id_member)
@@ -1338,8 +1408,9 @@  discard block
 block discarded – undo
1338 1408
 	// If mods want to do somthing with this list of polls, let them do that now.
1339 1409
 	call_integration_hook('integrate_ssi_recentPoll', array(&$return, $topPollInstead));
1340 1410
 
1341
-	if ($output_method != 'echo')
1342
-		return $return;
1411
+	if ($output_method != 'echo') {
1412
+			return $return;
1413
+	}
1343 1414
 
1344 1415
 	if ($allow_view_results)
1345 1416
 	{
@@ -1348,19 +1419,20 @@  discard block
 block discarded – undo
1348 1419
 			<strong>', $return['question'], '</strong><br>
1349 1420
 			', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1350 1421
 
1351
-		foreach ($return['options'] as $option)
1352
-			echo '
1422
+		foreach ($return['options'] as $option) {
1423
+					echo '
1353 1424
 			<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1425
+		}
1354 1426
 
1355 1427
 		echo '
1356 1428
 			<input type="submit" value="', $txt['poll_vote'], '" class="button">
1357 1429
 			<input type="hidden" name="poll" value="', $return['id'], '">
1358 1430
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1359 1431
 		</form>';
1432
+	} else {
1433
+			echo $txt['poll_cannot_see'];
1434
+	}
1360 1435
 	}
1361
-	else
1362
-		echo $txt['poll_cannot_see'];
1363
-}
1364 1436
 
1365 1437
 /**
1366 1438
  * Shows the poll from the specified topic
@@ -1374,13 +1446,15 @@  discard block
 block discarded – undo
1374 1446
 
1375 1447
 	$boardsAllowed = boardsAllowedTo('poll_view');
1376 1448
 
1377
-	if (empty($boardsAllowed))
1378
-		return array();
1449
+	if (empty($boardsAllowed)) {
1450
+			return array();
1451
+	}
1379 1452
 
1380
-	if ($topic === null && isset($_REQUEST['ssi_topic']))
1381
-		$topic = (int) $_REQUEST['ssi_topic'];
1382
-	else
1383
-		$topic = (int) $topic;
1453
+	if ($topic === null && isset($_REQUEST['ssi_topic'])) {
1454
+			$topic = (int) $_REQUEST['ssi_topic'];
1455
+	} else {
1456
+			$topic = (int) $topic;
1457
+	}
1384 1458
 
1385 1459
 	$request = $smcFunc['db_query']('', '
1386 1460
 		SELECT
@@ -1401,17 +1475,18 @@  discard block
 block discarded – undo
1401 1475
 	);
1402 1476
 
1403 1477
 	// Either this topic has no poll, or the user cannot view it.
1404
-	if ($smcFunc['db_num_rows']($request) == 0)
1405
-		return array();
1478
+	if ($smcFunc['db_num_rows']($request) == 0) {
1479
+			return array();
1480
+	}
1406 1481
 
1407 1482
 	$row = $smcFunc['db_fetch_assoc']($request);
1408 1483
 	$smcFunc['db_free_result']($request);
1409 1484
 
1410 1485
 	// Check if they can vote.
1411 1486
 	$already_voted = false;
1412
-	if (!empty($row['expire_time']) && $row['expire_time'] < time())
1413
-		$allow_vote = false;
1414
-	elseif ($user_info['is_guest'])
1487
+	if (!empty($row['expire_time']) && $row['expire_time'] < time()) {
1488
+			$allow_vote = false;
1489
+	} elseif ($user_info['is_guest'])
1415 1490
 	{
1416 1491
 		// There's a difference between "allowed to vote" and "already voted"...
1417 1492
 		$allow_vote = $row['guest_vote'];
@@ -1421,10 +1496,9 @@  discard block
 block discarded – undo
1421 1496
 		{
1422 1497
 			$already_voted = true;
1423 1498
 		}
1424
-	}
1425
-	elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board']))
1426
-		$allow_vote = false;
1427
-	else
1499
+	} elseif (!empty($row['voting_locked']) || !allowedTo('poll_vote', $row['id_board'])) {
1500
+			$allow_vote = false;
1501
+	} else
1428 1502
 	{
1429 1503
 		$request = $smcFunc['db_query']('', '
1430 1504
 			SELECT id_member
@@ -1506,8 +1580,9 @@  discard block
 block discarded – undo
1506 1580
 	// If mods want to do somthing with this poll, let them do that now.
1507 1581
 	call_integration_hook('integrate_ssi_showPoll', array(&$return));
1508 1582
 
1509
-	if ($output_method != 'echo')
1510
-		return $return;
1583
+	if ($output_method != 'echo') {
1584
+			return $return;
1585
+	}
1511 1586
 
1512 1587
 	if ($return['allow_vote'])
1513 1588
 	{
@@ -1516,17 +1591,17 @@  discard block
 block discarded – undo
1516 1591
 				<strong>', $return['question'], '</strong><br>
1517 1592
 				', !empty($return['allowed_warning']) ? $return['allowed_warning'] . '<br>' : '';
1518 1593
 
1519
-		foreach ($return['options'] as $option)
1520
-			echo '
1594
+		foreach ($return['options'] as $option) {
1595
+					echo '
1521 1596
 				<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br>';
1597
+		}
1522 1598
 
1523 1599
 		echo '
1524 1600
 				<input type="submit" value="', $txt['poll_vote'], '" class="button">
1525 1601
 				<input type="hidden" name="poll" value="', $return['id'], '">
1526 1602
 				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1527 1603
 			</form>';
1528
-	}
1529
-	else
1604
+	} else
1530 1605
 	{
1531 1606
 		echo '
1532 1607
 			<div class="ssi_poll">
@@ -1606,27 +1681,32 @@  discard block
 block discarded – undo
1606 1681
 			'is_approved' => 1,
1607 1682
 		)
1608 1683
 	);
1609
-	if ($smcFunc['db_num_rows']($request) == 0)
1610
-		die;
1684
+	if ($smcFunc['db_num_rows']($request) == 0) {
1685
+			die;
1686
+	}
1611 1687
 	$row = $smcFunc['db_fetch_assoc']($request);
1612 1688
 	$smcFunc['db_free_result']($request);
1613 1689
 
1614
-	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time']))
1615
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1690
+	if (!empty($row['voting_locked']) || ($row['selected'] != -1 && !$user_info['is_guest']) || (!empty($row['expire_time']) && time() > $row['expire_time'])) {
1691
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1692
+	}
1616 1693
 
1617 1694
 	// Too many options checked?
1618
-	if (count($_REQUEST['options']) > $row['max_votes'])
1619
-		redirectexit('topic=' . $row['id_topic'] . '.0');
1695
+	if (count($_REQUEST['options']) > $row['max_votes']) {
1696
+			redirectexit('topic=' . $row['id_topic'] . '.0');
1697
+	}
1620 1698
 
1621 1699
 	// It's a guest who has already voted?
1622 1700
 	if ($user_info['is_guest'])
1623 1701
 	{
1624 1702
 		// Guest voting disabled?
1625
-		if (!$row['guest_vote'])
1626
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1703
+		if (!$row['guest_vote']) {
1704
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1705
+		}
1627 1706
 		// Already voted?
1628
-		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote'])))
1629
-			redirectexit('topic=' . $row['id_topic'] . '.0');
1707
+		elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) {
1708
+					redirectexit('topic=' . $row['id_topic'] . '.0');
1709
+		}
1630 1710
 	}
1631 1711
 
1632 1712
 	$sOptions = array();
@@ -1680,11 +1760,13 @@  discard block
 block discarded – undo
1680 1760
 {
1681 1761
 	global $scripturl, $txt, $context;
1682 1762
 
1683
-	if (!allowedTo('search_posts'))
1684
-		return;
1763
+	if (!allowedTo('search_posts')) {
1764
+			return;
1765
+	}
1685 1766
 
1686
-	if ($output_method != 'echo')
1687
-		return $scripturl . '?action=search';
1767
+	if ($output_method != 'echo') {
1768
+			return $scripturl . '?action=search';
1769
+	}
1688 1770
 
1689 1771
 	echo '
1690 1772
 		<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
@@ -1706,8 +1788,9 @@  discard block
 block discarded – undo
1706 1788
 	// If mods want to do somthing with the news, let them do that now. Don't need to pass the news line itself, since it is already in $context.
1707 1789
 	call_integration_hook('integrate_ssi_news');
1708 1790
 
1709
-	if ($output_method != 'echo')
1710
-		return $context['random_news_line'];
1791
+	if ($output_method != 'echo') {
1792
+			return $context['random_news_line'];
1793
+	}
1711 1794
 
1712 1795
 	echo $context['random_news_line'];
1713 1796
 }
@@ -1721,8 +1804,9 @@  discard block
 block discarded – undo
1721 1804
 {
1722 1805
 	global $scripturl, $modSettings, $user_info;
1723 1806
 
1724
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view'))
1725
-		return;
1807
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view') || !allowedTo('profile_view')) {
1808
+			return;
1809
+	}
1726 1810
 
1727 1811
 	$eventOptions = array(
1728 1812
 		'include_birthdays' => true,
@@ -1733,13 +1817,15 @@  discard block
 block discarded – undo
1733 1817
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1734 1818
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1735 1819
 
1736
-	if ($output_method != 'echo')
1737
-		return $return['calendar_birthdays'];
1820
+	if ($output_method != 'echo') {
1821
+			return $return['calendar_birthdays'];
1822
+	}
1738 1823
 
1739
-	foreach ($return['calendar_birthdays'] as $member)
1740
-		echo '
1824
+	foreach ($return['calendar_birthdays'] as $member) {
1825
+			echo '
1741 1826
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">' . $member['name'] . '</span>' . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
1742
-}
1827
+	}
1828
+	}
1743 1829
 
1744 1830
 /**
1745 1831
  * Shows today's holidays.
@@ -1750,8 +1836,9 @@  discard block
 block discarded – undo
1750 1836
 {
1751 1837
 	global $modSettings, $user_info;
1752 1838
 
1753
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1754
-		return;
1839
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1840
+			return;
1841
+	}
1755 1842
 
1756 1843
 	$eventOptions = array(
1757 1844
 		'include_holidays' => true,
@@ -1762,8 +1849,9 @@  discard block
 block discarded – undo
1762 1849
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1763 1850
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1764 1851
 
1765
-	if ($output_method != 'echo')
1766
-		return $return['calendar_holidays'];
1852
+	if ($output_method != 'echo') {
1853
+			return $return['calendar_holidays'];
1854
+	}
1767 1855
 
1768 1856
 	echo '
1769 1857
 		', implode(', ', $return['calendar_holidays']);
@@ -1777,8 +1865,9 @@  discard block
 block discarded – undo
1777 1865
 {
1778 1866
 	global $modSettings, $user_info;
1779 1867
 
1780
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1781
-		return;
1868
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1869
+			return;
1870
+	}
1782 1871
 
1783 1872
 	$eventOptions = array(
1784 1873
 		'include_events' => true,
@@ -1789,14 +1878,16 @@  discard block
 block discarded – undo
1789 1878
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1790 1879
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1791 1880
 
1792
-	if ($output_method != 'echo')
1793
-		return $return['calendar_events'];
1881
+	if ($output_method != 'echo') {
1882
+			return $return['calendar_events'];
1883
+	}
1794 1884
 
1795 1885
 	foreach ($return['calendar_events'] as $event)
1796 1886
 	{
1797
-		if ($event['can_edit'])
1798
-			echo '
1887
+		if ($event['can_edit']) {
1888
+					echo '
1799 1889
 	<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1890
+		}
1800 1891
 		echo '
1801 1892
 	' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1802 1893
 	}
@@ -1811,8 +1902,9 @@  discard block
 block discarded – undo
1811 1902
 {
1812 1903
 	global $modSettings, $txt, $scripturl, $user_info;
1813 1904
 
1814
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
1815
-		return;
1905
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
1906
+			return;
1907
+	}
1816 1908
 
1817 1909
 	$eventOptions = array(
1818 1910
 		'include_birthdays' => allowedTo('profile_view'),
@@ -1825,19 +1917,22 @@  discard block
 block discarded – undo
1825 1917
 	// The ssi_todaysCalendar variants all use the same hook and just pass on $eventOptions so the hooked code can distinguish different cases if necessary
1826 1918
 	call_integration_hook('integrate_ssi_calendar', array(&$return, $eventOptions));
1827 1919
 
1828
-	if ($output_method != 'echo')
1829
-		return $return;
1920
+	if ($output_method != 'echo') {
1921
+			return $return;
1922
+	}
1830 1923
 
1831
-	if (!empty($return['calendar_holidays']))
1832
-		echo '
1924
+	if (!empty($return['calendar_holidays'])) {
1925
+			echo '
1833 1926
 			<span class="holiday">' . $txt['calendar_prompt'] . ' ' . implode(', ', $return['calendar_holidays']) . '<br></span>';
1927
+	}
1834 1928
 	if (!empty($return['calendar_birthdays']))
1835 1929
 	{
1836 1930
 		echo '
1837 1931
 			<span class="birthday">' . $txt['birthdays_upcoming'] . '</span> ';
1838
-		foreach ($return['calendar_birthdays'] as $member)
1839
-			echo '
1932
+		foreach ($return['calendar_birthdays'] as $member) {
1933
+					echo '
1840 1934
 			<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', !$member['is_last'] ? ', ' : '';
1935
+		}
1841 1936
 		echo '
1842 1937
 			<br>';
1843 1938
 	}
@@ -1847,9 +1942,10 @@  discard block
 block discarded – undo
1847 1942
 			<span class="event">' . $txt['events_upcoming'] . '</span> ';
1848 1943
 		foreach ($return['calendar_events'] as $event)
1849 1944
 		{
1850
-			if ($event['can_edit'])
1851
-				echo '
1945
+			if ($event['can_edit']) {
1946
+							echo '
1852 1947
 			<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
1948
+			}
1853 1949
 			echo '
1854 1950
 			' . $event['link'] . (!$event['is_last'] ? ', ' : '');
1855 1951
 		}
@@ -1873,25 +1969,29 @@  discard block
 block discarded – undo
1873 1969
 	loadLanguage('Stats');
1874 1970
 
1875 1971
 	// Must be integers....
1876
-	if ($limit === null)
1877
-		$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1878
-	else
1879
-		$limit = (int) $limit;
1880
-
1881
-	if ($start === null)
1882
-		$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1883
-	else
1884
-		$start = (int) $start;
1885
-
1886
-	if ($board !== null)
1887
-		$board = (int) $board;
1888
-	elseif (isset($_GET['board']))
1889
-		$board = (int) $_GET['board'];
1890
-
1891
-	if ($length === null)
1892
-		$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1893
-	else
1894
-		$length = (int) $length;
1972
+	if ($limit === null) {
1973
+			$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
1974
+	} else {
1975
+			$limit = (int) $limit;
1976
+	}
1977
+
1978
+	if ($start === null) {
1979
+			$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
1980
+	} else {
1981
+			$start = (int) $start;
1982
+	}
1983
+
1984
+	if ($board !== null) {
1985
+			$board = (int) $board;
1986
+	} elseif (isset($_GET['board'])) {
1987
+			$board = (int) $_GET['board'];
1988
+	}
1989
+
1990
+	if ($length === null) {
1991
+			$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
1992
+	} else {
1993
+			$length = (int) $length;
1994
+	}
1895 1995
 
1896 1996
 	$limit = max(0, $limit);
1897 1997
 	$start = max(0, $start);
@@ -1909,17 +2009,19 @@  discard block
 block discarded – undo
1909 2009
 	);
1910 2010
 	if ($smcFunc['db_num_rows']($request) == 0)
1911 2011
 	{
1912
-		if ($output_method == 'echo')
1913
-			die($txt['ssi_no_guests']);
1914
-		else
1915
-			return array();
2012
+		if ($output_method == 'echo') {
2013
+					die($txt['ssi_no_guests']);
2014
+		} else {
2015
+					return array();
2016
+		}
1916 2017
 	}
1917 2018
 	list ($board) = $smcFunc['db_fetch_row']($request);
1918 2019
 	$smcFunc['db_free_result']($request);
1919 2020
 
1920 2021
 	$icon_sources = array();
1921
-	foreach ($context['stable_icons'] as $icon)
1922
-		$icon_sources[$icon] = 'images_url';
2022
+	foreach ($context['stable_icons'] as $icon) {
2023
+			$icon_sources[$icon] = 'images_url';
2024
+	}
1923 2025
 
1924 2026
 	if (!empty($modSettings['enable_likes']))
1925 2027
 	{
@@ -1942,12 +2044,14 @@  discard block
 block discarded – undo
1942 2044
 		)
1943 2045
 	);
1944 2046
 	$posts = array();
1945
-	while ($row = $smcFunc['db_fetch_assoc']($request))
1946
-		$posts[] = $row['id_first_msg'];
2047
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
2048
+			$posts[] = $row['id_first_msg'];
2049
+	}
1947 2050
 	$smcFunc['db_free_result']($request);
1948 2051
 
1949
-	if (empty($posts))
1950
-		return array();
2052
+	if (empty($posts)) {
2053
+			return array();
2054
+	}
1951 2055
 
1952 2056
 	// Find the posts.
1953 2057
 	$request = $smcFunc['db_query']('', '
@@ -1977,24 +2081,28 @@  discard block
 block discarded – undo
1977 2081
 			$last_space = strrpos($row['body'], ' ');
1978 2082
 			$last_open = strrpos($row['body'], '<');
1979 2083
 			$last_close = strrpos($row['body'], '>');
1980
-			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6)
1981
-				$cutoff = $last_open;
1982
-			elseif (empty($last_close) || $last_close < $last_open)
1983
-				$cutoff = $last_space;
2084
+			if (empty($last_space) || ($last_space == $last_open + 3 && (empty($last_close) || (!empty($last_close) && $last_close < $last_open))) || $last_space < $last_open || $last_open == $length - 6) {
2085
+							$cutoff = $last_open;
2086
+			} elseif (empty($last_close) || $last_close < $last_open) {
2087
+							$cutoff = $last_space;
2088
+			}
1984 2089
 
1985
-			if ($cutoff !== false)
1986
-				$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2090
+			if ($cutoff !== false) {
2091
+							$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
2092
+			}
1987 2093
 			$row['body'] .= '...';
1988 2094
 		}
1989 2095
 
1990 2096
 		$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
1991 2097
 
1992
-		if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
1993
-			$row['icon'] = 'recycled';
2098
+		if (!empty($recycle_board) && $row['id_board'] == $recycle_board) {
2099
+					$row['icon'] = 'recycled';
2100
+		}
1994 2101
 
1995 2102
 		// Check that this message icon is there...
1996
-		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']]))
1997
-			$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2103
+		if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
2104
+					$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
2105
+		}
1998 2106
 
1999 2107
 		censorText($row['subject']);
2000 2108
 		censorText($row['body']);
@@ -2031,16 +2139,18 @@  discard block
 block discarded – undo
2031 2139
 	}
2032 2140
 	$smcFunc['db_free_result']($request);
2033 2141
 
2034
-	if (empty($return))
2035
-		return $return;
2142
+	if (empty($return)) {
2143
+			return $return;
2144
+	}
2036 2145
 
2037 2146
 	$return[count($return) - 1]['is_last'] = true;
2038 2147
 
2039 2148
 	// If mods want to do somthing with this list of posts, let them do that now.
2040 2149
 	call_integration_hook('integrate_ssi_boardNews', array(&$return));
2041 2150
 
2042
-	if ($output_method != 'echo')
2043
-		return $return;
2151
+	if ($output_method != 'echo') {
2152
+			return $return;
2153
+	}
2044 2154
 
2045 2155
 	foreach ($return as $news)
2046 2156
 	{
@@ -2092,9 +2202,10 @@  discard block
 block discarded – undo
2092 2202
 		echo '
2093 2203
 			</div>';
2094 2204
 
2095
-		if (!$news['is_last'])
2096
-			echo '
2205
+		if (!$news['is_last']) {
2206
+					echo '
2097 2207
 			<hr>';
2208
+		}
2098 2209
 	}
2099 2210
 }
2100 2211
 
@@ -2108,8 +2219,9 @@  discard block
 block discarded – undo
2108 2219
 {
2109 2220
 	global $user_info, $scripturl, $modSettings, $txt, $context, $smcFunc;
2110 2221
 
2111
-	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view'))
2112
-		return;
2222
+	if (empty($modSettings['cal_enabled']) || !allowedTo('calendar_view')) {
2223
+			return;
2224
+	}
2113 2225
 
2114 2226
 	// Find all events which are happening in the near future that the member can see.
2115 2227
 	$request = $smcFunc['db_query']('', '
@@ -2135,20 +2247,23 @@  discard block
 block discarded – undo
2135 2247
 	while ($row = $smcFunc['db_fetch_assoc']($request))
2136 2248
 	{
2137 2249
 		// Check if we've already come by an event linked to this same topic with the same title... and don't display it if we have.
2138
-		if (!empty($duplicates[$row['title'] . $row['id_topic']]))
2139
-			continue;
2250
+		if (!empty($duplicates[$row['title'] . $row['id_topic']])) {
2251
+					continue;
2252
+		}
2140 2253
 
2141 2254
 		// Censor the title.
2142 2255
 		censorText($row['title']);
2143 2256
 
2144
-		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false)))
2145
-			$date = strftime('%Y-%m-%d', forum_time(false));
2146
-		else
2147
-			$date = $row['start_date'];
2257
+		if ($row['start_date'] < strftime('%Y-%m-%d', forum_time(false))) {
2258
+					$date = strftime('%Y-%m-%d', forum_time(false));
2259
+		} else {
2260
+					$date = $row['start_date'];
2261
+		}
2148 2262
 
2149 2263
 		// If the topic it is attached to is not approved then don't link it.
2150
-		if (!empty($row['id_first_msg']) && !$row['approved'])
2151
-			$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2264
+		if (!empty($row['id_first_msg']) && !$row['approved']) {
2265
+					$row['id_board'] = $row['id_topic'] = $row['id_first_msg'] = 0;
2266
+		}
2152 2267
 
2153 2268
 		$allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false;
2154 2269
 
@@ -2174,24 +2289,27 @@  discard block
 block discarded – undo
2174 2289
 	}
2175 2290
 	$smcFunc['db_free_result']($request);
2176 2291
 
2177
-	foreach ($return as $mday => $array)
2178
-		$return[$mday][count($array) - 1]['is_last'] = true;
2292
+	foreach ($return as $mday => $array) {
2293
+			$return[$mday][count($array) - 1]['is_last'] = true;
2294
+	}
2179 2295
 
2180 2296
 	// If mods want to do somthing with this list of events, let them do that now.
2181 2297
 	call_integration_hook('integrate_ssi_recentEvents', array(&$return));
2182 2298
 
2183
-	if ($output_method != 'echo' || empty($return))
2184
-		return $return;
2299
+	if ($output_method != 'echo' || empty($return)) {
2300
+			return $return;
2301
+	}
2185 2302
 
2186 2303
 	// Well the output method is echo.
2187 2304
 	echo '
2188 2305
 			<span class="event">' . $txt['events'] . '</span> ';
2189
-	foreach ($return as $mday => $array)
2190
-		foreach ($array as $event)
2306
+	foreach ($return as $mday => $array) {
2307
+			foreach ($array as $event)
2191 2308
 		{
2192 2309
 			if ($event['can_edit'])
2193 2310
 				echo '
2194 2311
 				<a href="' . $event['modify_href'] . '" style="color: #ff0000;">*</a> ';
2312
+	}
2195 2313
 
2196 2314
 			echo '
2197 2315
 				' . $event['link'] . (!$event['is_last'] ? ', ' : '');
@@ -2210,8 +2328,9 @@  discard block
 block discarded – undo
2210 2328
 	global $smcFunc;
2211 2329
 
2212 2330
 	// If $id is null, this was most likely called from a query string and should do nothing.
2213
-	if ($id === null)
2214
-		return;
2331
+	if ($id === null) {
2332
+			return;
2333
+	}
2215 2334
 
2216 2335
 	$request = $smcFunc['db_query']('', '
2217 2336
 		SELECT passwd, member_name, is_activated
@@ -2243,8 +2362,9 @@  discard block
 block discarded – undo
2243 2362
 	$attachments_boards = boardsAllowedTo('view_attachments');
2244 2363
 
2245 2364
 	// No boards?  Adios amigo.
2246
-	if (empty($attachments_boards))
2247
-		return array();
2365
+	if (empty($attachments_boards)) {
2366
+			return array();
2367
+	}
2248 2368
 
2249 2369
 	// Is it an array?
2250 2370
 	$attachment_ext = (array) $attachment_ext;
@@ -2328,8 +2448,9 @@  discard block
 block discarded – undo
2328 2448
 	call_integration_hook('integrate_ssi_recentAttachments', array(&$attachments));
2329 2449
 
2330 2450
 	// So you just want an array?  Here you can have it.
2331
-	if ($output_method == 'array' || empty($attachments))
2332
-		return $attachments;
2451
+	if ($output_method == 'array' || empty($attachments)) {
2452
+			return $attachments;
2453
+	}
2333 2454
 
2334 2455
 	// Give them the default.
2335 2456
 	echo '
@@ -2340,14 +2461,15 @@  discard block
 block discarded – undo
2340 2461
 				<th style="text-align: left; padding: 2">', $txt['downloads'], '</th>
2341 2462
 				<th style="text-align: left; padding: 2">', $txt['filesize'], '</th>
2342 2463
 			</tr>';
2343
-	foreach ($attachments as $attach)
2344
-		echo '
2464
+	foreach ($attachments as $attach) {
2465
+			echo '
2345 2466
 			<tr>
2346 2467
 				<td>', $attach['file']['link'], '</td>
2347 2468
 				<td>', $attach['member']['link'], '</td>
2348 2469
 				<td style="text-align: center">', $attach['file']['downloads'], '</td>
2349 2470
 				<td>', $attach['file']['filesize'], '</td>
2350 2471
 			</tr>';
2472
+	}
2351 2473
 	echo '
2352 2474
 		</table>';
2353 2475
 }
Please login to merge, or discard this patch.
Themes/default/GenericControls.template.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
  * @param int|string $verify_id The verification control ID
228 228
  * @param string $display_type What type to display. Can be 'single' to only show one verification option or 'all' to show all of them
229 229
  * @param bool $reset Whether to reset the internal tracking counter
230
- * @return bool False if there's nothing else to show, true if $display_type is 'single', nothing otherwise
230
+ * @return boolean|null False if there's nothing else to show, true if $display_type is 'single', nothing otherwise
231 231
  */
232 232
 function template_control_verification($verify_id, $display_type = 'all', $reset = false)
233 233
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -300,7 +300,7 @@
 block discarded – undo
300 300
 				echo '
301 301
 				<div class="g-recaptcha centertext" data-sitekey="' . $verify_context['recaptcha_site_key'] . '" data-theme="' . $verify_context['recaptcha_theme'] . '"></div>
302 302
 				<br>
303
-				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>';
303
+				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang . '"></script>';
304 304
 			}
305 305
 		}
306 306
 		else
Please login to merge, or discard this patch.
Braces   +79 added lines, -60 removed lines patch added patch discarded remove patch
@@ -53,14 +53,15 @@  discard block
 block discarded – undo
53 53
 			foreach ($context['smileys'] as $location => $smileyRows)
54 54
 			{
55 55
 				$countLocations--;
56
-				if ($location == 'postform')
57
-					echo '
56
+				if ($location == 'postform') {
57
+									echo '
58 58
 						dropdown:
59 59
 						{';
60
-				elseif ($location == 'popup')
61
-					echo '
60
+				} elseif ($location == 'popup') {
61
+									echo '
62 62
 						popup:
63 63
 						{';
64
+				}
64 65
 
65 66
 				$numRows = count($smileyRows);
66 67
 
@@ -68,25 +69,27 @@  discard block
 block discarded – undo
68 69
 				$emptyPlaceholder = 0;
69 70
 				foreach ($smileyRows as $smileyRow)
70 71
 				{
71
-					foreach ($smileyRow['smileys'] as $smiley)
72
-						echo '
72
+					foreach ($smileyRow['smileys'] as $smiley) {
73
+											echo '
73 74
 							', JavaScriptEscape($smiley['code']), ': ', JavaScriptEscape($settings['smileys_url'] . '/' . $smiley['filename']), empty($smiley['isLast']) ? ',' : '';
75
+					}
74 76
 
75
-					if (empty($smileyRow['isLast']) && $numRows != 1)
76
-						echo ',
77
+					if (empty($smileyRow['isLast']) && $numRows != 1) {
78
+											echo ',
77 79
 						\'-', $emptyPlaceholder++, '\': \'\',';
80
+					}
78 81
 				}
79 82
 				echo '
80 83
 						}', $countLocations != 0 ? ',' : '';
81 84
 			}
82 85
 			echo '
83 86
 					}';
84
-		}
85
-		else
86
-			echo ',
87
+		} else {
88
+					echo ',
87 89
 					emoticons:
88 90
 					{},
89 91
 					emoticonsEnabled:false';
92
+		}
90 93
 
91 94
 		if ($context['show_bbc'] && $bbcContainer !== null)
92 95
 		{
@@ -100,15 +103,16 @@  discard block
 block discarded – undo
100 103
 
101 104
 				$count_tags--;
102 105
 
103
-				if (!empty($count_tags))
104
-					echo '||';
106
+				if (!empty($count_tags)) {
107
+									echo '||';
108
+				}
105 109
 			}
106 110
 
107 111
 			echo '",';
108
-		}
109
-		else
110
-			echo ',
112
+		} else {
113
+					echo ',
111 114
 					toolbar: "",';
115
+		}
112 116
 
113 117
 		echo '
114 118
 				});
@@ -150,42 +154,47 @@  discard block
 block discarded – undo
150 154
 
151 155
 	$tempTab = $context['tabindex'];
152 156
 
153
-	if (!empty($context['drafts_pm_save']))
154
-		$tempTab++;
155
-	elseif (!empty($context['drafts_save']))
156
-		$tempTab++;
157
-	elseif ($editor_context['preview_type'])
158
-		$tempTab++;
159
-	elseif ($context['show_spellchecking'])
160
-		$tempTab++;
157
+	if (!empty($context['drafts_pm_save'])) {
158
+			$tempTab++;
159
+	} elseif (!empty($context['drafts_save'])) {
160
+			$tempTab++;
161
+	} elseif ($editor_context['preview_type']) {
162
+			$tempTab++;
163
+	} elseif ($context['show_spellchecking']) {
164
+			$tempTab++;
165
+	}
161 166
 
162 167
 	$tempTab++;
163 168
 	$context['tabindex'] = $tempTab;
164 169
 
165
-	if (!empty($context['drafts_pm_save']))
166
-		echo '
170
+	if (!empty($context['drafts_pm_save'])) {
171
+			echo '
167 172
 		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button">
168 173
 		<input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">';
174
+	}
169 175
 
170
-	if (!empty($context['drafts_save']))
171
-		echo '
176
+	if (!empty($context['drafts_save'])) {
177
+			echo '
172 178
 		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button">
173 179
 		<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">';
180
+	}
174 181
 
175
-	if ($context['show_spellchecking'])
176
-		echo '
182
+	if ($context['show_spellchecking']) {
183
+			echo '
177 184
 		<input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button">';
185
+	}
178 186
 
179
-	if ($editor_context['preview_type'])
180
-		echo '
187
+	if ($editor_context['preview_type']) {
188
+			echo '
181 189
 		<input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', --$tempTab, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button">';
190
+	}
182 191
 
183 192
 	echo '
184 193
 		<input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" name="post" tabindex="', --$tempTab, '" onclick="return submitThisOnce(this);" accesskey="s" class="button">';
185 194
 
186 195
 	// Load in the PM autosaver if it's enabled
187
-	if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave']))
188
-		echo '
196
+	if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) {
197
+			echo '
189 198
 		<span class="righttext padding" style="display: block">
190 199
 			<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"></span>
191 200
 			<span id="draft_lastautosave" ></span>
@@ -203,10 +212,11 @@  discard block
 block discarded – undo
203 212
 				iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), '
204 213
 			});
205 214
 		</script>';
215
+	}
206 216
 
207 217
 	// Start an instance of the auto saver if its enabled
208
-	if (!empty($context['drafts_save']) && !empty($context['drafts_autosave']))
209
-		echo '
218
+	if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) {
219
+			echo '
210 220
 		<span class="righttext padding" style="display: block">
211 221
 			<span id="throbber" style="display:none"><img src="', $settings['images_url'], '/loading_sm.gif" alt="" class="centericon"></span>
212 222
 			<span id="draft_lastautosave" ></span>
@@ -223,7 +233,8 @@  discard block
 block discarded – undo
223 233
 				iFreq: ', $context['drafts_autosave_frequency'], '
224 234
 			});
225 235
 		</script>';
226
-}
236
+	}
237
+	}
227 238
 
228 239
 /**
229 240
  * This template displays a verification form
@@ -240,51 +251,57 @@  discard block
 block discarded – undo
240 251
 	$verify_context = &$context['controls']['verification'][$verify_id];
241 252
 
242 253
 	// Keep track of where we are.
243
-	if (empty($verify_context['tracking']) || $reset)
244
-		$verify_context['tracking'] = 0;
254
+	if (empty($verify_context['tracking']) || $reset) {
255
+			$verify_context['tracking'] = 0;
256
+	}
245 257
 
246 258
 	// How many items are there to display in total.
247 259
 	$total_items = count($verify_context['questions']) + ($verify_context['show_visual'] || $verify_context['can_recaptcha'] ? 1 : 0);
248 260
 
249 261
 	// If we've gone too far, stop.
250
-	if ($verify_context['tracking'] > $total_items)
251
-		return false;
262
+	if ($verify_context['tracking'] > $total_items) {
263
+			return false;
264
+	}
252 265
 
253 266
 	// Loop through each item to show them.
254 267
 	for ($i = 0; $i < $total_items; $i++)
255 268
 	{
256 269
 		// If we're after a single item only show it if we're in the right place.
257
-		if ($display_type == 'single' && $verify_context['tracking'] != $i)
258
-			continue;
270
+		if ($display_type == 'single' && $verify_context['tracking'] != $i) {
271
+					continue;
272
+		}
259 273
 
260
-		if ($display_type != 'single')
261
-			echo '
274
+		if ($display_type != 'single') {
275
+					echo '
262 276
 			<div id="verification_control_', $i, '" class="verification_control">';
277
+		}
263 278
 
264 279
 		// Display empty field, but only if we have one, and it's the first time.
265
-		if ($verify_context['empty_field'] && empty($i))
266
-			echo '
280
+		if ($verify_context['empty_field'] && empty($i)) {
281
+					echo '
267 282
 				<div class="smalltext vv_special">
268 283
 					', $txt['visual_verification_hidden'], ':
269 284
 					<input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value="">
270 285
 				</div>';
286
+		}
271 287
 
272 288
 		// Do the actual stuff
273 289
 		if ($i == 0 && ($verify_context['show_visual'] || $verify_context['can_recaptcha']))
274 290
 		{
275 291
 			if ($verify_context['show_visual'])
276 292
 			{
277
-				if ($context['use_graphic_library'])
278
-					echo '
293
+				if ($context['use_graphic_library']) {
294
+									echo '
279 295
 				<img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">';
280
-				else
281
-					echo '
296
+				} else {
297
+									echo '
282 298
 				<img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1">
283 299
 				<img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2">
284 300
 				<img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3">
285 301
 				<img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4">
286 302
 				<img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5">
287 303
 				<img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">';
304
+				}
288 305
 
289 306
 				echo '
290 307
 				<div class="smalltext" style="margin: 4px 0 8px 0;">
@@ -302,8 +319,7 @@  discard block
 block discarded – undo
302 319
 				<br>
303 320
 				<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl='.$lang.'"></script>';
304 321
 			}
305
-		}
306
-		else
322
+		} else
307 323
 		{
308 324
 			// Where in the question array is this question?
309 325
 			$qIndex = $verify_context['show_visual'] ? $i - 1 : $i;
@@ -315,21 +331,24 @@  discard block
 block discarded – undo
315 331
 				</div>';
316 332
 		}
317 333
 
318
-		if ($display_type != 'single')
319
-			echo '
334
+		if ($display_type != 'single') {
335
+					echo '
320 336
 			</div><!-- #verification_control_[i] -->';
337
+		}
321 338
 
322 339
 		// If we were displaying just one and we did it, break.
323
-		if ($display_type == 'single' && $verify_context['tracking'] == $i)
324
-			break;
340
+		if ($display_type == 'single' && $verify_context['tracking'] == $i) {
341
+					break;
342
+		}
325 343
 	}
326 344
 
327 345
 	// Assume we found something, always.
328 346
 	$verify_context['tracking']++;
329 347
 
330 348
 	// Tell something displaying piecemeal to keep going.
331
-	if ($display_type == 'single')
332
-		return true;
333
-}
349
+	if ($display_type == 'single') {
350
+			return true;
351
+	}
352
+	}
334 353
 
335 354
 ?>
336 355
\ No newline at end of file
Please login to merge, or discard this patch.
Themes/default/Packages.template.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1096,7 +1096,7 @@
 block discarded – undo
1096 1096
 /**
1097 1097
  * CHMOD control form
1098 1098
  *
1099
- * @return bool False if nothing to do.
1099
+ * @return false|null False if nothing to do.
1100 1100
  */
1101 1101
 function template_control_chmod()
1102 1102
 {
Please login to merge, or discard this patch.
Braces   +175 added lines, -128 removed lines patch added patch discarded remove patch
@@ -31,25 +31,27 @@  discard block
 block discarded – undo
31 31
 		</div>
32 32
 		<div class="information">';
33 33
 
34
-	if ($context['is_installed'])
35
-		echo '
34
+	if ($context['is_installed']) {
35
+			echo '
36 36
 			<strong>', $txt['package_installed_warning1'], '</strong><br>
37 37
 			<br>
38 38
 			', $txt['package_installed_warning2'], '<br>
39 39
 			<br>';
40
+	}
40 41
 
41 42
 	echo $txt['package_installed_warning3'], '
42 43
 		</div>
43 44
 		<br>';
44 45
 
45 46
 	// Do errors exist in the install? If so light them up like a christmas tree.
46
-	if ($context['has_failure'])
47
-		echo '
47
+	if ($context['has_failure']) {
48
+			echo '
48 49
 		<div class="errorbox">
49 50
 			', sprintf($txt['package_will_fail_title'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), '<br>
50 51
 			', sprintf($txt['package_will_fail_warning'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]),
51 52
 			!empty($context['failure_details']) ? '<br><br><strong>' . $context['failure_details'] . '</strong>' : '', '
52 53
 		</div>';
54
+	}
53 55
 
54 56
 	// Display the package readme if one exists
55 57
 	if (isset($context['package_readme']))
@@ -63,9 +65,10 @@  discard block
 block discarded – undo
63 65
 			<span class="floatright">', $txt['package_available_readme_language'], '
64 66
 				<select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value + \';license=\' + get_selected(\'license_language\'));">';
65 67
 
66
-		foreach ($context['readmes'] as $a => $b)
67
-			echo '
68
+		foreach ($context['readmes'] as $a => $b) {
69
+					echo '
68 70
 					<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>';
71
+		}
69 72
 
70 73
 		echo '
71 74
 				</select>
@@ -86,9 +89,10 @@  discard block
 block discarded – undo
86 89
 			<span class="floatright">', $txt['package_available_license_language'], '
87 90
 				<select name="license_language" id="license_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=install', ';package=', $context['filename'], ';license=\' + this.options[this.selectedIndex].value + \';readme=\' + get_selected(\'readme_language\'));">';
88 91
 
89
-		foreach ($context['licenses'] as $a => $b)
90
-			echo '
92
+		foreach ($context['licenses'] as $a => $b) {
93
+					echo '
91 94
 					<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>';
95
+		}
92 96
 		echo '
93 97
 				</select>
94 98
 			</span>
@@ -115,9 +119,10 @@  discard block
 block discarded – undo
115 119
 					', $txt['package_db_uninstall_actions'], ':
116 120
 					<ul>';
117 121
 
118
-		foreach ($context['database_changes'] as $change)
119
-			echo '
122
+		foreach ($context['database_changes'] as $change) {
123
+					echo '
120 124
 						<li>', $change, '</li>';
125
+		}
121 126
 
122 127
 		echo '
123 128
 					</ul>
@@ -128,14 +133,14 @@  discard block
 block discarded – undo
128 133
 	echo '
129 134
 			<div class="information">';
130 135
 
131
-	if (empty($context['actions']) && empty($context['database_changes']))
132
-		echo '
136
+	if (empty($context['actions']) && empty($context['database_changes'])) {
137
+			echo '
133 138
 				<br>
134 139
 				<div class="errorbox">
135 140
 					', $txt['corrupt_compatible'], '
136 141
 				</div>
137 142
 			</div><!-- .information -->';
138
-	else
143
+	} else
139 144
 	{
140 145
 		echo '
141 146
 				', $txt['perform_actions'], '
@@ -239,9 +244,10 @@  discard block
 block discarded – undo
239 244
 						<td></td>
240 245
 						<td>';
241 246
 
242
-				if (!empty($context['themes_locked']))
243
-					echo '
247
+				if (!empty($context['themes_locked'])) {
248
+									echo '
244 249
 							<input type="hidden" name="custom_theme[]" value="', $id, '">';
250
+				}
245 251
 				echo '
246 252
 							<input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);"', !empty($context['themes_locked']) ? ' disabled checked' : '', '>
247 253
 						</td>
@@ -307,21 +313,23 @@  discard block
 block discarded – undo
307 313
 	}
308 314
 
309 315
 	// Are we effectively ready to install?
310
-	if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes'])))
311
-		echo '
316
+	if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes']))) {
317
+			echo '
312 318
 			<div class="righttext padding">
313 319
 				<input type="submit" value="', $context['uninstalling'] ? $txt['package_uninstall_now'] : $txt['package_install_now'], '" onclick="return ', !empty($context['has_failure']) ? '(submitThisOnce(this) &amp;&amp; confirm(\'' . ($context['uninstalling'] ? $txt['package_will_fail_popup_uninstall'] : $txt['package_will_fail_popup']) . '\'))' : 'submitThisOnce(this)', ';" class="button">
314 320
 			</div>';
321
+	}
315 322
 
316 323
 	// If we need ftp information then demand it!
317
-	elseif ($context['ftp_needed'])
318
-		echo '
324
+	elseif ($context['ftp_needed']) {
325
+			echo '
319 326
 			<div class="cat_bar">
320 327
 				<h3 class="catbg">', $txt['package_ftp_necessary'], '</h3>
321 328
 			</div>
322 329
 			<div>
323 330
 				', template_control_chmod(), '
324 331
 			</div>';
332
+	}
325 333
 
326 334
 	echo '
327 335
 
@@ -338,8 +346,8 @@  discard block
 block discarded – undo
338 346
 	// Operations.
339 347
 	if (!empty($js_operations))
340 348
 	{
341
-		foreach ($js_operations as $key => $operation)
342
-			echo '
349
+		foreach ($js_operations as $key => $operation) {
350
+					echo '
343 351
 		aOperationElements[', $key, '] = new smc_Toggle({
344 352
 			bToggleEnabled: true,
345 353
 			bNoAnimate: true,
@@ -357,6 +365,7 @@  discard block
 block discarded – undo
357 365
 				}
358 366
 			]
359 367
 		});';
368
+		}
360 369
 	}
361 370
 
362 371
 	echo '
@@ -378,14 +387,15 @@  discard block
 block discarded – undo
378 387
 	</script>';
379 388
 
380 389
 	// And a bit more for database changes.
381
-	if (!empty($context['database_changes']))
382
-		echo '
390
+	if (!empty($context['database_changes'])) {
391
+			echo '
383 392
 	<script>
384 393
 		var database_changes_area = document.getElementById(\'db_changes_div\');
385 394
 		var db_vis = false;
386 395
 		database_changes_area.style.display = "none";
387 396
 	</script>';
388
-}
397
+	}
398
+	}
389 399
 
390 400
 /**
391 401
  * Extract package contents
@@ -394,8 +404,8 @@  discard block
 block discarded – undo
394 404
 {
395 405
 	global $context, $txt, $scripturl;
396 406
 
397
-	if (!empty($context['redirect_url']))
398
-		echo '
407
+	if (!empty($context['redirect_url'])) {
408
+			echo '
399 409
 	<script>
400 410
 		setTimeout("doRedirect();", ', empty($context['redirect_timeout']) ? '5000' : $context['redirect_timeout'], ');
401 411
 
@@ -404,52 +414,51 @@  discard block
 block discarded – undo
404 414
 			window.location = "', $context['redirect_url'], '";
405 415
 		}
406 416
 	</script>';
417
+	}
407 418
 
408 419
 	echo '
409 420
 	<div id="admincenter">';
410 421
 
411
-	if (empty($context['redirect_url']))
412
-		echo '
422
+	if (empty($context['redirect_url'])) {
423
+			echo '
413 424
 		<div class="cat_bar">
414 425
 			<h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3>
415 426
 		</div>
416 427
 		<div class="information">', $txt['package_installed_extract'], '</div>';
417
-	else
418
-		echo '
428
+	} else {
429
+			echo '
419 430
 		<div class="cat_bar">
420 431
 			<h3 class="catbg">', $txt['package_installed_redirecting'], '</h3>
421 432
 		</div>';
433
+	}
422 434
 
423 435
 	echo '
424 436
 		<div class="windowbg">';
425 437
 
426 438
 	// If we are going to redirect we have a slightly different agenda.
427
-	if (!empty($context['redirect_url']))
428
-		echo '
439
+	if (!empty($context['redirect_url'])) {
440
+			echo '
429 441
 			', $context['redirect_text'], '<br><br>
430 442
 			<a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>';
431
-
432
-	elseif ($context['uninstalling'])
433
-		echo '
443
+	} elseif ($context['uninstalling']) {
444
+			echo '
434 445
 			', $txt['package_uninstall_done'];
435
-
436
-	elseif ($context['install_finished'])
446
+	} elseif ($context['install_finished'])
437 447
 	{
438
-		if ($context['extract_type'] == 'avatar')
439
-			echo '
448
+		if ($context['extract_type'] == 'avatar') {
449
+					echo '
440 450
 			', $txt['avatars_extracted'];
441
-
442
-		elseif ($context['extract_type'] == 'language')
443
-			echo '
451
+		} elseif ($context['extract_type'] == 'language') {
452
+					echo '
444 453
 			', $txt['language_extracted'];
445
-
446
-		else
447
-			echo '
454
+		} else {
455
+					echo '
448 456
 			', $txt['package_installed_done'];
449
-	}
450
-	else
451
-		echo '
457
+		}
458
+	} else {
459
+			echo '
452 460
 			', $txt['corrupt_compatible'];
461
+	}
453 462
 
454 463
 	echo '
455 464
 		</div><!-- .windowbg -->';
@@ -483,9 +492,10 @@  discard block
 block discarded – undo
483 492
 		<div class="windowbg">
484 493
 			<ol>';
485 494
 
486
-	foreach ($context['files'] as $fileinfo)
487
-		echo '
495
+	foreach ($context['files'] as $fileinfo) {
496
+			echo '
488 497
 				<li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>';
498
+	}
489 499
 
490 500
 	echo '
491 501
 			</ol>
@@ -549,9 +559,10 @@  discard block
 block discarded – undo
549 559
 			</script>
550 560
 			<div id="yourVersion" style="display:none">', $context['forum_version'], '</div>';
551 561
 
552
-	if (empty($modSettings['disable_smf_js']))
553
-		echo '
562
+	if (empty($modSettings['disable_smf_js'])) {
563
+			echo '
554 564
 			<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
565
+	}
555 566
 
556 567
 	// This sets the announcements and current versions themselves ;).
557 568
 	echo '
@@ -590,12 +601,13 @@  discard block
 block discarded – undo
590 601
 		}
591 602
 	}
592 603
 
593
-	if (!$mods_available)
594
-		echo '
604
+	if (!$mods_available) {
605
+			echo '
595 606
 		<div class="noticebox">', $txt['no_packages'], '</div>';
596
-	else
597
-		echo '
607
+	} else {
608
+			echo '
598 609
 		<br>';
610
+	}
599 611
 
600 612
 	// The advanced (emulation) box, collapsed by default
601 613
 	echo '
@@ -622,9 +634,10 @@  discard block
 block discarded – undo
622 634
 							<a id="revert" name="revert"></a>
623 635
 							<select name="version_emulate" id="ve">';
624 636
 
625
-	foreach ($context['emulation_versions'] as $version)
626
-		echo '
637
+	foreach ($context['emulation_versions'] as $version) {
638
+			echo '
627 639
 								<option value="', $version, '"', ($version == $context['selected_version'] ? ' selected="selected"' : ''), '>', $version, '</option>';
640
+	}
628 641
 
629 642
 	echo '
630 643
 							</select>
@@ -680,11 +693,12 @@  discard block
 block discarded – undo
680 693
 {
681 694
 	global $context, $txt, $scripturl;
682 695
 
683
-	if (!empty($context['package_ftp']['error']))
684
-		echo '
696
+	if (!empty($context['package_ftp']['error'])) {
697
+			echo '
685 698
 	<div class="errorbox">
686 699
 		<pre>', $context['package_ftp']['error'], '</pre>
687 700
 	</div>';
701
+	}
688 702
 
689 703
 	echo '
690 704
 	<div id="admin_form_wrapper">
@@ -766,13 +780,14 @@  discard block
 block discarded – undo
766 780
 					<legend>' . $txt['package_servers'] . '</legend>
767 781
 					<ul class="package_servers">';
768 782
 
769
-	foreach ($context['servers'] as $server)
770
-		echo '
783
+	foreach ($context['servers'] as $server) {
784
+			echo '
771 785
 						<li class="flow_auto">
772 786
 							<span class="floatleft">' . $server['name'] . '</span>
773 787
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span>
774 788
 							<span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span>
775 789
 						</li>';
790
+	}
776 791
 	echo '
777 792
 					</ul>
778 793
 				</fieldset>
@@ -859,11 +874,12 @@  discard block
 block discarded – undo
859 874
 		<div class="windowbg2">';
860 875
 
861 876
 	// No packages, as yet.
862
-	if (empty($context['package_list']))
863
-		echo '
877
+	if (empty($context['package_list'])) {
878
+			echo '
864 879
 			<ul>
865 880
 				<li>', $txt['no_packages'], '</li>
866 881
 			</ul>';
882
+	}
867 883
 
868 884
 	// List out the packages...
869 885
 	else
@@ -877,11 +893,12 @@  discard block
 block discarded – undo
877 893
 				<li>
878 894
 					<strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>';
879 895
 
880
-			if (!empty($packageSection['text']))
881
-				echo '
896
+			if (!empty($packageSection['text'])) {
897
+							echo '
882 898
 					<div class="sub_bar">
883 899
 						<h3 class="subbg">', $packageSection['text'], '</h3>
884 900
 					</div>';
901
+			}
885 902
 
886 903
 			echo '
887 904
 					<', $context['list_type'], ' id="package_section_', $i, '" class="packages">';
@@ -892,24 +909,28 @@  discard block
 block discarded – undo
892 909
 						<li>';
893 910
 
894 911
 				// Textual message. Could be empty just for a blank line...
895
-				if ($package['is_text'])
896
-					echo '
912
+				if ($package['is_text']) {
913
+									echo '
897 914
 							', empty($package['name']) ? '&nbsp;' : $package['name'];
915
+				}
898 916
 
899 917
 				// This is supposed to be a rule..
900
-				elseif ($package['is_line'])
901
-					echo '
918
+				elseif ($package['is_line']) {
919
+									echo '
902 920
 							<hr>';
921
+				}
903 922
 
904 923
 				// A remote link.
905
-				elseif ($package['is_remote'])
906
-					echo '
924
+				elseif ($package['is_remote']) {
925
+									echo '
907 926
 							<strong>', $package['link'], '</strong>';
927
+				}
908 928
 
909 929
 				// A title?
910
-				elseif ($package['is_heading'] || $package['is_title'])
911
-					echo '
930
+				elseif ($package['is_heading'] || $package['is_title']) {
931
+									echo '
912 932
 							<strong>', $package['name'], '</strong>';
933
+				}
913 934
 
914 935
 				// Otherwise, it's a package.
915 936
 				else
@@ -920,32 +941,36 @@  discard block
 block discarded – undo
920 941
 						<ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">';
921 942
 
922 943
 					// Show the mod type?
923
-					if ($package['type'] != '')
924
-						echo '
944
+					if ($package['type'] != '') {
945
+											echo '
925 946
 							<li class="package_section">
926 947
 								', $txt['package_type'], ':&nbsp; ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '
927 948
 							</li>';
949
+					}
928 950
 
929 951
 					// Show the version number?
930
-					if ($package['version'] != '')
931
-						echo '
952
+					if ($package['version'] != '') {
953
+											echo '
932 954
 							<li class="package_section">
933 955
 								', $txt['mod_version'], ':&nbsp; ', $package['version'], '
934 956
 							</li>';
957
+					}
935 958
 
936 959
 					// How 'bout the author?
937
-					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link']))
938
-						echo '
960
+					if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) {
961
+											echo '
939 962
 							<li class="package_section">
940 963
 								', $txt['mod_author'], ':&nbsp; ', $package['author']['link'], '
941 964
 							</li>';
965
+					}
942 966
 
943 967
 					// The homepage...
944
-					if ($package['author']['website']['link'] != '')
945
-						echo '
968
+					if ($package['author']['website']['link'] != '') {
969
+											echo '
946 970
 							<li class="package_section">
947 971
 								', $txt['author_website'], ':&nbsp; ', $package['author']['website']['link'], '
948 972
 							</li>';
973
+					}
949 974
 
950 975
 					// Description: bleh bleh!
951 976
 					// Location of file: http://someplace/.
@@ -1004,8 +1029,8 @@  discard block
 block discarded – undo
1004 1029
 
1005 1030
 			foreach ($ps['items'] as $id => $package)
1006 1031
 			{
1007
-				if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote'])
1008
-					echo '
1032
+				if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) {
1033
+									echo '
1009 1034
 		var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({
1010 1035
 			bToggleEnabled: true,
1011 1036
 			bCurrentlyCollapsed: true,
@@ -1020,6 +1045,7 @@  discard block
 block discarded – undo
1020 1045
 				}
1021 1046
 			]
1022 1047
 		});';
1048
+				}
1023 1049
 			}
1024 1050
 		}
1025 1051
 
@@ -1064,9 +1090,10 @@  discard block
 block discarded – undo
1064 1090
 {
1065 1091
 	global $context, $txt, $scripturl;
1066 1092
 
1067
-	if (!empty($context['saved_successful']))
1068
-		echo '
1093
+	if (!empty($context['saved_successful'])) {
1094
+			echo '
1069 1095
 	<div class="infobox">', $txt['settings_saved'], '</div>';
1096
+	}
1070 1097
 
1071 1098
 	echo '
1072 1099
 	<div id="admincenter">
@@ -1128,8 +1155,9 @@  discard block
 block discarded – undo
1128 1155
 	global $context, $txt;
1129 1156
 
1130 1157
 	// Nothing to do? Brilliant!
1131
-	if (empty($context['package_ftp']))
1132
-		return false;
1158
+	if (empty($context['package_ftp'])) {
1159
+			return false;
1160
+	}
1133 1161
 
1134 1162
 	if (empty($context['package_ftp']['form_elements_only']))
1135 1163
 	{
@@ -1139,19 +1167,21 @@  discard block
 block discarded – undo
1139 1167
 					', $txt['package_ftp_why_file_list'], '
1140 1168
 					<ul style="display: inline;">';
1141 1169
 
1142
-		if (!empty($context['notwritable_files']))
1143
-			foreach ($context['notwritable_files'] as $file)
1170
+		if (!empty($context['notwritable_files'])) {
1171
+					foreach ($context['notwritable_files'] as $file)
1144 1172
 				echo '
1145 1173
 						<li>', $file, '</li>';
1174
+		}
1146 1175
 
1147 1176
 		echo '
1148 1177
 					</ul>';
1149 1178
 
1150
-		if (!$context['server']['is_windows'])
1151
-			echo '
1179
+		if (!$context['server']['is_windows']) {
1180
+					echo '
1152 1181
 					<hr>
1153 1182
 					', $txt['package_chmod_linux'], '<br>
1154 1183
 					<tt># chmod a+w ', implode(' ', $context['notwritable_files']), '</tt>';
1184
+		}
1155 1185
 
1156 1186
 		echo '
1157 1187
 				</div><!-- #need_writable_list -->';
@@ -1164,9 +1194,10 @@  discard block
 block discarded – undo
1164 1194
 					</div>
1165 1195
 				</div>';
1166 1196
 
1167
-	if (!empty($context['package_ftp']['destination']))
1168
-		echo '
1197
+	if (!empty($context['package_ftp']['destination'])) {
1198
+			echo '
1169 1199
 				<form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '">';
1200
+	}
1170 1201
 
1171 1202
 	echo '
1172 1203
 					<fieldset>
@@ -1199,24 +1230,27 @@  discard block
 block discarded – undo
1199 1230
 					</dl>
1200 1231
 					</fieldset>';
1201 1232
 
1202
-	if (empty($context['package_ftp']['form_elements_only']))
1203
-		echo '
1233
+	if (empty($context['package_ftp']['form_elements_only'])) {
1234
+			echo '
1204 1235
 					<div class="righttext" style="margin: 1ex;">
1205 1236
 						<span id="test_ftp_placeholder_full"></span>
1206 1237
 						<input type="submit" value="', $txt['package_proceed'], '" class="button">
1207 1238
 					</div>';
1239
+	}
1208 1240
 
1209
-	if (!empty($context['package_ftp']['destination']))
1210
-		echo '
1241
+	if (!empty($context['package_ftp']['destination'])) {
1242
+			echo '
1211 1243
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1212 1244
 				</form>';
1245
+	}
1213 1246
 
1214 1247
 	// Hide the details of the list.
1215
-	if (empty($context['package_ftp']['form_elements_only']))
1216
-		echo '
1248
+	if (empty($context['package_ftp']['form_elements_only'])) {
1249
+			echo '
1217 1250
 				<script>
1218 1251
 					document.getElementById(\'need_writable_list\').style.display = \'none\';
1219 1252
 				</script>';
1253
+	}
1220 1254
 
1221 1255
 	// Quick generate the test button.
1222 1256
 	echo '
@@ -1573,9 +1607,10 @@  discard block
 block discarded – undo
1573 1607
 					<td width="30%">
1574 1608
 						<strong>';
1575 1609
 
1576
-		if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1577
-			echo '
1610
+		if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1611
+					echo '
1578 1612
 							<span class="generic_icons folder"></span>';
1613
+		}
1579 1614
 
1580 1615
 		echo '
1581 1616
 							', $name, '
@@ -1602,8 +1637,9 @@  discard block
 block discarded – undo
1602 1637
 					</td>
1603 1638
 				</tr>';
1604 1639
 
1605
-		if (!empty($dir['contents']))
1606
-			template_permission_show_contents($name, $dir['contents'], 1);
1640
+		if (!empty($dir['contents'])) {
1641
+					template_permission_show_contents($name, $dir['contents'], 1);
1642
+		}
1607 1643
 	}
1608 1644
 
1609 1645
 	echo '
@@ -1639,13 +1675,14 @@  discard block
 block discarded – undo
1639 1675
 			</fieldset>';
1640 1676
 
1641 1677
 	// Likely to need FTP?
1642
-	if (empty($context['ftp_connected']))
1643
-		echo '
1678
+	if (empty($context['ftp_connected'])) {
1679
+			echo '
1644 1680
 			<p>
1645 1681
 				', $txt['package_file_perms_ftp_details'], ':
1646 1682
 			</p>
1647 1683
 			', template_control_chmod(), '
1648 1684
 			<div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>';
1685
+	}
1649 1686
 
1650 1687
 	echo '
1651 1688
 			<span id="test_ftp_placeholder_full"></span>
@@ -1654,9 +1691,10 @@  discard block
 block discarded – undo
1654 1691
 		</div><!-- .windowbg2 -->';
1655 1692
 
1656 1693
 	// Any looks fors we've already done?
1657
-	foreach ($context['look_for'] as $path)
1658
-		echo '
1694
+	foreach ($context['look_for'] as $path) {
1695
+			echo '
1659 1696
 		<input type="hidden" name="back_look[]" value="', $path, '">';
1697
+	}
1660 1698
 
1661 1699
 	echo '
1662 1700
 	</form>
@@ -1698,9 +1736,10 @@  discard block
 block discarded – undo
1698 1736
 					<td class="smalltext" width="30%">' . str_repeat('&nbsp;', $level * 5), '
1699 1737
 					', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : '';
1700 1738
 
1701
-			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
1702
-				echo '
1739
+			if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) {
1740
+							echo '
1703 1741
 						<span class="generic_icons folder"></span>';
1742
+			}
1704 1743
 
1705 1744
 			echo '
1706 1745
 						', $name, '
@@ -1718,34 +1757,38 @@  discard block
 block discarded – undo
1718 1757
 				</tr>
1719 1758
 				<tr id="insert_div_loc_' . $cur_ident . '" style="display: none;"><td></td></tr>';
1720 1759
 
1721
-			if (!empty($dir['contents']))
1722
-				template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files']));
1760
+			if (!empty($dir['contents'])) {
1761
+							template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files']));
1762
+			}
1723 1763
 		}
1724 1764
 	}
1725 1765
 
1726 1766
 	// We have more files to show?
1727
-	if ($has_more)
1728
-		echo '
1767
+	if ($has_more) {
1768
+			echo '
1729 1769
 				<tr class="windowbg" id="content_', $js_ident, '_more">
1730 1770
 					<td class="smalltext" width="40%">' . str_repeat('&nbsp;', $level * 5), '
1731 1771
 						&#171; <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> &#187;
1732 1772
 					</td>
1733 1773
 					<td colspan="6"></td>
1734 1774
 				</tr>';
1775
+	}
1735 1776
 
1736 1777
 	if ($drawn_div)
1737 1778
 	{
1738 1779
 		// Hide anything too far down the tree.
1739 1780
 		$isFound = false;
1740
-		foreach ($context['look_for'] as $tree)
1741
-			if (substr($tree, 0, strlen($ident)) == $ident)
1781
+		foreach ($context['look_for'] as $tree) {
1782
+					if (substr($tree, 0, strlen($ident)) == $ident)
1742 1783
 				$isFound = true;
1784
+		}
1743 1785
 
1744
-		if ($level > 1 && !$isFound)
1745
-			echo '
1786
+		if ($level > 1 && !$isFound) {
1787
+					echo '
1746 1788
 		<script>
1747 1789
 			expandFolder(\'', $js_ident, '\', \'\');
1748 1790
 		</script>';
1791
+		}
1749 1792
 	}
1750 1793
 }
1751 1794
 
@@ -1765,11 +1808,12 @@  discard block
 block discarded – undo
1765 1808
 				<h3 class="catbg">', $txt['package_file_perms_applying'], '</h3>
1766 1809
 			</div>';
1767 1810
 
1768
-	if (!empty($context['skip_ftp']))
1769
-		echo '
1811
+	if (!empty($context['skip_ftp'])) {
1812
+			echo '
1770 1813
 			<div class="errorbox">
1771 1814
 				', $txt['package_file_perms_skipping_ftp'], '
1772 1815
 			</div>';
1816
+	}
1773 1817
 
1774 1818
 	// How many have we done?
1775 1819
 	$remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']);
@@ -1808,28 +1852,31 @@  discard block
 block discarded – undo
1808 1852
 				<br>';
1809 1853
 
1810 1854
 	// Put out the right hidden data.
1811
-	if ($context['method'] == 'individual')
1812
-		echo '
1855
+	if ($context['method'] == 'individual') {
1856
+			echo '
1813 1857
 				<input type="hidden" name="custom_value" value="', $context['custom_value'], '">
1814 1858
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1815 1859
 				<input type="hidden" name="toProcess" value="', $context['to_process_encode'], '">';
1816
-	else
1817
-		echo '
1860
+	} else {
1861
+			echo '
1818 1862
 				<input type="hidden" name="predefined" value="', $context['predefined_type'], '">
1819 1863
 				<input type="hidden" name="fileOffset" value="', $context['file_offset'], '">
1820 1864
 				<input type="hidden" name="totalItems" value="', $context['total_items'], '">
1821 1865
 				<input type="hidden" name="dirList" value="', $context['directory_list_encode'], '">
1822 1866
 				<input type="hidden" name="specialFiles" value="', $context['special_files_encode'], '">';
1867
+	}
1823 1868
 
1824 1869
 	// Are we not using FTP for whatever reason.
1825
-	if (!empty($context['skip_ftp']))
1826
-		echo '
1870
+	if (!empty($context['skip_ftp'])) {
1871
+			echo '
1827 1872
 				<input type="hidden" name="skip_ftp" value="1">';
1873
+	}
1828 1874
 
1829 1875
 	// Retain state.
1830
-	foreach ($context['back_look_data'] as $path)
1831
-		echo '
1876
+	foreach ($context['back_look_data'] as $path) {
1877
+			echo '
1832 1878
 				<input type="hidden" name="back_look[]" value="', $path, '">';
1879
+	}
1833 1880
 
1834 1881
 	echo '
1835 1882
 				<input type="hidden" name="method" value="', $context['method'], '">
Please login to merge, or discard this patch.
Packages/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
 	header('Location: ' . $boardurl);
13 13
 }
14 14
 // Can't find it... just forget it.
15
-else
15
+else {
16 16
 	exit;
17
+}
17 18
 
18 19
 ?>
19 20
\ No newline at end of file
Please login to merge, or discard this patch.