Completed
Branch release-2.1 (3c29ac)
by Mathias
08:54
created
Sources/Load.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 
74 74
 	// Set a list of common functions.
75 75
 	$ent_list = empty($modSettings['disableEntityCheck']) ? '&(#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(#021|quot|amp|lt|gt|nbsp);';
76
-	$ent_check = empty($modSettings['disableEntityCheck']) ? function ($string)
76
+	$ent_check = empty($modSettings['disableEntityCheck']) ? function($string)
77 77
 		{
78 78
 			$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
79 79
 			return $string;
80
-		} : function ($string)
80
+		} : function($string)
81 81
 		{
82 82
 			return $string;
83 83
 		};
84
-	$fix_utf8mb4 = function ($string) use ($utf8)
84
+	$fix_utf8mb4 = function($string) use ($utf8)
85 85
 	{
86 86
 		if (!$utf8)
87 87
 			return $string;
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 			}
100 100
 			elseif ($ord < 224)
101 101
 			{
102
-				$new_string .= $string[$i] . $string[$i+1];
102
+				$new_string .= $string[$i] . $string[$i + 1];
103 103
 				$i += 2;
104 104
 			}
105 105
 			elseif ($ord < 240)
106 106
 			{
107
-				$new_string .= $string[$i] . $string[$i+1] . $string[$i+2];
107
+				$new_string .= $string[$i] . $string[$i + 1] . $string[$i + 2];
108 108
 				$i += 3;
109 109
 			}
110 110
 			elseif ($ord < 248)
111 111
 			{
112 112
 				// Magic happens.
113 113
 				$val = (ord($string[$i]) & 0x07) << 18;
114
-				$val += (ord($string[$i+1]) & 0x3F) << 12;
115
-				$val += (ord($string[$i+2]) & 0x3F) << 6;
116
-				$val += (ord($string[$i+3]) & 0x3F);
114
+				$val += (ord($string[$i + 1]) & 0x3F) << 12;
115
+				$val += (ord($string[$i + 2]) & 0x3F) << 6;
116
+				$val += (ord($string[$i + 3]) & 0x3F);
117 117
 				$new_string .= '&#' . $val . ';';
118 118
 				$i += 4;
119 119
 			}
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 
127 127
 	// global array of anonymous helper functions, used mostly to properly handle multi byte strings
128 128
 	$smcFunc += array(
129
-		'entity_fix' => function ($string)
129
+		'entity_fix' => function($string)
130 130
 		{
131 131
 			$num = $string[0] === 'x' ? hexdec(substr($string, 1)) : (int) $string;
132 132
 			return $num < 0x20 || $num > 0x10FFFF || ($num >= 0xD800 && $num <= 0xDFFF) || $num === 0x202E || $num === 0x202D ? '' : '&#' . $num . ';';
133 133
 		},
134
-		'htmlspecialchars' => function ($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4)
134
+		'htmlspecialchars' => function($string, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1') use ($ent_check, $utf8, $fix_utf8mb4)
135 135
 		{
136 136
 			return $fix_utf8mb4($ent_check(htmlspecialchars($string, $quote_style, $utf8 ? 'UTF-8' : $charset)));
137 137
 		},
138
-		'htmltrim' => function ($string) use ($utf8, $space_chars, $ent_check)
138
+		'htmltrim' => function($string) use ($utf8, $space_chars, $ent_check)
139 139
 		{
140 140
 			return preg_replace('~^(?:[ \t\n\r\x0B\x00' . $space_chars . ']|&nbsp;)+|(?:[ \t\n\r\x0B\x00' . $space_chars . ']|&nbsp;)+$~' . ($utf8 ? 'u' : ''), '', $ent_check($string));
141 141
 		},
142
-		'strlen' => function ($string) use ($ent_list, $utf8, $ent_check)
142
+		'strlen' => function($string) use ($ent_list, $utf8, $ent_check)
143 143
 		{
144 144
 			return strlen(preg_replace('~' . $ent_list . ($utf8 ? '|.~u' : '~'), '_', $ent_check($string)));
145 145
 		},
146
-		'strpos' => function ($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings)
146
+		'strpos' => function($haystack, $needle, $offset = 0) use ($utf8, $ent_check, $modSettings)
147 147
 		{
148 148
 			$haystack_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|&quot;|&amp;|&lt;|&gt;|&nbsp;|.)~' . ($utf8 ? 'u' : ''), $ent_check($haystack), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
149 149
 
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 				return false;
169 169
 			}
170 170
 		},
