@@ -1,9 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
6 | -else |
|
6 | +} else { |
|
7 | 7 | exit; |
8 | +} |
|
8 | 9 | |
9 | 10 | ?> |
10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
12 | 12 | header('Location: ' . $boardurl); |
13 | 13 | } |
14 | 14 | // Can't find it... just forget it. |
15 | -else |
|
15 | +else { |
|
16 | 16 | exit; |
17 | +} |
|
17 | 18 | |
18 | 19 | ?> |
19 | 20 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
12 | 12 | header('Location: ' . $boardurl); |
13 | 13 | } |
14 | 14 | // Can't find it... just forget it. |
15 | -else |
|
15 | +else { |
|
16 | 16 | exit; |
17 | +} |
|
17 | 18 | |
18 | 19 | ?> |
19 | 20 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
12 | 12 | header('Location: ' . $boardurl); |
13 | 13 | } |
14 | 14 | // Can't find it... just forget it. |
15 | -else |
|
15 | +else { |
|
16 | 16 | exit; |
17 | +} |
|
17 | 18 | |
18 | 19 | ?> |
19 | 20 | \ No newline at end of file |
@@ -14,8 +14,9 @@ discard block |
||
14 | 14 | * @version 2.1 Beta 3 |
15 | 15 | */ |
16 | 16 | |
17 | -if (!defined('SMF')) |
|
17 | +if (!defined('SMF')) { |
|
18 | 18 | die('No direct access...'); |
19 | +} |
|
19 | 20 | |
20 | 21 | /** |
21 | 22 | * !!!Compatibility!!! |
@@ -30,8 +31,9 @@ discard block |
||
30 | 31 | { |
31 | 32 | global $modSettings; |
32 | 33 | |
33 | - if (!$compat_mode) |
|
34 | - return $text; |
|
34 | + if (!$compat_mode) { |
|
35 | + return $text; |
|
36 | + } |
|
35 | 37 | |
36 | 38 | // Turn line breaks back into br's. |
37 | 39 | $text = strtr($text, array("\r" => '', "\n" => '<br>')); |
@@ -48,8 +50,9 @@ discard block |
||
48 | 50 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
49 | 51 | { |
50 | 52 | // Value of 2 means we're inside the tag. |
51 | - if ($i % 4 == 2) |
|
52 | - $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
53 | + if ($i % 4 == 2) { |
|
54 | + $parts[$i] = strtr($parts[$i], array('[' => '[', ']' => ']', "'" => "'")); |
|
55 | + } |
|
53 | 56 | } |
54 | 57 | // Put our humpty dumpty message back together again. |
55 | 58 | $text = implode('', $parts); |
@@ -107,8 +110,9 @@ discard block |
||
107 | 110 | $text = preg_replace('~</p>\s*(?!<)~i', '</p><br>', $text); |
108 | 111 | |
109 | 112 | // Safari/webkit wraps lines in Wysiwyg in <div>'s. |
110 | - if (isBrowser('webkit')) |
|
111 | - $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
113 | + if (isBrowser('webkit')) { |
|
114 | + $text = preg_replace(array('~<div(?:\s(?:[^<>]*?))?' . '>~i', '</div>'), array('<br>', ''), $text); |
|
115 | + } |
|
112 | 116 | |
113 | 117 | // If there's a trailing break get rid of it - Firefox tends to add one. |
114 | 118 | $text = preg_replace('~<br\s?/?' . '>$~i', '', $text); |
@@ -123,8 +127,9 @@ discard block |
||
123 | 127 | for ($i = 0, $n = count($parts); $i < $n; $i++) |
124 | 128 | { |
125 | 129 | // Value of 2 means we're inside the tag. |
126 | - if ($i % 4 == 2) |
|
127 | - $parts[$i] = strip_tags($parts[$i]); |
|
130 | + if ($i % 4 == 2) { |
|
131 | + $parts[$i] = strip_tags($parts[$i]); |
|
132 | + } |
|
128 | 133 | } |
129 | 134 | |
130 | 135 | $text = strtr(implode('', $parts), array('#smf_br_spec_grudge_cool!#' => '<br>')); |
@@ -150,18 +155,19 @@ discard block |
||
150 | 155 | { |
151 | 156 | $found = array_search($file, $smileysto); |
152 | 157 | // Note the weirdness here is to stop double spaces between smileys. |
153 | - if ($found) |
|
154 | - $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
155 | - else |
|
156 | - $matches[1][$k] = ''; |
|
158 | + if ($found) { |
|
159 | + $matches[1][$k] = '-[]-smf_smily_start#|#' . $smcFunc['htmlspecialchars']($smileysfrom[$found]) . '-[]-smf_smily_end#|#'; |
|
160 | + } else { |
|
161 | + $matches[1][$k] = ''; |
|
162 | + } |
|
157 | 163 | } |
158 | - } |
|
159 | - else |
|
164 | + } else |
|
160 | 165 | { |
161 | 166 | // Load all the smileys. |
162 | 167 | $names = array(); |
163 | - foreach ($matches[1] as $file) |
|
164 | - $names[] = $file; |
|
168 | + foreach ($matches[1] as $file) { |
|
169 | + $names[] = $file; |
|
170 | + } |
|
165 | 171 | $names = array_unique($names); |
166 | 172 | |
167 | 173 | if (!empty($names)) |
@@ -175,13 +181,15 @@ discard block |
||
175 | 181 | ) |
176 | 182 | ); |
177 | 183 | $mappings = array(); |
178 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
179 | - $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
184 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
185 | + $mappings[$row['filename']] = $smcFunc['htmlspecialchars']($row['code']); |
|
186 | + } |
|
180 | 187 | $smcFunc['db_free_result']($request); |
181 | 188 | |
182 | - foreach ($matches[1] as $k => $file) |
|
183 | - if (isset($mappings[$file])) |
|
189 | + foreach ($matches[1] as $k => $file) { |
|
190 | + if (isset($mappings[$file])) |
|
184 | 191 | $matches[1][$k] = '-[]-smf_smily_start#|#' . $mappings[$file] . '-[]-smf_smily_end#|#'; |
192 | + } |
|
185 | 193 | } |
186 | 194 | } |
187 | 195 | |
@@ -193,8 +201,9 @@ discard block |
||
193 | 201 | } |
194 | 202 | |
195 | 203 | // Only try to buy more time if the client didn't quit. |
196 | - if (connection_aborted() && $context['server']['is_apache']) |
|
197 | - @apache_reset_timeout(); |
|
204 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
205 | + @apache_reset_timeout(); |
|
206 | + } |
|
198 | 207 | |
199 | 208 | $parts = preg_split('~(<[A-Za-z]+\s*[^<>]*?style="?[^<>"]+"?[^<>]*?(?:/?)>|</[A-Za-z]+>)~', $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
200 | 209 | $replacement = ''; |
@@ -205,9 +214,9 @@ discard block |
||
205 | 214 | if (preg_match('~(<([A-Za-z]+)\s*[^<>]*?)style="?([^<>"]+)"?([^<>]*?(/?)>)~', $part, $matches) === 1) |
206 | 215 | { |
207 | 216 | // If it's being closed instantly, we can't deal with it...yet. |
208 | - if ($matches[5] === '/') |
|
209 | - continue; |
|
210 | - else |
|
217 | + if ($matches[5] === '/') { |
|
218 | + continue; |
|
219 | + } else |
|
211 | 220 | { |
212 | 221 | // Get an array of styles that apply to this element. (The strtr is there to combat HTML generated by Word.) |
213 | 222 | $styles = explode(';', strtr($matches[3], array('"' => ''))); |
@@ -223,8 +232,9 @@ discard block |
||
223 | 232 | $clean_type_value_pair = strtolower(strtr(trim($type_value_pair), '=', ':')); |
224 | 233 | |
225 | 234 | // Something like 'font-weight: bold' is expected here. |
226 | - if (strpos($clean_type_value_pair, ':') === false) |
|
227 | - continue; |
|
235 | + if (strpos($clean_type_value_pair, ':') === false) { |
|
236 | + continue; |
|
237 | + } |
|
228 | 238 | |
229 | 239 | // Capture the elements of a single style item (e.g. 'font-weight' and 'bold'). |
230 | 240 | list ($style_type, $style_value) = explode(':', $type_value_pair); |
@@ -246,8 +256,7 @@ discard block |
||
246 | 256 | { |
247 | 257 | $curCloseTags .= '[/u]'; |
248 | 258 | $replacement .= '[u]'; |
249 | - } |
|
250 | - elseif ($style_value == 'line-through') |
|
259 | + } elseif ($style_value == 'line-through') |
|
251 | 260 | { |
252 | 261 | $curCloseTags .= '[/s]'; |
253 | 262 | $replacement .= '[s]'; |
@@ -259,13 +268,11 @@ discard block |
||
259 | 268 | { |
260 | 269 | $curCloseTags .= '[/left]'; |
261 | 270 | $replacement .= '[left]'; |
262 | - } |
|
263 | - elseif ($style_value == 'center') |
|
271 | + } elseif ($style_value == 'center') |
|
264 | 272 | { |
265 | 273 | $curCloseTags .= '[/center]'; |
266 | 274 | $replacement .= '[center]'; |
267 | - } |
|
268 | - elseif ($style_value == 'right') |
|
275 | + } elseif ($style_value == 'right') |
|
269 | 276 | { |
270 | 277 | $curCloseTags .= '[/right]'; |
271 | 278 | $replacement .= '[right]'; |
@@ -287,8 +294,9 @@ discard block |
||
287 | 294 | |
288 | 295 | case 'font-size': |
289 | 296 | // Sometimes people put decimals where decimals should not be. |
290 | - if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) |
|
291 | - $style_value = $dec_matches[1] . $dec_matches[2]; |
|
297 | + if (preg_match('~(\d)+\.\d+(p[xt])~i', $style_value, $dec_matches) === 1) { |
|
298 | + $style_value = $dec_matches[1] . $dec_matches[2]; |
|
299 | + } |
|
292 | 300 | |
293 | 301 | $curCloseTags .= '[/size]'; |
294 | 302 | $replacement .= '[size=' . $style_value . ']'; |
@@ -296,8 +304,9 @@ discard block |
||
296 | 304 | |
297 | 305 | case 'font-family': |
298 | 306 | // Only get the first freaking font if there's a list! |
299 | - if (strpos($style_value, ',') !== false) |
|
300 | - $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
307 | + if (strpos($style_value, ',') !== false) { |
|
308 | + $style_value = substr($style_value, 0, strpos($style_value, ',')); |
|
309 | + } |
|
301 | 310 | |
302 | 311 | $curCloseTags .= '[/font]'; |
303 | 312 | $replacement .= '[font=' . strtr($style_value, array("'" => '')) . ']'; |
@@ -306,13 +315,15 @@ discard block |
||
306 | 315 | // This is a hack for images with dimensions embedded. |
307 | 316 | case 'width': |
308 | 317 | case 'height': |
309 | - if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) |
|
310 | - $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
318 | + if (preg_match('~[1-9]\d*~i', $style_value, $dimension) === 1) { |
|
319 | + $extra_attr .= ' ' . $style_type . '="' . $dimension[0] . '"'; |
|
320 | + } |
|
311 | 321 | break; |
312 | 322 | |
313 | 323 | case 'list-style-type': |
314 | - if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) |
|
315 | - $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
324 | + if (preg_match('~none|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-alpha|upper-alpha|lower-greek|lower-latin|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha~i', $style_value, $listType) === 1) { |
|
325 | + $extra_attr .= ' listtype="' . $listType[0] . '"'; |
|
326 | + } |
|
316 | 327 | break; |
317 | 328 | } |
318 | 329 | } |
@@ -325,18 +336,17 @@ discard block |
||
325 | 336 | } |
326 | 337 | |
327 | 338 | // If there's something that still needs closing, push it to the stack. |
328 | - if (!empty($curCloseTags)) |
|
329 | - array_push($stack, array( |
|
339 | + if (!empty($curCloseTags)) { |
|
340 | + array_push($stack, array( |
|
330 | 341 | 'element' => strtolower($curElement), |
331 | 342 | 'closeTags' => $curCloseTags |
332 | 343 | ) |
333 | 344 | ); |
334 | - elseif (!empty($extra_attr)) |
|
335 | - $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
345 | + } elseif (!empty($extra_attr)) { |
|
346 | + $replacement .= $precedingStyle . $extra_attr . $afterStyle; |
|
347 | + } |
|
336 | 348 | } |
337 | - } |
|
338 | - |
|
339 | - elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
349 | + } elseif (preg_match('~</([A-Za-z]+)>~', $part, $matches) === 1) |
|
340 | 350 | { |
341 | 351 | // Is this the element that we've been waiting for to be closed? |
342 | 352 | if (!empty($stack) && strtolower($matches[1]) === $stack[count($stack) - 1]['element']) |
@@ -346,28 +356,32 @@ discard block |
||
346 | 356 | } |
347 | 357 | |
348 | 358 | // Must've been something else. |
349 | - else |
|
350 | - $replacement .= $part; |
|
359 | + else { |
|
360 | + $replacement .= $part; |
|
361 | + } |
|
351 | 362 | } |
352 | 363 | // In all other cases, just add the part to the replacement. |
353 | - else |
|
354 | - $replacement .= $part; |
|
364 | + else { |
|
365 | + $replacement .= $part; |
|
366 | + } |
|
355 | 367 | } |
356 | 368 | |
357 | 369 | // Now put back the replacement in the text. |
358 | 370 | $text = $replacement; |
359 | 371 | |
360 | 372 | // We are not finished yet, request more time. |
361 | - if (connection_aborted() && $context['server']['is_apache']) |
|
362 | - @apache_reset_timeout(); |
|
373 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
374 | + @apache_reset_timeout(); |
|
375 | + } |
|
363 | 376 | |
364 | 377 | // Let's pull out any legacy alignments. |
365 | 378 | while (preg_match('~<([A-Za-z]+)\s+[^<>]*?(align="*(left|center|right)"*)[^<>]*?(/?)>~i', $text, $matches) === 1) |
366 | 379 | { |
367 | 380 | // Find the position in the text of this tag over again. |
368 | 381 | $start_pos = strpos($text, $matches[0]); |
369 | - if ($start_pos === false) |
|
370 | - break; |
|
382 | + if ($start_pos === false) { |
|
383 | + break; |
|
384 | + } |
|
371 | 385 | |
372 | 386 | // End tag? |
373 | 387 | if ($matches[4] != '/' && strpos($text, '</' . $matches[1] . '>', $start_pos) !== false) |
@@ -382,8 +396,7 @@ discard block |
||
382 | 396 | |
383 | 397 | // Put the tags back into the body. |
384 | 398 | $text = substr($text, 0, $start_pos) . $tag . '[' . $matches[3] . ']' . $content . '[/' . $matches[3] . ']' . substr($text, $end_pos); |
385 | - } |
|
386 | - else |
|
399 | + } else |
|
387 | 400 | { |
388 | 401 | // Just get rid of this evil tag. |
389 | 402 | $text = substr($text, 0, $start_pos) . substr($text, $start_pos + strlen($matches[0])); |
@@ -396,8 +409,9 @@ discard block |
||
396 | 409 | // Find the position of this again. |
397 | 410 | $start_pos = strpos($text, $matches[0]); |
398 | 411 | $end_pos = false; |
399 | - if ($start_pos === false) |
|
400 | - break; |
|
412 | + if ($start_pos === false) { |
|
413 | + break; |
|
414 | + } |
|
401 | 415 | |
402 | 416 | // This must have an end tag - and we must find the right one. |
403 | 417 | $lower_text = strtolower($text); |
@@ -430,8 +444,9 @@ discard block |
||
430 | 444 | break; |
431 | 445 | } |
432 | 446 | } |
433 | - if ($end_pos === false) |
|
434 | - break; |
|
447 | + if ($end_pos === false) { |
|
448 | + break; |
|
449 | + } |
|
435 | 450 | |
436 | 451 | // Now work out what the attributes are. |
437 | 452 | $attribs = fetchTagAttributes($matches[1]); |
@@ -445,11 +460,11 @@ discard block |
||
445 | 460 | $v = (int) trim($v); |
446 | 461 | $v = empty($v) ? 1 : $v; |
447 | 462 | $tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]'); |
463 | + } elseif ($s == 'face') { |
|
464 | + $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
465 | + } elseif ($s == 'color') { |
|
466 | + $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
448 | 467 | } |
449 | - elseif ($s == 'face') |
|
450 | - $tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]'); |
|
451 | - elseif ($s == 'color') |
|
452 | - $tags[] = array('[color=' . trim(strtolower($v)) . ']', '[/color]'); |
|
453 | 468 | } |
454 | 469 | |
455 | 470 | // As before add in our tags. |
@@ -457,8 +472,9 @@ discard block |
||
457 | 472 | foreach ($tags as $tag) |
458 | 473 | { |
459 | 474 | $before .= $tag[0]; |
460 | - if (isset($tag[1])) |
|
461 | - $after = $tag[1] . $after; |
|
475 | + if (isset($tag[1])) { |
|
476 | + $after = $tag[1] . $after; |
|
477 | + } |
|
462 | 478 | } |
463 | 479 | |
464 | 480 | // Remove the tag so it's never checked again. |
@@ -469,8 +485,9 @@ discard block |
||
469 | 485 | } |
470 | 486 | |
471 | 487 | // Almost there, just a little more time. |
472 | - if (connection_aborted() && $context['server']['is_apache']) |
|
473 | - @apache_reset_timeout(); |
|
488 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
489 | + @apache_reset_timeout(); |
|
490 | + } |
|
474 | 491 | |
475 | 492 | if (count($parts = preg_split('~<(/?)(li|ol|ul)([^>]*)>~i', $text, null, PREG_SPLIT_DELIM_CAPTURE)) > 1) |
476 | 493 | { |
@@ -526,12 +543,13 @@ discard block |
||
526 | 543 | { |
527 | 544 | $inList = true; |
528 | 545 | |
529 | - if ($tag === 'ol') |
|
530 | - $listType = 'decimal'; |
|
531 | - elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) |
|
532 | - $listType = $listTypeMapping[$match[1]]; |
|
533 | - else |
|
534 | - $listType = null; |
|
546 | + if ($tag === 'ol') { |
|
547 | + $listType = 'decimal'; |
|
548 | + } elseif (preg_match('~type="?(' . implode('|', array_keys($listTypeMapping)) . ')"?~', $parts[$i + 3], $match) === 1) { |
|
549 | + $listType = $listTypeMapping[$match[1]]; |
|
550 | + } else { |
|
551 | + $listType = null; |
|
552 | + } |
|
535 | 553 | |
536 | 554 | $listDepth++; |
537 | 555 | |
@@ -595,9 +613,7 @@ discard block |
||
595 | 613 | $parts[$i + 1] = ''; |
596 | 614 | $parts[$i + 2] = str_repeat("\t", $listDepth) . '[/list]'; |
597 | 615 | $parts[$i + 3] = ''; |
598 | - } |
|
599 | - |
|
600 | - else |
|
616 | + } else |
|
601 | 617 | { |
602 | 618 | // We're in a list item. |
603 | 619 | if ($listDepth > 0) |
@@ -634,9 +650,7 @@ discard block |
||
634 | 650 | $parts[$i + 1] = ''; |
635 | 651 | $parts[$i + 2] = ''; |
636 | 652 | $parts[$i + 3] = ''; |
637 | - } |
|
638 | - |
|
639 | - else |
|
653 | + } else |
|
640 | 654 | { |
641 | 655 | // Remove the trailing breaks from the list item. |
642 | 656 | $parts[$i] = preg_replace('~\s*<br\s*' . '/?' . '>\s*$~', '', $parts[$i]); |
@@ -674,8 +688,9 @@ discard block |
||
674 | 688 | $text .= str_repeat("\t", $listDepth) . '[/list]'; |
675 | 689 | } |
676 | 690 | |
677 | - for ($i = $listDepth; $i > 0; $i--) |
|
678 | - $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
691 | + for ($i = $listDepth; $i > 0; $i--) { |
|
692 | + $text .= '[/li]' . "\n" . str_repeat("\t", $i - 1) . '[/list]'; |
|
693 | + } |
|
679 | 694 | |
680 | 695 | } |
681 | 696 | |
@@ -684,8 +699,9 @@ discard block |
||
684 | 699 | { |
685 | 700 | // Find the position of the image. |
686 | 701 | $start_pos = strpos($text, $matches[0]); |
687 | - if ($start_pos === false) |
|
688 | - break; |
|
702 | + if ($start_pos === false) { |
|
703 | + break; |
|
704 | + } |
|
689 | 705 | $end_pos = $start_pos + strlen($matches[0]); |
690 | 706 | |
691 | 707 | $params = ''; |
@@ -695,12 +711,13 @@ discard block |
||
695 | 711 | $attrs = fetchTagAttributes($matches[1]); |
696 | 712 | foreach ($attrs as $attrib => $value) |
697 | 713 | { |
698 | - if (in_array($attrib, array('width', 'height'))) |
|
699 | - $params .= ' ' . $attrib . '=' . (int) $value; |
|
700 | - elseif ($attrib == 'alt' && trim($value) != '') |
|
701 | - $params .= ' alt=' . trim($value); |
|
702 | - elseif ($attrib == 'src') |
|
703 | - $src = trim($value); |
|
714 | + if (in_array($attrib, array('width', 'height'))) { |
|
715 | + $params .= ' ' . $attrib . '=' . (int) $value; |
|
716 | + } elseif ($attrib == 'alt' && trim($value) != '') { |
|
717 | + $params .= ' alt=' . trim($value); |
|
718 | + } elseif ($attrib == 'src') { |
|
719 | + $src = trim($value); |
|
720 | + } |
|
704 | 721 | } |
705 | 722 | |
706 | 723 | $tag = ''; |
@@ -711,10 +728,11 @@ discard block |
||
711 | 728 | { |
712 | 729 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
713 | 730 | |
714 | - if (substr($src, 0, 1) === '/') |
|
715 | - $src = $baseURL . $src; |
|
716 | - else |
|
717 | - $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
731 | + if (substr($src, 0, 1) === '/') { |
|
732 | + $src = $baseURL . $src; |
|
733 | + } else { |
|
734 | + $src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src; |
|
735 | + } |
|
718 | 736 | } |
719 | 737 | |
720 | 738 | $tag = '[img' . $params . ']' . $src . '[/img]'; |
@@ -892,20 +910,23 @@ discard block |
||
892 | 910 | }, |
893 | 911 | ); |
894 | 912 | |
895 | - foreach ($tags as $tag => $replace) |
|
896 | - $text = preg_replace_callback($tag, $replace, $text); |
|
913 | + foreach ($tags as $tag => $replace) { |
|
914 | + $text = preg_replace_callback($tag, $replace, $text); |
|
915 | + } |
|
897 | 916 | |
898 | 917 | // Please give us just a little more time. |
899 | - if (connection_aborted() && $context['server']['is_apache']) |
|
900 | - @apache_reset_timeout(); |
|
918 | + if (connection_aborted() && $context['server']['is_apache']) { |
|
919 | + @apache_reset_timeout(); |
|
920 | + } |
|
901 | 921 | |
902 | 922 | // What about URL's - the pain in the ass of the tag world. |
903 | 923 | while (preg_match('~<a\s+([^<>]*)>([^<>]*)</a>~i', $text, $matches) === 1) |
904 | 924 | { |
905 | 925 | // Find the position of the URL. |
906 | 926 | $start_pos = strpos($text, $matches[0]); |
907 | - if ($start_pos === false) |
|
908 | - break; |
|
927 | + if ($start_pos === false) { |
|
928 | + break; |
|
929 | + } |
|
909 | 930 | $end_pos = $start_pos + strlen($matches[0]); |
910 | 931 | |
911 | 932 | $tag_type = 'url'; |
@@ -919,8 +940,9 @@ discard block |
||
919 | 940 | $href = trim($value); |
920 | 941 | |
921 | 942 | // Are we dealing with an FTP link? |
922 | - if (preg_match('~^ftps?://~', $href) === 1) |
|
923 | - $tag_type = 'ftp'; |
|
943 | + if (preg_match('~^ftps?://~', $href) === 1) { |
|
944 | + $tag_type = 'ftp'; |
|
945 | + } |
|
924 | 946 | |
925 | 947 | // Or is this a link to an email address? |
926 | 948 | elseif (substr($href, 0, 7) == 'mailto:') |
@@ -934,28 +956,31 @@ discard block |
||
934 | 956 | { |
935 | 957 | $baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']); |
936 | 958 | |
937 | - if (substr($href, 0, 1) === '/') |
|
938 | - $href = $baseURL . $href; |
|
939 | - else |
|
940 | - $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
959 | + if (substr($href, 0, 1) === '/') { |
|
960 | + $href = $baseURL . $href; |
|
961 | + } else { |
|
962 | + $href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href; |
|
963 | + } |
|
941 | 964 | } |
942 | 965 | } |
943 | 966 | |
944 | 967 | // External URL? |
945 | 968 | if ($attrib == 'target' && $tag_type == 'url') |
946 | 969 | { |
947 | - if (trim($value) == '_blank') |
|
948 | - $tag_type == 'iurl'; |
|
970 | + if (trim($value) == '_blank') { |
|
971 | + $tag_type == 'iurl'; |
|
972 | + } |
|
949 | 973 | } |
950 | 974 | } |
951 | 975 | |
952 | 976 | $tag = ''; |
953 | 977 | if ($href != '') |
954 | 978 | { |
955 | - if ($matches[2] == $href) |
|
956 | - $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
957 | - else |
|
958 | - $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
979 | + if ($matches[2] == $href) { |
|
980 | + $tag = '[' . $tag_type . ']' . $href . '[/' . $tag_type . ']'; |
|
981 | + } else { |
|
982 | + $tag = '[' . $tag_type . '=' . $href . ']' . $matches[2] . '[/' . $tag_type . ']'; |
|
983 | + } |
|
959 | 984 | } |
960 | 985 | |
961 | 986 | // Replace the tag |
@@ -995,17 +1020,18 @@ discard block |
||
995 | 1020 | // We're either moving from the key to the attribute or we're in a string and this is fine. |
996 | 1021 | if ($text[$i] == '=') |
997 | 1022 | { |
998 | - if ($tag_state == 0) |
|
999 | - $tag_state = 1; |
|
1000 | - elseif ($tag_state == 2) |
|
1001 | - $value .= '='; |
|
1023 | + if ($tag_state == 0) { |
|
1024 | + $tag_state = 1; |
|
1025 | + } elseif ($tag_state == 2) { |
|
1026 | + $value .= '='; |
|
1027 | + } |
|
1002 | 1028 | } |
1003 | 1029 | // A space is either moving from an attribute back to a potential key or in a string is fine. |
1004 | 1030 | elseif ($text[$i] == ' ') |
1005 | 1031 | { |
1006 | - if ($tag_state == 2) |
|
1007 | - $value .= ' '; |
|
1008 | - elseif ($tag_state == 1) |
|
1032 | + if ($tag_state == 2) { |
|
1033 | + $value .= ' '; |
|
1034 | + } elseif ($tag_state == 1) |
|
1009 | 1035 | { |
1010 | 1036 | $attribs[$key] = $value; |
1011 | 1037 | $key = $value = ''; |
@@ -1016,24 +1042,27 @@ discard block |
||
1016 | 1042 | elseif ($text[$i] == '"') |
1017 | 1043 | { |
1018 | 1044 | // Must be either going into or out of a string. |
1019 | - if ($tag_state == 1) |
|
1020 | - $tag_state = 2; |
|
1021 | - else |
|
1022 | - $tag_state = 1; |
|
1045 | + if ($tag_state == 1) { |
|
1046 | + $tag_state = 2; |
|
1047 | + } else { |
|
1048 | + $tag_state = 1; |
|
1049 | + } |
|
1023 | 1050 | } |
1024 | 1051 | // Otherwise it's fine. |
1025 | 1052 | else |
1026 | 1053 | { |
1027 | - if ($tag_state == 0) |
|
1028 | - $key .= $text[$i]; |
|
1029 | - else |
|
1030 | - $value .= $text[$i]; |
|
1054 | + if ($tag_state == 0) { |
|
1055 | + $key .= $text[$i]; |
|
1056 | + } else { |
|
1057 | + $value .= $text[$i]; |
|
1058 | + } |
|
1031 | 1059 | } |
1032 | 1060 | } |
1033 | 1061 | |
1034 | 1062 | // Anything left? |
1035 | - if ($key != '' && $value != '') |
|
1036 | - $attribs[$key] = $value; |
|
1063 | + if ($key != '' && $value != '') { |
|
1064 | + $attribs[$key] = $value; |
|
1065 | + } |
|
1037 | 1066 | |
1038 | 1067 | return $attribs; |
1039 | 1068 | } |
@@ -1049,8 +1078,9 @@ discard block |
||
1049 | 1078 | global $modSettings; |
1050 | 1079 | |
1051 | 1080 | // Don't care about the texts that are too short. |
1052 | - if (strlen($text) < 3) |
|
1053 | - return $text; |
|
1081 | + if (strlen($text) < 3) { |
|
1082 | + return $text; |
|
1083 | + } |
|
1054 | 1084 | |
1055 | 1085 | // We are going to cycle through the BBC and keep track of tags as they arise - in order. If get to a block level tag we're going to make sure it's not in a non-block level tag! |
1056 | 1086 | // This will keep the order of tags that are open. |
@@ -1063,8 +1093,9 @@ discard block |
||
1063 | 1093 | $disabled = empty($modSettings['disabledBBC']) ? array() : array_flip(explode(',', strtolower($modSettings['disabledBBC']))); |
1064 | 1094 | |
1065 | 1095 | // Add flash if it's disabled as embedded tag. |
1066 | - if (empty($modSettings['enableEmbeddedFlash'])) |
|
1067 | - $disabled['flash'] = true; |
|
1096 | + if (empty($modSettings['enableEmbeddedFlash'])) { |
|
1097 | + $disabled['flash'] = true; |
|
1098 | + } |
|
1068 | 1099 | |
1069 | 1100 | // Get a list of all the tags that are not disabled. |
1070 | 1101 | $all_tags = parse_bbc(false); |
@@ -1072,10 +1103,12 @@ discard block |
||
1072 | 1103 | $self_closing_tags = array(); |
1073 | 1104 | foreach ($all_tags as $tag) |
1074 | 1105 | { |
1075 | - if (!isset($disabled[$tag['tag']])) |
|
1076 | - $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1077 | - if (isset($tag['type']) && $tag['type'] == 'closed') |
|
1078 | - $self_closing_tags[] = $tag['tag']; |
|
1106 | + if (!isset($disabled[$tag['tag']])) { |
|
1107 | + $valid_tags[$tag['tag']] = !empty($tag['block_level']); |
|
1108 | + } |
|
1109 | + if (isset($tag['type']) && $tag['type'] == 'closed') { |
|
1110 | + $self_closing_tags[] = $tag['tag']; |
|
1111 | + } |
|
1079 | 1112 | } |
1080 | 1113 | |
1081 | 1114 | // Don't worry if we're in a code/nobbc. |
@@ -1105,16 +1138,19 @@ discard block |
||
1105 | 1138 | $tagName = substr($match, $isClosingTag ? 2 : 1, -1); |
1106 | 1139 | |
1107 | 1140 | // We're closing the exact same tag that we opened. |
1108 | - if ($isClosingTag && $insideTag === $tagName) |
|
1109 | - $insideTag = null; |
|
1141 | + if ($isClosingTag && $insideTag === $tagName) { |
|
1142 | + $insideTag = null; |
|
1143 | + } |
|
1110 | 1144 | |
1111 | 1145 | // We're opening a tag and we're not yet inside one either |
1112 | - elseif (!$isClosingTag && $insideTag === null) |
|
1113 | - $insideTag = $tagName; |
|
1146 | + elseif (!$isClosingTag && $insideTag === null) { |
|
1147 | + $insideTag = $tagName; |
|
1148 | + } |
|
1114 | 1149 | |
1115 | 1150 | // In all other cases, this tag must be invalid |
1116 | - else |
|
1117 | - unset($matches[$i]); |
|
1151 | + else { |
|
1152 | + unset($matches[$i]); |
|
1153 | + } |
|
1118 | 1154 | } |
1119 | 1155 | |
1120 | 1156 | // The next one is gonna be the other one. |
@@ -1122,8 +1158,9 @@ discard block |
||
1122 | 1158 | } |
1123 | 1159 | |
1124 | 1160 | // We're still inside a tag and had no chance for closure? |
1125 | - if ($insideTag !== null) |
|
1126 | - $matches[] = '[/' . $insideTag . ']'; |
|
1161 | + if ($insideTag !== null) { |
|
1162 | + $matches[] = '[/' . $insideTag . ']'; |
|
1163 | + } |
|
1127 | 1164 | |
1128 | 1165 | // And a complete text string again. |
1129 | 1166 | $text = implode('', $matches); |
@@ -1132,8 +1169,9 @@ discard block |
||
1132 | 1169 | // Quickly remove any tags which are back to back. |
1133 | 1170 | $backToBackPattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), array('td', 'anchor'))) . ')[^<>\\[\\]]*\\]\s*\\[/\\1\\]~'; |
1134 | 1171 | $lastlen = 0; |
1135 | - while (strlen($text) !== $lastlen) |
|
1136 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1172 | + while (strlen($text) !== $lastlen) { |
|
1173 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1174 | + } |
|
1137 | 1175 | |
1138 | 1176 | // Need to sort the tags my name length. |
1139 | 1177 | uksort($valid_tags, 'sort_array_length'); |
@@ -1177,8 +1215,9 @@ discard block |
||
1177 | 1215 | $isCompetingTag = in_array($tag, $competing_tags); |
1178 | 1216 | |
1179 | 1217 | // Check if this might be one of those cleaned out tags. |
1180 | - if ($tag === '') |
|
1181 | - continue; |
|
1218 | + if ($tag === '') { |
|
1219 | + continue; |
|
1220 | + } |
|
1182 | 1221 | |
1183 | 1222 | // Special case: inside [code] blocks any code is left untouched. |
1184 | 1223 | elseif ($tag === 'code') |
@@ -1189,8 +1228,9 @@ discard block |
||
1189 | 1228 | $inCode = false; |
1190 | 1229 | |
1191 | 1230 | // Reopen tags that were closed before the code block. |
1192 | - if (!empty($inlineElements)) |
|
1193 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1231 | + if (!empty($inlineElements)) { |
|
1232 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1233 | + } |
|
1194 | 1234 | } |
1195 | 1235 | |
1196 | 1236 | // We're outside a coding and nobbc block and opening it. |
@@ -1219,8 +1259,9 @@ discard block |
||
1219 | 1259 | $inNoBbc = false; |
1220 | 1260 | |
1221 | 1261 | // Some inline elements might've been closed that need reopening. |
1222 | - if (!empty($inlineElements)) |
|
1223 | - $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1262 | + if (!empty($inlineElements)) { |
|
1263 | + $parts[$i + 4] .= '[' . implode('][', array_keys($inlineElements)) . ']'; |
|
1264 | + } |
|
1224 | 1265 | } |
1225 | 1266 | |
1226 | 1267 | // We're outside a nobbc and coding block and opening it. |
@@ -1240,8 +1281,9 @@ discard block |
||
1240 | 1281 | } |
1241 | 1282 | |
1242 | 1283 | // So, we're inside one of the special blocks: ignore any tag. |
1243 | - elseif ($inCode || $inNoBbc) |
|
1244 | - continue; |
|
1284 | + elseif ($inCode || $inNoBbc) { |
|
1285 | + continue; |
|
1286 | + } |
|
1245 | 1287 | |
1246 | 1288 | // We're dealing with an opening tag. |
1247 | 1289 | if ($isOpeningTag) |
@@ -1282,8 +1324,9 @@ discard block |
||
1282 | 1324 | if ($parts[$j + 3] === $tag) |
1283 | 1325 | { |
1284 | 1326 | // If it's an opening tag, increase the level. |
1285 | - if ($parts[$j + 2] === '') |
|
1286 | - $curLevel++; |
|
1327 | + if ($parts[$j + 2] === '') { |
|
1328 | + $curLevel++; |
|
1329 | + } |
|
1287 | 1330 | |
1288 | 1331 | // A closing tag, decrease the level. |
1289 | 1332 | else |
@@ -1306,13 +1349,15 @@ discard block |
||
1306 | 1349 | { |
1307 | 1350 | if ($isCompetingTag) |
1308 | 1351 | { |
1309 | - if (!isset($competingElements[$tag])) |
|
1310 | - $competingElements[$tag] = array(); |
|
1352 | + if (!isset($competingElements[$tag])) { |
|
1353 | + $competingElements[$tag] = array(); |
|
1354 | + } |
|
1311 | 1355 | |
1312 | 1356 | $competingElements[$tag][] = $parts[$i + 4]; |
1313 | 1357 | |
1314 | - if (count($competingElements[$tag]) > 1) |
|
1315 | - $parts[$i] .= '[/' . $tag . ']'; |
|
1358 | + if (count($competingElements[$tag]) > 1) { |
|
1359 | + $parts[$i] .= '[/' . $tag . ']'; |
|
1360 | + } |
|
1316 | 1361 | } |
1317 | 1362 | |
1318 | 1363 | $inlineElements[$elementContent] = $tag; |
@@ -1333,15 +1378,17 @@ discard block |
||
1333 | 1378 | $addClosingTags = array(); |
1334 | 1379 | while ($element = array_pop($blockElements)) |
1335 | 1380 | { |
1336 | - if ($element === $tag) |
|
1337 | - break; |
|
1381 | + if ($element === $tag) { |
|
1382 | + break; |
|
1383 | + } |
|
1338 | 1384 | |
1339 | 1385 | // Still a block tag was open not equal to this tag. |
1340 | 1386 | $addClosingTags[] = $element['type']; |
1341 | 1387 | } |
1342 | 1388 | |
1343 | - if (!empty($addClosingTags)) |
|
1344 | - $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1389 | + if (!empty($addClosingTags)) { |
|
1390 | + $parts[$i + 1] = '[/' . implode('][/', array_reverse($addClosingTags)) . ']' . $parts[$i + 1]; |
|
1391 | + } |
|
1345 | 1392 | |
1346 | 1393 | // Apparently the closing tag was not found on the stack. |
1347 | 1394 | if (!is_string($element) || $element !== $tag) |
@@ -1351,8 +1398,7 @@ discard block |
||
1351 | 1398 | $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
1352 | 1399 | continue; |
1353 | 1400 | } |
1354 | - } |
|
1355 | - else |
|
1401 | + } else |
|
1356 | 1402 | { |
1357 | 1403 | // Get rid of this closing tag! |
1358 | 1404 | $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
@@ -1381,53 +1427,62 @@ discard block |
||
1381 | 1427 | unset($inlineElements[$tagContentToBeClosed]); |
1382 | 1428 | |
1383 | 1429 | // Was this the tag we were looking for? |
1384 | - if ($tagToBeClosed === $tag) |
|
1385 | - break; |
|
1430 | + if ($tagToBeClosed === $tag) { |
|
1431 | + break; |
|
1432 | + } |
|
1386 | 1433 | |
1387 | 1434 | // Nope, close it and look further! |
1388 | - else |
|
1389 | - $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1435 | + else { |
|
1436 | + $parts[$i] .= '[/' . $tagToBeClosed . ']'; |
|
1437 | + } |
|
1390 | 1438 | } |
1391 | 1439 | |
1392 | 1440 | if ($isCompetingTag && !empty($competingElements[$tag])) |
1393 | 1441 | { |
1394 | 1442 | array_pop($competingElements[$tag]); |
1395 | 1443 | |
1396 | - if (count($competingElements[$tag]) > 0) |
|
1397 | - $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1444 | + if (count($competingElements[$tag]) > 0) { |
|
1445 | + $parts[$i + 5] = '[' . $tag . $competingElements[$tag][count($competingElements[$tag]) - 1] . $parts[$i + 5]; |
|
1446 | + } |
|
1398 | 1447 | } |
1399 | 1448 | } |
1400 | 1449 | |
1401 | 1450 | // Unexpected closing tag, ex-ter-mi-nate. |
1402 | - else |
|
1403 | - $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1451 | + else { |
|
1452 | + $parts[$i + 1] = $parts[$i + 2] = $parts[$i + 3] = $parts[$i + 4] = ''; |
|
1453 | + } |
|
1404 | 1454 | } |
1405 | 1455 | } |
1406 | 1456 | } |
1407 | 1457 | |
1408 | 1458 | // Close the code tags. |
1409 | - if ($inCode) |
|
1410 | - $parts[$i] .= '[/code]'; |
|
1459 | + if ($inCode) { |
|
1460 | + $parts[$i] .= '[/code]'; |
|
1461 | + } |
|
1411 | 1462 | |
1412 | 1463 | // The same for nobbc tags. |
1413 | - elseif ($inNoBbc) |
|
1414 | - $parts[$i] .= '[/nobbc]'; |
|
1464 | + elseif ($inNoBbc) { |
|
1465 | + $parts[$i] .= '[/nobbc]'; |
|
1466 | + } |
|
1415 | 1467 | |
1416 | 1468 | // Still inline tags left unclosed? Close them now, better late than never. |
1417 | - elseif (!empty($inlineElements)) |
|
1418 | - $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1469 | + elseif (!empty($inlineElements)) { |
|
1470 | + $parts[$i] .= '[/' . implode('][/', array_reverse($inlineElements)) . ']'; |
|
1471 | + } |
|
1419 | 1472 | |
1420 | 1473 | // Now close the block elements. |
1421 | - if (!empty($blockElements)) |
|
1422 | - $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1474 | + if (!empty($blockElements)) { |
|
1475 | + $parts[$i] .= '[/' . implode('][/', array_reverse($blockElements)) . ']'; |
|
1476 | + } |
|
1423 | 1477 | |
1424 | 1478 | $text = implode('', $parts); |
1425 | 1479 | } |
1426 | 1480 | |
1427 | 1481 | // Final clean up of back to back tags. |
1428 | 1482 | $lastlen = 0; |
1429 | - while (strlen($text) !== $lastlen) |
|
1430 | - $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1483 | + while (strlen($text) !== $lastlen) { |
|
1484 | + $lastlen = strlen($text = preg_replace($backToBackPattern, '', $text)); |
|
1485 | + } |
|
1431 | 1486 | |
1432 | 1487 | return $text; |
1433 | 1488 | } |
@@ -1456,22 +1511,25 @@ discard block |
||
1456 | 1511 | $context['template_layers'] = array(); |
1457 | 1512 | // Lets make sure we aren't going to output anything nasty. |
1458 | 1513 | @ob_end_clean(); |
1459 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
1460 | - @ob_start('ob_gzhandler'); |
|
1461 | - else |
|
1462 | - @ob_start(); |
|
1514 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
1515 | + @ob_start('ob_gzhandler'); |
|
1516 | + } else { |
|
1517 | + @ob_start(); |
|
1518 | + } |
|
1463 | 1519 | |
1464 | 1520 | // If we don't have any locale better avoid broken js |
1465 | - if (empty($txt['lang_locale'])) |
|
1466 | - die(); |
|
1521 | + if (empty($txt['lang_locale'])) { |
|
1522 | + die(); |
|
1523 | + } |
|
1467 | 1524 | |
1468 | 1525 | $file_data = '(function ($) { |
1469 | 1526 | \'use strict\'; |
1470 | 1527 | |
1471 | 1528 | $.sceditor.locale[' . javaScriptEscape($txt['lang_locale']) . '] = {'; |
1472 | - foreach ($editortxt as $key => $val) |
|
1473 | - $file_data .= ' |
|
1529 | + foreach ($editortxt as $key => $val) { |
|
1530 | + $file_data .= ' |
|
1474 | 1531 | ' . javaScriptEscape($key) . ': ' . javaScriptEscape($val) . ','; |
1532 | + } |
|
1475 | 1533 | |
1476 | 1534 | $file_data .= ' |
1477 | 1535 | dateFormat: "day.month.year" |
@@ -1539,8 +1597,9 @@ discard block |
||
1539 | 1597 | ) |
1540 | 1598 | ); |
1541 | 1599 | $icon_data = array(); |
1542 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
1543 | - $icon_data[] = $row; |
|
1600 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
1601 | + $icon_data[] = $row; |
|
1602 | + } |
|
1544 | 1603 | $smcFunc['db_free_result']($request); |
1545 | 1604 | |
1546 | 1605 | $icons = array(); |
@@ -1555,9 +1614,9 @@ discard block |
||
1555 | 1614 | } |
1556 | 1615 | |
1557 | 1616 | cache_put_data('posting_icons-' . $board_id, $icons, 480); |
1617 | + } else { |
|
1618 | + $icons = $temp; |
|
1558 | 1619 | } |
1559 | - else |
|
1560 | - $icons = $temp; |
|
1561 | 1620 | } |
1562 | 1621 | call_integration_hook('integrate_load_message_icons', array(&$icons)); |
1563 | 1622 | |
@@ -1598,8 +1657,9 @@ discard block |
||
1598 | 1657 | { |
1599 | 1658 | // Some general stuff. |
1600 | 1659 | $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set']; |
1601 | - if (!empty($context['drafts_autosave'])) |
|
1602 | - $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1660 | + if (!empty($context['drafts_autosave'])) { |
|
1661 | + $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000; |
|
1662 | + } |
|
1603 | 1663 | |
1604 | 1664 | // This really has some WYSIWYG stuff. |
1605 | 1665 | loadCSSFile('jquery.sceditor.css', array('force_current' => false, 'validate' => true), 'smf_jquery_sceditor'); |
@@ -1615,8 +1675,9 @@ discard block |
||
1615 | 1675 | var bbc_quote = \'' . addcslashes($txt['quote'], "'") . '\'; |
1616 | 1676 | var bbc_search_on = \'' . addcslashes($txt['search_on'], "'") . '\';'); |
1617 | 1677 | // editor language file |
1618 | - if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') |
|
1619 | - loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1678 | + if (!empty($txt['lang_locale']) && $txt['lang_locale'] != 'en_US') { |
|
1679 | + loadJavaScriptFile($scripturl . '?action=loadeditorlocale', array('external' => true), 'sceditor_language'); |
|
1680 | + } |
|
1620 | 1681 | |
1621 | 1682 | $context['shortcuts_text'] = $txt['shortcuts' . (!empty($context['drafts_save']) ? '_drafts' : '') . (isBrowser('is_firefox') ? '_firefox' : '')]; |
1622 | 1683 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv')))); |
@@ -1625,11 +1686,12 @@ discard block |
||
1625 | 1686 | loadJavaScriptFile('spellcheck.js', array(), 'smf_spellcheck'); |
1626 | 1687 | |
1627 | 1688 | // Some hidden information is needed in order to make the spell checking work. |
1628 | - if (!isset($_REQUEST['xml'])) |
|
1629 | - $context['insert_after_template'] .= ' |
|
1689 | + if (!isset($_REQUEST['xml'])) { |
|
1690 | + $context['insert_after_template'] .= ' |
|
1630 | 1691 | <form name="spell_form" id="spell_form" method="post" accept-charset="' . $context['character_set'] . '" target="spellWindow" action="' . $scripturl . '?action=spellcheck"> |
1631 | 1692 | <input type="hidden" name="spellstring" value=""> |
1632 | 1693 | </form>'; |
1694 | + } |
|
1633 | 1695 | } |
1634 | 1696 | } |
1635 | 1697 | |
@@ -1786,10 +1848,12 @@ discard block |
||
1786 | 1848 | |
1787 | 1849 | // Generate a list of buttons that shouldn't be shown - this should be the fastest way to do this. |
1788 | 1850 | $disabled_tags = array(); |
1789 | - if (!empty($modSettings['disabledBBC'])) |
|
1790 | - $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1791 | - if (empty($modSettings['enableEmbeddedFlash'])) |
|
1792 | - $disabled_tags[] = 'flash'; |
|
1851 | + if (!empty($modSettings['disabledBBC'])) { |
|
1852 | + $disabled_tags = explode(',', $modSettings['disabledBBC']); |
|
1853 | + } |
|
1854 | + if (empty($modSettings['enableEmbeddedFlash'])) { |
|
1855 | + $disabled_tags[] = 'flash'; |
|
1856 | + } |
|
1793 | 1857 | |
1794 | 1858 | foreach ($disabled_tags as $tag) |
1795 | 1859 | { |
@@ -1799,9 +1863,10 @@ discard block |
||
1799 | 1863 | $context['disabled_tags']['orderedlist'] = true; |
1800 | 1864 | } |
1801 | 1865 | |
1802 | - foreach ($editor_tag_map as $thisTag => $tagNameBBC) |
|
1803 | - if ($tag === $thisTag) |
|
1866 | + foreach ($editor_tag_map as $thisTag => $tagNameBBC) { |
|
1867 | + if ($tag === $thisTag) |
|
1804 | 1868 | $context['disabled_tags'][$tagNameBBC] = true; |
1869 | + } |
|
1805 | 1870 | |
1806 | 1871 | $context['disabled_tags'][trim($tag)] = true; |
1807 | 1872 | } |
@@ -1811,19 +1876,21 @@ discard block |
||
1811 | 1876 | $context['bbc_toolbar'] = array(); |
1812 | 1877 | foreach ($context['bbc_tags'] as $row => $tagRow) |
1813 | 1878 | { |
1814 | - if (!isset($context['bbc_toolbar'][$row])) |
|
1815 | - $context['bbc_toolbar'][$row] = array(); |
|
1879 | + if (!isset($context['bbc_toolbar'][$row])) { |
|
1880 | + $context['bbc_toolbar'][$row] = array(); |
|
1881 | + } |
|
1816 | 1882 | $tagsRow = array(); |
1817 | 1883 | foreach ($tagRow as $tag) |
1818 | 1884 | { |
1819 | 1885 | if ((!empty($tag['code'])) && empty($context['disabled_tags'][$tag['code']])) |
1820 | 1886 | { |
1821 | 1887 | $tagsRow[] = $tag['code']; |
1822 | - if (isset($tag['image'])) |
|
1823 | - $bbcodes_styles .= ' |
|
1888 | + if (isset($tag['image'])) { |
|
1889 | + $bbcodes_styles .= ' |
|
1824 | 1890 | .sceditor-button-' . $tag['code'] . ' div { |
1825 | 1891 | background: url(\'' . $settings['default_theme_url'] . '/images/bbc/' . $tag['image'] . '.png\'); |
1826 | 1892 | }'; |
1893 | + } |
|
1827 | 1894 | if (isset($tag['before'])) |
1828 | 1895 | { |
1829 | 1896 | $context['bbcodes_handlers'] .= ' |
@@ -1837,8 +1904,7 @@ discard block |
||
1837 | 1904 | });'; |
1838 | 1905 | } |
1839 | 1906 | |
1840 | - } |
|
1841 | - else |
|
1907 | + } else |
|
1842 | 1908 | { |
1843 | 1909 | $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
1844 | 1910 | $tagsRow = array(); |
@@ -1849,14 +1915,16 @@ discard block |
||
1849 | 1915 | { |
1850 | 1916 | $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
1851 | 1917 | $tagsRow = array(); |
1852 | - if (!isset($context['disabled_tags']['font'])) |
|
1853 | - $tagsRow[] = 'font'; |
|
1854 | - if (!isset($context['disabled_tags']['size'])) |
|
1855 | - $tagsRow[] = 'size'; |
|
1856 | - if (!isset($context['disabled_tags']['color'])) |
|
1857 | - $tagsRow[] = 'color'; |
|
1858 | - } |
|
1859 | - elseif ($row == 1 && empty($modSettings['disable_wysiwyg'])) |
|
1918 | + if (!isset($context['disabled_tags']['font'])) { |
|
1919 | + $tagsRow[] = 'font'; |
|
1920 | + } |
|
1921 | + if (!isset($context['disabled_tags']['size'])) { |
|
1922 | + $tagsRow[] = 'size'; |
|
1923 | + } |
|
1924 | + if (!isset($context['disabled_tags']['color'])) { |
|
1925 | + $tagsRow[] = 'color'; |
|
1926 | + } |
|
1927 | + } elseif ($row == 1 && empty($modSettings['disable_wysiwyg'])) |
|
1860 | 1928 | { |
1861 | 1929 | $tmp = array(); |
1862 | 1930 | $tagsRow[] = 'removeformat'; |
@@ -1867,13 +1935,15 @@ discard block |
||
1867 | 1935 | } |
1868 | 1936 | } |
1869 | 1937 | |
1870 | - if (!empty($tagsRow)) |
|
1871 | - $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1938 | + if (!empty($tagsRow)) { |
|
1939 | + $context['bbc_toolbar'][$row][] = implode(',', $tagsRow); |
|
1940 | + } |
|
1872 | 1941 | } |
1873 | - if (!empty($bbcodes_styles)) |
|
1874 | - $context['html_headers'] .= ' |
|
1942 | + if (!empty($bbcodes_styles)) { |
|
1943 | + $context['html_headers'] .= ' |
|
1875 | 1944 | <style>' . $bbcodes_styles . ' |
1876 | 1945 | </style>'; |
1946 | + } |
|
1877 | 1947 | } |
1878 | 1948 | |
1879 | 1949 | // Initialize smiley array... if not loaded before. |
@@ -1885,8 +1955,8 @@ discard block |
||
1885 | 1955 | ); |
1886 | 1956 | |
1887 | 1957 | // Load smileys - don't bother to run a query if we're not using the database's ones anyhow. |
1888 | - if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') |
|
1889 | - $context['smileys']['postform'][] = array( |
|
1958 | + if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') { |
|
1959 | + $context['smileys']['postform'][] = array( |
|
1890 | 1960 | 'smileys' => array( |
1891 | 1961 | array( |
1892 | 1962 | 'code' => ':)', |
@@ -1972,7 +2042,7 @@ discard block |
||
1972 | 2042 | ), |
1973 | 2043 | 'isLast' => true, |
1974 | 2044 | ); |
1975 | - elseif ($user_info['smiley_set'] != 'none') |
|
2045 | + } elseif ($user_info['smiley_set'] != 'none') |
|
1976 | 2046 | { |
1977 | 2047 | if (($temp = cache_get_data('posting_smileys', 480)) == null) |
1978 | 2048 | { |
@@ -1995,17 +2065,19 @@ discard block |
||
1995 | 2065 | |
1996 | 2066 | foreach ($context['smileys'] as $section => $smileyRows) |
1997 | 2067 | { |
1998 | - foreach ($smileyRows as $rowIndex => $smileys) |
|
1999 | - $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2068 | + foreach ($smileyRows as $rowIndex => $smileys) { |
|
2069 | + $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true; |
|
2070 | + } |
|
2000 | 2071 | |
2001 | - if (!empty($smileyRows)) |
|
2002 | - $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2072 | + if (!empty($smileyRows)) { |
|
2073 | + $context['smileys'][$section][count($smileyRows) - 1]['isLast'] = true; |
|
2074 | + } |
|
2003 | 2075 | } |
2004 | 2076 | |
2005 | 2077 | cache_put_data('posting_smileys', $context['smileys'], 480); |
2078 | + } else { |
|
2079 | + $context['smileys'] = $temp; |
|
2006 | 2080 | } |
2007 | - else |
|
2008 | - $context['smileys'] = $temp; |
|
2009 | 2081 | } |
2010 | 2082 | } |
2011 | 2083 | |
@@ -2031,8 +2103,9 @@ discard block |
||
2031 | 2103 | loadTemplate('GenericControls'); |
2032 | 2104 | |
2033 | 2105 | // Some javascript ma'am? |
2034 | - if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) |
|
2035 | - loadJavaScriptFile('captcha.js', array(), 'smf_captcha'); |
|
2106 | + if (!empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual']))) { |
|
2107 | + loadJavaScriptFile('captcha.js', array(), 'smf_captcha'); |
|
2108 | + } |
|
2036 | 2109 | |
2037 | 2110 | $context['use_graphic_library'] = in_array('gd', get_loaded_extensions()); |
2038 | 2111 | |
@@ -2045,8 +2118,8 @@ discard block |
||
2045 | 2118 | $isNew = !isset($context['controls']['verification'][$verificationOptions['id']]); |
2046 | 2119 | |
2047 | 2120 | // Log this into our collection. |
2048 | - if ($isNew) |
|
2049 | - $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2121 | + if ($isNew) { |
|
2122 | + $context['controls']['verification'][$verificationOptions['id']] = array( |
|
2050 | 2123 | 'id' => $verificationOptions['id'], |
2051 | 2124 | 'empty_field' => empty($verificationOptions['no_empty_field']), |
2052 | 2125 | 'show_visual' => !empty($verificationOptions['override_visual']) || (!empty($modSettings['visual_verification_type']) && !isset($verificationOptions['override_visual'])), |
@@ -2057,13 +2130,15 @@ discard block |
||
2057 | 2130 | 'questions' => array(), |
2058 | 2131 | 'can_recaptcha' => !empty($modSettings['recaptcha_enabled']) && $modSettings['recaptcha_enabled'] == 1 && !empty($modSettings['recaptcha_site_key']) && !empty($modSettings['recaptcha_secret_key']), |
2059 | 2132 | ); |
2133 | + } |
|
2060 | 2134 | $thisVerification = &$context['controls']['verification'][$verificationOptions['id']]; |
2061 | 2135 | |
2062 | 2136 | // Is there actually going to be anything? |
2063 | - if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) |
|
2064 | - return false; |
|
2065 | - elseif (!$isNew && !$do_test) |
|
2066 | - return true; |
|
2137 | + if (empty($thisVerification['show_visual']) && empty($thisVerification['number_questions']) && empty($thisVerification['can_recaptcha'])) { |
|
2138 | + return false; |
|
2139 | + } elseif (!$isNew && !$do_test) { |
|
2140 | + return true; |
|
2141 | + } |
|
2067 | 2142 | |
2068 | 2143 | // Sanitize reCAPTCHA fields? |
2069 | 2144 | if ($thisVerification['can_recaptcha']) |
@@ -2076,11 +2151,12 @@ discard block |
||
2076 | 2151 | } |
2077 | 2152 | |
2078 | 2153 | // Add javascript for the object. |
2079 | - if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) |
|
2080 | - $context['insert_after_template'] .= ' |
|
2154 | + if ($context['controls']['verification'][$verificationOptions['id']]['show_visual']) { |
|
2155 | + $context['insert_after_template'] .= ' |
|
2081 | 2156 | <script> |
2082 | 2157 | var verification' . $verificationOptions['id'] . 'Handle = new smfCaptcha("' . $thisVerification['image_href'] . '", "' . $verificationOptions['id'] . '", ' . ($context['use_graphic_library'] ? 1 : 0) . '); |
2083 | 2158 | </script>'; |
2159 | + } |
|
2084 | 2160 | |
2085 | 2161 | // If we want questions do we have a cache of all the IDs? |
2086 | 2162 | if (!empty($thisVerification['number_questions']) && empty($modSettings['question_id_cache'])) |
@@ -2103,8 +2179,9 @@ discard block |
||
2103 | 2179 | unset ($row['id_question']); |
2104 | 2180 | // Make them all lowercase. We can't directly use $smcFunc['strtolower'] with array_walk, so do it manually, eh? |
2105 | 2181 | $row['answers'] = smf_json_decode($row['answers'], true); |
2106 | - foreach ($row['answers'] as $k => $v) |
|
2107 | - $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2182 | + foreach ($row['answers'] as $k => $v) { |
|
2183 | + $row['answers'][$k] = $smcFunc['strtolower']($v); |
|
2184 | + } |
|
2108 | 2185 | |
2109 | 2186 | $modSettings['question_id_cache']['questions'][$id_question] = $row; |
2110 | 2187 | $modSettings['question_id_cache']['langs'][$row['lngfile']][] = $id_question; |
@@ -2115,35 +2192,42 @@ discard block |
||
2115 | 2192 | } |
2116 | 2193 | } |
2117 | 2194 | |
2118 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) |
|
2119 | - $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2195 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv'])) { |
|
2196 | + $_SESSION[$verificationOptions['id'] . '_vv'] = array(); |
|
2197 | + } |
|
2120 | 2198 | |
2121 | 2199 | // Do we need to refresh the verification? |
2122 | - if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) |
|
2123 | - $force_refresh = true; |
|
2124 | - else |
|
2125 | - $force_refresh = false; |
|
2200 | + if (!$do_test && (!empty($_SESSION[$verificationOptions['id'] . '_vv']['did_pass']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) || $_SESSION[$verificationOptions['id'] . '_vv']['count'] > 3) && empty($verificationOptions['dont_refresh'])) { |
|
2201 | + $force_refresh = true; |
|
2202 | + } else { |
|
2203 | + $force_refresh = false; |
|
2204 | + } |
|
2126 | 2205 | |
2127 | 2206 | // This can also force a fresh, although unlikely. |
2128 | - if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) |
|
2129 | - $force_refresh = true; |
|
2207 | + if (($thisVerification['show_visual'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['code'])) || ($thisVerification['number_questions'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['q']))) { |
|
2208 | + $force_refresh = true; |
|
2209 | + } |
|
2130 | 2210 | |
2131 | 2211 | $verification_errors = array(); |
2132 | 2212 | // Start with any testing. |
2133 | 2213 | if ($do_test) |
2134 | 2214 | { |
2135 | 2215 | // This cannot happen! |
2136 | - if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) |
|
2137 | - fatal_lang_error('no_access', false); |
|
2216 | + if (!isset($_SESSION[$verificationOptions['id'] . '_vv']['count'])) { |
|
2217 | + fatal_lang_error('no_access', false); |
|
2218 | + } |
|
2138 | 2219 | // ... nor this! |
2139 | - if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) |
|
2140 | - fatal_lang_error('no_access', false); |
|
2220 | + if ($thisVerification['number_questions'] && (!isset($_SESSION[$verificationOptions['id'] . '_vv']['q']) || !isset($_REQUEST[$verificationOptions['id'] . '_vv']['q']))) { |
|
2221 | + fatal_lang_error('no_access', false); |
|
2222 | + } |
|
2141 | 2223 | // Hmm, it's requested but not actually declared. This shouldn't happen. |
2142 | - if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
|
2143 | - fatal_lang_error('no_access', false); |
|
2224 | + if ($thisVerification['empty_field'] && empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) { |
|
2225 | + fatal_lang_error('no_access', false); |
|
2226 | + } |
|
2144 | 2227 | // While we're here, did the user do something bad? |
2145 | - if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) |
|
2146 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2228 | + if ($thisVerification['empty_field'] && !empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field']) && !empty($_REQUEST[$_SESSION[$verificationOptions['id'] . '_vv']['empty_field']])) { |
|
2229 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2230 | + } |
|
2147 | 2231 | |
2148 | 2232 | if ($thisVerification['can_recaptcha']) |
2149 | 2233 | { |
@@ -2156,22 +2240,25 @@ discard block |
||
2156 | 2240 | { |
2157 | 2241 | $resp = $reCaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); |
2158 | 2242 | |
2159 | - if (!$resp->isSuccess()) |
|
2160 | - $verification_errors[] = 'wrong_verification_code'; |
|
2243 | + if (!$resp->isSuccess()) { |
|
2244 | + $verification_errors[] = 'wrong_verification_code'; |
|
2245 | + } |
|
2246 | + } else { |
|
2247 | + $verification_errors[] = 'wrong_verification_code'; |
|
2161 | 2248 | } |
2162 | - else |
|
2163 | - $verification_errors[] = 'wrong_verification_code'; |
|
2164 | 2249 | } |
2165 | - if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) |
|
2166 | - $verification_errors[] = 'wrong_verification_code'; |
|
2250 | + if ($thisVerification['show_visual'] && (empty($_REQUEST[$verificationOptions['id'] . '_vv']['code']) || empty($_SESSION[$verificationOptions['id'] . '_vv']['code']) || strtoupper($_REQUEST[$verificationOptions['id'] . '_vv']['code']) !== $_SESSION[$verificationOptions['id'] . '_vv']['code'])) { |
|
2251 | + $verification_errors[] = 'wrong_verification_code'; |
|
2252 | + } |
|
2167 | 2253 | if ($thisVerification['number_questions']) |
2168 | 2254 | { |
2169 | 2255 | $incorrectQuestions = array(); |
2170 | 2256 | foreach ($_SESSION[$verificationOptions['id'] . '_vv']['q'] as $q) |
2171 | 2257 | { |
2172 | 2258 | // We don't have this question any more, thus no answers. |
2173 | - if (!isset($modSettings['question_id_cache']['questions'][$q])) |
|
2174 | - continue; |
|
2259 | + if (!isset($modSettings['question_id_cache']['questions'][$q])) { |
|
2260 | + continue; |
|
2261 | + } |
|
2175 | 2262 | // This is quite complex. We have our question but it might have multiple answers. |
2176 | 2263 | // First, did they actually answer this question? |
2177 | 2264 | if (!isset($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) || trim($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]) == '') |
@@ -2183,24 +2270,28 @@ discard block |
||
2183 | 2270 | else |
2184 | 2271 | { |
2185 | 2272 | $given_answer = trim($smcFunc['htmlspecialchars'](strtolower($_REQUEST[$verificationOptions['id'] . '_vv']['q'][$q]))); |
2186 | - if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) |
|
2187 | - $incorrectQuestions[] = $q; |
|
2273 | + if (!in_array($given_answer, $modSettings['question_id_cache']['questions'][$q]['answers'])) { |
|
2274 | + $incorrectQuestions[] = $q; |
|
2275 | + } |
|
2188 | 2276 | } |
2189 | 2277 | } |
2190 | 2278 | |
2191 | - if (!empty($incorrectQuestions)) |
|
2192 | - $verification_errors[] = 'wrong_verification_answer'; |
|
2279 | + if (!empty($incorrectQuestions)) { |
|
2280 | + $verification_errors[] = 'wrong_verification_answer'; |
|
2281 | + } |
|
2193 | 2282 | } |
2194 | 2283 | } |
2195 | 2284 | |
2196 | 2285 | // Any errors means we refresh potentially. |
2197 | 2286 | if (!empty($verification_errors)) |
2198 | 2287 | { |
2199 | - if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) |
|
2200 | - $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2288 | + if (empty($_SESSION[$verificationOptions['id'] . '_vv']['errors'])) { |
|
2289 | + $_SESSION[$verificationOptions['id'] . '_vv']['errors'] = 0; |
|
2290 | + } |
|
2201 | 2291 | // Too many errors? |
2202 | - elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) |
|
2203 | - $force_refresh = true; |
|
2292 | + elseif ($_SESSION[$verificationOptions['id'] . '_vv']['errors'] > $thisVerification['max_errors']) { |
|
2293 | + $force_refresh = true; |
|
2294 | + } |
|
2204 | 2295 | |
2205 | 2296 | // Keep a track of these. |
2206 | 2297 | $_SESSION[$verificationOptions['id'] . '_vv']['errors']++; |
@@ -2233,8 +2324,9 @@ discard block |
||
2233 | 2324 | // Are we overriding the range? |
2234 | 2325 | $character_range = !empty($verificationOptions['override_range']) ? $verificationOptions['override_range'] : $context['standard_captcha_range']; |
2235 | 2326 | |
2236 | - for ($i = 0; $i < 6; $i++) |
|
2237 | - $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2327 | + for ($i = 0; $i < 6; $i++) { |
|
2328 | + $_SESSION[$verificationOptions['id'] . '_vv']['code'] .= $character_range[array_rand($character_range)]; |
|
2329 | + } |
|
2238 | 2330 | } |
2239 | 2331 | |
2240 | 2332 | // Getting some new questions? |
@@ -2242,8 +2334,9 @@ discard block |
||
2242 | 2334 | { |
2243 | 2335 | // Attempt to try the current page's language, followed by the user's preference, followed by the site default. |
2244 | 2336 | $possible_langs = array(); |
2245 | - if (isset($_SESSION['language'])) |
|
2246 | - $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2337 | + if (isset($_SESSION['language'])) { |
|
2338 | + $possible_langs[] = strtr($_SESSION['language'], array('-utf8' => '')); |
|
2339 | + } |
|
2247 | 2340 | if (!empty($user_info['language'])); |
2248 | 2341 | $possible_langs[] = $user_info['language']; |
2249 | 2342 | $possible_langs[] = $language; |
@@ -2262,8 +2355,7 @@ discard block |
||
2262 | 2355 | } |
2263 | 2356 | } |
2264 | 2357 | } |
2265 | - } |
|
2266 | - else |
|
2358 | + } else |
|
2267 | 2359 | { |
2268 | 2360 | // Same questions as before. |
2269 | 2361 | $questionIDs = !empty($_SESSION[$verificationOptions['id'] . '_vv']['q']) ? $_SESSION[$verificationOptions['id'] . '_vv']['q'] : array(); |
@@ -2273,8 +2365,9 @@ discard block |
||
2273 | 2365 | // If we do have an empty field, it would be nice to hide it from legitimate users who shouldn't be populating it anyway. |
2274 | 2366 | if (!empty($_SESSION[$verificationOptions['id'] . '_vv']['empty_field'])) |
2275 | 2367 | { |
2276 | - if (!isset($context['html_headers'])) |
|
2277 | - $context['html_headers'] = ''; |
|
2368 | + if (!isset($context['html_headers'])) { |
|
2369 | + $context['html_headers'] = ''; |
|
2370 | + } |
|
2278 | 2371 | $context['html_headers'] .= '<style>.vv_special { display:none; }</style>'; |
2279 | 2372 | } |
2280 | 2373 | |
@@ -2300,11 +2393,13 @@ discard block |
||
2300 | 2393 | $_SESSION[$verificationOptions['id'] . '_vv']['count'] = empty($_SESSION[$verificationOptions['id'] . '_vv']['count']) ? 1 : $_SESSION[$verificationOptions['id'] . '_vv']['count'] + 1; |
2301 | 2394 | |
2302 | 2395 | // Return errors if we have them. |
2303 | - if (!empty($verification_errors)) |
|
2304 | - return $verification_errors; |
|
2396 | + if (!empty($verification_errors)) { |
|
2397 | + return $verification_errors; |
|
2398 | + } |
|
2305 | 2399 | // If we had a test that one, make a note. |
2306 | - elseif ($do_test) |
|
2307 | - $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2400 | + elseif ($do_test) { |
|
2401 | + $_SESSION[$verificationOptions['id'] . '_vv']['did_pass'] = true; |
|
2402 | + } |
|
2308 | 2403 | |
2309 | 2404 | // Say that everything went well chaps. |
2310 | 2405 | return true; |
@@ -2329,8 +2424,9 @@ discard block |
||
2329 | 2424 | call_integration_hook('integrate_autosuggest', array(&$searchTypes)); |
2330 | 2425 | |
2331 | 2426 | // If we're just checking the callback function is registered return true or false. |
2332 | - if ($checkRegistered != null) |
|
2333 | - return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2427 | + if ($checkRegistered != null) { |
|
2428 | + return isset($searchTypes[$checkRegistered]) && function_exists('AutoSuggest_Search_' . $checkRegistered); |
|
2429 | + } |
|
2334 | 2430 | |
2335 | 2431 | checkSession('get'); |
2336 | 2432 | loadTemplate('Xml'); |
@@ -2481,24 +2577,27 @@ discard block |
||
2481 | 2577 | foreach ($possible_versions as $ver) |
2482 | 2578 | { |
2483 | 2579 | $ver = trim($ver); |
2484 | - if (strpos($ver, 'SMF') === 0) |
|
2485 | - $versions[] = $ver; |
|
2580 | + if (strpos($ver, 'SMF') === 0) { |
|
2581 | + $versions[] = $ver; |
|
2582 | + } |
|
2486 | 2583 | } |
2487 | 2584 | } |
2488 | 2585 | $smcFunc['db_free_result']($request); |
2489 | 2586 | |
2490 | 2587 | // Just in case we don't have ANYthing. |
2491 | - if (empty($versions)) |
|
2492 | - $versions = array('SMF 2.0'); |
|
2588 | + if (empty($versions)) { |
|
2589 | + $versions = array('SMF 2.0'); |
|
2590 | + } |
|
2493 | 2591 | |
2494 | - foreach ($versions as $id => $version) |
|
2495 | - if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2592 | + foreach ($versions as $id => $version) { |
|
2593 | + if (strpos($version, strtoupper($_REQUEST['search'])) !== false) |
|
2496 | 2594 | $xml_data['items']['children'][] = array( |
2497 | 2595 | 'attributes' => array( |
2498 | 2596 | 'id' => $id, |
2499 | 2597 | ), |
2500 | 2598 | 'value' => $version, |
2501 | 2599 | ); |
2600 | + } |
|
2502 | 2601 | |
2503 | 2602 | return $xml_data; |
2504 | 2603 | } |
@@ -53,14 +53,15 @@ discard block |
||
53 | 53 | foreach ($context['smileys'] as $location => $smileyRows) |
54 | 54 | { |
55 | 55 | $countLocations--; |
56 | - if ($location == 'postform') |
|
57 | - echo ' |
|
56 | + if ($location == 'postform') { |
|
57 | + echo ' |
|
58 | 58 | dropdown: |
59 | 59 | {'; |
60 | - elseif ($location == 'popup') |
|
61 | - echo ' |
|
60 | + } elseif ($location == 'popup') { |
|
61 | + echo ' |
|
62 | 62 | popup: |
63 | 63 | {'; |
64 | + } |
|
64 | 65 | |
65 | 66 | $numRows = count($smileyRows); |
66 | 67 | // This is needed because otherwise the editor will remove all the duplicate (empty) keys and leave only 1 additional line |
@@ -72,20 +73,21 @@ discard block |
||
72 | 73 | echo ' |
73 | 74 | ', JavaScriptEscape($smiley['code']), ': ', JavaScriptEscape($settings['smileys_url'] . '/' . $smiley['filename']), empty($smiley['isLast']) ? ',' : ''; |
74 | 75 | } |
75 | - if (empty($smileyRow['isLast']) && $numRows != 1) |
|
76 | - echo ', |
|
76 | + if (empty($smileyRow['isLast']) && $numRows != 1) { |
|
77 | + echo ', |
|
77 | 78 | \'-', $emptyPlaceholder++, '\': \'\','; |
79 | + } |
|
78 | 80 | } |
79 | 81 | echo ' |
80 | 82 | }', $countLocations != 0 ? ',' : ''; |
81 | 83 | } |
82 | 84 | echo ' |
83 | 85 | }'; |
84 | - } |
|
85 | - else |
|
86 | - echo ', |
|
86 | + } else { |
|
87 | + echo ', |
|
87 | 88 | emoticons: |
88 | 89 | {}'; |
90 | + } |
|
89 | 91 | |
90 | 92 | if ($context['show_bbc'] && $bbcContainer !== null) |
91 | 93 | { |
@@ -96,15 +98,16 @@ discard block |
||
96 | 98 | { |
97 | 99 | echo implode('|', $buttonRow); |
98 | 100 | $count_tags--; |
99 | - if (!empty($count_tags)) |
|
100 | - echo '||'; |
|
101 | + if (!empty($count_tags)) { |
|
102 | + echo '||'; |
|
103 | + } |
|
101 | 104 | } |
102 | 105 | |
103 | 106 | echo '",'; |
104 | - } |
|
105 | - else |
|
106 | - echo ', |
|
107 | + } else { |
|
108 | + echo ', |
|
107 | 109 | toolbar: "",'; |
110 | + } |
|
108 | 111 | |
109 | 112 | echo ' |
110 | 113 | }); |
@@ -145,43 +148,48 @@ discard block |
||
145 | 148 | </span>'; |
146 | 149 | |
147 | 150 | $tempTab = $context['tabindex']; |
148 | - if (!empty($context['drafts_pm_save'])) |
|
149 | - $tempTab++; |
|
150 | - elseif (!empty($context['drafts_save'])) |
|
151 | - $tempTab++; |
|
152 | - elseif ($editor_context['preview_type']) |
|
153 | - $tempTab++; |
|
154 | - elseif ($context['show_spellchecking']) |
|
155 | - $tempTab++; |
|
151 | + if (!empty($context['drafts_pm_save'])) { |
|
152 | + $tempTab++; |
|
153 | + } elseif (!empty($context['drafts_save'])) { |
|
154 | + $tempTab++; |
|
155 | + } elseif ($editor_context['preview_type']) { |
|
156 | + $tempTab++; |
|
157 | + } elseif ($context['show_spellchecking']) { |
|
158 | + $tempTab++; |
|
159 | + } |
|
156 | 160 | |
157 | 161 | $tempTab++; |
158 | 162 | $context['tabindex'] = $tempTab; |
159 | 163 | |
160 | - if (!empty($context['drafts_pm_save'])) |
|
161 | - echo ' |
|
164 | + if (!empty($context['drafts_pm_save'])) { |
|
165 | + echo ' |
|
162 | 166 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit"> |
163 | 167 | <input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '">'; |
168 | + } |
|
164 | 169 | |
165 | - if (!empty($context['drafts_save'])) |
|
166 | - echo ' |
|
170 | + if (!empty($context['drafts_save'])) { |
|
171 | + echo ' |
|
167 | 172 | <input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', --$tempTab, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button_submit"> |
168 | 173 | <input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '">'; |
174 | + } |
|
169 | 175 | |
170 | - if ($context['show_spellchecking']) |
|
171 | - echo ' |
|
176 | + if ($context['show_spellchecking']) { |
|
177 | + echo ' |
|
172 | 178 | <input type="button" value="', $txt['spell_check'], '" tabindex="', --$tempTab, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit">'; |
179 | + } |
|
173 | 180 | |
174 | - if ($editor_context['preview_type']) |
|
175 | - echo ' |
|
181 | + if ($editor_context['preview_type']) { |
|
182 | + echo ' |
|
176 | 183 | <input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', --$tempTab, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button_submit">'; |
184 | + } |
|
177 | 185 | |
178 | 186 | |
179 | 187 | echo ' |
180 | 188 | <input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" name="post" tabindex="', --$tempTab, '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit">'; |
181 | 189 | |
182 | 190 | // Load in the PM autosaver if it's enabled |
183 | - if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) |
|
184 | - echo ' |
|
191 | + if (!empty($context['drafts_pm_save']) && !empty($context['drafts_autosave'])) { |
|
192 | + echo ' |
|
185 | 193 | <span class="righttext padding" style="display: block"> |
186 | 194 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
187 | 195 | <span id="draft_lastautosave" ></span> |
@@ -199,10 +207,11 @@ discard block |
||
199 | 207 | iFreq: ', (empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000), ' |
200 | 208 | }); |
201 | 209 | </script>'; |
210 | + } |
|
202 | 211 | |
203 | 212 | // Start an instance of the auto saver if its enabled |
204 | - if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) |
|
205 | - echo ' |
|
213 | + if (!empty($context['drafts_save']) && !empty($context['drafts_autosave'])) { |
|
214 | + echo ' |
|
206 | 215 | <span class="righttext padding" style="display: block"> |
207 | 216 | <span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon"> </span> |
208 | 217 | <span id="draft_lastautosave" ></span> |
@@ -219,7 +228,8 @@ discard block |
||
219 | 228 | iFreq: ', $context['drafts_autosave_frequency'], ' |
220 | 229 | }); |
221 | 230 | </script>'; |
222 | -} |
|
231 | + } |
|
232 | + } |
|
223 | 233 | |
224 | 234 | /** |
225 | 235 | * This template displays a verification form |
@@ -236,35 +246,40 @@ discard block |
||
236 | 246 | $verify_context = &$context['controls']['verification'][$verify_id]; |
237 | 247 | |
238 | 248 | // Keep track of where we are. |
239 | - if (empty($verify_context['tracking']) || $reset) |
|
240 | - $verify_context['tracking'] = 0; |
|
249 | + if (empty($verify_context['tracking']) || $reset) { |
|
250 | + $verify_context['tracking'] = 0; |
|
251 | + } |
|
241 | 252 | |
242 | 253 | // How many items are there to display in total. |
243 | 254 | $total_items = count($verify_context['questions']) + ($verify_context['show_visual'] || $verify_context['can_recaptcha'] ? 1 : 0); |
244 | 255 | |
245 | 256 | // If we've gone too far, stop. |
246 | - if ($verify_context['tracking'] > $total_items) |
|
247 | - return false; |
|
257 | + if ($verify_context['tracking'] > $total_items) { |
|
258 | + return false; |
|
259 | + } |
|
248 | 260 | |
249 | 261 | // Loop through each item to show them. |
250 | 262 | for ($i = 0; $i < $total_items; $i++) |
251 | 263 | { |
252 | 264 | // If we're after a single item only show it if we're in the right place. |
253 | - if ($display_type == 'single' && $verify_context['tracking'] != $i) |
|
254 | - continue; |
|
265 | + if ($display_type == 'single' && $verify_context['tracking'] != $i) { |
|
266 | + continue; |
|
267 | + } |
|
255 | 268 | |
256 | - if ($display_type != 'single') |
|
257 | - echo ' |
|
269 | + if ($display_type != 'single') { |
|
270 | + echo ' |
|
258 | 271 | <div id="verification_control_', $i, '" class="verification_control">'; |
272 | + } |
|
259 | 273 | |
260 | 274 | // Display empty field, but only if we have one, and it's the first time. |
261 | - if ($verify_context['empty_field'] && empty($i)) |
|
262 | - echo ' |
|
275 | + if ($verify_context['empty_field'] && empty($i)) { |
|
276 | + echo ' |
|
263 | 277 | <div class="smalltext vv_special"> |
264 | 278 | ', $txt['visual_verification_hidden'], ': |
265 | 279 | <input type="text" name="', $_SESSION[$verify_id . '_vv']['empty_field'], '" autocomplete="off" size="30" value=""> |
266 | 280 | </div> |
267 | 281 | <br>'; |
282 | + } |
|
268 | 283 | |
269 | 284 | // Do the actual stuff |
270 | 285 | if ($i == 0) |
@@ -278,17 +293,18 @@ discard block |
||
278 | 293 | |
279 | 294 | if ($verify_context['show_visual']) |
280 | 295 | { |
281 | - if ($context['use_graphic_library']) |
|
282 | - echo ' |
|
296 | + if ($context['use_graphic_library']) { |
|
297 | + echo ' |
|
283 | 298 | <img src="', $verify_context['image_href'], '" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '">'; |
284 | - else |
|
285 | - echo ' |
|
299 | + } else { |
|
300 | + echo ' |
|
286 | 301 | <img src="', $verify_context['image_href'], ';letter=1" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_1"> |
287 | 302 | <img src="', $verify_context['image_href'], ';letter=2" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_2"> |
288 | 303 | <img src="', $verify_context['image_href'], ';letter=3" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_3"> |
289 | 304 | <img src="', $verify_context['image_href'], ';letter=4" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_4"> |
290 | 305 | <img src="', $verify_context['image_href'], ';letter=5" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_5"> |
291 | 306 | <img src="', $verify_context['image_href'], ';letter=6" alt="', $txt['visual_verification_description'], '" id="verification_image_', $verify_id, '_6">'; |
307 | + } |
|
292 | 308 | |
293 | 309 | echo ' |
294 | 310 | <div class="smalltext" style="margin: 4px 0 8px 0;"> |
@@ -297,8 +313,7 @@ discard block |
||
297 | 313 | <input type="text" name="', $verify_id, '_vv[code]" value="', !empty($verify_context['text_value']) ? $verify_context['text_value'] : '', '" size="30" tabindex="', $context['tabindex']++, '" class="input_text" required> |
298 | 314 | </div>'; |
299 | 315 | } |
300 | - } |
|
301 | - else |
|
316 | + } else |
|
302 | 317 | { |
303 | 318 | // Where in the question array is this question? |
304 | 319 | $qIndex = $verify_context['show_visual'] ? $i - 1 : $i; |
@@ -310,21 +325,24 @@ discard block |
||
310 | 325 | </div>'; |
311 | 326 | } |
312 | 327 | |
313 | - if ($display_type != 'single') |
|
314 | - echo ' |
|
328 | + if ($display_type != 'single') { |
|
329 | + echo ' |
|
315 | 330 | </div>'; |
331 | + } |
|
316 | 332 | |
317 | 333 | // If we were displaying just one and we did it, break. |
318 | - if ($display_type == 'single' && $verify_context['tracking'] == $i) |
|
319 | - break; |
|
334 | + if ($display_type == 'single' && $verify_context['tracking'] == $i) { |
|
335 | + break; |
|
336 | + } |
|
320 | 337 | } |
321 | 338 | |
322 | 339 | // Assume we found something, always, |
323 | 340 | $verify_context['tracking']++; |
324 | 341 | |
325 | 342 | // Tell something displaying piecemeal to keep going. |
326 | - if ($display_type == 'single') |
|
327 | - return true; |
|
328 | -} |
|
343 | + if ($display_type == 'single') { |
|
344 | + return true; |
|
345 | + } |
|
346 | + } |
|
329 | 347 | |
330 | 348 | ?> |
@@ -51,11 +51,13 @@ discard block |
||
51 | 51 | <p>'; |
52 | 52 | |
53 | 53 | // Show just numbers...? |
54 | - if ($settings['display_who_viewing'] == 1) |
|
55 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
54 | + if ($settings['display_who_viewing'] == 1) { |
|
55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
56 | + } |
|
56 | 57 | // Or show the actual people viewing the topic? |
57 | - else |
|
58 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
58 | + else { |
|
59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
60 | + } |
|
59 | 61 | |
60 | 62 | // Now show how many guests are here too. |
61 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -93,10 +95,11 @@ discard block |
||
93 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
94 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
95 | 97 | |
96 | - if ($context['allow_results_view']) |
|
97 | - echo ' |
|
98 | + if ($context['allow_results_view']) { |
|
99 | + echo ' |
|
98 | 100 | ', $option['bar_ndt'], ' |
99 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
102 | + } |
|
100 | 103 | |
101 | 104 | echo ' |
102 | 105 | </dd>'; |
@@ -105,9 +108,10 @@ discard block |
||
105 | 108 | echo ' |
106 | 109 | </dl>'; |
107 | 110 | |
108 | - if ($context['allow_results_view']) |
|
109 | - echo ' |
|
111 | + if ($context['allow_results_view']) { |
|
112 | + echo ' |
|
110 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
114 | + } |
|
111 | 115 | } |
112 | 116 | // They are allowed to vote! Go to it! |
113 | 117 | else |
@@ -116,17 +120,19 @@ discard block |
||
116 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
117 | 121 | |
118 | 122 | // Show a warning if they are allowed more than one option. |
119 | - if ($context['poll']['allowed_warning']) |
|
120 | - echo ' |
|
123 | + if ($context['poll']['allowed_warning']) { |
|
124 | + echo ' |
|
121 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
126 | + } |
|
122 | 127 | |
123 | 128 | echo ' |
124 | 129 | <ul class="options">'; |
125 | 130 | |
126 | 131 | // Show each option with its button - a radio likely. |
127 | - foreach ($context['poll']['options'] as $option) |
|
128 | - echo ' |
|
132 | + foreach ($context['poll']['options'] as $option) { |
|
133 | + echo ' |
|
129 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
135 | + } |
|
130 | 136 | |
131 | 137 | echo ' |
132 | 138 | </ul> |
@@ -138,9 +144,10 @@ discard block |
||
138 | 144 | } |
139 | 145 | |
140 | 146 | // Is the clock ticking? |
141 | - if (!empty($context['poll']['expire_time'])) |
|
142 | - echo ' |
|
147 | + if (!empty($context['poll']['expire_time'])) { |
|
148 | + echo ' |
|
143 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
150 | + } |
|
144 | 151 | |
145 | 152 | echo ' |
146 | 153 | </div> |
@@ -170,11 +177,13 @@ discard block |
||
170 | 177 | <li> |
171 | 178 | <b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>'; |
172 | 179 | |
173 | - if ($event['can_edit']) |
|
174 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
180 | + if ($event['can_edit']) { |
|
181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
182 | + } |
|
175 | 183 | |
176 | - if ($event['can_export']) |
|
177 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
184 | + if ($event['can_export']) { |
|
185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
186 | + } |
|
178 | 187 | |
179 | 188 | echo ' |
180 | 189 | <br>'; |
@@ -182,14 +191,14 @@ discard block |
||
182 | 191 | if (!empty($event['allday'])) |
183 | 192 | { |
184 | 193 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
185 | - } |
|
186 | - else |
|
194 | + } else |
|
187 | 195 | { |
188 | 196 | // Display event info relative to user's local timezone |
189 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
190 | 198 | |
191 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
192 | - echo trim($event['end_date_local']) . ', '; |
|
199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
200 | + echo trim($event['end_date_local']) . ', '; |
|
201 | + } |
|
193 | 202 | |
194 | 203 | echo trim($event['end_time_local']); |
195 | 204 | |
@@ -198,23 +207,27 @@ discard block |
||
198 | 207 | { |
199 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
200 | 209 | |
201 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
202 | - echo trim($event['start_date_orig']), ', '; |
|
210 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
211 | + echo trim($event['start_date_orig']), ', '; |
|
212 | + } |
|
203 | 213 | |
204 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
205 | 215 | |
206 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
207 | - echo trim($event['end_date_orig']) . ', '; |
|
216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
217 | + echo trim($event['end_date_orig']) . ', '; |
|
218 | + } |
|
208 | 219 | |
209 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
210 | 221 | } |
211 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
212 | - else |
|
213 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
223 | + else { |
|
224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
225 | + } |
|
214 | 226 | } |
215 | 227 | |
216 | - if (!empty($event['location'])) |
|
217 | - echo '<br>', $event['location']; |
|
228 | + if (!empty($event['location'])) { |
|
229 | + echo '<br>', $event['location']; |
|
230 | + } |
|
218 | 231 | |
219 | 232 | echo ' |
220 | 233 | </li>'; |
@@ -252,8 +265,9 @@ discard block |
||
252 | 265 | $context['removableMessageIDs'] = array(); |
253 | 266 | |
254 | 267 | // Get all the messages... |
255 | - while ($message = $context['get_message']()) |
|
256 | - template_single_post($message); |
|
268 | + while ($message = $context['get_message']()) { |
|
269 | + template_single_post($message); |
|
270 | + } |
|
257 | 271 | |
258 | 272 | echo ' |
259 | 273 | </form> |
@@ -290,8 +304,9 @@ discard block |
||
290 | 304 | <div id="display_jump_to"> </div>'; |
291 | 305 | |
292 | 306 | // Show quickreply |
293 | - if ($context['can_reply']) |
|
294 | - template_quickreply(); |
|
307 | + if ($context['can_reply']) { |
|
308 | + template_quickreply(); |
|
309 | + } |
|
295 | 310 | |
296 | 311 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
297 | 312 | echo ' |
@@ -304,8 +319,8 @@ discard block |
||
304 | 319 | </div>'; |
305 | 320 | |
306 | 321 | // Show the moderation button & pop only if user can moderate |
307 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
308 | - echo ' |
|
322 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
323 | + echo ' |
|
309 | 324 | <div id="mobile_moderation" class="popup_container"> |
310 | 325 | <div class="popup_window description"> |
311 | 326 | <div class="popup_heading">', $txt['mobile_moderation'],' |
@@ -315,6 +330,7 @@ discard block |
||
315 | 330 | </div> |
316 | 331 | </div> |
317 | 332 | </div>'; |
333 | + } |
|
318 | 334 | |
319 | 335 | echo ' |
320 | 336 | <script>'; |
@@ -438,9 +454,10 @@ discard block |
||
438 | 454 | }); |
439 | 455 | }'; |
440 | 456 | |
441 | - if (!empty($context['ignoredMsgs'])) |
|
442 | - echo ' |
|
457 | + if (!empty($context['ignoredMsgs'])) { |
|
458 | + echo ' |
|
443 | 459 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
460 | + } |
|
444 | 461 | |
445 | 462 | echo ' |
446 | 463 | </script>'; |
@@ -457,8 +474,9 @@ discard block |
||
457 | 474 | |
458 | 475 | $ignoring = false; |
459 | 476 | |
460 | - if ($message['can_remove']) |
|
461 | - $context['removableMessageIDs'][] = $message['id']; |
|
477 | + if ($message['can_remove']) { |
|
478 | + $context['removableMessageIDs'][] = $message['id']; |
|
479 | + } |
|
462 | 480 | |
463 | 481 | // Are we ignoring this message? |
464 | 482 | if (!empty($message['is_ignored'])) |
@@ -484,9 +502,10 @@ discard block |
||
484 | 502 | <div class="custom_fields_above_member"> |
485 | 503 | <ul class="nolist">'; |
486 | 504 | |
487 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
488 | - echo ' |
|
505 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
506 | + echo ' |
|
489 | 507 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
508 | + } |
|
490 | 509 | |
491 | 510 | echo ' |
492 | 511 | </ul> |
@@ -497,9 +516,10 @@ discard block |
||
497 | 516 | <h4>'; |
498 | 517 | |
499 | 518 | // Show online and offline buttons? |
500 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
501 | - echo ' |
|
519 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
520 | + echo ' |
|
502 | 521 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
522 | + } |
|
503 | 523 | |
504 | 524 | |
505 | 525 | // Show a link to the member's profile. |
@@ -512,51 +532,59 @@ discard block |
||
512 | 532 | |
513 | 533 | |
514 | 534 | // Show the user's avatar. |
515 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
516 | - echo ' |
|
535 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
536 | + echo ' |
|
517 | 537 | <li class="avatar"> |
518 | 538 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
519 | 539 | </li>'; |
540 | + } |
|
520 | 541 | |
521 | 542 | // Are there any custom fields below the avatar? |
522 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
523 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
543 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
544 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
524 | 545 | echo ' |
525 | 546 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
547 | + } |
|
526 | 548 | |
527 | 549 | // Show the post group icons, but not for guests. |
528 | - if (!$message['member']['is_guest']) |
|
529 | - echo ' |
|
550 | + if (!$message['member']['is_guest']) { |
|
551 | + echo ' |
|
530 | 552 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
553 | + } |
|
531 | 554 | |
532 | 555 | // Show the member's primary group (like 'Administrator') if they have one. |
533 | - if (!empty($message['member']['group'])) |
|
534 | - echo ' |
|
556 | + if (!empty($message['member']['group'])) { |
|
557 | + echo ' |
|
535 | 558 | <li class="membergroup">', $message['member']['group'], '</li>'; |
559 | + } |
|
536 | 560 | |
537 | 561 | // Show the member's custom title, if they have one. |
538 | - if (!empty($message['member']['title'])) |
|
539 | - echo ' |
|
562 | + if (!empty($message['member']['title'])) { |
|
563 | + echo ' |
|
540 | 564 | <li class="title">', $message['member']['title'], '</li>'; |
565 | + } |
|
541 | 566 | |
542 | 567 | // Don't show these things for guests. |
543 | 568 | if (!$message['member']['is_guest']) |
544 | 569 | { |
545 | 570 | |
546 | 571 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
547 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
548 | - echo ' |
|
572 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
573 | + echo ' |
|
549 | 574 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
575 | + } |
|
550 | 576 | |
551 | 577 | // Show how many posts they have made. |
552 | - if (!isset($context['disabled_fields']['posts'])) |
|
553 | - echo ' |
|
578 | + if (!isset($context['disabled_fields']['posts'])) { |
|
579 | + echo ' |
|
554 | 580 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
581 | + } |
|
555 | 582 | |
556 | 583 | // Show their personal text? |
557 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
558 | - echo ' |
|
584 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
585 | + echo ' |
|
559 | 586 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
587 | + } |
|
560 | 588 | |
561 | 589 | // Any custom fields to show as icons? |
562 | 590 | if (!empty($message['custom_fields']['icons'])) |
@@ -565,9 +593,10 @@ discard block |
||
565 | 593 | <li class="im_icons"> |
566 | 594 | <ol>'; |
567 | 595 | |
568 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
569 | - echo ' |
|
596 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
597 | + echo ' |
|
570 | 598 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
599 | + } |
|
571 | 600 | |
572 | 601 | echo ' |
573 | 602 | </ol> |
@@ -582,19 +611,22 @@ discard block |
||
582 | 611 | <ol class="profile_icons">'; |
583 | 612 | |
584 | 613 | // Don't show an icon if they haven't specified a website. |
585 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
586 | - echo ' |
|
614 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
615 | + echo ' |
|
587 | 616 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
617 | + } |
|
588 | 618 | |
589 | 619 | // Since we know this person isn't a guest, you *can* message them. |
590 | - if ($context['can_send_pm']) |
|
591 | - echo ' |
|
620 | + if ($context['can_send_pm']) { |
|
621 | + echo ' |
|
592 | 622 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
623 | + } |
|
593 | 624 | |
594 | 625 | // Show the email if necessary |
595 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
596 | - echo ' |
|
626 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
627 | + echo ' |
|
597 | 628 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
629 | + } |
|
598 | 630 | |
599 | 631 | echo ' |
600 | 632 | </ol> |
@@ -602,48 +634,56 @@ discard block |
||
602 | 634 | } |
603 | 635 | |
604 | 636 | // Any custom fields for standard placement? |
605 | - if (!empty($message['custom_fields']['standard'])) |
|
606 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
637 | + if (!empty($message['custom_fields']['standard'])) { |
|
638 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
607 | 639 | echo ' |
608 | 640 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
641 | + } |
|
609 | 642 | |
610 | 643 | } |
611 | 644 | // Otherwise, show the guest's email. |
612 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
613 | - echo ' |
|
645 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
646 | + echo ' |
|
614 | 647 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
648 | + } |
|
615 | 649 | |
616 | 650 | // Show the IP to this user for this post - because you can moderate? |
617 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
618 | - echo ' |
|
651 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
652 | + echo ' |
|
619 | 653 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
654 | + } |
|
620 | 655 | |
621 | 656 | // Or, should we show it because this is you? |
622 | - elseif ($message['can_see_ip']) |
|
623 | - echo ' |
|
657 | + elseif ($message['can_see_ip']) { |
|
658 | + echo ' |
|
624 | 659 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
660 | + } |
|
625 | 661 | |
626 | 662 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
627 | - elseif (!$context['user']['is_guest']) |
|
628 | - echo ' |
|
663 | + elseif (!$context['user']['is_guest']) { |
|
664 | + echo ' |
|
629 | 665 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
666 | + } |
|
630 | 667 | |
631 | 668 | // Otherwise, you see NOTHING! |
632 | - else |
|
633 | - echo ' |
|
669 | + else { |
|
670 | + echo ' |
|
634 | 671 | <li class="poster_ip">', $txt['logged'], '</li>'; |
672 | + } |
|
635 | 673 | |
636 | 674 | // Are we showing the warning status? |
637 | 675 | // Don't show these things for guests. |
638 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
639 | - echo ' |
|
676 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
677 | + echo ' |
|
640 | 678 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
679 | + } |
|
641 | 680 | |
642 | 681 | // Are there any custom fields to show at the bottom of the poster info? |
643 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
644 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
682 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
683 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
645 | 684 | echo ' |
646 | 685 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
686 | + } |
|
647 | 687 | |
648 | 688 | // Poster info ends. |
649 | 689 | echo ' |
@@ -672,9 +712,10 @@ discard block |
||
672 | 712 | echo ' |
673 | 713 | <span class="smalltext modified" id="modified_', $message['id'], '">'; |
674 | 714 | |
675 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
676 | - echo |
|
715 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
716 | + echo |
|
677 | 717 | $message['modified']['last_edit_text']; |
718 | + } |
|
678 | 719 | |
679 | 720 | echo ' |
680 | 721 | </span>'; |
@@ -685,22 +726,24 @@ discard block |
||
685 | 726 | </div>'; |
686 | 727 | |
687 | 728 | // Ignoring this user? Hide the post. |
688 | - if ($ignoring) |
|
689 | - echo ' |
|
729 | + if ($ignoring) { |
|
730 | + echo ' |
|
690 | 731 | <div id="msg_', $message['id'], '_ignored_prompt"> |
691 | 732 | ', $txt['ignoring_user'], ' |
692 | 733 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
693 | 734 | </div>'; |
735 | + } |
|
694 | 736 | |
695 | 737 | // Show the post itself, finally! |
696 | 738 | echo ' |
697 | 739 | <div class="post">'; |
698 | 740 | |
699 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
700 | - echo ' |
|
741 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
742 | + echo ' |
|
701 | 743 | <div class="approve_post"> |
702 | 744 | ', $txt['post_awaiting_approval'], ' |
703 | 745 | </div>'; |
746 | + } |
|
704 | 747 | echo ' |
705 | 748 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
706 | 749 | </div>'; |
@@ -717,9 +760,9 @@ discard block |
||
717 | 760 | foreach ($message['attachment'] as $attachment) |
718 | 761 | { |
719 | 762 | // Do we want this attachment to not be showed here? |
720 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
721 | - continue; |
|
722 | - elseif (!$div_output) |
|
763 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
764 | + continue; |
|
765 | + } elseif (!$div_output) |
|
723 | 766 | { |
724 | 767 | $div_output = true; |
725 | 768 | |
@@ -735,9 +778,10 @@ discard block |
||
735 | 778 | <fieldset> |
736 | 779 | <legend>', $txt['attach_awaiting_approve']; |
737 | 780 | |
738 | - if ($context['can_approve']) |
|
739 | - echo ' |
|
781 | + if ($context['can_approve']) { |
|
782 | + echo ' |
|
740 | 783 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
784 | + } |
|
741 | 785 | |
742 | 786 | echo ' |
743 | 787 | </legend>'; |
@@ -751,12 +795,13 @@ discard block |
||
751 | 795 | echo ' |
752 | 796 | <div class="attachments_top">'; |
753 | 797 | |
754 | - if ($attachment['thumbnail']['has_thumb']) |
|
755 | - echo ' |
|
798 | + if ($attachment['thumbnail']['has_thumb']) { |
|
799 | + echo ' |
|
756 | 800 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
757 | - else |
|
758 | - echo ' |
|
801 | + } else { |
|
802 | + echo ' |
|
759 | 803 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
804 | + } |
|
760 | 805 | |
761 | 806 | echo ' |
762 | 807 | </div>'; |
@@ -766,9 +811,10 @@ discard block |
||
766 | 811 | <div class="attachments_bot"> |
767 | 812 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
768 | 813 | |
769 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
770 | - echo ' |
|
814 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
815 | + echo ' |
|
771 | 816 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
817 | + } |
|
772 | 818 | echo ' |
773 | 819 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
774 | 820 | </div>'; |
@@ -777,33 +823,38 @@ discard block |
||
777 | 823 | </div>'; |
778 | 824 | |
779 | 825 | // Next attachment line ? |
780 | - if (++$i % $attachments_per_line === 0) |
|
781 | - echo ' |
|
826 | + if (++$i % $attachments_per_line === 0) { |
|
827 | + echo ' |
|
782 | 828 | <br>'; |
829 | + } |
|
783 | 830 | } |
784 | 831 | |
785 | 832 | // If we had unapproved attachments clean up. |
786 | - if ($last_approved_state == 0) |
|
787 | - echo ' |
|
833 | + if ($last_approved_state == 0) { |
|
834 | + echo ' |
|
788 | 835 | </fieldset>'; |
836 | + } |
|
789 | 837 | |
790 | 838 | // Only do this if we output a div above - otherwise it'll break things |
791 | - if ($div_output) |
|
792 | - echo ' |
|
839 | + if ($div_output) { |
|
840 | + echo ' |
|
793 | 841 | </div>'; |
842 | + } |
|
794 | 843 | } |
795 | 844 | |
796 | 845 | // And stuff below the attachments. |
797 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
798 | - echo ' |
|
846 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
847 | + echo ' |
|
799 | 848 | <div class="under_message">'; |
849 | + } |
|
800 | 850 | |
801 | 851 | // Maybe they want to report this post to the moderator(s)? |
802 | - if ($context['can_report_moderator']) |
|
803 | - echo ' |
|
852 | + if ($context['can_report_moderator']) { |
|
853 | + echo ' |
|
804 | 854 | <ul class="floatright smalltext"> |
805 | 855 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
806 | 856 | </ul>'; |
857 | + } |
|
807 | 858 | |
808 | 859 | // What about likes? |
809 | 860 | if (!empty($modSettings['enable_likes'])) |
@@ -844,78 +895,91 @@ discard block |
||
844 | 895 | <ul class="quickbuttons">'; |
845 | 896 | |
846 | 897 | // Can they quote? if so they can select and quote as well! |
847 | - if ($context['can_quote']) |
|
848 | - echo ' |
|
898 | + if ($context['can_quote']) { |
|
899 | + echo ' |
|
849 | 900 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
850 | 901 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>'; |
902 | + } |
|
851 | 903 | |
852 | 904 | // Can the user modify the contents of this post? Show the modify inline image. |
853 | - if ($message['can_modify']) |
|
854 | - echo ' |
|
905 | + if ($message['can_modify']) { |
|
906 | + echo ' |
|
855 | 907 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
908 | + } |
|
856 | 909 | |
857 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
858 | - echo ' |
|
910 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
911 | + echo ' |
|
859 | 912 | <li class="post_options">', $txt['post_options']; |
913 | + } |
|
860 | 914 | |
861 | 915 | echo ' |
862 | 916 | <ul>'; |
863 | 917 | |
864 | 918 | // Can the user modify the contents of this post? |
865 | - if ($message['can_modify']) |
|
866 | - echo ' |
|
919 | + if ($message['can_modify']) { |
|
920 | + echo ' |
|
867 | 921 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
922 | + } |
|
868 | 923 | |
869 | 924 | // How about... even... remove it entirely?! |
870 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
871 | - echo ' |
|
925 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
926 | + echo ' |
|
872 | 927 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>'; |
873 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
874 | - echo ' |
|
928 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
929 | + echo ' |
|
875 | 930 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'] ,'" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
931 | + } |
|
876 | 932 | |
877 | 933 | // What about splitting it off the rest of the topic? |
878 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
879 | - echo ' |
|
934 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
935 | + echo ' |
|
880 | 936 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
937 | + } |
|
881 | 938 | |
882 | 939 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
883 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
884 | - echo ' |
|
940 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
941 | + echo ' |
|
885 | 942 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
943 | + } |
|
886 | 944 | |
887 | 945 | // Can we restore topics? |
888 | - if ($context['can_restore_msg']) |
|
889 | - echo ' |
|
946 | + if ($context['can_restore_msg']) { |
|
947 | + echo ' |
|
890 | 948 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
949 | + } |
|
891 | 950 | |
892 | 951 | // Maybe we can approve it, maybe we should? |
893 | - if ($message['can_approve']) |
|
894 | - echo ' |
|
952 | + if ($message['can_approve']) { |
|
953 | + echo ' |
|
895 | 954 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
955 | + } |
|
896 | 956 | |
897 | 957 | // Maybe we can unapprove it? |
898 | - if ($message['can_unapprove']) |
|
899 | - echo ' |
|
958 | + if ($message['can_unapprove']) { |
|
959 | + echo ' |
|
900 | 960 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
961 | + } |
|
901 | 962 | |
902 | 963 | echo ' |
903 | 964 | </ul> |
904 | 965 | </li>'; |
905 | 966 | |
906 | 967 | // Show a checkbox for quick moderation? |
907 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
908 | - echo ' |
|
968 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
969 | + echo ' |
|
909 | 970 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
971 | + } |
|
910 | 972 | |
911 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
912 | - echo ' |
|
973 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
974 | + echo ' |
|
913 | 975 | </ul>'; |
976 | + } |
|
914 | 977 | } |
915 | 978 | |
916 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
917 | - echo ' |
|
979 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
980 | + echo ' |
|
918 | 981 | </div>'; |
982 | + } |
|
919 | 983 | |
920 | 984 | echo ' |
921 | 985 | </div> |
@@ -928,9 +992,10 @@ discard block |
||
928 | 992 | <div class="custom_fields_above_signature"> |
929 | 993 | <ul class="nolist">'; |
930 | 994 | |
931 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
932 | - echo ' |
|
995 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
996 | + echo ' |
|
933 | 997 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
998 | + } |
|
934 | 999 | |
935 | 1000 | echo ' |
936 | 1001 | </ul> |
@@ -938,9 +1003,10 @@ discard block |
||
938 | 1003 | } |
939 | 1004 | |
940 | 1005 | // Show the member's signature? |
941 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
942 | - echo ' |
|
1006 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
1007 | + echo ' |
|
943 | 1008 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
1009 | + } |
|
944 | 1010 | |
945 | 1011 | |
946 | 1012 | // Are there any custom profile fields for below the signature? |
@@ -950,9 +1016,10 @@ discard block |
||
950 | 1016 | <div class="custom_fields_below_signature"> |
951 | 1017 | <ul class="nolist">'; |
952 | 1018 | |
953 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
954 | - echo ' |
|
1019 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
1020 | + echo ' |
|
955 | 1021 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
1022 | + } |
|
956 | 1023 | |
957 | 1024 | echo ' |
958 | 1025 | </ul> |
@@ -1000,8 +1067,8 @@ discard block |
||
1000 | 1067 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
1001 | 1068 | |
1002 | 1069 | // Guests just need more. |
1003 | - if ($context['user']['is_guest']) |
|
1004 | - echo ' |
|
1070 | + if ($context['user']['is_guest']) { |
|
1071 | + echo ' |
|
1005 | 1072 | <dl id="post_header"> |
1006 | 1073 | <dt> |
1007 | 1074 | ', $txt['name'], ': |
@@ -1016,6 +1083,7 @@ discard block |
||
1016 | 1083 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required> |
1017 | 1084 | </dd> |
1018 | 1085 | </dl>'; |
1086 | + } |
|
1019 | 1087 | |
1020 | 1088 | echo ' |
1021 | 1089 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1063,8 +1131,8 @@ discard block |
||
1063 | 1131 | <br class="clear">'; |
1064 | 1132 | |
1065 | 1133 | // draft autosave available and the user has it enabled? |
1066 | - if (!empty($context['drafts_autosave'])) |
|
1067 | - echo ' |
|
1134 | + if (!empty($context['drafts_autosave'])) { |
|
1135 | + echo ' |
|
1068 | 1136 | <script> |
1069 | 1137 | var oDraftAutoSave = new smf_DraftAutoSave({ |
1070 | 1138 | sSelf: \'oDraftAutoSave\', |
@@ -1076,10 +1144,12 @@ discard block |
||
1076 | 1144 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
1077 | 1145 | }); |
1078 | 1146 | </script>'; |
1147 | + } |
|
1079 | 1148 | |
1080 | - if ($context['show_spellchecking']) |
|
1081 | - echo ' |
|
1149 | + if ($context['show_spellchecking']) { |
|
1150 | + echo ' |
|
1082 | 1151 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>'; |
1152 | + } |
|
1083 | 1153 | |
1084 | 1154 | echo ' |
1085 | 1155 | <script> |
@@ -22,22 +22,24 @@ discard block |
||
22 | 22 | <script>'; |
23 | 23 | |
24 | 24 | // When using Go Back due to fatal_error, allow the form to be re-submitted with changes. |
25 | - if (isBrowser('is_firefox')) |
|
26 | - echo ' |
|
25 | + if (isBrowser('is_firefox')) { |
|
26 | + echo ' |
|
27 | 27 | window.addEventListener("pageshow", reActivate, false);'; |
28 | + } |
|
28 | 29 | |
29 | 30 | // Start with message icons - and any missing from this theme. |
30 | 31 | echo ' |
31 | 32 | var icon_urls = {'; |
32 | - foreach ($context['icons'] as $icon) |
|
33 | - echo ' |
|
33 | + foreach ($context['icons'] as $icon) { |
|
34 | + echo ' |
|
34 | 35 | \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ','; |
36 | + } |
|
35 | 37 | echo ' |
36 | 38 | };'; |
37 | 39 | |
38 | 40 | // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations. |
39 | - if ($context['make_poll']) |
|
40 | - echo ' |
|
41 | + if ($context['make_poll']) { |
|
42 | + echo ' |
|
41 | 43 | var pollOptionNum = 0, pollTabIndex; |
42 | 44 | var pollOptionId = ', $context['last_choice_id'], '; |
43 | 45 | function addPollOption() |
@@ -56,11 +58,13 @@ discard block |
||
56 | 58 | |
57 | 59 | setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text"></dd><p id="pollMoreOptions"></p>'), '); |
58 | 60 | }'; |
61 | + } |
|
59 | 62 | |
60 | 63 | // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here. |
61 | - if ($context['make_event']) |
|
62 | - echo ' |
|
64 | + if ($context['make_event']) { |
|
65 | + echo ' |
|
63 | 66 | var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];'; |
67 | + } |
|
64 | 68 | |
65 | 69 | // End of the javascript, start the form and display the link tree. |
66 | 70 | echo ' |
@@ -80,9 +84,10 @@ discard block |
||
80 | 84 | </div> |
81 | 85 | </div><br>'; |
82 | 86 | |
83 | - if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) |
|
84 | - echo ' |
|
87 | + if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) { |
|
88 | + echo ' |
|
85 | 89 | <input type="hidden" name="eventid" value="', $context['event']['id'], '">'; |
90 | + } |
|
86 | 91 | |
87 | 92 | // Start the main table. |
88 | 93 | echo ' |
@@ -117,26 +122,28 @@ discard block |
||
117 | 122 | } |
118 | 123 | |
119 | 124 | // If it's locked, show a message to warn the replier. |
120 | - if (!empty($context['locked'])) |
|
121 | - echo ' |
|
125 | + if (!empty($context['locked'])) { |
|
126 | + echo ' |
|
122 | 127 | <p class="errorbox"> |
123 | 128 | ', $txt['topic_locked_no_reply'], ' |
124 | 129 | </p>'; |
130 | + } |
|
125 | 131 | |
126 | - if (!empty($modSettings['drafts_post_enabled'])) |
|
127 | - echo ' |
|
132 | + if (!empty($modSettings['drafts_post_enabled'])) { |
|
133 | + echo ' |
|
128 | 134 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
129 | 135 | sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), ' |
130 | 136 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
131 | 137 | </div>'; |
138 | + } |
|
132 | 139 | |
133 | 140 | // The post header... important stuff |
134 | 141 | echo ' |
135 | 142 | <dl id="post_header">'; |
136 | 143 | |
137 | 144 | // Custom posting fields. |
138 | - if (!empty($context['posting_fields']) && is_array($context['posting_fields'])) |
|
139 | - foreach ($context['posting_fields'] as $pf) |
|
145 | + if (!empty($context['posting_fields']) && is_array($context['posting_fields'])) { |
|
146 | + foreach ($context['posting_fields'] as $pf) |
|
140 | 147 | echo ' |
141 | 148 | <dt> |
142 | 149 | ', $pf['dt'] ,' |
@@ -144,6 +151,7 @@ discard block |
||
144 | 151 | <dd> |
145 | 152 | ', $pf['dd'] ,' |
146 | 153 | </dd>'; |
154 | + } |
|
147 | 155 | |
148 | 156 | |
149 | 157 | // Guests have to put in their name and email... |
@@ -157,14 +165,15 @@ discard block |
||
157 | 165 | <input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text"> |
158 | 166 | </dd>'; |
159 | 167 | |
160 | - if (empty($modSettings['guest_post_no_email'])) |
|
161 | - echo ' |
|
168 | + if (empty($modSettings['guest_post_no_email'])) { |
|
169 | + echo ' |
|
162 | 170 | <dt> |
163 | 171 | <span', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</span> |
164 | 172 | </dt> |
165 | 173 | <dd> |
166 | 174 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required> |
167 | 175 | </dd>'; |
176 | + } |
|
168 | 177 | } |
169 | 178 | |
170 | 179 | // Now show the subject box for this post. |
@@ -182,9 +191,10 @@ discard block |
||
182 | 191 | <select name="icon" id="icon" onchange="showimage()">'; |
183 | 192 | |
184 | 193 | // Loop through each message icon allowed, adding it to the drop down list. |
185 | - foreach ($context['icons'] as $icon) |
|
186 | - echo ' |
|
194 | + foreach ($context['icons'] as $icon) { |
|
195 | + echo ' |
|
187 | 196 | <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected' : '', '>', $icon['name'], '</option>'; |
197 | + } |
|
188 | 198 | |
189 | 199 | echo ' |
190 | 200 | </select> |
@@ -219,9 +229,10 @@ discard block |
||
219 | 229 | { |
220 | 230 | echo ' |
221 | 231 | <optgroup label="', $category['name'], '">'; |
222 | - foreach ($category['boards'] as $board) |
|
223 | - echo ' |
|
232 | + foreach ($category['boards'] as $board) { |
|
233 | + echo ' |
|
224 | 234 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], ' </option>'; |
235 | + } |
|
225 | 236 | echo ' |
226 | 237 | </optgroup>'; |
227 | 238 | } |
@@ -257,9 +268,10 @@ discard block |
||
257 | 268 | <span class="label">', $txt['calendar_timezone'], '</span> |
258 | 269 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
259 | 270 | |
260 | - foreach ($context['all_timezones'] as $tz => $tzname) |
|
261 | - echo ' |
|
271 | + foreach ($context['all_timezones'] as $tz => $tzname) { |
|
272 | + echo ' |
|
262 | 273 | <option value="', $tz, '"', $tz == $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
274 | + } |
|
263 | 275 | |
264 | 276 | echo ' |
265 | 277 | </select> |
@@ -325,14 +337,15 @@ discard block |
||
325 | 337 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', ' class="input_check"> |
326 | 338 | </dd>'; |
327 | 339 | |
328 | - if ($context['poll_options']['guest_vote_enabled']) |
|
329 | - echo ' |
|
340 | + if ($context['poll_options']['guest_vote_enabled']) { |
|
341 | + echo ' |
|
330 | 342 | <dt> |
331 | 343 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
332 | 344 | </dt> |
333 | 345 | <dd> |
334 | 346 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', ' class="input_check"> |
335 | 347 | </dd>'; |
348 | + } |
|
336 | 349 | |
337 | 350 | echo ' |
338 | 351 | <dt> |
@@ -353,8 +366,8 @@ discard block |
||
353 | 366 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); |
354 | 367 | |
355 | 368 | // If we're editing and displaying edit details, show a box where they can say why |
356 | - if (isset($context['editing']) && $modSettings['show_modify']) |
|
357 | - echo ' |
|
369 | + if (isset($context['editing']) && $modSettings['show_modify']) { |
|
370 | + echo ' |
|
358 | 371 | <dl> |
359 | 372 | <dt class="clear"> |
360 | 373 | <span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span> |
@@ -363,20 +376,23 @@ discard block |
||
363 | 376 | <input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text"> |
364 | 377 | </dd> |
365 | 378 | </dl>'; |
379 | + } |
|
366 | 380 | |
367 | 381 | // If this message has been edited in the past - display when it was. |
368 | - if (isset($context['last_modified'])) |
|
369 | - echo ' |
|
382 | + if (isset($context['last_modified'])) { |
|
383 | + echo ' |
|
370 | 384 | <div class="padding smalltext"> |
371 | 385 | ', $context['last_modified_text'], ' |
372 | 386 | </div>'; |
387 | + } |
|
373 | 388 | |
374 | 389 | // If the admin has enabled the hiding of the additional options - show a link and image for it. |
375 | - if (!empty($modSettings['additional_options_collapsable'])) |
|
376 | - echo ' |
|
390 | + if (!empty($modSettings['additional_options_collapsable'])) { |
|
391 | + echo ' |
|
377 | 392 | <div id="postAdditionalOptionsHeader"> |
378 | 393 | <strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong> |
379 | 394 | </div>'; |
395 | + } |
|
380 | 396 | |
381 | 397 | echo ' |
382 | 398 | <div id="postAdditionalOptions">'; |
@@ -408,19 +424,21 @@ discard block |
||
408 | 424 | <input type="hidden" name="attach_del[]" value="0"> |
409 | 425 | ', $txt['uncheck_unwatchd_attach'], ': |
410 | 426 | </dd>'; |
411 | - foreach ($context['current_attachments'] as $attachment) |
|
412 | - echo ' |
|
427 | + foreach ($context['current_attachments'] as $attachment) { |
|
428 | + echo ' |
|
413 | 429 | <dd class="smalltext"> |
414 | 430 | <label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', ' class="input_check"> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), |
415 | 431 | !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label> |
416 | 432 | </dd>'; |
433 | + } |
|
417 | 434 | |
418 | 435 | echo ' |
419 | 436 | </dl>'; |
420 | 437 | |
421 | - if (!empty($context['files_in_session_warning'])) |
|
422 | - echo ' |
|
438 | + if (!empty($context['files_in_session_warning'])) { |
|
439 | + echo ' |
|
423 | 440 | <div class="smalltext">', $context['files_in_session_warning'], '</div>'; |
441 | + } |
|
424 | 442 | } |
425 | 443 | |
426 | 444 | // Is the user allowed to post any additional ones? If so give them the boxes to do it! |
@@ -473,8 +491,8 @@ discard block |
||
473 | 491 | ', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '">'); |
474 | 492 | |
475 | 493 | // Show more boxes if they aren't approaching that limit. |
476 | - if ($context['num_allowed_attachments'] > 1) |
|
477 | - echo ' |
|
494 | + if ($context['num_allowed_attachments'] > 1) { |
|
495 | + echo ' |
|
478 | 496 | <script> |
479 | 497 | var allowed_attachments = ', $context['num_allowed_attachments'], '; |
480 | 498 | var current_attachment = 1; |
@@ -495,9 +513,10 @@ discard block |
||
495 | 513 | </div> |
496 | 514 | </div> |
497 | 515 | </dd>'; |
498 | - else |
|
499 | - echo ' |
|
516 | + } else { |
|
517 | + echo ' |
|
500 | 518 | </dd>'; |
519 | + } |
|
501 | 520 | |
502 | 521 | // Add any template changes for an alternative upload system here. |
503 | 522 | call_integration_hook('integrate_upload_template'); |
@@ -506,21 +525,25 @@ discard block |
||
506 | 525 | <dd class="smalltext">'; |
507 | 526 | |
508 | 527 | // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed. |
509 | - if (!empty($modSettings['attachmentCheckExtensions'])) |
|
510 | - echo ' |
|
528 | + if (!empty($modSettings['attachmentCheckExtensions'])) { |
|
529 | + echo ' |
|
511 | 530 | ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>'; |
531 | + } |
|
512 | 532 | |
513 | - if (!empty($context['attachment_restrictions'])) |
|
514 | - echo ' |
|
533 | + if (!empty($context['attachment_restrictions'])) { |
|
534 | + echo ' |
|
515 | 535 | ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>'; |
536 | + } |
|
516 | 537 | |
517 | - if ($context['num_allowed_attachments'] == 0) |
|
518 | - echo ' |
|
538 | + if ($context['num_allowed_attachments'] == 0) { |
|
539 | + echo ' |
|
519 | 540 | ', $txt['attach_limit_nag'], '<br>'; |
541 | + } |
|
520 | 542 | |
521 | - if (!$context['can_post_attachment_unapproved']) |
|
522 | - echo ' |
|
543 | + if (!$context['can_post_attachment_unapproved']) { |
|
544 | + echo ' |
|
523 | 545 | <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>'; |
546 | + } |
|
524 | 547 | |
525 | 548 | echo ' |
526 | 549 | </dd> |
@@ -543,10 +566,11 @@ discard block |
||
543 | 566 | <dt><strong>', $txt['subject'], '</strong></dt> |
544 | 567 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
545 | 568 | |
546 | - foreach ($context['drafts'] as $draft) |
|
547 | - echo ' |
|
569 | + foreach ($context['drafts'] as $draft) { |
|
570 | + echo ' |
|
548 | 571 | <dt>', $draft['link'], '</dt> |
549 | 572 | <dd>', $draft['poster_time'], '</dd>'; |
573 | + } |
|
550 | 574 | echo ' |
551 | 575 | </dl> |
552 | 576 | </div>'; |
@@ -571,9 +595,10 @@ discard block |
||
571 | 595 | ', template_control_richedit_buttons($context['post_box_name']); |
572 | 596 | |
573 | 597 | // Option to delete an event if user is editing one. |
574 | - if ($context['make_event'] && !$context['event']['new']) |
|
575 | - echo ' |
|
598 | + if ($context['make_event'] && !$context['event']['new']) { |
|
599 | + echo ' |
|
576 | 600 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'] ,'" class="button_submit you_sure">'; |
601 | + } |
|
577 | 602 | |
578 | 603 | echo ' |
579 | 604 | </span> |
@@ -582,9 +607,10 @@ discard block |
||
582 | 607 | <br class="clear">'; |
583 | 608 | |
584 | 609 | // Assuming this isn't a new topic pass across the last message id. |
585 | - if (isset($context['topic_last_message'])) |
|
586 | - echo ' |
|
610 | + if (isset($context['topic_last_message'])) { |
|
611 | + echo ' |
|
587 | 612 | <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">'; |
613 | + } |
|
588 | 614 | |
589 | 615 | echo ' |
590 | 616 | <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '"> |
@@ -726,9 +752,10 @@ discard block |
||
726 | 752 | |
727 | 753 | newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \'"><div id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">« <strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \' »</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';'; |
728 | 754 | |
729 | - if ($context['can_quote']) |
|
730 | - echo ' |
|
755 | + if ($context['can_quote']) { |
|
756 | + echo ' |
|
731 | 757 | newPostsHTML += \'<ul class="quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>', $txt['quote'], '</span><\' + \'/a></li></ul>\';'; |
758 | + } |
|
732 | 759 | |
733 | 760 | echo ' |
734 | 761 | newPostsHTML += \'<br class="clear">\'; |
@@ -771,8 +798,8 @@ discard block |
||
771 | 798 | }'; |
772 | 799 | |
773 | 800 | // Code for showing and hiding additional options. |
774 | - if (!empty($modSettings['additional_options_collapsable'])) |
|
775 | - echo ' |
|
801 | + if (!empty($modSettings['additional_options_collapsable'])) { |
|
802 | + echo ' |
|
776 | 803 | var oSwapAdditionalOptions = new smc_Toggle({ |
777 | 804 | bToggleEnabled: true, |
778 | 805 | bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ', |
@@ -800,10 +827,11 @@ discard block |
||
800 | 827 | } |
801 | 828 | ] |
802 | 829 | });'; |
830 | + } |
|
803 | 831 | |
804 | 832 | // Code for showing and hiding drafts |
805 | - if (!empty($context['drafts'])) |
|
806 | - echo ' |
|
833 | + if (!empty($context['drafts'])) { |
|
834 | + echo ' |
|
807 | 835 | var oSwapDraftOptions = new smc_Toggle({ |
808 | 836 | bToggleEnabled: true, |
809 | 837 | bCurrentlyCollapsed: true, |
@@ -825,6 +853,7 @@ discard block |
||
825 | 853 | } |
826 | 854 | ] |
827 | 855 | });'; |
856 | + } |
|
828 | 857 | |
829 | 858 | echo ' |
830 | 859 | var oEditorID = "', $context['post_box_name'] ,'"; |
@@ -845,8 +874,9 @@ discard block |
||
845 | 874 | foreach ($context['previous_posts'] as $post) |
846 | 875 | { |
847 | 876 | $ignoring = false; |
848 | - if (!empty($post['is_ignored'])) |
|
849 | - $ignored_posts[] = $ignoring = $post['id']; |
|
877 | + if (!empty($post['is_ignored'])) { |
|
878 | + $ignored_posts[] = $ignoring = $post['id']; |
|
879 | + } |
|
850 | 880 | |
851 | 881 | echo ' |
852 | 882 | <div class="windowbg"> |
@@ -1029,10 +1059,10 @@ discard block |
||
1029 | 1059 | <div id="temporary_posting_area" style="display: none;"></div> |
1030 | 1060 | <script>'; |
1031 | 1061 | |
1032 | - if ($context['close_window']) |
|
1033 | - echo ' |
|
1062 | + if ($context['close_window']) { |
|
1063 | + echo ' |
|
1034 | 1064 | window.close();'; |
1035 | - else |
|
1065 | + } else |
|
1036 | 1066 | { |
1037 | 1067 | // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;). |
1038 | 1068 | echo ' |
@@ -1086,11 +1116,12 @@ discard block |
||
1086 | 1116 | </p> |
1087 | 1117 | <ul>'; |
1088 | 1118 | |
1089 | - foreach ($context['groups'] as $group) |
|
1090 | - echo ' |
|
1119 | + foreach ($context['groups'] as $group) { |
|
1120 | + echo ' |
|
1091 | 1121 | <li> |
1092 | 1122 | <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked class="input_check"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em> |
1093 | 1123 | </li>'; |
1124 | + } |
|
1094 | 1125 | |
1095 | 1126 | echo ' |
1096 | 1127 | <li> |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | // Get everything started up... |
27 | 27 | define('SMF', 1); |
28 | -if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0) |
|
28 | +if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0) { |
|
29 | 29 | @set_magic_quotes_runtime(0); |
30 | +} |
|
30 | 31 | error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
31 | 32 | $time_start = microtime(); |
32 | 33 | |
@@ -34,16 +35,18 @@ discard block |
||
34 | 35 | ob_start(); |
35 | 36 | |
36 | 37 | // Do some cleaning, just in case. |
37 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
38 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
38 | 39 | if (isset($GLOBALS[$variable])) |
39 | 40 | unset($GLOBALS[$variable], $GLOBALS[$variable]); |
41 | +} |
|
40 | 42 | |
41 | 43 | // Load the settings... |
42 | 44 | require_once(dirname(__FILE__) . '/Settings.php'); |
43 | 45 | |
44 | 46 | // Make absolutely sure the cache directory is defined. |
45 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
47 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
46 | 48 | $cachedir = $boarddir . '/cache'; |
49 | +} |
|
47 | 50 | |
48 | 51 | // Without those we can't go anywhere |
49 | 52 | require_once($sourcedir . '/QueryString.php'); |
@@ -53,8 +56,9 @@ discard block |
||
53 | 56 | require_once($sourcedir . '/Load.php'); |
54 | 57 | |
55 | 58 | // If $maintenance is set specifically to 2, then we're upgrading or something. |
56 | -if (!empty($maintenance) && $maintenance == 2) |
|
59 | +if (!empty($maintenance) && $maintenance == 2) { |
|
57 | 60 | display_maintenance_message(); |
61 | +} |
|
58 | 62 | |
59 | 63 | // Create a variable to store some SMF specific functions in. |
60 | 64 | $smcFunc = array(); |
@@ -69,8 +73,9 @@ discard block |
||
69 | 73 | cleanRequest(); |
70 | 74 | |
71 | 75 | // Seed the random generator. |
72 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
76 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
73 | 77 | smf_seed_generator(); |
78 | +} |
|
74 | 79 | |
75 | 80 | // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out! |
76 | 81 | if (isset($_GET['scheduled'])) |
@@ -90,9 +95,9 @@ discard block |
||
90 | 95 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent()) |
91 | 96 | { |
92 | 97 | // If zlib is being used, turn off output compression. |
93 | - if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
94 | - $modSettings['enableCompressedOutput'] = '0'; |
|
95 | - else |
|
98 | + if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') { |
|
99 | + $modSettings['enableCompressedOutput'] = '0'; |
|
100 | + } else |
|
96 | 101 | { |
97 | 102 | ob_end_clean(); |
98 | 103 | ob_start('ob_gzhandler'); |
@@ -141,18 +146,21 @@ discard block |
||
141 | 146 | loadPermissions(); |
142 | 147 | |
143 | 148 | // Attachments don't require the entire theme to be loaded. |
144 | - if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') |
|
145 | - detectBrowser(); |
|
149 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') { |
|
150 | + detectBrowser(); |
|
151 | + } |
|
146 | 152 | // Load the current theme. (note that ?theme=1 will also work, may be used for guest theming.) |
147 | - else |
|
148 | - loadTheme(); |
|
153 | + else { |
|
154 | + loadTheme(); |
|
155 | + } |
|
149 | 156 | |
150 | 157 | // Check if the user should be disallowed access. |
151 | 158 | is_not_banned(); |
152 | 159 | |
153 | 160 | // If we are in a topic and don't have permission to approve it then duck out now. |
154 | - if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) |
|
155 | - fatal_lang_error('not_a_topic', false); |
|
161 | + if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) { |
|
162 | + fatal_lang_error('not_a_topic', false); |
|
163 | + } |
|
156 | 164 | |
157 | 165 | $no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'); |
158 | 166 | call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions)); |
@@ -163,8 +171,9 @@ discard block |
||
163 | 171 | writeLog(); |
164 | 172 | |
165 | 173 | // Track forum statistics and hits...? |
166 | - if (!empty($modSettings['hitStats'])) |
|
167 | - trackStats(array('hits' => '+')); |
|
174 | + if (!empty($modSettings['hitStats'])) { |
|
175 | + trackStats(array('hits' => '+')); |
|
176 | + } |
|
168 | 177 | } |
169 | 178 | unset($no_stat_actions); |
170 | 179 | |
@@ -178,13 +187,14 @@ discard block |
||
178 | 187 | return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout')); |
179 | 188 | } |
180 | 189 | // Don't even try it, sonny. |
181 | - else |
|
182 | - return 'InMaintenance'; |
|
190 | + else { |
|
191 | + return 'InMaintenance'; |
|
192 | + } |
|
183 | 193 | } |
184 | 194 | // If guest access is off, a guest can only do one of the very few following actions. |
185 | - elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) |
|
186 | - return 'KickGuest'; |
|
187 | - elseif (empty($_REQUEST['action'])) |
|
195 | + elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) { |
|
196 | + return 'KickGuest'; |
|
197 | + } elseif (empty($_REQUEST['action'])) |
|
188 | 198 | { |
189 | 199 | // Action and board are both empty... BoardIndex! Unless someone else wants to do something different. |
190 | 200 | if (empty($board) && empty($topic)) |
@@ -200,8 +210,9 @@ discard block |
||
200 | 210 | |
201 | 211 | $call = call_helper($defaultAction, true); |
202 | 212 | |
203 | - if (!empty($call)) |
|
204 | - return $call; |
|
213 | + if (!empty($call)) { |
|
214 | + return $call; |
|
215 | + } |
|
205 | 216 | } |
206 | 217 | |
207 | 218 | // No default action huh? then go to our good old BoardIndex. |
@@ -331,8 +342,9 @@ discard block |
||
331 | 342 | |
332 | 343 | $call = call_helper($fallbackAction, true); |
333 | 344 | |
334 | - if (!empty($call)) |
|
335 | - return $call; |
|
345 | + if (!empty($call)) { |
|
346 | + return $call; |
|
347 | + } |
|
336 | 348 | } |
337 | 349 | |
338 | 350 | // No fallback action, huh? |