Completed
Push — release-2.1 ( 093156...093156 )
by Michael
24s queued 18s
created
Sources/tasks/EventNew-Notify.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 class EventNew_Notify_Background extends SMF_BackgroundTask
21 21
 {
22 22
 	/**
23
-     * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
23
+	 * This executes the task - loads up the information, puts the email in the queue and inserts alerts as needed.
24 24
 	 * @return bool Always returns true
25 25
 	 */
26 26
 	public function execute()
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 					'content_action' => empty($this->_details['sender_id']) ? 'new_guest' : 'new',
82 82
 					'is_read' => 0,
83 83
 					'extra' => $smcFunc['json_encode'](
84
-					    array(
85
-					        "event_id" => $this->_details['event_id'],
84
+						array(
85
+							"event_id" => $this->_details['event_id'],
86 86
 							"event_title" => $this->_details['event_title']
87 87
 						)
88 88
 					),
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * @return bool Always returns true
25 25
 	 */
26 26
 	public function execute()
27
- 	{
27
+	{
28 28
  		global $sourcedir, $smcFunc, $user_profile;
29 29
 
30 30
 		// Get everyone who could be notified - those are the people who can see the calendar.
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/Modlog.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					'class' => 'centercol',
257 257
 				),
258 258
 				'data' => array(
259
-					'function' => function ($entry)
259
+					'function' => function($entry)
260 260
 					{
261 261
 						return '<input type="checkbox" name="delete[]" value="' . $entry['id'] . '"' . ($entry['editable'] ? '' : ' disabled') . '>';
262 262
 					},
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 		if (empty($entries[$k]['action_text']))
639 639
 			$entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action'];
640 640
 		$entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i',
641
-			function ($matches) use ($entries, $k)
641
+			function($matches) use ($entries, $k)
642 642
 			{
643 643
 				return isset($entries[$k]['extra'][$matches[1]]) ? $entries[$k]['extra'][$matches[1]] : '';
644 644
 			}, $entries[$k]['action_text']);
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
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$table = str_replace('{db_prefix}', $db_prefix, $table);
93 93
 
94
-	$pg_tables = array('pg_catalog','information_schema');
94
+	$pg_tables = array('pg_catalog', 'information_schema');
95 95
 
96 96
 	$request = $smcFunc['db_query']('', '
97 97
 		SELECT pg_relation_size(C.oid) AS "size"
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	global $db_connection;
291 291
 	static $ver;
292 292
 
293
-	if(!empty($ver))
293
+	if (!empty($ver))
294 294
 		return $ver;
295 295
 
296 296
 	$ver = pg_version($db_connection)['server'];
Please login to merge, or discard this patch.
Sources/DbPackages-postgresql.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 			$smcFunc['db_drop_table']($table_name);
123 123
 		else if ($if_exists == 'update')
124 124
 		{
125
-			$smcFunc['db_drop_table']($table_name.'_old');
125
+			$smcFunc['db_drop_table']($table_name . '_old');
126 126
 			$smcFunc['db_transaction']('begin');
127 127
 			$db_trans = true;
128
-			$smcFunc['db_query']('','
129
-				ALTER TABLE '. $table_name .' RENAME TO ' . $table_name . '_old',
128
+			$smcFunc['db_query']('', '
129
+				ALTER TABLE '. $table_name . ' RENAME TO ' . $table_name . '_old',
130 130
 				array(
131 131
 					'security_override' => true,
132 132
 				)
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		$same_col = array();
215 215
 
216
-		$request = $smcFunc['db_query']('','
216
+		$request = $smcFunc['db_query']('', '
217 217
 			SELECT count(*), column_name
218 218
 			FROM information_schema.columns
219 219
 			WHERE table_name in ({string:table1},{string:table2}) AND table_schema = {string:schema}
220 220
 			GROUP BY column_name
221 221
 			HAVING count(*) > 1',
222
-			array (
222
+			array(
223 223
 				'table1' => $table_name,
224
-				'table2' => $table_name.'_old',
224
+				'table2' => $table_name . '_old',
225 225
 				'schema' => 'public',
226 226
 			)
227 227
 		);
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 			$same_col[] = $row['column_name'];
232 232
 		}
233 233
 
234
-		$smcFunc['db_query']('','
235
-			INSERT INTO ' . $table_name .'('
234
+		$smcFunc['db_query']('', '
235
+			INSERT INTO ' . $table_name . '('
236 236
 			. implode($same_col, ',') .
237 237
 			')
238 238
 			SELECT '. implode($same_col, ',') . '
Please login to merge, or discard this patch.
Themes/default/index.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 			// In maintenance mode, only login is allowed and don't show OverlayDiv
233 233
 			echo '
234 234
 			<ul class="floatleft welcome">
235
-				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl. '?action=login', 'return true;'), '</li>
235
+				<li>', sprintf($txt['welcome_guest'], $txt['guest_title'], '', $scripturl . '?action=login', 'return true;'), '</li>
236 236
 			</ul>';
237 237
 
238 238
 	if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1)
Please login to merge, or discard this patch.
Themes/default/Admin.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -945,7 +945,7 @@
 block discarded – undo
945 945
 				}
946 946
 
947 947
 				echo isset($config_var['postinput']) ? '
948
-											' . $config_var['postinput'] : '','
948
+											' . $config_var['postinput'] : '', '
949 949
 									</dd>';
950 950
 			}
951 951
 		}
Please login to merge, or discard this patch.
Sources/ManageSmileys.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					'class' => 'centercol',
394 394
 				),
395 395
 				'data' => array(
396
-					'function' => function ($rowData)
396
+					'function' => function($rowData)
397 397
 					{
398 398
 						return $rowData['selected'] ? '<span class="generic_icons valid"></span>' : '';
399 399
 					},
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 					'class' => 'centercol',
454 454
 				),
455 455
 				'data' => array(
456
-					'function' => function ($rowData)
456
+					'function' => function($rowData)
457 457
 					{
458 458
 						return $rowData['selected'] ? '' : sprintf('<input type="checkbox" name="smiley_set[%1$d]">', $rowData['id']);
459 459
 					},
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 						'value' => $txt['smileys_location'],
998 998
 					),
999 999
 					'data' => array(
1000
-						'function' => function ($rowData) use ($txt)
1000
+						'function' => function($rowData) use ($txt)
1001 1001
 						{
1002 1002
 							if (empty($rowData['hidden']))
1003 1003
 								return $txt['smileys_location_form'];
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 						},
1009 1009
 					),
1010 1010
 					'sort' => array(
1011
-						'default' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations)) ,
1011
+						'default' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations)),
1012 1012
 						'reverse' => $smcFunc['db_custom_order']('hidden', array_keys($smiley_locations), true),
1013 1013
 					),
1014 1014
 				),
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 						'value' => $txt['smileys_description'],
1018 1018
 					),