171
-		'substr' => function ($string, $start, $length = null) use ($utf8, $ent_check, $modSettings)
171
+		'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $modSettings)
172 172
 		{
173 173
 			$ent_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|&quot;|&amp;|&lt;|&gt;|&nbsp;|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
174 174
 			return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
175 175
 		},
176
-		'strtolower' => $utf8 ? function ($string) use ($sourcedir)
176
+		'strtolower' => $utf8 ? function($string) use ($sourcedir)
177 177
 		{
178 178
 			if (!function_exists('mb_strtolower'))
179 179
 			{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			return mb_strtolower($string, 'UTF-8');
185 185
 		} : 'strtolower',
186
-		'strtoupper' => $utf8 ? function ($string)
186
+		'strtoupper' => $utf8 ? function($string)
187 187
 		{
188 188
 			global $sourcedir;
189 189
 
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 		'truncate' => function($string, $length) use ($utf8, $ent_check, $ent_list, &$smcFunc)
199 199
 		{
200 200
 			$string = $ent_check($string);
201
-			preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~'.  ($utf8 ? 'u' : ''), $string, $matches);
201
+			preg_match('~^(' . $ent_list . '|.){' . $smcFunc['strlen'](substr($string, 0, $length)) . '}~' . ($utf8 ? 'u' : ''), $string, $matches);
202 202
 			$string = $matches[0];
203 203
 			while (strlen($string) > $length)
204
-				$string = preg_replace('~(?:' . $ent_list . '|.)$~'.  ($utf8 ? 'u' : ''), '', $string);
204
+				$string = preg_replace('~(?:' . $ent_list . '|.)$~' . ($utf8 ? 'u' : ''), '', $string);
205 205
 			return $string;
206 206
 		},
207
-		'ucfirst' => $utf8 ? function ($string) use (&$smcFunc)
207
+		'ucfirst' => $utf8 ? function($string) use (&$smcFunc)
208 208
 		{
209 209
 			return $smcFunc['strtoupper']($smcFunc['substr']($string, 0, 1)) . $smcFunc['substr']($string, 1);
210 210
 		} : 'ucfirst',
211
-		'ucwords' => $utf8 ? function ($string) use (&$smcFunc)
211
+		'ucwords' => $utf8 ? function($string) use (&$smcFunc)
212 212
 		{
213 213
 			$words = preg_split('~([\s\r\n\t]+)~', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
214 214
 			for ($i = 0, $n = count($words); $i < $n; $i += 2)
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 		else
608 608
 		{
609 609
 			// !!! Compatibility.
610
-			$user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 :$user_settings['time_offset'];
610
+			$user_info['time_offset'] = empty($user_settings['time_offset']) ? 0 : $user_settings['time_offset'];
611 611
 		}
612 612
 	}
613 613
 	// If the user is a guest, initialize all the critical user settings.
@@ -1262,9 +1262,9 @@  discard block
 block discarded – undo
1262 1262
 			if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false)
1263 1263
 				$row['avatar'] = $boardurl . '/proxy.php?request=' . urlencode($row['avatar']) . '&hash=' . md5($row['avatar'] . $image_proxy_secret);
1264 1264
 
1265
-			if ( isset($row['member_ip']) )
1265
+			if (isset($row['member_ip']))
1266 1266
 				$row['member_ip'] = inet_dtop($row['member_ip']);
1267
-			if ( isset($row['member_ip2']) )
1267
+			if (isset($row['member_ip2']))
1268 1268
 				$row['member_ip2'] = inet_dtop($row['member_ip2']);
1269 1269
 			$new_loaded_ids[] = $row['id_member'];
1270 1270
 			$loaded_ids[] = $row['id_member'];
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 		'name' => $profile['real_name'],
1413 1413
 		'id' => $profile['id_member'],
1414 1414
 		'href' => $scripturl . '?action=profile;u=' . $profile['id_member'],
1415
-		'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" '. (!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '').'>' . $profile['real_name'] . '</a>',
1415
+		'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($modSettings['onlineEnable']) ? 'class="pm_icon"' : '') . '>' . $profile['real_name'] . '</a>',
1416 1416
 		'email' => $profile['email_address'],
1417 1417
 		'show_email' => !$user_info['is_guest'] && ($user_info['id'] == $profile['id_member'] || allowedTo('moderate_forum')),
1418 1418
 		'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']),
@@ -1427,9 +1427,9 @@  discard block
 block discarded – undo
