Completed
Push — release-2.1 ( 093156...093156 )
by Michael
24s queued 18s
created
Sources/CacheAPI-postgres.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	{
166 166
 		global $db_connection, $db_prefix;
167 167
 		
168
-		pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time() );
168
+		pg_query($db_connection, 'CREATE LOCAL TEMP TABLE IF NOT EXISTS ' . $db_prefix . 'cache_tmp AS SELECT * FROM ' . $db_prefix . 'cache WHERE ttl >= ' . time());
169 169
 	}
170 170
 	
171 171
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		global $db_connection, $db_prefix;
191 191
 		
192
-		pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM '. $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING');
192
+		pg_query($db_connection, 'INSERT INTO ' . $db_prefix . 'cache SELECT * FROM ' . $db_prefix . 'cache_tmp ON CONFLICT DO NOTHING');
193 193
 	}
194 194
 }
195 195
 
Please login to merge, or discard this patch.
Sources/Subs-Db-postgresql.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -199,22 +199,22 @@  discard block
 block discarded – undo
199 199
 
200 200
 		case 'date':
201 201
 			if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1)
202
-				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]).'::date';
202
+				return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date';
203 203
 			else
204 204
 				smf_db_error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
205 205
 		break;
206 206
 
207 207
 		case 'time':
208 208
 			if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1)
209
-				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]).'::time';
209
+				return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time';
210 210
 			else
211 211
 				smf_db_error_backtrace('Wrong value type sent to the database. Time expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
212 212
 		break;
213 213
 
214 214
 		case 'datetime':
215 215
 			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)
216
-				return 'to_timestamp('.
217
-					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]).
216
+				return 'to_timestamp(' .
217
+					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]) .
218 218
 					',\'YYYY-MM-DD HH24:MI:SS\')';
219 219
 			else
220 220
 				smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		$old_pos = 0;
425 425
 		$pos = -1;
426 426
 		// Remove the string escape for better runtime
427
-		$db_string_1 = str_replace('\'\'','',$db_string);
427
+		$db_string_1 = str_replace('\'\'', '', $db_string);
428 428
 		while (true)
