Completed
Push — release-2.1 ( 5fca16...3ecb1d )
by Michael
07:15
created
Sources/Subs-Db-postgresql.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -200,22 +200,22 @@  discard block
 block discarded – undo
200 200
 
201 201
 		case 'date':
202 202
 			if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1)
203
-				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date';
203
+				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date';
204 204
 			else
205 205
 				smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
206 206
 		break;
207 207
 
208 208
 		case 'time':
209 209
 			if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1)
210
-				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time';
210
+				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time';
211 211
 			else
212 212
 				smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
213 213
 		break;
214 214
 
215 215
 		case 'datetime':
216 216
 			if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1)
217
-				return 'to_timestamp('.
218
-					sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]).
217
+				return 'to_timestamp(' .
218
+					sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) .
219 219
 					',\'YYYY-MM-DD HH24:MI:SS\')';
220 220
 			else
221 221
 				smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	if (!empty($keys) && (count($keys) > 0) && $returnmode > 0)
768 768
 	{
769 769
 		// we only take the first key
770
-		$returning = ' RETURNING '.$keys[0];
770
+		$returning = ' RETURNING ' . $keys[0];
771 771
 		$with_returning = true;
772 772
 	}
773 773
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 			INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
799 799
 			VALUES
800 800
 				' . implode(',
