Passed
Push — release-2.1 ( f28109...493a4c )
by Mathias
06:40
created
Sources/ManageServer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1638,7 +1638,7 @@
 block discarded – undo
1638 1638
 	$cacheAPIdir = $sourcedir . '/Cache';
1639 1639
 
1640 1640
 	$loadedApis = array();
1641
-	$apis_dir = $cacheAPIdir .'/'. CacheApi::APIS_FOLDER;
1641
+	$apis_dir = $cacheAPIdir . '/' . CacheApi::APIS_FOLDER;
1642 1642
 
1643 1643
 	$api_classes = new GlobIterator($apis_dir . '/*.php', FilesystemIterator::NEW_CURRENT_AND_KEY);
1644 1644
 
Please login to merge, or discard this patch.
Braces   -1 removed lines patch added patch discarded remove patch
@@ -707,7 +707,6 @@
 block discarded – undo
707 707
 		$cache_level = array($txt['cache_off']);
708 708
 		$apis_names['none'] = $txt['cache_off'];
709 709
 	}
710
-
711 710
 	else
712 711
 	{
713 712
 		$txt['cache_settings_message'] = '<strong class="success">' .
Please login to merge, or discard this patch.
Sources/Cache/APIs/FileBased.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		$class_name = $this->getImplementationClassKeyName();
185 185
 		$class_name_txt_key = strtolower($class_name);
186 186
 
187
-		$config_vars[] = $txt['cache_'. $class_name_txt_key .'_settings'];
187
+		$config_vars[] = $txt['cache_' . $class_name_txt_key . '_settings'];
188 188
 		$config_vars[] = array('cachedir', $txt['cachedir'], 'file', 'text', 36, 'cache_cachedir');
189 189
 
190 190
 		if (!isset($context['settings_post_javascript']))
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$context['settings_post_javascript'] .= '
194 194
 			$("#cache_accelerator").change(function (e) {
195 195
 				var cache_type = e.currentTarget.value;
196
-				$("#cachedir").prop("disabled", cache_type != "'. $class_name .'");
196
+				$("#cachedir").prop("disabled", cache_type != "'. $class_name . '");
197 197
 			});';
198 198
 	}
199 199
 
Please login to merge, or discard this patch.
Braces   -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,6 @@
 block discarded – undo
128 128
 
129 129
 				return false;
130 130
 			}
131
-
132 131
 			else
133 132
 				return true;
134 133
 		}
Please login to merge, or discard this patch.
Sources/Cache/APIs/MemcachedImplementation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 		$class_name = $this->getImplementationClassKeyName();
170 170
 		$class_name_txt_key = strtolower($class_name);
171 171
 
172
-		$config_vars[] = $txt['cache_'. $class_name_txt_key .'_settings'];
172
+		$config_vars[] = $txt['cache_' . $class_name_txt_key . '_settings'];
173 173
 		$config_vars[] = array(
174 174
 			self::CLASS_KEY,
175
-			$txt['cache_'. $class_name_txt_key .'_servers'],
175
+			$txt['cache_' . $class_name_txt_key . '_servers'],
176 176
 			'file',
177 177
 			'text',
178 178
 			0,
179
-			'cache_'. $class_name_txt_key,
180
-			'subtext' => $txt['cache_'. $class_name_txt_key .'_servers_subtext']);
179
+			'cache_' . $class_name_txt_key,
180
+			'subtext' => $txt['cache_' . $class_name_txt_key . '_servers_subtext']);
181 181
 
182 182
 		if (!isset($context['settings_post_javascript']))
183 183
 			$context['settings_post_javascript'] = '';
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		$context['settings_post_javascript'] .= '
186 186
 			$("#cache_accelerator").change(function (e) {
187 187
 				var cache_type = e.currentTarget.value;
188
-				$("#'. self::CLASS_KEY .'").prop("disabled", cache_type != "'. $class_name .'");
188
+				$("#'. self::CLASS_KEY . '").prop("disabled", cache_type != "' . $class_name . '");
189 189
 			});';
