Passed
Pull Request — release-2.1 (#5093)
by 01
05:42
created
Themes/default/BoardIndex.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 		echo '
72 72
 		<div class="main_container">
73
-			<div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '">
73
+			<div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '', '" id="category_', $category['id'], '">
74 74
 				<h3 class="catbg">';
75 75
 
76 76
 		// If this category even can collapse, show a link to collapse it.
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		foreach ($board['children'] as $child)
250 250
 		{
251 251
 			if (!$child['is_redirect'])
252
-				$child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
252
+				$child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')" class="new_posts">' . $txt['new'] . '</a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
253 253
 			else
254 254
 				$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
255 255
 
Please login to merge, or discard this patch.
Sources/Profile-Modify.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 			);
1257 1257
 			if (empty($value))
1258 1258
 			{
1259
-				$deletes = array('id_theme' => 1 , 'variable' => $row['col_name'], 'id_member' => $memID);
1259
+				$deletes = array('id_theme' => 1, 'variable' => $row['col_name'], 'id_member' => $memID);
1260 1260
 				unset($user_profile[$memID]['options'][$row['col_name']]);
1261 1261
 			}
1262 1262
 			else
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 				array('id_theme', 'variable', 'id_member')
1285 1285
 			);
1286 1286
 		if (!empty($deletes))