801
-				', $insertRows).$replace.$returning,
801
+				', $insertRows) . $replace . $returning,
802 802
 			array(
803 803
 				'security_override' => true,
804 804
 				'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 			if ($returnmode === 2)
812 812
 				$return_var = array();
813 813
 
814
-			while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
814
+			while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
815 815
 			{
816 816
 				if (is_numeric($row[0])) // try to emulate mysql limitation
817 817
 				{
Please login to merge, or discard this patch.
Sources/ManageCalendar.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 					'value' => $txt['date'],
137 137
 				),
138 138
 				'data' => array(
139
-					'function' => function ($rowData) use ($txt)
139
+					'function' => function($rowData) use ($txt)
140 140
 					{
141 141
 						// Recurring every year or just a single year?
142 142
 						$year = $rowData['year'] == '1004' ? sprintf('(%1$s)', $txt['every_year']) : $rowData['year'];
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		checkSession();
219 219
 
220 220
 		// Not too long good sir?
221
-		$_REQUEST['title'] =  $smcFunc['substr']($_REQUEST['title'], 0, 60);
221
+		$_REQUEST['title'] = $smcFunc['substr']($_REQUEST['title'], 0, 60);
222 222
 		$_REQUEST['holiday'] = isset($_REQUEST['holiday']) ? (int) $_REQUEST['holiday'] : 0;
223 223
 
224 224
 		if (isset($_REQUEST['delete']))
Please login to merge, or discard this patch.
Sources/Who.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 						'Shitiz "Dragooon" Garg',
591 591
 						'Karl "RegularExpression" Benson',
592 592
 						'Matthew "Labradoodle-360" Kerle',
593
-						$user_info['is_admin'] ? 'Matt "Grudge" Wolf': 'Grudge',
593
+						$user_info['is_admin'] ? 'Matt "Grudge" Wolf' : 'Grudge',
594 594
 						'Michael "Thantos" Miller',
595 595
 						'Norv',
596 596
 						'Peter "Arantor" Spicer',
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
 			$credit_info = $smcFunc['json_decode']($row['credits'], true);
815 815
 
816 816
 			$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' © ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
817
-			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
817
+			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
818 818
 			$version = $txt['credits_version'] . ' ' . $row['version'];
819 819
 			$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
820 820
 
821 821
 			// build this one out and stash it away
822 822
 			$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
823
-			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license  : '') . (!empty($copyright) ? ' | ' . $copyright  : '');
823
+			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
824 824
 		}
825 825
 		cache_put_data('mods_credits', $mods, 86400);
826 826
 	}
Please login to merge, or discard this patch.
Sources/Attachments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		// Just send a generic message.
77 77
 		else
78 78
 			$this->setResponse(array(
79
-				'text' => $this->_sa == 'add' ? 'attach_error_title' :   'attached_file_deleted_error',
79
+				'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error',
80 80
 				'type' => 'error',
81 81
 				'data' => false,
82 82
 			));
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 			// Gotta urlencode the filename.
407 407
 			if ($this->_attachResults)
408 408
 				foreach ($this->_attachResults as $k => $v)
409
-					$this->_attachResults[$k]['name'] =  urlencode($this->_attachResults[$k]['name']);
409
+					$this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']);
410 410
 
411 411
 			$this->_response = array(
412 412
 				'files' => $this->_attachResults ? $this->_attachResults : false,
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			ob_start();
434 434
 
435 435
 		// Set the header.
436
-		header('Content-Type: application/json; charset='. $context['character_set'] .'');
436
+		header('Content-Type: application/json; charset=' . $context['character_set'] . '');
437 437
 
438 438
 		echo $smcFunc['json_encode']($this->_response ? $this->_response : array());
439 439
 
Please login to merge, or discard this patch.
Themes/default/MessageIndex.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 				foreach ($board['children'] as $child)
87 87
 				{
88 88
 					if (!$child['is_redirect'])
89
-						$child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
89
+						$child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
90 90
 					else
91 91
 						$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
92 92
 
Please login to merge, or discard this patch.
Sources/ManageSettings.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 					'class' => 'centercol',
1335 1335
 				),
1336 1336
 				'data' => array(
1337
-					'function' => function ($rowData)
1337
+					'function' => function($rowData)
1338 1338
 					{
1339 1339
 						$isChecked = $rowData['disabled'] ? '' : ' checked';
1340 1340
 						$onClickHandler = $rowData['can_show_register'] ? sprintf(' onclick="document.getElementById(\'reg_%1$s\').disabled = !this.checked;"', $rowData['id']) : '';
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 					'class' => 'centercol',
1351 1351
 				),
1352 1352
 				'data' => array(
1353
-					'function' => function ($rowData)
1353
+					'function' => function($rowData)
1354 1354
 					{
1355 1355
 						$isChecked = $rowData['on_register'] && !$rowData['disabled'] ? ' checked' : '';
1356 1356
 						$isDisabled = $rowData['can_show_register'] ? '' : ' disabled';
@@ -1397,15 +1397,15 @@  discard block
 block discarded – undo
1397 1397
 					'value' => $txt['custom_profile_fieldorder'],
1398 1398
 				),
1399 1399
 				'data' => array(
1400
-					'function' => function ($rowData) use ($context, $txt, $scripturl)
1400
+					'function' => function($rowData) use ($context, $txt, $scripturl)
1401 1401
 					{
1402
-						$return = '<p class="centertext bold_text">'. $rowData['field_order'] .'<br>';
1402
+						$return = '<p class="centertext bold_text">' . $rowData['field_order'] . '<br>';
1403 1403
 
1404 1404
 						if ($rowData['field_order'] > 1)
1405
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_up'] .'"></span></a>';
1405
+							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=up"><span class="toggle_up" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_up'] . '"></span></a>';
1406 1406
 
1407 1407
 						if ($rowData['field_order'] < $context['custFieldsMaxOrder'])
1408
-							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="'. $txt['custom_edit_order_move'] .' '. $txt['custom_edit_order_down'] .'"></span></a>';
1408
+							$return .= '<a href="' . $scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $rowData['id_field'] . ';move=down"><span class="toggle_down" title="' . $txt['custom_edit_order_move'] . ' ' . $txt['custom_edit_order_down'] . '"></span></a>';
1409 1409
 
1410 1410
 						$return .= '</p>';
1411 1411
 
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 					'value' => $txt['custom_profile_fieldname'],
1424 1424
 				),
1425 1425
 				'data' => array(
1426
-					'function' => function ($rowData) use ($scripturl)
1426
+					'function' => function($rowData) use ($scripturl)
1427 1427
 					{
1428 1428
 						return sprintf('<a href="%1$s?action=admin;area=featuresettings;sa=profileedit;fid=%2$d">%3$s</a><div class="smalltext">%4$s</div>', $scripturl, $rowData['id_field'], $rowData['field_name'], $rowData['field_desc']);
1429 1429
 					},
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 					'value' => $txt['custom_profile_fieldtype'],
1440 1440
 				),
1441 1441
 				'data' => array(
1442
-					'function' => function ($rowData) use ($txt)
1442
+					'function' => function($rowData) use ($txt)
1443 1443
 					{
1444 1444
 						$textKey = sprintf('custom_profile_type_%1$s', $rowData['field_type']);
1445 1445
 						return isset($txt[$textKey]) ? $txt[$textKey] : $textKey;
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 					'value' => $txt['custom_profile_active'],
1458 1458
 				),
1459 1459
 				'data' => array(
1460
-					'function' => function ($rowData) use ($txt)
1460
+					'function' => function($rowData) use ($txt)
1461 1461
 					{
1462 1462
 						return $rowData['active'] ? $txt['yes'] : $txt['no'];
1463 1463
 					},
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 					'value' => $txt['custom_profile_placement'],
1475 1475
 				),
1476 1476
 				'data' => array(
1477
-					'function' => function ($rowData)
1477
+					'function' => function($rowData)
1478 1478
 					{
1479 1479
 						global $txt, $context;
1480 1480
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 			redirectexit('action=admin;area=featuresettings;sa=profile'); // @todo implement an error handler
1710 1710
 
1711 1711
 		// All good, proceed.
1712
-		$smcFunc['db_query']('','
1712
+		$smcFunc['db_query']('', '
1713 1713
 			UPDATE {db_prefix}custom_fields
1714 1714
 			SET field_order = {int:old_order}
1715 1715
 			WHERE field_order = {int:new_order}',
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
 				'old_order' => $context['field']['order'],
1719 1719
 			)
1720 1720
 		);
1721
-		$smcFunc['db_query']('','
1721
+		$smcFunc['db_query']('', '
1722 1722
 			UPDATE {db_prefix}custom_fields
1723 1723
 			SET field_order = {int:new_order}
1724 1724
 			WHERE id_field = {int:id_field}',
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
 			$smcFunc['db_free_result']($request);
1821 1821
 
1822 1822
 			$unique = false;
1823
-			for ($i = 0; !$unique && $i < 9; $i ++)
1823
+			for ($i = 0; !$unique && $i < 9; $i++)
1824 1824
 			{
1825 1825
 				if (!in_array($col_name, $current_fields))
1826 1826
 					$unique = true;
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 		);
1994 1994
 
1995 1995
 		// Re-arrange the order.
1996
-		$smcFunc['db_query']('','
1996
+		$smcFunc['db_query']('', '
1997 1997
 			UPDATE {db_prefix}custom_fields
1998 1998
 			SET field_order = field_order - 1
1999 1999
 			WHERE field_order > {int:current_order}',
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 	$context['token_check'] = 'noti-admin';
2258 2258
 
2259 2259
 	// Specify our action since we'll want to post back here instead of the profile
2260
-	$context['action'] = 'action=admin;area=featuresettings;sa=alerts;'. $context['session_var'] .'='. $context['session_id'];
2260
+	$context['action'] = 'action=admin;area=featuresettings;sa=alerts;' . $context['session_var'] . '=' . $context['session_id'];
2261 2261
 
2262 2262
 	loadTemplate('Profile');
2263 2263
 	loadLanguage('Profile');
Please login to merge, or discard this patch.
Sources/Display.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -891,13 +891,13 @@
 block discarded – undo
891 891
 		if ($start_char === 'C')
892 892
 			$limit_seek = $limit;
893 893
 		else
894
-			$limit_seek  = $limit + 1;
894
+			$limit_seek = $limit + 1;
895 895
 
896 896
 		$request = $smcFunc['db_query']('', '
897 897
 			SELECT id_msg, id_member, approved
898 898
 			FROM {db_prefix}messages
899 899
 			WHERE id_topic = {int:current_topic} 
900
-			AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : '
900
+			AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : '
901 901
 			AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . '
902 902
 			ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
903 903
 			LIMIT {int:limit}'),
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
801 801
 		if (empty($unsupportedFormats))
802 802
 		{
803
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
803
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
804 804
 			{
805 805
 				$value = @strftime('%' . $format);
806 806
 
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1166 1166
 				),
1167 1167
 				'content' => '$1',
1168
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1168
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1169 1169
 				{
1170 1170
 					$returnContext = '';
1171 1171
 
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 						}
1201 1201
 
1202 1202
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1203
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1203
+							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>';
1204 1204
 						else
1205 1205
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1206 1206
 					}
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 				'type' => 'unparsed_content',
1230 1230
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1231 1231
 				// @todo Maybe this can be simplified?
1232
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1232
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1233 1233
 				{
1234 1234
 					if (!isset($disabled['code']))
1235 1235
 					{
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 				'type' => 'unparsed_equals_content',
1267 1267
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1268 1268
 				// @todo Maybe this can be simplified?
1269
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1269
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1270 1270
 				{
1271 1271
 					if (!isset($disabled['code']))
1272 1272
 					{
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 				'type' => 'unparsed_content',
1311 1311
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1312 1312
 				// @todo Should this respect guest_hideContacts?
1313
-				'validate' => function (&$tag, &$data, $disabled)
1313
+				'validate' => function(&$tag, &$data, $disabled)
1314 1314
 				{
1315 1315
 					$data = strtr($data, array('<br>' => ''));
1316 1316
 				},
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 				'type' => 'unparsed_commas_content',
1330 1330
 				'test' => '\d+,\d+\]',
1331 1331
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1332
-				'validate' => function (&$tag, &$data, $disabled)
1332
+				'validate' => function(&$tag, &$data, $disabled)
1333 1333
 				{
1334 1334
 					if (isset($disabled['url']))
1335 1335
 						$tag['content'] = '$1';
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1346 1346
 				'before' => '<div $1>',
1347 1347
 				'after' => '</div>',
1348
-				'validate' => function (&$tag, &$data, $disabled)
1348
+				'validate' => function(&$tag, &$data, $disabled)
1349 1349
 				{
1350 1350
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1351 1351
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1395 1395
 				),
1396 1396
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1397
-				'validate' => function (&$tag, &$data, $disabled)
1397
+				'validate' => function(&$tag, &$data, $disabled)
1398 1398
 				{
1399 1399
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1400 1400
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 				'tag' => 'img',
1418 1418
 				'type' => 'unparsed_content',
1419 1419
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1420
-				'validate' => function (&$tag, &$data, $disabled)
1420
+				'validate' => function(&$tag, &$data, $disabled)
1421 1421
 				{
1422 1422
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1423 1423
 
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 				'tag' => 'iurl',
1441 1441
 				'type' => 'unparsed_content',
1442 1442
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1443
-				'validate' => function (&$tag, &$data, $disabled)
1443
+				'validate' => function(&$tag, &$data, $disabled)
1444 1444
 				{
1445 1445
 					$data = strtr($data, array('<br>' => ''));
1446 1446
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 				'quoted' => 'optional',
1455 1455
 				'before' => '<a href="$1" class="bbc_link">',
1456 1456
 				'after' => '</a>',
1457
-				'validate' => function (&$tag, &$data, $disabled)
1457
+				'validate' => function(&$tag, &$data, $disabled)
1458 1458
 				{
1459 1459
 					if (substr($data, 0, 1) == '#')
1460 1460
 						$data = '#post_' . substr($data, 1);
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 				'tag' => 'php',
1535 1535
 				'type' => 'unparsed_content',
1536 1536
 				'content' => '<span class="phpcode">$1</span>',
1537
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1537
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1538 1538
 				{
1539 1539
 					if (!isset($disabled['php']))
1540 1540
 					{
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 				'test' => '[1-7]\]',
1633 1633
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1634 1634
 				'after' => '</span>',
1635
-				'validate' => function (&$tag, &$data, $disabled)
1635
+				'validate' => function(&$tag, &$data, $disabled)
1636 1636
 				{
1637 1637
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1638 1638
 					$data = $sizes[$data] . 'em';
@@ -1670,7 +1670,7 @@  discard block
 block discarded – undo
1670 1670
 				'tag' => 'time',
1671 1671
 				'type' => 'unparsed_content',
1672 1672
 				'content' => '$1',
1673
-				'validate' => function (&$tag, &$data, $disabled)
1673
+				'validate' => function(&$tag, &$data, $disabled)
1674 1674
 				{
1675 1675
 					if (is_numeric($data))
1676 1676
 						$data = timeformat($data);
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 				'tag' => 'url',
1699 1699
 				'type' => 'unparsed_content',
1700 1700
 				'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
1701
-				'validate' => function (&$tag, &$data, $disabled)
1701
+				'validate' => function(&$tag, &$data, $disabled)
1702 1702
 				{
1703 1703
 					$data = strtr($data, array('<br>' => ''));
1704 1704
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 				'quoted' => 'optional',
1713 1713
 				'before' => '<a href="$1" class="bbc_link" target="_blank">',
1714 1714
 				'after' => '</a>',
1715
-				'validate' => function (&$tag, &$data, $disabled)
1715
+				'validate' => function(&$tag, &$data, $disabled)
1716 1716
 				{
1717 1717
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1718 1718
 					if (empty($scheme))
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 		{
1739 1739
 			if (isset($temp_bbc))
1740 1740
 				$bbc_codes = $temp_bbc;
1741
-			usort($codes, function ($a, $b) {
1741
+			usort($codes, function($a, $b) {
1742 1742
 				return strcmp($a['tag'], $b['tag']);
1743 1743
 			});
1744 1744
 			return $codes;
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 										# a run of Unicode domain name characters and a dot
1977 1977
 										[\p{L}\p{M}\p{N}\-.:@]+\.
1978 1978
 										# and then a TLD valid in the DNS or the reserved "local" TLD
1979
-										(?:'. $modSettings['tld_regex'] .'|local)
1979
+										(?:'. $modSettings['tld_regex'] . '|local)
1980 1980
 									)
1981 1981
 									# followed by a non-domain character or end of line
1982 1982
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 						)?
2045 2045
 						';
2046 2046
 
2047
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2047
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2048 2048
 							$url = array_shift($matches);
2049 2049
 
2050 2050
 							$scheme = parse_url($url, PHP_URL_SCHEME);
@@ -2781,7 +2781,7 @@  discard block
 block discarded – undo
2781 2781
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2782 2782
 		{
2783 2783
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2784
-			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2784
+			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2785 2785
 
2786 2786
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2787 2787
 
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
 
2799 2799
 	// Replace away!
2800 2800
 	$message = preg_replace_callback($smileyPregSearch,
2801
-		function ($matches) use ($smileyPregReplacements)
2801
+		function($matches) use ($smileyPregReplacements)
2802 2802
 		{
2803 2803
 			return $smileyPregReplacements[$matches[1]];
2804 2804
 		}, $message);
@@ -2864,13 +2864,13 @@  discard block
 block discarded – undo
2864 2864
 	{
2865 2865
 		if (defined('SID') && SID != '')
2866 2866
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2867
-				function ($m) use ($scripturl)
2867
+				function($m) use ($scripturl)
2868 2868
 				{
2869
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
2869
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
2870 2870
 				}, $setLocation);
2871 2871
 		else
2872 2872
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2873
-				function ($m) use ($scripturl)
2873
+				function($m) use ($scripturl)
2874 2874
 				{
2875 2875
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
2876 2876
 				}, $setLocation);
@@ -3193,7 +3193,7 @@  discard block
 block discarded – undo
3193 3193
 
3194 3194
 	// Add a generic "Are you sure?" confirmation message.
3195 3195
 	addInlineJavaScript('
3196
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3196
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3197 3197
 
3198 3198
 	// Now add the capping code for avatars.
3199 3199
 	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize')
@@ -3554,7 +3554,7 @@  discard block
 block discarded – undo
3554 3554
 
3555 3555
 		else
3556 3556
 			echo '
3557
-	<script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>';
3557
+	<script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>';
3558 3558
 	}
3559 3559
 
3560 3560
 	// Inline JavaScript - Actually useful some times!
@@ -3632,14 +3632,14 @@  discard block
 block discarded – undo
3632 3632
 
3633 3633
 		else
3634 3634
 			echo '
3635
-	<link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">';
3635
+	<link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">';
3636 3636
 	}
3637 3637
 
3638 3638
 	// Print the rest after the minified files.
3639 3639
 	if (!empty($normal))
3640 3640
 		foreach ($normal as $nf)
3641 3641
 			echo '
3642
-	<link rel="stylesheet" href="', $nf ,'">';
3642
+	<link rel="stylesheet" href="', $nf, '">';
3643 3643
 
3644 3644
 	if ($db_show_debug === true)
3645 3645
 	{
@@ -3655,7 +3655,7 @@  discard block
 block discarded – undo
3655 3655
 	<style>';
3656 3656
 
3657 3657
 		foreach ($context['css_header'] as $css)
3658
-			echo $css .'
3658
+			echo $css . '
3659 3659
 	';
3660 3660
 
3661 3661
 		echo'
@@ -3684,27 +3684,27 @@  discard block
 block discarded – undo
3684 3684
 		return false;
3685 3685
 
3686 3686
 	// Did we already did this?
3687
-	$toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400);
3687
+	$toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400);
3688 3688
 
3689 3689
 	// Already done?
3690 3690
 	if (!empty($toCache))
3691 3691
 		return true;
3692 3692
 
3693 3693
 	// No namespaces, sorry!
3694
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3694
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3695 3695
 
3696 3696
 	// Temp path.
3697
-	$cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/';
3697
+	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
3698 3698
 
3699 3699
 	// What kind of file are we going to create?
3700
-	$toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type;
3700
+	$toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type;
3701 3701
 
3702 3702
 	// File has to exists, if it isn't try to create it.
3703 3703
 	if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate))
3704 3704
 	{
3705 3705
 		loadLanguage('Errors');
3706 3706
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3707
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3707
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3708 3708
 
3709 3709
 		// The process failed so roll back to print each individual file.
3710 3710
 		return $data;
@@ -3739,14 +3739,14 @@  discard block
 block discarded – undo
3739 3739
 	{
3740 3740
 		loadLanguage('Errors');
3741 3741
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3742
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3742
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3743 3743
 
3744 3744
 		// The process failed so roll back to print each individual file.
3745 3745
 		return $data;
3746 3746
 	}
3747 3747
 
3748 3748
 	// And create a long lived cache entry.
3749
-	cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400);
3749
+	cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400);
3750 3750
 
3751 3751
 	return true;
3752 3752
 }
@@ -3806,7 +3806,7 @@  discard block
 block discarded – undo
3806 3806
 	else
3807 3807
 		$path = $modSettings['attachmentUploadDir'];
3808 3808
 
3809
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3809
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
3810 3810
 }
3811 3811
 
3812 3812
 /**
@@ -3850,10 +3850,10 @@  discard block
 block discarded – undo
3850 3850
 		$valid_low = isValidIP($ip_parts[0]);
3851 3851
 		$valid_high = isValidIP($ip_parts[1]);
3852 3852
 		$count = 0;
3853
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
3853
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
3854 3854
 		$max = ($mode == ':' ? 'ffff' : '255');
3855 3855
 		$min = 0;
3856
-		if(!$valid_low)
3856
+		if (!$valid_low)
3857 3857
 		{
3858 3858
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
3859 3859
 			$valid_low = isValidIP($ip_parts[0]);
@@ -3867,7 +3867,7 @@  discard block
 block discarded – undo
3867 3867
 		}
3868 3868
 
3869 3869
 		$count = 0;
3870
-		if(!$valid_high)
3870
+		if (!$valid_high)
3871 3871
 		{
3872 3872
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
3873 3873
 			$valid_high = isValidIP($ip_parts[1]);
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
 			}
3881 3881
 		}
3882 3882
 
3883
-		if($valid_high && $valid_low)
3883
+		if ($valid_high && $valid_low)
3884 3884
 		{
3885 3885
 			$ip_array['low'] = $ip_parts[0];
3886 3886
 			$ip_array['high'] = $ip_parts[1];
@@ -4062,7 +4062,7 @@  discard block
 block discarded – undo
4062 4062
 		addInlineJavaScript('
4063 4063
 	var user_menus = new smc_PopupMenu();
4064 4064
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4065
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4065
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4066 4066
 		if ($context['allow_pm'])
4067 4067
 			addInlineJavaScript('
4068 4068
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4682,7 +4682,7 @@  discard block
 block discarded – undo
4682 4682
 		// No? try a fallback to $sourcedir
4683 4683
 		else
4684 4684
 		{
4685
-			$absPath = $sourcedir .'/'. $file;
4685
+			$absPath = $sourcedir . '/' . $file;
4686 4686
 
4687 4687
 			if (file_exists($absPath))
4688 4688
 				require_once($absPath);
@@ -4763,15 +4763,15 @@  discard block
 block discarded – undo
4763 4763
 
4764 4764
 	// UTF-8 occurences of MS special characters
4765 4765
 	$findchars_utf8 = array(
4766
-		"\xe2\x80\x9a",	// single low-9 quotation mark
4767
-		"\xe2\x80\x9e",	// double low-9 quotation mark
4768
-		"\xe2\x80\xa6",	// horizontal ellipsis
4769
-		"\xe2\x80\x98",	// left single curly quote
4770
-		"\xe2\x80\x99",	// right single curly quote
4771
-		"\xe2\x80\x9c",	// left double curly quote
4772
-		"\xe2\x80\x9d",	// right double curly quote
4773
-		"\xe2\x80\x93",	// en dash
4774
-		"\xe2\x80\x94",	// em dash
4766
+		"\xe2\x80\x9a", // single low-9 quotation mark
4767
+		"\xe2\x80\x9e", // double low-9 quotation mark
4768
+		"\xe2\x80\xa6", // horizontal ellipsis
4769
+		"\xe2\x80\x98", // left single curly quote
4770
+		"\xe2\x80\x99", // right single curly quote
4771
+		"\xe2\x80\x9c", // left double curly quote
4772
+		"\xe2\x80\x9d", // right double curly quote
4773
+		"\xe2\x80\x93", // en dash
4774
+		"\xe2\x80\x94", // em dash
4775 4775
 	);
4776 4776
 
4777 4777
 	// windows 1252 / iso equivalents
@@ -4789,15 +4789,15 @@  discard block
 block discarded – undo
4789 4789
 
4790 4790
 	// safe replacements
4791 4791
 	$replacechars = array(
4792
-		',',	// &sbquo;
4793
-		',,',	// &bdquo;
4794
-		'...',	// &hellip;
4795
-		"'",	// &lsquo;
4796
-		"'",	// &rsquo;
4797
-		'"',	// &ldquo;
4798
-		'"',	// &rdquo;
4799
-		'-',	// &ndash;
4800
-		'--',	// &mdash;
4792
+		',', // &sbquo;
4793
+		',,', // &bdquo;
4794
+		'...', // &hellip;
4795
+		"'", // &lsquo;
4796
+		"'", // &rsquo;
4797
+		'"', // &ldquo;
4798
+		'"', // &rdquo;
4799
+		'-', // &ndash;
4800
+		'--', // &mdash;
4801 4801
 	);
4802 4802
 
4803 4803
 	if ($context['utf8'])
@@ -5216,7 +5216,7 @@  discard block
 block discarded – undo
5216 5216
  */
5217 5217
 function inet_dtop($bin)
5218 5218
 {
5219
-	if(empty($bin))
5219
+	if (empty($bin))
5220 5220
 		return '';
5221 5221
 
5222 5222
 	global $db_type;
@@ -5247,28 +5247,28 @@  discard block
 block discarded – undo
5247 5247
  */
5248 5248
 function _safe_serialize($value)
5249 5249
 {
5250
-	if(is_null($value))
5250
+	if (is_null($value))
5251 5251
 		return 'N;';
5252 5252
 
5253
-	if(is_bool($value))
5254
-		return 'b:'. (int) $value .';';
5253
+	if (is_bool($value))
5254
+		return 'b:' . (int) $value . ';';
5255 5255
 
5256
-	if(is_int($value))
5257
-		return 'i:'. $value .';';
5256
+	if (is_int($value))
5257
+		return 'i:' . $value . ';';
5258 5258
 
5259
-	if(is_float($value))
5260
-		return 'd:'. str_replace(',', '.', $value) .';';
5259
+	if (is_float($value))
5260
+		return 'd:' . str_replace(',', '.', $value) . ';';
5261 5261
 
5262
-	if(is_string($value))
5263
-		return 's:'. strlen($value) .':"'. $value .'";';
5262
+	if (is_string($value))
5263
+		return 's:' . strlen($value) . ':"' . $value . '";';
5264 5264
 
5265
-	if(is_array($value))
5265
+	if (is_array($value))
5266 5266
 	{
5267 5267
 		$out = '';
5268
-		foreach($value as $k => $v)
5268
+		foreach ($value as $k => $v)
5269 5269
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5270 5270
 
5271
-		return 'a:'. count($value) .':{'. $out .'}';
5271
+		return 'a:' . count($value) . ':{' . $out . '}';
5272 5272
 	}
5273 5273
 
5274 5274
 	// safe_serialize cannot serialize resources or objects.
@@ -5310,7 +5310,7 @@  discard block
 block discarded – undo
5310 5310
 function _safe_unserialize($str)
5311 5311
 {
5312 5312
 	// Input  is not a string.
5313
-	if(empty($str) || !is_string($str))
5313
+	if (empty($str) || !is_string($str))
5314 5314
 		return false;
5315 5315
 
5316 5316
 	$stack = array();
@@ -5324,40 +5324,40 @@  discard block
 block discarded – undo
5324 5324
 	 *   3 - in array, expecting value or another array
5325 5325
 	 */
5326 5326
 	$state = 0;
5327
-	while($state != 1)
5327
+	while ($state != 1)
5328 5328
 	{
5329 5329
 		$type = isset($str[0]) ? $str[0] : '';
5330
-		if($type == '}')
5330
+		if ($type == '}')
5331 5331
 			$str = substr($str, 1);
5332 5332
 
5333
-		else if($type == 'N' && $str[1] == ';')
5333
+		else if ($type == 'N' && $str[1] == ';')
5334 5334
 		{
5335 5335
 			$value = null;
5336 5336
 			$str = substr($str, 2);
5337 5337
 		}
5338
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5338
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5339 5339
 		{
5340 5340
 			$value = $matches[1] == '1' ? true : false;
5341 5341
 			$str = substr($str, 4);
5342 5342
 		}
5343
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5343
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5344 5344
 		{
5345
-			$value = (int)$matches[1];
5345
+			$value = (int) $matches[1];
5346 5346
 			$str = $matches[2];
5347 5347
 		}
5348
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5348
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5349 5349
 		{
5350
-			$value = (float)$matches[1];
5350
+			$value = (float) $matches[1];
5351 5351
 			$str = $matches[3];
5352 5352
 		}
5353
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5353
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5354 5354
 		{
5355
-			$value = substr($matches[2], 0, (int)$matches[1]);
5356
-			$str = substr($matches[2], (int)$matches[1] + 2);
5355
+			$value = substr($matches[2], 0, (int) $matches[1]);
5356
+			$str = substr($matches[2], (int) $matches[1] + 2);
5357 5357
 		}
5358
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5358
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5359 5359
 		{
5360
-			$expectedLength = (int)$matches[1];
5360
+			$expectedLength = (int) $matches[1];
5361 5361
 			$str = $matches[2];
5362 5362
 		}
5363 5363
 
@@ -5365,10 +5365,10 @@  discard block
 block discarded – undo
5365 5365
 		else
5366 5366
 			return false;
5367 5367
 
5368
-		switch($state)
5368
+		switch ($state)
5369 5369
 		{
5370 5370
 			case 3: // In array, expecting value or another array.
5371
-				if($type == 'a')
5371
+				if ($type == 'a')
5372 5372
 				{
5373 5373
 					$stack[] = &$list;
5374 5374
 					$list[$key] = array();
@@ -5377,7 +5377,7 @@  discard block
 block discarded – undo
5377 5377
 					$state = 2;
5378 5378
 					break;
5379 5379
 				}
5380
-				if($type != '}')
5380
+				if ($type != '}')
5381 5381
 				{
5382 5382
 					$list[$key] = $value;
5383 5383
 					$state = 2;
@@ -5388,29 +5388,29 @@  discard block
 block discarded – undo
5388 5388
 				return false;
5389 5389
 
5390 5390
 			case 2: // in array, expecting end of array or a key
5391
-				if($type == '}')
5391
+				if ($type == '}')
5392 5392
 				{
5393 5393
 					// Array size is less than expected.
5394
-					if(count($list) < end($expected))
5394
+					if (count($list) < end($expected))
5395 5395
 						return false;
5396 5396
 
5397 5397
 					unset($list);
5398
-					$list = &$stack[count($stack)-1];
5398
+					$list = &$stack[count($stack) - 1];
5399 5399
 					array_pop($stack);
5400 5400
 
5401 5401
 					// Go to terminal state if we're at the end of the root array.
5402 5402
 					array_pop($expected);
5403 5403
 
5404
-					if(count($expected) == 0)
5404
+					if (count($expected) == 0)
5405 5405
 						$state = 1;
5406 5406
 
5407 5407
 					break;
5408 5408
 				}
5409 5409
 
5410
-				if($type == 'i' || $type == 's')
5410
+				if ($type == 'i' || $type == 's')
5411 5411
 				{
5412 5412
 					// Array size exceeds expected length.
5413
-					if(count($list) >= end($expected))
5413
+					if (count($list) >= end($expected))
5414 5414
 						return false;
5415 5415
 
5416 5416
 					$key = $value;
@@ -5423,7 +5423,7 @@  discard block
 block discarded – undo
5423 5423
 
5424 5424
 			// Expecting array or value.
5425 5425
 			case 0:
5426
-				if($type == 'a')
5426
+				if ($type == 'a')
5427 5427
 				{
5428 5428
 					$data = array();
5429 5429
 					$list = &$data;
@@ -5432,7 +5432,7 @@  discard block
 block discarded – undo
5432 5432
 					break;
5433 5433
 				}
5434 5434
 
5435
-				if($type != '}')
5435
+				if ($type != '}')
5436 5436
 				{
5437 5437
 					$data = $value;
5438 5438
 					$state = 1;
@@ -5445,7 +5445,7 @@  discard block
 block discarded – undo
5445 5445
 	}
5446 5446
 
5447 5447
 	// Trailing data in input.
5448
-	if(!empty($str))
5448
+	if (!empty($str))
5449 5449
 		return false;
5450 5450
 
5451 5451
 	return $data;
@@ -5499,7 +5499,7 @@  discard block
 block discarded – undo
5499 5499
 	// Set different modes.
5500 5500
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5501 5501
 
5502
-	foreach($chmodValues as $val)
5502
+	foreach ($chmodValues as $val)
5503 5503
 	{
5504 5504
 		// If it's writable, break out of the loop.
5505 5505
 		if (is_writable($file))
@@ -5534,13 +5534,13 @@  discard block
 block discarded – undo
5534 5534
 	$returnArray = @json_decode($json, $returnAsArray);
5535 5535
 
5536 5536
 	// PHP 5.3 so no json_last_error_msg()
5537
-	switch(json_last_error())
5537
+	switch (json_last_error())
5538 5538
 	{
5539 5539
 		case JSON_ERROR_NONE:
5540 5540
 			$jsonError = false;
5541 5541
 			break;
5542 5542
 		case JSON_ERROR_DEPTH:
5543
-			$jsonError =  'JSON_ERROR_DEPTH';
5543
+			$jsonError = 'JSON_ERROR_DEPTH';
5544 5544
 			break;
5545 5545
 		case JSON_ERROR_STATE_MISMATCH:
5546 5546
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5568,10 +5568,10 @@  discard block
 block discarded – undo
5568 5568
 		loadLanguage('Errors');
5569 5569
 
5570 5570
 		if (!empty($jsonDebug))
5571
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5571
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5572 5572
 
5573 5573
 		else
5574
-			log_error($txt['json_'. $jsonError], 'critical');
5574
+			log_error($txt['json_' . $jsonError], 'critical');
5575 5575
 
5576 5576
 		// Everyone expects an array.
5577 5577
 		return array();
@@ -5683,7 +5683,7 @@  discard block
 block discarded – undo
5683 5683
 		});
5684 5684
 
5685 5685
 		// Convert Punycode to Unicode
5686
-		$tlds = array_map(function ($input) {
5686
+		$tlds = array_map(function($input) {
5687 5687
 			$prefix = 'xn--';
5688 5688
 			$safe_char = 0xFFFC;
5689 5689
 			$base = 36;
@@ -5699,7 +5699,7 @@  discard block
 block discarded – undo
5699 5699
 
5700 5700
 			foreach ($enco_parts as $encoded)
5701 5701
 			{
5702
-				if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0)
5702
+				if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0)
5703 5703
 				{
5704 5704
 					$output_parts[] = $encoded;
5705 5705
 					continue;
@@ -5710,7 +5710,7 @@  discard block
 block discarded – undo
5710 5710
 				$idx = 0;
5711 5711
 				$char = 0x80;
5712 5712
 				$decoded = array();
5713
-				$output='';
5713
+				$output = '';
5714 5714
 				$delim_pos = strrpos($encoded, '-');
5715 5715
 
5716 5716
 				if ($delim_pos > strlen($prefix))
@@ -5726,7 +5726,7 @@  discard block
 block discarded – undo
5726 5726
 
5727 5727
 				for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len)
5728 5728
 				{
5729
-					for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base)
5729
+					for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base)
5730 5730
 					{
5731 5731
 						$cp = ord($encoded{$enco_idx++});
5732 5732
 						$digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
@@ -5767,15 +5767,15 @@  discard block
 block discarded – undo
5767 5767
 
5768 5768
 					// 2 bytes
5769 5769
 					elseif ($v < (1 << 11))
5770
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
5770
+						$output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
5771 5771
 
5772 5772
 					// 3 bytes
5773 5773
 					elseif ($v < (1 << 16))
5774
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5774
+						$output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5775 5775
 
5776 5776
 					// 4 bytes
5777 5777
 					elseif ($v < (1 << 21))
5778
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5778
+						$output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5779 5779
 
5780 5780
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5781 5781
 					else
@@ -5880,7 +5880,7 @@  discard block
 block discarded – undo
5880 5880
 	}
5881 5881
 
5882 5882
 	// This recursive function creates the index array from the strings
5883
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5883
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5884 5884
 	{
5885 5885
 		static $depth = 0;
5886 5886
 		$depth++;
@@ -5907,7 +5907,7 @@  discard block
 block discarded – undo
5907 5907
 	};
5908 5908
 
5909 5909
 	// This recursive function turns the index array into a regular expression
5910
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
5910
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
5911 5911
 	{
5912 5912
 		static $depth = 0;
5913 5913
 		$depth++;
@@ -5931,11 +5931,11 @@  discard block
 block discarded – undo
5931 5931
 
5932 5932
 				if (count(array_keys($value)) == 1)
5933 5933
 				{
5934
-					$new_key_array = explode('(?'.'>', $sub_regex);
5934
+					$new_key_array = explode('(?' . '>', $sub_regex);
5935 5935
 					$new_key .= $new_key_array[0];
5936 5936
 				}
5937 5937
 				else
5938
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
5938
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
5939 5939
 			}
5940 5940
 
5941 5941
 			if ($depth > 1)
@@ -5978,10 +5978,10 @@  discard block
 block discarded – undo
5978 5978
 	{
5979 5979
 		$regex = array();
5980 5980
 		while (!empty($index))
5981
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5981
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5982 5982
 	}
5983 5983
 	else
5984
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5984
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5985 5985
 
5986 5986
 	// Restore PHP's internal character encoding to whatever it was originally
5987 5987
 	if (!empty($current_encoding))
@@ -6001,7 +6001,7 @@  discard block
 block discarded – undo
6001 6001
 	$url = str_ireplace('http://', 'https://', $url) . '/';
6002 6002
 
6003 6003
 	$result = false;
6004
-	$stream = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
6004
+	$stream = stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
6005 6005
 	$read = @fopen($url, "rb", false, $stream);
6006 6006
 	if ($read !== false) {
6007 6007
 		$cont = stream_context_get_params($read);
Please login to merge, or discard this patch.
Sources/SearchAPI-Fulltext.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$query_where = array();
167 167
 		$query_params = $search_data['params'];
168 168
 
169
-		if( $smcFunc['db_title'] == "PostgreSQL")
169
+		if ($smcFunc['db_title'] == "PostgreSQL")
170 170
 			$modSettings['search_simple_fulltext'] = true;
171 171
 
172 172
 		if ($query_params['id_search'])
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 		if (!empty($modSettings['search_simple_fulltext']))
211 211
 		{
212
-			if($smcFunc['db_title'] == "PostgreSQL")
212
+			if ($smcFunc['db_title'] == "PostgreSQL")
213 213
 			{
214 214
 				$language_ftx = $smcFunc['db_search_language']();
215 215
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			// remove any indexed words that are used in the complex body search terms
228 228
 			$words['indexed_words'] = array_diff($words['indexed_words'], $words['complex_words']);
229 229
 
230
-			if($smcFunc['db_title'] == "PostgreSQL"){
230
+			if ($smcFunc['db_title'] == "PostgreSQL") {
231 231
 				$row = 0;
232 232
 				foreach ($words['indexed_words'] as $fulltextWord) {
233 233
 					$query_params['boolean_match'] .= ($row <> 0 ? '&' : '');
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 			// if we have bool terms to search, add them in
245 245
 			if ($query_params['boolean_match']) {
246
-				if($smcFunc['db_title'] == "PostgreSQL")
246
+				if ($smcFunc['db_title'] == "PostgreSQL")
247 247
 				{
248 248
 					$language_ftx = $smcFunc['db_search_language']();
249 249
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 		}
258 258
 
259
-		$ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( '
259
+		$ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ('
260 260
 			INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . '
261 261
 				(' . implode(', ', array_keys($query_select)) . ')') : '') . '
262 262
 			SELECT ' . implode(', ', $query_select) . '
Please login to merge, or discard this patch.