Completed
Push — release-2.1 ( 4ddcf6...08e8aa )
by Mathias
06:28
created
Sources/random_compat/byte_safe_strings.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -27,169 +27,169 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!is_callable('RandomCompat_strlen')) {
30
-    if (
31
-        defined('MB_OVERLOAD_STRING')
32
-            &&
33
-        ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
34
-    ) {
35
-        /**
36
-         * strlen() implementation that isn't brittle to mbstring.func_overload
37
-         *
38
-         * This version uses mb_strlen() in '8bit' mode to treat strings as raw
39
-         * binary rather than UTF-8, ISO-8859-1, etc
40
-         *
41
-         * @param string $binary_string
42
-         *
43
-         * @throws TypeError
44
-         *
45
-         * @return int
46
-         */
47
-        function RandomCompat_strlen($binary_string)
48
-        {
49
-            if (!is_string($binary_string)) {
50
-                throw new TypeError(
51
-                    'RandomCompat_strlen() expects a string'
52
-                );
53
-            }
30
+	if (
31
+		defined('MB_OVERLOAD_STRING')
32
+			&&
33
+		((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
34
+	) {
35
+		/**
36
+		 * strlen() implementation that isn't brittle to mbstring.func_overload
37
+		 *
38
+		 * This version uses mb_strlen() in '8bit' mode to treat strings as raw
39
+		 * binary rather than UTF-8, ISO-8859-1, etc
40
+		 *
41
+		 * @param string $binary_string
42
+		 *
43
+		 * @throws TypeError
44
+		 *
45
+		 * @return int
46
+		 */
47
+		function RandomCompat_strlen($binary_string)
48
+		{
49
+			if (!is_string($binary_string)) {
50
+				throw new TypeError(
51
+					'RandomCompat_strlen() expects a string'
52
+				);
53
+			}
54 54
 
55
-            return (int) mb_strlen($binary_string, '8bit');
56
-        }
55
+			return (int) mb_strlen($binary_string, '8bit');
56
+		}
57 57
 
58
-    } else {
59
-        /**
60
-         * strlen() implementation that isn't brittle to mbstring.func_overload
61
-         *
62
-         * This version just used the default strlen()
63
-         *
64
-         * @param string $binary_string
65
-         *
66
-         * @throws TypeError
67
-         *
68
-         * @return int
69
-         */
70
-        function RandomCompat_strlen($binary_string)
71
-        {
72
-            if (!is_string($binary_string)) {
73
-                throw new TypeError(
74
-                    'RandomCompat_strlen() expects a string'
75
-                );
76
-            }
77
-            return (int) strlen($binary_string);
78
-        }
79
-    }
58
+	} else {
59
+		/**
60
+		 * strlen() implementation that isn't brittle to mbstring.func_overload
61
+		 *
62
+		 * This version just used the default strlen()
63
+		 *
64
+		 * @param string $binary_string
65
+		 *
66
+		 * @throws TypeError
67
+		 *
68
+		 * @return int
69
+		 */
70
+		function RandomCompat_strlen($binary_string)
71
+		{
72
+			if (!is_string($binary_string)) {
73
+				throw new TypeError(
74
+					'RandomCompat_strlen() expects a string'
75
+				);
76
+			}
77
+			return (int) strlen($binary_string);
78
+		}
79
+	}
80 80
 }
81 81
 
82 82
 if (!is_callable('RandomCompat_substr')) {
83 83
 
84
-    if (
85
-        defined('MB_OVERLOAD_STRING')
86
-            &&
87
-        ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
88
-    ) {
89
-        /**
90
-         * substr() implementation that isn't brittle to mbstring.func_overload
91
-         *
92
-         * This version uses mb_substr() in '8bit' mode to treat strings as raw
93
-         * binary rather than UTF-8, ISO-8859-1, etc
94
-         *
95
-         * @param string $binary_string
96
-         * @param int $start
97
-         * @param int|null $length (optional)
98
-         *
99
-         * @throws TypeError
100
-         *
101
-         * @return string
102
-         */
103
-        function RandomCompat_substr($binary_string, $start, $length = null)
104
-        {
105
-            if (!is_string($binary_string)) {
106
-                throw new TypeError(
107
-                    'RandomCompat_substr(): First argument should be a string'
108
-                );
109
-            }
84
+	if (
85
+		defined('MB_OVERLOAD_STRING')
86
+			&&
87
+		((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING
88
+	) {
89
+		/**
90
+		 * substr() implementation that isn't brittle to mbstring.func_overload
91
+		 *
92
+		 * This version uses mb_substr() in '8bit' mode to treat strings as raw
93
+		 * binary rather than UTF-8, ISO-8859-1, etc
94
+		 *
95
+		 * @param string $binary_string
96
+		 * @param int $start
97
+		 * @param int|null $length (optional)
98
+		 *
99
+		 * @throws TypeError
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function RandomCompat_substr($binary_string, $start, $length = null)
104
+		{
105
+			if (!is_string($binary_string)) {
106
+				throw new TypeError(
107
+					'RandomCompat_substr(): First argument should be a string'
108
+				);
109
+			}
110 110
 
111
-            if (!is_int($start)) {
112
-                throw new TypeError(
113
-                    'RandomCompat_substr(): Second argument should be an integer'
114
-                );
115
-            }
111
+			if (!is_int($start)) {
112
+				throw new TypeError(
113
+					'RandomCompat_substr(): Second argument should be an integer'
114
+				);
115
+			}
116 116
 
117
-            if ($length === null) {
118
-                /**
119
-                 * mb_substr($str, 0, NULL, '8bit') returns an empty string on
120
-                 * PHP 5.3, so we have to find the length ourselves.
121
-                 */
122
-                /** @var int $length */
123
-                $length = RandomCompat_strlen($binary_string) - $start;
124
-            } elseif (!is_int($length)) {
125
-                throw new TypeError(
126
-                    'RandomCompat_substr(): Third argument should be an integer, or omitted'
127
-                );
128
-            }
117
+			if ($length === null) {
118
+				/**
119
+				 * mb_substr($str, 0, NULL, '8bit') returns an empty string on
120
+				 * PHP 5.3, so we have to find the length ourselves.
121
+				 */
122
+				/** @var int $length */
123
+				$length = RandomCompat_strlen($binary_string) - $start;
124
+			} elseif (!is_int($length)) {
125
+				throw new TypeError(
126
+					'RandomCompat_substr(): Third argument should be an integer, or omitted'
127
+				);
128
+			}
129 129
 
130
-            // Consistency with PHP's behavior
131
-            if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
132
-                return '';
133
-            }
134
-            if ($start > RandomCompat_strlen($binary_string)) {
135
-                return '';
136
-            }
130
+			// Consistency with PHP's behavior
131
+			if ($start === RandomCompat_strlen($binary_string) && $length === 0) {
132
+				return '';
133
+			}
134
+			if ($start > RandomCompat_strlen($binary_string)) {
135
+				return '';
136
+			}
137 137
 
138
-            return (string) mb_substr(
139
-                (string) $binary_string,
140
-                (int) $start,
141
-                (int) $length,
142
-                '8bit'
143
-            );
144
-        }
138
+			return (string) mb_substr(
139
+				(string) $binary_string,
140
+				(int) $start,
141
+				(int) $length,
142
+				'8bit'
143
+			);
144
+		}
145 145
 
146
-    } else {
146
+	} else {
147 147
 
148
-        /**
149
-         * substr() implementation that isn't brittle to mbstring.func_overload
150
-         *
151
-         * This version just uses the default substr()
152
-         *
153
-         * @param string $binary_string
154
-         * @param int $start
155
-         * @param int|null $length (optional)
156
-         *
157
-         * @throws TypeError
158
-         *
159
-         * @return string
160
-         */
161
-        function RandomCompat_substr($binary_string, $start, $length = null)
162
-        {
163
-            if (!is_string($binary_string)) {
164
-                throw new TypeError(
165
-                    'RandomCompat_substr(): First argument should be a string'
166
-                );
167
-            }
148
+		/**
149
+		 * substr() implementation that isn't brittle to mbstring.func_overload
150
+		 *
151
+		 * This version just uses the default substr()
152
+		 *
153
+		 * @param string $binary_string
154
+		 * @param int $start
155
+		 * @param int|null $length (optional)
156
+		 *
157
+		 * @throws TypeError
158
+		 *
159
+		 * @return string
160
+		 */
161
+		function RandomCompat_substr($binary_string, $start, $length = null)
162
+		{
163
+			if (!is_string($binary_string)) {
164
+				throw new TypeError(
165
+					'RandomCompat_substr(): First argument should be a string'
166
+				);
167
+			}
168 168
 
169
-            if (!is_int($start)) {
170
-                throw new TypeError(
171
-                    'RandomCompat_substr(): Second argument should be an integer'
172
-                );
173
-            }
169
+			if (!is_int($start)) {
170
+				throw new TypeError(
171
+					'RandomCompat_substr(): Second argument should be an integer'
172
+				);
173
+			}
174 174
 
175
-            if ($length !== null) {
176
-                if (!is_int($length)) {
177
-                    throw new TypeError(
178
-                        'RandomCompat_substr(): Third argument should be an integer, or omitted'
179
-                    );
180
-                }
175
+			if ($length !== null) {
176
+				if (!is_int($length)) {
177
+					throw new TypeError(
178
+						'RandomCompat_substr(): Third argument should be an integer, or omitted'
179
+					);
180
+				}
181 181
 
182
-                return (string) substr(
183
-                    (string )$binary_string,
184
-                    (int) $start,
185
-                    (int) $length
186
-                );
187
-            }
182
+				return (string) substr(
183
+					(string )$binary_string,
184
+					(int) $start,
185
+					(int) $length
186
+				);
187
+			}
188 188
 
189
-            return (string) substr(
190
-                (string) $binary_string,
191
-                (int) $start
192
-            );
193
-        }
194
-    }
189
+			return (string) substr(
190
+				(string) $binary_string,
191
+				(int) $start
192
+			);
193
+		}
194
+	}
195 195
 }
Please login to merge, or discard this patch.
Sources/tasks/CreatePost-Notify.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 {
20 20
 	/**
21 21
 	 * Constants for reply types.
22
-	*/
22
+	 */
23 23
 	const NOTIFY_TYPE_REPLY_AND_MODIFY = 1;
24 24
 	const NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING = 2;
25 25
 	const NOTIFY_TYPE_ONLY_REPLIES = 3;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	/**
29 29
 	 * Constants for frequencies.
30
-	*/
30
+	 */
31 31
 	const FREQUENCY_NOTHING = 0;
32 32
 	const FREQUENCY_EVERYTHING = 1;
33 33
 	const FREQUENCY_FIRST_UNREAD_MSG = 2;
Please login to merge, or discard this patch.
cron.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -310,7 +310,7 @@
 block discarded – undo
310 310
 {
311 311
 	/**
312 312
 	 * Constants for notification types.
313
-	*/
313
+	 */
314 314
 	const RECEIVE_NOTIFY_EMAIL = 0x02;
315 315
 	const RECEIVE_NOTIFY_ALERT = 0x01;
316 316
 
Please login to merge, or discard this patch.
Sources/News.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2169,7 +2169,7 @@
 block discarded – undo
2169 2169
 			{
2170 2170
 				uasort($loaded_attachments, function($a, $b) {
2171 2171
 					if ($a['filesize'] == $b['filesize'])
2172
-					        return 0;
2172
+							return 0;
2173 2173
 					return ($a['filesize'] < $b['filesize']) ? -1 : 1;
2174 2174
 				});
2175 2175
 			}
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7239,32 +7239,32 @@  discard block
 block discarded – undo
7239 7239
  */
7240 7240
 function truncate_array($array, $max_length = 1900, $deep = 3)
7241 7241
 {
7242
-    $array = (array) $array;
7242
+	$array = (array) $array;
7243 7243
 
7244
-    $curr_length = array_length($array, $deep);
7244
+	$curr_length = array_length($array, $deep);
7245 7245
 
7246
-    if ($curr_length <= $max_length)
7247
-        return $array;
7246
+	if ($curr_length <= $max_length)
7247
+		return $array;
7248 7248
 
7249
-    else
7250
-    {
7251
-        // Truncate each element's value to a reasonable length
7252
-        $param_max = floor($max_length / count($array));
7249
+	else
7250
+	{
7251
+		// Truncate each element's value to a reasonable length
7252
+		$param_max = floor($max_length / count($array));
7253 7253
 
7254
-        $current_deep = $deep - 1;
7254
+		$current_deep = $deep - 1;
7255 7255
 
7256
-        foreach ($array as $key => &$value)
7257
-        {
7258
-            if (is_array($value))
7259
-                if ($current_deep > 0)
7260
-                    $value = truncate_array($value, $current_deep);
7256
+		foreach ($array as $key => &$value)
7257
+		{
7258
+			if (is_array($value))
7259
+				if ($current_deep > 0)
7260
+					$value = truncate_array($value, $current_deep);
7261 7261
 
7262
-            else
7263
-                $value = substr($value, 0, $param_max - strlen($key) - 5);
7264
-        }
7262
+			else
7263
+				$value = substr($value, 0, $param_max - strlen($key) - 5);
7264
+		}
7265 7265
 
7266
-        return $array;
7267
-    }
7266
+		return $array;
7267
+	}
7268 7268
 }
7269 7269
 
7270 7270
 /**
@@ -7275,29 +7275,29 @@  discard block
 block discarded – undo
7275 7275
  */
7276 7276
 function array_length($array, $deep = 3)
7277 7277
 {
7278
-    // Work with arrays
7279
-    $array = (array) $array;
7280
-    $length = 0;
7278
+	// Work with arrays
7279
+	$array = (array) $array;
7280
+	$length = 0;
7281 7281
 
7282
-    $deep_count = $deep - 1;
7282
+	$deep_count = $deep - 1;
7283 7283
 
7284
-    foreach ($array as $value)
7285
-    {
7286
-        // Recursive?
7287
-        if (is_array($value))
7288
-        {
7289
-            // No can't do
7290
-            if ($deep_count <= 0)
7291
-                continue;
7284
+	foreach ($array as $value)
7285
+	{
7286
+		// Recursive?
7287
+		if (is_array($value))
7288
+		{
7289
+			// No can't do
7290
+			if ($deep_count <= 0)
7291
+				continue;
7292 7292
 
7293
-            $length += array_length($value, $deep_count);
7294
-        }
7293
+			$length += array_length($value, $deep_count);
7294
+		}
7295 7295
 
7296
-        else
7297
-            $length += strlen($value);
7298
-    }
7296
+		else
7297
+			$length += strlen($value);
7298
+	}
7299 7299
 
7300
-    return $length;
7300
+	return $length;
7301 7301
 }
7302 7302
 
7303 7303
 /**
Please login to merge, or discard this patch.