190 190
 	}
191 191
 
Please login to merge, or discard this patch.
Sources/Cache/APIs/Sqlite.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 		$class_name = $this->getImplementationClassKeyName();
132 132
 		$class_name_txt_key = strtolower($class_name);
133 133
 
134
-		$config_vars[] = $txt['cache_'. $class_name_txt_key .'_settings'];
134
+		$config_vars[] = $txt['cache_' . $class_name_txt_key . '_settings'];
135 135
 		$config_vars[] = array(
136
-			'cachedir_'. $class_name_txt_key,
137
-			$txt['cachedir_'. $class_name_txt_key],
136
+			'cachedir_' . $class_name_txt_key,
137
+			$txt['cachedir_' . $class_name_txt_key],
138 138
 			'file',
139 139
 			'text',
140 140
 			36,
141
-			'cache_'. $class_name_txt_key .'_cachedir');
141
+			'cache_' . $class_name_txt_key . '_cachedir');
142 142
 
143 143
 		if (!isset($context['settings_post_javascript']))
144 144
 			$context['settings_post_javascript'] = '';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$context['settings_post_javascript'] .= '
147 147
 			$("#cache_accelerator").change(function (e) {
148 148
 				var cache_type = e.currentTarget.value;
149
-				$("#cachedir_'. $class_name_txt_key .'").prop("disabled", cache_type != "'. $class_name .'");
149
+				$("#cachedir_'. $class_name_txt_key . '").prop("disabled", cache_type != "' . $class_name . '");
150 150
 			});';
151 151
 	}
152 152
 
Please login to merge, or discard this patch.
Sources/Cache/APIs/MemcacheImplementation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 		$class_name = $this->getImplementationClassKeyName();
153 153
 		$class_name_txt_key = strtolower($class_name);
154 154
 
155
-		$config_vars[] = $txt['cache_'. $class_name_txt_key .'_settings'];
155
+		$config_vars[] = $txt['cache_' . $class_name_txt_key . '_settings'];
156 156
 		$config_vars[] = array(
157 157
 			self::CLASS_KEY,
158
-			$txt['cache_'. $class_name_txt_key .'_servers'],
158
+			$txt['cache_' . $class_name_txt_key . '_servers'],
159 159
 			'file',
160 160
 			'text',
161 161
 			0,
162
-			'cache_'. $class_name_txt_key,
163
-			'subtext' => $txt['cache_'. $class_name_txt_key .'_servers_subtext']);
162
+			'cache_' . $class_name_txt_key,
163
+			'subtext' => $txt['cache_' . $class_name_txt_key . '_servers_subtext']);
164 164
 
165 165
 		if (!isset($context['settings_post_javascript']))
166 166
 			$context['settings_post_javascript'] = '';
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$context['settings_post_javascript'] .= '
169 169
 			$("#cache_accelerator").change(function (e) {
170 170
 				var cache_type = e.currentTarget.value;
171
-				$("#'. self::CLASS_KEY .'").prop("disabled", cache_type != "'. $class_name .'");
171
+				$("#'. self::CLASS_KEY . '").prop("disabled", cache_type != "' . $class_name . '");
172 172
 			});';
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
Sources/ScheduledTasks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	clean_cache();
170 170
 
171 171
 	// If warning decrement is enabled and we have people who have not had a new warning in 24 hours, lower their warning level.