429 429
 		{
430 430
 			$pos = strpos($db_string_1, '\'', $pos + 1);
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	if (!empty($keys) && (count($keys) > 0) && $returnmode > 0)
803 803
 	{
804 804
 		// we only take the first key
805
-		$returning = ' RETURNING '.$keys[0];
805
+		$returning = ' RETURNING ' . $keys[0];
806 806
 		$with_returning = true;
807 807
 	}
808 808
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 			INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
834 834
 			VALUES
835 835
 				' . implode(',
836
-				', $insertRows).$replace.$returning,
836
+				', $insertRows) . $replace . $returning,
837 837
 			array(
838 838
 				'security_override' => true,
839 839
 				'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 			if ($returnmode === 2)
847 847
 				$return_var = array();
848 848
 
849
-			while(($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
849
+			while (($row = $smcFunc['db_fetch_row']($request)) && $with_returning)
850 850
 			{
851 851
 				if (is_numeric($row[0])) // try to emulate mysql limitation
852 852
 				{
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
  */
1010 1010
 function smf_db_custom_order($field, $array_values, $desc = false)
1011 1011
 {
1012
-	$return = 'CASE '. $field . ' ';
1012
+	$return = 'CASE ' . $field . ' ';
1013 1013
 	$count = count($array_values);
1014 1014
 	$then = ($desc ? ' THEN -' : ' THEN ');
1015 1015
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -722,12 +722,12 @@
 block discarded – undo
722 722
 		$where = '';
723 723
 		$count_pk = 0;
724 724
 
725
-		If ($replace_support)
725
+		if ($replace_support)
726 726
 		{
727 727
 			foreach ($columns as $columnName => $type)
728 728
 			{
729 729
 				//check pk fiel
730
-				IF (in_array($columnName, $keys))
730
+				if (in_array($columnName, $keys))
731 731
 				{
732 732
 					$key_str .= ($count_pk > 0 ? ',' : '');
733 733
 					$key_str .= $columnName;
Please login to merge, or discard this patch.
other/install.php 2 patches
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1697,8 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 	updateStats('topic');
1698 1698
 
1699 1699
 	// This function is needed to do the updateStats('subject') call.
1700
-	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1701
-		function($string){
1700
+	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1702 1701
 			global $sourcedir;
1703 1702
 			if (function_exists('mb_strtolower'))
1704 1703
 				return mb_strtolower($string, 'UTF-8');
@@ -1767,7 +1766,7 @@  discard block
 block discarded – undo
1767 1766
 		if (trim($settingsArray[$i]) == 'if (file_exists(dirname(__FILE__) . \'/install.php\'))' && trim($settingsArray[$i + 1]) == '{' && trim($settingsArray[$i + 9]) == '}')
1768 1767
 		{
1769 1768
 			// Set the ten lines to nothing.
1770
-			for ($j=0; $j < 10; $j++)
1769
+			for ($j = 0; $j < 10; $j++)
1771 1770
 				$settingsArray[$i++] = '';
1772 1771
 
1773 1772
 			continue;
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
 		'default_password' => 'mysql.default_password',
37 37
 		'default_host' => 'mysql.default_host',
38 38
 		'default_port' => 'mysql.default_port',
39
-		'utf8_support' => function() {
39
+		'utf8_support' => function()
40
+		{
40 41
 			return true;
41 42
 		},
42 43
 		'utf8_version' => '5.0.22',
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
 		'utf8_default' => true,
45 46
 		'utf8_required' => true,
46 47
 		'alter_support' => true,
47
-		'validate_prefix' => function(&$value) {
48
+		'validate_prefix' => function(&$value)
49
+		{
48 50
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
49 51
 			return true;
50 52
 		},
@@ -58,7 +60,8 @@  discard block
 block discarded – undo
58 60
 		'always_has_db' => true,
59 61
 		'utf8_default' => true,
60 62
 		'utf8_required' => true,
61
-		'utf8_support' => function() {
63
+		'utf8_support' => function()
64
+		{
62 65
 			$request = pg_query('SHOW SERVER_ENCODING');
63 66
 
64 67
 			list ($charcode) = pg_fetch_row($request);
@@ -70,7 +73,8 @@  discard block
 block discarded – undo
70 73
 		},
71 74
 		'utf8_version' => '8.0',
72 75
 		'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;',
73
-		'validate_prefix' => function(&$value) {
76
+		'validate_prefix' => function(&$value)
77
+		{
74 78
 			global $txt;
75 79
 
76 80
 			$value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value);
@@ -963,13 +967,15 @@  discard block
 block discarded – undo
963 967
 
964 968
 	// If redirect in effect, force ssl ON
965 969
 	require_once(dirname(__FILE__) . '/Sources/Subs.php');
966
-	if (https_redirect_active($incontext['detected_url'])) {
970
+	if (https_redirect_active($incontext['detected_url']))
971
+	{
967 972
 		$incontext['ssl_chkbx_protected'] = true;
968 973
 		$incontext['ssl_chkbx_checked'] = true;
969 974
 		$_POST['force_ssl'] = true;
970 975
 	}
971 976
 	// If no cert, make sure ssl stays OFF
972
-	if (!ssl_cert_found($incontext['detected_url'])) {
977
+	if (!ssl_cert_found($incontext['detected_url']))
978
+	{
973 979
 		$incontext['ssl_chkbx_protected'] = true;
974 980
 		$incontext['ssl_chkbx_checked'] = false;
975 981
 	}
@@ -1438,7 +1444,8 @@  discard block
 block discarded – undo
1438 1444
 	reloadSettings();
1439 1445
 
1440 1446
 	// We need this to properly hash the password for Admin
1441
-	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1447
+	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string)
1448
+	{
1442 1449
 			global $sourcedir;
1443 1450
 			if (function_exists('mb_strtolower'))
1444 1451
 				return mb_strtolower($string, 'UTF-8');
@@ -1696,7 +1703,8 @@  discard block
 block discarded – undo
1696 1703
 
1697 1704
 	// This function is needed to do the updateStats('subject') call.
1698 1705
 	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1699
-		function($string){
1706
+		function($string)
1707
+		{
1700 1708
 			global $sourcedir;
1701 1709
 			if (function_exists('mb_strtolower'))
1702 1710
 				return mb_strtolower($string, 'UTF-8');
Please login to merge, or discard this patch.
Themes/default/GenericControls.template.php 1 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.
Sources/DbPackages-mysql.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 		{
127 127
 			$smcFunc['db_transaction']('begin');
128 128
 			$db_trans = true;
129
-			$smcFunc['db_drop_table']($table_name.'_old');
130
-			$smcFunc['db_query']('','
131
-				RENAME TABLE '. $table_name .' TO ' . $table_name . '_old',
129
+			$smcFunc['db_drop_table']($table_name . '_old');
130
+			$smcFunc['db_query']('', '
131
+				RENAME TABLE '. $table_name . ' TO ' . $table_name . '_old',
132 132
 				array(
133 133
 					'security_override' => true,
134 134
 				)
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
 	{
203 203
 		$same_col = array();
204 204
 
205
-		$request = $smcFunc['db_query']('','
205
+		$request = $smcFunc['db_query']('', '
206 206
 			SELECT count(*), column_name
207 207
 			FROM information_schema.columns
208 208
 			WHERE table_name in ({string:table1},{string:table2}) AND table_schema = {string:schema}
209 209
 			GROUP BY column_name
210 210
 			HAVING count(*) > 1',
211
-			array (
211
+			array(
212 212
 				'table1' => $table_name,
213
-				'table2' => $table_name.'_old',
213
+				'table2' => $table_name . '_old',
214 214
 				'schema' => $db_name,
215 215
 			)
216 216
 		);
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 			$same_col[] = $row['column_name'];
221 221
 		}
222 222
 
223
-		$smcFunc['db_query']('','
224
-			INSERT INTO ' . $table_name .'('
223
+		$smcFunc['db_query']('', '
224
+			INSERT INTO ' . $table_name . '('
225 225
 			. implode($same_col, ',') .
226 226
 			')
227 227
 			SELECT '. implode($same_col, ',') . '
Please login to merge, or discard this patch.
SSI.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
  *
105 105
  * @param string $class The fully-qualified class name.
106 106
  */
107
-spl_autoload_register(function ($class) use ($sourcedir)
107
+spl_autoload_register(function($class) use ($sourcedir)
108 108
 {
109 109
 	$classMap = array(
110 110
 		'ReCaptcha\\' => 'ReCaptcha/',
Please login to merge, or discard this patch.
Sources/Subs-Auth.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -430,8 +430,8 @@
 block discarded – undo
430 430
 	$real_name = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name';
431 431
 
432 432
 	// Searches.
433
-	$member_name_search = $member_name . ' ' . $comparison . ' ' . implode( ' OR ' . $member_name . ' ' . $comparison . ' ', $names_list);
434
-	$real_name_search = $real_name . ' ' . $comparison . ' ' . implode( ' OR ' . $real_name . ' ' . $comparison . ' ', $names_list);
433
+	$member_name_search = $member_name . ' ' . $comparison . ' ' . implode(' OR ' . $member_name . ' ' . $comparison . ' ', $names_list);
434
+	$real_name_search = $real_name . ' ' . $comparison . ' ' . implode(' OR ' . $real_name . ' ' . $comparison . ' ', $names_list);
435 435
 
436 436
 	// Search by username, display name, and email address.
437 437
 	$request = $smcFunc['db_query']('', '
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
@@ -899,13 +899,13 @@
 block discarded – undo
899 899
 		if ($start_char === 'C')
900 900
 			$limit_seek = $limit;
901 901
 		else
902
-			$limit_seek  = $limit + 1;
902
+			$limit_seek = $limit + 1;
903 903
 
904 904
 		$request = $smcFunc['db_query']('', '
905 905
 			SELECT id_msg, id_member, approved
906 906
 			FROM {db_prefix}messages
907 907
 			WHERE id_topic = {int:current_topic}
908
-			AND id_msg '. $page_operator . ' {int:page_id}'. (!$modSettings['postmod_active'] || $approve_posts ? '' : '
908
+			AND id_msg '. $page_operator . ' {int:page_id}' . (!$modSettings['postmod_active'] || $approve_posts ? '' : '
909 909
 			AND (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . '
910 910
 			ORDER BY id_msg ' . ($ascending_seek ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
911 911
 			LIMIT {int:limit}'),
Please login to merge, or discard this patch.
Sources/Logging.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array The truncated array
25 25
  */
26
-function truncateArray($arr, $max_length=1900)
26
+function truncateArray($arr, $max_length = 1900)
27 27
 {
28 28
 	$curr_length = 0;
29 29
 	foreach ($arr as $key => $value)
30 30
 		if (is_array($value))
31 31
 			foreach ($value as $key2 => $value2)
32
-				$curr_length += strlen ($value2);
32
+				$curr_length += strlen($value2);
33 33
 		else
34
-			$curr_length += strlen ($value);
34
+			$curr_length += strlen($value);
35 35
 	if ($curr_length <= $max_length)
36 36
 		return $arr;
37 37
 	else
38 38
 	{
39 39
 		// Truncate each element's value to a reasonable length
40
-		$param_max = floor($max_length/count($arr));
40
+		$param_max = floor($max_length / count($arr));
41 41
 		foreach ($arr as $key => &$value)
42 42
 			if (is_array($value))
43 43
 				foreach ($value as $key2 => &$value2)
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	if (filemtime($cachedir . '/db_last_error.php') === $last_db_error_change)
208 208
 	{
209 209
 		// Write the change
210
-		$write_db_change =  '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>';
210
+		$write_db_change = '<' . '?' . "php\n" . '$db_last_error = ' . time() . ';' . "\n" . '?' . '>';
211 211
 		$written_bytes = file_put_contents($cachedir . '/db_last_error.php', $write_db_change, LOCK_EX);
212 212
 
213 213
 		// survey says ...
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br>
281 281
 	', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br>
282 282
 	', $txt['debug_hooks'], empty($context['debug']['hooks']) ? 0 : count($context['debug']['hooks']) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_hooks\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_hooks" style="display: none;"><em>' . implode('</em>, <em>', $context['debug']['hooks']), '</em></span>)', '<br>
283
-	',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">'. $txt['debug_show'] .'</a><span id="debug_instances" style="display: none;"><em>'. implode('</em>, <em>', array_keys($context['debug']['instances'])) .'</em></span>)'. '<br>') : ''),'
283
+	',(isset($context['debug']['instances']) ? ($txt['debug_instances'] . (empty($context['debug']['instances']) ? 0 : count($context['debug']['instances'])) . ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_instances\').style.display = \'inline\'; this.style.display = \'none\'; return false;">' . $txt['debug_show'] . '</a><span id="debug_instances" style="display: none;"><em>' . implode('</em>, <em>', array_keys($context['debug']['instances'])) . '</em></span>)' . '<br>') : ''), '
284 284
 	', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br>';
285 285
 
286 286
 	if (function_exists('memory_get_peak_usage'))
Please login to merge, or discard this patch.