Passed
Pull Request — release-2.1 (#6262)
by Jeremy
04:04
created
Themes/default/GenericList.template.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
 				),
221 221
 			),
222 222
 		);
223
-	*/
223
+	 */
224 224
 
225 225
 	// Are we using right-to-left orientation?
226 226
 	$first = $context['right_to_left'] ? 'last' : 'first';
Please login to merge, or discard this patch.
Sources/Subs-BoardIndex.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@
 block discarded – undo
419 419
 					$board['last_post']['last_post_message'] = sprintf($txt['last_post_message'], $board['last_post']['member']['link'], $board['last_post']['link'], $board['last_post']['time'] > 0 ? timeformat($board['last_post']['time']) : $txt['not_applicable']);
420 420
 			}
421 421
 		}
422
-	else
422
+		else
423 423
 		foreach ($this_category as &$board)
424 424
 		{
425 425
 			if (!empty($moderators[$board['id']]))
Please login to merge, or discard this patch.
Sources/Subs-Db-postgresql.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -979,7 +979,8 @@  discard block
 block discarded – undo
979 979
 		$error_array[2] = null;
980 980
 
981 981
 	if(empty($db_persist))
982
-	{ // without pooling
982
+	{
983
+// without pooling
983 984
 		if (empty($pg_error_data_prep))
984 985
 			$pg_error_data_prep = pg_prepare($db_connection, 'smf_log_errors',
985 986
 				'INSERT INTO ' . $db_prefix . 'log_errors
@@ -990,7 +991,8 @@  discard block
 block discarded – undo
990 991
 		pg_execute($db_connection, 'smf_log_errors', $error_array);
991 992
 	}
992 993
 	else
993
-	{ //with pooling
994
+	{
995
+//with pooling
994 996
 		$pg_error_data_prep = pg_prepare($db_connection, '',
995 997
 			'INSERT INTO ' . $db_prefix . 'log_errors
996 998
 				(id_member, log_time, ip, url, message, session, error_type, file, line, backtrace)
Please login to merge, or discard this patch.
Sources/random_compat/random_bytes_dev_urandom.php 2 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -27,146 +27,146 @@
 block discarded – undo
27 27
  */
28 28
 
29 29
 if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
30
-    define('RANDOM_COMPAT_READ_BUFFER', 8);
30
+	define('RANDOM_COMPAT_READ_BUFFER', 8);
31 31
 }
32 32
 
33 33
 if (!is_callable('random_bytes')) {
34
-    /**
35
-     * Unless open_basedir is enabled, use /dev/urandom for
36
-     * random numbers in accordance with best practices
37
-     *
38
-     * Why we use /dev/urandom and not /dev/random
39
-     * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers
40
-     *
41
-     * @param int $bytes
42
-     *
43
-     * @throws Exception
44
-     *
45
-     * @return string
46
-     */
47
-    function random_bytes($bytes)
48
-    {
49
-        /** @var resource $fp */
50
-        static $fp = null;
34
+	/**
35
+	 * Unless open_basedir is enabled, use /dev/urandom for
36
+	 * random numbers in accordance with best practices
37
+	 *
38
+	 * Why we use /dev/urandom and not /dev/random
39
+	 * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers
40
+	 *
41
+	 * @param int $bytes
42
+	 *
43
+	 * @throws Exception
44
+	 *
45
+	 * @return string
46
+	 */
47
+	function random_bytes($bytes)
48
+	{
49
+		/** @var resource $fp */
50
+		static $fp = null;
51 51
 
52
-        /**
53
-         * This block should only be run once
54
-         */
55
-        if (empty($fp)) {
56
-            /**
57
-             * We use /dev/urandom if it is a char device.
58
-             * We never fall back to /dev/random
59
-             */
60
-            /** @var resource|bool $fp */
61
-            $fp = fopen('/dev/urandom', 'rb');
62
-            if (is_resource($fp)) {
63
-                /** @var array<string, int> $st */
64
-                $st = fstat($fp);
65
-                if (($st['mode'] & 0170000) !== 020000) {
66
-                    fclose($fp);
67
-                    $fp = false;
68
-                }
69
-            }
52
+		/**
53
+		 * This block should only be run once
54
+		 */
55
+		if (empty($fp)) {
56
+			/**
57
+			 * We use /dev/urandom if it is a char device.
58
+			 * We never fall back to /dev/random
59
+			 */
60
+			/** @var resource|bool $fp */
61
+			$fp = fopen('/dev/urandom', 'rb');
62
+			if (is_resource($fp)) {
63
+				/** @var array<string, int> $st */
64
+				$st = fstat($fp);
65
+				if (($st['mode'] & 0170000) !== 020000) {
66
+					fclose($fp);
67
+					$fp = false;
68
+				}
69
+			}
70 70
 
71
-            if (is_resource($fp)) {
72
-                /**
73
-                 * stream_set_read_buffer() does not exist in HHVM
74
-                 *
75
-                 * If we don't set the stream's read buffer to 0, PHP will
76
-                 * internally buffer 8192 bytes, which can waste entropy
77
-                 *
78
-                 * stream_set_read_buffer returns 0 on success
79
-                 */
80
-                if (is_callable('stream_set_read_buffer')) {
81
-                    stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
82
-                }
83
-                if (is_callable('stream_set_chunk_size')) {
84
-                    stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
85
-                }
86
-            }
87
-        }
71
+			if (is_resource($fp)) {
72
+				/**
73
+				 * stream_set_read_buffer() does not exist in HHVM
74
+				 *
75
+				 * If we don't set the stream's read buffer to 0, PHP will
76
+				 * internally buffer 8192 bytes, which can waste entropy
77
+				 *
78
+				 * stream_set_read_buffer returns 0 on success
79
+				 */
80
+				if (is_callable('stream_set_read_buffer')) {
81
+					stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
82
+				}
83
+				if (is_callable('stream_set_chunk_size')) {
84
+					stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
85
+				}
86
+			}
87
+		}
88 88
 
89
-        try {
90
-            /** @var int $bytes */
91
-            $bytes = RandomCompat_intval($bytes);
92
-        } catch (TypeError $ex) {
93
-            throw new TypeError(
94
-                'random_bytes(): $bytes must be an integer'
95
-            );
96
-        }
89
+		try {
90
+			/** @var int $bytes */
91
+			$bytes = RandomCompat_intval($bytes);
92
+		} catch (TypeError $ex) {
93
+			throw new TypeError(
94
+				'random_bytes(): $bytes must be an integer'
95
+			);
96
+		}
97 97
 
98
-        if ($bytes < 1) {
99
-            throw new Error(
100
-                'Length must be greater than 0'
101
-            );
102
-        }
98
+		if ($bytes < 1) {
99
+			throw new Error(
100
+				'Length must be greater than 0'
101
+			);
102
+		}
103 103
 
104
-        /**
105
-         * This if() block only runs if we managed to open a file handle
106
-         *
107
-         * It does not belong in an else {} block, because the above
108
-         * if (empty($fp)) line is logic that should only be run once per
109
-         * page load.
110
-         */
111
-        if (is_resource($fp)) {
112
-            /**
113
-             * @var int
114
-             */
115
-            $remaining = $bytes;
104
+		/**
105
+		 * This if() block only runs if we managed to open a file handle
106
+		 *
107
+		 * It does not belong in an else {} block, because the above
108
+		 * if (empty($fp)) line is logic that should only be run once per
109
+		 * page load.
110
+		 */
111
+		if (is_resource($fp)) {
112
+			/**
113
+			 * @var int
114
+			 */
115
+			$remaining = $bytes;
116 116
 
117
-            /**
118
-             * @var string|bool
119
-             */
120
-            $buf = '';
117
+			/**
118
+			 * @var string|bool
119
+			 */
120
+			$buf = '';
121 121
 
122
-            /**
123
-             * We use fread() in a loop to protect against partial reads
124
-             */
125
-            do {
126
-                /**
127
-                 * @var string|bool
128
-                 */
129
-                $read = fread($fp, $remaining);
130
-                if (!is_string($read)) {
131
-                    if ($read === false) {
132
-                        /**
133
-                         * We cannot safely read from the file. Exit the
134
-                         * do-while loop and trigger the exception condition
135
-                         *
136
-                         * @var string|bool
137
-                         */
138
-                        $buf = false;
139
-                        break;
140
-                    }
141
-                }
142
-                /**
143
-                 * Decrease the number of bytes returned from remaining
144
-                 */
145
-                $remaining -= RandomCompat_strlen($read);
146
-                /**
147
-                 * @var string|bool
148
-                 */
149
-                $buf = $buf . $read;
150
-            } while ($remaining > 0);
122
+			/**
123
+			 * We use fread() in a loop to protect against partial reads
124
+			 */
125
+			do {
126
+				/**
127
+				 * @var string|bool
128
+				 */
129
+				$read = fread($fp, $remaining);
130
+				if (!is_string($read)) {
131
+					if ($read === false) {
132
+						/**
133
+						 * We cannot safely read from the file. Exit the
134
+						 * do-while loop and trigger the exception condition
135
+						 *
136
+						 * @var string|bool
137
+						 */
138
+						$buf = false;
139
+						break;
140
+					}
141
+				}
142
+				/**
143
+				 * Decrease the number of bytes returned from remaining
144
+				 */
145
+				$remaining -= RandomCompat_strlen($read);
146
+				/**
147
+				 * @var string|bool
148
+				 */
149
+				$buf = $buf . $read;
150
+			} while ($remaining > 0);
151 151
 
152
-            /**
153
-             * Is our result valid?
154
-             */
155
-            if (is_string($buf)) {
156
-                if (RandomCompat_strlen($buf) === $bytes) {
157
-                    /**
158
-                     * Return our random entropy buffer here:
159
-                     */
160
-                    return $buf;
161
-                }
162
-            }
163
-        }
152
+			/**
153
+			 * Is our result valid?
154
+			 */
155
+			if (is_string($buf)) {
156
+				if (RandomCompat_strlen($buf) === $bytes) {
157
+					/**
158
+					 * Return our random entropy buffer here:
159
+					 */
160
+					return $buf;
161
+				}
162
+			}
163
+		}
164 164
 
165
-        /**
166
-         * If we reach here, PHP has failed us.
167
-         */
168
-        throw new Exception(
169
-            'Error reading from source device'
170
-        );
171
-    }
165
+		/**
166
+		 * If we reach here, PHP has failed us.
167
+		 */
168
+		throw new Exception(
169
+			'Error reading from source device'
170
+		);
171
+	}
172 172
 }
Please login to merge, or discard this patch.
Braces   +33 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,11 +26,13 @@  discard block
 block discarded – undo
26 26
  * SOFTWARE.
27 27
  */
28 28
 
29
-if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
29
+if (!defined('RANDOM_COMPAT_READ_BUFFER'))
30
+{
30 31
     define('RANDOM_COMPAT_READ_BUFFER', 8);
31 32
 }
32 33
 
33
-if (!is_callable('random_bytes')) {
34
+if (!is_callable('random_bytes'))
35
+{
34 36
     /**
35 37
      * Unless open_basedir is enabled, use /dev/urandom for
36 38
      * random numbers in accordance with best practices
@@ -52,23 +54,27 @@  discard block
 block discarded – undo
52 54
         /**
53 55
          * This block should only be run once
54 56
          */
55
-        if (empty($fp)) {
57
+        if (empty($fp))
58
+        {
56 59
             /**
57 60
              * We use /dev/urandom if it is a char device.
58 61
              * We never fall back to /dev/random
59 62
              */
60 63
             /** @var resource|bool $fp */
61 64
             $fp = fopen('/dev/urandom', 'rb');
62
-            if (is_resource($fp)) {
65
+            if (is_resource($fp))
66
+            {
63 67
                 /** @var array<string, int> $st */
64 68
                 $st = fstat($fp);
65
-                if (($st['mode'] & 0170000) !== 020000) {
69
+                if (($st['mode'] & 0170000) !== 020000)
70
+                {
66 71
                     fclose($fp);
67 72
                     $fp = false;
68 73
                 }
69 74
             }
70 75
 
71
-            if (is_resource($fp)) {
76
+            if (is_resource($fp))
77
+            {
72 78
                 /**
73 79
                  * stream_set_read_buffer() does not exist in HHVM
74 80
                  *
@@ -77,25 +83,31 @@  discard block
 block discarded – undo
77 83
                  *
78 84
                  * stream_set_read_buffer returns 0 on success
79 85
                  */
80
-                if (is_callable('stream_set_read_buffer')) {
86
+                if (is_callable('stream_set_read_buffer'))
87
+                {
81 88
                     stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
82 89
                 }
83
-                if (is_callable('stream_set_chunk_size')) {
90
+                if (is_callable('stream_set_chunk_size'))
91
+                {
84 92
                     stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
85 93
                 }
86 94
             }
87 95
         }
88 96
 
89
-        try {
97
+        try
98
+        {
90 99
             /** @var int $bytes */
91 100
             $bytes = RandomCompat_intval($bytes);
92
-        } catch (TypeError $ex) {
101
+        }
102
+        catch (TypeError $ex)
103
+        {
93 104
             throw new TypeError(
94 105
                 'random_bytes(): $bytes must be an integer'
95 106
             );
96 107
         }
97 108
 
98
-        if ($bytes < 1) {
109
+        if ($bytes < 1)
110
+        {
99 111
             throw new Error(
100 112
                 'Length must be greater than 0'
101 113
             );
@@ -108,7 +120,8 @@  discard block
 block discarded – undo
108 120
          * if (empty($fp)) line is logic that should only be run once per
109 121
          * page load.
110 122
          */
111
-        if (is_resource($fp)) {
123
+        if (is_resource($fp))
124
+        {
112 125
             /**
113 126
              * @var int
114 127
              */
@@ -127,8 +140,10 @@  discard block
 block discarded – undo
127 140
                  * @var string|bool
128 141
                  */
129 142
                 $read = fread($fp, $remaining);
130
-                if (!is_string($read)) {
131
-                    if ($read === false) {
143
+                if (!is_string($read))
144
+                {
145
+                    if ($read === false)
146
+                    {
132 147
                         /**
133 148
                          * We cannot safely read from the file. Exit the
134 149
                          * do-while loop and trigger the exception condition
@@ -152,8 +167,10 @@  discard block
 block discarded – undo
152 167
             /**
153 168
              * Is our result valid?
154 169
              */
155
-            if (is_string($buf)) {
156
-                if (RandomCompat_strlen($buf) === $bytes) {
170
+            if (is_string($buf))
171
+            {
172
+                if (RandomCompat_strlen($buf) === $bytes)
173
+                {
157 174
                     /**
158 175
                      * Return our random entropy buffer here:
159 176
                      */
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
 }
92 92
\ No newline at end of file
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.
Sources/Subs-Admin.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1197,7 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 	}
1198 1198
 
1199 1199
 	// It's important to do the numbered ones before the named ones, or messes happen.
1200
-	uksort($substitutions, function($a, $b) {
1200
+	uksort($substitutions, function($a, $b)
1201
+	{
1201 1202
 		if (is_int($a) && is_int($b))
1202 1203
 			return $a > $b;
1203 1204
 		elseif (is_int($a))
@@ -1716,8 +1717,12 @@  discard block
 block discarded – undo
1716 1717
 		unset($mtime, $settingsFile, $settingsText);
1717 1718
 		$defined_vars = get_defined_vars();
1718 1719
 	}
1719
-	catch (Throwable $e) {}
1720
-	catch (ErrorException $e) {}
1720
+	catch (Throwable $e)
1721
+	{
1722
+}
1723
+	catch (ErrorException $e)
1724
+	{
1725
+}
1721 1726
 	if (isset($e))
1722 1727
 		return false;
1723 1728
 
@@ -1877,7 +1882,8 @@  discard block
 block discarded – undo
1877 1882
 	// For the same reason, replace literal returns and newlines with "\r" and "\n"
1878 1883
 	elseif (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false))
1879 1884
 	{
1880
-		return strtr(preg_replace_callback('/[\r\n]+/', function($m) {
1885
+		return strtr(preg_replace_callback('/[\r\n]+/', function($m)
1886
+		{
1881 1887
 			return '\' . "' . strtr($m[0], array("\r" => '\r', "\n" => '\n')) . '" . \'';
1882 1888
 		}, $var), array("'' . " => '', " . ''" => ''));
1883 1889
 	}
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Braces   +3 added lines, -8 removed lines patch added patch discarded remove patch
@@ -279,7 +279,6 @@  discard block
 block discarded – undo
279 279
 		$condition = 'id_member IN ({array_int:members})';
280 280
 		$parameters['members'] = $members;
281 281
 	}
282
-
283 282
 	elseif ($members === null)
284 283
 		$condition = '1=1';
285 284
 
@@ -382,11 +381,9 @@  discard block
 block discarded – undo
382 381
 				$val = $val . ' END';
383 382
 				$type = 'raw';
384 383
 			}
385
-
386 384
 			else
387 385
 				$val = alert_count($members, true);
388 386
 		}
389
-
390 387
 		elseif ($type == 'int' && ($val === '+' || $val === '-'))
391 388
 		{
392 389
 			$val = $var . ' ' . $val . ' 1';
@@ -2176,12 +2173,12 @@  discard block
 block discarded – undo
2176 2173
 			'tag' => 'cowsay',
2177 2174
 			'parameters' => array(
2178 2175
 				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2179
-					{
2176
+				{
2180 2177
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2181 2178
 					},
2182 2179
 				),
2183 2180
 				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2184
-					{
2181
+				{
2185 2182
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2186 2183
 					},
2187 2184
 				),
@@ -3279,7 +3276,7 @@  discard block
 block discarded – undo
3279 3276
 
3280 3277
 	// Replace away!
3281 3278
 	$message = preg_replace_callback($smileyPregSearch, function($matches) use ($smileyPregReplacements)
3282
-		{
3279
+	{
3283 3280
 			return $smileyPregReplacements[$matches[1]];
3284 3281
 		}, $message);
3285 3282
 }
@@ -4077,7 +4074,6 @@  discard block
 block discarded – undo
4077 4074
 				if (!isset($minSeed) && isset($js_file['options']['seed']))
4078 4075
 					$minSeed = $js_file['options']['seed'];
4079 4076
 			}
4080
-
4081 4077
 			else
4082 4078
 			{
4083 4079
 				echo '
@@ -6360,7 +6356,6 @@  discard block
 block discarded – undo
6360 6356
 			$isWritable = true;
6361 6357
 			break;
6362 6358
 		}
6363
-
6364 6359
 		else
6365 6360
 			@chmod($file, $val);
6366 6361
 	}
Please login to merge, or discard this patch.