172
-	list (, , $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']);
172
+	list (,, $modSettings['warning_decrement']) = explode(',', $modSettings['warning_settings']);
173 173
 	if ($modSettings['warning_decrement'])
174 174
 	{
175 175
 		// Find every member who has a warning level...
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
 	// Determine action based on last_login...
1666 1666
 	$purgeMembers = array();
1667 1667
 	$markReadMembers = array();
1668
-	foreach($members as $member)
1668
+	foreach ($members as $member)
1669 1669
 	{
1670 1670
 		if ($member['last_login'] <= $cleanupBeyond)
1671 1671
 			$purgeMembers[] = $member['id_member'];
Please login to merge, or discard this patch.
Sources/Load.php 2 patches
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2717,8 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 		$context['css_files_order'] = array();
2718 2718
 
2719 2719
 	$params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ?
2720
-		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') :
2721
-		(is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2720
+		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2722 2721
 	$params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false;
2723 2722
 	$themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme';
2724 2723
 	$params['minimize'] = isset($params['minimize']) ? $params['minimize'] : true;
@@ -2832,8 +2831,7 @@  discard block
 block discarded – undo
2832 2831
 	global $settings, $context, $modSettings;
2833 2832
 
2834 2833
 	$params['seed'] = (!array_key_exists('seed', $params) || (array_key_exists('seed', $params) && $params['seed'] === true)) ?
2835
-		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') :
2836
-		(is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2834
+		(array_key_exists('browser_cache', $context) ? $context['browser_cache'] : '') : (is_string($params['seed']) ? '?' . ltrim($params['seed'], '?') : '');
2837 2835
 	$params['force_current'] = isset($params['force_current']) ? $params['force_current'] : false;
2838 2836
 	$themeRef = !empty($params['default_theme']) ? 'default_theme' : 'theme';
2839 2837
 	$params['async'] = isset($params['async']) ? $params['async'] : false;
@@ -3573,10 +3571,10 @@  discard block
 block discarded – undo
3573 3571
 		$cacheAPI = false;
3574 3572
 
3575 3573
 	// Autoload hasn't been called yet :/
3576
-	require_once($cacheAPIdir .'/CacheApi.php');
3577
-	require_once($cacheAPIdir .'/CacheApiInterface.php');
3574
+	require_once($cacheAPIdir . '/CacheApi.php');
3575
+	require_once($cacheAPIdir . '/CacheApiInterface.php');
3578 3576
 
3579
-	$apis_dir = $cacheAPIdir .'/'. CacheApi::APIS_FOLDER;
3577
+	$apis_dir = $cacheAPIdir . '/' . CacheApi::APIS_FOLDER;
3580 3578
 
3581 3579
 	// What accelerator we are going to try.
3582 3580
 	$cache_class_name = !empty($cache_accelerator) ? $cache_accelerator : CacheApi::APIS_DEFAULT;
@@ -3588,8 +3586,7 @@  discard block
 block discarded – undo
3588 3586
 	{
3589 3587
 		require_once($file_to_load);
3590 3588
 
3591
-		$fully_qualified_class_name = !empty($overrideCache) ? $overrideCache :
3592
-			CacheApi::APIS_NAMESPACE . $cache_class_name;
3589
+		$fully_qualified_class_name = !empty($overrideCache) ? $overrideCache : CacheApi::APIS_NAMESPACE . $cache_class_name;
3593 3590
 
3594 3591
 		/* @var CacheApiInterface $cache_api */
3595 3592
 		$cache_api = new $fully_qualified_class_name();
Please login to merge, or discard this patch.
Braces   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	// Set a list of common functions.
108 108
 	$ent_list = '&(?:#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . '|quot|amp|lt|gt|nbsp);';
109 109
 	$ent_check = empty($modSettings['disableEntityCheck']) ? function($string)
110
-		{
110
+	{
111 111
 			$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
112 112
 			return $string;
113 113
 		} : function($string)
@@ -941,7 +941,6 @@  discard block
 block discarded – undo
941 941
 			$user_info_min[$row['id_member']]['time_offset'] = ($tz_user->getOffset($time_user) -
942 942
 					$tz_system->getOffset($time_system)) / 3600;
943 943
 		}
944
-
945 944
 		else
946 945
 			$user_info_min[$row['id_member']]['time_offset'] = empty($row['time_offset']) ? 0 : $row['time_offset'];
947 946
 	}
@@ -1669,7 +1668,6 @@  discard block
 block discarded – undo
1669 1668
 			$time_user = new DateTime('now', $tz_user);
1670 1669
 			$profile['time_offset'] = ($tz_user->getOffset($time_user) - $tz_system->getOffset($time_system)) / 3600;
1671 1670
 		}
1672
-
1673 1671
 		else
1674 1672
 		{
1675 1673
 			// !!! Compatibility.
@@ -2363,7 +2361,6 @@  discard block
 block discarded – undo
2363 2361
 		loadLanguage('index+Modifications');
2364 2362
 		$context['template_layers'] = array();
2365 2363
 	}
2366
-
2367 2364
 	else
2368 2365
 	{
2369 2366
 		// Custom templates to load, or just default?
@@ -3619,7 +3616,6 @@  discard block
 block discarded – undo
3619 3616
 
3620 3617
 			return $cacheAPI;
3621 3618
 		}
3622
-
3623 3619
 		else
3624 3620
 			return $cache_api;
3625 3621
 	}
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_com_dotnet.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -27,65 +27,65 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!is_callable('random_bytes')) {
30
-    /**
31
-     * Windows with PHP < 5.3.0 will not have the function
32
-     * openssl_random_pseudo_bytes() available, so let's use
33
-     * CAPICOM to work around this deficiency.
34
-     *
35
-     * @param int $bytes
36
-     *
37
-     * @throws Exception
38
-     *
39
-     * @return string
40
-     */
41
-    function random_bytes($bytes)
42
-    {
43
-        try {
44
-            /** @var int $bytes */
45
-            $bytes = RandomCompat_intval($bytes);
46
-        } catch (TypeError $ex) {
47
-            throw new TypeError(
48
-                'random_bytes(): $bytes must be an integer'
49
-            );
50
-        }
30
+	/**
31
+	 * Windows with PHP < 5.3.0 will not have the function
32
+	 * openssl_random_pseudo_bytes() available, so let's use
33
+	 * CAPICOM to work around this deficiency.
34
+	 *
35
+	 * @param int $bytes
36
+	 *
37
+	 * @throws Exception
38
+	 *
39
+	 * @return string
40
+	 */
41
+	function random_bytes($bytes)
42
+	{
43
+		try {
44
+			/** @var int $bytes */
45
+			$bytes = RandomCompat_intval($bytes);
46
+		} catch (TypeError $ex) {
47
+			throw new TypeError(
48
+				'random_bytes(): $bytes must be an integer'
49
+			);
50
+		}
51 51
 
52
-        if ($bytes < 1) {
53
-            throw new Error(
54
-                'Length must be greater than 0'
55
-            );
56
-        }
52
+		if ($bytes < 1) {
53
+			throw new Error(
54
+				'Length must be greater than 0'
55
+			);
56
+		}
57 57
 
58
-        /** @var string $buf */
59
-        $buf = '';
60
-        if (!class_exists('COM')) {
61
-            throw new Error(
62
-                'COM does not exist'
63
-            );
64
-        }
65
-        /** @var COM $util */
66
-        $util = new COM('CAPICOM.Utilities.1');
67
-        $execCount = 0;
58
+		/** @var string $buf */
59
+		$buf = '';
60
+		if (!class_exists('COM')) {
61
+			throw new Error(
62
+				'COM does not exist'
63
+			);
64
+		}
65
+		/** @var COM $util */
66
+		$util = new COM('CAPICOM.Utilities.1');
67
+		$execCount = 0;
68 68
 
69
-        /**
70
-         * Let's not let it loop forever. If we run N times and fail to
71
-         * get N bytes of random data, then CAPICOM has failed us.
72
-         */
73
-        do {
74
-            $buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
-            if (RandomCompat_strlen($buf) >= $bytes) {
76
-                /**
77
-                 * Return our random entropy buffer here:
78
-                 */
79
-                return (string) RandomCompat_substr($buf, 0, $bytes);
80
-            }
81
-            ++$execCount;
82
-        } while ($execCount < $bytes);
69
+		/**
70
+		 * Let's not let it loop forever. If we run N times and fail to
71
+		 * get N bytes of random data, then CAPICOM has failed us.
72
+		 */
73
+		do {
74
+			$buf .= base64_decode((string) $util->GetRandom($bytes, 0));
75
+			if (RandomCompat_strlen($buf) >= $bytes) {
76
+				/**
77
+				 * Return our random entropy buffer here:
78
+				 */
79
+				return (string) RandomCompat_substr($buf, 0, $bytes);
80
+			}
81
+			++$execCount;
82
+		} while ($execCount < $bytes);
83 83
 
84
-        /**
85
-         * If we reach here, PHP has failed us.
86
-         */
87
-        throw new Exception(
88
-            'Could not gather sufficient random data'
89
-        );
90
-    }
84
+		/**
85
+		 * If we reach here, PHP has failed us.
86
+		 */
87
+		throw new Exception(
88
+			'Could not gather sufficient random data'
89
+		);
90
+	}
91 91
 }
Please login to merge, or discard this patch.
Sources/random_compat/cast_to_int.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -28,50 +28,50 @@
 block discarded – undo
28 28
 
29 29
 if (!is_callable('RandomCompat_intval')) {
30 30
 
31
-    /**
32
-     * Cast to an integer if we can, safely.
33
-     *
34
-     * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
-     * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
-     * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats 
37
-     * lose precision, so the <= and => operators might accidentally let a float
38
-     * through.
39
-     *
40
-     * @param int|float $number    The number we want to convert to an int
41
-     * @param bool      $fail_open Set to true to not throw an exception
42
-     *
43
-     * @return float|int
44
-     * @psalm-suppress InvalidReturnType
45
-     *
46
-     * @throws TypeError
47
-     */
48
-    function RandomCompat_intval($number, $fail_open = false)
49
-    {
50
-        if (is_int($number) || is_float($number)) {
51
-            $number += 0;
52
-        } elseif (is_numeric($number)) {
53
-            /** @psalm-suppress InvalidOperand */
54
-            $number += 0;
55
-        }
56
-        /** @var int|float $number */
31
+	/**
32
+	 * Cast to an integer if we can, safely.
33
+	 *
34
+	 * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX)
35
+	 * (non-inclusive), it will sanely cast it to an int. If you it's equal to
36
+	 * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats 
37
+	 * lose precision, so the <= and => operators might accidentally let a float
38
+	 * through.
39
+	 *
40
+	 * @param int|float $number    The number we want to convert to an int
41
+	 * @param bool      $fail_open Set to true to not throw an exception
42
+	 *
43
+	 * @return float|int
44
+	 * @psalm-suppress InvalidReturnType
45
+	 *
46
+	 * @throws TypeError
47
+	 */
48
+	function RandomCompat_intval($number, $fail_open = false)
49
+	{
50
+		if (is_int($number) || is_float($number)) {
51
+			$number += 0;
52
+		} elseif (is_numeric($number)) {
53
+			/** @psalm-suppress InvalidOperand */
54
+			$number += 0;
55
+		}
56
+		/** @var int|float $number */
57 57
 
58
-        if (
59
-            is_float($number)
60
-                &&
61
-            $number > ~PHP_INT_MAX
62
-                &&
63
-            $number < PHP_INT_MAX
64
-        ) {
65
-            $number = (int) $number;
66
-        }
58
+		if (
59
+			is_float($number)
60
+				&&
61
+			$number > ~PHP_INT_MAX
62
+				&&
63
+			$number < PHP_INT_MAX
64
+		) {
65
+			$number = (int) $number;
66
+		}
67 67
 
68
-        if (is_int($number)) {
69
-            return (int) $number;
70
-        } elseif (!$fail_open) {
71
-            throw new TypeError(
72
-                'Expected an integer.'
73
-            );
74
-        }
75
-        return $number;
76
-    }
68
+		if (is_int($number)) {
69
+			return (int) $number;
70
+		} elseif (!$fail_open) {
71
+			throw new TypeError(
72
+				'Expected an integer.'
73
+			);
74
+		}
75
+		return $number;
76
+	}
77 77
 }
Please login to merge, or discard this patch.