Completed
Push — release-2.1 ( 4c82a0...64d581 )
by Rick
09:29
created
Sources/Subs-Db-mysql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 						$replacement[$key] = 'null';
253 253
 					if (!isValidIP($value))
254 254
 						smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
255
-					$replacement[$key] =  sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($value)));
255
+					$replacement[$key] = sprintf('unhex(\'%1$s\')', bin2hex(inet_pton($value)));
256 256
 				}
257 257
 
258 258
 				return implode(', ', $replacement);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
  * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
812 812
  * @return string The escaped string
813 813
  */
814
-function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
814
+function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false)
815 815
 {
816 816
 	$replacements = array(
817 817
 		'%' => '\%',
Please login to merge, or discard this patch.
Sources/Subs-Post.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	$message = preg_replace('~&#(\d{4,5}|[2-9]\d{2,4}|1[2-9]\d);~', '&#$1;', $message);
35 35
 
36 36
 	// Clean up after nobbc ;).
37
-	$message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', function ($a)
37
+	$message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', function($a)
38 38
 	{
39 39
 		return '[nobbc]' . strtr($a[1], array('[' => '[', ']' => ']', ':' => ':', '@' => '@')) . '[/nobbc]';
40 40
 	}, $message);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	if (!$previewing && strpos($message, '[html]') !== false)
123 123
 	{
124 124
 		if (allowedTo('admin_forum'))
125
-			$message = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function ($m) {
125
+			$message = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function($m) {
126 126
 				return '[html]' . strtr(un_htmlspecialchars($m), array("\n" => '
', '  ' => '  ', '[' => '[', ']' => ']')) . '[/html]';
127 127
 			}, $message);
128 128
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 	}
136 136
 
137 137
 	// Let's look at the time tags...
138
-	$message = preg_replace_callback('~\[time(?:=(absolute))*\](.+?)\[/time\]~i', function ($m) use ($modSettings, $user_info)
138
+	$message = preg_replace_callback('~\[time(?:=(absolute))*\](.+?)\[/time\]~i', function($m) use ($modSettings, $user_info)
139 139
 	{
140 140
 		return "[time]" . (is_numeric("$m[2]") || @strtotime("$m[2]") == 0 ? "$m[2]" : strtotime("$m[2]") - ("$m[1]" == "absolute" ? 0 : (($modSettings["time_offset"] + $user_info["time_offset"]) * 3600))) . "[/time]";
141 141
 	}, $message);
142 142
 
143 143
 	// Change the color specific tags to [color=the color].
144
-	$message = preg_replace('~\[(black|blue|green|red|white)\]~', '[color=$1]', $message);  // First do the opening tags.
145
-	$message = preg_replace('~\[/(black|blue|green|red|white)\]~', '[/color]', $message);   // And now do the closing tags
144
+	$message = preg_replace('~\[(black|blue|green|red|white)\]~', '[color=$1]', $message); // First do the opening tags.
145
+	$message = preg_replace('~\[/(black|blue|green|red|white)\]~', '[/color]', $message); // And now do the closing tags
146 146
 
147 147
 	// Make sure all tags are lowercase.
148
-	$message = preg_replace_callback('~\[([/]?)(list|li|table|tr|td)((\s[^\]]+)*)\]~i', function ($m)
148
+	$message = preg_replace_callback('~\[([/]?)(list|li|table|tr|td)((\s[^\]]+)*)\]~i', function($m)
149 149
 	{
150 150
 		return "[$m[1]" . strtolower("$m[2]") . "$m[3]]";
151 151
 	}, $message);
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 
253 253
 	$message = implode('', $parts);
254 254
 
255
-	$message = preg_replace_callback('~\[html\](.+?)\[/html\]~i', function ($m) use ($smcFunc)
255
+	$message = preg_replace_callback('~\[html\](.+?)\[/html\]~i', function($m) use ($smcFunc)
256 256
 	{
257 257
 		return "[html]" . strtr($smcFunc['htmlspecialchars']("$m[1]", ENT_QUOTES), array("\\&quot;" => "&quot;", "&amp;#13;" => "<br>", "&amp;#32;" => " ", "&amp;#91;" => "[", "&amp;#93;" => "]")) . "[/html]";
258 258
 	}, $message);
259 259
 
260 260
 	// Attempt to un-parse the time to something less awful.
261
-	$message = preg_replace_callback('~\[time\](\d{0,10})\[/time\]~i', function ($m)
261
+	$message = preg_replace_callback('~\[time\](\d{0,10})\[/time\]~i', function($m)
262 262
 	{
263 263
 		return "[time]" . timeformat("$m[1]", false) . "[/time]";
264 264
 	}, $message);
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		fixTag($message, $param['tag'], $param['protocols'], $param['embeddedUrl'], $param['hasEqualSign'], !empty($param['hasExtra']));
350 350
 
351 351
 	// Now fix possible security problems with images loading links automatically...
352
-	$message = preg_replace_callback('~(\[img.*?\])(.+?)\[/img\]~is', function ($m)
352
+	$message = preg_replace_callback('~(\[img.*?\])(.+?)\[/img\]~is', function($m)
353 353
 	{
354 354
 		return "$m[1]" . preg_replace("~action(=|%3d)(?!dlattach)~i", "action-", "$m[2]") . "[/img]";
355 355
 	}, $message);
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	$to_array = is_array($to) ? $to : array($to);
536 536
 
537 537
 	// Make sure we actually have email addresses to send this to
538
-	foreach($to_array as $k => $v)
538
+	foreach ($to_array as $k => $v)
539 539
 	{
540 540
 		// This should never happen, but better safe than sorry
541 541
 		if (trim($v) == '')
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 		unset($matches);
1212 1212
 
1213 1213
 		if ($simple)
1214
-			$string = preg_replace_callback('~&#(\d{3,8});~', function ($m)
1214
+			$string = preg_replace_callback('~&#(\d{3,8});~', function($m)
1215 1215
 			{
1216 1216
 				return chr("$m[1]");
1217 1217
 			}, $string);
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 				$string = $newstring;
1243 1243
 		}
1244 1244
 
1245
-		$entityConvert = function ($m)
1245
+		$entityConvert = function($m)
1246 1246
 		{
1247 1247
 			$c = $m[1];
1248 1248
 			if (strlen($c) === 1 && ord($c[0]) <= 0x7F)
@@ -1348,14 +1348,14 @@  discard block
 block discarded – undo
1348 1348
 		$helo = gethostname();
1349 1349
 	elseif (function_exists('php_uname'))
1350 1350
 		$helo = php_uname('n');
1351
-	elseif (array_key_exists('SERVER_NAME',$_SERVER) && !empty($_SERVER['SERVER_NAME']))
1351
+	elseif (array_key_exists('SERVER_NAME', $_SERVER) && !empty($_SERVER['SERVER_NAME']))
1352 1352
 		$helo = $_SERVER['SERVER_NAME'];
1353 1353
 
1354 1354
 	if (empty($helo))
1355 1355
 		$helo = $modSettings['smtp_host'];
1356 1356
 
1357 1357
 	// SMTP = 1, SMTP - STARTTLS = 2
1358
-	if (in_array($modSettings['mail_type'], array(1,2)) && $modSettings['smtp_username'] != '' && $modSettings['smtp_password'] != '')
1358
+	if (in_array($modSettings['mail_type'], array(1, 2)) && $modSettings['smtp_username'] != '' && $modSettings['smtp_password'] != '')
1359 1359
 	{
1360 1360
 		// EHLO could be understood to mean encrypted hello...
1361 1361
 		if (server_parse('EHLO ' . $helo, $socket, null, $response) == '250')
@@ -2119,7 +2119,7 @@  discard block
 block discarded – undo
2119 2119
 			preg_match_all('/\[member\=([0-9]+)\]([^\[]*)\[\/member\]/U', $msgOptions['old_body'], $match);
2120 2120
 
2121 2121
 			if (isset($match[1]) && isset($match[2]) && is_array($match[1]) && is_array($match[2]))
2122
-				foreach($match[1] as $i => $oldID)
2122
+				foreach ($match[1] as $i => $oldID)
2123 2123
 					$oldmentions[$oldID] = array('id' => $oldID, 'real_name' => $match[2][$i]);
2124 2124
 
2125 2125
 			if (empty($modSettings['search_custom_index_config']))
@@ -2130,10 +2130,10 @@  discard block
 block discarded – undo
2130 2130
 		$messages_columns['body'] = $msgOptions['body'] = Mentions::getBody($msgOptions['body'], $mentions);
2131 2131
 
2132 2132
 		// Remove the poster.
2133
-		if(isset($mentions[$user_info['id']]))
2133
+		if (isset($mentions[$user_info['id']]))
2134 2134
 			unset($mentions[$user_info['id']]);
2135 2135
 
2136
-		if(isset($oldmentions[$user_info['id']]))
2136
+		if (isset($oldmentions[$user_info['id']]))
2137 2137
 			unset($oldmentions[$user_info['id']]);
2138 2138
 
2139 2139
 		if (is_array($mentions) && is_array($oldmentions) && count(array_diff_key($mentions, $oldmentions)) > 0 && count($mentions) > count($oldmentions))
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
 			$suggestions = enchant_dict_suggest($dict, $word);
2949 2949
 
2950 2950
 			// Go through the suggestions and convert them back to the proper character set
2951
-			foreach($suggestions as $index => $suggestion)
2951
+			foreach ($suggestions as $index => $suggestion)
2952 2952
 			{
2953 2953
 				// //TRANSLIT makes it use similar-looking characters for incompatible ones...
2954 2954
 				$suggestions[$index] = iconv('UTF-8', $txt['lang_character_set'] . '//TRANSLIT', $suggestion);
Please login to merge, or discard this patch.
Sources/DbExtra-postgresql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	$table = str_replace('{db_prefix}', $db_prefix, $table);
94 94
 
95
-	$pg_tables = array('pg_catalog','information_schema');
95
+	$pg_tables = array('pg_catalog', 'information_schema');
96 96
 
97 97
 	$request = $smcFunc['db_query']('', '
98 98
 		SELECT pg_relation_size(C.oid) AS "size"
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 {
370 370
 	static $ver;
371 371
 
372
-	if(!empty($ver))
372
+	if (!empty($ver))
373 373
 		return $ver;
374 374
 
375 375
 	global $smcFunc;
Please login to merge, or discard this patch.
Sources/MessageIndex.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	if (!empty($board_info['moderators']))
134 134
 	{
135 135
 		foreach ($board_info['moderators'] as $mod)
136
-			$context['link_moderators'][] ='<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
136
+			$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt['board_moderator'] . '">' . $mod['name'] . '</a>';
137 137
 	}
138 138
 	if (!empty($board_info['moderator_groups']))
139 139
 	{
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 				COALESCE(memf.real_name, mf.poster_name) AS first_display_name, ' . (!empty($modSettings['preview_characters']) ? '
343 343
 				SUBSTRING(ml.body, 1, ' . ($modSettings['preview_characters'] + 256) . ') AS last_body,
344 344
 				SUBSTRING(mf.body, 1, ' . ($modSettings['preview_characters'] + 256) . ') AS first_body,' : '') . 'ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys
345
-				' . (!empty($message_index_selects) ? (', '. implode(', ', $message_index_selects)) : '') . '
345
+				' . (!empty($message_index_selects) ? (', ' . implode(', ', $message_index_selects)) : '') . '
346 346
 			FROM {db_prefix}topics AS t
347 347
 				INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
348 348
 				INNER JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 		$context['normal_buttons']['post_poll'] = array('text' => 'new_poll', 'image' => 'new_poll.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll');
728 728
 	
729 729
 	if (!$context['user']['is_logged'])
730
-		$context['normal_buttons']['markread'] = array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'custom' => 'data-confirm="'. $txt['are_sure_mark_read'] .'"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']);
730
+		$context['normal_buttons']['markread'] = array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']);
731 731
 
732 732
 	if ($context['can_mark_notify'])
733 733
 		$context['normal_buttons']['notify'] = array(
Please login to merge, or discard this patch.
Sources/ManageAttachments.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 	$context['valid_upload_dir'] = is_dir($context['attachmentUploadDir']) && is_writable($context['attachmentUploadDir']);
105 105
 
106 106
 	if (!empty($modSettings['automanage_attachments']))
107
-		$context['valid_basedirectory'] =  !empty($modSettings['basedirectory_for_attachments']) && is_writable($modSettings['basedirectory_for_attachments']);
107
+		$context['valid_basedirectory'] = !empty($modSettings['basedirectory_for_attachments']) && is_writable($modSettings['basedirectory_for_attachments']);
108 108
 
109 109
 	else
110 110
 		$context['valid_basedirectory'] = true;
111 111
 
112 112
 	// A bit of razzle dazzle with the $txt strings. :)
113 113
 	$txt['attachment_path'] = $context['attachmentUploadDir'];
114
-	$txt['basedirectory_for_attachments_path']= isset($modSettings['basedirectory_for_attachments']) ? $modSettings['basedirectory_for_attachments'] : '';
114
+	$txt['basedirectory_for_attachments_path'] = isset($modSettings['basedirectory_for_attachments']) ? $modSettings['basedirectory_for_attachments'] : '';
115 115
 	$txt['use_subdirectories_for_attachments_note'] = empty($modSettings['attachment_basedirectories']) || empty($modSettings['use_subdirectories_for_attachments']) ? $txt['use_subdirectories_for_attachments_note'] : '';
116 116
 	$txt['attachmentUploadDir_multiple_configure'] = '<a href="' . $scripturl . '?action=admin;area=manageattachments;sa=attachpaths">[' . $txt['attachmentUploadDir_multiple_configure'] . ']</a>';
117 117
 	$txt['attach_current_dir'] = empty($modSettings['automanage_attachments']) ? $txt['attach_current_dir'] : $txt['attach_last_dir'];
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			array('select', 'automanage_attachments', array(0 => $txt['attachments_normal'], 1 => $txt['attachments_auto_space'], 2 => $txt['attachments_auto_years'], 3 => $txt['attachments_auto_months'], 4 => $txt['attachments_auto_16'])),
137 137
 			array('check', 'use_subdirectories_for_attachments', 'subtext' => $txt['use_subdirectories_for_attachments_note']),
138 138
 			(empty($modSettings['attachment_basedirectories']) ? array('text', 'basedirectory_for_attachments', 40,) : array('var_message', 'basedirectory_for_attachments', 'message' => 'basedirectory_for_attachments_path', 'invalid' => empty($context['valid_basedirectory']), 'text_label' => (!empty($context['valid_basedirectory']) ? $txt['basedirectory_for_attachments_current'] : $txt['basedirectory_for_attachments_warning']))),
139
-			empty($modSettings['attachment_basedirectories']) && $modSettings['currentAttachmentUploadDir'] == 1 && count($modSettings['attachmentUploadDir']) == 1	? array('json', 'attachmentUploadDir', 'subtext' => $txt['attachmentUploadDir_multiple_configure'], 40, 'invalid' => !$context['valid_upload_dir'], 'disabled' => true) : array('var_message', 'attach_current_directory', 'subtext' => $txt['attachmentUploadDir_multiple_configure'], 'message' => 'attachment_path', 'invalid' => empty($context['valid_upload_dir']), 'text_label' => (!empty($context['valid_upload_dir']) ? $txt['attach_current_dir'] : $txt['attach_current_dir_warning'])),
139
+			empty($modSettings['attachment_basedirectories']) && $modSettings['currentAttachmentUploadDir'] == 1 && count($modSettings['attachmentUploadDir']) == 1 ? array('json', 'attachmentUploadDir', 'subtext' => $txt['attachmentUploadDir_multiple_configure'], 40, 'invalid' => !$context['valid_upload_dir'], 'disabled' => true) : array('var_message', 'attach_current_directory', 'subtext' => $txt['attachmentUploadDir_multiple_configure'], 'message' => 'attachment_path', 'invalid' => empty($context['valid_upload_dir']), 'text_label' => (!empty($context['valid_upload_dir']) ? $txt['attach_current_dir'] : $txt['attach_current_dir_warning'])),
140 140
 			array('int', 'attachmentDirFileLimit', 'subtext' => $txt['zero_for_no_limit'], 6),
141 141
 			array('int', 'attachmentDirSizeLimit', 'subtext' => $txt['zero_for_no_limit'], 6, 'postinput' => $txt['kilobyte']),
142 142
 			array('check', 'dont_show_attach_under_post', 'subtext' => $txt['dont_show_attach_under_post_sub']),
@@ -349,16 +349,16 @@  discard block
 block discarded – undo
349 349
 
350 350
 		// These settings cannot be left empty!
351 351
 		if (empty($_POST['custom_avatar_dir']))
352
-			$_POST['custom_avatar_dir'] = $boarddir .'/custom_avatar';
352
+			$_POST['custom_avatar_dir'] = $boarddir . '/custom_avatar';
353 353
 
354 354
 		if (empty($_POST['custom_avatar_url']))
355
-			$_POST['custom_avatar_url'] = $boardurl .'/custom_avatar';
355
+			$_POST['custom_avatar_url'] = $boardurl . '/custom_avatar';
356 356
 
357 357
 		if (empty($_POST['avatar_directory']))
358
-			$_POST['avatar_directory'] = $boarddir .'/avatars';
358
+			$_POST['avatar_directory'] = $boarddir . '/avatars';
359 359
 
360 360
 		if (empty($_POST['avatar_url']))
361
-			$_POST['avatar_url'] = $boardurl .'/avatars';
361
+			$_POST['avatar_url'] = $boardurl . '/avatars';
362 362
 
363 363
 		call_integration_hook('integrate_save_avatar_settings');
364 364
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		'items_per_page' => $modSettings['defaultMaxListItems'],
423 423
 		'base_href' => $scripturl . '?action=admin;area=manageattachments;sa=browse' . ($context['browse_type'] === 'avatars' ? ';avatars' : ($context['browse_type'] === 'thumbs' ? ';thumbs' : '')),
424 424
 		'default_sort_col' => 'name',
425
-		'no_items_label' => $txt['attachment_manager_' . ($context['browse_type'] === 'avatars' ? 'avatars' : ( $context['browse_type'] === 'thumbs' ? 'thumbs' : 'attachments')) . '_no_entries'],
425
+		'no_items_label' => $txt['attachment_manager_' . ($context['browse_type'] === 'avatars' ? 'avatars' : ($context['browse_type'] === 'thumbs' ? 'thumbs' : 'attachments')) . '_no_entries'],
426 426
 		'get_items' => array(
427 427
 			'function' => 'list_getFiles',
428 428
 			'params' => array(
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 					'value' => $txt['attachment_name'],
442 442
 				),
443 443
 				'data' => array(
444
-					'function' => function ($rowData) use ($modSettings, $context, $scripturl, $smcFunc)
444
+					'function' => function($rowData) use ($modSettings, $context, $scripturl, $smcFunc)
445 445
 					{
446 446
 						$link = '<a href="';
447 447
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 					'value' => $txt['attachment_file_size'],
483 483
 				),
484 484
 				'data' => array(
485
-					'function' => function ($rowData) use ($txt)
485
+					'function' => function($rowData) use ($txt)
486 486
 					{
487 487
 						return sprintf('%1$s%2$s', round($rowData['size'] / 1024, 2), $txt['kilobyte']);
488 488
 					},
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 					'value' => $context['browse_type'] == 'avatars' ? $txt['attachment_manager_member'] : $txt['posted_by'],
498 498
 				),
499 499
 				'data' => array(
500
-					'function' => function ($rowData) use ($scripturl, $smcFunc)
500
+					'function' => function($rowData) use ($scripturl, $smcFunc)
501 501
 					{
502 502
 						// In case of an attachment, return the poster of the attachment.
503 503
 						if (empty($rowData['id_member']))
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 					'value' => $context['browse_type'] == 'avatars' ? $txt['attachment_manager_last_active'] : $txt['date'],
519 519
 				),
520 520
 				'data' => array(
521
-					'function' => function ($rowData) use ($txt, $context, $scripturl)
521
+					'function' => function($rowData) use ($txt, $context, $scripturl)
522 522
 					{
523 523
 						// The date the message containing the attachment was posted or the owner of the avatar was active.
524 524
 						$date = empty($rowData['poster_time']) ? $txt['never'] : timeformat($rowData['poster_time']);
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 					if (!empty($modSettings['currentAttachmentUploadDir']))
1337 1337
 					{
1338 1338
 						// Get the attachment name with out the folder.
1339
-						$attachment_name = $row['id_attach'] . '_' . $row['file_hash'] .'.dat';
1339
+						$attachment_name = $row['id_attach'] . '_' . $row['file_hash'] . '.dat';
1340 1340
 
1341 1341
 						// Loop through the other folders.
1342 1342
 						foreach ($modSettings['attachmentUploadDir'] as $id => $dir)
@@ -1952,7 +1952,7 @@  discard block
 block discarded – undo
1952 1952
 				if (automanage_attachments_create_directory($path))
1953 1953
 					$_POST['current_dir'] = $modSettings['currentAttachmentUploadDir'];
1954 1954
 				else
1955
-					$errors[] =  $path . ': ' . $txt[$context['dir_creation_error']];
1955
+					$errors[] = $path . ': ' . $txt[$context['dir_creation_error']];
1956 1956
 			}
1957 1957
 
1958 1958
 			// Changing a directory name?
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 		}
2075 2075
 
2076 2076
 		// If the user wishes to go back, update the last_dir array
2077
-		if ($_POST['current_dir'] !=  $modSettings['currentAttachmentUploadDir']&& !empty($modSettings['last_attachments_directory']) && (isset($modSettings['last_attachments_directory'][$_POST['current_dir']]) || isset($modSettings['last_attachments_directory'][0])))
2077
+		if ($_POST['current_dir'] != $modSettings['currentAttachmentUploadDir'] && !empty($modSettings['last_attachments_directory']) && (isset($modSettings['last_attachments_directory'][$_POST['current_dir']]) || isset($modSettings['last_attachments_directory'][0])))
2078 2078
 		{
2079 2079
 			if (!is_array($modSettings['last_attachments_directory']))
2080 2080
 				$modSettings['last_attachments_directory'] = smf_json_decode($modSettings['last_attachments_directory'], true);
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 				$use_subdirectories_for_attachments = 0;
2088 2088
 				if (!empty($modSettings['attachment_basedirectories']))
2089 2089
 					foreach ($modSettings['attachment_basedirectories'] as $bid => $base)
2090
-						if (strpos($modSettings['attachmentUploadDir'][$_POST['current_dir']], $base . DIRECTORY_SEPARATOR) !==false)
2090
+						if (strpos($modSettings['attachmentUploadDir'][$_POST['current_dir']], $base . DIRECTORY_SEPARATOR) !== false)
2091 2091
 						{
2092 2092
 							$use_subdirectories_for_attachments = 1;
2093 2093
 							break;
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 					'class' => 'centercol',
2264 2264
 				),
2265 2265
 				'data' => array(
2266
-					'function' => function ($rowData)
2266
+					'function' => function($rowData)
2267 2267
 					{
2268 2268
 						return '<input type="radio" name="current_dir" value="' . $rowData['id'] . '"' . ($rowData['current'] ? ' checked' : '') . (!empty($rowData['disable_current']) ? ' disabled' : '') . ' class="input_radio">';
2269 2269
 					},
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
 					'value' => $txt['attach_path'],
2277 2277
 				),
2278 2278
 				'data' => array(
2279
-					'function' => function ($rowData)
2279
+					'function' => function($rowData)
2280 2280
 					{
2281 2281
 						return '<input type="hidden" name="dirs[' . $rowData['id'] . ']" value="' . $rowData['path'] . '"><input type="text" size="40" name="dirs[' . $rowData['id'] . ']" value="' . $rowData['path'] . '"' . (!empty($rowData['disable_base_dir']) ? ' disabled' : '') . ' class="input_text" style="width: 100%">';
2282 2282
 					},
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 						'class' => 'centercol',
2357 2357
 					),
2358 2358
 					'data' => array(
2359
-						'function' => function ($rowData)
2359
+						'function' => function($rowData)
2360 2360
 						{
2361 2361
 							return '<input type="radio" name="current_base_dir" value="' . $rowData['id'] . '"' . ($rowData['current'] ? ' checked' : '') . ' class="input_radio">';
2362 2362
 						},
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
 					$dir_size += !empty($row['size']) ? $row['size'] : filesize($source);
2728 2728
 
2729 2729
 					// If we've reached a limit. Do something.
2730
-					if (!empty($modSettings['attachmentDirSizeLimit']) && $dir_size > $modSettings['attachmentDirSizeLimit'] * 1024 || (!empty($modSettings['attachmentDirFileLimit']) && $dir_files >  $modSettings['attachmentDirFileLimit']))
2730
+					if (!empty($modSettings['attachmentDirSizeLimit']) && $dir_size > $modSettings['attachmentDirSizeLimit'] * 1024 || (!empty($modSettings['attachmentDirFileLimit']) && $dir_files > $modSettings['attachmentDirFileLimit']))
2731 2731
 					{
2732 2732
 						if (!empty($_POST['auto']))
2733 2733
 						{
Please login to merge, or discard this patch.
Sources/Subs-Members.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		'member_name' => $regOptions['username'],
587 587
 		'email_address' => $regOptions['email'],
588 588
 		'passwd' => hash_password($regOptions['username'], $regOptions['password']),
589
-		'password_salt' => substr(md5(mt_rand()), 0, 4) ,
589
+		'password_salt' => substr(md5(mt_rand()), 0, 4),
590 590
 		'posts' => 0,
591 591
 		'date_registered' => time(),
592 592
 		'member_ip' => $regOptions['interface'] == 'admin' ? '127.0.0.1' : $user_info['ip'],
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 		'time_offset',
677 677
 	);
678 678
 	$knownInets = array(
679
-		'member_ip','member_ip2',
679
+		'member_ip', 'member_ip2',
680 680
 	);
681 681
 
682 682
 	// Call an optional function to validate the users' input.
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	$checkName = strtr($name, array('_' => '\\_', '%' => '\\%'));
905 905
 
906 906
 	//when we got no wildcard we can use equal -> fast
907
-	$operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '=' );
907
+	$operator = (strpos($checkName, '%') || strpos($checkName, '_') ? 'LIKE' : '=');
908 908
 
909 909
 	// Make sure they don't want someone else's name.
910 910
 	$request = $smcFunc['db_query']('', '
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 		$user_info['buddies'][] = $userReceiver;
1274 1274
 
1275 1275
 		// And add a nice alert. Don't abuse though!
1276
-		if ((cache_get_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, 86400)) == null)
1276
+		if ((cache_get_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, 86400)) == null)
1277 1277
 		{
1278 1278
 			$smcFunc['db_insert']('insert',
1279 1279
 				'{db_prefix}background_tasks',
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 			);
1289 1289
 
1290 1290
 			// Store this in a cache entry to avoid creating multiple alerts. Give it a long life cycle.
1291
-			cache_put_data('Buddy-sent-'. $user_info['id'] .'-'. $userReceiver, '1', 86400);
1291
+			cache_put_data('Buddy-sent-' . $user_info['id'] . '-' . $userReceiver, '1', 86400);
1292 1292
 		}
1293 1293
 	}
1294 1294
 
Please login to merge, or discard this patch.
Sources/LogInOut.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,19 +99,19 @@
 block discarded – undo
99 99
 	{
100 100
 		if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;i:\d{1,7};i:1;s:(0|128):"([a-fA-F0-9]{128})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~', $_COOKIE[$cookiename]) === 1)
101 101
 		{
102
-			list (, , $timeout) = smf_json_decode($_COOKIE[$cookiename], true);
102
+			list (,, $timeout) = smf_json_decode($_COOKIE[$cookiename], true);
103 103
 
104 104
 			// That didn't work... Maybe it's using serialize?
105 105
 			if (is_null($timeout))
106
-				list (, , $timeout) = safe_unserialize($_COOKIE[$cookiename]);
106
+				list (,, $timeout) = safe_unserialize($_COOKIE[$cookiename]);
107 107
 		}
108 108
 		elseif (isset($_SESSION['login_' . $cookiename]))
109 109
 		{
110
-			list (, , $timeout) = smf_json_decode($_SESSION['login_' . $cookiename]);
110
+			list (,, $timeout) = smf_json_decode($_SESSION['login_' . $cookiename]);
111 111
 
112 112
 			// Try for old format
113 113
 			if (is_null($timeout))
114
-				list (, , $timeout) = safe_unserialize($_SESSION['login_' . $cookiename]);
114
+				list (,, $timeout) = safe_unserialize($_SESSION['login_' . $cookiename]);
115 115
 		}
116 116
 		else
117 117
 			trigger_error('Login2(): Cannot be logged in without a session or cookie', E_USER_ERROR);
Please login to merge, or discard this patch.
Sources/ManageSearch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				)
232 232
 			);
233 233
 
234
-			$request = $smcFunc['db_query']('','
234
+			$request = $smcFunc['db_query']('', '
235 235
 				SHOW default_text_search_config',
236 236
 				array()
237 237
 			);
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 			WHERE t.schemaname= {string:schema} and (
427 427
 				indexname = {string:messages_ftx} OR indexname = {string:log_search_words} )',
428 428
 			array(
429
-				'messages_ftx' => $db_prefix. 'messages_ftx',
430
-				'log_search_words' => $db_prefix. 'log_search_words',
429
+				'messages_ftx' => $db_prefix . 'messages_ftx',
430
+				'log_search_words' => $db_prefix . 'log_search_words',
431 431
 				'schema' => 'public',
432 432
 			)
433 433
 		);
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 					$context['table_info']['index_length'] = (int) $row['index_size'];
443 443
 					$context['table_info']['fulltext_length'] = (int) $row['index_size'];
444 444
 				}
445
-				elseif ($row['indexname'] == $db_prefix. 'log_search_words')
445
+				elseif ($row['indexname'] == $db_prefix . 'log_search_words')
446 446
 				{
447 447
 					$context['table_info']['index_length'] = (int) $row['index_size'];
448 448
 					$context['table_info']['custom_index_length'] = (int) $row['index_size'];
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	// We need this for db_get_version
800 800
 	db_extend();
801 801
 
802
-	if ($smcFunc['db_title'] == 'PostgreSQL'){
802
+	if ($smcFunc['db_title'] == 'PostgreSQL') {
803 803
 		$request = $smcFunc['db_query']('', '
804 804
 			SELECT
805 805
 				indexname
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 			WHERE t.schemaname= {string:schema} and indexname = {string:messages_ftx}',
815 815
 			array(
816 816
 				'schema' => 'public',
817
-				'messages_ftx' => $db_prefix.'messages_ftx',
817
+				'messages_ftx' => $db_prefix . 'messages_ftx',
818 818
 			)
819 819
 		);
820 820
 		while ($row = $smcFunc['db_fetch_assoc']($request))
Please login to merge, or discard this patch.
Sources/Subs-Db-postgresql.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	if (!empty($db_options['persist']))
64 64
 		$connection = @pg_pconnect('host=' . $db_server . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'' . (empty($db_options['port']) ? '' : ' port=\'' . $db_options['port'] . '\''));
65 65
 	else
66
-		$connection = @pg_connect( 'host=' . $db_server . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'' . (empty($db_options['port']) ? '' : ' port=\'' . $db_options['port'] . '\''));
66
+		$connection = @pg_connect('host=' . $db_server . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'' . (empty($db_options['port']) ? '' : ' port=\'' . $db_options['port'] . '\''));
67 67
 
68 68
 	// Something's wrong, show an error if its fatal (which we assume it is)
69 69
 	if (!$connection)
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
  *
88 88
  * @param string $type Indicates which additional file to load. ('extra', 'packages')
89 89
  */
90
-function db_extend ($type = 'extra')
90
+function db_extend($type = 'extra')
91 91
 {
92 92
 	global $sourcedir, $db_type;
93 93
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  * @param string $db_prefix The database prefix
104 104
  * @param string $db_name The database name
105 105
  */
106
-function db_fix_prefix (&$db_prefix, $db_name)
106
+function db_fix_prefix(&$db_prefix, $db_name)
107 107
 {
108 108
 	return;
109 109
 }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 						$replacement[$key] = 'null';
237 237
 					if (!isValidIP($value))
238 238
 						smf_db_error_backtrace('Wrong value type sent to the database. IPv4 or IPv6 expected.(' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
239
-					$replacement[$key] =  sprintf('\'%1$s\'::inet', pg_escape_string($value));
239
+					$replacement[$key] = sprintf('\'%1$s\'::inet', pg_escape_string($value));
240 240
 				}
241 241
 
242 242
 				return implode(', ', $replacement);
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 	// Log the error.
554 554
 	if (function_exists('log_error'))
555
-		log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n" .$db_string : ''), 'database', $file, $line);
555
+		log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n" . $db_string : ''), 'database', $file, $line);
556 556
 
557 557
 	// Nothing's defined yet... just die with it.
558 558
 	if (empty($context) || empty($txt))
@@ -688,31 +688,31 @@  discard block
 block discarded – undo
688 688
 		static $pg_version;
689 689
 		static $replace_support;
690 690
 
691
-		if(empty($pg_version))
691
+		if (empty($pg_version))
692 692
 		{
693 693
 			db_extend();
694 694
 			//pg 9.5 got replace support
695 695
 			$pg_version = $smcFunc['db_get_version']();
696 696
 			// if we got a Beta Version
697 697
 			if (stripos($pg_version, 'beta') !== false)
698
-				$pg_version = substr($pg_version, 0, stripos($pg_version, 'beta')).'.0';
698
+				$pg_version = substr($pg_version, 0, stripos($pg_version, 'beta')) . '.0';
699 699
 			// or RC
700 700
 			if (stripos($pg_version, 'rc') !== false)
701
-				$pg_version = substr($pg_version, 0, stripos($pg_version, 'rc')).'.0';
701
+				$pg_version = substr($pg_version, 0, stripos($pg_version, 'rc')) . '.0';
702 702
 
703
-			$replace_support = (version_compare($pg_version,'9.5.0','>=') ? true : false);
703
+			$replace_support = (version_compare($pg_version, '9.5.0', '>=') ? true : false);
704 704
 		}
705 705
 
706 706
 		$count = 0;
707 707
 		$where = '';
708 708
 		$count_pk = 0;
709 709
 
710
-		If($replace_support)
710
+		If ($replace_support)
711 711
 		{
712 712
 			foreach ($columns as $columnName => $type)
713 713
 			{
714 714
 				//check pk fiel
715
-				IF(in_array($columnName, $keys))
715
+				IF (in_array($columnName, $keys))
716 716
 				{
717 717
 					$key_str .= ($count_pk > 0 ? ',' : '');
718 718
 					$key_str .= $columnName;
@@ -721,11 +721,11 @@  discard block
 block discarded – undo
721 721
 				else //normal field
722 722
 				{
723 723
 					$col_str .= ($count > 0 ? ',' : '');
724
-					$col_str .= $columnName.' = EXCLUDED.'.$columnName;
724
+					$col_str .= $columnName . ' = EXCLUDED.' . $columnName;
725 725
 					$count++;
726 726
 				}
727 727
 			}
728
-			$replace = ' ON CONFLICT ('.$key_str.') DO UPDATE SET '.$col_str;
728
+			$replace = ' ON CONFLICT (' . $key_str . ') DO UPDATE SET ' . $col_str;
729 729
 		}
730 730
 		else
731 731
 		{
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			$smcFunc['db_query']('', '
786 786
 				INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
787 787
 				VALUES
788
-					' . $entry.$replace,
788
+					' . $entry . $replace,
789 789
 				array(
790 790
 					'security_override' => true,
791 791
 					'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
  * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
881 881
  * @return string The escaped string
882 882
  */
883
-function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
883
+function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false)
884 884
 {
885 885
 	$replacements = array(
886 886
 		'%' => '\%',
Please login to merge, or discard this patch.