1287
-			$smcFunc['db_query']('','
1287
+			$smcFunc['db_query']('', '
1288 1288
 				DELETE FROM {db_prefix}themes
1289 1289
 				WHERE id_theme = {int:id_theme} AND
1290 1290
 						variable = {string:variable} AND
Please login to merge, or discard this patch.
Sources/Class-Punycode.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 }
137 137
                 if ($c === $n) {
138 138
                     $q = $delta;
139
-                    for ($k = static::BASE;; $k += static::BASE) {
139
+                    for ($k = static::BASE; ; $k += static::BASE) {
140 140
                         $t = $this->calculateThreshold($k, $bias);
141 141
                         if ($q < $t) {
142 142
                             break;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             $oldi = $i;
225 225
             $w = 1;
226 226
 
227
-            for ($k = static::BASE;; $k += static::BASE) {
227
+            for ($k = static::BASE; ; $k += static::BASE) {
228 228
                 $digit = static::$decodeTable[$input[$pos++]];
229 229
                 $i = $i + ($digit * $w);
230 230
                 $t = $this->calculateThreshold($k, $bias);
Please login to merge, or discard this patch.
Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 
21 21
 if (!defined('SMF'))
22
-    die('No direct access...');
22
+	die('No direct access...');
23 23
 
24 24
 /**
25 25
  * Punycode implementation as described in RFC 3492
@@ -28,332 +28,332 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class Punycode
30 30
 {
31
-    /**
32
-     * Bootstring parameter values
33
-     *
34
-     */
35
-    const BASE         = 36;
36
-    const TMIN         = 1;
37
-    const TMAX         = 26;
38
-    const SKEW         = 38;
39
-    const DAMP         = 700;
40
-    const INITIAL_BIAS = 72;
41
-    const INITIAL_N    = 128;
42
-    const PREFIX       = 'xn--';
43
-    const DELIMITER    = '-';
44
-
45
-    /**
46
-     * Encode table
47
-     *
48
-     * @param array
49
-     */
50
-    protected static $encodeTable = array(
51
-        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
52
-        'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
53
-        'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
54
-    );
55
-
56
-    /**
57
-     * Decode table
58
-     *
59
-     * @param array
60
-     */
61
-    protected static $decodeTable = array(
62
-        'a' =>  0, 'b' =>  1, 'c' =>  2, 'd' =>  3, 'e' =>  4, 'f' =>  5,
63
-        'g' =>  6, 'h' =>  7, 'i' =>  8, 'j' =>  9, 'k' => 10, 'l' => 11,
64
-        'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17,
65
-        's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23,
66
-        'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29,
67
-        '4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35
68
-    );
69
-
70
-    /**
71
-     * Character encoding
72
-     *
73
-     * @param string
74
-     */
75
-    protected $encoding;
76
-
77
-    /**
78
-     * Constructor
79
-     *
80
-     * @param string $encoding Character encoding
81
-     */
82
-    public function __construct($encoding = 'UTF-8')
83
-    {
84
-        $this->encoding = $encoding;
85
-    }
86
-
87
-    /**
88
-     * Encode a domain to its Punycode version
89
-     *
90
-     * @param string $input Domain name in Unicode to be encoded
91
-     * @return string Punycode representation in ASCII
92
-     */
93
-    public function encode($input)
94
-    {
95
-        $input = mb_strtolower($input, $this->encoding);
96
-        $parts = explode('.', $input);
97
-        foreach ($parts as &$part) {
98
-            $part = $this->encodePart($part);
99
-        }
100
-        $output = implode('.', $parts);
101
-        $length = strlen($output);
102
-
103
-        return $output;
104
-    }
105
-
106
-    /**
107
-     * Encode a part of a domain name, such as tld, to its Punycode version
108
-     *
109
-     * @param string $input Part of a domain name
110
-     * @return string Punycode representation of a domain part
111
-     */
112
-    protected function encodePart($input)
113
-    {
114
-        $codePoints = $this->listCodePoints($input);
115
-
116
-        $n = static::INITIAL_N;
117
-        $bias = static::INITIAL_BIAS;
118
-        $delta = 0;
119
-        $h = $b = count($codePoints['basic']);
120
-
121
-        $output = '';
122
-        foreach ($codePoints['basic'] as $code) {
123
-            $output .= $this->codePointToChar($code);
124
-        }
125
-        if ($input === $output) {
126
-            return $output;
127
-        }
128
-        if ($b > 0) {
129
-            $output .= static::DELIMITER;
130
-        }
131
-
132
-        $codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
133
-        sort($codePoints['nonBasic']);
134
-
135
-        $i = 0;
136
-        $length = mb_strlen($input, $this->encoding);
137
-        while ($h < $length) {
138
-            $m = $codePoints['nonBasic'][$i++];
139
-            $delta = $delta + ($m - $n) * ($h + 1);
140
-            $n = $m;
141
-
142
-            foreach ($codePoints['all'] as $c) {
143
-                if ($c < $n || $c < static::INITIAL_N) {
144
-                    $delta++;
145
-                }
146
-                if ($c === $n) {
147
-                    $q = $delta;
148
-                    for ($k = static::BASE;; $k += static::BASE) {
149
-                        $t = $this->calculateThreshold($k, $bias);
150
-                        if ($q < $t) {
151
-                            break;
152
-                        }
153
-
154
-                        $code = $t + (($q - $t) % (static::BASE - $t));
155
-                        $output .= static::$encodeTable[$code];
156
-
157
-                        $q = ($q - $t) / (static::BASE - $t);
158
-                    }
159
-
160
-                    $output .= static::$encodeTable[$q];
161
-                    $bias = $this->adapt($delta, $h + 1, ($h === $b));
162
-                    $delta = 0;
163
-                    $h++;
164
-                }
165
-            }
166
-
167
-            $delta++;
168
-            $n++;
169
-        }
170
-        $out = static::PREFIX . $output;
171
-
172
-        return $out;
173
-    }
174
-
175
-    /**
176
-     * Decode a Punycode domain name to its Unicode counterpart
177
-     *
178
-     * @param string $input Domain name in Punycode
179
-     * @return string Unicode domain name
180
-     */
181
-    public function decode($input)
182
-    {
183
-        $input = strtolower($input);
184
-        $parts = explode('.', $input);
185
-        foreach ($parts as &$part) {
186
-            if (strpos($part, static::PREFIX) !== 0) {
187
-                continue;
188
-            }
189
-
190
-            $part = substr($part, strlen(static::PREFIX));
191
-            $part = $this->decodePart($part);
192
-        }
193
-        $output = implode('.', $parts);
194
-
195
-        return $output;
196
-    }
197
-
198
-    /**
199
-     * Decode a part of domain name, such as tld
200
-     *
201
-     * @param string $input Part of a domain name
202
-     * @return string Unicode domain part
203
-     */
204
-    protected function decodePart($input)
205
-    {
206
-        $n = static::INITIAL_N;
207
-        $i = 0;
208
-        $bias = static::INITIAL_BIAS;
209
-        $output = '';
210
-
211
-        $pos = strrpos($input, static::DELIMITER);
212
-        if ($pos !== false) {
213
-            $output = substr($input, 0, $pos++);
214
-        } else {
215
-            $pos = 0;
216
-        }
217
-
218
-        $outputLength = strlen($output);
219
-        $inputLength = strlen($input);
220
-        while ($pos < $inputLength) {
221
-            $oldi = $i;
222
-            $w = 1;
223
-
224
-            for ($k = static::BASE;; $k += static::BASE) {
225
-                $digit = static::$decodeTable[$input[$pos++]];
226
-                $i = $i + ($digit * $w);
227
-                $t = $this->calculateThreshold($k, $bias);
228
-
229
-                if ($digit < $t) {
230
-                    break;
231
-                }
232
-
233
-                $w = $w * (static::BASE - $t);
234
-            }
235
-
236
-            $bias = $this->adapt($i - $oldi, ++$outputLength, ($oldi === 0));
237
-            $n = $n + (int) ($i / $outputLength);
238
-            $i = $i % ($outputLength);
239
-            $output = mb_substr($output, 0, $i, $this->encoding) . $this->codePointToChar($n) . mb_substr($output, $i, $outputLength - 1, $this->encoding);
240
-
241
-            $i++;
242
-        }
243
-
244
-        return $output;
245
-    }
246
-
247
-    /**
248
-     * Calculate the bias threshold to fall between TMIN and TMAX
249
-     *
250
-     * @param integer $k
251
-     * @param integer $bias
252
-     * @return integer
253
-     */
254
-    protected function calculateThreshold($k, $bias)
255
-    {
256
-        if ($k <= $bias + static::TMIN) {
257
-            return static::TMIN;
258
-        } elseif ($k >= $bias + static::TMAX) {
259
-            return static::TMAX;
260
-        }
261
-        return $k - $bias;
262
-    }
263
-
264
-    /**
265
-     * Bias adaptation
266
-     *
267
-     * @param integer $delta
268
-     * @param integer $numPoints
269
-     * @param boolean $firstTime
270
-     * @return integer
271
-     */
272
-    protected function adapt($delta, $numPoints, $firstTime)
273
-    {
274
-        $delta = (int) (
275
-            ($firstTime)
276
-                ? $delta / static::DAMP
277
-                : $delta / 2
278
-            );
279
-        $delta += (int) ($delta / $numPoints);
280
-
281
-        $k = 0;
282
-        while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) {
283
-            $delta = (int) ($delta / (static::BASE - static::TMIN));
284
-            $k = $k + static::BASE;
285
-        }
286
-        $k = $k + (int) (((static::BASE - static::TMIN + 1) * $delta) / ($delta + static::SKEW));
287
-
288
-        return $k;
289
-    }
290
-
291
-    /**
292
-     * List code points for a given input
293
-     *
294
-     * @param string $input
295
-     * @return array Multi-dimension array with basic, non-basic and aggregated code points
296
-     */
297
-    protected function listCodePoints($input)
298
-    {
299
-        $codePoints = array(
300
-            'all'      => array(),
301
-            'basic'    => array(),
302
-            'nonBasic' => array(),
303
-        );
304
-
305
-        $length = mb_strlen($input, $this->encoding);
306
-        for ($i = 0; $i < $length; $i++) {
307
-            $char = mb_substr($input, $i, 1, $this->encoding);
308
-            $code = $this->charToCodePoint($char);
309
-            if ($code < 128) {
310
-                $codePoints['all'][] = $codePoints['basic'][] = $code;
311
-            } else {
312
-                $codePoints['all'][] = $codePoints['nonBasic'][] = $code;
313
-            }
314
-        }
315
-
316
-        return $codePoints;
317
-    }
318
-
319
-    /**
320
-     * Convert a single or multi-byte character to its code point
321
-     *
322
-     * @param string $char
323
-     * @return integer
324
-     */
325
-    protected function charToCodePoint($char)
326
-    {
327
-        $code = ord($char[0]);
328
-        if ($code < 128) {
329
-            return $code;
330
-        } elseif ($code < 224) {
331
-            return (($code - 192) * 64) + (ord($char[1]) - 128);
332
-        } elseif ($code < 240) {
333
-            return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
334
-        } else {
335
-            return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
336
-        }
337
-    }
338
-
339
-    /**
340
-     * Convert a code point to its single or multi-byte character
341
-     *
342
-     * @param integer $code
343
-     * @return string
344
-     */
345
-    protected function codePointToChar($code)
346
-    {
347
-        if ($code <= 0x7F) {
348
-            return chr($code);
349
-        } elseif ($code <= 0x7FF) {
350
-            return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
351
-        } elseif ($code <= 0xFFFF) {
352
-            return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
353
-        } else {
354
-            return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
355
-        }
356
-    }
31
+	/**
32
+	 * Bootstring parameter values
33
+	 *
34
+	 */
35
+	const BASE         = 36;
36
+	const TMIN         = 1;
37
+	const TMAX         = 26;
38
+	const SKEW         = 38;
39
+	const DAMP         = 700;
40
+	const INITIAL_BIAS = 72;
41
+	const INITIAL_N    = 128;
42
+	const PREFIX       = 'xn--';
43
+	const DELIMITER    = '-';
44
+
45
+	/**
46
+	 * Encode table
47
+	 *
48
+	 * @param array
49
+	 */
50
+	protected static $encodeTable = array(
51
+		'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
52
+		'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
53
+		'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
54
+	);
55
+
56
+	/**
57
+	 * Decode table
58
+	 *
59
+	 * @param array
60
+	 */
61
+	protected static $decodeTable = array(
62
+		'a' =>  0, 'b' =>  1, 'c' =>  2, 'd' =>  3, 'e' =>  4, 'f' =>  5,
63
+		'g' =>  6, 'h' =>  7, 'i' =>  8, 'j' =>  9, 'k' => 10, 'l' => 11,
64
+		'm' => 12, 'n' => 13, 'o' => 14, 'p' => 15, 'q' => 16, 'r' => 17,
65
+		's' => 18, 't' => 19, 'u' => 20, 'v' => 21, 'w' => 22, 'x' => 23,
66
+		'y' => 24, 'z' => 25, '0' => 26, '1' => 27, '2' => 28, '3' => 29,
67
+		'4' => 30, '5' => 31, '6' => 32, '7' => 33, '8' => 34, '9' => 35
68
+	);
69
+
70
+	/**
71
+	 * Character encoding
72
+	 *
73
+	 * @param string
74
+	 */
75
+	protected $encoding;
76
+
77
+	/**
78
+	 * Constructor
79
+	 *
80
+	 * @param string $encoding Character encoding
81
+	 */
82
+	public function __construct($encoding = 'UTF-8')
83
+	{
84
+		$this->encoding = $encoding;
85
+	}
86
+
87
+	/**
88
+	 * Encode a domain to its Punycode version
89
+	 *
90
+	 * @param string $input Domain name in Unicode to be encoded
91
+	 * @return string Punycode representation in ASCII
92
+	 */
93
+	public function encode($input)
94
+	{
95
+		$input = mb_strtolower($input, $this->encoding);
96
+		$parts = explode('.', $input);
97
+		foreach ($parts as &$part) {
98
+			$part = $this->encodePart($part);
99
+		}
100
+		$output = implode('.', $parts);
101
+		$length = strlen($output);
102
+
103
+		return $output;
104
+	}
105
+
106
+	/**
107
+	 * Encode a part of a domain name, such as tld, to its Punycode version
108
+	 *
109
+	 * @param string $input Part of a domain name
110
+	 * @return string Punycode representation of a domain part
111
+	 */
112
+	protected function encodePart($input)
113
+	{
114
+		$codePoints = $this->listCodePoints($input);
115
+
116
+		$n = static::INITIAL_N;
117
+		$bias = static::INITIAL_BIAS;
118
+		$delta = 0;
119
+		$h = $b = count($codePoints['basic']);
120
+
121
+		$output = '';
122
+		foreach ($codePoints['basic'] as $code) {
123
+			$output .= $this->codePointToChar($code);
124
+		}
125
+		if ($input === $output) {
126
+			return $output;
127
+		}
128
+		if ($b > 0) {
129
+			$output .= static::DELIMITER;
130
+		}
131
+
132
+		$codePoints['nonBasic'] = array_unique($codePoints['nonBasic']);
133
+		sort($codePoints['nonBasic']);
134
+
135
+		$i = 0;
136
+		$length = mb_strlen($input, $this->encoding);
137
+		while ($h < $length) {
138
+			$m = $codePoints['nonBasic'][$i++];
139
+			$delta = $delta + ($m - $n) * ($h + 1);
140
+			$n = $m;
141
+
142
+			foreach ($codePoints['all'] as $c) {
143
+				if ($c < $n || $c < static::INITIAL_N) {
144
+					$delta++;
145
+				}
146
+				if ($c === $n) {
147
+					$q = $delta;
148
+					for ($k = static::BASE;; $k += static::BASE) {
149
+						$t = $this->calculateThreshold($k, $bias);
150
+						if ($q < $t) {
151
+							break;
152
+						}
153
+
154
+						$code = $t + (($q - $t) % (static::BASE - $t));
155
+						$output .= static::$encodeTable[$code];
156
+
157
+						$q = ($q - $t) / (static::BASE - $t);
158
+					}
159
+
160
+					$output .= static::$encodeTable[$q];
161
+					$bias = $this->adapt($delta, $h + 1, ($h === $b));
162
+					$delta = 0;
163
+					$h++;
164
+				}
165
+			}
166
+
167
+			$delta++;
168
+			$n++;
169
+		}
170
+		$out = static::PREFIX . $output;
171
+
172
+		return $out;
173
+	}
174
+
175
+	/**
176
+	 * Decode a Punycode domain name to its Unicode counterpart
177
+	 *
178
+	 * @param string $input Domain name in Punycode
179
+	 * @return string Unicode domain name
180
+	 */
181
+	public function decode($input)
182
+	{
183
+		$input = strtolower($input);
184
+		$parts = explode('.', $input);
185
+		foreach ($parts as &$part) {
186
+			if (strpos($part, static::PREFIX) !== 0) {
187
+				continue;
188
+			}
189
+
190
+			$part = substr($part, strlen(static::PREFIX));
191
+			$part = $this->decodePart($part);
192
+		}
193
+		$output = implode('.', $parts);
194
+
195
+		return $output;
196
+	}
197
+
198
+	/**
199
+	 * Decode a part of domain name, such as tld
200
+	 *
201
+	 * @param string $input Part of a domain name
202
+	 * @return string Unicode domain part
203
+	 */
204
+	protected function decodePart($input)
205
+	{
206
+		$n = static::INITIAL_N;
207
+		$i = 0;
208
+		$bias = static::INITIAL_BIAS;
209
+		$output = '';
210
+
211
+		$pos = strrpos($input, static::DELIMITER);
212
+		if ($pos !== false) {
213
+			$output = substr($input, 0, $pos++);
214
+		} else {
215
+			$pos = 0;
216
+		}
217
+
218
+		$outputLength = strlen($output);
219
+		$inputLength = strlen($input);
220
+		while ($pos < $inputLength) {
221
+			$oldi = $i;
222
+			$w = 1;
223
+
224
+			for ($k = static::BASE;; $k += static::BASE) {
225
+				$digit = static::$decodeTable[$input[$pos++]];
226
+				$i = $i + ($digit * $w);
227
+				$t = $this->calculateThreshold($k, $bias);
228
+
229
+				if ($digit < $t) {
230
+					break;
231
+				}
232
+
233
+				$w = $w * (static::BASE - $t);
234
+			}
235
+
236
+			$bias = $this->adapt($i - $oldi, ++$outputLength, ($oldi === 0));
237
+			$n = $n + (int) ($i / $outputLength);
238
+			$i = $i % ($outputLength);
239
+			$output = mb_substr($output, 0, $i, $this->encoding) . $this->codePointToChar($n) . mb_substr($output, $i, $outputLength - 1, $this->encoding);
240
+
241
+			$i++;
242
+		}
243
+
244
+		return $output;
245
+	}
246
+
247
+	/**
248
+	 * Calculate the bias threshold to fall between TMIN and TMAX
249
+	 *
250
+	 * @param integer $k
251
+	 * @param integer $bias
252
+	 * @return integer
253
+	 */
254
+	protected function calculateThreshold($k, $bias)
255
+	{
256
+		if ($k <= $bias + static::TMIN) {
257
+			return static::TMIN;
258
+		} elseif ($k >= $bias + static::TMAX) {
259
+			return static::TMAX;
260
+		}
261
+		return $k - $bias;
262
+	}
263
+
264
+	/**
265
+	 * Bias adaptation
266
+	 *
267
+	 * @param integer $delta
268
+	 * @param integer $numPoints
269
+	 * @param boolean $firstTime
270
+	 * @return integer
271
+	 */
272
+	protected function adapt($delta, $numPoints, $firstTime)
273
+	{
274
+		$delta = (int) (
275
+			($firstTime)
276
+				? $delta / static::DAMP
277
+				: $delta / 2
278
+			);
279
+		$delta += (int) ($delta / $numPoints);
280
+
281
+		$k = 0;
282
+		while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) {
283
+			$delta = (int) ($delta / (static::BASE - static::TMIN));
284
+			$k = $k + static::BASE;
285
+		}
286
+		$k = $k + (int) (((static::BASE - static::TMIN + 1) * $delta) / ($delta + static::SKEW));
287
+
288
+		return $k;
289
+	}
290
+
291
+	/**
292
+	 * List code points for a given input
293
+	 *
294
+	 * @param string $input
295
+	 * @return array Multi-dimension array with basic, non-basic and aggregated code points
296
+	 */
297
+	protected function listCodePoints($input)
298
+	{
299
+		$codePoints = array(
300
+			'all'      => array(),
301
+			'basic'    => array(),
302
+			'nonBasic' => array(),
303
+		);
304
+
305
+		$length = mb_strlen($input, $this->encoding);
306
+		for ($i = 0; $i < $length; $i++) {
307
+			$char = mb_substr($input, $i, 1, $this->encoding);
308
+			$code = $this->charToCodePoint($char);
309
+			if ($code < 128) {
310
+				$codePoints['all'][] = $codePoints['basic'][] = $code;
311
+			} else {
312
+				$codePoints['all'][] = $codePoints['nonBasic'][] = $code;
313
+			}
314
+		}
315
+
316
+		return $codePoints;
317
+	}
318
+
319
+	/**
320
+	 * Convert a single or multi-byte character to its code point
321
+	 *
322
+	 * @param string $char
323
+	 * @return integer
324
+	 */
325
+	protected function charToCodePoint($char)
326
+	{
327
+		$code = ord($char[0]);
328
+		if ($code < 128) {
329
+			return $code;
330
+		} elseif ($code < 224) {
331
+			return (($code - 192) * 64) + (ord($char[1]) - 128);
332
+		} elseif ($code < 240) {
333
+			return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
334
+		} else {
335
+			return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
336
+		}
337
+	}
338
+
339
+	/**
340
+	 * Convert a code point to its single or multi-byte character
341
+	 *
342
+	 * @param integer $code
343
+	 * @return string
344
+	 */
345
+	protected function codePointToChar($code)
346
+	{
347
+		if ($code <= 0x7F) {
348
+			return chr($code);
349
+		} elseif ($code <= 0x7FF) {
350
+			return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
351
+		} elseif ($code <= 0xFFFF) {
352
+			return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
353
+		} else {
354
+			return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
355
+		}
356
+	}
357 357
 }
358 358
 
359 359
 ?>
360 360
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +71 added lines, -31 removed lines patch added patch discarded remove patch
@@ -94,7 +94,8 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $input = mb_strtolower($input, $this->encoding);
96 96
         $parts = explode('.', $input);
97
-        foreach ($parts as &$part) {
97
+        foreach ($parts as &$part)
98
+        {
98 99
             $part = $this->encodePart($part);
99 100
         }
100 101
         $output = implode('.', $parts);
@@ -119,13 +120,16 @@  discard block
 block discarded – undo
119 120
         $h = $b = count($codePoints['basic']);
120 121
 
121 122
         $output = '';
122
-        foreach ($codePoints['basic'] as $code) {
123
+        foreach ($codePoints['basic'] as $code)
124
+        {
123 125
             $output .= $this->codePointToChar($code);
124 126
         }
125
-        if ($input === $output) {
127
+        if ($input === $output)
128
+        {
126 129
             return $output;
127 130
         }
128
-        if ($b > 0) {
131
+        if ($b > 0)
132
+        {
129 133
             $output .= static::DELIMITER;
130 134
         }
131 135
 
@@ -134,20 +138,26 @@  discard block
 block discarded – undo
134 138
 
135 139
         $i = 0;
136 140
         $length = mb_strlen($input, $this->encoding);
137
-        while ($h < $length) {
141
+        while ($h < $length)
142
+        {
138 143
             $m = $codePoints['nonBasic'][$i++];
139 144
             $delta = $delta + ($m - $n) * ($h + 1);
140 145
             $n = $m;
141 146
 
142
-            foreach ($codePoints['all'] as $c) {
143
-                if ($c < $n || $c < static::INITIAL_N) {
147
+            foreach ($codePoints['all'] as $c)
148
+            {
149
+                if ($c < $n || $c < static::INITIAL_N)
150
+                {
144 151
                     $delta++;
145 152
                 }
146
-                if ($c === $n) {
153
+                if ($c === $n)
154
+                {
147 155
                     $q = $delta;
148
-                    for ($k = static::BASE;; $k += static::BASE) {
156
+                    for ($k = static::BASE;; $k += static::BASE)
157
+                    {
149 158
                         $t = $this->calculateThreshold($k, $bias);
150
-                        if ($q < $t) {
159
+                        if ($q < $t)
160
+                        {
151 161
                             break;
152 162
                         }
153 163
 
@@ -182,8 +192,10 @@  discard block
 block discarded – undo
182 192
     {
183 193
         $input = strtolower($input);
184 194
         $parts = explode('.', $input);
185
-        foreach ($parts as &$part) {
186
-            if (strpos($part, static::PREFIX) !== 0) {
195
+        foreach ($parts as &$part)
196
+        {
197
+            if (strpos($part, static::PREFIX) !== 0)
198
+            {
187 199
                 continue;
188 200
             }
189 201
 
@@ -209,24 +221,30 @@  discard block
 block discarded – undo
209 221
         $output = '';
210 222
 
211 223
         $pos = strrpos($input, static::DELIMITER);
212
-        if ($pos !== false) {
224
+        if ($pos !== false)
225
+        {
213 226
             $output = substr($input, 0, $pos++);
214
-        } else {
227
+        }
228
+        else
229
+        {
215 230
             $pos = 0;
216 231
         }
217 232
 
218 233
         $outputLength = strlen($output);
219 234
         $inputLength = strlen($input);
220
-        while ($pos < $inputLength) {
235
+        while ($pos < $inputLength)
236
+        {
221 237
             $oldi = $i;
222 238
             $w = 1;
223 239
 
224
-            for ($k = static::BASE;; $k += static::BASE) {
240
+            for ($k = static::BASE;; $k += static::BASE)
241
+            {
225 242
                 $digit = static::$decodeTable[$input[$pos++]];
226 243
                 $i = $i + ($digit * $w);
227 244
                 $t = $this->calculateThreshold($k, $bias);
228 245
 
229
-                if ($digit < $t) {
246
+                if ($digit < $t)
247
+                {
230 248
                     break;
231 249
                 }
232 250
 
@@ -253,9 +271,12 @@  discard block
 block discarded – undo
253 271
      */
254 272
     protected function calculateThreshold($k, $bias)
255 273
     {
256
-        if ($k <= $bias + static::TMIN) {
274
+        if ($k <= $bias + static::TMIN)
275
+        {
257 276
             return static::TMIN;
258
-        } elseif ($k >= $bias + static::TMAX) {
277
+        }
278
+        elseif ($k >= $bias + static::TMAX)
279
+        {
259 280
             return static::TMAX;
260 281
         }
261 282
         return $k - $bias;
@@ -279,7 +300,8 @@  discard block
 block discarded – undo
279 300
         $delta += (int) ($delta / $numPoints);
280 301
 
281 302
         $k = 0;
282
-        while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2) {
303
+        while ($delta > ((static::BASE - static::TMIN) * static::TMAX) / 2)
304
+        {
283 305
             $delta = (int) ($delta / (static::BASE - static::TMIN));
284 306
             $k = $k + static::BASE;
285 307
         }
@@ -303,12 +325,16 @@  discard block
 block discarded – undo
303 325
         );
304 326
 
305 327
         $length = mb_strlen($input, $this->encoding);
306
-        for ($i = 0; $i < $length; $i++) {
328
+        for ($i = 0; $i < $length; $i++)
329
+        {
307 330
             $char = mb_substr($input, $i, 1, $this->encoding);
308 331
             $code = $this->charToCodePoint($char);
309
-            if ($code < 128) {
332
+            if ($code < 128)
333
+            {
310 334
                 $codePoints['all'][] = $codePoints['basic'][] = $code;
311
-            } else {
335
+            }
336
+            else
337
+            {
312 338
                 $codePoints['all'][] = $codePoints['nonBasic'][] = $code;
313 339
             }
314 340
         }
@@ -325,13 +351,20 @@  discard block
 block discarded – undo
325 351
     protected function charToCodePoint($char)
326 352
     {
327 353
         $code = ord($char[0]);
328
-        if ($code < 128) {
354
+        if ($code < 128)
355
+        {
329 356
             return $code;
330
-        } elseif ($code < 224) {
357
+        }
358
+        elseif ($code < 224)
359
+        {
331 360
             return (($code - 192) * 64) + (ord($char[1]) - 128);
332
-        } elseif ($code < 240) {
361
+        }
362
+        elseif ($code < 240)
363
+        {
333 364
             return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
334
-        } else {
365
+        }
366
+        else
367
+        {
335 368
             return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
336 369
         }
337 370
     }
@@ -344,13 +377,20 @@  discard block
 block discarded – undo
344 377
      */
345 378
     protected function codePointToChar($code)
346 379
     {
347
-        if ($code <= 0x7F) {
380
+        if ($code <= 0x7F)
381
+        {
348 382
             return chr($code);
349
-        } elseif ($code <= 0x7FF) {
383
+        }
384
+        elseif ($code <= 0x7FF)
385
+        {
350 386
             return chr(($code >> 6) + 192) . chr(($code & 63) + 128);
351
-        } elseif ($code <= 0xFFFF) {
387
+        }
388
+        elseif ($code <= 0xFFFF)
389
+        {
352 390
             return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
353
-        } else {
391
+        }
392
+        else
393
+        {
354 394
             return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
355 395
         }
356 396
     }
Please login to merge, or discard this patch.
Sources/PackageGet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
 		{
182 182
 			collapsedDiv.show(\'slow\');
183 183
 			icon.removeClass(\'toggle_down\').addClass(\'toggle_up\');
184
-			icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) .');
184
+			icon.prop(\'title\', '. JavaScriptEscape($txt['hide']) . ');
185 185
 		}
186 186
 
187 187
 		else
188 188
 		{
189 189
 			collapsedDiv.hide(\'slow\');
190 190
 			icon.removeClass(\'toggle_up\').addClass(\'toggle_down\');
191
-			icon.prop(\'title\', '. JavaScriptEscape($txt['show']) .');
191
+			icon.prop(\'title\', '. JavaScriptEscape($txt['show']) . ');
192 192
 		}
193 193
 	});', true);
194 194
 }
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
 	// Setup the correct template, even though I'll admit we ain't downloading ;)
643 643
 	$context['sub_template'] = 'downloaded';
644
-	$allowext = array('.zip','.tgz','.gz');
644
+	$allowext = array('.zip', '.tgz', '.gz');
645 645
 	// @todo Use FTP if the Packages directory is not writable.
646 646
 
647 647
 	// Check the file was even sent!
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
 	// Make sure it has a sane filename.
654 654
 	$_FILES['package']['name'] = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $_FILES['package']['name']);
655 655
 	$extension = substr(strrchr(strtolower($_FILES['package']['name']), '.'), 0);
656
-	if(!in_array($extension, $allowext))
656
+	if (!in_array($extension, $allowext))
657 657
 	{
658 658
 		fatal_lang_error('package_upload_error_supports', false, array('zip, tgz, tar.gz'));
659 659
 	}
660 660
 
661 661
 	// We only need the filename...
662
-	$extension = ($extension == '.gz') ? '.tar.gz' : $extension ;
662
+	$extension = ($extension == '.gz') ? '.tar.gz' : $extension;
663 663
 	$packageName = time() . $extension;
664 664
 
665 665
 	// Setup the destination and throw an error if the file is already there!
Please login to merge, or discard this patch.
Sources/QueryString.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@
 block discarded – undo
429 429
 */
430 430
 function matchIPtoCIDR($ip_address, $cidr_address)
431 431
 {
432
-    list ($cidr_network, $cidr_subnetmask) = preg_split('/', $cidr_address);
432
+	list ($cidr_network, $cidr_subnetmask) = preg_split('/', $cidr_address);
433 433
 	
434 434
 	//v6?
435 435
 	if ((strpos($cidr_network, ':') !== false))
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -454,7 +454,7 @@
 block discarded – undo
454 454
 			break;
455 455
 		}
456 456
 		$binMask = str_pad($binMask, 32, '0');
457
-		$binMask = pack("H*" , $binMask);
457
+		$binMask = pack("H*", $binMask);
458 458
 
459 459
 		return ($ip_address & $binMask) == $cidr_network;
460 460
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -440,7 +440,8 @@
 block discarded – undo
440 440
 		$ip_address = inet_pton($ip_address);
441 441
 		$cidr_network = inet_pton($cidr_network);
442 442
 		$binMask = str_repeat("f", $cidr_subnetmask / 4);
443
-		switch ($cidr_subnetmask % 4) {
443
+		switch ($cidr_subnetmask % 4)
444
+		{
444 445
 		  case 0:
445 446
 			break;
446 447
 		  case 1:
Please login to merge, or discard this patch.
Sources/Class-SearchAPI.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		global $smcFunc;
225 225
 
226
-		$result = $smcFunc['db_query']('','
226
+		$result = $smcFunc['db_query']('', '
227 227
 			SELECT DISTINCT id_search
228 228
 			FROM {db_prefix}log_search_results
229 229
 			WHERE id_msg = {int:id_msg}',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		if (count($id_searchs) < 1)
240 240
 			return;
241 241
 
242
-		$smcFunc['db_query']('','
242
+		$smcFunc['db_query']('', '
243 243
 			DELETE FROM {db_prefix}log_search_results
244 244
 			WHERE id_search in ({array_int:id_searchs})',
245 245
 			array(
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			)
248 248
 		);
249 249
 
250
-		$smcFunc['db_query']('','
250
+		$smcFunc['db_query']('', '
251 251
 			DELETE FROM {db_prefix}log_search_topics
252 252
 			WHERE id_search in ({array_int:id_searchs})',
253 253
 			array(
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			)
256 256
 		);
257 257
 
258
-		$smcFunc['db_query']('','
258
+		$smcFunc['db_query']('', '
259 259
 			DELETE FROM {db_prefix}log_search_messages
260 260
 			WHERE id_search in ({array_int:id_searchs})',
261 261
 			array(
Please login to merge, or discard this patch.
Sources/SearchAPI-Fulltext.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * @var array Which databases support this method?
35 35
 	 */
36
-	protected $supported_databases = array('mysql','postgresql');
36
+	protected $supported_databases = array('mysql', 'postgresql');
37 37
 
38 38
 	/**
39 39
 	 * The constructor function
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		$query_where = array();
177 177
 		$query_params = $search_data['params'];
178 178
 
179
-		if( $smcFunc['db_title'] == "PostgreSQL")
179
+		if ($smcFunc['db_title'] == "PostgreSQL")
180 180
 			$modSettings['search_simple_fulltext'] = true;
181 181
 
182 182
 		if ($query_params['id_search'])
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			// if we have bool terms to search, add them in
257 257
 			if ($query_params['boolean_match'])
258 258
 			{
259
-				if($smcFunc['db_title'] == "PostgreSQL")
259
+				if ($smcFunc['db_title'] == "PostgreSQL")
260 260
 				{
261 261
 					$language_ftx = $smcFunc['db_search_language']();
262 262
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			}
269 269
 		}
270 270
 
271
-		$ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ( '
271
+		$ignoreRequest = $smcFunc['db_search_query']('insert_into_log_messages_fulltext', ($smcFunc['db_support_ignore'] ? ('
272 272
 			INSERT IGNORE INTO {db_prefix}' . $search_data['insert_into'] . '
273 273
 				(' . implode(', ', array_keys($query_select)) . ')') : '') . '
274 274
 			SELECT ' . implode(', ', $query_select) . '
Please login to merge, or discard this patch.
Sources/Subs-Db-mysql.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 		case 'datetime':
256 256
 			if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1)
257
-				return 'str_to_date('.
258
-					sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5] ,$datetime_matches[6]).
257
+				return 'str_to_date(' .
258
+					sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) .
259 259
 					',\'%Y-%m-%d %h:%i:%s\')';
260 260
 			else
261 261
 				smf_db_error_backtrace('Wrong value type sent to the database. Datetime expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 		$old_pos = 0;
407 407
 		$pos = -1;
408 408
 		// Remove the string escape for better runtime
409
-		$db_string_1 = str_replace('\\\'','',$db_string);
409
+		$db_string_1 = str_replace('\\\'', '', $db_string);
410 410
 		while (true)
411 411
 		{
412 412
 			$pos = strpos($db_string_1, '\'', $pos + 1);
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	{
788 788
 		$count = count($insertRows);
789 789
 		$ai = 0;
790
-		for($i = 0; $i < $count; $i++)
790
+		for ($i = 0; $i < $count; $i++)
791 791
 		{
792 792
 			$old_id = $smcFunc['db_insert_id']();
793 793
 
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
 				$count2 = count($indexed_columns);
814 814
 				for ($x = 0; $x < $count2; $x++)
815 815
 				{
816
-					$where_string += key($indexed_columns[$x]) . ' = '. $insertRows[$i][$x];
816
+					$where_string += key($indexed_columns[$x]) . ' = ' . $insertRows[$i][$x];
817 817
 					if (($x + 1) < $count2)
818 818
 						$where_string += ' AND ';
819 819
 				}
820 820
 
821
-				$request = $smcFunc['db_query']('','
822
-					SELECT `'. $keys[0] . '` FROM ' . $table .'
821
+				$request = $smcFunc['db_query']('', '
822
+					SELECT `'. $keys[0] . '` FROM ' . $table . '
823 823
 					WHERE ' . $where_string . ' LIMIT 1',
824 824
 					array()
825 825
 				);
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			$return_var = array();
849 849
 			$count = count($insertRows);
850 850
 			$start = smf_db_insert_id($table, $keys[0]);
851
-			for ($i = 0; $i < $count; $i++ )
851
+			for ($i = 0; $i < $count; $i++)
852 852
 				$return_var[] = $start + $i;
853 853
 		}
854 854
 		return $return_var;
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	mysqli_stmt_bind_param($mysql_error_data_prep, 'iissssssis',
986 986
 		$error_array[0], $error_array[1], $error_array[2], $error_array[3], $error_array[4], $error_array[5], $error_array[6],
987 987
 		$error_array[7], $error_array[8], $error_array[9]);
988
-	mysqli_stmt_execute ($mysql_error_data_prep);
988
+	mysqli_stmt_execute($mysql_error_data_prep);
989 989
 }
990 990
 
991 991
 /**
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
  */
1000 1000
 function smf_db_custom_order($field, $array_values, $desc = false)
1001 1001
 {
1002
-	$return = 'CASE '. $field . ' ';
1002
+	$return = 'CASE ' . $field . ' ';
1003 1003
 	$count = count($array_values);
1004 1004
 	$then = ($desc ? ' THEN -' : ' THEN ');
1005 1005
 
Please login to merge, or discard this patch.
Sources/Search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 	// Remove the phrase parts and extract the words.
661 661
 	$wordArray = preg_replace('~(?:^|\s)(?:[-]?)"(?:[^"]+)"(?:$|\s)~' . ($context['utf8'] ? 'u' : ''), ' ', $search_params['search']);
662
-	$wordArray = explode(' ',  $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES));
662
+	$wordArray = explode(' ', $smcFunc['htmlspecialchars'](un_htmlspecialchars($wordArray), ENT_QUOTES));
663 663
 
664 664
 	// A minus sign in front of a word excludes the word.... so...
665 665
 	$excludedWords = array();
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 		// Are the result fresh?
998 998
 		if (!$update_cache && !empty($_SESSION['search_cache']['id_search']))
999 999
 		{
1000
-			$request = $smcFunc['db_query']('','
1000
+			$request = $smcFunc['db_query']('', '
1001 1001
 				SELECT id_search 
1002 1002
 				FROM {db_prefix}log_search_results
1003 1003
 				WHERE id_search = {int:search_id}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 						SELECT
1120 1120
 							{int:id_search},
1121 1121
 							t.id_topic,
1122
-							' . $relevance. ',
1122
+							' . $relevance . ',
1123 1123
 							' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ',
1124 1124
 							1
1125 1125
 						FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : '
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 						if (empty($subject_query['where']))
1353 1353
 							continue;
1354 1354
 
1355
-						$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ( '
1355
+						$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_topics', ($smcFunc['db_support_ignore'] ? ('
1356 1356
 							INSERT IGNORE INTO {db_prefix}' . ($createTemporary ? 'tmp_' : '') . 'log_search_topics
1357 1357
 								(' . ($createTemporary ? '' : 'id_search, ') . 'id_topic)') : '') . '
1358 1358
 							SELECT ' . ($createTemporary ? '' : $_SESSION['search_cache']['id_search'] . ', ') . 't.id_topic
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
 					}
1580 1580
 					$main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance';
1581 1581
 
1582
-					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ( '
1582
+					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ('
1583 1583
 						INSERT IGNORE INTO ' . '{db_prefix}log_search_results
1584 1584
 							(' . implode(', ', array_keys($main_query['select'])) . ')') : '') . '
1585 1585
 						SELECT
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
1648 1648
 
1649 1649
 					$usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts));
1650
-					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( '
1650
+					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ('
1651 1651
 						INSERT IGNORE INTO {db_prefix}log_search_results
1652 1652
 							(id_search, id_topic, relevance, id_msg, num_matches)') : '') . '
1653 1653
 						SELECT
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
 		if (strlen($query) == 0)
2117 2117
 			continue;
2118 2118
 
2119
-		$body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => '&#039;')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function ($m)
2119
+		$body_highlighted = preg_replace_callback('/((<[^>]*)|' . preg_quote(strtr($query, array('\'' => '&#039;')), '/') . ')/i' . ($context['utf8'] ? 'u' : ''), function($m)
2120 2120
 		{
2121 2121
 			return isset($m[2]) && "$m[2]" == "$m[1]" ? stripslashes("$m[1]") : "<strong class=\"highlight\">$m[1]</strong>";
2122 2122
 		}, $body_highlighted);
Please login to merge, or discard this patch.