@@ -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 |
@@ -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 | } |
@@ -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> |
@@ -240,8 +240,8 @@ |
||
240 | 240 | $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
241 | 241 | |
242 | 242 | $js_time_string = str_replace( |
243 | - array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
|
244 | - array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'), |
|
243 | + array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
|
244 | + array('H', 'G', 'h', 'g', 'i', 'A', 'a', 'h:i:s A', 'H:i', 's', 'H:i:s', 'H:i:s'), |
|
245 | 245 | $time_string |
246 | 246 | ); |
247 | 247 |
@@ -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 | * Show the calendar. |
@@ -47,12 +48,14 @@ discard block |
||
47 | 48 | 'post' => 'CalendarPost', |
48 | 49 | ); |
49 | 50 | |
50 | - if (isset($_GET['sa']) && isset($subActions[$_GET['sa']])) |
|
51 | - return call_helper($subActions[$_GET['sa']]); |
|
51 | + if (isset($_GET['sa']) && isset($subActions[$_GET['sa']])) { |
|
52 | + return call_helper($subActions[$_GET['sa']]); |
|
53 | + } |
|
52 | 54 | |
53 | 55 | // You can't do anything if the calendar is off. |
54 | - if (empty($modSettings['cal_enabled'])) |
|
55 | - fatal_lang_error('calendar_off', false); |
|
56 | + if (empty($modSettings['cal_enabled'])) { |
|
57 | + fatal_lang_error('calendar_off', false); |
|
58 | + } |
|
56 | 59 | |
57 | 60 | // This is gonna be needed... |
58 | 61 | loadTemplate('Calendar'); |
@@ -97,8 +100,9 @@ discard block |
||
97 | 100 | $context['view_week'] = isset($_GET['viewweek']); |
98 | 101 | |
99 | 102 | // Don't let search engines index weekly calendar pages. |
100 | - if ($context['view_week']) |
|
101 | - $context['robot_no_index'] = true; |
|
103 | + if ($context['view_week']) { |
|
104 | + $context['robot_no_index'] = true; |
|
105 | + } |
|
102 | 106 | |
103 | 107 | // Get the current day of month... |
104 | 108 | require_once($sourcedir . '/Subs-Calendar.php'); |
@@ -112,17 +116,20 @@ discard block |
||
112 | 116 | ); |
113 | 117 | |
114 | 118 | // Make sure the year and month are in valid ranges. |
115 | - if ($curPage['month'] < 1 || $curPage['month'] > 12) |
|
116 | - fatal_lang_error('invalid_month', false); |
|
117 | - if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) |
|
118 | - fatal_lang_error('invalid_year', false); |
|
119 | + if ($curPage['month'] < 1 || $curPage['month'] > 12) { |
|
120 | + fatal_lang_error('invalid_month', false); |
|
121 | + } |
|
122 | + if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) { |
|
123 | + fatal_lang_error('invalid_year', false); |
|
124 | + } |
|
119 | 125 | // If we have a day clean that too. |
120 | 126 | if ($context['view_week']) |
121 | 127 | { |
122 | 128 | // Note $isValid is -1 < PHP 5.1 |
123 | 129 | $isValid = mktime(0, 0, 0, $curPage['month'], $curPage['day'], $curPage['year']); |
124 | - if ($curPage['day'] > 31 || !$isValid || $isValid == -1) |
|
125 | - fatal_lang_error('invalid_day', false); |
|
130 | + if ($curPage['day'] > 31 || !$isValid || $isValid == -1) { |
|
131 | + fatal_lang_error('invalid_day', false); |
|
132 | + } |
|
126 | 133 | } |
127 | 134 | |
128 | 135 | // Load all the context information needed to show the calendar grid. |
@@ -144,21 +151,24 @@ discard block |
||
144 | 151 | ); |
145 | 152 | |
146 | 153 | // Load up the main view. |
147 | - if ($context['view_week']) |
|
148 | - $context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions); |
|
149 | - else |
|
150 | - $context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
|
154 | + if ($context['view_week']) { |
|
155 | + $context['calendar_grid_main'] = getCalendarWeek($curPage['month'], $curPage['year'], $curPage['day'], $calendarOptions); |
|
156 | + } else { |
|
157 | + $context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
|
158 | + } |
|
151 | 159 | |
152 | 160 | // Load up the previous and next months. |
153 | 161 | $context['calendar_grid_current'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); |
154 | 162 | |
155 | 163 | // Only show previous month if it isn't pre-January of the min-year |
156 | - if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1) |
|
157 | - $context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true); |
|
164 | + if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1) { |
|
165 | + $context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true); |
|
166 | + } |
|
158 | 167 | |
159 | 168 | // Only show next month if it isn't post-December of the max-year |
160 | - if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12) |
|
161 | - $context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions); |
|
169 | + if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12) { |
|
170 | + $context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions); |
|
171 | + } |
|
162 | 172 | |
163 | 173 | // Basic template stuff. |
164 | 174 | $context['allow_calendar_event'] = allowedTo('calendar_post'); |
@@ -191,17 +201,19 @@ discard block |
||
191 | 201 | 'name' => $txt['months'][$context['current_month']] . ' ' . $context['current_year'] |
192 | 202 | ); |
193 | 203 | // If applicable, add the current week to the linktree. |
194 | - if ($context['view_week']) |
|
195 | - $context['linktree'][] = array( |
|
204 | + if ($context['view_week']) { |
|
205 | + $context['linktree'][] = array( |
|
196 | 206 | 'url' => $scripturl . '?action=calendar;viewweek;year=' . $context['current_year'] . ';month=' . $context['current_month'] . ';day=' . $context['current_day'], |
197 | 207 | 'name' => $context['calendar_grid_main']['week_title'], |
198 | 208 | ); |
209 | + } |
|
199 | 210 | |
200 | 211 | // Build the calendar button array. |
201 | 212 | $context['calendar_buttons'] = array(); |
202 | 213 | |
203 | - if ($context['can_post']) |
|
204 | - $context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
214 | + if ($context['can_post']) { |
|
215 | + $context['calendar_buttons']['post_event'] = array('text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']); |
|
216 | + } |
|
205 | 217 | |
206 | 218 | // Allow mods to add additional buttons here |
207 | 219 | call_integration_hook('integrate_calendar_buttons'); |
@@ -230,14 +242,16 @@ discard block |
||
230 | 242 | require_once($sourcedir . '/Subs.php'); |
231 | 243 | |
232 | 244 | // Cast this for safety... |
233 | - if (isset($_REQUEST['eventid'])) |
|
234 | - $_REQUEST['eventid'] = (int) $_REQUEST['eventid']; |
|
245 | + if (isset($_REQUEST['eventid'])) { |
|
246 | + $_REQUEST['eventid'] = (int) $_REQUEST['eventid']; |
|
247 | + } |
|
235 | 248 | |
236 | 249 | // We want a fairly compact version of the time, but as close as possible to the user's settings. |
237 | - if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) |
|
238 | - $time_string = '%k:%M'; |
|
239 | - else |
|
240 | - $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
250 | + if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0])) { |
|
251 | + $time_string = '%k:%M'; |
|
252 | + } else { |
|
253 | + $time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]); |
|
254 | + } |
|
241 | 255 | |
242 | 256 | $js_time_string = str_replace( |
243 | 257 | array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r', '%R', '%S', '%T', '%X'), |
@@ -251,12 +265,14 @@ discard block |
||
251 | 265 | checkSession(); |
252 | 266 | |
253 | 267 | // Validate the post... |
254 | - if (!isset($_POST['link_to_board'])) |
|
255 | - validateEventPost(); |
|
268 | + if (!isset($_POST['link_to_board'])) { |
|
269 | + validateEventPost(); |
|
270 | + } |
|
256 | 271 | |
257 | 272 | // If you're not allowed to edit any events, you have to be the poster. |
258 | - if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) |
|
259 | - isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any')); |
|
273 | + if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) { |
|
274 | + isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any')); |
|
275 | + } |
|
260 | 276 | |
261 | 277 | // New - and directing? |
262 | 278 | if (isset($_POST['link_to_board']) || empty($modSettings['cal_allow_unlinked'])) |
@@ -279,8 +295,9 @@ discard block |
||
279 | 295 | } |
280 | 296 | |
281 | 297 | // Deleting... |
282 | - elseif (isset($_REQUEST['deleteevent'])) |
|
283 | - removeEvent($_REQUEST['eventid']); |
|
298 | + elseif (isset($_REQUEST['deleteevent'])) { |
|
299 | + removeEvent($_REQUEST['eventid']); |
|
300 | + } |
|
284 | 301 | |
285 | 302 | // ... or just update it? |
286 | 303 | else |
@@ -302,14 +319,12 @@ discard block |
||
302 | 319 | $d = date_parse($_POST['start_date']); |
303 | 320 | $year = $d['year']; |
304 | 321 | $month = $d['month']; |
305 | - } |
|
306 | - elseif (isset($_POST['start_datetime'])) |
|
322 | + } elseif (isset($_POST['start_datetime'])) |
|
307 | 323 | { |
308 | 324 | $d = date_parse($_POST['start_datetime']); |
309 | 325 | $year = $d['year']; |
310 | 326 | $month = $d['month']; |
311 | - } |
|
312 | - else |
|
327 | + } else |
|
313 | 328 | { |
314 | 329 | $today = getdate(); |
315 | 330 | $year = isset($_POST['year']) ? $_POST['year'] : $today['year']; |
@@ -342,13 +357,13 @@ discard block |
||
342 | 357 | $context['event'] = array_merge($context['event'], $eventDatetimes); |
343 | 358 | |
344 | 359 | $context['event']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['event']['month'] == 12 ? 1 : $context['event']['month'] + 1, 0, $context['event']['month'] == 12 ? $context['event']['year'] + 1 : $context['event']['year'])); |
345 | - } |
|
346 | - else |
|
360 | + } else |
|
347 | 361 | { |
348 | 362 | $context['event'] = getEventProperties($_REQUEST['eventid']); |
349 | 363 | |
350 | - if ($context['event'] === false) |
|
351 | - fatal_lang_error('no_access', false); |
|
364 | + if ($context['event'] === false) { |
|
365 | + fatal_lang_error('no_access', false); |
|
366 | + } |
|
352 | 367 | |
353 | 368 | // If it has a board, then they should be editing it within the topic. |
354 | 369 | if (!empty($context['event']['topic']['id']) && !empty($context['event']['topic']['first_msg'])) |
@@ -359,10 +374,11 @@ discard block |
||
359 | 374 | } |
360 | 375 | |
361 | 376 | // Make sure the user is allowed to edit this event. |
362 | - if ($context['event']['member'] != $user_info['id']) |
|
363 | - isAllowedTo('calendar_edit_any'); |
|
364 | - elseif (!allowedTo('calendar_edit_any')) |
|
365 | - isAllowedTo('calendar_edit_own'); |
|
377 | + if ($context['event']['member'] != $user_info['id']) { |
|
378 | + isAllowedTo('calendar_edit_any'); |
|
379 | + } elseif (!allowedTo('calendar_edit_any')) { |
|
380 | + isAllowedTo('calendar_edit_own'); |
|
381 | + } |
|
366 | 382 | } |
367 | 383 | |
368 | 384 | // An all day event? Set up some nice defaults in case the user wants to change that |
@@ -396,8 +412,7 @@ discard block |
||
396 | 412 | { |
397 | 413 | // You can post new events but can't link them to anything... |
398 | 414 | $context['event']['categories'] = array(); |
399 | - } |
|
400 | - else |
|
415 | + } else |
|
401 | 416 | { |
402 | 417 | // Load the list of boards and categories in the context. |
403 | 418 | require_once($sourcedir . '/Subs-MessageIndex.php'); |
@@ -484,12 +499,14 @@ discard block |
||
484 | 499 | global $smcFunc, $sourcedir, $forum_version, $modSettings, $webmaster_email, $mbname; |
485 | 500 | |
486 | 501 | // You can't export if the calendar export feature is off. |
487 | - if (empty($modSettings['cal_export'])) |
|
488 | - fatal_lang_error('calendar_export_off', false); |
|
502 | + if (empty($modSettings['cal_export'])) { |
|
503 | + fatal_lang_error('calendar_export_off', false); |
|
504 | + } |
|
489 | 505 | |
490 | 506 | // Goes without saying that this is required. |
491 | - if (!isset($_REQUEST['eventid'])) |
|
492 | - fatal_lang_error('no_access', false); |
|
507 | + if (!isset($_REQUEST['eventid'])) { |
|
508 | + fatal_lang_error('no_access', false); |
|
509 | + } |
|
493 | 510 | |
494 | 511 | // This is kinda wanted. |
495 | 512 | require_once($sourcedir . '/Subs-Calendar.php'); |
@@ -497,15 +514,17 @@ discard block |
||
497 | 514 | // Load up the event in question and check it exists. |
498 | 515 | $event = getEventProperties($_REQUEST['eventid']); |
499 | 516 | |
500 | - if ($event === false) |
|
501 | - fatal_lang_error('no_access', false); |
|
517 | + if ($event === false) { |
|
518 | + fatal_lang_error('no_access', false); |
|
519 | + } |
|
502 | 520 | |
503 | 521 | // Check the title isn't too long - iCal requires some formatting if so. |
504 | 522 | $title = str_split($event['title'], 30); |
505 | 523 | foreach ($title as $id => $line) |
506 | 524 | { |
507 | - if ($id != 0) |
|
508 | - $title[$id] = ' ' . $title[$id]; |
|
525 | + if ($id != 0) { |
|
526 | + $title[$id] = ' ' . $title[$id]; |
|
527 | + } |
|
509 | 528 | $title[$id] .= "\n"; |
510 | 529 | } |
511 | 530 | |
@@ -518,8 +537,7 @@ discard block |
||
518 | 537 | { |
519 | 538 | $datestart = date_format($start_date, 'Ymd\THis'); |
520 | 539 | $dateend = date_format($end_date, 'Ymd\THis'); |
521 | - } |
|
522 | - else |
|
540 | + } else |
|
523 | 541 | { |
524 | 542 | $datestart = date_format($start_date, 'Ymd'); |
525 | 543 | |
@@ -540,15 +558,18 @@ discard block |
||
540 | 558 | $filecontents .= 'DTSTART' . (!empty($event['start_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $datestart . "\n"; |
541 | 559 | |
542 | 560 | // event has a duration |
543 | - if ($event['start_iso_gmdate'] != $event['end_iso_gmdate']) |
|
544 | - $filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n"; |
|
561 | + if ($event['start_iso_gmdate'] != $event['end_iso_gmdate']) { |
|
562 | + $filecontents .= 'DTEND' . (!empty($event['end_time']) ? ';TZID=' . $event['tz'] : ';VALUE=DATE') . ':' . $dateend . "\n"; |
|
563 | + } |
|
545 | 564 | |
546 | 565 | // event has changed? advance the sequence for this UID |
547 | - if ($event['sequence'] > 0) |
|
548 | - $filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n"; |
|
566 | + if ($event['sequence'] > 0) { |
|
567 | + $filecontents .= 'SEQUENCE:' . $event['sequence'] . "\n"; |
|
568 | + } |
|
549 | 569 | |
550 | - if (!empty($event['location'])) |
|
551 | - $filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n"; |
|
570 | + if (!empty($event['location'])) { |
|
571 | + $filecontents .= 'LOCATION:' . str_replace(',', '\,', $event['location']) . "\n"; |
|
572 | + } |
|
552 | 573 | |
553 | 574 | $filecontents .= 'SUMMARY:' . implode('', $title); |
554 | 575 | $filecontents .= 'UID:' . $event['eventid'] . '@' . str_replace(' ', '-', $mbname) . "\n"; |
@@ -557,23 +578,26 @@ discard block |
||
557 | 578 | |
558 | 579 | // Send some standard headers. |
559 | 580 | ob_end_clean(); |
560 | - if (!empty($modSettings['enableCompressedOutput'])) |
|
561 | - @ob_start('ob_gzhandler'); |
|
562 | - else |
|
563 | - ob_start(); |
|
581 | + if (!empty($modSettings['enableCompressedOutput'])) { |
|
582 | + @ob_start('ob_gzhandler'); |
|
583 | + } else { |
|
584 | + ob_start(); |
|
585 | + } |
|
564 | 586 | |
565 | 587 | // Send the file headers |
566 | 588 | header('Pragma: '); |
567 | 589 | header('Cache-Control: no-cache'); |
568 | - if (!isBrowser('gecko')) |
|
569 | - header('Content-Transfer-Encoding: binary'); |
|
590 | + if (!isBrowser('gecko')) { |
|
591 | + header('Content-Transfer-Encoding: binary'); |
|
592 | + } |
|
570 | 593 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 525600 * 60) . ' GMT'); |
571 | 594 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . 'GMT'); |
572 | 595 | header('Accept-Ranges: bytes'); |
573 | 596 | header('Connection: close'); |
574 | 597 | header('Content-Disposition: attachment; filename="' . $event['title'] . '.ics"'); |
575 | - if (empty($modSettings['enableCompressedOutput'])) |
|
576 | - header('Content-Length: ' . $smcFunc['strlen']($filecontents)); |
|
598 | + if (empty($modSettings['enableCompressedOutput'])) { |
|
599 | + header('Content-Length: ' . $smcFunc['strlen']($filecontents)); |
|
600 | + } |
|
577 | 601 | |
578 | 602 | // This is a calendar item! |
579 | 603 | header('Content-Type: text/calendar'); |
@@ -612,20 +636,17 @@ discard block |
||
612 | 636 | $context['sub_template'] = 'bcd'; |
613 | 637 | $context['linktree'][] = array('url' => $scripturl . '?action=clock;bcd', 'name' => 'BCD'); |
614 | 638 | $context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ==')); |
615 | - } |
|
616 | - elseif (!$omfg && !isset($_REQUEST['time'])) |
|
639 | + } elseif (!$omfg && !isset($_REQUEST['time'])) |
|
617 | 640 | { |
618 | 641 | $context['sub_template'] = 'hms'; |
619 | 642 | $context['linktree'][] = array('url' => $scripturl . '?action=clock', 'name' => 'Binary'); |
620 | 643 | $context['clockicons'] = safe_unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319')); |
621 | - } |
|
622 | - elseif ($omfg) |
|
644 | + } elseif ($omfg) |
|
623 | 645 | { |
624 | 646 | $context['sub_template'] = 'omfg'; |
625 | 647 | $context['linktree'][] = array('url' => $scripturl . '?action=clock;omfg', 'name' => 'OMFG'); |
626 | 648 | $context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ==')); |
627 | - } |
|
628 | - elseif (isset($_REQUEST['time'])) |
|
649 | + } elseif (isset($_REQUEST['time'])) |
|
629 | 650 | { |
630 | 651 | $context['sub_template'] = 'thetime'; |
631 | 652 | $time = getdate($_REQUEST['time'] == 'now' ? time() : (int) $_REQUEST['time']); |
@@ -685,12 +706,13 @@ discard block |
||
685 | 706 | ), |
686 | 707 | ); |
687 | 708 | |
688 | - foreach ($context['clockicons'] as $t => $vs) |
|
689 | - foreach ($vs as $v => $dumb) |
|
709 | + foreach ($context['clockicons'] as $t => $vs) { |
|
710 | + foreach ($vs as $v => $dumb) |
|
690 | 711 | { |
691 | 712 | if ($$t >= $v) |
692 | 713 | { |
693 | 714 | $$t -= $v; |
715 | + } |
|
694 | 716 | $context['clockicons'][$t][$v] = true; |
695 | 717 | } |
696 | 718 | } |
@@ -1622,8 +1622,7 @@ |
||
1622 | 1622 | updateStats('topic'); |
1623 | 1623 | |
1624 | 1624 | // This function is needed to do the updateStats('subject') call. |
1625 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
1626 | - function($string){ |
|
1625 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1627 | 1626 | global $sourcedir; |
1628 | 1627 | if (function_exists('mb_strtolower')) |
1629 | 1628 | return mb_strtolower($string, 'UTF-8'); |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | // ><html dir="ltr"><head><title>Error!</title></head><body>Sorry, this installer requires PHP!<div style="display: none;"> |
21 | 21 | |
22 | 22 | // Let's pull in useful classes |
23 | -if (!defined('SMF')) |
|
23 | +if (!defined('SMF')) { |
|
24 | 24 | define('SMF', 1); |
25 | +} |
|
25 | 26 | |
26 | 27 | require_once('Sources/Class-Package.php'); |
27 | 28 | |
@@ -83,12 +84,14 @@ discard block |
||
83 | 84 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
84 | 85 | |
85 | 86 | // Is it reserved? |
86 | - if ($value == 'pg_') |
|
87 | - return $txt['error_db_prefix_reserved']; |
|
87 | + if ($value == 'pg_') { |
|
88 | + return $txt['error_db_prefix_reserved']; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | // Is the prefix numeric? |
90 | - if (preg_match('~^\d~', $value)) |
|
91 | - return $txt['error_db_prefix_numeric']; |
|
92 | + if (preg_match('~^\d~', $value)) { |
|
93 | + return $txt['error_db_prefix_numeric']; |
|
94 | + } |
|
92 | 95 | |
93 | 96 | return true; |
94 | 97 | }, |
@@ -135,10 +138,11 @@ discard block |
||
135 | 138 | $incontext['skip'] = false; |
136 | 139 | |
137 | 140 | // Call the step and if it returns false that means pause! |
138 | - if (function_exists($step[2]) && $step[2]() === false) |
|
139 | - break; |
|
140 | - elseif (function_exists($step[2])) |
|
141 | - $incontext['current_step']++; |
|
141 | + if (function_exists($step[2]) && $step[2]() === false) { |
|
142 | + break; |
|
143 | + } elseif (function_exists($step[2])) { |
|
144 | + $incontext['current_step']++; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | // No warnings pass on. |
144 | 148 | $incontext['warning'] = ''; |
@@ -154,12 +158,14 @@ discard block |
||
154 | 158 | global $databases, $incontext; |
155 | 159 | |
156 | 160 | // Just so people using older versions of PHP aren't left in the cold. |
157 | - if (!isset($_SERVER['PHP_SELF'])) |
|
158 | - $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
161 | + if (!isset($_SERVER['PHP_SELF'])) { |
|
162 | + $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
163 | + } |
|
159 | 164 | |
160 | 165 | // Turn off magic quotes runtime and enable error reporting. |
161 | - if (function_exists('set_magic_quotes_runtime')) |
|
162 | - @set_magic_quotes_runtime(0); |
|
166 | + if (function_exists('set_magic_quotes_runtime')) { |
|
167 | + @set_magic_quotes_runtime(0); |
|
168 | + } |
|
163 | 169 | error_reporting(E_ALL); |
164 | 170 | |
165 | 171 | // Fun. Low PHP version... |
@@ -173,21 +179,23 @@ discard block |
||
173 | 179 | { |
174 | 180 | ob_start(); |
175 | 181 | |
176 | - if (ini_get('session.save_handler') == 'user') |
|
177 | - @ini_set('session.save_handler', 'files'); |
|
178 | - if (function_exists('session_start')) |
|
179 | - @session_start(); |
|
180 | - } |
|
181 | - else |
|
182 | + if (ini_get('session.save_handler') == 'user') { |
|
183 | + @ini_set('session.save_handler', 'files'); |
|
184 | + } |
|
185 | + if (function_exists('session_start')) { |
|
186 | + @session_start(); |
|
187 | + } |
|
188 | + } else |
|
182 | 189 | { |
183 | 190 | ob_start('ob_gzhandler'); |
184 | 191 | |
185 | - if (ini_get('session.save_handler') == 'user') |
|
186 | - @ini_set('session.save_handler', 'files'); |
|
192 | + if (ini_get('session.save_handler') == 'user') { |
|
193 | + @ini_set('session.save_handler', 'files'); |
|
194 | + } |
|
187 | 195 | session_start(); |
188 | 196 | |
189 | - if (!headers_sent()) |
|
190 | - echo '<!DOCTYPE html> |
|
197 | + if (!headers_sent()) { |
|
198 | + echo '<!DOCTYPE html> |
|
191 | 199 | <html> |
192 | 200 | <head> |
193 | 201 | <title>', htmlspecialchars($_GET['pass_string']), '</title> |
@@ -196,6 +204,7 @@ discard block |
||
196 | 204 | <strong>', htmlspecialchars($_GET['pass_string']), '</strong> |
197 | 205 | </body> |
198 | 206 | </html>'; |
207 | + } |
|
199 | 208 | exit; |
200 | 209 | } |
201 | 210 | |
@@ -204,16 +213,18 @@ discard block |
||
204 | 213 | { |
205 | 214 | $incontext['remote_files_available'] = false; |
206 | 215 | $test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1); |
207 | - if ($test) |
|
208 | - $incontext['remote_files_available'] = true; |
|
216 | + if ($test) { |
|
217 | + $incontext['remote_files_available'] = true; |
|
218 | + } |
|
209 | 219 | @fclose($test); |
210 | 220 | } |
211 | 221 | |
212 | 222 | // Add slashes, as long as they aren't already being added. |
213 | - if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) |
|
214 | - foreach ($_POST as $k => $v) |
|
223 | + if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) { |
|
224 | + foreach ($_POST as $k => $v) |
|
215 | 225 | if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false) |
216 | 226 | $_POST[$k] = addslashes($v); |
227 | + } |
|
217 | 228 | |
218 | 229 | // This is really quite simple; if ?delete is on the URL, delete the installer... |
219 | 230 | if (isset($_GET['delete'])) |
@@ -234,8 +245,7 @@ discard block |
||
234 | 245 | $ftp->close(); |
235 | 246 | |
236 | 247 | unset($_SESSION['installer_temp_ftp']); |
237 | - } |
|
238 | - else |
|
248 | + } else |
|
239 | 249 | { |
240 | 250 | @unlink(__FILE__); |
241 | 251 | |
@@ -256,10 +266,11 @@ discard block |
||
256 | 266 | { |
257 | 267 | // Get PHP's default timezone, if set |
258 | 268 | $ini_tz = ini_get('date.timezone'); |
259 | - if (!empty($ini_tz)) |
|
260 | - $timezone_id = $ini_tz; |
|
261 | - else |
|
262 | - $timezone_id = ''; |
|
269 | + if (!empty($ini_tz)) { |
|
270 | + $timezone_id = $ini_tz; |
|
271 | + } else { |
|
272 | + $timezone_id = ''; |
|
273 | + } |
|
263 | 274 | |
264 | 275 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
265 | 276 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -289,8 +300,9 @@ discard block |
||
289 | 300 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
290 | 301 | while ($entry = $dir->read()) |
291 | 302 | { |
292 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
293 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
303 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
304 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
305 | + } |
|
294 | 306 | } |
295 | 307 | $dir->close(); |
296 | 308 | } |
@@ -325,10 +337,11 @@ discard block |
||
325 | 337 | } |
326 | 338 | |
327 | 339 | // Override the language file? |
328 | - if (isset($_GET['lang_file'])) |
|
329 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
330 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
331 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
340 | + if (isset($_GET['lang_file'])) { |
|
341 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
342 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
343 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
344 | + } |
|
332 | 345 | |
333 | 346 | // Make sure it exists, if it doesn't reset it. |
334 | 347 | if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(dirname(__FILE__) . '/Themes/default/languages/' . $_SESSION['installer_temp_lang'])) |
@@ -337,8 +350,9 @@ discard block |
||
337 | 350 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
338 | 351 | |
339 | 352 | // If we have english and some other language, use the other language. We Americans hate english :P. |
340 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
341 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
353 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
354 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
355 | + } |
|
342 | 356 | } |
343 | 357 | |
344 | 358 | // And now include the actual language file itself. |
@@ -351,15 +365,18 @@ discard block |
||
351 | 365 | global $db_prefix, $db_connection, $sourcedir; |
352 | 366 | global $smcFunc, $modSettings, $db_type, $db_name, $db_user, $db_persist; |
353 | 367 | |
354 | - if (empty($sourcedir)) |
|
355 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
368 | + if (empty($sourcedir)) { |
|
369 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
370 | + } |
|
356 | 371 | |
357 | 372 | // Need this to check whether we need the database password. |
358 | 373 | require(dirname(__FILE__) . '/Settings.php'); |
359 | - if (!defined('SMF')) |
|
360 | - define('SMF', 1); |
|
361 | - if (empty($smcFunc)) |
|
362 | - $smcFunc = array(); |
|
374 | + if (!defined('SMF')) { |
|
375 | + define('SMF', 1); |
|
376 | + } |
|
377 | + if (empty($smcFunc)) { |
|
378 | + $smcFunc = array(); |
|
379 | + } |
|
363 | 380 | |
364 | 381 | $modSettings['disableQueryCheck'] = true; |
365 | 382 | |
@@ -367,8 +384,9 @@ discard block |
||
367 | 384 | if (!$db_connection) |
368 | 385 | { |
369 | 386 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
370 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
371 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
387 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
388 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
389 | + } |
|
372 | 390 | |
373 | 391 | $db_options = array('persist' => $db_persist); |
374 | 392 | $port = ''; |
@@ -379,19 +397,20 @@ discard block |
||
379 | 397 | if ($db_type == 'mysql' || $db_type == 'mysqli') |
380 | 398 | { |
381 | 399 | $port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port']; |
382 | - } |
|
383 | - elseif ($db_type == 'postgresql') |
|
400 | + } elseif ($db_type == 'postgresql') |
|
384 | 401 | { |
385 | 402 | // PostgreSQL doesn't have a default port setting in php.ini, so just check against the default |
386 | 403 | $port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port']; |
387 | 404 | } |
388 | 405 | } |
389 | 406 | |
390 | - if (!empty($port)) |
|
391 | - $db_options['port'] = $port; |
|
407 | + if (!empty($port)) { |
|
408 | + $db_options['port'] = $port; |
|
409 | + } |
|
392 | 410 | |
393 | - if (!$db_connection) |
|
394 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
411 | + if (!$db_connection) { |
|
412 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
413 | + } |
|
395 | 414 | } |
396 | 415 | } |
397 | 416 | |
@@ -419,8 +438,9 @@ discard block |
||
419 | 438 | // @todo REMOVE THIS!! |
420 | 439 | else |
421 | 440 | { |
422 | - if (function_exists('doStep' . $_GET['step'])) |
|
423 | - call_user_func('doStep' . $_GET['step']); |
|
441 | + if (function_exists('doStep' . $_GET['step'])) { |
|
442 | + call_user_func('doStep' . $_GET['step']); |
|
443 | + } |
|
424 | 444 | } |
425 | 445 | // Show the footer. |
426 | 446 | template_install_below(); |
@@ -438,8 +458,9 @@ discard block |
||
438 | 458 | $incontext['sub_template'] = 'welcome_message'; |
439 | 459 | |
440 | 460 | // Done the submission? |
441 | - if (isset($_POST['contbutt'])) |
|
442 | - return true; |
|
461 | + if (isset($_POST['contbutt'])) { |
|
462 | + return true; |
|
463 | + } |
|
443 | 464 | |
444 | 465 | // See if we think they have already installed it? |
445 | 466 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -447,14 +468,17 @@ discard block |
||
447 | 468 | $probably_installed = 0; |
448 | 469 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
449 | 470 | { |
450 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
451 | - $probably_installed++; |
|
452 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
453 | - $probably_installed++; |
|
471 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
472 | + $probably_installed++; |
|
473 | + } |
|
474 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
475 | + $probably_installed++; |
|
476 | + } |
|
454 | 477 | } |
455 | 478 | |
456 | - if ($probably_installed == 2) |
|
457 | - $incontext['warning'] = $txt['error_already_installed']; |
|
479 | + if ($probably_installed == 2) { |
|
480 | + $incontext['warning'] = $txt['error_already_installed']; |
|
481 | + } |
|
458 | 482 | } |
459 | 483 | |
460 | 484 | // Is some database support even compiled in? |
@@ -469,36 +493,43 @@ discard block |
||
469 | 493 | $databases[$key]['supported'] = false; |
470 | 494 | $notFoundSQLFile = true; |
471 | 495 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
496 | + } else { |
|
497 | + $incontext['supported_databases'][] = $db; |
|
472 | 498 | } |
473 | - else |
|
474 | - $incontext['supported_databases'][] = $db; |
|
475 | 499 | } |
476 | 500 | } |
477 | 501 | |
478 | 502 | // Check the PHP version. |
479 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) |
|
480 | - $error = 'error_php_too_low'; |
|
503 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) { |
|
504 | + $error = 'error_php_too_low'; |
|
505 | + } |
|
481 | 506 | // Make sure we have a supported database |
482 | - elseif (empty($incontext['supported_databases'])) |
|
483 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
507 | + elseif (empty($incontext['supported_databases'])) { |
|
508 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
509 | + } |
|
484 | 510 | // How about session support? Some crazy sysadmin remove it? |
485 | - elseif (!function_exists('session_start')) |
|
486 | - $error = 'error_session_missing'; |
|
511 | + elseif (!function_exists('session_start')) { |
|
512 | + $error = 'error_session_missing'; |
|
513 | + } |
|
487 | 514 | // Make sure they uploaded all the files. |
488 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
489 | - $error = 'error_missing_files'; |
|
515 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
516 | + $error = 'error_missing_files'; |
|
517 | + } |
|
490 | 518 | // Very simple check on the session.save_path for Windows. |
491 | 519 | // @todo Move this down later if they don't use database-driven sessions? |
492 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
493 | - $error = 'error_session_save_path'; |
|
520 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
521 | + $error = 'error_session_save_path'; |
|
522 | + } |
|
494 | 523 | |
495 | 524 | // Since each of the three messages would look the same, anyway... |
496 | - if (isset($error)) |
|
497 | - $incontext['error'] = $txt[$error]; |
|
525 | + if (isset($error)) { |
|
526 | + $incontext['error'] = $txt[$error]; |
|
527 | + } |
|
498 | 528 | |
499 | 529 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
500 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
501 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
530 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
531 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
532 | + } |
|
502 | 533 | |
503 | 534 | return false; |
504 | 535 | } |
@@ -521,15 +552,18 @@ discard block |
||
521 | 552 | 'agreement.txt', |
522 | 553 | 'Settings.php' |
523 | 554 | ); |
524 | - if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) |
|
525 | - $writable_files[] = 'Settings_bak.php'; |
|
555 | + if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) { |
|
556 | + $writable_files[] = 'Settings_bak.php'; |
|
557 | + } |
|
526 | 558 | |
527 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
528 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
559 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
560 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
561 | + } |
|
529 | 562 | |
530 | 563 | // With mod_security installed, we could attempt to fix it with .htaccess. |
531 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
532 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
564 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
565 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
566 | + } |
|
533 | 567 | |
534 | 568 | $failed_files = array(); |
535 | 569 | |
@@ -545,12 +579,14 @@ discard block |
||
545 | 579 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
546 | 580 | |
547 | 581 | // Well, 755 hopefully worked... if not, try 777. |
548 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
549 | - $failed_files[] = $file; |
|
582 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
583 | + $failed_files[] = $file; |
|
584 | + } |
|
550 | 585 | } |
551 | 586 | } |
552 | - foreach ($extra_files as $file) |
|
553 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
587 | + foreach ($extra_files as $file) { |
|
588 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
589 | + } |
|
554 | 590 | } |
555 | 591 | // Windows is trickier. Let's try opening for r+... |
556 | 592 | else |
@@ -560,30 +596,35 @@ discard block |
||
560 | 596 | foreach ($writable_files as $file) |
561 | 597 | { |
562 | 598 | // Folders can't be opened for write... but the index.php in them can ;) |
563 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
564 | - $file .= '/index.php'; |
|
599 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
600 | + $file .= '/index.php'; |
|
601 | + } |
|
565 | 602 | |
566 | 603 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
567 | 604 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
568 | 605 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
569 | 606 | |
570 | 607 | // Hmm, okay, try just for write in that case... |
571 | - if (!is_resource($fp)) |
|
572 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
608 | + if (!is_resource($fp)) { |
|
609 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
610 | + } |
|
573 | 611 | |
574 | - if (!is_resource($fp)) |
|
575 | - $failed_files[] = $file; |
|
612 | + if (!is_resource($fp)) { |
|
613 | + $failed_files[] = $file; |
|
614 | + } |
|
576 | 615 | |
577 | 616 | @fclose($fp); |
578 | 617 | } |
579 | - foreach ($extra_files as $file) |
|
580 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
618 | + foreach ($extra_files as $file) { |
|
619 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
620 | + } |
|
581 | 621 | } |
582 | 622 | |
583 | 623 | $failure = count($failed_files) >= 1; |
584 | 624 | |
585 | - if (!isset($_SERVER)) |
|
586 | - return !$failure; |
|
625 | + if (!isset($_SERVER)) { |
|
626 | + return !$failure; |
|
627 | + } |
|
587 | 628 | |
588 | 629 | // Put the list into context. |
589 | 630 | $incontext['failed_files'] = $failed_files; |
@@ -631,19 +672,23 @@ discard block |
||
631 | 672 | |
632 | 673 | if (!isset($ftp) || $ftp->error !== false) |
633 | 674 | { |
634 | - if (!isset($ftp)) |
|
635 | - $ftp = new ftp_connection(null); |
|
675 | + if (!isset($ftp)) { |
|
676 | + $ftp = new ftp_connection(null); |
|
677 | + } |
|
636 | 678 | // Save the error so we can mess with listing... |
637 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
638 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
679 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
680 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
681 | + } |
|
639 | 682 | |
640 | 683 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
641 | 684 | |
642 | - if (empty($_POST['ftp_path']) && $found_path) |
|
643 | - $_POST['ftp_path'] = $detect_path; |
|
685 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
686 | + $_POST['ftp_path'] = $detect_path; |
|
687 | + } |
|
644 | 688 | |
645 | - if (!isset($_POST['ftp_username'])) |
|
646 | - $_POST['ftp_username'] = $username; |
|
689 | + if (!isset($_POST['ftp_username'])) { |
|
690 | + $_POST['ftp_username'] = $username; |
|
691 | + } |
|
647 | 692 | |
648 | 693 | // Set the username etc, into context. |
649 | 694 | $incontext['ftp'] = array( |
@@ -655,8 +700,7 @@ discard block |
||
655 | 700 | ); |
656 | 701 | |
657 | 702 | return false; |
658 | - } |
|
659 | - else |
|
703 | + } else |
|
660 | 704 | { |
661 | 705 | $_SESSION['installer_temp_ftp'] = array( |
662 | 706 | 'server' => $_POST['ftp_server'], |
@@ -670,10 +714,12 @@ discard block |
||
670 | 714 | |
671 | 715 | foreach ($failed_files as $file) |
672 | 716 | { |
673 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
674 | - $ftp->chmod($file, 0755); |
|
675 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
676 | - $ftp->chmod($file, 0777); |
|
717 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
718 | + $ftp->chmod($file, 0755); |
|
719 | + } |
|
720 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
721 | + $ftp->chmod($file, 0777); |
|
722 | + } |
|
677 | 723 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
678 | 724 | { |
679 | 725 | $failed_files_updated[] = $file; |
@@ -728,15 +774,17 @@ discard block |
||
728 | 774 | |
729 | 775 | if (!$foundOne) |
730 | 776 | { |
731 | - if (isset($db['default_host'])) |
|
732 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
777 | + if (isset($db['default_host'])) { |
|
778 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
779 | + } |
|
733 | 780 | if (isset($db['default_user'])) |
734 | 781 | { |
735 | 782 | $incontext['db']['user'] = ini_get($db['default_user']); |
736 | 783 | $incontext['db']['name'] = ini_get($db['default_user']); |
737 | 784 | } |
738 | - if (isset($db['default_password'])) |
|
739 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
785 | + if (isset($db['default_password'])) { |
|
786 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
787 | + } |
|
740 | 788 | |
741 | 789 | // For simplicity and less confusion, leave the port blank by default |
742 | 790 | $incontext['db']['port'] = ''; |
@@ -755,10 +803,10 @@ discard block |
||
755 | 803 | $incontext['db']['server'] = $_POST['db_server']; |
756 | 804 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
757 | 805 | |
758 | - if (!empty($_POST['db_port'])) |
|
759 | - $incontext['db']['port'] = $_POST['db_port']; |
|
760 | - } |
|
761 | - else |
|
806 | + if (!empty($_POST['db_port'])) { |
|
807 | + $incontext['db']['port'] = $_POST['db_port']; |
|
808 | + } |
|
809 | + } else |
|
762 | 810 | { |
763 | 811 | $incontext['db']['prefix'] = 'smf_'; |
764 | 812 | } |
@@ -794,10 +842,11 @@ discard block |
||
794 | 842 | if (!empty($_POST['db_port'])) |
795 | 843 | { |
796 | 844 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
797 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
798 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
799 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
800 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
845 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
846 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
847 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
848 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
849 | + } |
|
801 | 850 | } |
802 | 851 | |
803 | 852 | // God I hope it saved! |
@@ -810,8 +859,9 @@ discard block |
||
810 | 859 | // Make sure it works. |
811 | 860 | require(dirname(__FILE__) . '/Settings.php'); |
812 | 861 | |
813 | - if (empty($sourcedir)) |
|
814 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
862 | + if (empty($sourcedir)) { |
|
863 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
864 | + } |
|
815 | 865 | |
816 | 866 | // Better find the database file! |
817 | 867 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -821,18 +871,21 @@ discard block |
||
821 | 871 | } |
822 | 872 | |
823 | 873 | // Now include it for database functions! |
824 | - if (!defined('SMF')) |
|
825 | - define('SMF', 1); |
|
874 | + if (!defined('SMF')) { |
|
875 | + define('SMF', 1); |
|
876 | + } |
|
826 | 877 | |
827 | 878 | $modSettings['disableQueryCheck'] = true; |
828 | - if (empty($smcFunc)) |
|
829 | - $smcFunc = array(); |
|
879 | + if (empty($smcFunc)) { |
|
880 | + $smcFunc = array(); |
|
881 | + } |
|
830 | 882 | |
831 | 883 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
832 | 884 | |
833 | 885 | // What - running PHP4? The shame! |
834 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
835 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
886 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
887 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
888 | + } |
|
836 | 889 | |
837 | 890 | // Attempt a connection. |
838 | 891 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
@@ -920,12 +973,14 @@ discard block |
||
920 | 973 | $incontext['page_title'] = $txt['install_settings']; |
921 | 974 | |
922 | 975 | // Let's see if we got the database type correct. |
923 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
924 | - $db_type = $_POST['db_type']; |
|
976 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
977 | + $db_type = $_POST['db_type']; |
|
978 | + } |
|
925 | 979 | |
926 | 980 | // Else we'd better be able to get the connection. |
927 | - else |
|
928 | - load_database(); |
|
981 | + else { |
|
982 | + load_database(); |
|
983 | + } |
|
929 | 984 | |
930 | 985 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
931 | 986 | |
@@ -945,12 +1000,14 @@ discard block |
||
945 | 1000 | // Submitting? |
946 | 1001 | if (isset($_POST['boardurl'])) |
947 | 1002 | { |
948 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
949 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
950 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
951 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
952 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
953 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
1003 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
1004 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
1005 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
1006 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
1007 | + } |
|
1008 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
1009 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
1010 | + } |
|
954 | 1011 | |
955 | 1012 | // Save these variables. |
956 | 1013 | $vars = array( |
@@ -981,10 +1038,10 @@ discard block |
||
981 | 1038 | { |
982 | 1039 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
983 | 1040 | return false; |
984 | - } |
|
985 | - else |
|
986 | - // Set the character set here. |
|
1041 | + } else { |
|
1042 | + // Set the character set here. |
|
987 | 1043 | updateSettingsFile(array('db_character_set' => 'utf8')); |
1044 | + } |
|
988 | 1045 | } |
989 | 1046 | |
990 | 1047 | // Good, skip on. |
@@ -1004,8 +1061,9 @@ discard block |
||
1004 | 1061 | $incontext['continue'] = 1; |
1005 | 1062 | |
1006 | 1063 | // Already done? |
1007 | - if (isset($_POST['pop_done'])) |
|
1008 | - return true; |
|
1064 | + if (isset($_POST['pop_done'])) { |
|
1065 | + return true; |
|
1066 | + } |
|
1009 | 1067 | |
1010 | 1068 | // Reload settings. |
1011 | 1069 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1023,8 +1081,9 @@ discard block |
||
1023 | 1081 | $modSettings = array(); |
1024 | 1082 | if ($result !== false) |
1025 | 1083 | { |
1026 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1027 | - $modSettings[$row['variable']] = $row['value']; |
|
1084 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1085 | + $modSettings[$row['variable']] = $row['value']; |
|
1086 | + } |
|
1028 | 1087 | $smcFunc['db_free_result']($result); |
1029 | 1088 | |
1030 | 1089 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1037,20 +1096,22 @@ discard block |
||
1037 | 1096 | $modSettings['disableQueryCheck'] = true; |
1038 | 1097 | |
1039 | 1098 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
1040 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
1041 | - $smcFunc['db_query']('', ' |
|
1099 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
1100 | + $smcFunc['db_query']('', ' |
|
1042 | 1101 | SET NAMES {string:utf8}', |
1043 | 1102 | array( |
1044 | 1103 | 'db_error_skip' => true, |
1045 | 1104 | 'utf8' => 'utf8', |
1046 | 1105 | ) |
1047 | 1106 | ); |
1107 | + } |
|
1048 | 1108 | |
1049 | 1109 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
1050 | - if (substr(__DIR__, -1) == '\\') |
|
1051 | - $attachdir = __DIR__ . 'attachments'; |
|
1052 | - else |
|
1053 | - $attachdir = __DIR__ . '/attachments'; |
|
1110 | + if (substr(__DIR__, -1) == '\\') { |
|
1111 | + $attachdir = __DIR__ . 'attachments'; |
|
1112 | + } else { |
|
1113 | + $attachdir = __DIR__ . '/attachments'; |
|
1114 | + } |
|
1054 | 1115 | |
1055 | 1116 | $replaces = array( |
1056 | 1117 | '{$db_prefix}' => $db_prefix, |
@@ -1067,8 +1128,9 @@ discard block |
||
1067 | 1128 | |
1068 | 1129 | foreach ($txt as $key => $value) |
1069 | 1130 | { |
1070 | - if (substr($key, 0, 8) == 'default_') |
|
1071 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1131 | + if (substr($key, 0, 8) == 'default_') { |
|
1132 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1133 | + } |
|
1072 | 1134 | } |
1073 | 1135 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
1074 | 1136 | |
@@ -1083,8 +1145,9 @@ discard block |
||
1083 | 1145 | |
1084 | 1146 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
1085 | 1147 | { |
1086 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
1087 | - $engines[] = $row['Engine']; |
|
1148 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
1149 | + $engines[] = $row['Engine']; |
|
1150 | + } |
|
1088 | 1151 | } |
1089 | 1152 | |
1090 | 1153 | // Done with this now |
@@ -1108,8 +1171,7 @@ discard block |
||
1108 | 1171 | $replaces['START TRANSACTION;'] = ''; |
1109 | 1172 | $replaces['COMMIT;'] = ''; |
1110 | 1173 | } |
1111 | - } |
|
1112 | - else |
|
1174 | + } else |
|
1113 | 1175 | { |
1114 | 1176 | $has_innodb = false; |
1115 | 1177 | } |
@@ -1131,21 +1193,24 @@ discard block |
||
1131 | 1193 | foreach ($sql_lines as $count => $line) |
1132 | 1194 | { |
1133 | 1195 | // No comments allowed! |
1134 | - if (substr(trim($line), 0, 1) != '#') |
|
1135 | - $current_statement .= "\n" . rtrim($line); |
|
1196 | + if (substr(trim($line), 0, 1) != '#') { |
|
1197 | + $current_statement .= "\n" . rtrim($line); |
|
1198 | + } |
|
1136 | 1199 | |
1137 | 1200 | // Is this the end of the query string? |
1138 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
1139 | - continue; |
|
1201 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
1202 | + continue; |
|
1203 | + } |
|
1140 | 1204 | |
1141 | 1205 | // Does this table already exist? If so, don't insert more data into it! |
1142 | 1206 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
1143 | 1207 | { |
1144 | 1208 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1145 | - if (!empty($matches[0])) |
|
1146 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1147 | - else |
|
1148 | - $incontext['sql_results']['insert_dups']++; |
|
1209 | + if (!empty($matches[0])) { |
|
1210 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1211 | + } else { |
|
1212 | + $incontext['sql_results']['insert_dups']++; |
|
1213 | + } |
|
1149 | 1214 | |
1150 | 1215 | $current_statement = ''; |
1151 | 1216 | continue; |
@@ -1154,8 +1219,9 @@ discard block |
||
1154 | 1219 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
1155 | 1220 | { |
1156 | 1221 | // Use the appropriate function based on the DB type |
1157 | - if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
1158 | - $db_errorno = $db_type . '_errno'; |
|
1222 | + if ($db_type == 'mysql' || $db_type == 'mysqli') { |
|
1223 | + $db_errorno = $db_type . '_errno'; |
|
1224 | + } |
|
1159 | 1225 | |
1160 | 1226 | // Error 1050: Table already exists! |
1161 | 1227 | // @todo Needs to be made better! |
@@ -1170,18 +1236,18 @@ discard block |
||
1170 | 1236 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
1171 | 1237 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
1172 | 1238 | } |
1173 | - } |
|
1174 | - else |
|
1239 | + } else |
|
1175 | 1240 | { |
1176 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1177 | - $incontext['sql_results']['tables']++; |
|
1178 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1241 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
1242 | + $incontext['sql_results']['tables']++; |
|
1243 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1179 | 1244 | { |
1180 | 1245 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1181 | - if (!empty($matches[0])) |
|
1182 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1183 | - else |
|
1184 | - $incontext['sql_results']['inserts']++; |
|
1246 | + if (!empty($matches[0])) { |
|
1247 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1248 | + } else { |
|
1249 | + $incontext['sql_results']['inserts']++; |
|
1250 | + } |
|
1185 | 1251 | } |
1186 | 1252 | } |
1187 | 1253 | |
@@ -1194,15 +1260,17 @@ discard block |
||
1194 | 1260 | // Sort out the context for the SQL. |
1195 | 1261 | foreach ($incontext['sql_results'] as $key => $number) |
1196 | 1262 | { |
1197 | - if ($number == 0) |
|
1198 | - unset($incontext['sql_results'][$key]); |
|
1199 | - else |
|
1200 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1263 | + if ($number == 0) { |
|
1264 | + unset($incontext['sql_results'][$key]); |
|
1265 | + } else { |
|
1266 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1267 | + } |
|
1201 | 1268 | } |
1202 | 1269 | |
1203 | 1270 | // Make sure UTF will be used globally. |
1204 | - if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) |
|
1205 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1271 | + if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) { |
|
1272 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1273 | + } |
|
1206 | 1274 | |
1207 | 1275 | // Maybe we can auto-detect better cookie settings? |
1208 | 1276 | preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches); |
@@ -1213,16 +1281,20 @@ discard block |
||
1213 | 1281 | $globalCookies = false; |
1214 | 1282 | |
1215 | 1283 | // Okay... let's see. Using a subdomain other than www.? (not a perfect check.) |
1216 | - if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) |
|
1217 | - $globalCookies = true; |
|
1284 | + if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) { |
|
1285 | + $globalCookies = true; |
|
1286 | + } |
|
1218 | 1287 | // If there's a / in the middle of the path, or it starts with ~... we want local. |
1219 | - if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) |
|
1220 | - $localCookies = true; |
|
1288 | + if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) { |
|
1289 | + $localCookies = true; |
|
1290 | + } |
|
1221 | 1291 | |
1222 | - if ($globalCookies) |
|
1223 | - $newSettings[] = array('globalCookies', '1'); |
|
1224 | - if ($localCookies) |
|
1225 | - $newSettings[] = array('localCookies', '1'); |
|
1292 | + if ($globalCookies) { |
|
1293 | + $newSettings[] = array('globalCookies', '1'); |
|
1294 | + } |
|
1295 | + if ($localCookies) { |
|
1296 | + $newSettings[] = array('localCookies', '1'); |
|
1297 | + } |
|
1226 | 1298 | } |
1227 | 1299 | |
1228 | 1300 | // Are we allowing stat collection? |
@@ -1238,32 +1310,36 @@ discard block |
||
1238 | 1310 | fwrite($fp, $out); |
1239 | 1311 | |
1240 | 1312 | $return_data = ''; |
1241 | - while (!feof($fp)) |
|
1242 | - $return_data .= fgets($fp, 128); |
|
1313 | + while (!feof($fp)) { |
|
1314 | + $return_data .= fgets($fp, 128); |
|
1315 | + } |
|
1243 | 1316 | |
1244 | 1317 | fclose($fp); |
1245 | 1318 | |
1246 | 1319 | // Get the unique site ID. |
1247 | 1320 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
1248 | 1321 | |
1249 | - if (!empty($ID[1])) |
|
1250 | - $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
1322 | + if (!empty($ID[1])) { |
|
1323 | + $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
1324 | + } |
|
1251 | 1325 | } |
1252 | 1326 | } |
1253 | 1327 | |
1254 | 1328 | // Are we enabling SSL? |
1255 | - if (!empty($_POST['force_ssl'])) |
|
1256 | - $newSettings[] = array('force_ssl', 2); |
|
1329 | + if (!empty($_POST['force_ssl'])) { |
|
1330 | + $newSettings[] = array('force_ssl', 2); |
|
1331 | + } |
|
1257 | 1332 | |
1258 | 1333 | // Setting a timezone is required. |
1259 | 1334 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
1260 | 1335 | { |
1261 | 1336 | // Get PHP's default timezone, if set |
1262 | 1337 | $ini_tz = ini_get('date.timezone'); |
1263 | - if (!empty($ini_tz)) |
|
1264 | - $timezone_id = $ini_tz; |
|
1265 | - else |
|
1266 | - $timezone_id = ''; |
|
1338 | + if (!empty($ini_tz)) { |
|
1339 | + $timezone_id = $ini_tz; |
|
1340 | + } else { |
|
1341 | + $timezone_id = ''; |
|
1342 | + } |
|
1267 | 1343 | |
1268 | 1344 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
1269 | 1345 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1272,8 +1348,9 @@ discard block |
||
1272 | 1348 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
1273 | 1349 | } |
1274 | 1350 | |
1275 | - if (date_default_timezone_set($timezone_id)) |
|
1276 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
1351 | + if (date_default_timezone_set($timezone_id)) { |
|
1352 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
1353 | + } |
|
1277 | 1354 | } |
1278 | 1355 | |
1279 | 1356 | if (!empty($newSettings)) |
@@ -1304,16 +1381,18 @@ discard block |
||
1304 | 1381 | } |
1305 | 1382 | |
1306 | 1383 | // MySQL specific stuff |
1307 | - if (substr($db_type, 0, 5) != 'mysql') |
|
1308 | - return false; |
|
1384 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
1385 | + return false; |
|
1386 | + } |
|
1309 | 1387 | |
1310 | 1388 | // Find database user privileges. |
1311 | 1389 | $privs = array(); |
1312 | 1390 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
1313 | 1391 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
1314 | 1392 | { |
1315 | - if ($row['Privilege'] == 'Alter') |
|
1316 | - $privs[] = $row['Privilege']; |
|
1393 | + if ($row['Privilege'] == 'Alter') { |
|
1394 | + $privs[] = $row['Privilege']; |
|
1395 | + } |
|
1317 | 1396 | } |
1318 | 1397 | $smcFunc['db_free_result']($get_privs); |
1319 | 1398 | |
@@ -1343,8 +1422,9 @@ discard block |
||
1343 | 1422 | $incontext['continue'] = 1; |
1344 | 1423 | |
1345 | 1424 | // Skipping? |
1346 | - if (!empty($_POST['skip'])) |
|
1347 | - return true; |
|
1425 | + if (!empty($_POST['skip'])) { |
|
1426 | + return true; |
|
1427 | + } |
|
1348 | 1428 | |
1349 | 1429 | // Need this to check whether we need the database password. |
1350 | 1430 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1357,18 +1437,22 @@ discard block |
||
1357 | 1437 | // We need this to properly hash the password for Admin |
1358 | 1438 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
1359 | 1439 | global $sourcedir; |
1360 | - if (function_exists('mb_strtolower')) |
|
1361 | - return mb_strtolower($string, 'UTF-8'); |
|
1440 | + if (function_exists('mb_strtolower')) { |
|
1441 | + return mb_strtolower($string, 'UTF-8'); |
|
1442 | + } |
|
1362 | 1443 | require_once($sourcedir . '/Subs-Charset.php'); |
1363 | 1444 | return utf8_strtolower($string); |
1364 | 1445 | }; |
1365 | 1446 | |
1366 | - if (!isset($_POST['username'])) |
|
1367 | - $_POST['username'] = ''; |
|
1368 | - if (!isset($_POST['email'])) |
|
1369 | - $_POST['email'] = ''; |
|
1370 | - if (!isset($_POST['server_email'])) |
|
1371 | - $_POST['server_email'] = ''; |
|
1447 | + if (!isset($_POST['username'])) { |
|
1448 | + $_POST['username'] = ''; |
|
1449 | + } |
|
1450 | + if (!isset($_POST['email'])) { |
|
1451 | + $_POST['email'] = ''; |
|
1452 | + } |
|
1453 | + if (!isset($_POST['server_email'])) { |
|
1454 | + $_POST['server_email'] = ''; |
|
1455 | + } |
|
1372 | 1456 | |
1373 | 1457 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
1374 | 1458 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1387,8 +1471,9 @@ discard block |
||
1387 | 1471 | 'admin_group' => 1, |
1388 | 1472 | ) |
1389 | 1473 | ); |
1390 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1391 | - $incontext['skip'] = 1; |
|
1474 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1475 | + $incontext['skip'] = 1; |
|
1476 | + } |
|
1392 | 1477 | $smcFunc['db_free_result']($request); |
1393 | 1478 | |
1394 | 1479 | // Trying to create an account? |
@@ -1419,8 +1504,9 @@ discard block |
||
1419 | 1504 | } |
1420 | 1505 | |
1421 | 1506 | // Update the webmaster's email? |
1422 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
1423 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1507 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
1508 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1509 | + } |
|
1424 | 1510 | |
1425 | 1511 | // Work out whether we're going to have dodgy characters and remove them. |
1426 | 1512 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1443,32 +1529,27 @@ discard block |
||
1443 | 1529 | $smcFunc['db_free_result']($result); |
1444 | 1530 | |
1445 | 1531 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
1446 | - } |
|
1447 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1532 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1448 | 1533 | { |
1449 | 1534 | // Try the previous step again. |
1450 | 1535 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
1451 | 1536 | return false; |
1452 | - } |
|
1453 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1537 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1454 | 1538 | { |
1455 | 1539 | // Try the previous step again. |
1456 | 1540 | $incontext['error'] = $txt['error_invalid_characters_username']; |
1457 | 1541 | return false; |
1458 | - } |
|
1459 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1542 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1460 | 1543 | { |
1461 | 1544 | // One step back, this time fill out a proper admin email address. |
1462 | 1545 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
1463 | 1546 | return false; |
1464 | - } |
|
1465 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1547 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1466 | 1548 | { |
1467 | 1549 | // One step back, this time fill out a proper admin email address. |
1468 | 1550 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
1469 | 1551 | return false; |
1470 | - } |
|
1471 | - elseif ($_POST['username'] != '') |
|
1552 | + } elseif ($_POST['username'] != '') |
|
1472 | 1553 | { |
1473 | 1554 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
1474 | 1555 | |
@@ -1543,17 +1624,19 @@ discard block |
||
1543 | 1624 | require_once($sourcedir . '/Subs-Auth.php'); |
1544 | 1625 | |
1545 | 1626 | // Bring a warning over. |
1546 | - if (!empty($incontext['account_existed'])) |
|
1547 | - $incontext['warning'] = $incontext['account_existed']; |
|
1627 | + if (!empty($incontext['account_existed'])) { |
|
1628 | + $incontext['warning'] = $incontext['account_existed']; |
|
1629 | + } |
|
1548 | 1630 | |
1549 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
1550 | - $smcFunc['db_query']('', ' |
|
1631 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
1632 | + $smcFunc['db_query']('', ' |
|
1551 | 1633 | SET NAMES {string:db_character_set}', |
1552 | 1634 | array( |
1553 | 1635 | 'db_character_set' => $db_character_set, |
1554 | 1636 | 'db_error_skip' => true, |
1555 | 1637 | ) |
1556 | 1638 | ); |
1639 | + } |
|
1557 | 1640 | |
1558 | 1641 | // As track stats is by default enabled let's add some activity. |
1559 | 1642 | $smcFunc['db_insert']('ignore', |
@@ -1574,14 +1657,16 @@ discard block |
||
1574 | 1657 | // Only proceed if we can load the data. |
1575 | 1658 | if ($request) |
1576 | 1659 | { |
1577 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
1578 | - $modSettings[$row[0]] = $row[1]; |
|
1660 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
1661 | + $modSettings[$row[0]] = $row[1]; |
|
1662 | + } |
|
1579 | 1663 | $smcFunc['db_free_result']($request); |
1580 | 1664 | } |
1581 | 1665 | |
1582 | 1666 | // Automatically log them in ;) |
1583 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
1584 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1667 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
1668 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1669 | + } |
|
1585 | 1670 | |
1586 | 1671 | $result = $smcFunc['db_query']('', ' |
1587 | 1672 | SELECT value |
@@ -1592,13 +1677,14 @@ discard block |
||
1592 | 1677 | 'db_error_skip' => true, |
1593 | 1678 | ) |
1594 | 1679 | ); |
1595 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1596 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1680 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1681 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1682 | + } |
|
1597 | 1683 | $smcFunc['db_free_result']($result); |
1598 | 1684 | |
1599 | - if (empty($db_sessions)) |
|
1600 | - $_SESSION['admin_time'] = time(); |
|
1601 | - else |
|
1685 | + if (empty($db_sessions)) { |
|
1686 | + $_SESSION['admin_time'] = time(); |
|
1687 | + } else |
|
1602 | 1688 | { |
1603 | 1689 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
1604 | 1690 | |
@@ -1622,8 +1708,9 @@ discard block |
||
1622 | 1708 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
1623 | 1709 | function($string){ |
1624 | 1710 | global $sourcedir; |
1625 | - if (function_exists('mb_strtolower')) |
|
1626 | - return mb_strtolower($string, 'UTF-8'); |
|
1711 | + if (function_exists('mb_strtolower')) { |
|
1712 | + return mb_strtolower($string, 'UTF-8'); |
|
1713 | + } |
|
1627 | 1714 | require_once($sourcedir . '/Subs-Charset.php'); |
1628 | 1715 | return utf8_strtolower($string); |
1629 | 1716 | }; |
@@ -1639,8 +1726,9 @@ discard block |
||
1639 | 1726 | ) |
1640 | 1727 | ); |
1641 | 1728 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
1642 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
1643 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1729 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
1730 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1731 | + } |
|
1644 | 1732 | $smcFunc['db_free_result']($request); |
1645 | 1733 | |
1646 | 1734 | // Now is the perfect time to fetch the SM files. |
@@ -1659,8 +1747,9 @@ discard block |
||
1659 | 1747 | |
1660 | 1748 | // Check if we need some stupid MySQL fix. |
1661 | 1749 | $server_version = $smcFunc['db_server_info'](); |
1662 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
1663 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1750 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
1751 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1752 | + } |
|
1664 | 1753 | |
1665 | 1754 | // Some final context for the template. |
1666 | 1755 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1680,8 +1769,9 @@ discard block |
||
1680 | 1769 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
1681 | 1770 | |
1682 | 1771 | // @todo Do we just want to read the file in clean, and split it this way always? |
1683 | - if (count($settingsArray) == 1) |
|
1684 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1772 | + if (count($settingsArray) == 1) { |
|
1773 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1774 | + } |
|
1685 | 1775 | |
1686 | 1776 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
1687 | 1777 | { |
@@ -1696,19 +1786,22 @@ discard block |
||
1696 | 1786 | continue; |
1697 | 1787 | } |
1698 | 1788 | |
1699 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
1700 | - $settingsArray[$i] = ''; |
|
1789 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
1790 | + $settingsArray[$i] = ''; |
|
1791 | + } |
|
1701 | 1792 | |
1702 | 1793 | // Don't trim or bother with it if it's not a variable. |
1703 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
1704 | - continue; |
|
1794 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
1795 | + continue; |
|
1796 | + } |
|
1705 | 1797 | |
1706 | 1798 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
1707 | 1799 | |
1708 | - foreach ($vars as $var => $val) |
|
1709 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1800 | + foreach ($vars as $var => $val) { |
|
1801 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1710 | 1802 | { |
1711 | 1803 | $comment = strstr($settingsArray[$i], '#'); |
1804 | + } |
|
1712 | 1805 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
1713 | 1806 | unset($vars[$var]); |
1714 | 1807 | } |
@@ -1718,36 +1811,41 @@ discard block |
||
1718 | 1811 | if (!empty($vars)) |
1719 | 1812 | { |
1720 | 1813 | $settingsArray[$i++] = ''; |
1721 | - foreach ($vars as $var => $val) |
|
1722 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1814 | + foreach ($vars as $var => $val) { |
|
1815 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1816 | + } |
|
1723 | 1817 | } |
1724 | 1818 | |
1725 | 1819 | // Blank out the file - done to fix a oddity with some servers. |
1726 | 1820 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
1727 | - if (!$fp) |
|
1728 | - return false; |
|
1821 | + if (!$fp) { |
|
1822 | + return false; |
|
1823 | + } |
|
1729 | 1824 | fclose($fp); |
1730 | 1825 | |
1731 | 1826 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
1732 | 1827 | |
1733 | 1828 | // Gotta have one of these ;) |
1734 | - if (trim($settingsArray[0]) != '<?php') |
|
1735 | - fwrite($fp, "<?php\n"); |
|
1829 | + if (trim($settingsArray[0]) != '<?php') { |
|
1830 | + fwrite($fp, "<?php\n"); |
|
1831 | + } |
|
1736 | 1832 | |
1737 | 1833 | $lines = count($settingsArray); |
1738 | 1834 | for ($i = 0; $i < $lines - 1; $i++) |
1739 | 1835 | { |
1740 | 1836 | // Don't just write a bunch of blank lines. |
1741 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
1742 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1837 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
1838 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1839 | + } |
|
1743 | 1840 | } |
1744 | 1841 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
1745 | 1842 | fclose($fp); |
1746 | 1843 | |
1747 | 1844 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
1748 | 1845 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
1749 | - if (function_exists('opcache_invalidate')) |
|
1750 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1846 | + if (function_exists('opcache_invalidate')) { |
|
1847 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1848 | + } |
|
1751 | 1849 | |
1752 | 1850 | return true; |
1753 | 1851 | } |
@@ -1772,9 +1870,9 @@ discard block |
||
1772 | 1870 | SecFilterScanPOST Off |
1773 | 1871 | </IfModule>'; |
1774 | 1872 | |
1775 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
1776 | - return true; |
|
1777 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1873 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
1874 | + return true; |
|
1875 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1778 | 1876 | { |
1779 | 1877 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
1780 | 1878 | |
@@ -1786,29 +1884,28 @@ discard block |
||
1786 | 1884 | fwrite($ht_handle, $htaccess_addition); |
1787 | 1885 | fclose($ht_handle); |
1788 | 1886 | return true; |
1887 | + } else { |
|
1888 | + return false; |
|
1789 | 1889 | } |
1790 | - else |
|
1791 | - return false; |
|
1890 | + } else { |
|
1891 | + return true; |
|
1792 | 1892 | } |
1793 | - else |
|
1794 | - return true; |
|
1795 | - } |
|
1796 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
1797 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1798 | - elseif (is_writable(dirname(__FILE__))) |
|
1893 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
1894 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1895 | + } elseif (is_writable(dirname(__FILE__))) |
|
1799 | 1896 | { |
1800 | 1897 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
1801 | 1898 | { |
1802 | 1899 | fwrite($ht_handle, $htaccess_addition); |
1803 | 1900 | fclose($ht_handle); |
1804 | 1901 | return true; |
1902 | + } else { |
|
1903 | + return false; |
|
1805 | 1904 | } |
1806 | - else |
|
1905 | + } else { |
|
1807 | 1906 | return false; |
1808 | 1907 | } |
1809 | - else |
|
1810 | - return false; |
|
1811 | -} |
|
1908 | + } |
|
1812 | 1909 | |
1813 | 1910 | function template_install_above() |
1814 | 1911 | { |
@@ -1846,9 +1943,10 @@ discard block |
||
1846 | 1943 | <label for="installer_language">', $txt['installer_language'], ':</label> |
1847 | 1944 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
1848 | 1945 | |
1849 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
1850 | - echo ' |
|
1946 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
1947 | + echo ' |
|
1851 | 1948 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
1949 | + } |
|
1852 | 1950 | |
1853 | 1951 | echo ' |
1854 | 1952 | </select> |
@@ -1868,9 +1966,10 @@ discard block |
||
1868 | 1966 | <h2>', $txt['upgrade_progress'], '</h2> |
1869 | 1967 | <ul>'; |
1870 | 1968 | |
1871 | - foreach ($incontext['steps'] as $num => $step) |
|
1872 | - echo ' |
|
1969 | + foreach ($incontext['steps'] as $num => $step) { |
|
1970 | + echo ' |
|
1873 | 1971 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
1972 | + } |
|
1874 | 1973 | |
1875 | 1974 | echo ' |
1876 | 1975 | </ul> |
@@ -1895,20 +1994,23 @@ discard block |
||
1895 | 1994 | echo ' |
1896 | 1995 | <div>'; |
1897 | 1996 | |
1898 | - if (!empty($incontext['continue'])) |
|
1899 | - echo ' |
|
1997 | + if (!empty($incontext['continue'])) { |
|
1998 | + echo ' |
|
1900 | 1999 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
1901 | - if (!empty($incontext['skip'])) |
|
1902 | - echo ' |
|
2000 | + } |
|
2001 | + if (!empty($incontext['skip'])) { |
|
2002 | + echo ' |
|
1903 | 2003 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
2004 | + } |
|
1904 | 2005 | echo ' |
1905 | 2006 | </div>'; |
1906 | 2007 | } |
1907 | 2008 | |
1908 | 2009 | // Show the closing form tag and other data only if not in the last step |
1909 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
1910 | - echo ' |
|
2010 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
2011 | + echo ' |
|
1911 | 2012 | </form>'; |
2013 | + } |
|
1912 | 2014 | |
1913 | 2015 | echo ' |
1914 | 2016 | </div> |
@@ -1943,13 +2045,15 @@ discard block |
||
1943 | 2045 | </div>'; |
1944 | 2046 | |
1945 | 2047 | // Show the warnings, or not. |
1946 | - if (template_warning_divs()) |
|
1947 | - echo ' |
|
2048 | + if (template_warning_divs()) { |
|
2049 | + echo ' |
|
1948 | 2050 | <h3>', $txt['install_all_lovely'], '</h3>'; |
2051 | + } |
|
1949 | 2052 | |
1950 | 2053 | // Say we want the continue button! |
1951 | - if (empty($incontext['error'])) |
|
1952 | - $incontext['continue'] = 1; |
|
2054 | + if (empty($incontext['error'])) { |
|
2055 | + $incontext['continue'] = 1; |
|
2056 | + } |
|
1953 | 2057 | |
1954 | 2058 | // For the latest version stuff. |
1955 | 2059 | echo ' |
@@ -1983,8 +2087,8 @@ discard block |
||
1983 | 2087 | global $txt, $incontext; |
1984 | 2088 | |
1985 | 2089 | // Errors are very serious.. |
1986 | - if (!empty($incontext['error'])) |
|
1987 | - echo ' |
|
2090 | + if (!empty($incontext['error'])) { |
|
2091 | + echo ' |
|
1988 | 2092 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
1989 | 2093 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
1990 | 2094 | <strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br> |
@@ -1992,9 +2096,10 @@ discard block |
||
1992 | 2096 | ', $incontext['error'], ' |
1993 | 2097 | </div> |
1994 | 2098 | </div>'; |
2099 | + } |
|
1995 | 2100 | // A warning message? |
1996 | - elseif (!empty($incontext['warning'])) |
|
1997 | - echo ' |
|
2101 | + elseif (!empty($incontext['warning'])) { |
|
2102 | + echo ' |
|
1998 | 2103 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
1999 | 2104 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
2000 | 2105 | <strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br> |
@@ -2002,6 +2107,7 @@ discard block |
||
2002 | 2107 | ', $incontext['warning'], ' |
2003 | 2108 | </div> |
2004 | 2109 | </div>'; |
2110 | + } |
|
2005 | 2111 | |
2006 | 2112 | return empty($incontext['error']) && empty($incontext['warning']); |
2007 | 2113 | } |
@@ -2017,27 +2123,30 @@ discard block |
||
2017 | 2123 | <li>', $incontext['failed_files']), '</li> |
2018 | 2124 | </ul>'; |
2019 | 2125 | |
2020 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
2021 | - echo ' |
|
2126 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
2127 | + echo ' |
|
2022 | 2128 | <hr> |
2023 | 2129 | <p>', $txt['chmod_linux_info'], '</p> |
2024 | 2130 | <tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>'; |
2131 | + } |
|
2025 | 2132 | |
2026 | 2133 | // This is serious! |
2027 | - if (!template_warning_divs()) |
|
2028 | - return; |
|
2134 | + if (!template_warning_divs()) { |
|
2135 | + return; |
|
2136 | + } |
|
2029 | 2137 | |
2030 | 2138 | echo ' |
2031 | 2139 | <hr> |
2032 | 2140 | <p>', $txt['ftp_setup_info'], '</p>'; |
2033 | 2141 | |
2034 | - if (!empty($incontext['ftp_errors'])) |
|
2035 | - echo ' |
|
2142 | + if (!empty($incontext['ftp_errors'])) { |
|
2143 | + echo ' |
|
2036 | 2144 | <div class="error_message"> |
2037 | 2145 | ', $txt['error_ftp_no_connect'], '<br><br> |
2038 | 2146 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
2039 | 2147 | </div> |
2040 | 2148 | <br>'; |
2149 | + } |
|
2041 | 2150 | |
2042 | 2151 | echo ' |
2043 | 2152 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2097,17 +2206,17 @@ discard block |
||
2097 | 2206 | <td> |
2098 | 2207 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
2099 | 2208 | |
2100 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
2101 | - echo ' |
|
2209 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
2210 | + echo ' |
|
2102 | 2211 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
2212 | + } |
|
2103 | 2213 | |
2104 | 2214 | echo ' |
2105 | 2215 | </select> |
2106 | 2216 | <div class="smalltext block">', $txt['db_settings_type_info'], '</div> |
2107 | 2217 | </td> |
2108 | 2218 | </tr>'; |
2109 | - } |
|
2110 | - else |
|
2219 | + } else |
|
2111 | 2220 | { |
2112 | 2221 | echo ' |
2113 | 2222 | <tr style="display: none;"> |
@@ -2299,9 +2408,10 @@ discard block |
||
2299 | 2408 | <div style="color: red;">', $txt['error_db_queries'], '</div> |
2300 | 2409 | <ul>'; |
2301 | 2410 | |
2302 | - foreach ($incontext['failures'] as $line => $fail) |
|
2303 | - echo ' |
|
2411 | + foreach ($incontext['failures'] as $line => $fail) { |
|
2412 | + echo ' |
|
2304 | 2413 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
2414 | + } |
|
2305 | 2415 | |
2306 | 2416 | echo ' |
2307 | 2417 | </ul>'; |
@@ -2362,15 +2472,16 @@ discard block |
||
2362 | 2472 | </tr> |
2363 | 2473 | </table>'; |
2364 | 2474 | |
2365 | - if ($incontext['require_db_confirm']) |
|
2366 | - echo ' |
|
2475 | + if ($incontext['require_db_confirm']) { |
|
2476 | + echo ' |
|
2367 | 2477 | <h2>', $txt['user_settings_database'], '</h2> |
2368 | 2478 | <p>', $txt['user_settings_database_info'], '</p> |
2369 | 2479 | |
2370 | 2480 | <div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;"> |
2371 | 2481 | <input type="password" name="password3" size="30" class="input_password" /> |
2372 | 2482 | </div>'; |
2373 | -} |
|
2483 | + } |
|
2484 | + } |
|
2374 | 2485 | |
2375 | 2486 | // Tell them it's done, and to delete. |
2376 | 2487 | function template_delete_install() |
@@ -2383,14 +2494,15 @@ discard block |
||
2383 | 2494 | template_warning_divs(); |
2384 | 2495 | |
2385 | 2496 | // Install directory still writable? |
2386 | - if ($incontext['dir_still_writable']) |
|
2387 | - echo ' |
|
2497 | + if ($incontext['dir_still_writable']) { |
|
2498 | + echo ' |
|
2388 | 2499 | <em>', $txt['still_writable'], '</em><br> |
2389 | 2500 | <br>'; |
2501 | + } |
|
2390 | 2502 | |
2391 | 2503 | // Don't show the box if it's like 99% sure it won't work :P. |
2392 | - if ($incontext['probably_delete_install']) |
|
2393 | - echo ' |
|
2504 | + if ($incontext['probably_delete_install']) { |
|
2505 | + echo ' |
|
2394 | 2506 | <div style="margin: 1ex; font-weight: bold;"> |
2395 | 2507 | <label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" class="input_check" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label> |
2396 | 2508 | </div> |
@@ -2406,6 +2518,7 @@ discard block |
||
2406 | 2518 | } |
2407 | 2519 | </script> |
2408 | 2520 | <br>'; |
2521 | + } |
|
2409 | 2522 | |
2410 | 2523 | echo ' |
2411 | 2524 | ', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br> |