1019 1019
 					'data' => array(
1020
-						'function' => function ($rowData) use ($context, $txt, $modSettings, $smcFunc)
1020
+						'function' => function($rowData) use ($context, $txt, $modSettings, $smcFunc)
1021 1021
 						{
1022 1022
 							if (empty($modSettings['smileys_dir']) || !is_dir($modSettings['smileys_dir']))
1023 1023
 								return $smcFunc['htmlspecialchars']($rowData['description']);
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 				'action' => $smcFunc['htmlspecialchars'](strtr($action['destination'], array($boarddir => '.')))
1555 1555
 			);
1556 1556
 
1557
-			$file =  $packagesdir . '/temp/' . $base_path . $action['filename'];
1557
+			$file = $packagesdir . '/temp/' . $base_path . $action['filename'];
1558 1558
 			if (isset($action['filename']) && (!file_exists($file) || !is_writable(dirname($action['destination']))))
1559 1559
 			{
1560 1560
 				$context['has_failure'] = true;
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 		{
1600 1600
 			updateSettings(array(
1601 1601
 				'smiley_sets_known' => $modSettings['smiley_sets_known'] . ',' . basename($action['action']),
1602
-				'smiley_sets_names' => $modSettings['smiley_sets_names'] . "\n" . $smileyInfo['name'] . (count($context['actions']) > 1 ? ' ' .  (!empty($action['description']) ? $smcFunc['htmlspecialchars']($action['description']) : basename($action['action'])) : ''),
1602
+				'smiley_sets_names' => $modSettings['smiley_sets_names'] . "\n" . $smileyInfo['name'] . (count($context['actions']) > 1 ? ' ' . (!empty($action['description']) ? $smcFunc['htmlspecialchars']($action['description']) : basename($action['action'])) : ''),
1603 1603
 			));
1604 1604
 		}
1605 1605
 
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 			'{db_prefix}log_packages',
1612 1612
 			array(
1613 1613
 				'filename' => 'string', 'name' => 'string', 'package_id' => 'string', 'version' => 'string',
1614
-				'id_member_installed' => 'int', 'member_installed' => 'string','time_installed' => 'int',
1614
+				'id_member_installed' => 'int', 'member_installed' => 'string', 'time_installed' => 'int',
1615 1615
 				'install_state' => 'int', 'failed_steps' => 'string', 'themes_installed' => 'string',
1616 1616
 				'member_removed' => 'int', 'db_changes' => 'string', 'credits' => 'string',
1617 1617
 			),
@@ -1860,7 +1860,7 @@  discard block
 block discarded – undo
1860 1860
 		'columns' => array(
1861 1861
 			'icon' => array(
1862 1862
 				'data' => array(
1863
-					'function' => function ($rowData) use ($settings, $smcFunc)
1863
+					'function' => function($rowData) use ($settings, $smcFunc)
1864 1864
 					{
1865 1865
 						$images_url = $settings[file_exists(sprintf('%1$s/images/post/%2$s.png', $settings['theme_dir'], $rowData['filename'])) ? 'actual_images_url' : 'default_images_url'];
1866 1866
 						return sprintf('<img src="%1$s/post/%2$s.png" alt="%3$s">', $images_url, $rowData['filename'], $smcFunc['htmlspecialchars']($rowData['title']));
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 					'value' => $txt['icons_board'],
1895 1895
 				),
1896 1896
 				'data' => array(
1897
-					'function' => function ($rowData) use ($txt)
1897
+					'function' => function($rowData) use ($txt)
1898 1898
 					{
1899 1899
 						return empty($rowData['board_name']) ? $txt['icons_edit_icons_all_boards'] : $rowData['board_name'];
1900 1900
 					},
Please login to merge, or discard this patch.
Sources/Subs.php 4 patches
Indentation   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5495,7 +5495,6 @@  discard block
 block discarded – undo
5495 5495
 
5496 5496
 /**
5497 5497
  * Tries different modes to make file/dirs writable. Wrapper function for chmod()
5498
-
5499 5498
  * @param string $file The file/dir full path.
5500 5499
  * @param int $value Not needed, added for legacy reasons.
5501 5500
  * @return boolean  true if the file/dir is already writable or the function was able to make it writable, false if the function couldn't make the file/dir writable.
@@ -5535,7 +5534,6 @@  discard block
 block discarded – undo
5535 5534
 
5536 5535
 /**
5537 5536
  * Wrapper function for json_decode() with error handling.
5538
-
5539 5537
  * @param string $json The string to decode.
5540 5538
  * @param bool $returnAsArray To return the decoded string as an array or an object, SMF only uses Arrays but to keep on compatibility with json_decode its set to false as default.
5541 5539
  * @param bool $logIt To specify if the error will be logged if theres any.
@@ -6029,7 +6027,7 @@  discard block
 block discarded – undo
6029 6027
 		$params = stream_context_get_params($stream);
6030 6028
 		$result = isset($params["options"]["ssl"]["peer_certificate"]) ? true : false;
6031 6029
 	}
6032
-    return $result;
6030
+	return $result;
6033 6031
 }
6034 6032
 
6035 6033
 /**
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2932,7 +2932,7 @@
 block discarded – undo
2932 2932
 		}
2933 2933
 
2934 2934
 		// Set proper extensions; do this post caching so cache doesn't become extension-specific
2935
-		foreach($smileysto AS $ix=>$file)
2935
+		foreach($smileysto as $ix=>$file)
2936 2936
 			// Need to use the default if user selection is disabled
2937 2937
 			if (empty($modSettings['smiley_sets_enable']))
2938 2938
 				$smileysto[$ix] = $file . $context['user']['smiley_set_default_ext'];
Please login to merge, or discard this patch.
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -302,7 +302,6 @@  discard block
 block discarded – undo
302 302
 		$condition = 'id_member IN ({array_int:members})';
303 303
 		$parameters['members'] = $members;
304 304
 	}
305
-
306 305
 	elseif ($members === null)
307 306
 		$condition = '1=1';
308 307
 
@@ -1739,7 +1738,7 @@  discard block
 block discarded – undo
1739 1738
 				'before' => '<span style="text-shadow: $1 $2">',
1740 1739
 				'after' => '</span>',
1741 1740
 				'validate' => function(&$tag, &$data, $disabled)
1742
-					{
1741
+				{
1743 1742
 
1744 1743
 						if ($data[1] == 'top' || (is_numeric($data[1]) && $data[1] < 50))
1745 1744
 							$data[1] = '0 -2px 1px';
@@ -1901,7 +1900,8 @@  discard block
 block discarded – undo
1901 1900
 		{
1902 1901
 			if (isset($temp_bbc))
1903 1902
 				$bbc_codes = $temp_bbc;
1904
-			usort($codes, function ($a, $b) {
1903
+			usort($codes, function ($a, $b)
1904
+			{
1905 1905
 				return strcmp($a['tag'], $b['tag']);
1906 1906
 			});
1907 1907
 			return $codes;
@@ -2185,7 +2185,8 @@  discard block
 block discarded – undo
2185 2185
 						)?
2186 2186
 						';
2187 2187
 
2188
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2188
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches)
2189
+						{
2189 2190
 							$url = array_shift($matches);
2190 2191
 
2191 2192
 							// If this isn't a clean URL, bail out
@@ -2274,7 +2275,9 @@  discard block
 block discarded – undo
2274 2275
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2275 2276
 
2276 2277
 			// A closing tag that doesn't match any open tags? Skip it.
2277
-			if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags)))
2278
+			if (!in_array($look_for, array_map(function($code)
2279
+			{
2280
+return $code['tag'];}, $open_tags)))
2278 2281
 				continue;
2279 2282
 
2280 2283
 			$to_close = array();
@@ -3759,7 +3762,6 @@  discard block
 block discarded – undo
3759 3762
 				if (!isset($minSeed) && isset($js_file['options']['seed']))
3760 3763
 					$minSeed = $js_file['options']['seed'];
3761 3764
 			}
3762
-
3763 3765
 			else
3764 3766
 				echo '
3765 3767
 	<script src="', $js_file['fileUrl'], '"', !empty($js_file['options']['async']) ? ' async' : '', !empty($js_file['options']['defer']) ? ' defer' : '', '></script>';
@@ -3909,7 +3911,9 @@  discard block
 block discarded – undo
3909 3911
 		return $data;
3910 3912
 
3911 3913
 	// Different pages include different files, so we use a hash to label the different combinations
3912
-	$hash = md5(implode(' ', array_map(function($file) { return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data)));
3914
+	$hash = md5(implode(' ', array_map(function($file)
3915
+	{
3916
+return $file['filePath'] . (int) @filesize($file['filePath']) . (int) @filemtime($file['filePath']); }, $data)));
3913 3917
 
3914 3918
 	// Is this a deferred or asynchonous JavaScript file?
3915 3919
 	$async = $type === 'js';
@@ -5910,7 +5914,6 @@  discard block
 block discarded – undo
5910 5914
 			$isWritable = true;
5911 5915
 			break;
5912 5916
 		}
5913
-
5914 5917
 		else
5915 5918
 			@chmod($file, $val);
5916 5919
 	}
@@ -6080,7 +6083,8 @@  discard block
 block discarded – undo
6080 6083
 	if (!empty($tlds))
6081 6084
 	{
6082 6085
 		// Clean $tlds and convert it to an array
6083
-		$tlds = array_filter(explode("\n", strtolower($tlds)), function($line) {
6086
+		$tlds = array_filter(explode("\n", strtolower($tlds)), function($line)
6087
+		{
6084 6088
 			$line = trim($line);
6085 6089
 			if (empty($line) || strpos($line, '#') !== false || strpos($line, ' ') !== false)
6086 6090
 				return false;
@@ -6091,7 +6095,9 @@  discard block
 block discarded – undo
6091 6095
 		// Convert Punycode to Unicode
6092 6096
 		require_once($sourcedir . '/Class-Punycode.php');
6093 6097
 		$Punycode = new Punycode();
6094
-		$tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6098
+		$tlds = array_map(function ($input) use ($Punycode)
6099
+		{
6100
+return $Punycode->decode($input); }, $tlds);
6095 6101
 	}
6096 6102
 	// Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update
6097 6103
 	else
@@ -6258,7 +6264,8 @@  discard block
 block discarded – undo
6258 6264
 		}
6259 6265
 
6260 6266
 		// Sort by key length and then alphabetically
6261
-		uksort($regex, function($k1, $k2) use (&$strlen) {
6267
+		uksort($regex, function($k1, $k2) use (&$strlen)
6268
+		{
6262 6269
 			$l1 = $strlen($k1);
6263 6270
 			$l2 = $strlen($k2);
6264 6271
 
@@ -6512,7 +6519,8 @@  discard block
 block discarded – undo
6512 6519
 function sanitize_iri($iri)
6513 6520
 {
6514 6521
 	// Encode any non-ASCII characters (but not space or control characters of any sort)
6515
-	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) {
6522
+	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches)
6523
+	{
6516 6524
 		return rawurlencode($matches[0]);
6517 6525
 	}, $iri);
6518 6526
 
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			{
392 392
 				$val = 'CASE ';
393 393
 				foreach ($members as $k => $v)
394
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, false) . ' ';
394
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, false) . ' ';
395 395
 				$val = $val . ' END';
396 396
 				$type = 'raw';
397 397
 			}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	static $non_twelve_hour, $locale_cache;
742 742
 	static $unsupportedFormats, $finalizedFormats;
743 743
 
744
-	$unsupportedFormatsWindows = array('z','Z');
744
+	$unsupportedFormatsWindows = array('z', 'Z');
745 745
 
746 746
 	// Ensure required values are set
747 747
 	$user_info['time_offset'] = !empty($user_info['time_offset']) ? $user_info['time_offset'] : 0;
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
827 827
 		if (empty($unsupportedFormats))
828 828
 		{
829
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
829
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
830 830
 			{
831 831
 				// Avoid a crashing bug with PHP 7 on certain versions of Windows
832 832
 				if ($context['server']['is_windows'] && in_array($format, $unsupportedFormatsWindows))
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1207 1207
 				),
1208 1208
 				'content' => '$1',
1209
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1209
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1210 1210
 				{
1211 1211
 					$returnContext = '';
1212 1212
 
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 						}
1242 1242
 
1243 1243
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1244
-							$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>';
1244
+							$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>';
1245 1245
 						else
1246 1246
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1247 1247
 					}
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 				'type' => 'unparsed_content',
1294 1294
 				'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>',
1295 1295
 				// @todo Maybe this can be simplified?
1296
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1296
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1297 1297
 				{
1298 1298
 					if (!isset($disabled['code']))
1299 1299
 					{
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 				'type' => 'unparsed_equals_content',
1331 1331
 				'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>',
1332 1332
 				// @todo Maybe this can be simplified?
1333
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1333
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1334 1334
 				{
1335 1335
 					if (!isset($disabled['code']))
1336 1336
 					{
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 				'type' => 'unparsed_content',
1375 1375
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1376 1376
 				// @todo Should this respect guest_hideContacts?
1377
-				'validate' => function (&$tag, &$data, $disabled)
1377
+				'validate' => function(&$tag, &$data, $disabled)
1378 1378
 				{
1379 1379
 					$data = strtr($data, array('<br>' => ''));
1380 1380
 				},
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1395 1395
 				'before' => '<div $1>',
1396 1396
 				'after' => '</div>',
1397
-				'validate' => function (&$tag, &$data, $disabled)
1397
+				'validate' => function(&$tag, &$data, $disabled)
1398 1398
 				{
1399 1399
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1400 1400
 
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1481 1481
 				),
1482 1482
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1483
-				'validate' => function (&$tag, &$data, $disabled)
1483
+				'validate' => function(&$tag, &$data, $disabled)
1484 1484
 				{
1485 1485
 					global $image_proxy_enabled, $user_info;
1486 1486
 
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 				'tag' => 'img',
1507 1507
 				'type' => 'unparsed_content',
1508 1508
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1509
-				'validate' => function (&$tag, &$data, $disabled)
1509
+				'validate' => function(&$tag, &$data, $disabled)
1510 1510
 				{
1511 1511
 					global $image_proxy_enabled, $user_info;
1512 1512
 
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
 				'tag' => 'iurl',
1533 1533
 				'type' => 'unparsed_content',
1534 1534
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1535
-				'validate' => function (&$tag, &$data, $disabled)
1535
+				'validate' => function(&$tag, &$data, $disabled)
1536 1536
 				{
1537 1537
 					$data = strtr($data, array('<br>' => ''));
1538 1538
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 				'quoted' => 'optional',
1547 1547
 				'before' => '<a href="$1" class="bbc_link">',
1548 1548
 				'after' => '</a>',
1549
-				'validate' => function (&$tag, &$data, $disabled)
1549
+				'validate' => function(&$tag, &$data, $disabled)
1550 1550
 				{
1551 1551
 					if (substr($data, 0, 1) == '#')
1552 1552
 						$data = '#post_' . substr($data, 1);
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 				'tag' => 'php',
1640 1640
 				'type' => 'unparsed_content',
1641 1641
 				'content' => '<span class="phpcode">$1</span>',
1642
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1642
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1643 1643
 				{
1644 1644
 					if (!isset($disabled['php']))
1645 1645
 					{
@@ -1767,7 +1767,7 @@  discard block
 block discarded – undo
1767 1767
 				'test' => '[1-7]\]',
1768 1768
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1769 1769
 				'after' => '</span>',
1770
-				'validate' => function (&$tag, &$data, $disabled)
1770
+				'validate' => function(&$tag, &$data, $disabled)
1771 1771
 				{
1772 1772
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1773 1773
 					$data = $sizes[$data] . 'em';
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 				'tag' => 'time',
1806 1806
 				'type' => 'unparsed_content',
1807 1807
 				'content' => '$1',
1808
-				'validate' => function (&$tag, &$data, $disabled)
1808
+				'validate' => function(&$tag, &$data, $disabled)
1809 1809
 				{
1810 1810
 					if (is_numeric($data))
1811 1811
 						$data = timeformat($data);
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 				'tag' => 'url',
1839 1839
 				'type' => 'unparsed_content',
1840 1840
 				'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>',
1841
-				'validate' => function (&$tag, &$data, $disabled)
1841
+				'validate' => function(&$tag, &$data, $disabled)
1842 1842
 				{
1843 1843
 					$data = strtr($data, array('<br>' => ''));
1844 1844
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
 				'quoted' => 'optional',
1853 1853
 				'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">',
1854 1854
 				'after' => '</a>',
1855
-				'validate' => function (&$tag, &$data, $disabled)
1855
+				'validate' => function(&$tag, &$data, $disabled)
1856 1856
 				{
1857 1857
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1858 1858
 					if (empty($scheme))
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 		{
1899 1899
 			if (isset($temp_bbc))
1900 1900
 				$bbc_codes = $temp_bbc;
1901
-			usort($codes, function ($a, $b) {
1901
+			usort($codes, function($a, $b) {
1902 1902
 				return strcmp($a['tag'], $b['tag']);
1903 1903
 			});
1904 1904
 			return $codes;
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 										# a run of Unicode domain name characters and a dot
2115 2115
 										[\p{L}\p{M}\p{N}\-.:@]+\.
2116 2116
 										# and then a TLD valid in the DNS or the reserved "local" TLD
2117
-										(?:'. $modSettings['tld_regex'] .'|local)
2117
+										(?:'. $modSettings['tld_regex'] . '|local)
2118 2118
 									)
2119 2119
 									# followed by a non-domain character or end of line
2120 2120
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
 						)?
2183 2183
 						';
2184 2184
 
2185
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2185
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2186 2186
 							$url = array_shift($matches);
2187 2187
 
2188 2188
 							// If this isn't a clean URL, bail out
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
 								$fullUrl = $url;
2208 2208
 
2209 2209
 							// Make sure that $fullUrl really is valid
2210
-							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '' ) . $fullUrl) === false)
2210
+							if (validate_iri((strpos($fullUrl, '//') === 0 ? 'http:' : '') . $fullUrl) === false)
2211 2211
 								return $url;
2212 2212
 
2213 2213
 							return '[url=&quot;' . str_replace(array('[', ']'), array('&#91;', '&#93;'), $fullUrl) . '&quot;]' . $url . '[/url]';
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2272 2272
 
2273 2273
 			// A closing tag that doesn't match any open tags? Skip it.
2274
-			if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags)))
2274
+			if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags)))
2275 2275
 				continue;
2276 2276
 
2277 2277
 			$to_close = array();
@@ -2929,7 +2929,7 @@  discard block
 block discarded – undo
2929 2929
 		}
2930 2930
 
2931 2931
 		// Set proper extensions; do this post caching so cache doesn't become extension-specific
2932
-		foreach($smileysto AS $ix=>$file)
2932
+		foreach ($smileysto AS $ix=>$file)
2933 2933
 			// Need to use the default if user selection is disabled
2934 2934
 			if (empty($modSettings['smiley_sets_enable']))
2935 2935
 				$smileysto[$ix] = $file . $context['user']['smiley_set_default_ext'];
@@ -2947,7 +2947,7 @@  discard block
 block discarded – undo
2947 2947
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2948 2948
 		{
2949 2949
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2950
-			$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">';
2950
+			$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">';
2951 2951
 
2952 2952
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2953 2953
 
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
 
2973 2973
 	// Replace away!
2974 2974
 	$message = preg_replace_callback($smileyPregSearch,
2975
-		function ($matches) use ($smileyPregReplacements)
2975
+		function($matches) use ($smileyPregReplacements)
2976 2976
 		{
2977 2977
 			return $smileyPregReplacements[$matches[1]];
2978 2978
 		}, $message);
@@ -3069,13 +3069,13 @@  discard block
 block discarded – undo
3069 3069
 	{
3070 3070
 		if (defined('SID') && SID != '')
3071 3071
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
3072
-				function ($m) use ($scripturl)
3072
+				function($m) use ($scripturl)
3073 3073
 				{
3074
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
3074
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
3075 3075
 				}, $setLocation);
3076 3076
 		else
3077 3077
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '~') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
3078
-				function ($m) use ($scripturl)
3078
+				function($m) use ($scripturl)
3079 3079
 				{
3080 3080
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
3081 3081
 				}, $setLocation);
@@ -3396,7 +3396,7 @@  discard block
 block discarded – undo
3396 3396
 
3397 3397
 	// Add a generic "Are you sure?" confirmation message.
3398 3398
 	addInlineJavaScript('
3399
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3399
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3400 3400
 
3401 3401
 	// Now add the capping code for avatars.
3402 3402
 	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')
@@ -3862,7 +3862,7 @@  discard block
 block discarded – undo
3862 3862
 	if (!empty($normal))
3863 3863
 		foreach ($normal as $nf)
3864 3864
 			echo '
3865
-	<link rel="stylesheet" href="', $nf ,'">';
3865
+	<link rel="stylesheet" href="', $nf, '">';
3866 3866
 
3867 3867
 	if ($db_show_debug === true)
3868 3868
 	{
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
 	<style>';
3879 3879
 
3880 3880
 		foreach ($context['css_header'] as $css)
3881
-			echo $css .'
3881
+			echo $css . '
3882 3882
 	';
3883 3883
 
3884 3884
 		echo'
@@ -3950,7 +3950,7 @@  discard block
 block discarded – undo
3950 3950
 	}
3951 3951
 
3952 3952
 	// No namespaces, sorry!
3953
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3953
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3954 3954
 
3955 3955
 	$minifier = new $classType();
3956 3956
 
@@ -4095,7 +4095,7 @@  discard block
 block discarded – undo
4095 4095
 	else
4096 4096
 		$path = $modSettings['attachmentUploadDir'];
4097 4097
 
4098
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
4098
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
4099 4099
 }
4100 4100
 
4101 4101
 /**
@@ -4139,10 +4139,10 @@  discard block
 block discarded – undo
4139 4139
 		$valid_low = isValidIP($ip_parts[0]);
4140 4140
 		$valid_high = isValidIP($ip_parts[1]);
4141 4141
 		$count = 0;
4142
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
4142
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
4143 4143
 		$max = ($mode == ':' ? 'ffff' : '255');
4144 4144
 		$min = 0;
4145
-		if(!$valid_low)
4145
+		if (!$valid_low)
4146 4146
 		{
4147 4147
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
4148 4148
 			$valid_low = isValidIP($ip_parts[0]);
@@ -4156,7 +4156,7 @@  discard block
 block discarded – undo
4156 4156
 		}
4157 4157
 
4158 4158
 		$count = 0;
4159
-		if(!$valid_high)
4159
+		if (!$valid_high)
4160 4160
 		{
4161 4161
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
4162 4162
 			$valid_high = isValidIP($ip_parts[1]);
@@ -4169,7 +4169,7 @@  discard block
 block discarded – undo
4169 4169
 			}
4170 4170
 		}
4171 4171
 
4172
-		if($valid_high && $valid_low)
4172
+		if ($valid_high && $valid_low)
4173 4173
 		{
4174 4174
 			$ip_array['low'] = $ip_parts[0];
4175 4175
 			$ip_array['high'] = $ip_parts[1];
@@ -4350,7 +4350,7 @@  discard block
 block discarded – undo
4350 4350
 		addInlineJavaScript('
4351 4351
 	var user_menus = new smc_PopupMenu();
4352 4352
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4353
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4353
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4354 4354
 		if ($context['allow_pm'])
4355 4355
 			addInlineJavaScript('
4356 4356
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4645,7 +4645,7 @@  discard block
 block discarded – undo
4645 4645
 		$context['total_admin_reports'] += $context['unapproved_members'];
4646 4646
 	}
4647 4647
 
4648
-	if($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin']))
4648
+	if ($context['total_admin_reports'] > 0 && !empty($context['menu_buttons']['admin']))
4649 4649
 	{
4650 4650
 		$context['menu_buttons']['admin']['amt'] = $context['total_admin_reports'];
4651 4651
 	}
@@ -4992,7 +4992,7 @@  discard block
 block discarded – undo
4992 4992
 		// No? try a fallback to $sourcedir
4993 4993
 		else
4994 4994
 		{
4995
-			$absPath = $sourcedir .'/'. $file;
4995
+			$absPath = $sourcedir . '/' . $file;
4996 4996
 
4997 4997
 			if (file_exists($absPath))
4998 4998
 				require_once($absPath);
@@ -5259,15 +5259,15 @@  discard block
 block discarded – undo
5259 5259
 
5260 5260
 	// UTF-8 occurences of MS special characters
5261 5261
 	$findchars_utf8 = array(
5262
-		"\xe2\x80\x9a",	// single low-9 quotation mark
5263
-		"\xe2\x80\x9e",	// double low-9 quotation mark
5264
-		"\xe2\x80\xa6",	// horizontal ellipsis
5265
-		"\xe2\x80\x98",	// left single curly quote
5266
-		"\xe2\x80\x99",	// right single curly quote
5267
-		"\xe2\x80\x9c",	// left double curly quote
5268
-		"\xe2\x80\x9d",	// right double curly quote
5269
-		"\xe2\x80\x93",	// en dash
5270
-		"\xe2\x80\x94",	// em dash
5262
+		"\xe2\x80\x9a", // single low-9 quotation mark
5263
+		"\xe2\x80\x9e", // double low-9 quotation mark
5264
+		"\xe2\x80\xa6", // horizontal ellipsis
5265
+		"\xe2\x80\x98", // left single curly quote
5266
+		"\xe2\x80\x99", // right single curly quote
5267
+		"\xe2\x80\x9c", // left double curly quote
5268
+		"\xe2\x80\x9d", // right double curly quote
5269
+		"\xe2\x80\x93", // en dash
5270
+		"\xe2\x80\x94", // em dash
5271 5271
 	);
5272 5272
 
5273 5273
 	// windows 1252 / iso equivalents
@@ -5285,15 +5285,15 @@  discard block
 block discarded – undo
5285 5285
 
5286 5286
 	// safe replacements
5287 5287
 	$replacechars = array(
5288
-		',',	// &sbquo;
5289
-		',,',	// &bdquo;
5290
-		'...',	// &hellip;
5291
-		"'",	// &lsquo;
5292
-		"'",	// &rsquo;
5293
-		'"',	// &ldquo;
5294
-		'"',	// &rdquo;
5295
-		'-',	// &ndash;
5296
-		'--',	// &mdash;
5288
+		',', // &sbquo;
5289
+		',,', // &bdquo;
5290
+		'...', // &hellip;
5291
+		"'", // &lsquo;
5292
+		"'", // &rsquo;
5293
+		'"', // &ldquo;
5294
+		'"', // &rdquo;
5295
+		'-', // &ndash;
5296
+		'--', // &mdash;
5297 5297
 	);
5298 5298
 
5299 5299
 	if ($context['utf8'])
@@ -5613,7 +5613,7 @@  discard block
 block discarded – undo
5613 5613
  */
5614 5614
 function inet_dtop($bin)
5615 5615
 {
5616
-	if(empty($bin))
5616
+	if (empty($bin))
5617 5617
 		return '';
5618 5618
 
5619 5619
 	global $db_type;
@@ -5644,28 +5644,28 @@  discard block
 block discarded – undo
5644 5644
  */
5645 5645
 function _safe_serialize($value)
5646 5646
 {
5647
-	if(is_null($value))
5647
+	if (is_null($value))
5648 5648
 		return 'N;';
5649 5649
 
5650
-	if(is_bool($value))
5651
-		return 'b:'. (int) $value .';';
5650
+	if (is_bool($value))
5651
+		return 'b:' . (int) $value . ';';
5652 5652
 
5653
-	if(is_int($value))
5654
-		return 'i:'. $value .';';
5653
+	if (is_int($value))
5654
+		return 'i:' . $value . ';';
5655 5655
 
5656
-	if(is_float($value))
5657
-		return 'd:'. str_replace(',', '.', $value) .';';
5656
+	if (is_float($value))
5657
+		return 'd:' . str_replace(',', '.', $value) . ';';
5658 5658
 
5659
-	if(is_string($value))
5660
-		return 's:'. strlen($value) .':"'. $value .'";';
5659
+	if (is_string($value))
5660
+		return 's:' . strlen($value) . ':"' . $value . '";';
5661 5661
 
5662
-	if(is_array($value))
5662
+	if (is_array($value))
5663 5663
 	{
5664 5664
 		$out = '';
5665
-		foreach($value as $k => $v)
5665
+		foreach ($value as $k => $v)
5666 5666
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5667 5667
 
5668
-		return 'a:'. count($value) .':{'. $out .'}';
5668
+		return 'a:' . count($value) . ':{' . $out . '}';
5669 5669
 	}
5670 5670
 
5671 5671
 	// safe_serialize cannot serialize resources or objects.
@@ -5707,7 +5707,7 @@  discard block
 block discarded – undo
5707 5707
 function _safe_unserialize($str)
5708 5708
 {
5709 5709
 	// Input  is not a string.
5710
-	if(empty($str) || !is_string($str))
5710
+	if (empty($str) || !is_string($str))
5711 5711
 		return false;
5712 5712
 
5713 5713
 	$stack = array();
@@ -5721,40 +5721,40 @@  discard block
 block discarded – undo
5721 5721
 	 *   3 - in array, expecting value or another array
5722 5722
 	 */
5723 5723
 	$state = 0;
5724
-	while($state != 1)
5724
+	while ($state != 1)
5725 5725
 	{
5726 5726
 		$type = isset($str[0]) ? $str[0] : '';
5727
-		if($type == '}')
5727
+		if ($type == '}')
5728 5728
 			$str = substr($str, 1);
5729 5729
 
5730
-		else if($type == 'N' && $str[1] == ';')
5730
+		else if ($type == 'N' && $str[1] == ';')
5731 5731
 		{
5732 5732
 			$value = null;
5733 5733
 			$str = substr($str, 2);
5734 5734
 		}
5735
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5735
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5736 5736
 		{
5737 5737
 			$value = $matches[1] == '1' ? true : false;
5738 5738
 			$str = substr($str, 4);
5739 5739
 		}
5740
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5740
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5741 5741
 		{
5742
-			$value = (int)$matches[1];
5742
+			$value = (int) $matches[1];
5743 5743
 			$str = $matches[2];
5744 5744
 		}
5745
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5745
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5746 5746
 		{
5747
-			$value = (float)$matches[1];
5747
+			$value = (float) $matches[1];
5748 5748
 			$str = $matches[3];
5749 5749
 		}
5750
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5750
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5751 5751
 		{
5752
-			$value = substr($matches[2], 0, (int)$matches[1]);
5753
-			$str = substr($matches[2], (int)$matches[1] + 2);
5752
+			$value = substr($matches[2], 0, (int) $matches[1]);
5753
+			$str = substr($matches[2], (int) $matches[1] + 2);
5754 5754
 		}
5755
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5755
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5756 5756
 		{
5757
-			$expectedLength = (int)$matches[1];
5757
+			$expectedLength = (int) $matches[1];
5758 5758
 			$str = $matches[2];
5759 5759
 		}
5760 5760
 
@@ -5762,10 +5762,10 @@  discard block
 block discarded – undo
5762 5762
 		else
5763 5763
 			return false;
5764 5764
 
5765
-		switch($state)
5765
+		switch ($state)
5766 5766
 		{
5767 5767
 			case 3: // In array, expecting value or another array.
5768
-				if($type == 'a')
5768
+				if ($type == 'a')
5769 5769
 				{
5770 5770
 					$stack[] = &$list;
5771 5771
 					$list[$key] = array();
@@ -5774,7 +5774,7 @@  discard block
 block discarded – undo
5774 5774
 					$state = 2;
5775 5775
 					break;
5776 5776
 				}
5777
-				if($type != '}')
5777
+				if ($type != '}')
5778 5778
 				{
5779 5779
 					$list[$key] = $value;
5780 5780
 					$state = 2;
@@ -5785,29 +5785,29 @@  discard block
 block discarded – undo
5785 5785
 				return false;
5786 5786
 
5787 5787
 			case 2: // in array, expecting end of array or a key
5788
-				if($type == '}')
5788
+				if ($type == '}')
5789 5789
 				{
5790 5790
 					// Array size is less than expected.
5791
-					if(count($list) < end($expected))
5791
+					if (count($list) < end($expected))
5792 5792
 						return false;
5793 5793
 
5794 5794
 					unset($list);
5795
-					$list = &$stack[count($stack)-1];
5795
+					$list = &$stack[count($stack) - 1];
5796 5796
 					array_pop($stack);
5797 5797
 
5798 5798
 					// Go to terminal state if we're at the end of the root array.
5799 5799
 					array_pop($expected);
5800 5800
 
5801
-					if(count($expected) == 0)
5801
+					if (count($expected) == 0)
5802 5802
 						$state = 1;
5803 5803
 
5804 5804
 					break;
5805 5805
 				}
5806 5806
 
5807
-				if($type == 'i' || $type == 's')
5807
+				if ($type == 'i' || $type == 's')
5808 5808
 				{
5809 5809
 					// Array size exceeds expected length.
5810
-					if(count($list) >= end($expected))
5810
+					if (count($list) >= end($expected))
5811 5811
 						return false;
5812 5812
 
5813 5813
 					$key = $value;
@@ -5820,7 +5820,7 @@  discard block
 block discarded – undo
5820 5820
 
5821 5821
 			// Expecting array or value.
5822 5822
 			case 0:
5823
-				if($type == 'a')
5823
+				if ($type == 'a')
5824 5824
 				{
5825 5825
 					$data = array();
5826 5826
 					$list = &$data;
@@ -5829,7 +5829,7 @@  discard block
 block discarded – undo
5829 5829
 					break;
5830 5830
 				}
5831 5831
 
5832
-				if($type != '}')
5832
+				if ($type != '}')
5833 5833
 				{
5834 5834
 					$data = $value;
5835 5835
 					$state = 1;
@@ -5842,7 +5842,7 @@  discard block
 block discarded – undo
5842 5842
 	}
5843 5843
 
5844 5844
 	// Trailing data in input.
5845
-	if(!empty($str))
5845
+	if (!empty($str))
5846 5846
 		return false;
5847 5847
 
5848 5848
 	return $data;
@@ -5896,7 +5896,7 @@  discard block
 block discarded – undo
5896 5896
 	// Set different modes.
5897 5897
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5898 5898
 
5899
-	foreach($chmodValues as $val)
5899
+	foreach ($chmodValues as $val)
5900 5900
 	{
5901 5901
 		// If it's writable, break out of the loop.
5902 5902
 		if (is_writable($file))
@@ -5931,13 +5931,13 @@  discard block
 block discarded – undo
5931 5931
 	$returnArray = @json_decode($json, $returnAsArray);
5932 5932
 
5933 5933
 	// PHP 5.3 so no json_last_error_msg()
5934
-	switch(json_last_error())
5934
+	switch (json_last_error())
5935 5935
 	{
5936 5936
 		case JSON_ERROR_NONE:
5937 5937
 			$jsonError = false;
5938 5938
 			break;
5939 5939
 		case JSON_ERROR_DEPTH:
5940
-			$jsonError =  'JSON_ERROR_DEPTH';
5940
+			$jsonError = 'JSON_ERROR_DEPTH';
5941 5941
 			break;
5942 5942
 		case JSON_ERROR_STATE_MISMATCH:
5943 5943
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5965,10 +5965,10 @@  discard block
 block discarded – undo
5965 5965
 		loadLanguage('Errors');
5966 5966
 
5967 5967
 		if (!empty($jsonDebug))
5968
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5968
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5969 5969
 
5970 5970
 		else
5971
-			log_error($txt['json_'. $jsonError], 'critical');
5971
+			log_error($txt['json_' . $jsonError], 'critical');
5972 5972
 
5973 5973
 		// Everyone expects an array.
5974 5974
 		return array();
@@ -6085,7 +6085,7 @@  discard block
 block discarded – undo
6085 6085
 		// Convert Punycode to Unicode
6086 6086
 		require_once($sourcedir . '/Class-Punycode.php');
6087 6087
 		$Punycode = new Punycode();
6088
-		$tlds = array_map(function ($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6088
+		$tlds = array_map(function($input) use ($Punycode) { return $Punycode->decode($input); }, $tlds);
6089 6089
 	}
6090 6090
 	// Otherwise, use the 2012 list of gTLDs and ccTLDs for now and schedule a background update
6091 6091
 	else
@@ -6179,7 +6179,7 @@  discard block
 block discarded – undo
6179 6179
 	}
6180 6180
 
6181 6181
 	// This recursive function creates the index array from the strings
6182
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6182
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
6183 6183
 	{
6184 6184
 		static $depth = 0;
6185 6185
 		$depth++;
@@ -6206,7 +6206,7 @@  discard block
 block discarded – undo
6206 6206
 	};
6207 6207
 
6208 6208
 	// This recursive function turns the index array into a regular expression
6209
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
6209
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
6210 6210
 	{
6211 6211
 		static $depth = 0;
6212 6212
 		$depth++;
@@ -6230,11 +6230,11 @@  discard block
 block discarded – undo
6230 6230
 
6231 6231
 				if (count(array_keys($value)) == 1)
6232 6232
 				{
6233
-					$new_key_array = explode('(?'.'>', $sub_regex);
6233
+					$new_key_array = explode('(?' . '>', $sub_regex);
6234 6234
 					$new_key .= $new_key_array[0];
6235 6235
 				}
6236 6236
 				else
6237
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
6237
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
6238 6238
 			}
6239 6239
 
6240 6240
 			if ($depth > 1)
@@ -6277,10 +6277,10 @@  discard block
 block discarded – undo
6277 6277
 	{
6278 6278
 		$regex = array();
6279 6279
 		while (!empty($index))
6280
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6280
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6281 6281
 	}
6282 6282
 	else
6283
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6283
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6284 6284
 
6285 6285
 	// Restore PHP's internal character encoding to whatever it was originally
6286 6286
 	if (!empty($current_encoding))
@@ -6442,8 +6442,8 @@  discard block
 block discarded – undo
6442 6442
 		$query_part['query_see_board'] = '1=1';
6443 6443
 	// Otherwise just the groups in $user_info['groups'].
6444 6444
 	else
6445
-		$query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( '. implode(',', $groups) .') AND bpv.deny = 0) '
6446
-				.  ( !empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( '. implode(',', $groups) .') and bpv.deny = 1)' : '')
6445
+		$query_part['query_see_board'] = 'EXISTS (SELECT DISTINCT bpv.id_board FROM ' . $db_prefix . 'board_permissions_view bpv WHERE (bpv.id_group IN ( ' . implode(',', $groups) . ') AND bpv.deny = 0) '
6446
+				.  (!empty($deny_boards_access) ? ' AND (bpv.id_group NOT IN ( ' . implode(',', $groups) . ') and bpv.deny = 1)' : '')
6447 6447
 				. ' AND bpv.id_board = b.id_board)';
6448 6448
 
6449 6449
 	// Build the list of boards they WANT to see.
@@ -6507,7 +6507,7 @@  discard block
 block discarded – undo
6507 6507
 function sanitize_iri($iri)
6508 6508
 {
6509 6509
 	// Encode any non-ASCII characters (but not space or control characters of any sort)
6510
-	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function ($matches) {
6510
+	$iri = preg_replace_callback('~[^\x00-\x7F\pZ\pC]~u', function($matches) {
6511 6511
 		return rawurlencode($matches[0]);
6512 6512
 	}, $iri);
6513 6513
 
@@ -6549,7 +6549,7 @@  discard block
 block discarded – undo
6549 6549
 	$unescaped = array(
6550 6550
 		'%21'=>'!', '%23'=>'#', '%24'=>'$', '%26'=>'&',
6551 6551
 		'%27'=>"'", '%28'=>'(', '%29'=>')', '%2A'=>'*',
6552
-		'%2B'=>'+', '%2C'=>',',	'%2F'=>'/', '%3A'=>':',
6552
+		'%2B'=>'+', '%2C'=>',', '%2F'=>'/', '%3A'=>':',
6553 6553
 		'%3B'=>';', '%3D'=>'=', '%3F'=>'?', '%40'=>'@',
6554 6554
 	);
6555 6555
 	$iri = strtr(rawurlencode($iri), $unescaped);
Please login to merge, or discard this patch.