1427 1427
 			$loadedLanguages = getLanguages();
1428 1428
 
1429 1429
 		$memberContext[$user] += array(
1430
-			'username_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['member_name'] .'</span>',
1431
-			'name_color' => '<span '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>'. $profile['real_name'] .'</span>',
1432
-			'link_color' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" '. (!empty($profile['member_group_color']) ? 'style="color:'. $profile['member_group_color'] .';"' : '') .'>' . $profile['real_name'] . '</a>',
1430
+			'username_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['member_name'] . '</span>',
1431
+			'name_color' => '<span ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</span>',
1432
+			'link_color' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '" ' . (!empty($profile['member_group_color']) ? 'style="color:' . $profile['member_group_color'] . ';"' : '') . '>' . $profile['real_name'] . '</a>',
1433 1433
 			'is_buddy' => $profile['buddy'],
1434 1434
 			'is_reverse_buddy' => in_array($user_info['id'], $buddy_list),
1435 1435
 			'buddies' => $buddy_list,
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 		if (!empty($image))
1500 1500
 			$memberContext[$user]['avatar'] = array(
1501 1501
 				'name' => $profile['avatar'],
1502
-				'image' => '<img class="avatar" src="' . $image . '" alt="avatar_'. $profile['member_name'].'">',
1502
+				'image' => '<img class="avatar" src="' . $image . '" alt="avatar_' . $profile['member_name'] . '">',
1503 1503
 				'href' => $image,
1504 1504
 				'url' => $image,
1505 1505
 			);
@@ -2826,7 +2826,7 @@  discard block
 block discarded – undo
2826 2826
 					$langName = $smcFunc['ucwords'](strtr($matches[1], array('_' => ' ')));
2827 2827
 
2828 2828
 					// Get the line we need.
2829
-					$fp = @fopen($language_dir .'/'. $entry);
2829
+					$fp = @fopen($language_dir . '/' . $entry);
2830 2830
 
2831 2831
 					// Yay!
2832 2832
 					if ($fp)
@@ -3476,7 +3476,7 @@  discard block
 block discarded – undo
3476 3476
 	$port = 0;
3477 3477
 
3478 3478
 	// Normal host names do not contain slashes, while e.g. unix sockets do. Assume alternative transport pipe with port 0.
3479
-	if(strpos($server,'/') !== false)
3479
+	if (strpos($server, '/') !== false)
3480 3480
 		$host = $server;
3481 3481
 	else
3482 3482
 	{
Please login to merge, or discard this patch.
Sources/Subs-Password.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 				return null;
49 49
 			}
50 50
 			if (PasswordCompat\binary\_strlen($password) > 72) {
51
-				$password = PasswordCompat\binary\_substr($password, 0,72);
51
+				$password = PasswordCompat\binary\_substr($password, 0, 72);
52 52
 			}
53 53
 			$resultLength = 0;
54 54
 			switch ($algo) {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 				return false;
237 237
 			}
238 238
 			if (PasswordCompat\binary\_strlen($password) > 72) {
239
-				$password = PasswordCompat\binary\_substr($password, 0,72);
239
+				$password = PasswordCompat\binary\_substr($password, 0, 72);
240 240
 			}
241 241
 			$ret = crypt($password, $hash);
242 242
 			if (!is_string($ret) || PasswordCompat\binary\_strlen($ret) != PasswordCompat\binary\_strlen($hash) || PasswordCompat\binary\_strlen($ret) <= 13) {
Please login to merge, or discard this patch.
Sources/ManageMembergroups.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 					'value' => $txt['membergroups_name'],
102 102
 				),
103 103
 				'data' => array(
104
-					'function' => function ($rowData) use ($scripturl)
104
+					'function' => function($rowData) use ($scripturl)
105 105
 					{
106 106
 						// Since the moderator group has no explicit members, no link is needed.
107 107
 						if ($rowData['id_group'] == 3)
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 					'class' => 'centercol',
145 145
 				),
146 146
 				'data' => array(
147
-					'function' => function ($rowData) use ($txt)
147
+					'function' => function($rowData) use ($txt)
148 148
 					{
149 149
 						// No explicit members for the moderator group.
150 150
 						return $rowData['id_group'] == 3 ? $txt['membergroups_guests_na'] : comma_format($rowData['num_members']);
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 					'value' => $txt['membergroups_name'],
211 211
 				),
212 212
 				'data' => array(
213
-					'function' => function ($rowData) use ($scripturl)
213
+					'function' => function($rowData) use ($scripturl)
214 214
 					{
215 215
 						$colorStyle = empty($rowData['online_color']) ? '' : sprintf(' style="color: %1$s;"', $rowData['online_color']);
216 216
 						return sprintf('<a href="%1$s?action=moderate;area=viewgroups;sa=members;group=%2$d"%3$s>%4$s</a>', $scripturl, $rowData['id_group'], $colorStyle, $rowData['group_name']);
Please login to merge, or discard this patch.
Sources/Profile-Actions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 					'style' => 'width: 20%;',
303 303
 				),
304 304
 				'data' => array(
305
-					'function' => function ($warning)
305
+					'function' => function($warning)
306 306
 					{
307 307
 						return $warning['issuer']['link'];
308 308
 					},
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 					'value' => $txt['profile_warning_previous_reason'],
331 331
 				),
332 332
 				'data' => array(
333
-					'function' => function ($warning) use ($scripturl, $txt)
333
+					'function' => function($warning) use ($scripturl, $txt)
334 334
 					{
335 335
 						$ret = '
336 336
 						<div class="floatleft">
Please login to merge, or discard this patch.
Sources/tasks/GroupAct-Notify.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
 			// Same as for approving, kind of.
104 104
 			foreach ($affected_users as $user)
105 105
 			{
106
-				$pref = !empty($prefs[$user['member_id']]['groupr_' . $pref_name]) ? $prefs[$user['member_id']]['groupr_'. $pref_name] : 0;
106
+				$pref = !empty($prefs[$user['member_id']]['groupr_' . $pref_name]) ? $prefs[$user['member_id']]['groupr_' . $pref_name] : 0;
107 107
 				$custom_reason = isset($this->_details['reason']) && isset($this->_details['reason'][$user['rid']]) ? $this->_details['reason'][$user['rid']] : '';
108 108
 
109 109
 				if ($pref & 0x01)
Please login to merge, or discard this patch.
Sources/PersonalMessage.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 					FROM {db_prefix}pm_recipients AS pmr' . ($context['display_mode'] == 2 ? '
620 620
 						INNER JOIN {db_prefix}personal_messages AS pm ON (pm.id_pm = pmr.id_pm)' : '') . $labelJoin . '
621 621
 					WHERE pmr.id_member = {int:current_member}
622
-						AND pmr.deleted = {int:not_deleted}' . $labelQuery .  $labelQuery2 . '
622
+						AND pmr.deleted = {int:not_deleted}' . $labelQuery . $labelQuery2 . '
623 623
 						AND pmr.id_pm ' . ($descending ? '>' : '<') . ' {int:id_pm}',
624 624
 					array(
625 625
 						'current_member' => $user_info['id'],
@@ -682,12 +682,12 @@  discard block
 block discarded – undo
682 682
 				INNER JOIN {db_prefix}pm_recipients AS pmr ON (pmr.id_pm = pm.id_pm
683 683
 					AND pmr.id_member = {int:current_member}
684 684
 					AND pmr.deleted = {int:deleted_by}
685
-					' . $labelQuery . ')') . $labelJoin . ($context['sort_by'] == 'name' ? ( '
685
+					' . $labelQuery . ')') . $labelJoin . ($context['sort_by'] == 'name' ? ('
686 686
 				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = {raw:pm_member})') : '') . '
687 687
 				WHERE ' . ($context['folder'] == 'sent' ? 'pm.id_member_from = {int:current_member}
688 688
 					AND pm.deleted_by_sender = {int:deleted_by}' : '1=1') . (empty($pmsg) ? '' : '
689 689
 					AND pm.id_pm = {int:pmsg}') . $labelQuery2 . '
690
-				GROUP BY pm.id_pm_head'.($_GET['sort'] != 'pm.id_pm' ? ','.$_GET['sort'] : '').'
690
+				GROUP BY pm.id_pm_head'.($_GET['sort'] != 'pm.id_pm' ? ',' . $_GET['sort'] : '') . '
691 691
 				ORDER BY ' . ($_GET['sort'] == 'pm.id_pm' && $context['folder'] != 'sent' ? 'id_pm' : '{raw:sort}') . ($descending ? ' DESC' : ' ASC') . (empty($_GET['pmsg']) ? '
692 692
 				LIMIT ' . $_GET['start'] . ', ' . $maxPerPage : ''),
693 693
 				array(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 				INNER JOIN {db_prefix}pm_recipients AS pmr ON (pmr.id_pm = pm.id_pm
712 712
 					AND pmr.id_member = {int:current_member}
713 713
 					AND pmr.deleted = {int:is_deleted}
714
-					' . $labelQuery . ')') . $labelJoin . ($context['sort_by'] == 'name' ? ( '
714
+					' . $labelQuery . ')') . $labelJoin . ($context['sort_by'] == 'name' ? ('
715 715
 				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = {raw:pm_member})') : '') . '
716 716
 			WHERE ' . ($context['folder'] == 'sent' ? 'pm.id_member_from = {raw:current_member}
717 717
 				AND pm.deleted_by_sender = {int:is_deleted}' : '1=1') . (empty($pmsg) ? '' : '
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 					)
849 849
 				);
850 850
 
851
-				while($row2 = $smcFunc['db_fetch_assoc']($request2))
851
+				while ($row2 = $smcFunc['db_fetch_assoc']($request2))
852 852
 				{
853 853
 					$l_id = $row2['id_label'];
854 854
 					if (isset($context['labels'][$l_id]))
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 					)
1627 1627
 				);
1628 1628
 
1629
-				while($row2 = $smcFunc['db_fetch_assoc']($request2))
1629
+				while ($row2 = $smcFunc['db_fetch_assoc']($request2))
1630 1630
 				{
1631 1631
 					$l_id = $row2['id_label'];
1632 1632
 					if (isset($context['labels'][$l_id]))
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
 	// Editing a specific one?
3724 3724
 	if (isset($_GET['add']))
3725 3725
 	{
3726
-		$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']])? (int) $_GET['rid'] : 0;
3726
+		$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']]) ? (int) $_GET['rid'] : 0;
3727 3727
 		$context['sub_template'] = 'add_rule';
3728 3728
 
3729 3729
 		// Current rule information...
@@ -3764,7 +3764,7 @@  discard block
 block discarded – undo
3764 3764
 	elseif (isset($_GET['save']))
3765 3765
 	{
3766 3766
 		checkSession();
3767
-		$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']])? (int) $_GET['rid'] : 0;
3767
+		$context['rid'] = isset($_GET['rid']) && isset($context['rules'][$_GET['rid']]) ? (int) $_GET['rid'] : 0;
3768 3768
 
3769 3769
 		// Name is easy!
3770 3770
 		$ruleName = $smcFunc['htmlspecialchars'](trim($_POST['rule_name']));
Please login to merge, or discard this patch.
Sources/DbPackages-mysql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	// Righty - let's do the damn thing!
126 126
 	$table_query = 'CREATE TABLE ' . $table_name . "\n" . '(';
127 127
 	foreach ($columns as $column)
128
-		$table_query .= "\n\t" . smf_db_create_query_column($column)  . ',';
128
+		$table_query .= "\n\t" . smf_db_create_query_column($column) . ',';
129 129
 
130 130
 	// Loop through the indexes next...
131 131
 	foreach ($indexes as $index)
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 		$type = $type . '(' . $size . ')';
745 745
 
746 746
 	// Now just put it together!
747
-	return '`' .$column['name'] . '` ' . $type . ' ' . (!empty($unsigned) ? $unsigned : '') . (!empty($column['null']) ? '' : 'NOT NULL') . ' ' . $default;
747
+	return '`' . $column['name'] . '` ' . $type . ' ' . (!empty($unsigned) ? $unsigned : '') . (!empty($column['null']) ? '' : 'NOT NULL') . ' ' . $default;
748 748
 }
749 749
 
750 750
 ?>
751 751
\ No newline at end of file
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);
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 
550 550
 	// Log the error.
551 551
 	if (function_exists('log_error'))
552
-		log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n" .$db_string : ''), 'database', $file, $line);
552
+		log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n" . $db_string : ''), 'database', $file, $line);
553 553
 
554 554
 	// Nothing's defined yet... just die with it.
555 555
 	if (empty($context) || empty($txt))
@@ -685,31 +685,31 @@  discard block
 block discarded – undo
685 685
 		static $pg_version;
686 686
 		static $replace_support;
687 687
 
688
-		if(empty($pg_version))
688
+		if (empty($pg_version))
689 689
 		{
690 690
 			db_extend();
691 691
 			//pg 9.5 got replace support
692 692
 			$pg_version = $smcFunc['db_get_version']();
693 693
 			// if we got a Beta Version
694 694
 			if (stripos($pg_version, 'beta') !== false)
695
-				$pg_version = substr($pg_version, 0, stripos($pg_version, 'beta')).'.0';
695
+				$pg_version = substr($pg_version, 0, stripos($pg_version, 'beta')) . '.0';
696 696
 			// or RC
697 697
 			if (stripos($pg_version, 'rc') !== false)
698
-				$pg_version = substr($pg_version, 0, stripos($pg_version, 'rc')).'.0';
698
+				$pg_version = substr($pg_version, 0, stripos($pg_version, 'rc')) . '.0';
699 699
 
700
-			$replace_support = (version_compare($pg_version,'9.5.0','>=') ? true : false);
700
+			$replace_support = (version_compare($pg_version, '9.5.0', '>=') ? true : false);
701 701
 		}
702 702
 
703 703
 		$count = 0;
704 704
 		$where = '';
705 705
 		$count_pk = 0;
706 706
 
707
-		If($replace_support)
707
+		If ($replace_support)
708 708
 		{
709 709
 			foreach ($columns as $columnName => $type)
710 710
 			{
711 711
 				//check pk fiel
712
-				IF(in_array($columnName, $keys))
712
+				IF (in_array($columnName, $keys))
713 713
 				{
714 714
 					$key_str .= ($count_pk > 0 ? ',' : '');
715 715
 					$key_str .= $columnName;
@@ -718,11 +718,11 @@  discard block
 block discarded – undo
718 718
 				else //normal field
719 719
 				{
720 720
 					$col_str .= ($count > 0 ? ',' : '');
721
-					$col_str .= $columnName.' = EXCLUDED.'.$columnName;
721
+					$col_str .= $columnName . ' = EXCLUDED.' . $columnName;
722 722
 					$count++;
723 723
 				}
724 724
 			}
725
-			$replace = ' ON CONFLICT ('.$key_str.') DO UPDATE SET '.$col_str;
725
+			$replace = ' ON CONFLICT (' . $key_str . ') DO UPDATE SET ' . $col_str;
726 726
 		}
727 727
 		else
728 728
 		{
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 			$smcFunc['db_query']('', '
783 783
 				INSERT INTO ' . $table . '("' . implode('", "', $indexed_columns) . '")
784 784
 				VALUES
785
-					' . $entry.$replace,
785
+					' . $entry . $replace,
786 786
 				array(
787 787
 					'security_override' => true,
788 788
 					'db_error_skip' => $method == 'ignore' || $table === $db_prefix . 'log_errors',
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
  * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
878 878
  * @return string The escaped string
879 879
  */
880
-function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
880
+function smf_db_escape_wildcard_string($string, $translate_human_wildcards = false)
881 881
 {
882 882
 	$replacements = array(
883 883
 		'%' => '\%',
Please login to merge, or discard this patch.
Sources/Drafts.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				locked = {int:locked},
86 86
 				is_sticky = {int:is_sticky}
87 87
 			WHERE id_draft = {int:id_draft}',
88
-			array (
88
+			array(
89 89
 				'id_topic' => $topic_id,
90 90
 				'id_board' => $board,
91 91
 				'poster_time' => time(),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		DELETE FROM {db_prefix}user_drafts
411 411
 		WHERE id_draft IN ({array_int:id_draft})' . ($check ? '
412 412
 			AND  id_member = {int:id_member}' : ''),
413
-		array (
413
+		array(
414 414
 			'id_draft' => $id_draft,
415 415
 			'id_member' => empty($user_info['id']) ? -1 : $user_info['id'],
416 416
 		)
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 			$context['drafts'][] = array(
472 472
 				'subject' => censorText(shorten_subject(stripslashes($row['subject']), 24)),
473 473
 				'poster_time' => timeformat($row['poster_time']),
474
-				'link' => '<a href="' . $scripturl . '?action=post;board=' . $row['id_board'] . ';' . (!empty($row['id_topic']) ? 'topic='. $row['id_topic'] .'.0;' : '') . 'id_draft=' . $row['id_draft'] . '">' . $row['subject'] . '</a>',
474
+				'link' => '<a href="' . $scripturl . '?action=post;board=' . $row['id_board'] . ';' . (!empty($row['id_topic']) ? 'topic=' . $row['id_topic'] . '.0;' : '') . 'id_draft=' . $row['id_draft'] . '">' . $row['subject'] . '</a>',
475 475
 			);
476 476
 		// PM drafts
477 477
 		elseif ($draft_type === 1)
Please login to merge, or discard this patch.