@@ -30,25 +30,27 @@ discard block |
||
30 | 30 | </div> |
31 | 31 | <div class="information">'; |
32 | 32 | |
33 | - if ($context['is_installed']) |
|
34 | - echo ' |
|
33 | + if ($context['is_installed']) { |
|
34 | + echo ' |
|
35 | 35 | <strong>', $txt['package_installed_warning1'], '</strong><br> |
36 | 36 | <br> |
37 | 37 | ', $txt['package_installed_warning2'], '<br> |
38 | 38 | <br>'; |
39 | + } |
|
39 | 40 | |
40 | 41 | echo $txt['package_installed_warning3'], ' |
41 | 42 | </div> |
42 | 43 | <br>'; |
43 | 44 | |
44 | 45 | // Do errors exist in the install? If so light them up like a christmas tree. |
45 | - if ($context['has_failure']) |
|
46 | - echo ' |
|
46 | + if ($context['has_failure']) { |
|
47 | + echo ' |
|
47 | 48 | <div class="errorbox"> |
48 | 49 | ', sprintf($txt['package_will_fail_title'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), '<br> |
49 | 50 | ', sprintf($txt['package_will_fail_warning'], $txt['package_' . ($context['uninstalling'] ? 'uninstall' : 'install')]), |
50 | 51 | !empty($context['failure_details']) ? '<br><br><strong>' . $context['failure_details'] . '</strong>' : '', ' |
51 | 52 | </div>'; |
53 | + } |
|
52 | 54 | |
53 | 55 | // Display the package readme if one exists |
54 | 56 | if (isset($context['package_readme'])) |
@@ -62,9 +64,10 @@ discard block |
||
62 | 64 | <span class="floatright">', $txt['package_available_readme_language'], ' |
63 | 65 | <select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value + \';license=\' + get_selected(\'license_language\'));">'; |
64 | 66 | |
65 | - foreach ($context['readmes'] as $a => $b) |
|
66 | - echo ' |
|
67 | + foreach ($context['readmes'] as $a => $b) { |
|
68 | + echo ' |
|
67 | 69 | <option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>'; |
70 | + } |
|
68 | 71 | |
69 | 72 | echo ' |
70 | 73 | </select> |
@@ -85,9 +88,10 @@ discard block |
||
85 | 88 | <span class="floatright">', $txt['package_available_license_language'], ' |
86 | 89 | <select name="license_language" id="license_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=install', ';package=', $context['filename'], ';license=\' + this.options[this.selectedIndex].value + \';readme=\' + get_selected(\'readme_language\'));">'; |
87 | 90 | |
88 | - foreach ($context['licenses'] as $a => $b) |
|
89 | - echo ' |
|
91 | + foreach ($context['licenses'] as $a => $b) { |
|
92 | + echo ' |
|
90 | 93 | <option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>'; |
94 | + } |
|
91 | 95 | echo ' |
92 | 96 | </select> |
93 | 97 | </span> |
@@ -114,9 +118,10 @@ discard block |
||
114 | 118 | ', $txt['package_db_uninstall_actions'], ': |
115 | 119 | <ul>'; |
116 | 120 | |
117 | - foreach ($context['database_changes'] as $change) |
|
118 | - echo ' |
|
121 | + foreach ($context['database_changes'] as $change) { |
|
122 | + echo ' |
|
119 | 123 | <li>', $change, '</li>'; |
124 | + } |
|
120 | 125 | |
121 | 126 | echo ' |
122 | 127 | </ul> |
@@ -127,14 +132,14 @@ discard block |
||
127 | 132 | echo ' |
128 | 133 | <div class="information">'; |
129 | 134 | |
130 | - if (empty($context['actions']) && empty($context['database_changes'])) |
|
131 | - echo ' |
|
135 | + if (empty($context['actions']) && empty($context['database_changes'])) { |
|
136 | + echo ' |
|
132 | 137 | <br> |
133 | 138 | <div class="errorbox"> |
134 | 139 | ', $txt['corrupt_compatible'], ' |
135 | 140 | </div> |
136 | 141 | </div><!-- .information -->'; |
137 | - else |
|
142 | + } else |
|
138 | 143 | { |
139 | 144 | echo ' |
140 | 145 | ', $txt['perform_actions'], ' |
@@ -238,9 +243,10 @@ discard block |
||
238 | 243 | <td></td> |
239 | 244 | <td>'; |
240 | 245 | |
241 | - if (!empty($context['themes_locked'])) |
|
242 | - echo ' |
|
246 | + if (!empty($context['themes_locked'])) { |
|
247 | + echo ' |
|
243 | 248 | <input type="hidden" name="custom_theme[]" value="', $id, '">'; |
249 | + } |
|
244 | 250 | echo ' |
245 | 251 | <input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);"', !empty($context['themes_locked']) ? ' disabled checked' : '', '> |
246 | 252 | </td> |
@@ -306,21 +312,23 @@ discard block |
||
306 | 312 | } |
307 | 313 | |
308 | 314 | // Are we effectively ready to install? |
309 | - if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes']))) |
|
310 | - echo ' |
|
315 | + if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes']))) { |
|
316 | + echo ' |
|
311 | 317 | <div class="righttext padding"> |
312 | 318 | <input type="submit" value="', $context['uninstalling'] ? $txt['package_uninstall_now'] : $txt['package_install_now'], '" onclick="return ', !empty($context['has_failure']) ? '(submitThisOnce(this) && confirm(\'' . ($context['uninstalling'] ? $txt['package_will_fail_popup_uninstall'] : $txt['package_will_fail_popup']) . '\'))' : 'submitThisOnce(this)', ';" class="button"> |
313 | 319 | </div>'; |
320 | + } |
|
314 | 321 | |
315 | 322 | // If we need ftp information then demand it! |
316 | - elseif ($context['ftp_needed']) |
|
317 | - echo ' |
|
323 | + elseif ($context['ftp_needed']) { |
|
324 | + echo ' |
|
318 | 325 | <div class="cat_bar"> |
319 | 326 | <h3 class="catbg">', $txt['package_ftp_necessary'], '</h3> |
320 | 327 | </div> |
321 | 328 | <div> |
322 | 329 | ', template_control_chmod(), ' |
323 | 330 | </div>'; |
331 | + } |
|
324 | 332 | |
325 | 333 | echo ' |
326 | 334 | |
@@ -336,8 +344,8 @@ discard block |
||
336 | 344 | // Operations. |
337 | 345 | if (!empty($js_operations)) |
338 | 346 | { |
339 | - foreach ($js_operations as $key => $operation) |
|
340 | - echo ' |
|
347 | + foreach ($js_operations as $key => $operation) { |
|
348 | + echo ' |
|
341 | 349 | aOperationElements[', $key, '] = new smc_Toggle({ |
342 | 350 | bToggleEnabled: true, |
343 | 351 | bNoAnimate: true, |
@@ -355,6 +363,7 @@ discard block |
||
355 | 363 | } |
356 | 364 | ] |
357 | 365 | });'; |
366 | + } |
|
358 | 367 | } |
359 | 368 | |
360 | 369 | echo ' |
@@ -376,14 +385,15 @@ discard block |
||
376 | 385 | </script>'; |
377 | 386 | |
378 | 387 | // And a bit more for database changes. |
379 | - if (!empty($context['database_changes'])) |
|
380 | - echo ' |
|
388 | + if (!empty($context['database_changes'])) { |
|
389 | + echo ' |
|
381 | 390 | <script> |
382 | 391 | var database_changes_area = document.getElementById(\'db_changes_div\'); |
383 | 392 | var db_vis = false; |
384 | 393 | database_changes_area.style.display = "none"; |
385 | 394 | </script>'; |
386 | -} |
|
395 | + } |
|
396 | + } |
|
387 | 397 | |
388 | 398 | /** |
389 | 399 | * Extract package contents |
@@ -392,8 +402,8 @@ discard block |
||
392 | 402 | { |
393 | 403 | global $context, $txt, $scripturl; |
394 | 404 | |
395 | - if (!empty($context['redirect_url'])) |
|
396 | - echo ' |
|
405 | + if (!empty($context['redirect_url'])) { |
|
406 | + echo ' |
|
397 | 407 | <script> |
398 | 408 | setTimeout("doRedirect();", ', empty($context['redirect_timeout']) ? '5000' : $context['redirect_timeout'], '); |
399 | 409 | |
@@ -402,49 +412,48 @@ discard block |
||
402 | 412 | window.location = "', $context['redirect_url'], '"; |
403 | 413 | } |
404 | 414 | </script>'; |
415 | + } |
|
405 | 416 | |
406 | - if (empty($context['redirect_url'])) |
|
407 | - echo ' |
|
417 | + if (empty($context['redirect_url'])) { |
|
418 | + echo ' |
|
408 | 419 | <div class="cat_bar"> |
409 | 420 | <h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3> |
410 | 421 | </div> |
411 | 422 | <div class="information">', $txt['package_installed_extract'], '</div>'; |
412 | - else |
|
413 | - echo ' |
|
423 | + } else { |
|
424 | + echo ' |
|
414 | 425 | <div class="cat_bar"> |
415 | 426 | <h3 class="catbg">', $txt['package_installed_redirecting'], '</h3> |
416 | 427 | </div>'; |
428 | + } |
|
417 | 429 | |
418 | 430 | echo ' |
419 | 431 | <div class="windowbg">'; |
420 | 432 | |
421 | 433 | // If we are going to redirect we have a slightly different agenda. |
422 | - if (!empty($context['redirect_url'])) |
|
423 | - echo ' |
|
434 | + if (!empty($context['redirect_url'])) { |
|
435 | + echo ' |
|
424 | 436 | ', $context['redirect_text'], '<br><br> |
425 | 437 | <a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>'; |
426 | - |
|
427 | - elseif ($context['uninstalling']) |
|
428 | - echo ' |
|
438 | + } elseif ($context['uninstalling']) { |
|
439 | + echo ' |
|
429 | 440 | ', $txt['package_uninstall_done']; |
430 | - |
|
431 | - elseif ($context['install_finished']) |
|
441 | + } elseif ($context['install_finished']) |
|
432 | 442 | { |
433 | - if ($context['extract_type'] == 'avatar') |
|
434 | - echo ' |
|
443 | + if ($context['extract_type'] == 'avatar') { |
|
444 | + echo ' |
|
435 | 445 | ', $txt['avatars_extracted']; |
436 | - |
|
437 | - elseif ($context['extract_type'] == 'language') |
|
438 | - echo ' |
|
446 | + } elseif ($context['extract_type'] == 'language') { |
|
447 | + echo ' |
|
439 | 448 | ', $txt['language_extracted']; |
440 | - |
|
441 | - else |
|
442 | - echo ' |
|
449 | + } else { |
|
450 | + echo ' |
|
443 | 451 | ', $txt['package_installed_done']; |
444 | - } |
|
445 | - else |
|
446 | - echo ' |
|
452 | + } |
|
453 | + } else { |
|
454 | + echo ' |
|
447 | 455 | ', $txt['corrupt_compatible']; |
456 | + } |
|
448 | 457 | |
449 | 458 | echo ' |
450 | 459 | </div><!-- .windowbg -->'; |
@@ -474,9 +483,10 @@ discard block |
||
474 | 483 | <div class="windowbg"> |
475 | 484 | <ol>'; |
476 | 485 | |
477 | - foreach ($context['files'] as $fileinfo) |
|
478 | - echo ' |
|
486 | + foreach ($context['files'] as $fileinfo) { |
|
487 | + echo ' |
|
479 | 488 | <li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>'; |
489 | + } |
|
480 | 490 | |
481 | 491 | echo ' |
482 | 492 | </ol> |
@@ -536,9 +546,10 @@ discard block |
||
536 | 546 | </script> |
537 | 547 | <div id="yourVersion" style="display:none">', $context['forum_version'], '</div>'; |
538 | 548 | |
539 | - if (empty($modSettings['disable_smf_js'])) |
|
540 | - echo ' |
|
549 | + if (empty($modSettings['disable_smf_js'])) { |
|
550 | + echo ' |
|
541 | 551 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
552 | + } |
|
542 | 553 | |
543 | 554 | // This sets the announcements and current versions themselves ;). |
544 | 555 | echo ' |
@@ -576,12 +587,13 @@ discard block |
||
576 | 587 | } |
577 | 588 | } |
578 | 589 | |
579 | - if (!$mods_available) |
|
580 | - echo ' |
|
590 | + if (!$mods_available) { |
|
591 | + echo ' |
|
581 | 592 | <div class="noticebox">', $txt['no_packages'], '</div>'; |
582 | - else |
|
583 | - echo ' |
|
593 | + } else { |
|
594 | + echo ' |
|
584 | 595 | <br>'; |
596 | + } |
|
585 | 597 | |
586 | 598 | // The advanced (emulation) box, collapsed by default |
587 | 599 | echo ' |
@@ -608,9 +620,10 @@ discard block |
||
608 | 620 | <a id="revert" name="revert"></a> |
609 | 621 | <select name="version_emulate" id="ve">'; |
610 | 622 | |
611 | - foreach ($context['emulation_versions'] as $version) |
|
612 | - echo ' |
|
623 | + foreach ($context['emulation_versions'] as $version) { |
|
624 | + echo ' |
|
613 | 625 | <option value="', $version, '"', ($version == $context['selected_version'] ? ' selected="selected"' : ''), '>', $version, '</option>'; |
626 | + } |
|
614 | 627 | |
615 | 628 | echo ' |
616 | 629 | </select> |
@@ -665,11 +678,12 @@ discard block |
||
665 | 678 | { |
666 | 679 | global $context, $txt, $scripturl; |
667 | 680 | |
668 | - if (!empty($context['package_ftp']['error'])) |
|
669 | - echo ' |
|
681 | + if (!empty($context['package_ftp']['error'])) { |
|
682 | + echo ' |
|
670 | 683 | <div class="errorbox"> |
671 | 684 | <pre>', $context['package_ftp']['error'], '</pre> |
672 | 685 | </div>'; |
686 | + } |
|
673 | 687 | |
674 | 688 | echo ' |
675 | 689 | <div id="admin_form_wrapper"> |
@@ -752,13 +766,14 @@ discard block |
||
752 | 766 | <legend>' . $txt['package_servers'] . '</legend> |
753 | 767 | <ul class="package_servers">'; |
754 | 768 | |
755 | - foreach ($context['servers'] as $server) |
|
756 | - echo ' |
|
769 | + foreach ($context['servers'] as $server) { |
|
770 | + echo ' |
|
757 | 771 | <li class="flow_auto"> |
758 | 772 | <span class="floatleft">' . $server['name'] . '</span> |
759 | 773 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span> |
760 | 774 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span> |
761 | 775 | </li>'; |
776 | + } |
|
762 | 777 | echo ' |
763 | 778 | </ul> |
764 | 779 | </fieldset> |
@@ -842,11 +857,12 @@ discard block |
||
842 | 857 | <div class="windowbg">'; |
843 | 858 | |
844 | 859 | // No packages, as yet. |
845 | - if (empty($context['package_list'])) |
|
846 | - echo ' |
|
860 | + if (empty($context['package_list'])) { |
|
861 | + echo ' |
|
847 | 862 | <ul> |
848 | 863 | <li>', $txt['no_packages'], '</li> |
849 | 864 | </ul>'; |
865 | + } |
|
850 | 866 | |
851 | 867 | // List out the packages... |
852 | 868 | else |
@@ -860,11 +876,12 @@ discard block |
||
860 | 876 | <li> |
861 | 877 | <strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>'; |
862 | 878 | |
863 | - if (!empty($packageSection['text'])) |
|
864 | - echo ' |
|
879 | + if (!empty($packageSection['text'])) { |
|
880 | + echo ' |
|
865 | 881 | <div class="sub_bar"> |
866 | 882 | <h3 class="subbg">', $packageSection['text'], '</h3> |
867 | 883 | </div>'; |
884 | + } |
|
868 | 885 | |
869 | 886 | echo ' |
870 | 887 | <', $context['list_type'], ' id="package_section_', $i, '" class="packages">'; |
@@ -875,24 +892,28 @@ discard block |
||
875 | 892 | <li>'; |
876 | 893 | |
877 | 894 | // Textual message. Could be empty just for a blank line... |
878 | - if ($package['is_text']) |
|
879 | - echo ' |
|
895 | + if ($package['is_text']) { |
|
896 | + echo ' |
|
880 | 897 | ', empty($package['name']) ? ' ' : $package['name']; |
898 | + } |
|
881 | 899 | |
882 | 900 | // This is supposed to be a rule.. |
883 | - elseif ($package['is_line']) |
|
884 | - echo ' |
|
901 | + elseif ($package['is_line']) { |
|
902 | + echo ' |
|
885 | 903 | <hr>'; |
904 | + } |
|
886 | 905 | |
887 | 906 | // A remote link. |
888 | - elseif ($package['is_remote']) |
|
889 | - echo ' |
|
907 | + elseif ($package['is_remote']) { |
|
908 | + echo ' |
|
890 | 909 | <strong>', $package['link'], '</strong>'; |
910 | + } |
|
891 | 911 | |
892 | 912 | // A title? |
893 | - elseif ($package['is_heading'] || $package['is_title']) |
|
894 | - echo ' |
|
913 | + elseif ($package['is_heading'] || $package['is_title']) { |
|
914 | + echo ' |
|
895 | 915 | <strong>', $package['name'], '</strong>'; |
916 | + } |
|
896 | 917 | |
897 | 918 | // Otherwise, it's a package. |
898 | 919 | else |
@@ -903,32 +924,36 @@ discard block |
||
903 | 924 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
904 | 925 | |
905 | 926 | // Show the mod type? |
906 | - if ($package['type'] != '') |
|
907 | - echo ' |
|
927 | + if ($package['type'] != '') { |
|
928 | + echo ' |
|
908 | 929 | <li class="package_section"> |
909 | 930 | ', $txt['package_type'], ': ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), ' |
910 | 931 | </li>'; |
932 | + } |
|
911 | 933 | |
912 | 934 | // Show the version number? |
913 | - if ($package['version'] != '') |
|
914 | - echo ' |
|
935 | + if ($package['version'] != '') { |
|
936 | + echo ' |
|
915 | 937 | <li class="package_section"> |
916 | 938 | ', $txt['mod_version'], ': ', $package['version'], ' |
917 | 939 | </li>'; |
940 | + } |
|
918 | 941 | |
919 | 942 | // How 'bout the author? |
920 | - if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) |
|
921 | - echo ' |
|
943 | + if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) { |
|
944 | + echo ' |
|
922 | 945 | <li class="package_section"> |
923 | 946 | ', $txt['mod_author'], ': ', $package['author']['link'], ' |
924 | 947 | </li>'; |
948 | + } |
|
925 | 949 | |
926 | 950 | // The homepage... |
927 | - if ($package['author']['website']['link'] != '') |
|
928 | - echo ' |
|
951 | + if ($package['author']['website']['link'] != '') { |
|
952 | + echo ' |
|
929 | 953 | <li class="package_section"> |
930 | 954 | ', $txt['author_website'], ': ', $package['author']['website']['link'], ' |
931 | 955 | </li>'; |
956 | + } |
|
932 | 957 | |
933 | 958 | // Description: bleh bleh! |
934 | 959 | // Location of file: http://someplace/. |
@@ -986,8 +1011,8 @@ discard block |
||
986 | 1011 | |
987 | 1012 | foreach ($ps['items'] as $id => $package) |
988 | 1013 | { |
989 | - if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) |
|
990 | - echo ' |
|
1014 | + if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) { |
|
1015 | + echo ' |
|
991 | 1016 | var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({ |
992 | 1017 | bToggleEnabled: true, |
993 | 1018 | bCurrentlyCollapsed: true, |
@@ -1002,6 +1027,7 @@ discard block |
||
1002 | 1027 | } |
1003 | 1028 | ] |
1004 | 1029 | });'; |
1030 | + } |
|
1005 | 1031 | } |
1006 | 1032 | } |
1007 | 1033 | |
@@ -1044,9 +1070,10 @@ discard block |
||
1044 | 1070 | { |
1045 | 1071 | global $context, $txt, $scripturl; |
1046 | 1072 | |
1047 | - if (!empty($context['saved_successful'])) |
|
1048 | - echo ' |
|
1073 | + if (!empty($context['saved_successful'])) { |
|
1074 | + echo ' |
|
1049 | 1075 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1076 | + } |
|
1050 | 1077 | |
1051 | 1078 | echo ' |
1052 | 1079 | <div class="cat_bar"> |
@@ -1106,8 +1133,9 @@ discard block |
||
1106 | 1133 | global $context, $txt; |
1107 | 1134 | |
1108 | 1135 | // Nothing to do? Brilliant! |
1109 | - if (empty($context['package_ftp'])) |
|
1110 | - return false; |
|
1136 | + if (empty($context['package_ftp'])) { |
|
1137 | + return false; |
|
1138 | + } |
|
1111 | 1139 | |
1112 | 1140 | if (empty($context['package_ftp']['form_elements_only'])) |
1113 | 1141 | { |
@@ -1117,19 +1145,21 @@ discard block |
||
1117 | 1145 | ', $txt['package_ftp_why_file_list'], ' |
1118 | 1146 | <ul style="display: inline;">'; |
1119 | 1147 | |
1120 | - if (!empty($context['notwritable_files'])) |
|
1121 | - foreach ($context['notwritable_files'] as $file) |
|
1148 | + if (!empty($context['notwritable_files'])) { |
|
1149 | + foreach ($context['notwritable_files'] as $file) |
|
1122 | 1150 | echo ' |
1123 | 1151 | <li>', $file, '</li>'; |
1152 | + } |
|
1124 | 1153 | |
1125 | 1154 | echo ' |
1126 | 1155 | </ul>'; |
1127 | 1156 | |
1128 | - if (!$context['server']['is_windows']) |
|
1129 | - echo ' |
|
1157 | + if (!$context['server']['is_windows']) { |
|
1158 | + echo ' |
|
1130 | 1159 | <hr> |
1131 | 1160 | ', $txt['package_chmod_linux'], '<br> |
1132 | 1161 | <samp># chmod a+w ', implode(' ', $context['notwritable_files']), '</samp>'; |
1162 | + } |
|
1133 | 1163 | |
1134 | 1164 | echo ' |
1135 | 1165 | </div><!-- #need_writable_list -->'; |
@@ -1142,9 +1172,10 @@ discard block |
||
1142 | 1172 | </div> |
1143 | 1173 | </div>'; |
1144 | 1174 | |
1145 | - if (!empty($context['package_ftp']['destination'])) |
|
1146 | - echo ' |
|
1175 | + if (!empty($context['package_ftp']['destination'])) { |
|
1176 | + echo ' |
|
1147 | 1177 | <form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '">'; |
1178 | + } |
|
1148 | 1179 | |
1149 | 1180 | echo ' |
1150 | 1181 | <fieldset> |
@@ -1178,24 +1209,27 @@ discard block |
||
1178 | 1209 | </dl> |
1179 | 1210 | </fieldset>'; |
1180 | 1211 | |
1181 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
1182 | - echo ' |
|
1212 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
1213 | + echo ' |
|
1183 | 1214 | <div class="righttext" style="margin: 1ex;"> |
1184 | 1215 | <span id="test_ftp_placeholder_full"></span> |
1185 | 1216 | <input type="submit" value="', $txt['package_proceed'], '" class="button"> |
1186 | 1217 | </div>'; |
1218 | + } |
|
1187 | 1219 | |
1188 | - if (!empty($context['package_ftp']['destination'])) |
|
1189 | - echo ' |
|
1220 | + if (!empty($context['package_ftp']['destination'])) { |
|
1221 | + echo ' |
|
1190 | 1222 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1191 | 1223 | </form>'; |
1224 | + } |
|
1192 | 1225 | |
1193 | 1226 | // Hide the details of the list. |
1194 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
1195 | - echo ' |
|
1227 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
1228 | + echo ' |
|
1196 | 1229 | <script> |
1197 | 1230 | document.getElementById(\'need_writable_list\').style.display = \'none\'; |
1198 | 1231 | </script>'; |
1232 | + } |
|
1199 | 1233 | |
1200 | 1234 | // Quick generate the test button. |
1201 | 1235 | echo ' |
@@ -1552,9 +1586,10 @@ discard block |
||
1552 | 1586 | <td width="30%"> |
1553 | 1587 | <strong>'; |
1554 | 1588 | |
1555 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
1556 | - echo ' |
|
1589 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
1590 | + echo ' |
|
1557 | 1591 | <span class="generic_icons folder"></span>'; |
1592 | + } |
|
1558 | 1593 | |
1559 | 1594 | echo ' |
1560 | 1595 | ', $name, ' |
@@ -1581,8 +1616,9 @@ discard block |
||
1581 | 1616 | </td> |
1582 | 1617 | </tr>'; |
1583 | 1618 | |
1584 | - if (!empty($dir['contents'])) |
|
1585 | - template_permission_show_contents($name, $dir['contents'], 1); |
|
1619 | + if (!empty($dir['contents'])) { |
|
1620 | + template_permission_show_contents($name, $dir['contents'], 1); |
|
1621 | + } |
|
1586 | 1622 | } |
1587 | 1623 | |
1588 | 1624 | echo ' |
@@ -1618,13 +1654,14 @@ discard block |
||
1618 | 1654 | </fieldset>'; |
1619 | 1655 | |
1620 | 1656 | // Likely to need FTP? |
1621 | - if (empty($context['ftp_connected'])) |
|
1622 | - echo ' |
|
1657 | + if (empty($context['ftp_connected'])) { |
|
1658 | + echo ' |
|
1623 | 1659 | <p> |
1624 | 1660 | ', $txt['package_file_perms_ftp_details'], ': |
1625 | 1661 | </p> |
1626 | 1662 | ', template_control_chmod(), ' |
1627 | 1663 | <div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>'; |
1664 | + } |
|
1628 | 1665 | |
1629 | 1666 | echo ' |
1630 | 1667 | <span id="test_ftp_placeholder_full"></span> |
@@ -1633,9 +1670,10 @@ discard block |
||
1633 | 1670 | </div><!-- .windowbg -->'; |
1634 | 1671 | |
1635 | 1672 | // Any looks fors we've already done? |
1636 | - foreach ($context['look_for'] as $path) |
|
1637 | - echo ' |
|
1673 | + foreach ($context['look_for'] as $path) { |
|
1674 | + echo ' |
|
1638 | 1675 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
1676 | + } |
|
1639 | 1677 | |
1640 | 1678 | echo ' |
1641 | 1679 | </form> |
@@ -1677,9 +1715,10 @@ discard block |
||
1677 | 1715 | <td class="smalltext" width="30%">' . str_repeat(' ', $level * 5), ' |
1678 | 1716 | ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : ''; |
1679 | 1717 | |
1680 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
1681 | - echo ' |
|
1718 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
1719 | + echo ' |
|
1682 | 1720 | <span class="generic_icons folder"></span>'; |
1721 | + } |
|
1683 | 1722 | |
1684 | 1723 | echo ' |
1685 | 1724 | ', $name, ' |
@@ -1697,34 +1736,38 @@ discard block |
||
1697 | 1736 | </tr> |
1698 | 1737 | <tr id="insert_div_loc_' . $cur_ident . '" style="display: none;"><td></td></tr>'; |
1699 | 1738 | |
1700 | - if (!empty($dir['contents'])) |
|
1701 | - template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files'])); |
|
1739 | + if (!empty($dir['contents'])) { |
|
1740 | + template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files'])); |
|
1741 | + } |
|
1702 | 1742 | } |
1703 | 1743 | } |
1704 | 1744 | |
1705 | 1745 | // We have more files to show? |
1706 | - if ($has_more) |
|
1707 | - echo ' |
|
1746 | + if ($has_more) { |
|
1747 | + echo ' |
|
1708 | 1748 | <tr class="windowbg" id="content_', $js_ident, '_more"> |
1709 | 1749 | <td class="smalltext" width="40%">' . str_repeat(' ', $level * 5), ' |
1710 | 1750 | « <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> » |
1711 | 1751 | </td> |
1712 | 1752 | <td colspan="6"></td> |
1713 | 1753 | </tr>'; |
1754 | + } |
|
1714 | 1755 | |
1715 | 1756 | if ($drawn_div) |
1716 | 1757 | { |
1717 | 1758 | // Hide anything too far down the tree. |
1718 | 1759 | $isFound = false; |
1719 | - foreach ($context['look_for'] as $tree) |
|
1720 | - if (substr($tree, 0, strlen($ident)) == $ident) |
|
1760 | + foreach ($context['look_for'] as $tree) { |
|
1761 | + if (substr($tree, 0, strlen($ident)) == $ident) |
|
1721 | 1762 | $isFound = true; |
1763 | + } |
|
1722 | 1764 | |
1723 | - if ($level > 1 && !$isFound) |
|
1724 | - echo ' |
|
1765 | + if ($level > 1 && !$isFound) { |
|
1766 | + echo ' |
|
1725 | 1767 | <script> |
1726 | 1768 | expandFolder(\'', $js_ident, '\', \'\'); |
1727 | 1769 | </script>'; |
1770 | + } |
|
1728 | 1771 | } |
1729 | 1772 | } |
1730 | 1773 | |
@@ -1743,11 +1786,12 @@ discard block |
||
1743 | 1786 | <h3 class="catbg">', $txt['package_file_perms_applying'], '</h3> |
1744 | 1787 | </div>'; |
1745 | 1788 | |
1746 | - if (!empty($context['skip_ftp'])) |
|
1747 | - echo ' |
|
1789 | + if (!empty($context['skip_ftp'])) { |
|
1790 | + echo ' |
|
1748 | 1791 | <div class="errorbox"> |
1749 | 1792 | ', $txt['package_file_perms_skipping_ftp'], ' |
1750 | 1793 | </div>'; |
1794 | + } |
|
1751 | 1795 | |
1752 | 1796 | // How many have we done? |
1753 | 1797 | $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']); |
@@ -1785,28 +1829,31 @@ discard block |
||
1785 | 1829 | <br>'; |
1786 | 1830 | |
1787 | 1831 | // Put out the right hidden data. |
1788 | - if ($context['method'] == 'individual') |
|
1789 | - echo ' |
|
1832 | + if ($context['method'] == 'individual') { |
|
1833 | + echo ' |
|
1790 | 1834 | <input type="hidden" name="custom_value" value="', $context['custom_value'], '"> |
1791 | 1835 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
1792 | 1836 | <input type="hidden" name="toProcess" value="', $context['to_process_encode'], '">'; |
1793 | - else |
|
1794 | - echo ' |
|
1837 | + } else { |
|
1838 | + echo ' |
|
1795 | 1839 | <input type="hidden" name="predefined" value="', $context['predefined_type'], '"> |
1796 | 1840 | <input type="hidden" name="fileOffset" value="', $context['file_offset'], '"> |
1797 | 1841 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
1798 | 1842 | <input type="hidden" name="dirList" value="', $context['directory_list_encode'], '"> |
1799 | 1843 | <input type="hidden" name="specialFiles" value="', $context['special_files_encode'], '">'; |
1844 | + } |
|
1800 | 1845 | |
1801 | 1846 | // Are we not using FTP for whatever reason. |
1802 | - if (!empty($context['skip_ftp'])) |
|
1803 | - echo ' |
|
1847 | + if (!empty($context['skip_ftp'])) { |
|
1848 | + echo ' |
|
1804 | 1849 | <input type="hidden" name="skip_ftp" value="1">'; |
1850 | + } |
|
1805 | 1851 | |
1806 | 1852 | // Retain state. |
1807 | - foreach ($context['back_look_data'] as $path) |
|
1808 | - echo ' |
|
1853 | + foreach ($context['back_look_data'] as $path) { |
|
1854 | + echo ' |
|
1809 | 1855 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
1856 | + } |
|
1810 | 1857 | |
1811 | 1858 | echo ' |
1812 | 1859 | <input type="hidden" name="method" value="', $context['method'], '"> |
@@ -20,9 +20,10 @@ discard block |
||
20 | 20 | echo ' |
21 | 21 | <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], '" method="post">'; |
22 | 22 | |
23 | - if (!empty($context['disable_groups'])) |
|
24 | - echo ' |
|
23 | + if (!empty($context['disable_groups'])) { |
|
24 | + echo ' |
|
25 | 25 | <div class="noticebox">', $txt['paid_mod_edit_note'], '</div>'; |
26 | + } |
|
26 | 27 | |
27 | 28 | echo ' |
28 | 29 | <div class="cat_bar"> |
@@ -66,9 +67,10 @@ discard block |
||
66 | 67 | <option value="0"', $context['sub']['prim_group'] == 0 ? ' selected' : '', '>', $txt['paid_mod_no_group'], '</option>'; |
67 | 68 | |
68 | 69 | // Put each group into the box. |
69 | - foreach ($context['groups'] as $id => $name) |
|
70 | - echo ' |
|
70 | + foreach ($context['groups'] as $id => $name) { |
|
71 | + echo ' |
|
71 | 72 | <option value="', $id, '"', $context['sub']['prim_group'] == $id ? ' selected' : '', '>', $name, '</option>'; |
73 | + } |
|
72 | 74 | |
73 | 75 | echo ' |
74 | 76 | </select> |
@@ -80,12 +82,13 @@ discard block |
||
80 | 82 | <dd>'; |
81 | 83 | |
82 | 84 | // Put a checkbox in for each group |
83 | - foreach ($context['groups'] as $id => $name) |
|
84 | - echo ' |
|
85 | + foreach ($context['groups'] as $id => $name) { |
|
86 | + echo ' |
|
85 | 87 | <label for="addgroup_', $id, '"> |
86 | 88 | <input type="checkbox" id="addgroup_', $id, '" name="addgroup[', $id, ']"', in_array($id, $context['sub']['add_groups']) ? ' checked' : '', !empty($context['disable_groups']) ? ' disabled' : '', '> |
87 | 89 | <span class="smalltext">', $name, '</span> |
88 | 90 | </label><br>'; |
91 | + } |
|
89 | 92 | |
90 | 93 | echo ' |
91 | 94 | </dd> |
@@ -230,8 +233,8 @@ discard block |
||
230 | 233 | <dl class="settings">'; |
231 | 234 | |
232 | 235 | // Do we need a username? |
233 | - if ($context['action_type'] == 'add') |
|
234 | - echo ' |
|
236 | + if ($context['action_type'] == 'add') { |
|
237 | + echo ' |
|
235 | 238 | <dt> |
236 | 239 | <strong>', $txt['paid_username'], ':</strong><br> |
237 | 240 | <span class="smalltext">', $txt['one_username'], '</span> |
@@ -239,6 +242,7 @@ discard block |
||
239 | 242 | <dd> |
240 | 243 | <input type="text" name="name" id="name_control" value="', $context['sub']['username'], '" size="30"> |
241 | 244 | </dd>'; |
245 | + } |
|
242 | 246 | |
243 | 247 | echo ' |
244 | 248 | <dt> |
@@ -256,9 +260,10 @@ discard block |
||
256 | 260 | <select name="year" id="year" onchange="generateDays();">'; |
257 | 261 | |
258 | 262 | // Show a list of all the years we allow... |
259 | - for ($year = 2005; $year <= 2030; $year++) |
|
260 | - echo ' |
|
263 | + for ($year = 2005; $year <= 2030; $year++) { |
|
264 | + echo ' |
|
261 | 265 | <option value="', $year, '"', $year == $context['sub']['start']['year'] ? ' selected' : '', '>', $year, '</option>'; |
266 | + } |
|
262 | 267 | |
263 | 268 | echo ' |
264 | 269 | </select> |
@@ -266,9 +271,10 @@ discard block |
||
266 | 271 | <select name="month" id="month" onchange="generateDays();">'; |
267 | 272 | |
268 | 273 | // There are 12 months per year - ensure that they all get listed. |
269 | - for ($month = 1; $month <= 12; $month++) |
|
270 | - echo ' |
|
274 | + for ($month = 1; $month <= 12; $month++) { |
|
275 | + echo ' |
|
271 | 276 | <option value="', $month, '"', $month == $context['sub']['start']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
277 | + } |
|
272 | 278 | |
273 | 279 | echo ' |
274 | 280 | </select> |
@@ -276,9 +282,10 @@ discard block |
||
276 | 282 | <select name="day" id="day">'; |
277 | 283 | |
278 | 284 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
279 | - for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++) |
|
280 | - echo ' |
|
285 | + for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++) { |
|
286 | + echo ' |
|
281 | 287 | <option value="', $day, '"', $day == $context['sub']['start']['day'] ? ' selected' : '', '>', $day, '</option>'; |
288 | + } |
|
282 | 289 | |
283 | 290 | echo ' |
284 | 291 | </select> |
@@ -290,9 +297,10 @@ discard block |
||
290 | 297 | <select name="yearend" id="yearend" onchange="generateDays(\'end\');">'; |
291 | 298 | |
292 | 299 | // Show a list of all the years we allow... |
293 | - for ($year = 2005; $year <= 2030; $year++) |
|
294 | - echo ' |
|
300 | + for ($year = 2005; $year <= 2030; $year++) { |
|
301 | + echo ' |
|
295 | 302 | <option value="', $year, '"', $year == $context['sub']['end']['year'] ? ' selected' : '', '>', $year, '</option>'; |
303 | + } |
|
296 | 304 | |
297 | 305 | echo ' |
298 | 306 | </select> |
@@ -300,9 +308,10 @@ discard block |
||
300 | 308 | <select name="monthend" id="monthend" onchange="generateDays(\'end\');">'; |
301 | 309 | |
302 | 310 | // There are 12 months per year - ensure that they all get listed. |
303 | - for ($month = 1; $month <= 12; $month++) |
|
304 | - echo ' |
|
311 | + for ($month = 1; $month <= 12; $month++) { |
|
312 | + echo ' |
|
305 | 313 | <option value="', $month, '"', $month == $context['sub']['end']['month'] ? ' selected' : '', '>', $txt['months'][$month], '</option>'; |
314 | + } |
|
306 | 315 | |
307 | 316 | echo ' |
308 | 317 | </select> |
@@ -310,9 +319,10 @@ discard block |
||
310 | 319 | <select name="dayend" id="dayend">'; |
311 | 320 | |
312 | 321 | // This prints out all the days in the current month - this changes dynamically as we switch months. |
313 | - for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++) |
|
314 | - echo ' |
|
322 | + for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++) { |
|
323 | + echo ' |
|
315 | 324 | <option value="', $day, '"', $day == $context['sub']['end']['day'] ? ' selected' : '', '>', $day, '</option>'; |
325 | + } |
|
316 | 326 | |
317 | 327 | echo ' |
318 | 328 | </select> |
@@ -351,8 +361,8 @@ discard block |
||
351 | 361 | <div class="windowbg"> |
352 | 362 | <ul>'; |
353 | 363 | |
354 | - foreach ($context['pending_payments'] as $id => $payment) |
|
355 | - echo ' |
|
364 | + foreach ($context['pending_payments'] as $id => $payment) { |
|
365 | + echo ' |
|
356 | 366 | <li> |
357 | 367 | ', $payment['desc'], ' |
358 | 368 | <span class="floatleft"> |
@@ -362,6 +372,7 @@ discard block |
||
362 | 372 | <a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;lid=', $context['log_id'], ';pending=', $id, ';remove">', $txt['pending_payments_remove'], '</a> |
363 | 373 | </span> |
364 | 374 | </li>'; |
375 | + } |
|
365 | 376 | |
366 | 377 | echo ' |
367 | 378 | </ul>'; |
@@ -385,12 +396,12 @@ discard block |
||
385 | 396 | <h3 class="catbg">', $txt['subscriptions'], '</h3> |
386 | 397 | </div>'; |
387 | 398 | |
388 | - if (empty($context['subscriptions'])) |
|
389 | - echo ' |
|
399 | + if (empty($context['subscriptions'])) { |
|
400 | + echo ' |
|
390 | 401 | <div class="information"> |
391 | 402 | ', $txt['paid_subs_none'], ' |
392 | 403 | </div>'; |
393 | - else |
|
404 | + } else |
|
394 | 405 | { |
395 | 406 | echo ' |
396 | 407 | <div class="information"> |
@@ -401,8 +412,9 @@ discard block |
||
401 | 412 | foreach ($context['subscriptions'] as $id => $subscription) |
402 | 413 | { |
403 | 414 | // Ignore the inactive ones... |
404 | - if (empty($subscription['active'])) |
|
405 | - continue; |
|
415 | + if (empty($subscription['active'])) { |
|
416 | + continue; |
|
417 | + } |
|
406 | 418 | |
407 | 419 | echo ' |
408 | 420 | <div class="cat_bar"> |
@@ -412,9 +424,10 @@ discard block |
||
412 | 424 | <p><strong>', $subscription['name'], '</strong></p> |
413 | 425 | <p class="smalltext">', $subscription['desc'], '</p>'; |
414 | 426 | |
415 | - if (!$subscription['flexible']) |
|
416 | - echo ' |
|
427 | + if (!$subscription['flexible']) { |
|
428 | + echo ' |
|
417 | 429 | <div><strong>', $txt['paid_duration'], ':</strong> ', $subscription['length'], '</div>'; |
430 | + } |
|
418 | 431 | |
419 | 432 | if ($context['user']['is_owner']) |
420 | 433 | { |
@@ -427,24 +440,25 @@ discard block |
||
427 | 440 | <select name="cur[', $subscription['id'], ']">'; |
428 | 441 | |
429 | 442 | // Print out the costs for this one. |
430 | - foreach ($subscription['costs'] as $duration => $value) |
|
431 | - echo ' |
|
443 | + foreach ($subscription['costs'] as $duration => $value) { |
|
444 | + echo ' |
|
432 | 445 | <option value="', $duration, '">', sprintf($modSettings['paid_currency_symbol'], $value), '/', $txt[$duration], '</option>'; |
446 | + } |
|
433 | 447 | |
434 | 448 | echo ' |
435 | 449 | </select>'; |
436 | - } |
|
437 | - else |
|
438 | - echo ' |
|
450 | + } else { |
|
451 | + echo ' |
|
439 | 452 | ', sprintf($modSettings['paid_currency_symbol'], $subscription['costs']['fixed']); |
453 | + } |
|
440 | 454 | |
441 | 455 | echo ' |
442 | 456 | <hr> |
443 | 457 | <input type="submit" name="sub_id[', $subscription['id'], ']" value="', $txt['paid_order'], '" class="button">'; |
444 | - } |
|
445 | - else |
|
446 | - echo ' |
|
458 | + } else { |
|
459 | + echo ' |
|
447 | 460 | <a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $subscription['id'], ';uid=', $context['member']['id'], (empty($context['current'][$subscription['id']]) ? '' : ';lid=' . $context['current'][$subscription['id']]['id']), '">', empty($context['current'][$subscription['id']]) ? $txt['paid_admin_add'] : $txt['paid_edit_subscription'], '</a>'; |
461 | + } |
|
448 | 462 | |
449 | 463 | echo ' |
450 | 464 | </div><!-- .windowbg -->'; |
@@ -471,18 +485,19 @@ discard block |
||
471 | 485 | </thead> |
472 | 486 | <tbody>'; |
473 | 487 | |
474 | - if (empty($context['current'])) |
|
475 | - echo ' |
|
488 | + if (empty($context['current'])) { |
|
489 | + echo ' |
|
476 | 490 | <tr class="windowbg"> |
477 | 491 | <td colspan="4"> |
478 | 492 | ', $txt['paid_none_yet'], ' |
479 | 493 | </td> |
480 | 494 | </tr>'; |
495 | + } |
|
481 | 496 | |
482 | 497 | foreach ($context['current'] as $sub) |
483 | 498 | { |
484 | - if (!$sub['hide']) |
|
485 | - echo ' |
|
499 | + if (!$sub['hide']) { |
|
500 | + echo ' |
|
486 | 501 | <tr class="windowbg"> |
487 | 502 | <td> |
488 | 503 | ', ($context['user']['is_admin'] ? '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $sub['id'] . '">' . $sub['name'] . '</a>' : $sub['name']), ' |
@@ -493,6 +508,7 @@ discard block |
||
493 | 508 | <td>', $sub['start'], '</td> |
494 | 509 | <td>', $sub['end'], '</td> |
495 | 510 | </tr>'; |
511 | + } |
|
496 | 512 | } |
497 | 513 | |
498 | 514 | echo ' |
@@ -544,15 +560,17 @@ discard block |
||
544 | 560 | ', $gateway['desc'], '<br> |
545 | 561 | <form action="', $gateway['form'], '" method="post">'; |
546 | 562 | |
547 | - if (!empty($gateway['javascript'])) |
|
548 | - echo ' |
|
563 | + if (!empty($gateway['javascript'])) { |
|
564 | + echo ' |
|
549 | 565 | <script> |
550 | 566 | ', $gateway['javascript'], ' |
551 | 567 | </script>'; |
568 | + } |
|
552 | 569 | |
553 | - foreach ($gateway['hidden'] as $name => $value) |
|
554 | - echo ' |
|
570 | + foreach ($gateway['hidden'] as $name => $value) { |
|
571 | + echo ' |
|
555 | 572 | <input type="hidden" id="', $gateway['id'], '_', $name, '" name="', $name, '" value="', $value, '">'; |
573 | + } |
|
556 | 574 | |
557 | 575 | echo ' |
558 | 576 | <br> |
@@ -19,26 +19,28 @@ discard block |
||
19 | 19 | global $context, $settings, $scripturl, $txt, $modSettings; |
20 | 20 | |
21 | 21 | // Not allowed to edit? |
22 | - if (!$context['can_modify']) |
|
23 | - echo ' |
|
22 | + if (!$context['can_modify']) { |
|
23 | + echo ' |
|
24 | 24 | <div class="errorbox"> |
25 | 25 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
26 | 26 | </div>'; |
27 | + } |
|
27 | 28 | |
28 | 29 | echo ' |
29 | 30 | <div id="admin_form_wrapper"> |
30 | 31 | <form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">'; |
31 | 32 | |
32 | - if (!empty($context['profile'])) |
|
33 | - echo ' |
|
33 | + if (!empty($context['profile'])) { |
|
34 | + echo ' |
|
34 | 35 | <div class="cat_bar"> |
35 | 36 | <h3 class="catbg">', $txt['permissions_for_profile'], ': "', $context['profile']['name'], '"</h3> |
36 | 37 | </div>'; |
37 | - else |
|
38 | - echo ' |
|
38 | + } else { |
|
39 | + echo ' |
|
39 | 40 | <div class="cat_bar"> |
40 | 41 | <h3 class="catbg">', $txt['permissions_title'], '</h3> |
41 | 42 | </div>'; |
43 | + } |
|
42 | 44 | |
43 | 45 | echo ' |
44 | 46 | <table class="table_grid"> |
@@ -47,13 +49,14 @@ discard block |
||
47 | 49 | <th>', $txt['membergroups_name'], '</th> |
48 | 50 | <th class="small_table">', $txt['membergroups_members_top'], '</th>'; |
49 | 51 | |
50 | - if (empty($modSettings['permission_enable_deny'])) |
|
51 | - echo ' |
|
52 | + if (empty($modSettings['permission_enable_deny'])) { |
|
53 | + echo ' |
|
52 | 54 | <th class="small_table">', $txt['membergroups_permissions'], '</th>'; |
53 | - else |
|
54 | - echo ' |
|
55 | + } else { |
|
56 | + echo ' |
|
55 | 57 | <th class="small_table">', $txt['permissions_allowed'], '</th> |
56 | 58 | <th class="small_table">', $txt['permissions_denied'], '</th>'; |
59 | + } |
|
57 | 60 | |
58 | 61 | echo ' |
59 | 62 | <th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th> |
@@ -71,26 +74,28 @@ discard block |
||
71 | 74 | <td> |
72 | 75 | ', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a> ' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '<span>', $group['name'], '</span>'; |
73 | 76 | |
74 | - if (!empty($group['children'])) |
|
75 | - echo ' |
|
77 | + if (!empty($group['children'])) { |
|
78 | + echo ' |
|
76 | 79 | <br> |
77 | 80 | <span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
81 | + } |
|
78 | 82 | |
79 | 83 | echo ' |
80 | 84 | </td> |
81 | 85 | <td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>'; |
82 | 86 | |
83 | - if (empty($modSettings['permission_enable_deny'])) |
|
84 | - echo ' |
|
87 | + if (empty($modSettings['permission_enable_deny'])) { |
|
88 | + echo ' |
|
85 | 89 | <td>', $group['num_permissions']['allowed'], '</td>'; |
86 | - else |
|
87 | - echo ' |
|
90 | + } else { |
|
91 | + echo ' |
|
88 | 92 | <td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '> |
89 | 93 | ', $group['num_permissions']['allowed'], ' |
90 | 94 | </td> |
91 | 95 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '> |
92 | 96 | ', $group['num_permissions']['denied'], ' |
93 | 97 | </td>'; |
98 | + } |
|
94 | 99 | |
95 | 100 | echo ' |
96 | 101 | <td> |
@@ -141,10 +146,11 @@ discard block |
||
141 | 146 | <select name="copy_from"> |
142 | 147 | <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; |
143 | 148 | |
144 | - foreach ($context['groups'] as $group) |
|
145 | - if ($group['id'] != 1) |
|
149 | + foreach ($context['groups'] as $group) { |
|
150 | + if ($group['id'] != 1) |
|
146 | 151 | echo ' |
147 | 152 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
153 | + } |
|
148 | 154 | |
149 | 155 | echo ' |
150 | 156 | </select> |
@@ -154,9 +160,10 @@ discard block |
||
154 | 160 | <option value="add">', $txt['permissions_add'], '...</option> |
155 | 161 | <option value="clear">', $txt['permissions_remove'], '...</option>'; |
156 | 162 | |
157 | - if (!empty($modSettings['permission_enable_deny'])) |
|
158 | - echo ' |
|
163 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
164 | + echo ' |
|
159 | 165 | <option value="deny">', $txt['permissions_deny'], '...</option>'; |
166 | + } |
|
160 | 167 | |
161 | 168 | echo ' |
162 | 169 | </select> |
@@ -167,31 +174,35 @@ discard block |
||
167 | 174 | |
168 | 175 | foreach ($context['permissions'] as $permissionType) |
169 | 176 | { |
170 | - if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) |
|
171 | - continue; |
|
177 | + if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) { |
|
178 | + continue; |
|
179 | + } |
|
172 | 180 | |
173 | 181 | foreach ($permissionType['columns'] as $column) |
174 | 182 | { |
175 | 183 | foreach ($column as $permissionGroup) |
176 | 184 | { |
177 | - if ($permissionGroup['hidden']) |
|
178 | - continue; |
|
185 | + if ($permissionGroup['hidden']) { |
|
186 | + continue; |
|
187 | + } |
|
179 | 188 | |
180 | 189 | echo ' |
181 | 190 | <option value="" disabled>[', $permissionGroup['name'], ']</option>'; |
182 | 191 | |
183 | 192 | foreach ($permissionGroup['permissions'] as $perm) |
184 | 193 | { |
185 | - if ($perm['hidden']) |
|
186 | - continue; |
|
194 | + if ($perm['hidden']) { |
|
195 | + continue; |
|
196 | + } |
|
187 | 197 | |
188 | - if ($perm['has_own_any']) |
|
189 | - echo ' |
|
198 | + if ($perm['has_own_any']) { |
|
199 | + echo ' |
|
190 | 200 | <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> |
191 | 201 | <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; |
192 | - else |
|
193 | - echo ' |
|
202 | + } else { |
|
203 | + echo ' |
|
194 | 204 | <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; |
205 | + } |
|
195 | 206 | } |
196 | 207 | } |
197 | 208 | } |
@@ -256,9 +267,10 @@ discard block |
||
256 | 267 | } |
257 | 268 | </script>'; |
258 | 269 | |
259 | - if (!empty($context['profile'])) |
|
260 | - echo ' |
|
270 | + if (!empty($context['profile'])) { |
|
271 | + echo ' |
|
261 | 272 | <input type="hidden" name="pid" value="', $context['profile']['id'], '">'; |
273 | + } |
|
262 | 274 | |
263 | 275 | echo ' |
264 | 276 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -302,9 +314,10 @@ discard block |
||
302 | 314 | <h3 class="subbg">', $category['name'], '</h3> |
303 | 315 | </div>'; |
304 | 316 | |
305 | - if (!empty($category['boards'])) |
|
306 | - echo ' |
|
317 | + if (!empty($category['boards'])) { |
|
318 | + echo ' |
|
307 | 319 | <ul class="perm_boards flow_hidden">'; |
320 | + } |
|
308 | 321 | |
309 | 322 | foreach ($category['boards'] as $board) |
310 | 323 | { |
@@ -320,33 +333,36 @@ discard block |
||
320 | 333 | echo ' |
321 | 334 | <select name="boardprofile[', $board['id'], ']">'; |
322 | 335 | |
323 | - foreach ($context['profiles'] as $id => $profile) |
|
324 | - echo ' |
|
336 | + foreach ($context['profiles'] as $id => $profile) { |
|
337 | + echo ' |
|
325 | 338 | <option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
339 | + } |
|
326 | 340 | |
327 | 341 | echo ' |
328 | 342 | </select>'; |
329 | - } |
|
330 | - else |
|
331 | - echo ' |
|
343 | + } else { |
|
344 | + echo ' |
|
332 | 345 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>'; |
346 | + } |
|
333 | 347 | |
334 | 348 | echo ' |
335 | 349 | </span> |
336 | 350 | </li>'; |
337 | 351 | } |
338 | 352 | |
339 | - if (!empty($category['boards'])) |
|
340 | - echo ' |
|
353 | + if (!empty($category['boards'])) { |
|
354 | + echo ' |
|
341 | 355 | </ul>'; |
356 | + } |
|
342 | 357 | } |
343 | 358 | |
344 | - if ($context['edit_all']) |
|
345 | - echo ' |
|
359 | + if ($context['edit_all']) { |
|
360 | + echo ' |
|
346 | 361 | <input type="submit" name="save_changes" value="', $txt['save'], '" class="button">'; |
347 | - else |
|
348 | - echo ' |
|
362 | + } else { |
|
363 | + echo ' |
|
349 | 364 | <a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>'; |
365 | + } |
|
350 | 366 | |
351 | 367 | echo ' |
352 | 368 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -385,12 +401,13 @@ discard block |
||
385 | 401 | <tr class="windowbg"> |
386 | 402 | <td>'; |
387 | 403 | |
388 | - if (!empty($context['show_rename_boxes']) && $profile['can_edit']) |
|
389 | - echo ' |
|
404 | + if (!empty($context['show_rename_boxes']) && $profile['can_edit']) { |
|
405 | + echo ' |
|
390 | 406 | <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">'; |
391 | - else |
|
392 | - echo ' |
|
407 | + } else { |
|
408 | + echo ' |
|
393 | 409 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; |
410 | + } |
|
394 | 411 | |
395 | 412 | echo ' |
396 | 413 | </td> |
@@ -410,9 +427,10 @@ discard block |
||
410 | 427 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
411 | 428 | <input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">'; |
412 | 429 | |
413 | - if ($context['can_edit_something']) |
|
414 | - echo ' |
|
430 | + if ($context['can_edit_something']) { |
|
431 | + echo ' |
|
415 | 432 | <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">'; |
433 | + } |
|
416 | 434 | |
417 | 435 | echo ' |
418 | 436 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '> |
@@ -437,9 +455,10 @@ discard block |
||
437 | 455 | <dd> |
438 | 456 | <select name="copy_from">'; |
439 | 457 | |
440 | - foreach ($context['profiles'] as $id => $profile) |
|
441 | - echo ' |
|
458 | + foreach ($context['profiles'] as $id => $profile) { |
|
459 | + echo ' |
|
442 | 460 | <option value="', $id, '">', $profile['name'], '</option>'; |
461 | + } |
|
443 | 462 | |
444 | 463 | echo ' |
445 | 464 | </select> |
@@ -461,13 +480,13 @@ discard block |
||
461 | 480 | global $context, $scripturl, $txt, $modSettings; |
462 | 481 | |
463 | 482 | // Cannot be edited? |
464 | - if (!$context['profile']['can_modify']) |
|
465 | - echo ' |
|
483 | + if (!$context['profile']['can_modify']) { |
|
484 | + echo ' |
|
466 | 485 | <div class="errorbox"> |
467 | 486 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
468 | 487 | </div>'; |
469 | - else |
|
470 | - echo ' |
|
488 | + } else { |
|
489 | + echo ' |
|
471 | 490 | <script> |
472 | 491 | window.smf_usedDeny = false; |
473 | 492 | |
@@ -479,26 +498,29 @@ discard block |
||
479 | 498 | return true; |
480 | 499 | } |
481 | 500 | </script>'; |
501 | + } |
|
482 | 502 | |
483 | 503 | echo ' |
484 | 504 | <form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">'; |
485 | 505 | |
486 | - if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) |
|
487 | - echo ' |
|
506 | + if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) { |
|
507 | + echo ' |
|
488 | 508 | <div class="information"> |
489 | 509 | ', $txt['permissions_option_desc'], ' |
490 | 510 | </div>'; |
511 | + } |
|
491 | 512 | |
492 | 513 | echo ' |
493 | 514 | <div class="cat_bar"> |
494 | 515 | <h3 class="catbg">'; |
495 | 516 | |
496 | - if ($context['permission_type'] == 'board') |
|
497 | - echo ' |
|
517 | + if ($context['permission_type'] == 'board') { |
|
518 | + echo ' |
|
498 | 519 | ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; |
499 | - else |
|
500 | - echo ' |
|
520 | + } else { |
|
521 | + echo ' |
|
501 | 522 | ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; |
523 | + } |
|
502 | 524 | echo ' |
503 | 525 | </h3> |
504 | 526 | </div>'; |
@@ -521,15 +543,17 @@ discard block |
||
521 | 543 | template_modify_group_display('board'); |
522 | 544 | } |
523 | 545 | |
524 | - if ($context['profile']['can_modify']) |
|
525 | - echo ' |
|
546 | + if ($context['profile']['can_modify']) { |
|
547 | + echo ' |
|
526 | 548 | <div class="padding"> |
527 | 549 | <input type="submit" value="', $txt['permissions_commit'], '" class="button"> |
528 | 550 | </div>'; |
551 | + } |
|
529 | 552 | |
530 | - foreach ($context['hidden_perms'] as $hidden_perm) |
|
531 | - echo ' |
|
553 | + foreach ($context['hidden_perms'] as $hidden_perm) { |
|
554 | + echo ' |
|
532 | 555 | <input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">'; |
556 | + } |
|
533 | 557 | |
534 | 558 | echo ' |
535 | 559 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -556,17 +580,19 @@ discard block |
||
556 | 580 | |
557 | 581 | foreach ($column as $permissionGroup) |
558 | 582 | { |
559 | - if (empty($permissionGroup['permissions'])) |
|
560 | - continue; |
|
583 | + if (empty($permissionGroup['permissions'])) { |
|
584 | + continue; |
|
585 | + } |
|
561 | 586 | |
562 | 587 | // Are we likely to have something in this group to display or is it all hidden? |
563 | 588 | $has_display_content = false; |
564 | 589 | if (!$permissionGroup['hidden']) |
565 | 590 | { |
566 | 591 | // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. |
567 | - foreach ($permissionGroup['permissions'] as $permission) |
|
568 | - if (!$permission['hidden']) |
|
592 | + foreach ($permissionGroup['permissions'] as $permission) { |
|
593 | + if (!$permission['hidden']) |
|
569 | 594 | $has_display_content = true; |
595 | + } |
|
570 | 596 | |
571 | 597 | if ($has_display_content) |
572 | 598 | { |
@@ -575,10 +601,11 @@ discard block |
||
575 | 601 | <th></th> |
576 | 602 | <th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>'; |
577 | 603 | |
578 | - if ($context['group']['id'] != -1) |
|
579 | - echo ' |
|
604 | + if ($context['group']['id'] != -1) { |
|
605 | + echo ' |
|
580 | 606 | <th>', $txt['permissions_option_own'], '</th> |
581 | 607 | <th>', $txt['permissions_option_any'], '</th>'; |
608 | + } |
|
582 | 609 | |
583 | 610 | echo ' |
584 | 611 | </tr>'; |
@@ -601,17 +628,18 @@ discard block |
||
601 | 628 | // Guests can't do their own thing. |
602 | 629 | if ($context['group']['id'] != -1) |
603 | 630 | { |
604 | - if (empty($modSettings['permission_enable_deny'])) |
|
605 | - echo ' |
|
631 | + if (empty($modSettings['permission_enable_deny'])) { |
|
632 | + echo ' |
|
606 | 633 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '>'; |
607 | - else |
|
634 | + } else |
|
608 | 635 | { |
609 | 636 | echo ' |
610 | 637 | <select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>'; |
611 | 638 | |
612 | - foreach (array('on', 'off', 'deny') as $c) |
|
613 | - echo ' |
|
639 | + foreach (array('on', 'off', 'deny') as $c) { |
|
640 | + echo ' |
|
614 | 641 | <option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
642 | + } |
|
615 | 643 | echo ' |
616 | 644 | </select>'; |
617 | 645 | } |
@@ -621,39 +649,41 @@ discard block |
||
621 | 649 | <td>'; |
622 | 650 | } |
623 | 651 | |
624 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
625 | - echo ' |
|
652 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
653 | + echo ' |
|
626 | 654 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>'; |
627 | - else |
|
655 | + } else |
|
628 | 656 | { |
629 | 657 | echo ' |
630 | 658 | <select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>'; |
631 | 659 | |
632 | - foreach (array('on', 'off', 'deny') as $c) |
|
633 | - echo ' |
|
660 | + foreach (array('on', 'off', 'deny') as $c) { |
|
661 | + echo ' |
|
634 | 662 | <option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
663 | + } |
|
635 | 664 | echo ' |
636 | 665 | </select>'; |
637 | 666 | } |
638 | - } |
|
639 | - else |
|
667 | + } else |
|
640 | 668 | { |
641 | - if ($context['group']['id'] != -1) |
|
642 | - echo ' |
|
669 | + if ($context['group']['id'] != -1) { |
|
670 | + echo ' |
|
643 | 671 | </td> |
644 | 672 | <td>'; |
673 | + } |
|
645 | 674 | |
646 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
647 | - echo ' |
|
675 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
676 | + echo ' |
|
648 | 677 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>'; |
649 | - else |
|
678 | + } else |
|
650 | 679 | { |
651 | 680 | echo ' |
652 | 681 | <select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>'; |
653 | 682 | |
654 | - foreach (array('on', 'off', 'deny') as $c) |
|
655 | - echo ' |
|
683 | + foreach (array('on', 'off', 'deny') as $c) { |
|
684 | + echo ' |
|
656 | 685 | <option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
686 | + } |
|
657 | 687 | echo ' |
658 | 688 | </select>'; |
659 | 689 | } |
@@ -685,11 +715,11 @@ discard block |
||
685 | 715 | <fieldset id="', $context['current_permission'], '"> |
686 | 716 | <legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>'; |
687 | 717 | |
688 | - if (empty($modSettings['permission_enable_deny'])) |
|
689 | - echo ' |
|
718 | + if (empty($modSettings['permission_enable_deny'])) { |
|
719 | + echo ' |
|
690 | 720 | <ul>'; |
691 | - else |
|
692 | - echo ' |
|
721 | + } else { |
|
722 | + echo ' |
|
693 | 723 | <div class="information">', $txt['permissions_option_desc'], '</div> |
694 | 724 | <dl class="settings"> |
695 | 725 | <dt> |
@@ -699,47 +729,52 @@ discard block |
||
699 | 729 | </dt> |
700 | 730 | <dd> |
701 | 731 | </dd>'; |
732 | + } |
|
702 | 733 | |
703 | 734 | foreach ($context['member_groups'] as $group) |
704 | 735 | { |
705 | - if (!empty($modSettings['permission_enable_deny'])) |
|
706 | - echo ' |
|
736 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
737 | + echo ' |
|
707 | 738 | <dt>'; |
708 | - else |
|
709 | - echo ' |
|
739 | + } else { |
|
740 | + echo ' |
|
710 | 741 | <li>'; |
742 | + } |
|
711 | 743 | |
712 | - if (empty($modSettings['permission_enable_deny'])) |
|
713 | - echo ' |
|
744 | + if (empty($modSettings['permission_enable_deny'])) { |
|
745 | + echo ' |
|
714 | 746 | <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>'; |
715 | - else |
|
716 | - echo ' |
|
747 | + } else { |
|
748 | + echo ' |
|
717 | 749 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span> |
718 | 750 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span> |
719 | 751 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>'; |
752 | + } |
|
720 | 753 | |
721 | - if (!empty($modSettings['permission_enable_deny'])) |
|
722 | - echo ' |
|
754 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
755 | + echo ' |
|
723 | 756 | </dt> |
724 | 757 | <dd> |
725 | 758 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
726 | 759 | </dd>'; |
727 | - else |
|
728 | - echo ' |
|
760 | + } else { |
|
761 | + echo ' |
|
729 | 762 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
730 | 763 | </li>'; |
764 | + } |
|
731 | 765 | } |
732 | 766 | |
733 | - if (empty($modSettings['permission_enable_deny'])) |
|
734 | - echo ' |
|
767 | + if (empty($modSettings['permission_enable_deny'])) { |
|
768 | + echo ' |
|
735 | 769 | <li> |
736 | 770 | <input type="checkbox" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');"> |
737 | 771 | <span>', $txt['check_all'], '</span> |
738 | 772 | </li> |
739 | 773 | </ul>'; |
740 | - else |
|
741 | - echo ' |
|
774 | + } else { |
|
775 | + echo ' |
|
742 | 776 | </dl>'; |
777 | + } |
|
743 | 778 | |
744 | 779 | echo ' |
745 | 780 | </fieldset> |
@@ -779,9 +814,10 @@ discard block |
||
779 | 814 | if (!empty($modSettings['postmod_active'])) |
780 | 815 | { |
781 | 816 | // Got advanced permissions - if so warn! |
782 | - if (!empty($modSettings['permission_enable_deny'])) |
|
783 | - echo ' |
|
817 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
818 | + echo ' |
|
784 | 819 | <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; |
820 | + } |
|
785 | 821 | |
786 | 822 | echo ' |
787 | 823 | <div class="padding"> |
@@ -796,10 +832,11 @@ discard block |
||
796 | 832 | ', $txt['permissions_post_moderation_select'], ': |
797 | 833 | <select name="pid" onchange="document.forms.postmodForm.submit();">'; |
798 | 834 | |
799 | - foreach ($context['profiles'] as $profile) |
|
800 | - if ($profile['can_modify']) |
|
835 | + foreach ($context['profiles'] as $profile) { |
|
836 | + if ($profile['can_modify']) |
|
801 | 837 | echo ' |
802 | 838 | <option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
839 | + } |
|
803 | 840 | |
804 | 841 | echo ' |
805 | 842 | </select> |
@@ -820,11 +857,12 @@ discard block |
||
820 | 857 | ', $txt['permissions_post_moderation_replies_any'], ' |
821 | 858 | </th>'; |
822 | 859 | |
823 | - if ($modSettings['attachmentEnable'] == 1) |
|
824 | - echo ' |
|
860 | + if ($modSettings['attachmentEnable'] == 1) { |
|
861 | + echo ' |
|
825 | 862 | <th class="centercol" colspan="3"> |
826 | 863 | ', $txt['permissions_post_moderation_attachments'], ' |
827 | 864 | </th>'; |
865 | + } |
|
828 | 866 | |
829 | 867 | echo ' |
830 | 868 | </tr> |
@@ -842,11 +880,12 @@ discard block |
||
842 | 880 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
843 | 881 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
844 | 882 | |
845 | - if ($modSettings['attachmentEnable'] == 1) |
|
846 | - echo ' |
|
883 | + if ($modSettings['attachmentEnable'] == 1) { |
|
884 | + echo ' |
|
847 | 885 | <th><span class="generic_icons post_moderation_allow"></span></th> |
848 | 886 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
849 | 887 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
888 | + } |
|
850 | 889 | |
851 | 890 | echo ' |
852 | 891 | </tr> |
@@ -860,10 +899,11 @@ discard block |
||
860 | 899 | <td class="half_table"> |
861 | 900 | <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; |
862 | 901 | |
863 | - if (!empty($group['children'])) |
|
864 | - echo ' |
|
902 | + if (!empty($group['children'])) { |
|
903 | + echo ' |
|
865 | 904 | <br> |
866 | 905 | <span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
906 | + } |
|
867 | 907 | |
868 | 908 | echo ' |
869 | 909 | </td> |
@@ -878,11 +918,11 @@ discard block |
||
878 | 918 | </td>'; |
879 | 919 | |
880 | 920 | // Guests can't have "own" permissions |
881 | - if ($group['id'] == '-1') |
|
882 | - echo ' |
|
921 | + if ($group['id'] == '-1') { |
|
922 | + echo ' |
|
883 | 923 | <td colspan="3"></td>'; |
884 | - else |
|
885 | - echo ' |
|
924 | + } else { |
|
925 | + echo ' |
|
886 | 926 | <td class="centercol"> |
887 | 927 | <input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '> |
888 | 928 | </td> |
@@ -892,6 +932,7 @@ discard block |
||
892 | 932 | <td class="centercol"> |
893 | 933 | <input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', '> |
894 | 934 | </td>'; |
935 | + } |
|
895 | 936 | |
896 | 937 | echo ' |
897 | 938 | <td class="centercol"> |
@@ -904,8 +945,8 @@ discard block |
||
904 | 945 | <input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', '> |
905 | 946 | </td>'; |
906 | 947 | |
907 | - if ($modSettings['attachmentEnable'] == 1) |
|
908 | - echo ' |
|
948 | + if ($modSettings['attachmentEnable'] == 1) { |
|
949 | + echo ' |
|
909 | 950 | <td class="centercol"> |
910 | 951 | <input type="radio" name="attachment[', $group['id'], ']" value="allow"', $group['attachment'] == 'allow' ? ' checked' : '', '> |
911 | 952 | </td> |
@@ -915,6 +956,7 @@ discard block |
||
915 | 956 | <td class="centercol"> |
916 | 957 | <input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', '> |
917 | 958 | </td>'; |
959 | + } |
|
918 | 960 | |
919 | 961 | echo ' |
920 | 962 | </tr>'; |
@@ -18,9 +18,10 @@ discard block |
||
18 | 18 | global $context, $txt, $scripturl; |
19 | 19 | |
20 | 20 | // Are we done sending the newsletter? |
21 | - if (!empty($context['newsletter_sent'])) |
|
22 | - echo ' |
|
21 | + if (!empty($context['newsletter_sent'])) { |
|
22 | + echo ' |
|
23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
24 | + } |
|
24 | 25 | |
25 | 26 | echo ' |
26 | 27 | <form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" id="admin_newsletters" class="flow_hidden" accept-charset="', $context['character_set'], '"> |
@@ -38,9 +39,10 @@ discard block |
||
38 | 39 | </dt> |
39 | 40 | <dd>'; |
40 | 41 | |
41 | - foreach ($context['groups'] as $group) |
|
42 | - echo ' |
|
42 | + foreach ($context['groups'] as $group) { |
|
43 | + echo ' |
|
43 | 44 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
45 | + } |
|
44 | 46 | |
45 | 47 | echo ' |
46 | 48 | <br> |
@@ -79,9 +81,10 @@ discard block |
||
79 | 81 | </dt> |
80 | 82 | <dd>'; |
81 | 83 | |
82 | - foreach ($context['groups'] as $group) |
|
83 | - echo ' |
|
84 | + foreach ($context['groups'] as $group) { |
|
85 | + echo ' |
|
84 | 86 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
87 | + } |
|
85 | 88 | |
86 | 89 | echo ' |
87 | 90 | <br> |
@@ -225,9 +228,10 @@ discard block |
||
225 | 228 | <div id="bbcBox_message"></div>'; |
226 | 229 | |
227 | 230 | // What about smileys? |
228 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
229 | - echo ' |
|
231 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
232 | + echo ' |
|
230 | 233 | <div id="smileyBox_message"></div>'; |
234 | + } |
|
231 | 235 | |
232 | 236 | // Show BBC buttons, smileys and textbox. |
233 | 237 | echo ' |
@@ -248,9 +252,10 @@ discard block |
||
248 | 252 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
249 | 253 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
250 | 254 | |
251 | - foreach ($context['recipients'] as $key => $values) |
|
252 | - echo ' |
|
255 | + foreach ($context['recipients'] as $key => $values) { |
|
256 | + echo ' |
|
253 | 257 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
258 | + } |
|
254 | 259 | |
255 | 260 | echo ' |
256 | 261 | <script>'; |
@@ -404,9 +409,10 @@ discard block |
||
404 | 409 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
405 | 410 | |
406 | 411 | // All the things we must remember! |
407 | - foreach ($context['recipients'] as $key => $values) |
|
408 | - echo ' |
|
412 | + foreach ($context['recipients'] as $key => $values) { |
|
413 | + echo ' |
|
409 | 414 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
415 | + } |
|
410 | 416 | |
411 | 417 | echo ' |
412 | 418 | </div><!-- .windowbg --> |
@@ -438,9 +444,10 @@ discard block |
||
438 | 444 | { |
439 | 445 | global $context, $txt; |
440 | 446 | |
441 | - if (!empty($context['saved_successful'])) |
|
442 | - echo ' |
|
447 | + if (!empty($context['saved_successful'])) { |
|
448 | + echo ' |
|
443 | 449 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
450 | + } |
|
444 | 451 | |
445 | 452 | template_show_list('news_lists'); |
446 | 453 | } |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | <div class="windowbg"> |
125 | 125 | <dl class="settings">'; |
126 | 126 | |
127 | - if (!empty($context['table_info'])) |
|
128 | - echo ' |
|
127 | + if (!empty($context['table_info'])) { |
|
128 | + echo ' |
|
129 | 129 | <dt> |
130 | 130 | <strong>', $txt['search_method_messages_table_space'], ':</strong> |
131 | 131 | </dt> |
@@ -138,6 +138,7 @@ discard block |
||
138 | 138 | <dd> |
139 | 139 | ', $context['table_info']['index_length'], ' |
140 | 140 | </dd>'; |
141 | + } |
|
141 | 142 | echo ' |
142 | 143 | </dl> |
143 | 144 | ', $context['double_index'] ? '<div class="noticebox"> |
@@ -160,17 +161,17 @@ discard block |
||
160 | 161 | <dd> |
161 | 162 | <span class="smalltext">'; |
162 | 163 | |
163 | - if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) |
|
164 | - echo ' |
|
164 | + if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) { |
|
165 | + echo ' |
|
165 | 166 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]'; |
166 | - |
|
167 | - elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) |
|
168 | - echo ' |
|
167 | + } elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) { |
|
168 | + echo ' |
|
169 | 169 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; |
170 | - else |
|
171 | - echo ' |
|
170 | + } else { |
|
171 | + echo ' |
|
172 | 172 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br> |
173 | 173 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; |
174 | + } |
|
174 | 175 | echo ' |
175 | 176 | </span> |
176 | 177 | </dd>'; |
@@ -184,26 +185,27 @@ discard block |
||
184 | 185 | <dd> |
185 | 186 | <span class="smalltext">'; |
186 | 187 | |
187 | - if ($context['custom_index']) |
|
188 | - echo ' |
|
188 | + if ($context['custom_index']) { |
|
189 | + echo ' |
|
189 | 190 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br> |
190 | 191 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
191 | - |
|
192 | - elseif ($context['partial_custom_index']) |
|
193 | - echo ' |
|
192 | + } elseif ($context['partial_custom_index']) { |
|
193 | + echo ' |
|
194 | 194 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br> |
195 | 195 | <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
196 | - else |
|
197 | - echo ' |
|
196 | + } else { |
|
197 | + echo ' |
|
198 | 198 | <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; |
199 | + } |
|
199 | 200 | echo ' |
200 | 201 | </span> |
201 | 202 | </dd>'; |
202 | 203 | |
203 | 204 | foreach ($context['search_apis'] as $api) |
204 | 205 | { |
205 | - if (empty($api['label']) || $api['has_template']) |
|
206 | - continue; |
|
206 | + if (empty($api['label']) || $api['has_template']) { |
|
207 | + continue; |
|
208 | + } |
|
207 | 209 | |
208 | 210 | echo ' |
209 | 211 | <dt> |
@@ -211,11 +213,12 @@ discard block |
||
211 | 213 | ', $api['label'], ' |
212 | 214 | </dt>'; |
213 | 215 | |
214 | - if ($api['desc']) |
|
215 | - echo ' |
|
216 | + if ($api['desc']) { |
|
217 | + echo ' |
|
216 | 218 | <dd> |
217 | 219 | <span class="smalltext">', $api['desc'], '</span> |
218 | 220 | </dd>'; |
221 | + } |
|
219 | 222 | } |
220 | 223 | |
221 | 224 | echo ' |
@@ -34,11 +34,12 @@ discard block |
||
34 | 34 | </div>'; |
35 | 35 | |
36 | 36 | // If this is an existing set, and there are still un-added smileys - offer an import opportunity. |
37 | - if (!empty($context['current_set']['can_import'])) |
|
38 | - echo ' |
|
37 | + if (!empty($context['current_set']['can_import'])) { |
|
38 | + echo ' |
|
39 | 39 | <div class="information noup"> |
40 | 40 | ', $context['current_set']['can_import'] == 1 ? sprintf($txt['smiley_set_import_single'], $context['current_set']['import_url']) : sprintf($txt['smiley_set_import_multiple'], $context['current_set']['can_import'], $context['current_set']['import_url']), ' |
41 | 41 | </div>'; |
42 | + } |
|
42 | 43 | |
43 | 44 | echo ' |
44 | 45 | <div class="windowbg noup"> |
@@ -54,20 +55,20 @@ discard block |
||
54 | 55 | </dt> |
55 | 56 | <dd> |
56 | 57 | ', $modSettings['smileys_url'], '/'; |
57 | - if ($context['current_set']['id'] == 'default') |
|
58 | - echo '<strong>default</strong><input type="hidden" name="smiley_sets_path" id="smiley_sets_path" value="default">'; |
|
59 | - |
|
60 | - elseif (empty($context['smiley_set_dirs'])) |
|
61 | - echo ' |
|
58 | + if ($context['current_set']['id'] == 'default') { |
|
59 | + echo '<strong>default</strong><input type="hidden" name="smiley_sets_path" id="smiley_sets_path" value="default">'; |
|
60 | + } elseif (empty($context['smiley_set_dirs'])) { |
|
61 | + echo ' |
|
62 | 62 | <input type="text" name="smiley_sets_path" id="smiley_sets_path" value="', $context['current_set']['path'], '"> '; |
63 | - else |
|
63 | + } else |
|
64 | 64 | { |
65 | 65 | echo ' |
66 | 66 | <select name="smiley_sets_path" id="smiley_sets_path">'; |
67 | 67 | |
68 | - foreach ($context['smiley_set_dirs'] as $smiley_set_dir) |
|
69 | - echo ' |
|
68 | + foreach ($context['smiley_set_dirs'] as $smiley_set_dir) { |
|
69 | + echo ' |
|
70 | 70 | <option value="', $smiley_set_dir['id'], '"', $smiley_set_dir['current'] ? ' selected' : '', $smiley_set_dir['selectable'] ? '' : ' disabled', '>', $smiley_set_dir['id'], '</option>'; |
71 | + } |
|
71 | 72 | echo ' |
72 | 73 | </select> '; |
73 | 74 | } |
@@ -82,14 +83,15 @@ discard block |
||
82 | 83 | </dd>'; |
83 | 84 | |
84 | 85 | // If this is a new smiley set they have the option to import smileys already in the directory. |
85 | - if ($context['current_set']['is_new'] && !empty($modSettings['smiley_enable'])) |
|
86 | - echo ' |
|
86 | + if ($context['current_set']['is_new'] && !empty($modSettings['smiley_enable'])) { |
|
87 | + echo ' |
|
87 | 88 | <dt> |
88 | 89 | <strong><label for="smiley_sets_import">', $txt['smiley_set_import_directory'], '</label>: </strong> |
89 | 90 | </dt> |
90 | 91 | <dd> |
91 | 92 | <input type="checkbox" name="smiley_sets_import" id="smiley_sets_import" value="1"> |
92 | 93 | </dd>'; |
94 | + } |
|
93 | 95 | |
94 | 96 | echo ' |
95 | 97 | </dl> |
@@ -121,9 +123,10 @@ discard block |
||
121 | 123 | <dd> |
122 | 124 | <img src="', $modSettings['smileys_url'], '/', $modSettings['smiley_sets_default'], '/', $context['current_smiley']['filename'], '" id="preview" alt=""> (', $txt['smiley_preview_using'], ': <select name="set" onchange="updatePreview();">'; |
123 | 125 | |
124 | - foreach ($context['smiley_sets'] as $smiley_set) |
|
125 | - echo ' |
|
126 | + foreach ($context['smiley_sets'] as $smiley_set) { |
|
127 | + echo ' |
|
126 | 128 | <option value="', $smiley_set['path'], '"', $context['selected_set'] == $smiley_set['path'] ? ' selected' : '', '>', $smiley_set['name'], '</option>'; |
129 | + } |
|
127 | 130 | |
128 | 131 | echo ' |
129 | 132 | </select>) |
@@ -139,17 +142,18 @@ discard block |
||
139 | 142 | </dt> |
140 | 143 | <dd>'; |
141 | 144 | |
142 | - if (empty($context['filenames'])) |
|
143 | - echo ' |
|
145 | + if (empty($context['filenames'])) { |
|
146 | + echo ' |
|
144 | 147 | <input type="text" name="smiley_filename" id="smiley_filename" value="', $context['current_smiley']['filename'], '">'; |
145 | - else |
|
148 | + } else |
|
146 | 149 | { |
147 | 150 | echo ' |
148 | 151 | <select name="smiley_filename" id="smiley_filename" onchange="updatePreview();">'; |
149 | 152 | |
150 | - foreach ($context['filenames'] as $filename) |
|
151 | - echo ' |
|
153 | + foreach ($context['filenames'] as $filename) { |
|
154 | + echo ' |
|
152 | 155 | <option value="', $filename['id'], '"', $filename['selected'] ? ' selected' : '', '>', $filename['id'], '</option>'; |
156 | + } |
|
153 | 157 | echo ' |
154 | 158 | </select>'; |
155 | 159 | } |
@@ -216,9 +220,10 @@ discard block |
||
216 | 220 | <dd> |
217 | 221 | ', $txt['smiley_preview_using'], ': <select name="set" onchange="updatePreview();selectMethod(\'existing\');">'; |
218 | 222 | |
219 | - foreach ($context['smiley_sets'] as $smiley_set) |
|
220 | - echo ' |
|
223 | + foreach ($context['smiley_sets'] as $smiley_set) { |
|
224 | + echo ' |
|
221 | 225 | <option value="', $smiley_set['path'], '"', $context['selected_set'] == $smiley_set['path'] ? ' selected' : '', '>', $smiley_set['name'], '</option>'; |
226 | + } |
|
222 | 227 | |
223 | 228 | echo ' |
224 | 229 | </select> |
@@ -228,17 +233,18 @@ discard block |
||
228 | 233 | </dt> |
229 | 234 | <dd>'; |
230 | 235 | |
231 | - if (empty($context['filenames'])) |
|
232 | - echo ' |
|
236 | + if (empty($context['filenames'])) { |
|
237 | + echo ' |
|
233 | 238 | <input type="text" name="smiley_filename" id="smiley_filename" value="', $context['current_smiley']['filename'], '" onchange="selectMethod(\'existing\');">'; |
234 | - else |
|
239 | + } else |
|
235 | 240 | { |
236 | 241 | echo ' |
237 | 242 | <select name="smiley_filename" id="smiley_filename" onchange="updatePreview();selectMethod(\'existing\');">'; |
238 | 243 | |
239 | - foreach ($context['filenames'] as $filename) |
|
240 | - echo ' |
|
244 | + foreach ($context['filenames'] as $filename) { |
|
245 | + echo ' |
|
241 | 246 | <option value="', $filename['id'], '"', $filename['selected'] ? ' selected' : '', '>', $filename['id'], '</option>'; |
247 | + } |
|
242 | 248 | echo ' |
243 | 249 | </select>'; |
244 | 250 | } |
@@ -267,14 +273,15 @@ discard block |
||
267 | 273 | |
268 | 274 | <dl id="uploadMore" style="display: none;" class="settings">'; |
269 | 275 | |
270 | - foreach ($context['smiley_sets'] as $smiley_set) |
|
271 | - echo ' |
|
276 | + foreach ($context['smiley_sets'] as $smiley_set) { |
|
277 | + echo ' |
|
272 | 278 | <dt> |
273 | 279 | ', sprintf($txt['smileys_add_upload_for'], '<strong>' . $smiley_set['name'] . '</strong>'), ': |
274 | 280 | </dt> |
275 | 281 | <dd> |
276 | 282 | <input type="file" name="individual_', $smiley_set['name'], '" onchange="selectMethod(\'upload\');"> |
277 | 283 | </dd>'; |
284 | + } |
|
278 | 285 | |
279 | 286 | echo ' |
280 | 287 | </dl> |
@@ -341,27 +348,30 @@ discard block |
||
341 | 348 | |
342 | 349 | foreach ($location['rows'] as $row) |
343 | 350 | { |
344 | - if (!empty($context['move_smiley'])) |
|
345 | - echo ' |
|
351 | + if (!empty($context['move_smiley'])) { |
|
352 | + echo ' |
|
346 | 353 | <a href="', $scripturl, '?action=admin;area=smileys;sa=setorder;location=', $location['id'], ';source=', $context['move_smiley'], ';row=', $row[0]['row'], ';reorder=1;', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons select_below" title="', $txt['smileys_move_here'], '"></span></a>'; |
354 | + } |
|
347 | 355 | |
348 | 356 | foreach ($row as $smiley) |
349 | 357 | { |
350 | - if (empty($context['move_smiley'])) |
|
351 | - echo ' |
|
358 | + if (empty($context['move_smiley'])) { |
|
359 | + echo ' |
|
352 | 360 | <a href="', $scripturl, '?action=admin;area=smileys;sa=setorder;move=', $smiley['id'], '"><img src="', $modSettings['smileys_url'], '/', $modSettings['smiley_sets_default'], '/', $smiley['filename'], '" alt="', $smiley['description'], '"></a>'; |
353 | - else |
|
354 | - echo ' |
|
361 | + } else { |
|
362 | + echo ' |
|
355 | 363 | <img src="', $modSettings['smileys_url'], '/', $modSettings['smiley_sets_default'], '/', $smiley['filename'], '" alt="', $smiley['description'], '" ', $smiley['selected'] ? 'class="selected_item"' : '', '> |
356 | 364 | <a href="', $scripturl, '?action=admin;area=smileys;sa=setorder;location=', $location['id'], ';source=', $context['move_smiley'], ';after=', $smiley['id'], ';reorder=1;', $context['session_var'], '=', $context['session_id'], '" title="', $txt['smileys_move_here'], '"><span class="generic_icons select_below" title="', $txt['smileys_move_here'], '"></span></a>'; |
365 | + } |
|
357 | 366 | } |
358 | 367 | |
359 | 368 | echo ' |
360 | 369 | <br>'; |
361 | 370 | } |
362 | - if (!empty($context['move_smiley'])) |
|
363 | - echo ' |
|
371 | + if (!empty($context['move_smiley'])) { |
|
372 | + echo ' |
|
364 | 373 | <a href="', $scripturl, '?action=admin;area=smileys;sa=setorder;location=', $location['id'], ';source=', $context['move_smiley'], ';row=', $location['last_row'], ';reorder=1;', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons select_below" title="', $txt['smileys_move_here'], '"></span></a>'; |
374 | + } |
|
365 | 375 | echo ' |
366 | 376 | </div><!-- .windowbg --> |
367 | 377 | <input type="hidden" name="reorder" value="1"> |
@@ -394,14 +404,15 @@ discard block |
||
394 | 404 | <div class="windowbg"> |
395 | 405 | <dl class="settings">'; |
396 | 406 | |
397 | - if (!$context['new_icon']) |
|
398 | - echo ' |
|
407 | + if (!$context['new_icon']) { |
|
408 | + echo ' |
|
399 | 409 | <dt> |
400 | 410 | <strong>', $txt['smiley_preview'], ': </strong> |
401 | 411 | </dt> |
402 | 412 | <dd> |
403 | 413 | <img src="', $context['icon']['image_url'], '" alt="', $context['icon']['title'], '"> |
404 | 414 | </dd>'; |
415 | + } |
|
405 | 416 | |
406 | 417 | echo ' |
407 | 418 | <dt> |
@@ -428,9 +439,10 @@ discard block |
||
428 | 439 | echo ' |
429 | 440 | <optgroup label="', $category['name'], '">'; |
430 | 441 | |
431 | - foreach ($category['boards'] as $board) |
|
432 | - echo ' |
|
442 | + foreach ($category['boards'] as $board) { |
|
443 | + echo ' |
|
433 | 444 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], '</option>'; |
445 | + } |
|
434 | 446 | |
435 | 447 | echo ' |
436 | 448 | </optgroup>'; |
@@ -447,19 +459,21 @@ discard block |
||
447 | 459 | <option value="0"', empty($context['icon']['after']) ? ' selected' : '', '>', $txt['icons_location_first_icon'], '</option>'; |
448 | 460 | |
449 | 461 | // Print the list of all the icons it can be put after... |
450 | - foreach ($context['icons'] as $id => $data) |
|
451 | - if (empty($context['icon']['id']) || $id != $context['icon']['id']) |
|
462 | + foreach ($context['icons'] as $id => $data) { |
|
463 | + if (empty($context['icon']['id']) || $id != $context['icon']['id']) |
|
452 | 464 | echo ' |
453 | 465 | <option value="', $id, '"', !empty($context['icon']['after']) && $id == $context['icon']['after'] ? ' selected' : '', '>', $txt['icons_location_after'], ': ', $data['title'], '</option>'; |
466 | + } |
|
454 | 467 | |
455 | 468 | echo ' |
456 | 469 | </select> |
457 | 470 | </dd> |
458 | 471 | </dl>'; |
459 | 472 | |
460 | - if (!$context['new_icon']) |
|
461 | - echo ' |
|
473 | + if (!$context['new_icon']) { |
|
474 | + echo ' |
|
462 | 475 | <input type="hidden" name="icon" value="', $context['icon']['id'], '">'; |
476 | + } |
|
463 | 477 | |
464 | 478 | echo ' |
465 | 479 | <input type="submit" name="icons_save" value="', $txt['smileys_save'], '" class="button"> |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | $upcontext['inactive_timeout'] = 10; |
76 | 76 | |
77 | 77 | // The helper is crucial. Include it first thing. |
78 | -if (!file_exists($upgrade_path . '/upgrade-helper.php')) |
|
78 | +if (!file_exists($upgrade_path . '/upgrade-helper.php')) { |
|
79 | 79 | die('upgrade-helper.php not found where it was expected: ' . $upgrade_path . '/upgrade-helper.php! Make sure you have uploaded ALL files from the upgrade package. The upgrader cannot continue.'); |
80 | +} |
|
80 | 81 | |
81 | 82 | require_once($upgrade_path . '/upgrade-helper.php'); |
82 | 83 | |
@@ -107,11 +108,14 @@ discard block |
||
107 | 108 | ini_set('default_socket_timeout', 900); |
108 | 109 | } |
109 | 110 | // Clean the upgrade path if this is from the client. |
110 | -if (!empty($_SERVER['argv']) && php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) |
|
111 | - for ($i = 1; $i < $_SERVER['argc']; $i++) |
|
111 | +if (!empty($_SERVER['argv']) && php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { |
|
112 | + for ($i = 1; |
|
113 | +} |
|
114 | +$i < $_SERVER['argc']; $i++) |
|
112 | 115 | { |
113 | - if (preg_match('~^--path=(.+)$~', $_SERVER['argv'][$i], $match) != 0) |
|
114 | - $upgrade_path = substr($match[1], -1) == '/' ? substr($match[1], 0, -1) : $match[1]; |
|
116 | + if (preg_match('~^--path=(.+)$~', $_SERVER['argv'][$i], $match) != 0) { |
|
117 | + $upgrade_path = substr($match[1], -1) == '/' ? substr($match[1], 0, -1) : $match[1]; |
|
118 | + } |
|
115 | 119 | } |
116 | 120 | |
117 | 121 | // Are we from the client? |
@@ -119,16 +123,17 @@ discard block |
||
119 | 123 | { |
120 | 124 | $command_line = true; |
121 | 125 | $disable_security = true; |
122 | -} |
|
123 | -else |
|
126 | +} else { |
|
124 | 127 | $command_line = false; |
128 | +} |
|
125 | 129 | |
126 | 130 | // Load this now just because we can. |
127 | 131 | require_once($upgrade_path . '/Settings.php'); |
128 | 132 | |
129 | 133 | // We don't use "-utf8" anymore... Tweak the entry that may have been loaded by Settings.php |
130 | -if (isset($language)) |
|
134 | +if (isset($language)) { |
|
131 | 135 | $language = str_ireplace('-utf8', '', $language); |
136 | +} |
|
132 | 137 | |
133 | 138 | // Are we logged in? |
134 | 139 | if (isset($upgradeData)) |
@@ -136,10 +141,12 @@ discard block |
||
136 | 141 | $upcontext['user'] = json_decode(base64_decode($upgradeData), true); |
137 | 142 | |
138 | 143 | // Check for sensible values. |
139 | - if (empty($upcontext['user']['started']) || $upcontext['user']['started'] < time() - 86400) |
|
140 | - $upcontext['user']['started'] = time(); |
|
141 | - if (empty($upcontext['user']['updated']) || $upcontext['user']['updated'] < time() - 86400) |
|
142 | - $upcontext['user']['updated'] = 0; |
|
144 | + if (empty($upcontext['user']['started']) || $upcontext['user']['started'] < time() - 86400) { |
|
145 | + $upcontext['user']['started'] = time(); |
|
146 | + } |
|
147 | + if (empty($upcontext['user']['updated']) || $upcontext['user']['updated'] < time() - 86400) { |
|
148 | + $upcontext['user']['updated'] = 0; |
|
149 | + } |
|
143 | 150 | |
144 | 151 | $upcontext['started'] = $upcontext['user']['started']; |
145 | 152 | $upcontext['updated'] = $upcontext['user']['updated']; |
@@ -204,8 +211,9 @@ discard block |
||
204 | 211 | 'db_error_skip' => true, |
205 | 212 | ) |
206 | 213 | ); |
207 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
208 | - $modSettings[$row['variable']] = $row['value']; |
|
214 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
215 | + $modSettings[$row['variable']] = $row['value']; |
|
216 | + } |
|
209 | 217 | $smcFunc['db_free_result']($request); |
210 | 218 | } |
211 | 219 | |
@@ -215,14 +223,17 @@ discard block |
||
215 | 223 | $modSettings['theme_url'] = 'Themes/default'; |
216 | 224 | $modSettings['images_url'] = 'Themes/default/images'; |
217 | 225 | } |
218 | -if (!isset($settings['default_theme_url'])) |
|
226 | +if (!isset($settings['default_theme_url'])) { |
|
219 | 227 | $settings['default_theme_url'] = $modSettings['theme_url']; |
220 | -if (!isset($settings['default_theme_dir'])) |
|
228 | +} |
|
229 | +if (!isset($settings['default_theme_dir'])) { |
|
221 | 230 | $settings['default_theme_dir'] = $modSettings['theme_dir']; |
231 | +} |
|
222 | 232 | |
223 | 233 | // This is needed in case someone invokes the upgrader using https when upgrading an http forum |
224 | -if (httpsOn()) |
|
234 | +if (httpsOn()) { |
|
225 | 235 | $settings['default_theme_url'] = strtr($settings['default_theme_url'], array('http://' => 'https://')); |
236 | +} |
|
226 | 237 | |
227 | 238 | $upcontext['is_large_forum'] = (empty($modSettings['smfVersion']) || $modSettings['smfVersion'] <= '1.1 RC1') && !empty($modSettings['totalMessages']) && $modSettings['totalMessages'] > 75000; |
228 | 239 | // Default title... |
@@ -240,13 +251,15 @@ discard block |
||
240 | 251 | $support_js = $upcontext['upgrade_status']['js']; |
241 | 252 | |
242 | 253 | // Only set this if the upgrader status says so. |
243 | - if (empty($is_debug)) |
|
244 | - $is_debug = $upcontext['upgrade_status']['debug']; |
|
254 | + if (empty($is_debug)) { |
|
255 | + $is_debug = $upcontext['upgrade_status']['debug']; |
|
256 | + } |
|
245 | 257 | |
246 | 258 | // Load the language. |
247 | - if (file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) |
|
248 | - require_once($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php'); |
|
249 | -} |
|
259 | + if (file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) { |
|
260 | + require_once($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php'); |
|
261 | + } |
|
262 | + } |
|
250 | 263 | // Set the defaults. |
251 | 264 | else |
252 | 265 | { |
@@ -264,15 +277,18 @@ discard block |
||
264 | 277 | } |
265 | 278 | |
266 | 279 | // If this isn't the first stage see whether they are logging in and resuming. |
267 | -if ($upcontext['current_step'] != 0 || !empty($upcontext['user']['step'])) |
|
280 | +if ($upcontext['current_step'] != 0 || !empty($upcontext['user']['step'])) { |
|
268 | 281 | checkLogin(); |
282 | +} |
|
269 | 283 | |
270 | -if ($command_line) |
|
284 | +if ($command_line) { |
|
271 | 285 | cmdStep0(); |
286 | +} |
|
272 | 287 | |
273 | 288 | // Don't error if we're using xml. |
274 | -if (isset($_GET['xml'])) |
|
289 | +if (isset($_GET['xml'])) { |
|
275 | 290 | $upcontext['return_error'] = true; |
291 | +} |
|
276 | 292 | |
277 | 293 | // Loop through all the steps doing each one as required. |
278 | 294 | $upcontext['overall_percent'] = 0; |
@@ -293,9 +309,9 @@ discard block |
||
293 | 309 | } |
294 | 310 | |
295 | 311 | // Call the step and if it returns false that means pause! |
296 | - if (function_exists($step[2]) && $step[2]() === false) |
|
297 | - break; |
|
298 | - elseif (function_exists($step[2])) { |
|
312 | + if (function_exists($step[2]) && $step[2]() === false) { |
|
313 | + break; |
|
314 | + } elseif (function_exists($step[2])) { |
|
299 | 315 | //Start each new step with this unset, so the 'normal' template is called first |
300 | 316 | unset($_GET['xml']); |
301 | 317 | //Clear out warnings at the start of each step |
@@ -341,17 +357,18 @@ discard block |
||
341 | 357 | // This should not happen my dear... HELP ME DEVELOPERS!! |
342 | 358 | if (!empty($command_line)) |
343 | 359 | { |
344 | - if (function_exists('debug_print_backtrace')) |
|
345 | - debug_print_backtrace(); |
|
360 | + if (function_exists('debug_print_backtrace')) { |
|
361 | + debug_print_backtrace(); |
|
362 | + } |
|
346 | 363 | |
347 | 364 | echo "\n" . 'Error: Unexpected call to use the ' . (isset($upcontext['sub_template']) ? $upcontext['sub_template'] : '') . ' template. Please copy and paste all the text above and visit the SMF support forum to tell the Developers that they\'ve made a boo boo; they\'ll get you up and running again.'; |
348 | 365 | flush(); |
349 | 366 | die(); |
350 | 367 | } |
351 | 368 | |
352 | - if (!isset($_GET['xml'])) |
|
353 | - template_upgrade_above(); |
|
354 | - else |
|
369 | + if (!isset($_GET['xml'])) { |
|
370 | + template_upgrade_above(); |
|
371 | + } else |
|
355 | 372 | { |
356 | 373 | header('content-type: text/xml; charset=UTF-8'); |
357 | 374 | // Sadly we need to retain the $_GET data thanks to the old upgrade scripts. |
@@ -373,25 +390,29 @@ discard block |
||
373 | 390 | $upcontext['form_url'] = $upgradeurl . '?step=' . $upcontext['current_step'] . '&substep=' . $_GET['substep'] . '&data=' . base64_encode(json_encode($upcontext['upgrade_status'])); |
374 | 391 | |
375 | 392 | // Custom stuff to pass back? |
376 | - if (!empty($upcontext['query_string'])) |
|
377 | - $upcontext['form_url'] .= $upcontext['query_string']; |
|
393 | + if (!empty($upcontext['query_string'])) { |
|
394 | + $upcontext['form_url'] .= $upcontext['query_string']; |
|
395 | + } |
|
378 | 396 | |
379 | 397 | // Call the appropriate subtemplate |
380 | - if (is_callable('template_' . $upcontext['sub_template'])) |
|
381 | - call_user_func('template_' . $upcontext['sub_template']); |
|
382 | - else |
|
383 | - die('Upgrade aborted! Invalid template: template_' . $upcontext['sub_template']); |
|
398 | + if (is_callable('template_' . $upcontext['sub_template'])) { |
|
399 | + call_user_func('template_' . $upcontext['sub_template']); |
|
400 | + } else { |
|
401 | + die('Upgrade aborted! Invalid template: template_' . $upcontext['sub_template']); |
|
402 | + } |
|
384 | 403 | } |
385 | 404 | |
386 | 405 | // Was there an error? |
387 | - if (!empty($upcontext['forced_error_message'])) |
|
388 | - echo $upcontext['forced_error_message']; |
|
406 | + if (!empty($upcontext['forced_error_message'])) { |
|
407 | + echo $upcontext['forced_error_message']; |
|
408 | + } |
|
389 | 409 | |
390 | 410 | // Show the footer. |
391 | - if (!isset($_GET['xml'])) |
|
392 | - template_upgrade_below(); |
|
393 | - else |
|
394 | - template_xml_below(); |
|
411 | + if (!isset($_GET['xml'])) { |
|
412 | + template_upgrade_below(); |
|
413 | + } else { |
|
414 | + template_xml_below(); |
|
415 | + } |
|
395 | 416 | } |
396 | 417 | |
397 | 418 | // Show the upgrade time for CLI when we are completely done, if in debug mode. |
@@ -403,12 +424,13 @@ discard block |
||
403 | 424 | $seconds = intval($active % 60); |
404 | 425 | |
405 | 426 | $totalTime = ''; |
406 | - if ($hours > 0) |
|
407 | - echo "\n" . '', sprintf($txt['upgrade_completed_time_hms'], $hours, $minutes, $seconds), '' . "\n"; |
|
408 | - elseif ($minutes > 0) |
|
409 | - echo "\n" . '', sprintf($txt['upgrade_completed_time_ms'], $minutes, $seconds), '' . "\n"; |
|
410 | - elseif ($seconds > 0) |
|
411 | - echo "\n" . '', sprintf($txt['upgrade_completed_time_s'], $seconds), '' . "\n"; |
|
427 | + if ($hours > 0) { |
|
428 | + echo "\n" . '', sprintf($txt['upgrade_completed_time_hms'], $hours, $minutes, $seconds), '' . "\n"; |
|
429 | + } elseif ($minutes > 0) { |
|
430 | + echo "\n" . '', sprintf($txt['upgrade_completed_time_ms'], $minutes, $seconds), '' . "\n"; |
|
431 | + } elseif ($seconds > 0) { |
|
432 | + echo "\n" . '', sprintf($txt['upgrade_completed_time_s'], $seconds), '' . "\n"; |
|
433 | + } |
|
412 | 434 | } |
413 | 435 | |
414 | 436 | // Bang - gone! |
@@ -429,8 +451,9 @@ discard block |
||
429 | 451 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
430 | 452 | while ($entry = $dir->read()) |
431 | 453 | { |
432 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
433 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
454 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
455 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
456 | + } |
|
434 | 457 | } |
435 | 458 | $dir->close(); |
436 | 459 | } |
@@ -474,10 +497,11 @@ discard block |
||
474 | 497 | } |
475 | 498 | |
476 | 499 | // Override the language file? |
477 | - if (isset($_GET['lang_file'])) |
|
478 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
479 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
480 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
500 | + if (isset($_GET['lang_file'])) { |
|
501 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
502 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
503 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
504 | + } |
|
481 | 505 | |
482 | 506 | // Make sure it exists, if it doesn't reset it. |
483 | 507 | 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'])) |
@@ -486,12 +510,14 @@ discard block |
||
486 | 510 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
487 | 511 | |
488 | 512 | // If we have english and some other language, use the other language. We Americans hate english :P. |
489 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
490 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
513 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
514 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
515 | + } |
|
491 | 516 | |
492 | 517 | // For backup we load the english at first -> second language overwrite the english one |
493 | - if (count($incontext['detected_languages']) > 1) |
|
494 | - require_once(dirname(__FILE__) . '/Themes/default/languages/Install.english.php'); |
|
518 | + if (count($incontext['detected_languages']) > 1) { |
|
519 | + require_once(dirname(__FILE__) . '/Themes/default/languages/Install.english.php'); |
|
520 | + } |
|
495 | 521 | } |
496 | 522 | |
497 | 523 | // And now include the actual language file itself. |
@@ -499,11 +525,12 @@ discard block |
||
499 | 525 | |
500 | 526 | // Which language did we load? Assume that he likes his language. |
501 | 527 | preg_match('~^Install\.(.+[^-utf8])\.php$~', $_SESSION['installer_temp_lang'], $matches); |
502 | - if (empty($matches[1])) |
|
503 | - $matches = [ |
|
528 | + if (empty($matches[1])) { |
|
529 | + $matches = [ |
|
504 | 530 | 0 => 'nothing', |
505 | 531 | 1 => 'english', |
506 | 532 | ]; |
533 | + } |
|
507 | 534 | $user_info['language'] = $matches[1]; |
508 | 535 | } |
509 | 536 | |
@@ -513,8 +540,9 @@ discard block |
||
513 | 540 | global $upgradeurl, $upcontext, $command_line; |
514 | 541 | |
515 | 542 | // Command line users can't be redirected. |
516 | - if ($command_line) |
|
517 | - upgradeExit(true); |
|
543 | + if ($command_line) { |
|
544 | + upgradeExit(true); |
|
545 | + } |
|
518 | 546 | |
519 | 547 | // Are we providing the core info? |
520 | 548 | if ($addForm) |
@@ -540,12 +568,14 @@ discard block |
||
540 | 568 | define('SMF', 1); |
541 | 569 | |
542 | 570 | // Start the session. |
543 | - if (@ini_get('session.save_handler') == 'user') |
|
544 | - @ini_set('session.save_handler', 'files'); |
|
571 | + if (@ini_get('session.save_handler') == 'user') { |
|
572 | + @ini_set('session.save_handler', 'files'); |
|
573 | + } |
|
545 | 574 | @session_start(); |
546 | 575 | |
547 | - if (empty($smcFunc)) |
|
548 | - $smcFunc = array(); |
|
576 | + if (empty($smcFunc)) { |
|
577 | + $smcFunc = array(); |
|
578 | + } |
|
549 | 579 | |
550 | 580 | // We need this for authentication and some upgrade code |
551 | 581 | require_once($sourcedir . '/Subs-Auth.php'); |
@@ -576,30 +606,34 @@ discard block |
||
576 | 606 | { |
577 | 607 | $options = array('non_fatal' => true); |
578 | 608 | // Add in the port if needed |
579 | - if (!empty($db_port)) |
|
580 | - $options['port'] = $db_port; |
|
609 | + if (!empty($db_port)) { |
|
610 | + $options['port'] = $db_port; |
|
611 | + } |
|
581 | 612 | |
582 | - if (!empty($db_mb4)) |
|
583 | - $options['db_mb4'] = $db_mb4; |
|
613 | + if (!empty($db_mb4)) { |
|
614 | + $options['db_mb4'] = $db_mb4; |
|
615 | + } |
|
584 | 616 | |
585 | 617 | $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $options); |
586 | - } |
|
587 | - else |
|
588 | - // If we've returned here, ping/reconnect to be safe |
|
618 | + } else { |
|
619 | + // If we've returned here, ping/reconnect to be safe |
|
589 | 620 | $smcFunc['db_ping']($db_connection); |
621 | + } |
|
590 | 622 | |
591 | 623 | // Oh dear god!! |
592 | - if ($db_connection === null) |
|
593 | - die('Unable to connect to database - please check username and password are correct in Settings.php'); |
|
624 | + if ($db_connection === null) { |
|
625 | + die('Unable to connect to database - please check username and password are correct in Settings.php'); |
|
626 | + } |
|
594 | 627 | |
595 | - if ($db_type == 'mysql' && isset($db_character_set) && preg_match('~^\w+$~', $db_character_set) === 1) |
|
596 | - $smcFunc['db_query']('', ' |
|
628 | + if ($db_type == 'mysql' && isset($db_character_set) && preg_match('~^\w+$~', $db_character_set) === 1) { |
|
629 | + $smcFunc['db_query']('', ' |
|
597 | 630 | SET NAMES {string:db_character_set}', |
598 | 631 | array( |
599 | 632 | 'db_error_skip' => true, |
600 | 633 | 'db_character_set' => $db_character_set, |
601 | 634 | ) |
602 | 635 | ); |
636 | + } |
|
603 | 637 | |
604 | 638 | // Load the modSettings data... |
605 | 639 | $request = $smcFunc['db_query']('', ' |
@@ -610,11 +644,11 @@ discard block |
||
610 | 644 | ) |
611 | 645 | ); |
612 | 646 | $modSettings = array(); |
613 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
614 | - $modSettings[$row['variable']] = $row['value']; |
|
647 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
648 | + $modSettings[$row['variable']] = $row['value']; |
|
649 | + } |
|
615 | 650 | $smcFunc['db_free_result']($request); |
616 | - } |
|
617 | - else |
|
651 | + } else |
|
618 | 652 | { |
619 | 653 | return throw_error('Cannot find ' . $sourcedir . '/Subs-Db-' . $db_type . '.php' . '. Please check you have uploaded all source files and have the correct paths set.'); |
620 | 654 | } |
@@ -628,9 +662,10 @@ discard block |
||
628 | 662 | cleanRequest(); |
629 | 663 | } |
630 | 664 | |
631 | - if (!isset($_GET['substep'])) |
|
632 | - $_GET['substep'] = 0; |
|
633 | -} |
|
665 | + if (!isset($_GET['substep'])) { |
|
666 | + $_GET['substep'] = 0; |
|
667 | + } |
|
668 | + } |
|
634 | 669 | |
635 | 670 | function initialize_inputs() |
636 | 671 | { |
@@ -660,8 +695,9 @@ discard block |
||
660 | 695 | $dh = opendir(dirname(__FILE__)); |
661 | 696 | while ($file = readdir($dh)) |
662 | 697 | { |
663 | - if (preg_match('~upgrade_\d-\d_([A-Za-z])+\.sql~i', $file, $matches) && isset($matches[1])) |
|
664 | - @unlink(dirname(__FILE__) . '/' . $file); |
|
698 | + if (preg_match('~upgrade_\d-\d_([A-Za-z])+\.sql~i', $file, $matches) && isset($matches[1])) { |
|
699 | + @unlink(dirname(__FILE__) . '/' . $file); |
|
700 | + } |
|
665 | 701 | } |
666 | 702 | closedir($dh); |
667 | 703 | |
@@ -690,8 +726,9 @@ discard block |
||
690 | 726 | $temp = 'upgrade_php?step'; |
691 | 727 | while (strlen($temp) > 4) |
692 | 728 | { |
693 | - if (isset($_GET[$temp])) |
|
694 | - unset($_GET[$temp]); |
|
729 | + if (isset($_GET[$temp])) { |
|
730 | + unset($_GET[$temp]); |
|
731 | + } |
|
695 | 732 | $temp = substr($temp, 1); |
696 | 733 | } |
697 | 734 | |
@@ -718,32 +755,39 @@ discard block |
||
718 | 755 | && @file_exists(dirname(__FILE__) . '/upgrade_2-1_' . $db_type . '.sql'); |
719 | 756 | |
720 | 757 | // Need legacy scripts? |
721 | - if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 2.1) |
|
722 | - $check &= @file_exists(dirname(__FILE__) . '/upgrade_2-0_' . $db_type . '.sql'); |
|
723 | - if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 2.0) |
|
724 | - $check &= @file_exists(dirname(__FILE__) . '/upgrade_1-1.sql'); |
|
725 | - if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 1.1) |
|
726 | - $check &= @file_exists(dirname(__FILE__) . '/upgrade_1-0.sql'); |
|
758 | + if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 2.1) { |
|
759 | + $check &= @file_exists(dirname(__FILE__) . '/upgrade_2-0_' . $db_type . '.sql'); |
|
760 | + } |
|
761 | + if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 2.0) { |
|
762 | + $check &= @file_exists(dirname(__FILE__) . '/upgrade_1-1.sql'); |
|
763 | + } |
|
764 | + if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < 1.1) { |
|
765 | + $check &= @file_exists(dirname(__FILE__) . '/upgrade_1-0.sql'); |
|
766 | + } |
|
727 | 767 | |
728 | 768 | // We don't need "-utf8" files anymore... |
729 | 769 | $upcontext['language'] = str_ireplace('-utf8', '', $upcontext['language']); |
730 | 770 | |
731 | 771 | // This needs to exist! |
732 | - if (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) |
|
733 | - return throw_error('The upgrader could not find the "Install" language file for the forum default language, ' . $upcontext['language'] . '.<br><br>Please make certain you uploaded all the files included in the package, even the theme and language files for the default theme.<br> [<a href="' . $upgradeurl . '?lang=english">Try English</a>]'); |
|
734 | - else |
|
735 | - require_once($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php'); |
|
772 | + if (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) { |
|
773 | + return throw_error('The upgrader could not find the "Install" language file for the forum default language, ' . $upcontext['language'] . '.<br><br>Please make certain you uploaded all the files included in the package, even the theme and language files for the default theme.<br> [<a href="' . $upgradeurl . '?lang=english">Try English</a>]'); |
|
774 | + } else { |
|
775 | + require_once($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php'); |
|
776 | + } |
|
736 | 777 | |
737 | - if (!$check) |
|
738 | - // Don't tell them what files exactly because it's a spot check - just like teachers don't tell which problems they are spot checking, that's dumb. |
|
778 | + if (!$check) { |
|
779 | + // Don't tell them what files exactly because it's a spot check - just like teachers don't tell which problems they are spot checking, that's dumb. |
|
739 | 780 | return throw_error('The upgrader was unable to find some crucial files.<br><br>Please make sure you uploaded all of the files included in the package, including the Themes, Sources, and other directories.'); |
781 | + } |
|
740 | 782 | |
741 | 783 | // Do they meet the install requirements? |
742 | - if (!php_version_check()) |
|
743 | - return throw_error('Warning! You do not appear to have a version of PHP installed on your webserver that meets SMF\'s minimum installations requirements.<br><br>Please ask your host to upgrade.'); |
|
784 | + if (!php_version_check()) { |
|
785 | + return throw_error('Warning! You do not appear to have a version of PHP installed on your webserver that meets SMF\'s minimum installations requirements.<br><br>Please ask your host to upgrade.'); |
|
786 | + } |
|
744 | 787 | |
745 | - if (!db_version_check()) |
|
746 | - return throw_error('Your ' . $databases[$db_type]['name'] . ' version does not meet the minimum requirements of SMF.<br><br>Please ask your host to upgrade.'); |
|
788 | + if (!db_version_check()) { |
|
789 | + return throw_error('Your ' . $databases[$db_type]['name'] . ' version does not meet the minimum requirements of SMF.<br><br>Please ask your host to upgrade.'); |
|
790 | + } |
|
747 | 791 | |
748 | 792 | // Do some checks to make sure they have proper privileges |
749 | 793 | db_extend('packages'); |
@@ -758,14 +802,16 @@ discard block |
||
758 | 802 | $drop = $smcFunc['db_drop_table']('{db_prefix}priv_check'); |
759 | 803 | |
760 | 804 | // Sorry... we need CREATE, ALTER and DROP |
761 | - if (!$create || !$alter || !$drop) |
|
762 | - return throw_error('The ' . $databases[$db_type]['name'] . ' user you have set in Settings.php does not have proper privileges.<br><br>Please ask your host to give this user the ALTER, CREATE, and DROP privileges.'); |
|
805 | + if (!$create || !$alter || !$drop) { |
|
806 | + return throw_error('The ' . $databases[$db_type]['name'] . ' user you have set in Settings.php does not have proper privileges.<br><br>Please ask your host to give this user the ALTER, CREATE, and DROP privileges.'); |
|
807 | + } |
|
763 | 808 | |
764 | 809 | // Do a quick version spot check. |
765 | 810 | $temp = substr(@implode('', @file($boarddir . '/index.php')), 0, 4096); |
766 | 811 | preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $temp, $match); |
767 | - if (empty($match[1]) || (trim($match[1]) != SMF_VERSION)) |
|
768 | - return throw_error('The upgrader found some old or outdated files.<br><br>Please make certain you uploaded the new versions of all the files included in the package.'); |
|
812 | + if (empty($match[1]) || (trim($match[1]) != SMF_VERSION)) { |
|
813 | + return throw_error('The upgrader found some old or outdated files.<br><br>Please make certain you uploaded the new versions of all the files included in the package.'); |
|
814 | + } |
|
769 | 815 | |
770 | 816 | // What absolutely needs to be writable? |
771 | 817 | $writable_files = array( |
@@ -774,12 +820,13 @@ discard block |
||
774 | 820 | ); |
775 | 821 | |
776 | 822 | // Only check for minified writable files if we have it enabled or not set. |
777 | - if (!empty($modSettings['minimize_files']) || !isset($modSettings['minimize_files'])) |
|
778 | - $writable_files += array( |
|
823 | + if (!empty($modSettings['minimize_files']) || !isset($modSettings['minimize_files'])) { |
|
824 | + $writable_files += array( |
|
779 | 825 | $modSettings['theme_dir'] . '/css/minified.css', |
780 | 826 | $modSettings['theme_dir'] . '/scripts/minified.js', |
781 | 827 | $modSettings['theme_dir'] . '/scripts/minified_deferred.js', |
782 | 828 | ); |
829 | + } |
|
783 | 830 | |
784 | 831 | // Do we need to add this setting? |
785 | 832 | $need_settings_update = empty($modSettings['custom_avatar_dir']); |
@@ -791,12 +838,13 @@ discard block |
||
791 | 838 | quickFileWritable($custom_av_dir); |
792 | 839 | |
793 | 840 | // Are we good now? |
794 | - if (!is_writable($custom_av_dir)) |
|
795 | - return throw_error(sprintf('The directory: %1$s has to be writable to continue the upgrade. Please make sure permissions are correctly set to allow this.', $custom_av_dir)); |
|
796 | - elseif ($need_settings_update) |
|
841 | + if (!is_writable($custom_av_dir)) { |
|
842 | + return throw_error(sprintf('The directory: %1$s has to be writable to continue the upgrade. Please make sure permissions are correctly set to allow this.', $custom_av_dir)); |
|
843 | + } elseif ($need_settings_update) |
|
797 | 844 | { |
798 | - if (!function_exists('cache_put_data')) |
|
799 | - require_once($sourcedir . '/Load.php'); |
|
845 | + if (!function_exists('cache_put_data')) { |
|
846 | + require_once($sourcedir . '/Load.php'); |
|
847 | + } |
|
800 | 848 | |
801 | 849 | updateSettings(array('custom_avatar_dir' => $custom_av_dir)); |
802 | 850 | updateSettings(array('custom_avatar_url' => $custom_av_url)); |
@@ -806,29 +854,34 @@ discard block |
||
806 | 854 | |
807 | 855 | // Check the cache directory. |
808 | 856 | $cachedir_temp = empty($cachedir) ? $boarddir . '/cache' : $cachedir; |
809 | - if (!file_exists($cachedir_temp)) |
|
810 | - @mkdir($cachedir_temp); |
|
857 | + if (!file_exists($cachedir_temp)) { |
|
858 | + @mkdir($cachedir_temp); |
|
859 | + } |
|
811 | 860 | |
812 | - if (!file_exists($cachedir_temp)) |
|
813 | - return throw_error('The cache directory could not be found.<br><br>Please make sure you have a directory called "cache" in your forum directory before continuing.'); |
|
861 | + if (!file_exists($cachedir_temp)) { |
|
862 | + return throw_error('The cache directory could not be found.<br><br>Please make sure you have a directory called "cache" in your forum directory before continuing.'); |
|
863 | + } |
|
814 | 864 | |
815 | - if (!file_exists($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php') && !isset($modSettings['smfVersion']) && !isset($_GET['lang'])) |
|
816 | - return throw_error('The upgrader was unable to find language files for the language specified in Settings.php.<br>SMF will not work without the primary language files installed.<br><br>Please either install them, or <a href="' . $upgradeurl . '?step=0;lang=english">use english instead</a>.'); |
|
817 | - elseif (!isset($_GET['skiplang'])) |
|
865 | + if (!file_exists($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php') && !isset($modSettings['smfVersion']) && !isset($_GET['lang'])) { |
|
866 | + return throw_error('The upgrader was unable to find language files for the language specified in Settings.php.<br>SMF will not work without the primary language files installed.<br><br>Please either install them, or <a href="' . $upgradeurl . '?step=0;lang=english">use english instead</a>.'); |
|
867 | + } elseif (!isset($_GET['skiplang'])) |
|
818 | 868 | { |
819 | 869 | $temp = substr(@implode('', @file($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php')), 0, 4096); |
820 | 870 | preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*index(?:[\s]{2}|\*/)~i', $temp, $match); |
821 | 871 | |
822 | - if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) |
|
823 | - return throw_error('The upgrader found some old or outdated language files, for the forum default language, ' . $upcontext['language'] . '.<br><br>Please make certain you uploaded the new versions of all the files included in the package, even the theme and language files for the default theme.<br> [<a href="' . $upgradeurl . '?skiplang">SKIP</a>] [<a href="' . $upgradeurl . '?lang=english">Try English</a>]'); |
|
872 | + if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) { |
|
873 | + return throw_error('The upgrader found some old or outdated language files, for the forum default language, ' . $upcontext['language'] . '.<br><br>Please make certain you uploaded the new versions of all the files included in the package, even the theme and language files for the default theme.<br> [<a href="' . $upgradeurl . '?skiplang">SKIP</a>] [<a href="' . $upgradeurl . '?lang=english">Try English</a>]'); |
|
874 | + } |
|
824 | 875 | } |
825 | 876 | |
826 | - if (!makeFilesWritable($writable_files)) |
|
827 | - return false; |
|
877 | + if (!makeFilesWritable($writable_files)) { |
|
878 | + return false; |
|
879 | + } |
|
828 | 880 | |
829 | 881 | // Check agreement.txt. (it may not exist, in which case $boarddir must be writable.) |
830 | - if (isset($modSettings['agreement']) && (!is_writable($boarddir) || file_exists($boarddir . '/agreement.txt')) && !is_writable($boarddir . '/agreement.txt')) |
|
831 | - return throw_error('The upgrader was unable to obtain write access to agreement.txt.<br><br>If you are using a linux or unix based server, please ensure that the file is chmod\'d to 777, or if it does not exist that the directory this upgrader is in is 777.<br>If your server is running Windows, please ensure that the internet guest account has the proper permissions on it or its folder.'); |
|
882 | + if (isset($modSettings['agreement']) && (!is_writable($boarddir) || file_exists($boarddir . '/agreement.txt')) && !is_writable($boarddir . '/agreement.txt')) { |
|
883 | + return throw_error('The upgrader was unable to obtain write access to agreement.txt.<br><br>If you are using a linux or unix based server, please ensure that the file is chmod\'d to 777, or if it does not exist that the directory this upgrader is in is 777.<br>If your server is running Windows, please ensure that the internet guest account has the proper permissions on it or its folder.'); |
|
884 | + } |
|
832 | 885 | |
833 | 886 | // Upgrade the agreement. |
834 | 887 | elseif (isset($modSettings['agreement'])) |
@@ -839,8 +892,8 @@ discard block |
||
839 | 892 | } |
840 | 893 | |
841 | 894 | // We're going to check that their board dir setting is right in case they've been moving stuff around. |
842 | - if (strtr($boarddir, array('/' => '', '\\' => '')) != strtr(dirname(__FILE__), array('/' => '', '\\' => ''))) |
|
843 | - $upcontext['warning'] = ' |
|
895 | + if (strtr($boarddir, array('/' => '', '\\' => '')) != strtr(dirname(__FILE__), array('/' => '', '\\' => ''))) { |
|
896 | + $upcontext['warning'] = ' |
|
844 | 897 | '. sprintf($txt['upgrade_boarddir_settings'], $boarddir, dirname(__FILE__)) .'<br> |
845 | 898 | <ul> |
846 | 899 | <li>'. $txt['upgrade_boarddir'] .' ' . $boarddir . '</li> |
@@ -848,19 +901,23 @@ discard block |
||
848 | 901 | <li>'. $txt['upgrade_cachedir'] .' ' . $cachedir_temp . '</li> |
849 | 902 | </ul> |
850 | 903 | '. $txt['upgrade_incorrect_settings'] .''; |
904 | + } |
|
851 | 905 | |
852 | 906 | // Confirm mbstring is loaded... |
853 | - if (!extension_loaded('mbstring')) |
|
854 | - return throw_error($txt['install_no_mbstring']); |
|
907 | + if (!extension_loaded('mbstring')) { |
|
908 | + return throw_error($txt['install_no_mbstring']); |
|
909 | + } |
|
855 | 910 | |
856 | 911 | // Check for https stream support. |
857 | 912 | $supported_streams = stream_get_wrappers(); |
858 | - if (!in_array('https', $supported_streams)) |
|
859 | - $upcontext['custom_warning'] = $txt['install_no_https']; |
|
913 | + if (!in_array('https', $supported_streams)) { |
|
914 | + $upcontext['custom_warning'] = $txt['install_no_https']; |
|
915 | + } |
|
860 | 916 | |
861 | 917 | // Either we're logged in or we're going to present the login. |
862 | - if (checkLogin()) |
|
863 | - return true; |
|
918 | + if (checkLogin()) { |
|
919 | + return true; |
|
920 | + } |
|
864 | 921 | |
865 | 922 | $upcontext += createToken('login'); |
866 | 923 | |
@@ -874,15 +931,17 @@ discard block |
||
874 | 931 | global $smcFunc, $db_type, $support_js; |
875 | 932 | |
876 | 933 | // Don't bother if the security is disabled. |
877 | - if ($disable_security) |
|
878 | - return true; |
|
934 | + if ($disable_security) { |
|
935 | + return true; |
|
936 | + } |
|
879 | 937 | |
880 | 938 | // Are we trying to login? |
881 | 939 | if (isset($_POST['contbutt']) && (!empty($_POST['user']))) |
882 | 940 | { |
883 | 941 | // If we've disabled security pick a suitable name! |
884 | - if (empty($_POST['user'])) |
|
885 | - $_POST['user'] = 'Administrator'; |
|
942 | + if (empty($_POST['user'])) { |
|
943 | + $_POST['user'] = 'Administrator'; |
|
944 | + } |
|
886 | 945 | |
887 | 946 | // Before 2.0 these column names were different! |
888 | 947 | $oldDB = false; |
@@ -897,16 +956,17 @@ discard block |
||
897 | 956 | 'db_error_skip' => true, |
898 | 957 | ) |
899 | 958 | ); |
900 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
901 | - $oldDB = true; |
|
959 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
960 | + $oldDB = true; |
|
961 | + } |
|
902 | 962 | $smcFunc['db_free_result']($request); |
903 | 963 | } |
904 | 964 | |
905 | 965 | // Get what we believe to be their details. |
906 | 966 | if (!$disable_security) |
907 | 967 | { |
908 | - if ($oldDB) |
|
909 | - $request = $smcFunc['db_query']('', ' |
|
968 | + if ($oldDB) { |
|
969 | + $request = $smcFunc['db_query']('', ' |
|
910 | 970 | SELECT id_member, memberName AS member_name, passwd, id_group, |
911 | 971 | additionalGroups AS additional_groups, lngfile |
912 | 972 | FROM {db_prefix}members |
@@ -916,8 +976,8 @@ discard block |
||
916 | 976 | 'db_error_skip' => true, |
917 | 977 | ) |
918 | 978 | ); |
919 | - else |
|
920 | - $request = $smcFunc['db_query']('', ' |
|
979 | + } else { |
|
980 | + $request = $smcFunc['db_query']('', ' |
|
921 | 981 | SELECT id_member, member_name, passwd, id_group, additional_groups, lngfile |
922 | 982 | FROM {db_prefix}members |
923 | 983 | WHERE member_name = {string:member_name}', |
@@ -926,6 +986,7 @@ discard block |
||
926 | 986 | 'db_error_skip' => true, |
927 | 987 | ) |
928 | 988 | ); |
989 | + } |
|
929 | 990 | if ($smcFunc['db_num_rows']($request) != 0) |
930 | 991 | { |
931 | 992 | list ($id_member, $name, $password, $id_group, $addGroups, $user_language) = $smcFunc['db_fetch_row']($request); |
@@ -933,16 +994,17 @@ discard block |
||
933 | 994 | $groups = explode(',', $addGroups); |
934 | 995 | $groups[] = $id_group; |
935 | 996 | |
936 | - foreach ($groups as $k => $v) |
|
937 | - $groups[$k] = (int) $v; |
|
997 | + foreach ($groups as $k => $v) { |
|
998 | + $groups[$k] = (int) $v; |
|
999 | + } |
|
938 | 1000 | |
939 | 1001 | $sha_passwd = sha1(strtolower($name) . un_htmlspecialchars($_REQUEST['passwrd'])); |
940 | 1002 | |
941 | 1003 | // We don't use "-utf8" anymore... |
942 | 1004 | $user_language = str_ireplace('-utf8', '', $user_language); |
1005 | + } else { |
|
1006 | + $upcontext['username_incorrect'] = true; |
|
943 | 1007 | } |
944 | - else |
|
945 | - $upcontext['username_incorrect'] = true; |
|
946 | 1008 | |
947 | 1009 | $smcFunc['db_free_result']($request); |
948 | 1010 | } |
@@ -953,13 +1015,14 @@ discard block |
||
953 | 1015 | { |
954 | 1016 | $upcontext['upgrade_status']['js'] = 1; |
955 | 1017 | $support_js = 1; |
1018 | + } else { |
|
1019 | + $support_js = 0; |
|
956 | 1020 | } |
957 | - else |
|
958 | - $support_js = 0; |
|
959 | 1021 | |
960 | 1022 | // Note down the version we are coming from. |
961 | - if (!empty($modSettings['smfVersion']) && empty($upcontext['user']['version'])) |
|
962 | - $upcontext['user']['version'] = $modSettings['smfVersion']; |
|
1023 | + if (!empty($modSettings['smfVersion']) && empty($upcontext['user']['version'])) { |
|
1024 | + $upcontext['user']['version'] = $modSettings['smfVersion']; |
|
1025 | + } |
|
963 | 1026 | |
964 | 1027 | // Didn't get anywhere? |
965 | 1028 | if (!$disable_security && (empty($sha_passwd) || (!empty($password) ? $password : '') != $sha_passwd) && !hash_verify_password((!empty($name) ? $name : ''), $_REQUEST['passwrd'], (!empty($password) ? $password : '')) && empty($upcontext['username_incorrect'])) |
@@ -993,15 +1056,15 @@ discard block |
||
993 | 1056 | 'db_error_skip' => true, |
994 | 1057 | ) |
995 | 1058 | ); |
996 | - if ($smcFunc['db_num_rows']($request) == 0) |
|
997 | - return throw_error('You need to be an admin to perform an upgrade!'); |
|
1059 | + if ($smcFunc['db_num_rows']($request) == 0) { |
|
1060 | + return throw_error('You need to be an admin to perform an upgrade!'); |
|
1061 | + } |
|
998 | 1062 | $smcFunc['db_free_result']($request); |
999 | 1063 | } |
1000 | 1064 | |
1001 | 1065 | $upcontext['user']['id'] = $id_member; |
1002 | 1066 | $upcontext['user']['name'] = $name; |
1003 | - } |
|
1004 | - else |
|
1067 | + } else |
|
1005 | 1068 | { |
1006 | 1069 | $upcontext['user']['id'] = 1; |
1007 | 1070 | $upcontext['user']['name'] = 'Administrator'; |
@@ -1017,11 +1080,11 @@ discard block |
||
1017 | 1080 | $temp = substr(@implode('', @file($modSettings['theme_dir'] . '/languages/index.' . $user_language . '.php')), 0, 4096); |
1018 | 1081 | preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*index(?:[\s]{2}|\*/)~i', $temp, $match); |
1019 | 1082 | |
1020 | - if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) |
|
1021 | - $upcontext['upgrade_options_warning'] = 'The language files for your selected language, ' . $user_language . ', have not been updated to the latest version. Upgrade will continue with the forum default, ' . $upcontext['language'] . '.'; |
|
1022 | - elseif (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . basename($user_language, '.lng') . '.php')) |
|
1023 | - $upcontext['upgrade_options_warning'] = 'The language files for your selected language, ' . $user_language . ', have not been uploaded/updated as the "Install" language file is missing. Upgrade will continue with the forum default, ' . $upcontext['language'] . '.'; |
|
1024 | - else |
|
1083 | + if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) { |
|
1084 | + $upcontext['upgrade_options_warning'] = 'The language files for your selected language, ' . $user_language . ', have not been updated to the latest version. Upgrade will continue with the forum default, ' . $upcontext['language'] . '.'; |
|
1085 | + } elseif (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . basename($user_language, '.lng') . '.php')) { |
|
1086 | + $upcontext['upgrade_options_warning'] = 'The language files for your selected language, ' . $user_language . ', have not been uploaded/updated as the "Install" language file is missing. Upgrade will continue with the forum default, ' . $upcontext['language'] . '.'; |
|
1087 | + } else |
|
1025 | 1088 | { |
1026 | 1089 | // Set this as the new language. |
1027 | 1090 | $upcontext['language'] = $user_language; |
@@ -1065,8 +1128,9 @@ discard block |
||
1065 | 1128 | unset($member_columns); |
1066 | 1129 | |
1067 | 1130 | // If we've not submitted then we're done. |
1068 | - if (empty($_POST['upcont'])) |
|
1069 | - return false; |
|
1131 | + if (empty($_POST['upcont'])) { |
|
1132 | + return false; |
|
1133 | + } |
|
1070 | 1134 | |
1071 | 1135 | // Firstly, if they're enabling SM stat collection just do it. |
1072 | 1136 | if (!empty($_POST['stats']) && substr($boardurl, 0, 16) != 'http://localhost' && empty($modSettings['allow_sm_stats']) && empty($modSettings['enable_sm_stats'])) |
@@ -1086,16 +1150,17 @@ discard block |
||
1086 | 1150 | fwrite($fp, $out); |
1087 | 1151 | |
1088 | 1152 | $return_data = ''; |
1089 | - while (!feof($fp)) |
|
1090 | - $return_data .= fgets($fp, 128); |
|
1153 | + while (!feof($fp)) { |
|
1154 | + $return_data .= fgets($fp, 128); |
|
1155 | + } |
|
1091 | 1156 | |
1092 | 1157 | fclose($fp); |
1093 | 1158 | |
1094 | 1159 | // Get the unique site ID. |
1095 | 1160 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
1096 | 1161 | |
1097 | - if (!empty($ID[1])) |
|
1098 | - $smcFunc['db_insert']('replace', |
|
1162 | + if (!empty($ID[1])) { |
|
1163 | + $smcFunc['db_insert']('replace', |
|
1099 | 1164 | $db_prefix . 'settings', |
1100 | 1165 | array('variable' => 'string', 'value' => 'string'), |
1101 | 1166 | array( |
@@ -1104,9 +1169,9 @@ discard block |
||
1104 | 1169 | ), |
1105 | 1170 | array('variable') |
1106 | 1171 | ); |
1172 | + } |
|
1107 | 1173 | } |
1108 | - } |
|
1109 | - else |
|
1174 | + } else |
|
1110 | 1175 | { |
1111 | 1176 | $smcFunc['db_insert']('replace', |
1112 | 1177 | $db_prefix . 'settings', |
@@ -1117,8 +1182,8 @@ discard block |
||
1117 | 1182 | } |
1118 | 1183 | } |
1119 | 1184 | // Don't remove stat collection unless we unchecked the box for real, not from the loop. |
1120 | - elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) |
|
1121 | - $smcFunc['db_query']('', ' |
|
1185 | + elseif (empty($_POST['stats']) && empty($upcontext['allow_sm_stats'])) { |
|
1186 | + $smcFunc['db_query']('', ' |
|
1122 | 1187 | DELETE FROM {db_prefix}settings |
1123 | 1188 | WHERE variable = {string:enable_sm_stats}', |
1124 | 1189 | array( |
@@ -1126,6 +1191,7 @@ discard block |
||
1126 | 1191 | 'db_error_skip' => true, |
1127 | 1192 | ) |
1128 | 1193 | ); |
1194 | + } |
|
1129 | 1195 | |
1130 | 1196 | // Deleting old karma stuff? |
1131 | 1197 | if (!empty($_POST['delete_karma'])) |
@@ -1140,20 +1206,22 @@ discard block |
||
1140 | 1206 | ); |
1141 | 1207 | |
1142 | 1208 | // Cleaning up old karma member settings. |
1143 | - if ($upcontext['karma_installed']['good']) |
|
1144 | - $smcFunc['db_query']('', ' |
|
1209 | + if ($upcontext['karma_installed']['good']) { |
|
1210 | + $smcFunc['db_query']('', ' |
|
1145 | 1211 | ALTER TABLE {db_prefix}members |
1146 | 1212 | DROP karma_good', |
1147 | 1213 | array() |
1148 | 1214 | ); |
1215 | + } |
|
1149 | 1216 | |
1150 | 1217 | // Does karma bad was enable? |
1151 | - if ($upcontext['karma_installed']['bad']) |
|
1152 | - $smcFunc['db_query']('', ' |
|
1218 | + if ($upcontext['karma_installed']['bad']) { |
|
1219 | + $smcFunc['db_query']('', ' |
|
1153 | 1220 | ALTER TABLE {db_prefix}members |
1154 | 1221 | DROP karma_bad', |
1155 | 1222 | array() |
1156 | 1223 | ); |
1224 | + } |
|
1157 | 1225 | |
1158 | 1226 | // Cleaning up old karma permissions. |
1159 | 1227 | $smcFunc['db_query']('', ' |
@@ -1171,32 +1239,37 @@ discard block |
||
1171 | 1239 | } |
1172 | 1240 | |
1173 | 1241 | // Emptying the error log? |
1174 | - if (!empty($_POST['empty_error'])) |
|
1175 | - $smcFunc['db_query']('truncate_table', ' |
|
1242 | + if (!empty($_POST['empty_error'])) { |
|
1243 | + $smcFunc['db_query']('truncate_table', ' |
|
1176 | 1244 | TRUNCATE {db_prefix}log_errors', |
1177 | 1245 | array( |
1178 | 1246 | ) |
1179 | 1247 | ); |
1248 | + } |
|
1180 | 1249 | |
1181 | 1250 | $changes = array(); |
1182 | 1251 | |
1183 | 1252 | // Add proxy settings. |
1184 | - if (!isset($GLOBALS['image_proxy_maxsize'])) |
|
1185 | - $changes += array( |
|
1253 | + if (!isset($GLOBALS['image_proxy_maxsize'])) { |
|
1254 | + $changes += array( |
|
1186 | 1255 | 'image_proxy_secret' => '\'' . substr(sha1(mt_rand()), 0, 20) . '\'', |
1187 | 1256 | 'image_proxy_maxsize' => 5190, |
1188 | 1257 | 'image_proxy_enabled' => 0, |
1189 | 1258 | ); |
1259 | + } |
|
1190 | 1260 | |
1191 | 1261 | // If $boardurl reflects https, set force_ssl |
1192 | - if (!function_exists('cache_put_data')) |
|
1193 | - require_once($sourcedir . '/Load.php'); |
|
1194 | - if (stripos($boardurl, 'https://') !== false) |
|
1195 | - updateSettings(array('force_ssl' => '1')); |
|
1262 | + if (!function_exists('cache_put_data')) { |
|
1263 | + require_once($sourcedir . '/Load.php'); |
|
1264 | + } |
|
1265 | + if (stripos($boardurl, 'https://') !== false) { |
|
1266 | + updateSettings(array('force_ssl' => '1')); |
|
1267 | + } |
|
1196 | 1268 | |
1197 | 1269 | // If we're overriding the language follow it through. |
1198 | - if (isset($_GET['lang']) && file_exists($modSettings['theme_dir'] . '/languages/index.' . $_GET['lang'] . '.php')) |
|
1199 | - $changes['language'] = '\'' . $_GET['lang'] . '\''; |
|
1270 | + if (isset($_GET['lang']) && file_exists($modSettings['theme_dir'] . '/languages/index.' . $_GET['lang'] . '.php')) { |
|
1271 | + $changes['language'] = '\'' . $_GET['lang'] . '\''; |
|
1272 | + } |
|
1200 | 1273 | |
1201 | 1274 | if (!empty($_POST['maint'])) |
1202 | 1275 | { |
@@ -1208,26 +1281,29 @@ discard block |
||
1208 | 1281 | { |
1209 | 1282 | $changes['mtitle'] = '\'' . addslashes($_POST['maintitle']) . '\''; |
1210 | 1283 | $changes['mmessage'] = '\'' . addslashes($_POST['mainmessage']) . '\''; |
1211 | - } |
|
1212 | - else |
|
1284 | + } else |
|
1213 | 1285 | { |
1214 | 1286 | $changes['mtitle'] = '\'Upgrading the forum...\''; |
1215 | 1287 | $changes['mmessage'] = '\'Don\\\'t worry, we will be back shortly with an updated forum. It will only be a minute ;).\''; |
1216 | 1288 | } |
1217 | 1289 | } |
1218 | 1290 | |
1219 | - if ($command_line) |
|
1220 | - echo ' * Updating Settings.php...'; |
|
1291 | + if ($command_line) { |
|
1292 | + echo ' * Updating Settings.php...'; |
|
1293 | + } |
|
1221 | 1294 | |
1222 | 1295 | // Fix some old paths. |
1223 | - if (substr($boarddir, 0, 1) == '.') |
|
1224 | - $changes['boarddir'] = '\'' . fixRelativePath($boarddir) . '\''; |
|
1296 | + if (substr($boarddir, 0, 1) == '.') { |
|
1297 | + $changes['boarddir'] = '\'' . fixRelativePath($boarddir) . '\''; |
|
1298 | + } |
|
1225 | 1299 | |
1226 | - if (substr($sourcedir, 0, 1) == '.') |
|
1227 | - $changes['sourcedir'] = '\'' . fixRelativePath($sourcedir) . '\''; |
|
1300 | + if (substr($sourcedir, 0, 1) == '.') { |
|
1301 | + $changes['sourcedir'] = '\'' . fixRelativePath($sourcedir) . '\''; |
|
1302 | + } |
|
1228 | 1303 | |
1229 | - if (empty($cachedir) || substr($cachedir, 0, 1) == '.') |
|
1230 | - $changes['cachedir'] = '\'' . fixRelativePath($boarddir) . '/cache\''; |
|
1304 | + if (empty($cachedir) || substr($cachedir, 0, 1) == '.') { |
|
1305 | + $changes['cachedir'] = '\'' . fixRelativePath($boarddir) . '/cache\''; |
|
1306 | + } |
|
1231 | 1307 | |
1232 | 1308 | // If they have a "host:port" setup for the host, split that into separate values |
1233 | 1309 | // You should never have a : in the hostname if you're not on MySQL, but better safe than sorry |
@@ -1238,32 +1314,36 @@ discard block |
||
1238 | 1314 | $changes['db_server'] = '\'' . $db_server . '\''; |
1239 | 1315 | |
1240 | 1316 | // Only set this if we're not using the default port |
1241 | - if ($db_port != ini_get('mysqli.default_port')) |
|
1242 | - $changes['db_port'] = (int) $db_port; |
|
1243 | - } |
|
1244 | - elseif (!empty($db_port)) |
|
1317 | + if ($db_port != ini_get('mysqli.default_port')) { |
|
1318 | + $changes['db_port'] = (int) $db_port; |
|
1319 | + } |
|
1320 | + } elseif (!empty($db_port)) |
|
1245 | 1321 | { |
1246 | 1322 | // If db_port is set and is the same as the default, set it to '' |
1247 | 1323 | if ($db_type == 'mysql') |
1248 | 1324 | { |
1249 | - if ($db_port == ini_get('mysqli.default_port')) |
|
1250 | - $changes['db_port'] = '\'\''; |
|
1251 | - elseif ($db_type == 'postgresql' && $db_port == 5432) |
|
1252 | - $changes['db_port'] = '\'\''; |
|
1325 | + if ($db_port == ini_get('mysqli.default_port')) { |
|
1326 | + $changes['db_port'] = '\'\''; |
|
1327 | + } elseif ($db_type == 'postgresql' && $db_port == 5432) { |
|
1328 | + $changes['db_port'] = '\'\''; |
|
1329 | + } |
|
1253 | 1330 | } |
1254 | 1331 | } |
1255 | 1332 | |
1256 | 1333 | // Maybe we haven't had this option yet? |
1257 | - if (empty($packagesdir)) |
|
1258 | - $changes['packagesdir'] = '\'' . fixRelativePath($boarddir) . '/Packages\''; |
|
1334 | + if (empty($packagesdir)) { |
|
1335 | + $changes['packagesdir'] = '\'' . fixRelativePath($boarddir) . '/Packages\''; |
|
1336 | + } |
|
1259 | 1337 | |
1260 | 1338 | // Add support for $tasksdir var. |
1261 | - if (empty($tasksdir)) |
|
1262 | - $changes['tasksdir'] = '\'' . fixRelativePath($sourcedir) . '/tasks\''; |
|
1339 | + if (empty($tasksdir)) { |
|
1340 | + $changes['tasksdir'] = '\'' . fixRelativePath($sourcedir) . '/tasks\''; |
|
1341 | + } |
|
1263 | 1342 | |
1264 | 1343 | // Make sure we fix the language as well. |
1265 | - if (stristr($language, '-utf8')) |
|
1266 | - $changes['language'] = '\'' . str_ireplace('-utf8', '', $language) . '\''; |
|
1344 | + if (stristr($language, '-utf8')) { |
|
1345 | + $changes['language'] = '\'' . str_ireplace('-utf8', '', $language) . '\''; |
|
1346 | + } |
|
1267 | 1347 | |
1268 | 1348 | // @todo Maybe change the cookie name if going to 1.1, too? |
1269 | 1349 | |
@@ -1274,8 +1354,9 @@ discard block |
||
1274 | 1354 | // Tell Settings.php to store db_last_error.php in the cache |
1275 | 1355 | move_db_last_error_to_cachedir(); |
1276 | 1356 | |
1277 | - if ($command_line) |
|
1278 | - echo ' Successful.' . "\n"; |
|
1357 | + if ($command_line) { |
|
1358 | + echo ' Successful.' . "\n"; |
|
1359 | + } |
|
1279 | 1360 | |
1280 | 1361 | // Are we doing debug? |
1281 | 1362 | if (isset($_POST['debug'])) |
@@ -1285,8 +1366,9 @@ discard block |
||
1285 | 1366 | } |
1286 | 1367 | |
1287 | 1368 | // If we're not backing up then jump one. |
1288 | - if (empty($_POST['backup'])) |
|
1289 | - $upcontext['current_step']++; |
|
1369 | + if (empty($_POST['backup'])) { |
|
1370 | + $upcontext['current_step']++; |
|
1371 | + } |
|
1290 | 1372 | |
1291 | 1373 | // If we've got here then let's proceed to the next step! |
1292 | 1374 | return true; |
@@ -1301,8 +1383,9 @@ discard block |
||
1301 | 1383 | $upcontext['page_title'] = $txt['backup_database']; |
1302 | 1384 | |
1303 | 1385 | // Done it already - js wise? |
1304 | - if (!empty($_POST['backup_done'])) |
|
1305 | - return true; |
|
1386 | + if (!empty($_POST['backup_done'])) { |
|
1387 | + return true; |
|
1388 | + } |
|
1306 | 1389 | |
1307 | 1390 | // Some useful stuff here. |
1308 | 1391 | db_extend(); |
@@ -1316,9 +1399,10 @@ discard block |
||
1316 | 1399 | $tables = $smcFunc['db_list_tables']($db, $filter); |
1317 | 1400 | |
1318 | 1401 | $table_names = array(); |
1319 | - foreach ($tables as $table) |
|
1320 | - if (substr($table, 0, 7) !== 'backup_') |
|
1402 | + foreach ($tables as $table) { |
|
1403 | + if (substr($table, 0, 7) !== 'backup_') |
|
1321 | 1404 | $table_names[] = $table; |
1405 | + } |
|
1322 | 1406 | |
1323 | 1407 | $upcontext['table_count'] = count($table_names); |
1324 | 1408 | $upcontext['cur_table_num'] = $_GET['substep']; |
@@ -1328,12 +1412,14 @@ discard block |
||
1328 | 1412 | $file_steps = $upcontext['table_count']; |
1329 | 1413 | |
1330 | 1414 | // What ones have we already done? |
1331 | - foreach ($table_names as $id => $table) |
|
1332 | - if ($id < $_GET['substep']) |
|
1415 | + foreach ($table_names as $id => $table) { |
|
1416 | + if ($id < $_GET['substep']) |
|
1333 | 1417 | $upcontext['previous_tables'][] = $table; |
1418 | + } |
|
1334 | 1419 | |
1335 | - if ($command_line) |
|
1336 | - echo 'Backing Up Tables.'; |
|
1420 | + if ($command_line) { |
|
1421 | + echo 'Backing Up Tables.'; |
|
1422 | + } |
|
1337 | 1423 | |
1338 | 1424 | // If we don't support javascript we backup here. |
1339 | 1425 | if (!$support_js || isset($_GET['xml'])) |
@@ -1352,8 +1438,9 @@ discard block |
||
1352 | 1438 | backupTable($table_names[$substep]); |
1353 | 1439 | |
1354 | 1440 | // If this is XML to keep it nice for the user do one table at a time anyway! |
1355 | - if (isset($_GET['xml'])) |
|
1356 | - return upgradeExit(); |
|
1441 | + if (isset($_GET['xml'])) { |
|
1442 | + return upgradeExit(); |
|
1443 | + } |
|
1357 | 1444 | } |
1358 | 1445 | |
1359 | 1446 | if ($command_line) |
@@ -1386,9 +1473,10 @@ discard block |
||
1386 | 1473 | |
1387 | 1474 | $smcFunc['db_backup_table']($table, 'backup_' . $table); |
1388 | 1475 | |
1389 | - if ($command_line) |
|
1390 | - echo ' done.'; |
|
1391 | -} |
|
1476 | + if ($command_line) { |
|
1477 | + echo ' done.'; |
|
1478 | + } |
|
1479 | + } |
|
1392 | 1480 | |
1393 | 1481 | // Step 2: Everything. |
1394 | 1482 | function DatabaseChanges() |
@@ -1397,8 +1485,9 @@ discard block |
||
1397 | 1485 | global $upcontext, $support_js, $db_type; |
1398 | 1486 | |
1399 | 1487 | // Have we just completed this? |
1400 | - if (!empty($_POST['database_done'])) |
|
1401 | - return true; |
|
1488 | + if (!empty($_POST['database_done'])) { |
|
1489 | + return true; |
|
1490 | + } |
|
1402 | 1491 | |
1403 | 1492 | $upcontext['sub_template'] = isset($_GET['xml']) ? 'database_xml' : 'database_changes'; |
1404 | 1493 | $upcontext['page_title'] = $txt['database_changes']; |
@@ -1413,15 +1502,16 @@ discard block |
||
1413 | 1502 | ); |
1414 | 1503 | |
1415 | 1504 | // How many files are there in total? |
1416 | - if (isset($_GET['filecount'])) |
|
1417 | - $upcontext['file_count'] = (int) $_GET['filecount']; |
|
1418 | - else |
|
1505 | + if (isset($_GET['filecount'])) { |
|
1506 | + $upcontext['file_count'] = (int) $_GET['filecount']; |
|
1507 | + } else |
|
1419 | 1508 | { |
1420 | 1509 | $upcontext['file_count'] = 0; |
1421 | 1510 | foreach ($files as $file) |
1422 | 1511 | { |
1423 | - if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < $file[1]) |
|
1424 | - $upcontext['file_count']++; |
|
1512 | + if (!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] < $file[1]) { |
|
1513 | + $upcontext['file_count']++; |
|
1514 | + } |
|
1425 | 1515 | } |
1426 | 1516 | } |
1427 | 1517 | |
@@ -1431,9 +1521,9 @@ discard block |
||
1431 | 1521 | $upcontext['cur_file_num'] = 0; |
1432 | 1522 | foreach ($files as $file) |
1433 | 1523 | { |
1434 | - if ($did_not_do) |
|
1435 | - $did_not_do--; |
|
1436 | - else |
|
1524 | + if ($did_not_do) { |
|
1525 | + $did_not_do--; |
|
1526 | + } else |
|
1437 | 1527 | { |
1438 | 1528 | $upcontext['cur_file_num']++; |
1439 | 1529 | $upcontext['cur_file_name'] = $file[0]; |
@@ -1460,12 +1550,13 @@ discard block |
||
1460 | 1550 | // Flag to move on to the next. |
1461 | 1551 | $upcontext['completed_step'] = true; |
1462 | 1552 | // Did we complete the whole file? |
1463 | - if ($nextFile) |
|
1464 | - $upcontext['current_debug_item_num'] = -1; |
|
1553 | + if ($nextFile) { |
|
1554 | + $upcontext['current_debug_item_num'] = -1; |
|
1555 | + } |
|
1465 | 1556 | return upgradeExit(); |
1557 | + } elseif ($support_js) { |
|
1558 | + break; |
|
1466 | 1559 | } |
1467 | - elseif ($support_js) |
|
1468 | - break; |
|
1469 | 1560 | } |
1470 | 1561 | // Set the progress bar to be right as if we had - even if we hadn't... |
1471 | 1562 | $upcontext['step_progress'] = ($upcontext['cur_file_num'] / $upcontext['file_count']) * 100; |
@@ -1491,8 +1582,9 @@ discard block |
||
1491 | 1582 | global $user_info, $maintenance, $smcFunc, $db_type, $txt, $settings; |
1492 | 1583 | |
1493 | 1584 | // Now it's nice to have some of the basic SMF source files. |
1494 | - if (!isset($_GET['ssi']) && !$command_line) |
|
1495 | - redirectLocation('&ssi=1'); |
|
1585 | + if (!isset($_GET['ssi']) && !$command_line) { |
|
1586 | + redirectLocation('&ssi=1'); |
|
1587 | + } |
|
1496 | 1588 | |
1497 | 1589 | $upcontext['sub_template'] = 'upgrade_complete'; |
1498 | 1590 | $upcontext['page_title'] = $txt['upgrade_complete']; |
@@ -1508,14 +1600,16 @@ discard block |
||
1508 | 1600 | // Are we in maintenance mode? |
1509 | 1601 | if (isset($upcontext['user']['main'])) |
1510 | 1602 | { |
1511 | - if ($command_line) |
|
1512 | - echo ' * '; |
|
1603 | + if ($command_line) { |
|
1604 | + echo ' * '; |
|
1605 | + } |
|
1513 | 1606 | $upcontext['removed_maintenance'] = true; |
1514 | 1607 | $changes['maintenance'] = $upcontext['user']['main']; |
1515 | 1608 | } |
1516 | 1609 | // Otherwise if somehow we are in 2 let's go to 1. |
1517 | - elseif (!empty($maintenance) && $maintenance == 2) |
|
1518 | - $changes['maintenance'] = 1; |
|
1610 | + elseif (!empty($maintenance) && $maintenance == 2) { |
|
1611 | + $changes['maintenance'] = 1; |
|
1612 | + } |
|
1519 | 1613 | |
1520 | 1614 | // Wipe this out... |
1521 | 1615 | $upcontext['user'] = array(); |
@@ -1530,21 +1624,23 @@ discard block |
||
1530 | 1624 | $upcontext['can_delete_script'] = is_writable(dirname(__FILE__)) || is_writable(__FILE__); |
1531 | 1625 | |
1532 | 1626 | // Now is the perfect time to fetch the SM files. |
1533 | - if ($command_line) |
|
1534 | - cli_scheduled_fetchSMfiles(); |
|
1535 | - else |
|
1627 | + if ($command_line) { |
|
1628 | + cli_scheduled_fetchSMfiles(); |
|
1629 | + } else |
|
1536 | 1630 | { |
1537 | 1631 | require_once($sourcedir . '/ScheduledTasks.php'); |
1538 | 1632 | $forum_version = SMF_VERSION; // The variable is usually defined in index.php so lets just use the constant to do it for us. |
1539 | 1633 | scheduled_fetchSMfiles(); // Now go get those files! |
1540 | 1634 | // This is needed in case someone invokes the upgrader using https when upgrading an http forum |
1541 | - if (httpsOn()) |
|
1542 | - $settings['default_theme_url'] = strtr($settings['default_theme_url'], array('http://' => 'https://')); |
|
1635 | + if (httpsOn()) { |
|
1636 | + $settings['default_theme_url'] = strtr($settings['default_theme_url'], array('http://' => 'https://')); |
|
1637 | + } |
|
1543 | 1638 | } |
1544 | 1639 | |
1545 | 1640 | // Log what we've done. |
1546 | - if (empty($user_info['id'])) |
|
1547 | - $user_info['id'] = !empty($upcontext['user']['id']) ? $upcontext['user']['id'] : 0; |
|
1641 | + if (empty($user_info['id'])) { |
|
1642 | + $user_info['id'] = !empty($upcontext['user']['id']) ? $upcontext['user']['id'] : 0; |
|
1643 | + } |
|
1548 | 1644 | |
1549 | 1645 | // Log the action manually, so CLI still works. |
1550 | 1646 | $smcFunc['db_insert']('', |
@@ -1563,8 +1659,9 @@ discard block |
||
1563 | 1659 | |
1564 | 1660 | // Save the current database version. |
1565 | 1661 | $server_version = $smcFunc['db_server_info'](); |
1566 | - if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
1567 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1662 | + if ($db_type == 'mysql' && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
1663 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1664 | + } |
|
1568 | 1665 | |
1569 | 1666 | if ($command_line) |
1570 | 1667 | { |
@@ -1576,8 +1673,9 @@ discard block |
||
1576 | 1673 | |
1577 | 1674 | // Make sure it says we're done. |
1578 | 1675 | $upcontext['overall_percent'] = 100; |
1579 | - if (isset($upcontext['step_progress'])) |
|
1580 | - unset($upcontext['step_progress']); |
|
1676 | + if (isset($upcontext['step_progress'])) { |
|
1677 | + unset($upcontext['step_progress']); |
|
1678 | + } |
|
1581 | 1679 | |
1582 | 1680 | $_GET['substep'] = 0; |
1583 | 1681 | return false; |
@@ -1588,8 +1686,9 @@ discard block |
||
1588 | 1686 | { |
1589 | 1687 | global $sourcedir, $language, $forum_version, $modSettings, $smcFunc; |
1590 | 1688 | |
1591 | - if (empty($modSettings['time_format'])) |
|
1592 | - $modSettings['time_format'] = '%B %d, %Y, %I:%M:%S %p'; |
|
1689 | + if (empty($modSettings['time_format'])) { |
|
1690 | + $modSettings['time_format'] = '%B %d, %Y, %I:%M:%S %p'; |
|
1691 | + } |
|
1593 | 1692 | |
1594 | 1693 | // What files do we want to get |
1595 | 1694 | $request = $smcFunc['db_query']('', ' |
@@ -1623,8 +1722,9 @@ discard block |
||
1623 | 1722 | $file_data = fetch_web_data($url); |
1624 | 1723 | |
1625 | 1724 | // If we got an error - give up - the site might be down. |
1626 | - if ($file_data === false) |
|
1627 | - return throw_error(sprintf('Could not retrieve the file %1$s.', $url)); |
|
1725 | + if ($file_data === false) { |
|
1726 | + return throw_error(sprintf('Could not retrieve the file %1$s.', $url)); |
|
1727 | + } |
|
1628 | 1728 | |
1629 | 1729 | // Save the file to the database. |
1630 | 1730 | $smcFunc['db_query']('substring', ' |
@@ -1666,8 +1766,9 @@ discard block |
||
1666 | 1766 | $themeData = array(); |
1667 | 1767 | foreach ($values as $variable => $value) |
1668 | 1768 | { |
1669 | - if (!isset($value) || $value === null) |
|
1670 | - $value = 0; |
|
1769 | + if (!isset($value) || $value === null) { |
|
1770 | + $value = 0; |
|
1771 | + } |
|
1671 | 1772 | |
1672 | 1773 | $themeData[] = array(0, 1, $variable, $value); |
1673 | 1774 | } |
@@ -1696,8 +1797,9 @@ discard block |
||
1696 | 1797 | |
1697 | 1798 | foreach ($values as $variable => $value) |
1698 | 1799 | { |
1699 | - if (empty($modSettings[$value[0]])) |
|
1700 | - continue; |
|
1800 | + if (empty($modSettings[$value[0]])) { |
|
1801 | + continue; |
|
1802 | + } |
|
1701 | 1803 | |
1702 | 1804 | $smcFunc['db_query']('', ' |
1703 | 1805 | INSERT IGNORE INTO {db_prefix}themes |
@@ -1783,19 +1885,21 @@ discard block |
||
1783 | 1885 | set_error_handler( |
1784 | 1886 | function ($errno, $errstr, $errfile, $errline) use ($support_js) |
1785 | 1887 | { |
1786 | - if ($support_js) |
|
1787 | - return true; |
|
1788 | - else |
|
1789 | - echo 'Error: ' . $errstr . ' File: ' . $errfile . ' Line: ' . $errline; |
|
1888 | + if ($support_js) { |
|
1889 | + return true; |
|
1890 | + } else { |
|
1891 | + echo 'Error: ' . $errstr . ' File: ' . $errfile . ' Line: ' . $errline; |
|
1892 | + } |
|
1790 | 1893 | } |
1791 | 1894 | ); |
1792 | 1895 | |
1793 | 1896 | // If we're on MySQL, set {db_collation}; this approach is used throughout upgrade_2-0_mysql.php to set new tables to utf8 |
1794 | 1897 | // Note it is expected to be in the format: ENGINE=MyISAM{$db_collation}; |
1795 | - if ($db_type == 'mysql') |
|
1796 | - $db_collation = ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
1797 | - else |
|
1798 | - $db_collation = ''; |
|
1898 | + if ($db_type == 'mysql') { |
|
1899 | + $db_collation = ' DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; |
|
1900 | + } else { |
|
1901 | + $db_collation = ''; |
|
1902 | + } |
|
1799 | 1903 | |
1800 | 1904 | $endl = $command_line ? "\n" : '<br>' . "\n"; |
1801 | 1905 | |
@@ -1807,8 +1911,9 @@ discard block |
||
1807 | 1911 | $last_step = ''; |
1808 | 1912 | |
1809 | 1913 | // Make sure all newly created tables will have the proper characters set; this approach is used throughout upgrade_2-1_mysql.php |
1810 | - if (isset($db_character_set) && $db_character_set === 'utf8') |
|
1811 | - $lines = str_replace(') ENGINE=MyISAM;', ') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;', $lines); |
|
1914 | + if (isset($db_character_set) && $db_character_set === 'utf8') { |
|
1915 | + $lines = str_replace(') ENGINE=MyISAM;', ') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;', $lines); |
|
1916 | + } |
|
1812 | 1917 | |
1813 | 1918 | // Count the total number of steps within this file - for progress. |
1814 | 1919 | $file_steps = substr_count(implode('', $lines), '---#'); |
@@ -1828,15 +1933,18 @@ discard block |
||
1828 | 1933 | $do_current = $substep >= $_GET['substep']; |
1829 | 1934 | |
1830 | 1935 | // Get rid of any comments in the beginning of the line... |
1831 | - if (substr(trim($line), 0, 2) === '/*') |
|
1832 | - $line = preg_replace('~/\*.+?\*/~', '', $line); |
|
1936 | + if (substr(trim($line), 0, 2) === '/*') { |
|
1937 | + $line = preg_replace('~/\*.+?\*/~', '', $line); |
|
1938 | + } |
|
1833 | 1939 | |
1834 | 1940 | // Always flush. Flush, flush, flush. Flush, flush, flush, flush! FLUSH! |
1835 | - if ($is_debug && !$support_js && $command_line) |
|
1836 | - flush(); |
|
1941 | + if ($is_debug && !$support_js && $command_line) { |
|
1942 | + flush(); |
|
1943 | + } |
|
1837 | 1944 | |
1838 | - if (trim($line) === '') |
|
1839 | - continue; |
|
1945 | + if (trim($line) === '') { |
|
1946 | + continue; |
|
1947 | + } |
|
1840 | 1948 | |
1841 | 1949 | if (trim(substr($line, 0, 3)) === '---') |
1842 | 1950 | { |
@@ -1846,8 +1954,9 @@ discard block |
||
1846 | 1954 | if (trim($current_data) != '' && $type !== '}') |
1847 | 1955 | { |
1848 | 1956 | $upcontext['error_message'] = 'Error in upgrade script - line ' . $line_number . '!' . $endl; |
1849 | - if ($command_line) |
|
1850 | - echo $upcontext['error_message']; |
|
1957 | + if ($command_line) { |
|
1958 | + echo $upcontext['error_message']; |
|
1959 | + } |
|
1851 | 1960 | } |
1852 | 1961 | |
1853 | 1962 | if ($type == ' ') |
@@ -1865,17 +1974,18 @@ discard block |
||
1865 | 1974 | if ($do_current) |
1866 | 1975 | { |
1867 | 1976 | $upcontext['actioned_items'][] = $last_step; |
1868 | - if ($command_line) |
|
1869 | - echo ' * '; |
|
1977 | + if ($command_line) { |
|
1978 | + echo ' * '; |
|
1979 | + } |
|
1870 | 1980 | } |
1871 | - } |
|
1872 | - elseif ($type == '#') |
|
1981 | + } elseif ($type == '#') |
|
1873 | 1982 | { |
1874 | 1983 | $upcontext['step_progress'] += (100 / $upcontext['file_count']) / $file_steps; |
1875 | 1984 | |
1876 | 1985 | $upcontext['current_debug_item_num']++; |
1877 | - if (trim($line) != '---#') |
|
1878 | - $upcontext['current_debug_item_name'] = htmlspecialchars(rtrim(substr($line, 4))); |
|
1986 | + if (trim($line) != '---#') { |
|
1987 | + $upcontext['current_debug_item_name'] = htmlspecialchars(rtrim(substr($line, 4))); |
|
1988 | + } |
|
1879 | 1989 | |
1880 | 1990 | // Have we already done something? |
1881 | 1991 | if (isset($_GET['xml']) && $done_something) |
@@ -1886,34 +1996,36 @@ discard block |
||
1886 | 1996 | |
1887 | 1997 | if ($do_current) |
1888 | 1998 | { |
1889 | - if (trim($line) == '---#' && $command_line) |
|
1890 | - echo ' done.', $endl; |
|
1891 | - elseif ($command_line) |
|
1892 | - echo ' +++ ', rtrim(substr($line, 4)); |
|
1893 | - elseif (trim($line) != '---#') |
|
1999 | + if (trim($line) == '---#' && $command_line) { |
|
2000 | + echo ' done.', $endl; |
|
2001 | + } elseif ($command_line) { |
|
2002 | + echo ' +++ ', rtrim(substr($line, 4)); |
|
2003 | + } elseif (trim($line) != '---#') |
|
1894 | 2004 | { |
1895 | - if ($is_debug) |
|
1896 | - $upcontext['actioned_items'][] = htmlspecialchars(rtrim(substr($line, 4))); |
|
2005 | + if ($is_debug) { |
|
2006 | + $upcontext['actioned_items'][] = htmlspecialchars(rtrim(substr($line, 4))); |
|
2007 | + } |
|
1897 | 2008 | } |
1898 | 2009 | } |
1899 | 2010 | |
1900 | 2011 | if ($substep < $_GET['substep'] && $substep + 1 >= $_GET['substep']) |
1901 | 2012 | { |
1902 | - if ($command_line) |
|
1903 | - echo ' * '; |
|
1904 | - else |
|
1905 | - $upcontext['actioned_items'][] = $last_step; |
|
2013 | + if ($command_line) { |
|
2014 | + echo ' * '; |
|
2015 | + } else { |
|
2016 | + $upcontext['actioned_items'][] = $last_step; |
|
2017 | + } |
|
1906 | 2018 | } |
1907 | 2019 | |
1908 | 2020 | // Small step - only if we're actually doing stuff. |
1909 | - if ($do_current) |
|
1910 | - nextSubstep(++$substep); |
|
1911 | - else |
|
1912 | - $substep++; |
|
1913 | - } |
|
1914 | - elseif ($type == '{') |
|
1915 | - $current_type = 'code'; |
|
1916 | - elseif ($type == '}') |
|
2021 | + if ($do_current) { |
|
2022 | + nextSubstep(++$substep); |
|
2023 | + } else { |
|
2024 | + $substep++; |
|
2025 | + } |
|
2026 | + } elseif ($type == '{') { |
|
2027 | + $current_type = 'code'; |
|
2028 | + } elseif ($type == '}') |
|
1917 | 2029 | { |
1918 | 2030 | $current_type = 'sql'; |
1919 | 2031 | |
@@ -1926,8 +2038,9 @@ discard block |
||
1926 | 2038 | if (eval('global $db_prefix, $modSettings, $smcFunc, $txt; ' . $current_data) === false) |
1927 | 2039 | { |
1928 | 2040 | $upcontext['error_message'] = 'Error in upgrade script ' . basename($filename) . ' on line ' . $line_number . '!' . $endl; |
1929 | - if ($command_line) |
|
1930 | - echo $upcontext['error_message']; |
|
2041 | + if ($command_line) { |
|
2042 | + echo $upcontext['error_message']; |
|
2043 | + } |
|
1931 | 2044 | } |
1932 | 2045 | |
1933 | 2046 | // Done with code! |
@@ -2015,8 +2128,9 @@ discard block |
||
2015 | 2128 | $db_unbuffered = false; |
2016 | 2129 | |
2017 | 2130 | // Failure?! |
2018 | - if ($result !== false) |
|
2019 | - return $result; |
|
2131 | + if ($result !== false) { |
|
2132 | + return $result; |
|
2133 | + } |
|
2020 | 2134 | |
2021 | 2135 | $db_error_message = $smcFunc['db_error']($db_connection); |
2022 | 2136 | // If MySQL we do something more clever. |
@@ -2044,54 +2158,61 @@ discard block |
||
2044 | 2158 | { |
2045 | 2159 | mysqli_query($db_connection, 'REPAIR TABLE `' . $match[1] . '`'); |
2046 | 2160 | $result = mysqli_query($db_connection, $string); |
2047 | - if ($result !== false) |
|
2048 | - return $result; |
|
2161 | + if ($result !== false) { |
|
2162 | + return $result; |
|
2163 | + } |
|
2049 | 2164 | } |
2050 | - } |
|
2051 | - elseif ($mysqli_errno == 2013) |
|
2165 | + } elseif ($mysqli_errno == 2013) |
|
2052 | 2166 | { |
2053 | 2167 | $db_connection = mysqli_connect($db_server, $db_user, $db_passwd); |
2054 | 2168 | mysqli_select_db($db_connection, $db_name); |
2055 | 2169 | if ($db_connection) |
2056 | 2170 | { |
2057 | 2171 | $result = mysqli_query($db_connection, $string); |
2058 | - if ($result !== false) |
|
2059 | - return $result; |
|
2172 | + if ($result !== false) { |
|
2173 | + return $result; |
|
2174 | + } |
|
2060 | 2175 | } |
2061 | 2176 | } |
2062 | 2177 | // Duplicate column name... should be okay ;). |
2063 | - elseif (in_array($mysqli_errno, array(1060, 1061, 1068, 1091))) |
|
2064 | - return false; |
|
2178 | + elseif (in_array($mysqli_errno, array(1060, 1061, 1068, 1091))) { |
|
2179 | + return false; |
|
2180 | + } |
|
2065 | 2181 | // Duplicate insert... make sure it's the proper type of query ;). |
2066 | - elseif (in_array($mysqli_errno, array(1054, 1062, 1146)) && $error_query) |
|
2067 | - return false; |
|
2182 | + elseif (in_array($mysqli_errno, array(1054, 1062, 1146)) && $error_query) { |
|
2183 | + return false; |
|
2184 | + } |
|
2068 | 2185 | // Creating an index on a non-existent column. |
2069 | - elseif ($mysqli_errno == 1072) |
|
2070 | - return false; |
|
2071 | - elseif ($mysqli_errno == 1050 && substr(trim($string), 0, 12) == 'RENAME TABLE') |
|
2072 | - return false; |
|
2186 | + elseif ($mysqli_errno == 1072) { |
|
2187 | + return false; |
|
2188 | + } elseif ($mysqli_errno == 1050 && substr(trim($string), 0, 12) == 'RENAME TABLE') { |
|
2189 | + return false; |
|
2190 | + } |
|
2073 | 2191 | } |
2074 | 2192 | // If a table already exists don't go potty. |
2075 | 2193 | else |
2076 | 2194 | { |
2077 | 2195 | if (in_array(substr(trim($string), 0, 8), array('CREATE T', 'CREATE S', 'DROP TABL', 'ALTER TA', 'CREATE I', 'CREATE U'))) |
2078 | 2196 | { |
2079 | - if (strpos($db_error_message, 'exist') !== false) |
|
2080 | - return true; |
|
2081 | - } |
|
2082 | - elseif (strpos(trim($string), 'INSERT ') !== false) |
|
2197 | + if (strpos($db_error_message, 'exist') !== false) { |
|
2198 | + return true; |
|
2199 | + } |
|
2200 | + } elseif (strpos(trim($string), 'INSERT ') !== false) |
|
2083 | 2201 | { |
2084 | - if (strpos($db_error_message, 'duplicate') !== false || $ignore_insert_error) |
|
2085 | - return true; |
|
2202 | + if (strpos($db_error_message, 'duplicate') !== false || $ignore_insert_error) { |
|
2203 | + return true; |
|
2204 | + } |
|
2086 | 2205 | } |
2087 | 2206 | } |
2088 | 2207 | |
2089 | 2208 | // Get the query string so we pass everything. |
2090 | 2209 | $query_string = ''; |
2091 | - foreach ($_GET as $k => $v) |
|
2092 | - $query_string .= ';' . $k . '=' . $v; |
|
2093 | - if (strlen($query_string) != 0) |
|
2094 | - $query_string = '?' . substr($query_string, 1); |
|
2210 | + foreach ($_GET as $k => $v) { |
|
2211 | + $query_string .= ';' . $k . '=' . $v; |
|
2212 | + } |
|
2213 | + if (strlen($query_string) != 0) { |
|
2214 | + $query_string = '?' . substr($query_string, 1); |
|
2215 | + } |
|
2095 | 2216 | |
2096 | 2217 | if ($command_line) |
2097 | 2218 | { |
@@ -2146,16 +2267,18 @@ discard block |
||
2146 | 2267 | { |
2147 | 2268 | $found |= 1; |
2148 | 2269 | // Do some checks on the data if we have it set. |
2149 | - if (isset($change['col_type'])) |
|
2150 | - $found &= $change['col_type'] === $column['type']; |
|
2151 | - if (isset($change['null_allowed'])) |
|
2152 | - $found &= $column['null'] == $change['null_allowed']; |
|
2153 | - if (isset($change['default'])) |
|
2154 | - $found &= $change['default'] === $column['default']; |
|
2270 | + if (isset($change['col_type'])) { |
|
2271 | + $found &= $change['col_type'] === $column['type']; |
|
2272 | + } |
|
2273 | + if (isset($change['null_allowed'])) { |
|
2274 | + $found &= $column['null'] == $change['null_allowed']; |
|
2275 | + } |
|
2276 | + if (isset($change['default'])) { |
|
2277 | + $found &= $change['default'] === $column['default']; |
|
2278 | + } |
|
2155 | 2279 | } |
2156 | 2280 | } |
2157 | - } |
|
2158 | - elseif ($change['type'] === 'index') |
|
2281 | + } elseif ($change['type'] === 'index') |
|
2159 | 2282 | { |
2160 | 2283 | $request = upgrade_query(' |
2161 | 2284 | SHOW INDEX |
@@ -2164,9 +2287,10 @@ discard block |
||
2164 | 2287 | { |
2165 | 2288 | $cur_index = array(); |
2166 | 2289 | |
2167 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2168 | - if ($row['Key_name'] === $change['name']) |
|
2290 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2291 | + if ($row['Key_name'] === $change['name']) |
|
2169 | 2292 | $cur_index[(int) $row['Seq_in_index']] = $row['Column_name']; |
2293 | + } |
|
2170 | 2294 | |
2171 | 2295 | ksort($cur_index, SORT_NUMERIC); |
2172 | 2296 | $found = array_values($cur_index) === $change['target_columns']; |
@@ -2176,14 +2300,17 @@ discard block |
||
2176 | 2300 | } |
2177 | 2301 | |
2178 | 2302 | // If we're trying to add and it's added, we're done. |
2179 | - if ($found && in_array($change['method'], array('add', 'change'))) |
|
2180 | - return true; |
|
2303 | + if ($found && in_array($change['method'], array('add', 'change'))) { |
|
2304 | + return true; |
|
2305 | + } |
|
2181 | 2306 | // Otherwise if we're removing and it wasn't found we're also done. |
2182 | - elseif (!$found && in_array($change['method'], array('remove', 'change_remove'))) |
|
2183 | - return true; |
|
2307 | + elseif (!$found && in_array($change['method'], array('remove', 'change_remove'))) { |
|
2308 | + return true; |
|
2309 | + } |
|
2184 | 2310 | // Otherwise is it just a test? |
2185 | - elseif ($is_test) |
|
2186 | - return false; |
|
2311 | + elseif ($is_test) { |
|
2312 | + return false; |
|
2313 | + } |
|
2187 | 2314 | |
2188 | 2315 | // Not found it yet? Bummer! How about we see if we're currently doing it? |
2189 | 2316 | $running = false; |
@@ -2194,8 +2321,9 @@ discard block |
||
2194 | 2321 | SHOW FULL PROCESSLIST'); |
2195 | 2322 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
2196 | 2323 | { |
2197 | - if (strpos($row['Info'], 'ALTER TABLE ' . $db_prefix . $change['table']) !== false && strpos($row['Info'], $change['text']) !== false) |
|
2198 | - $found = true; |
|
2324 | + if (strpos($row['Info'], 'ALTER TABLE ' . $db_prefix . $change['table']) !== false && strpos($row['Info'], $change['text']) !== false) { |
|
2325 | + $found = true; |
|
2326 | + } |
|
2199 | 2327 | } |
2200 | 2328 | |
2201 | 2329 | // Can't find it? Then we need to run it fools! |
@@ -2207,8 +2335,9 @@ discard block |
||
2207 | 2335 | ALTER TABLE ' . $db_prefix . $change['table'] . ' |
2208 | 2336 | ' . $change['text'], true) !== false; |
2209 | 2337 | |
2210 | - if (!$success) |
|
2211 | - return false; |
|
2338 | + if (!$success) { |
|
2339 | + return false; |
|
2340 | + } |
|
2212 | 2341 | |
2213 | 2342 | // Return |
2214 | 2343 | $running = true; |
@@ -2250,8 +2379,9 @@ discard block |
||
2250 | 2379 | 'db_error_skip' => true, |
2251 | 2380 | ) |
2252 | 2381 | ); |
2253 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
2254 | - die('Unable to find column ' . $change['column'] . ' inside table ' . $db_prefix . $change['table']); |
|
2382 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
2383 | + die('Unable to find column ' . $change['column'] . ' inside table ' . $db_prefix . $change['table']); |
|
2384 | + } |
|
2255 | 2385 | $table_row = $smcFunc['db_fetch_assoc']($request); |
2256 | 2386 | $smcFunc['db_free_result']($request); |
2257 | 2387 | |
@@ -2273,18 +2403,19 @@ discard block |
||
2273 | 2403 | ) |
2274 | 2404 | ); |
2275 | 2405 | // No results? Just forget it all together. |
2276 | - if ($smcFunc['db_num_rows']($request) === 0) |
|
2277 | - unset($table_row['Collation']); |
|
2278 | - else |
|
2279 | - $collation_info = $smcFunc['db_fetch_assoc']($request); |
|
2406 | + if ($smcFunc['db_num_rows']($request) === 0) { |
|
2407 | + unset($table_row['Collation']); |
|
2408 | + } else { |
|
2409 | + $collation_info = $smcFunc['db_fetch_assoc']($request); |
|
2410 | + } |
|
2280 | 2411 | $smcFunc['db_free_result']($request); |
2281 | 2412 | } |
2282 | 2413 | |
2283 | 2414 | if ($column_fix) |
2284 | 2415 | { |
2285 | 2416 | // Make sure there are no NULL's left. |
2286 | - if ($null_fix) |
|
2287 | - $smcFunc['db_query']('', ' |
|
2417 | + if ($null_fix) { |
|
2418 | + $smcFunc['db_query']('', ' |
|
2288 | 2419 | UPDATE {db_prefix}' . $change['table'] . ' |
2289 | 2420 | SET ' . $change['column'] . ' = {string:default} |
2290 | 2421 | WHERE ' . $change['column'] . ' IS NULL', |
@@ -2293,6 +2424,7 @@ discard block |
||
2293 | 2424 | 'db_error_skip' => true, |
2294 | 2425 | ) |
2295 | 2426 | ); |
2427 | + } |
|
2296 | 2428 | |
2297 | 2429 | // Do the actual alteration. |
2298 | 2430 | $smcFunc['db_query']('', ' |
@@ -2321,8 +2453,9 @@ discard block |
||
2321 | 2453 | } |
2322 | 2454 | |
2323 | 2455 | // Not a column we need to check on? |
2324 | - if (!in_array($change['name'], array('memberGroups', 'passwordSalt'))) |
|
2325 | - return; |
|
2456 | + if (!in_array($change['name'], array('memberGroups', 'passwordSalt'))) { |
|
2457 | + return; |
|
2458 | + } |
|
2326 | 2459 | |
2327 | 2460 | // Break it up you (six|seven). |
2328 | 2461 | $temp = explode(' ', str_replace('NOT NULL', 'NOT_NULL', $change['text'])); |
@@ -2341,13 +2474,13 @@ discard block |
||
2341 | 2474 | 'new_name' => $temp[2], |
2342 | 2475 | )); |
2343 | 2476 | // !!! This doesn't technically work because we don't pass request into it, but it hasn't broke anything yet. |
2344 | - if ($smcFunc['db_num_rows'] != 1) |
|
2345 | - return; |
|
2477 | + if ($smcFunc['db_num_rows'] != 1) { |
|
2478 | + return; |
|
2479 | + } |
|
2346 | 2480 | |
2347 | 2481 | list (, $current_type) = $smcFunc['db_fetch_assoc']($request); |
2348 | 2482 | $smcFunc['db_free_result']($request); |
2349 | - } |
|
2350 | - else |
|
2483 | + } else |
|
2351 | 2484 | { |
2352 | 2485 | // Do this the old fashion, sure method way. |
2353 | 2486 | $request = $smcFunc['db_query']('', ' |
@@ -2358,21 +2491,24 @@ discard block |
||
2358 | 2491 | )); |
2359 | 2492 | // Mayday! |
2360 | 2493 | // !!! This doesn't technically work because we don't pass request into it, but it hasn't broke anything yet. |
2361 | - if ($smcFunc['db_num_rows'] == 0) |
|
2362 | - return; |
|
2494 | + if ($smcFunc['db_num_rows'] == 0) { |
|
2495 | + return; |
|
2496 | + } |
|
2363 | 2497 | |
2364 | 2498 | // Oh where, oh where has my little field gone. Oh where can it be... |
2365 | - while ($row = $smcFunc['db_query']($request)) |
|
2366 | - if ($row['Field'] == $temp[1] || $row['Field'] == $temp[2]) |
|
2499 | + while ($row = $smcFunc['db_query']($request)) { |
|
2500 | + if ($row['Field'] == $temp[1] || $row['Field'] == $temp[2]) |
|
2367 | 2501 | { |
2368 | 2502 | $current_type = $row['Type']; |
2503 | + } |
|
2369 | 2504 | break; |
2370 | 2505 | } |
2371 | 2506 | } |
2372 | 2507 | |
2373 | 2508 | // If this doesn't match, the column may of been altered for a reason. |
2374 | - if (trim($current_type) != trim($temp[3])) |
|
2375 | - $temp[3] = $current_type; |
|
2509 | + if (trim($current_type) != trim($temp[3])) { |
|
2510 | + $temp[3] = $current_type; |
|
2511 | + } |
|
2376 | 2512 | |
2377 | 2513 | // Piece this back together. |
2378 | 2514 | $change['text'] = str_replace('NOT_NULL', 'NOT NULL', implode(' ', $temp)); |
@@ -2384,8 +2520,9 @@ discard block |
||
2384 | 2520 | global $start_time, $timeLimitThreshold, $command_line, $custom_warning; |
2385 | 2521 | global $step_progress, $is_debug, $upcontext; |
2386 | 2522 | |
2387 | - if ($_GET['substep'] < $substep) |
|
2388 | - $_GET['substep'] = $substep; |
|
2523 | + if ($_GET['substep'] < $substep) { |
|
2524 | + $_GET['substep'] = $substep; |
|
2525 | + } |
|
2389 | 2526 | |
2390 | 2527 | if ($command_line) |
2391 | 2528 | { |
@@ -2398,29 +2535,33 @@ discard block |
||
2398 | 2535 | } |
2399 | 2536 | |
2400 | 2537 | @set_time_limit(300); |
2401 | - if (function_exists('apache_reset_timeout')) |
|
2402 | - @apache_reset_timeout(); |
|
2538 | + if (function_exists('apache_reset_timeout')) { |
|
2539 | + @apache_reset_timeout(); |
|
2540 | + } |
|
2403 | 2541 | |
2404 | - if (time() - $start_time <= $timeLimitThreshold) |
|
2405 | - return; |
|
2542 | + if (time() - $start_time <= $timeLimitThreshold) { |
|
2543 | + return; |
|
2544 | + } |
|
2406 | 2545 | |
2407 | 2546 | // Do we have some custom step progress stuff? |
2408 | 2547 | if (!empty($step_progress)) |
2409 | 2548 | { |
2410 | 2549 | $upcontext['substep_progress'] = 0; |
2411 | 2550 | $upcontext['substep_progress_name'] = $step_progress['name']; |
2412 | - if ($step_progress['current'] > $step_progress['total']) |
|
2413 | - $upcontext['substep_progress'] = 99.9; |
|
2414 | - else |
|
2415 | - $upcontext['substep_progress'] = ($step_progress['current'] / $step_progress['total']) * 100; |
|
2551 | + if ($step_progress['current'] > $step_progress['total']) { |
|
2552 | + $upcontext['substep_progress'] = 99.9; |
|
2553 | + } else { |
|
2554 | + $upcontext['substep_progress'] = ($step_progress['current'] / $step_progress['total']) * 100; |
|
2555 | + } |
|
2416 | 2556 | |
2417 | 2557 | // Make it nicely rounded. |
2418 | 2558 | $upcontext['substep_progress'] = round($upcontext['substep_progress'], 1); |
2419 | 2559 | } |
2420 | 2560 | |
2421 | 2561 | // If this is XML we just exit right away! |
2422 | - if (isset($_GET['xml'])) |
|
2423 | - return upgradeExit(); |
|
2562 | + if (isset($_GET['xml'])) { |
|
2563 | + return upgradeExit(); |
|
2564 | + } |
|
2424 | 2565 | |
2425 | 2566 | // We're going to pause after this! |
2426 | 2567 | $upcontext['pause'] = true; |
@@ -2428,13 +2569,15 @@ discard block |
||
2428 | 2569 | $upcontext['query_string'] = ''; |
2429 | 2570 | foreach ($_GET as $k => $v) |
2430 | 2571 | { |
2431 | - if ($k != 'data' && $k != 'substep' && $k != 'step') |
|
2432 | - $upcontext['query_string'] .= ';' . $k . '=' . $v; |
|
2572 | + if ($k != 'data' && $k != 'substep' && $k != 'step') { |
|
2573 | + $upcontext['query_string'] .= ';' . $k . '=' . $v; |
|
2574 | + } |
|
2433 | 2575 | } |
2434 | 2576 | |
2435 | 2577 | // Custom warning? |
2436 | - if (!empty($custom_warning)) |
|
2437 | - $upcontext['custom_warning'] = $custom_warning; |
|
2578 | + if (!empty($custom_warning)) { |
|
2579 | + $upcontext['custom_warning'] = $custom_warning; |
|
2580 | + } |
|
2438 | 2581 | |
2439 | 2582 | upgradeExit(); |
2440 | 2583 | } |
@@ -2449,25 +2592,26 @@ discard block |
||
2449 | 2592 | ob_implicit_flush(true); |
2450 | 2593 | @set_time_limit(600); |
2451 | 2594 | |
2452 | - if (!isset($_SERVER['argv'])) |
|
2453 | - $_SERVER['argv'] = array(); |
|
2595 | + if (!isset($_SERVER['argv'])) { |
|
2596 | + $_SERVER['argv'] = array(); |
|
2597 | + } |
|
2454 | 2598 | $_GET['maint'] = 1; |
2455 | 2599 | |
2456 | 2600 | foreach ($_SERVER['argv'] as $i => $arg) |
2457 | 2601 | { |
2458 | - if (preg_match('~^--language=(.+)$~', $arg, $match) != 0) |
|
2459 | - $_GET['lang'] = $match[1]; |
|
2460 | - elseif (preg_match('~^--path=(.+)$~', $arg) != 0) |
|
2461 | - continue; |
|
2462 | - elseif ($arg == '--no-maintenance') |
|
2463 | - $_GET['maint'] = 0; |
|
2464 | - elseif ($arg == '--debug') |
|
2465 | - $is_debug = true; |
|
2466 | - elseif ($arg == '--backup') |
|
2467 | - $_POST['backup'] = 1; |
|
2468 | - elseif ($arg == '--template' && (file_exists($boarddir . '/template.php') || file_exists($boarddir . '/template.html') && !file_exists($modSettings['theme_dir'] . '/converted'))) |
|
2469 | - $_GET['conv'] = 1; |
|
2470 | - elseif ($i != 0) |
|
2602 | + if (preg_match('~^--language=(.+)$~', $arg, $match) != 0) { |
|
2603 | + $_GET['lang'] = $match[1]; |
|
2604 | + } elseif (preg_match('~^--path=(.+)$~', $arg) != 0) { |
|
2605 | + continue; |
|
2606 | + } elseif ($arg == '--no-maintenance') { |
|
2607 | + $_GET['maint'] = 0; |
|
2608 | + } elseif ($arg == '--debug') { |
|
2609 | + $is_debug = true; |
|
2610 | + } elseif ($arg == '--backup') { |
|
2611 | + $_POST['backup'] = 1; |
|
2612 | + } elseif ($arg == '--template' && (file_exists($boarddir . '/template.php') || file_exists($boarddir . '/template.html') && !file_exists($modSettings['theme_dir'] . '/converted'))) { |
|
2613 | + $_GET['conv'] = 1; |
|
2614 | + } elseif ($i != 0) |
|
2471 | 2615 | { |
2472 | 2616 | echo 'SMF Command-line Upgrader |
2473 | 2617 | Usage: /path/to/php -f ' . basename(__FILE__) . ' -- [OPTION]... |
@@ -2481,10 +2625,12 @@ discard block |
||
2481 | 2625 | } |
2482 | 2626 | } |
2483 | 2627 | |
2484 | - if (!php_version_check()) |
|
2485 | - print_error('Error: PHP ' . PHP_VERSION . ' does not match version requirements.', true); |
|
2486 | - if (!db_version_check()) |
|
2487 | - print_error('Error: ' . $databases[$db_type]['name'] . ' ' . $databases[$db_type]['version'] . ' does not match minimum requirements.', true); |
|
2628 | + if (!php_version_check()) { |
|
2629 | + print_error('Error: PHP ' . PHP_VERSION . ' does not match version requirements.', true); |
|
2630 | + } |
|
2631 | + if (!db_version_check()) { |
|
2632 | + print_error('Error: ' . $databases[$db_type]['name'] . ' ' . $databases[$db_type]['version'] . ' does not match minimum requirements.', true); |
|
2633 | + } |
|
2488 | 2634 | |
2489 | 2635 | // Do some checks to make sure they have proper privileges |
2490 | 2636 | db_extend('packages'); |
@@ -2499,34 +2645,39 @@ discard block |
||
2499 | 2645 | $drop = $smcFunc['db_drop_table']('{db_prefix}priv_check'); |
2500 | 2646 | |
2501 | 2647 | // Sorry... we need CREATE, ALTER and DROP |
2502 | - if (!$create || !$alter || !$drop) |
|
2503 | - print_error("The " . $databases[$db_type]['name'] . " user you have set in Settings.php does not have proper privileges.\n\nPlease ask your host to give this user the ALTER, CREATE, and DROP privileges.", true); |
|
2648 | + if (!$create || !$alter || !$drop) { |
|
2649 | + print_error("The " . $databases[$db_type]['name'] . " user you have set in Settings.php does not have proper privileges.\n\nPlease ask your host to give this user the ALTER, CREATE, and DROP privileges.", true); |
|
2650 | + } |
|
2504 | 2651 | |
2505 | 2652 | $check = @file_exists($modSettings['theme_dir'] . '/index.template.php') |
2506 | 2653 | && @file_exists($sourcedir . '/QueryString.php') |
2507 | 2654 | && @file_exists($sourcedir . '/ManageBoards.php'); |
2508 | - if (!$check && !isset($modSettings['smfVersion'])) |
|
2509 | - print_error('Error: Some files are missing or out-of-date.', true); |
|
2655 | + if (!$check && !isset($modSettings['smfVersion'])) { |
|
2656 | + print_error('Error: Some files are missing or out-of-date.', true); |
|
2657 | + } |
|
2510 | 2658 | |
2511 | 2659 | // Do a quick version spot check. |
2512 | 2660 | $temp = substr(@implode('', @file($boarddir . '/index.php')), 0, 4096); |
2513 | 2661 | preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $temp, $match); |
2514 | - if (empty($match[1]) || (trim($match[1]) != SMF_VERSION)) |
|
2515 | - print_error('Error: Some files have not yet been updated properly.'); |
|
2662 | + if (empty($match[1]) || (trim($match[1]) != SMF_VERSION)) { |
|
2663 | + print_error('Error: Some files have not yet been updated properly.'); |
|
2664 | + } |
|
2516 | 2665 | |
2517 | 2666 | // Make sure Settings.php is writable. |
2518 | 2667 | quickFileWritable($boarddir . '/Settings.php'); |
2519 | - if (!is_writable($boarddir . '/Settings.php')) |
|
2520 | - print_error('Error: Unable to obtain write access to "Settings.php".', true); |
|
2668 | + if (!is_writable($boarddir . '/Settings.php')) { |
|
2669 | + print_error('Error: Unable to obtain write access to "Settings.php".', true); |
|
2670 | + } |
|
2521 | 2671 | |
2522 | 2672 | // Make sure Settings_bak.php is writable. |
2523 | 2673 | quickFileWritable($boarddir . '/Settings_bak.php'); |
2524 | - if (!is_writable($boarddir . '/Settings_bak.php')) |
|
2525 | - print_error('Error: Unable to obtain write access to "Settings_bak.php".'); |
|
2674 | + if (!is_writable($boarddir . '/Settings_bak.php')) { |
|
2675 | + print_error('Error: Unable to obtain write access to "Settings_bak.php".'); |
|
2676 | + } |
|
2526 | 2677 | |
2527 | - if (isset($modSettings['agreement']) && (!is_writable($boarddir) || file_exists($boarddir . '/agreement.txt')) && !is_writable($boarddir . '/agreement.txt')) |
|
2528 | - print_error('Error: Unable to obtain write access to "agreement.txt".'); |
|
2529 | - elseif (isset($modSettings['agreement'])) |
|
2678 | + if (isset($modSettings['agreement']) && (!is_writable($boarddir) || file_exists($boarddir . '/agreement.txt')) && !is_writable($boarddir . '/agreement.txt')) { |
|
2679 | + print_error('Error: Unable to obtain write access to "agreement.txt".'); |
|
2680 | + } elseif (isset($modSettings['agreement'])) |
|
2530 | 2681 | { |
2531 | 2682 | $fp = fopen($boarddir . '/agreement.txt', 'w'); |
2532 | 2683 | fwrite($fp, $modSettings['agreement']); |
@@ -2536,36 +2687,42 @@ discard block |
||
2536 | 2687 | // Make sure Themes is writable. |
2537 | 2688 | quickFileWritable($modSettings['theme_dir']); |
2538 | 2689 | |
2539 | - if (!is_writable($modSettings['theme_dir']) && !isset($modSettings['smfVersion'])) |
|
2540 | - print_error('Error: Unable to obtain write access to "Themes".'); |
|
2690 | + if (!is_writable($modSettings['theme_dir']) && !isset($modSettings['smfVersion'])) { |
|
2691 | + print_error('Error: Unable to obtain write access to "Themes".'); |
|
2692 | + } |
|
2541 | 2693 | |
2542 | 2694 | // Make sure cache directory exists and is writable! |
2543 | 2695 | $cachedir_temp = empty($cachedir) ? $boarddir . '/cache' : $cachedir; |
2544 | - if (!file_exists($cachedir_temp)) |
|
2545 | - @mkdir($cachedir_temp); |
|
2696 | + if (!file_exists($cachedir_temp)) { |
|
2697 | + @mkdir($cachedir_temp); |
|
2698 | + } |
|
2546 | 2699 | |
2547 | 2700 | // Make sure the cache temp dir is writable. |
2548 | 2701 | quickFileWritable($cachedir_temp); |
2549 | 2702 | |
2550 | - if (!is_writable($cachedir_temp)) |
|
2551 | - print_error('Error: Unable to obtain write access to "cache".', true); |
|
2703 | + if (!is_writable($cachedir_temp)) { |
|
2704 | + print_error('Error: Unable to obtain write access to "cache".', true); |
|
2705 | + } |
|
2552 | 2706 | |
2553 | 2707 | // Make sure db_last_error.php is writable. |
2554 | 2708 | quickFileWritable($cachedir_temp . '/db_last_error.php'); |
2555 | - if (!is_writable($cachedir_temp . '/db_last_error.php')) |
|
2556 | - print_error('Error: Unable to obtain write access to "db_last_error.php".'); |
|
2709 | + if (!is_writable($cachedir_temp . '/db_last_error.php')) { |
|
2710 | + print_error('Error: Unable to obtain write access to "db_last_error.php".'); |
|
2711 | + } |
|
2557 | 2712 | |
2558 | - if (!file_exists($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php') && !isset($modSettings['smfVersion']) && !isset($_GET['lang'])) |
|
2559 | - print_error('Error: Unable to find language files!', true); |
|
2560 | - else |
|
2713 | + if (!file_exists($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php') && !isset($modSettings['smfVersion']) && !isset($_GET['lang'])) { |
|
2714 | + print_error('Error: Unable to find language files!', true); |
|
2715 | + } else |
|
2561 | 2716 | { |
2562 | 2717 | $temp = substr(@implode('', @file($modSettings['theme_dir'] . '/languages/index.' . $upcontext['language'] . '.php')), 0, 4096); |
2563 | 2718 | preg_match('~(?://|/\*)\s*Version:\s+(.+?);\s*index(?:[\s]{2}|\*/)~i', $temp, $match); |
2564 | 2719 | |
2565 | - if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) |
|
2566 | - print_error('Error: Language files out of date.', true); |
|
2567 | - if (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) |
|
2568 | - print_error('Error: Install language is missing for selected language.', true); |
|
2720 | + if (empty($match[1]) || $match[1] != SMF_LANG_VERSION) { |
|
2721 | + print_error('Error: Language files out of date.', true); |
|
2722 | + } |
|
2723 | + if (!file_exists($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php')) { |
|
2724 | + print_error('Error: Install language is missing for selected language.', true); |
|
2725 | + } |
|
2569 | 2726 | |
2570 | 2727 | // Otherwise include it! |
2571 | 2728 | require_once($modSettings['theme_dir'] . '/languages/Install.' . $upcontext['language'] . '.php'); |
@@ -2585,8 +2742,9 @@ discard block |
||
2585 | 2742 | global $db_prefix, $db_type, $command_line, $support_js, $txt; |
2586 | 2743 | |
2587 | 2744 | // Done it already? |
2588 | - if (!empty($_POST['utf8_done'])) |
|
2589 | - return true; |
|
2745 | + if (!empty($_POST['utf8_done'])) { |
|
2746 | + return true; |
|
2747 | + } |
|
2590 | 2748 | |
2591 | 2749 | // First make sure they aren't already on UTF-8 before we go anywhere... |
2592 | 2750 | if ($db_type == 'postgresql' || ($db_character_set === 'utf8' && !empty($modSettings['global_character_set']) && $modSettings['global_character_set'] === 'UTF-8')) |
@@ -2599,8 +2757,7 @@ discard block |
||
2599 | 2757 | ); |
2600 | 2758 | |
2601 | 2759 | return true; |
2602 | - } |
|
2603 | - else |
|
2760 | + } else |
|
2604 | 2761 | { |
2605 | 2762 | $upcontext['page_title'] = $txt['converting_utf8']; |
2606 | 2763 | $upcontext['sub_template'] = isset($_GET['xml']) ? 'convert_xml' : 'convert_utf8'; |
@@ -2644,8 +2801,9 @@ discard block |
||
2644 | 2801 | ) |
2645 | 2802 | ); |
2646 | 2803 | $db_charsets = array(); |
2647 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2648 | - $db_charsets[] = $row['Charset']; |
|
2804 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2805 | + $db_charsets[] = $row['Charset']; |
|
2806 | + } |
|
2649 | 2807 | |
2650 | 2808 | $smcFunc['db_free_result']($request); |
2651 | 2809 | |
@@ -2681,13 +2839,15 @@ discard block |
||
2681 | 2839 | // If there's a fulltext index, we need to drop it first... |
2682 | 2840 | if ($request !== false || $smcFunc['db_num_rows']($request) != 0) |
2683 | 2841 | { |
2684 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
2685 | - if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
2842 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
2843 | + if ($row['Column_name'] == 'body' && (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT' || isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) |
|
2686 | 2844 | $upcontext['fulltext_index'][] = $row['Key_name']; |
2845 | + } |
|
2687 | 2846 | $smcFunc['db_free_result']($request); |
2688 | 2847 | |
2689 | - if (isset($upcontext['fulltext_index'])) |
|
2690 | - $upcontext['fulltext_index'] = array_unique($upcontext['fulltext_index']); |
|
2848 | + if (isset($upcontext['fulltext_index'])) { |
|
2849 | + $upcontext['fulltext_index'] = array_unique($upcontext['fulltext_index']); |
|
2850 | + } |
|
2691 | 2851 | } |
2692 | 2852 | |
2693 | 2853 | // Drop it and make a note... |
@@ -2877,8 +3037,9 @@ discard block |
||
2877 | 3037 | $replace = '%field%'; |
2878 | 3038 | |
2879 | 3039 | // Build a huge REPLACE statement... |
2880 | - foreach ($translation_tables[$upcontext['charset_detected']] as $from => $to) |
|
2881 | - $replace = 'REPLACE(' . $replace . ', ' . $from . ', ' . $to . ')'; |
|
3040 | + foreach ($translation_tables[$upcontext['charset_detected']] as $from => $to) { |
|
3041 | + $replace = 'REPLACE(' . $replace . ', ' . $from . ', ' . $to . ')'; |
|
3042 | + } |
|
2882 | 3043 | } |
2883 | 3044 | |
2884 | 3045 | // Get a list of table names ahead of time... This makes it easier to set our substep and such |
@@ -2888,9 +3049,10 @@ discard block |
||
2888 | 3049 | $upcontext['table_count'] = count($queryTables); |
2889 | 3050 | |
2890 | 3051 | // What ones have we already done? |
2891 | - foreach ($queryTables as $id => $table) |
|
2892 | - if ($id < $_GET['substep']) |
|
3052 | + foreach ($queryTables as $id => $table) { |
|
3053 | + if ($id < $_GET['substep']) |
|
2893 | 3054 | $upcontext['previous_tables'][] = $table; |
3055 | + } |
|
2894 | 3056 | |
2895 | 3057 | $upcontext['cur_table_num'] = $_GET['substep']; |
2896 | 3058 | $upcontext['cur_table_name'] = str_replace($db_prefix, '', $queryTables[$_GET['substep']]); |
@@ -2927,8 +3089,9 @@ discard block |
||
2927 | 3089 | nextSubstep($substep); |
2928 | 3090 | |
2929 | 3091 | // Just to make sure it doesn't time out. |
2930 | - if (function_exists('apache_reset_timeout')) |
|
2931 | - @apache_reset_timeout(); |
|
3092 | + if (function_exists('apache_reset_timeout')) { |
|
3093 | + @apache_reset_timeout(); |
|
3094 | + } |
|
2932 | 3095 | |
2933 | 3096 | $table_charsets = array(); |
2934 | 3097 | |
@@ -2951,8 +3114,9 @@ discard block |
||
2951 | 3114 | |
2952 | 3115 | // Build structure of columns to operate on organized by charset; only operate on columns not yet utf8 |
2953 | 3116 | if ($charset != 'utf8') { |
2954 | - if (!isset($table_charsets[$charset])) |
|
2955 | - $table_charsets[$charset] = array(); |
|
3117 | + if (!isset($table_charsets[$charset])) { |
|
3118 | + $table_charsets[$charset] = array(); |
|
3119 | + } |
|
2956 | 3120 | |
2957 | 3121 | $table_charsets[$charset][] = $column_info; |
2958 | 3122 | } |
@@ -2993,10 +3157,11 @@ discard block |
||
2993 | 3157 | if (isset($translation_tables[$upcontext['charset_detected']])) |
2994 | 3158 | { |
2995 | 3159 | $update = ''; |
2996 | - foreach ($table_charsets as $charset => $columns) |
|
2997 | - foreach ($columns as $column) |
|
3160 | + foreach ($table_charsets as $charset => $columns) { |
|
3161 | + foreach ($columns as $column) |
|
2998 | 3162 | $update .= ' |
2999 | 3163 | ' . $column['Field'] . ' = ' . strtr($replace, array('%field%' => $column['Field'])) . ','; |
3164 | + } |
|
3000 | 3165 | |
3001 | 3166 | $smcFunc['db_query']('', ' |
3002 | 3167 | UPDATE {raw:table_name} |
@@ -3021,8 +3186,9 @@ discard block |
||
3021 | 3186 | // Now do the actual conversion (if still needed). |
3022 | 3187 | if ($charsets[$upcontext['charset_detected']] !== 'utf8') |
3023 | 3188 | { |
3024 | - if ($command_line) |
|
3025 | - echo 'Converting table ' . $table_info['Name'] . ' to UTF-8...'; |
|
3189 | + if ($command_line) { |
|
3190 | + echo 'Converting table ' . $table_info['Name'] . ' to UTF-8...'; |
|
3191 | + } |
|
3026 | 3192 | |
3027 | 3193 | $smcFunc['db_query']('', ' |
3028 | 3194 | ALTER TABLE {raw:table_name} |
@@ -3032,12 +3198,14 @@ discard block |
||
3032 | 3198 | ) |
3033 | 3199 | ); |
3034 | 3200 | |
3035 | - if ($command_line) |
|
3036 | - echo " done.\n"; |
|
3201 | + if ($command_line) { |
|
3202 | + echo " done.\n"; |
|
3203 | + } |
|
3037 | 3204 | } |
3038 | 3205 | // If this is XML to keep it nice for the user do one table at a time anyway! |
3039 | - if (isset($_GET['xml']) && $upcontext['cur_table_num'] < $upcontext['table_count']) |
|
3040 | - return upgradeExit(); |
|
3206 | + if (isset($_GET['xml']) && $upcontext['cur_table_num'] < $upcontext['table_count']) { |
|
3207 | + return upgradeExit(); |
|
3208 | + } |
|
3041 | 3209 | } |
3042 | 3210 | |
3043 | 3211 | $prev_charset = empty($translation_tables[$upcontext['charset_detected']]) ? $charsets[$upcontext['charset_detected']] : $translation_tables[$upcontext['charset_detected']]; |
@@ -3066,8 +3234,8 @@ discard block |
||
3066 | 3234 | ); |
3067 | 3235 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
3068 | 3236 | { |
3069 | - if (@safe_unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1) |
|
3070 | - $smcFunc['db_query']('', ' |
|
3237 | + if (@safe_unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1) { |
|
3238 | + $smcFunc['db_query']('', ' |
|
3071 | 3239 | UPDATE {db_prefix}log_actions |
3072 | 3240 | SET extra = {string:extra} |
3073 | 3241 | WHERE id_action = {int:current_action}', |
@@ -3076,6 +3244,7 @@ discard block |
||
3076 | 3244 | 'extra' => $matches[1] . strlen($matches[3]) . ':"' . $matches[3] . '"' . $matches[4], |
3077 | 3245 | ) |
3078 | 3246 | ); |
3247 | + } |
|
3079 | 3248 | } |
3080 | 3249 | $smcFunc['db_free_result']($request); |
3081 | 3250 | |
@@ -3097,15 +3266,17 @@ discard block |
||
3097 | 3266 | // First thing's first - did we already do this? |
3098 | 3267 | if (!empty($modSettings['json_done'])) |
3099 | 3268 | { |
3100 | - if ($command_line) |
|
3101 | - return DeleteUpgrade(); |
|
3102 | - else |
|
3103 | - return true; |
|
3269 | + if ($command_line) { |
|
3270 | + return DeleteUpgrade(); |
|
3271 | + } else { |
|
3272 | + return true; |
|
3273 | + } |
|
3104 | 3274 | } |
3105 | 3275 | |
3106 | 3276 | // Done it already - js wise? |
3107 | - if (!empty($_POST['json_done'])) |
|
3108 | - return true; |
|
3277 | + if (!empty($_POST['json_done'])) { |
|
3278 | + return true; |
|
3279 | + } |
|
3109 | 3280 | |
3110 | 3281 | // List of tables affected by this function |
3111 | 3282 | // name => array('key', col1[,col2|true[,col3]]) |
@@ -3137,12 +3308,14 @@ discard block |
||
3137 | 3308 | $upcontext['cur_table_name'] = isset($keys[$_GET['substep']]) ? $keys[$_GET['substep']] : $keys[0]; |
3138 | 3309 | $upcontext['step_progress'] = (int) (($upcontext['cur_table_num'] / $upcontext['table_count']) * 100); |
3139 | 3310 | |
3140 | - foreach ($keys as $id => $table) |
|
3141 | - if ($id < $_GET['substep']) |
|
3311 | + foreach ($keys as $id => $table) { |
|
3312 | + if ($id < $_GET['substep']) |
|
3142 | 3313 | $upcontext['previous_tables'][] = $table; |
3314 | + } |
|
3143 | 3315 | |
3144 | - if ($command_line) |
|
3145 | - echo 'Converting data from serialize() to json_encode().'; |
|
3316 | + if ($command_line) { |
|
3317 | + echo 'Converting data from serialize() to json_encode().'; |
|
3318 | + } |
|
3146 | 3319 | |
3147 | 3320 | if (!$support_js || isset($_GET['xml'])) |
3148 | 3321 | { |
@@ -3182,8 +3355,9 @@ discard block |
||
3182 | 3355 | |
3183 | 3356 | // Loop through and fix these... |
3184 | 3357 | $new_settings = array(); |
3185 | - if ($command_line) |
|
3186 | - echo "\n" . 'Fixing some settings...'; |
|
3358 | + if ($command_line) { |
|
3359 | + echo "\n" . 'Fixing some settings...'; |
|
3360 | + } |
|
3187 | 3361 | |
3188 | 3362 | foreach ($serialized_settings as $var) |
3189 | 3363 | { |
@@ -3191,22 +3365,24 @@ discard block |
||
3191 | 3365 | { |
3192 | 3366 | // Attempt to unserialize the setting |
3193 | 3367 | $temp = @safe_unserialize($modSettings[$var]); |
3194 | - if (!$temp && $command_line) |
|
3195 | - echo "\n - Failed to unserialize the '" . $var . "' setting. Skipping."; |
|
3196 | - elseif ($temp !== false) |
|
3197 | - $new_settings[$var] = json_encode($temp); |
|
3368 | + if (!$temp && $command_line) { |
|
3369 | + echo "\n - Failed to unserialize the '" . $var . "' setting. Skipping."; |
|
3370 | + } elseif ($temp !== false) { |
|
3371 | + $new_settings[$var] = json_encode($temp); |
|
3372 | + } |
|
3198 | 3373 | } |
3199 | 3374 | } |
3200 | 3375 | |
3201 | 3376 | // Update everything at once |
3202 | - if (!function_exists('cache_put_data')) |
|
3203 | - require_once($sourcedir . '/Load.php'); |
|
3377 | + if (!function_exists('cache_put_data')) { |
|
3378 | + require_once($sourcedir . '/Load.php'); |
|
3379 | + } |
|
3204 | 3380 | updateSettings($new_settings, true); |
3205 | 3381 | |
3206 | - if ($command_line) |
|
3207 | - echo ' done.'; |
|
3208 | - } |
|
3209 | - elseif ($table == 'themes') |
|
3382 | + if ($command_line) { |
|
3383 | + echo ' done.'; |
|
3384 | + } |
|
3385 | + } elseif ($table == 'themes') |
|
3210 | 3386 | { |
3211 | 3387 | // Finally, fix the admin prefs. Unfortunately this is stored per theme, but hopefully they only have one theme installed at this point... |
3212 | 3388 | $query = $smcFunc['db_query']('', ' |
@@ -3225,10 +3401,11 @@ discard block |
||
3225 | 3401 | |
3226 | 3402 | if ($command_line) |
3227 | 3403 | { |
3228 | - if ($temp === false) |
|
3229 | - echo "\n" . 'Unserialize of admin_preferences for user ' . $row['id_member'] . ' failed. Skipping.'; |
|
3230 | - else |
|
3231 | - echo "\n" . 'Fixing admin preferences...'; |
|
3404 | + if ($temp === false) { |
|
3405 | + echo "\n" . 'Unserialize of admin_preferences for user ' . $row['id_member'] . ' failed. Skipping.'; |
|
3406 | + } else { |
|
3407 | + echo "\n" . 'Fixing admin preferences...'; |
|
3408 | + } |
|
3232 | 3409 | } |
3233 | 3410 | |
3234 | 3411 | if ($temp !== false) |
@@ -3250,15 +3427,15 @@ discard block |
||
3250 | 3427 | ) |
3251 | 3428 | ); |
3252 | 3429 | |
3253 | - if ($command_line) |
|
3254 | - echo ' done.'; |
|
3430 | + if ($command_line) { |
|
3431 | + echo ' done.'; |
|
3432 | + } |
|
3255 | 3433 | } |
3256 | 3434 | } |
3257 | 3435 | |
3258 | 3436 | $smcFunc['db_free_result']($query); |
3259 | 3437 | } |
3260 | - } |
|
3261 | - else |
|
3438 | + } else |
|
3262 | 3439 | { |
3263 | 3440 | // First item is always the key... |
3264 | 3441 | $key = $info[0]; |
@@ -3269,8 +3446,7 @@ discard block |
||
3269 | 3446 | { |
3270 | 3447 | $col_select = $info[1]; |
3271 | 3448 | $where = ' WHERE ' . $info[1] . ' != {empty}'; |
3272 | - } |
|
3273 | - else |
|
3449 | + } else |
|
3274 | 3450 | { |
3275 | 3451 | $col_select = implode(', ', $info); |
3276 | 3452 | } |
@@ -3303,8 +3479,7 @@ discard block |
||
3303 | 3479 | if ($temp === false && $command_line) |
3304 | 3480 | { |
3305 | 3481 | echo "\nFailed to unserialize " . $row[$col] . "... Skipping\n"; |
3306 | - } |
|
3307 | - else |
|
3482 | + } else |
|
3308 | 3483 | { |
3309 | 3484 | $row[$col] = json_encode($temp); |
3310 | 3485 | |
@@ -3329,16 +3504,18 @@ discard block |
||
3329 | 3504 | } |
3330 | 3505 | } |
3331 | 3506 | |
3332 | - if ($command_line) |
|
3333 | - echo ' done.'; |
|
3507 | + if ($command_line) { |
|
3508 | + echo ' done.'; |
|
3509 | + } |
|
3334 | 3510 | |
3335 | 3511 | // Free up some memory... |
3336 | 3512 | $smcFunc['db_free_result']($query); |
3337 | 3513 | } |
3338 | 3514 | } |
3339 | 3515 | // If this is XML to keep it nice for the user do one table at a time anyway! |
3340 | - if (isset($_GET['xml'])) |
|
3341 | - return upgradeExit(); |
|
3516 | + if (isset($_GET['xml'])) { |
|
3517 | + return upgradeExit(); |
|
3518 | + } |
|
3342 | 3519 | } |
3343 | 3520 | |
3344 | 3521 | if ($command_line) |
@@ -3353,8 +3530,9 @@ discard block |
||
3353 | 3530 | |
3354 | 3531 | $_GET['substep'] = 0; |
3355 | 3532 | // Make sure we move on! |
3356 | - if ($command_line) |
|
3357 | - return DeleteUpgrade(); |
|
3533 | + if ($command_line) { |
|
3534 | + return DeleteUpgrade(); |
|
3535 | + } |
|
3358 | 3536 | |
3359 | 3537 | return true; |
3360 | 3538 | } |
@@ -3411,14 +3589,16 @@ discard block |
||
3411 | 3589 | global $upcontext, $txt, $settings; |
3412 | 3590 | |
3413 | 3591 | // Don't call me twice! |
3414 | - if (!empty($upcontext['chmod_called'])) |
|
3415 | - return; |
|
3592 | + if (!empty($upcontext['chmod_called'])) { |
|
3593 | + return; |
|
3594 | + } |
|
3416 | 3595 | |
3417 | 3596 | $upcontext['chmod_called'] = true; |
3418 | 3597 | |
3419 | 3598 | // Nothing? |
3420 | - if (empty($upcontext['chmod']['files']) && empty($upcontext['chmod']['ftp_error'])) |
|
3421 | - return; |
|
3599 | + if (empty($upcontext['chmod']['files']) && empty($upcontext['chmod']['ftp_error'])) { |
|
3600 | + return; |
|
3601 | + } |
|
3422 | 3602 | |
3423 | 3603 | // Was it a problem with Windows? |
3424 | 3604 | if (!empty($upcontext['chmod']['ftp_error']) && $upcontext['chmod']['ftp_error'] == 'total_mess') |
@@ -3450,11 +3630,12 @@ discard block |
||
3450 | 3630 | content.write(\'<div class="windowbg description">\n\t\t\t<h4>', $txt['upgrade_ftp_files'], '</h4>\n\t\t\t\'); |
3451 | 3631 | content.write(\'<p>', implode('<br>\n\t\t\t', $upcontext['chmod']['files']), '</p>\n\t\t\t\');'; |
3452 | 3632 | |
3453 | - if (isset($upcontext['systemos']) && $upcontext['systemos'] == 'linux') |
|
3454 | - echo ' |
|
3633 | + if (isset($upcontext['systemos']) && $upcontext['systemos'] == 'linux') { |
|
3634 | + echo ' |
|
3455 | 3635 | content.write(\'<hr>\n\t\t\t\'); |
3456 | 3636 | content.write(\'<p>', $txt['upgrade_ftp_shell'], '</p>\n\t\t\t\'); |
3457 | 3637 | content.write(\'<tt># chmod a+w ', implode(' ', $upcontext['chmod']['files']), '</tt>\n\t\t\t\');'; |
3638 | + } |
|
3458 | 3639 | |
3459 | 3640 | echo ' |
3460 | 3641 | content.write(\'<a href="javascript:self.close();">close</a>\n\t\t</div>\n\t</body>\n</html>\'); |
@@ -3462,16 +3643,18 @@ discard block |
||
3462 | 3643 | } |
3463 | 3644 | </script>'; |
3464 | 3645 | |
3465 | - if (!empty($upcontext['chmod']['ftp_error'])) |
|
3466 | - echo ' |
|
3646 | + if (!empty($upcontext['chmod']['ftp_error'])) { |
|
3647 | + echo ' |
|
3467 | 3648 | <div class="error_message red"> |
3468 | 3649 | <p>', $txt['upgrade_ftp_error'], '<p> |
3469 | 3650 | <code>', $upcontext['chmod']['ftp_error'], '</code> |
3470 | 3651 | </div>'; |
3652 | + } |
|
3471 | 3653 | |
3472 | - if (empty($upcontext['chmod_in_form'])) |
|
3473 | - echo ' |
|
3654 | + if (empty($upcontext['chmod_in_form'])) { |
|
3655 | + echo ' |
|
3474 | 3656 | <form action="', $upcontext['form_url'], '" method="post">'; |
3657 | + } |
|
3475 | 3658 | |
3476 | 3659 | echo ' |
3477 | 3660 | <dl class="settings"> |
@@ -3513,9 +3696,10 @@ discard block |
||
3513 | 3696 | <input type="submit" value="', $txt['ftp_connect'], '" class="button"> |
3514 | 3697 | </div>'; |
3515 | 3698 | |
3516 | - if (empty($upcontext['chmod_in_form'])) |
|
3517 | - echo ' |
|
3699 | + if (empty($upcontext['chmod_in_form'])) { |
|
3700 | + echo ' |
|
3518 | 3701 | </form>'; |
3702 | + } |
|
3519 | 3703 | |
3520 | 3704 | echo ' |
3521 | 3705 | </div><!-- .panel -->'; |
@@ -3579,9 +3763,10 @@ discard block |
||
3579 | 3763 | <h2>', $txt['upgrade_progress'], '</h2> |
3580 | 3764 | <ul>'; |
3581 | 3765 | |
3582 | - foreach ($upcontext['steps'] as $num => $step) |
|
3583 | - echo ' |
|
3766 | + foreach ($upcontext['steps'] as $num => $step) { |
|
3767 | + echo ' |
|
3584 | 3768 | <li class="', $num < $upcontext['current_step'] ? 'stepdone' : ($num == $upcontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
3769 | + } |
|
3585 | 3770 | |
3586 | 3771 | echo ' |
3587 | 3772 | </ul> |
@@ -3594,13 +3779,14 @@ discard block |
||
3594 | 3779 | <span id="overall_text">', $upcontext['overall_percent'], '%</span> |
3595 | 3780 | </div>'; |
3596 | 3781 | |
3597 | - if (isset($upcontext['step_progress'])) |
|
3598 | - echo ' |
|
3782 | + if (isset($upcontext['step_progress'])) { |
|
3783 | + echo ' |
|
3599 | 3784 | <div id="progress_bar_step" class="progress_bar progress_yellow"> |
3600 | 3785 | <h3>', $txt['upgrade_step_progress'], '</h3> |
3601 | 3786 | <div id="step_progress" class="bar" style="width: ', $upcontext['step_progress'], '%;"></div> |
3602 | 3787 | <span id="step_text">', $upcontext['step_progress'], '%</span> |
3603 | 3788 | </div>'; |
3789 | + } |
|
3604 | 3790 | |
3605 | 3791 | echo ' |
3606 | 3792 | <div id="substep_bar_div" class="progress_bar" style="display: ', isset($upcontext['substep_progress']) ? '' : 'none', ';"> |
@@ -3631,31 +3817,35 @@ discard block |
||
3631 | 3817 | { |
3632 | 3818 | global $upcontext, $txt; |
3633 | 3819 | |
3634 | - if (!empty($upcontext['pause'])) |
|
3635 | - echo ' |
|
3820 | + if (!empty($upcontext['pause'])) { |
|
3821 | + echo ' |
|
3636 | 3822 | <em>', $txt['upgrade_incomplete'], '.</em><br> |
3637 | 3823 | |
3638 | 3824 | <h2 style="margin-top: 2ex;">', $txt['upgrade_not_quite_done'], '</h2> |
3639 | 3825 | <h3> |
3640 | 3826 | ', $txt['upgrade_paused_overload'], ' |
3641 | 3827 | </h3>'; |
3828 | + } |
|
3642 | 3829 | |
3643 | - if (!empty($upcontext['custom_warning'])) |
|
3644 | - echo ' |
|
3830 | + if (!empty($upcontext['custom_warning'])) { |
|
3831 | + echo ' |
|
3645 | 3832 | <div class="errorbox"> |
3646 | 3833 | <h3>', $txt['upgrade_note'], '</h3> |
3647 | 3834 | ', $upcontext['custom_warning'], ' |
3648 | 3835 | </div>'; |
3836 | + } |
|
3649 | 3837 | |
3650 | 3838 | echo ' |
3651 | 3839 | <div class="righttext" style="margin: 1ex;">'; |
3652 | 3840 | |
3653 | - if (!empty($upcontext['continue'])) |
|
3654 | - echo ' |
|
3841 | + if (!empty($upcontext['continue'])) { |
|
3842 | + echo ' |
|
3655 | 3843 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '"', $upcontext['continue'] == 2 ? ' disabled' : '', ' class="button">'; |
3656 | - if (!empty($upcontext['skip'])) |
|
3657 | - echo ' |
|
3844 | + } |
|
3845 | + if (!empty($upcontext['skip'])) { |
|
3846 | + echo ' |
|
3658 | 3847 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="dontSubmit = true; document.getElementById(\'contbutt\').disabled = \'disabled\'; return true;" class="button">'; |
3848 | + } |
|
3659 | 3849 | |
3660 | 3850 | echo ' |
3661 | 3851 | </div> |
@@ -3706,11 +3896,12 @@ discard block |
||
3706 | 3896 | echo '<', '?xml version="1.0" encoding="UTF-8"?', '> |
3707 | 3897 | <smf>'; |
3708 | 3898 | |
3709 | - if (!empty($upcontext['get_data'])) |
|
3710 | - foreach ($upcontext['get_data'] as $k => $v) |
|
3899 | + if (!empty($upcontext['get_data'])) { |
|
3900 | + foreach ($upcontext['get_data'] as $k => $v) |
|
3711 | 3901 | echo ' |
3712 | 3902 | <get key="', $k, '">', $v, '</get>'; |
3713 | -} |
|
3903 | + } |
|
3904 | + } |
|
3714 | 3905 | |
3715 | 3906 | function template_xml_below() |
3716 | 3907 | { |
@@ -3750,20 +3941,22 @@ discard block |
||
3750 | 3941 | template_chmod(); |
3751 | 3942 | |
3752 | 3943 | // For large, pre 1.1 RC2 forums give them a warning about the possible impact of this upgrade! |
3753 | - if ($upcontext['is_large_forum']) |
|
3754 | - echo ' |
|
3944 | + if ($upcontext['is_large_forum']) { |
|
3945 | + echo ' |
|
3755 | 3946 | <div class="errorbox"> |
3756 | 3947 | <h3>', $txt['upgrade_warning'], '</h3> |
3757 | 3948 | ', $txt['upgrade_warning_lots_data'], ' |
3758 | 3949 | </div>'; |
3950 | + } |
|
3759 | 3951 | |
3760 | 3952 | // A warning message? |
3761 | - if (!empty($upcontext['warning'])) |
|
3762 | - echo ' |
|
3953 | + if (!empty($upcontext['warning'])) { |
|
3954 | + echo ' |
|
3763 | 3955 | <div class="errorbox"> |
3764 | 3956 | <h3>', $txt['upgrade_warning'], '</h3> |
3765 | 3957 | ', $upcontext['warning'], ' |
3766 | 3958 | </div>'; |
3959 | + } |
|
3767 | 3960 | |
3768 | 3961 | // Paths are incorrect? |
3769 | 3962 | echo ' |
@@ -3794,16 +3987,18 @@ discard block |
||
3794 | 3987 | <p>', sprintf($txt[$agoTxt], $ago_seconds, $ago_minutes, $ago_hours), '</p> |
3795 | 3988 | <p>', sprintf($txt[$updatedTxt], $updated_seconds, $updated_minutes, $updated_hours), '</p>'; |
3796 | 3989 | |
3797 | - if ($updated < 600) |
|
3798 | - echo ' |
|
3990 | + if ($updated < 600) { |
|
3991 | + echo ' |
|
3799 | 3992 | <p>', $txt['upgrade_run_script'], ' ', $upcontext['user']['name'],' ', $txt['upgrade_run_script2'], '</p>'; |
3993 | + } |
|
3800 | 3994 | |
3801 | - if ($updated > $upcontext['inactive_timeout']) |
|
3802 | - echo ' |
|
3995 | + if ($updated > $upcontext['inactive_timeout']) { |
|
3996 | + echo ' |
|
3803 | 3997 | <p>',$txt['upgrade_run'], '</p>'; |
3804 | - else |
|
3805 | - echo ' |
|
3998 | + } else { |
|
3999 | + echo ' |
|
3806 | 4000 | <p>', $txt['upgrade_script_timeout'], ' ', $upcontext['user']['name'], ' ', $txt['upgrade_script_timeout2'], ' ', ($upcontext['inactive_timeout'] > 120 ? round($upcontext['inactive_timeout'] / 60, 1) . ' minutes!' : $upcontext['inactive_timeout'] . ' seconds!'), '</p>'; |
4001 | + } |
|
3807 | 4002 | |
3808 | 4003 | echo ' |
3809 | 4004 | </div>'; |
@@ -3819,9 +4014,10 @@ discard block |
||
3819 | 4014 | <dd> |
3820 | 4015 | <input type="text" name="user" value="', !empty($upcontext['username']) ? $upcontext['username'] : '', '"', $disable_security ? ' disabled' : '', '>'; |
3821 | 4016 | |
3822 | - if (!empty($upcontext['username_incorrect'])) |
|
3823 | - echo ' |
|
4017 | + if (!empty($upcontext['username_incorrect'])) { |
|
4018 | + echo ' |
|
3824 | 4019 | <div class="smalltext red">', $txt['upgrade_wrong_username'], '</div>'; |
4020 | + } |
|
3825 | 4021 | |
3826 | 4022 | echo ' |
3827 | 4023 | </dd> |
@@ -3832,9 +4028,10 @@ discard block |
||
3832 | 4028 | <input type="password" name="passwrd" value=""', $disable_security ? ' disabled' : '', '> |
3833 | 4029 | <input type="hidden" name="hash_passwrd" value="">'; |
3834 | 4030 | |
3835 | - if (!empty($upcontext['password_failed'])) |
|
3836 | - echo ' |
|
4031 | + if (!empty($upcontext['password_failed'])) { |
|
4032 | + echo ' |
|
3837 | 4033 | <div class="smalltext red">', $txt['upgrade_wrong_password'], '</div>'; |
4034 | + } |
|
3838 | 4035 | |
3839 | 4036 | echo ' |
3840 | 4037 | </dd>'; |
@@ -3902,12 +4099,13 @@ discard block |
||
3902 | 4099 | <form action="', $upcontext['form_url'], '" method="post" name="upform" id="upform">'; |
3903 | 4100 | |
3904 | 4101 | // Warning message? |
3905 | - if (!empty($upcontext['upgrade_options_warning'])) |
|
3906 | - echo ' |
|
4102 | + if (!empty($upcontext['upgrade_options_warning'])) { |
|
4103 | + echo ' |
|
3907 | 4104 | <div class="errorbox"> |
3908 | 4105 | <h3>', $txt['upgrade_warning'] ,'</h3> |
3909 | 4106 | ', $upcontext['upgrade_options_warning'], ' |
3910 | 4107 | </div>'; |
4108 | + } |
|
3911 | 4109 | |
3912 | 4110 | echo ' |
3913 | 4111 | <ul class="upgrade_settings"> |
@@ -3936,12 +4134,13 @@ discard block |
||
3936 | 4134 | <label for="empty_error">', $txt['upgrade_empty_errlog'], '</label> |
3937 | 4135 | </li>'; |
3938 | 4136 | |
3939 | - if (!empty($upcontext['karma_installed']['good']) || !empty($upcontext['karma_installed']['bad'])) |
|
3940 | - echo ' |
|
4137 | + if (!empty($upcontext['karma_installed']['good']) || !empty($upcontext['karma_installed']['bad'])) { |
|
4138 | + echo ' |
|
3941 | 4139 | <li> |
3942 | 4140 | <input type="checkbox" name="delete_karma" id="delete_karma" value="1"> |
3943 | 4141 | <label for="delete_karma">', $txt['upgrade_delete_karma'], '</label> |
3944 | 4142 | </li>'; |
4143 | + } |
|
3945 | 4144 | |
3946 | 4145 | echo ' |
3947 | 4146 | <li> |
@@ -3975,10 +4174,11 @@ discard block |
||
3975 | 4174 | </div>'; |
3976 | 4175 | |
3977 | 4176 | // Dont any tables so far? |
3978 | - if (!empty($upcontext['previous_tables'])) |
|
3979 | - foreach ($upcontext['previous_tables'] as $table) |
|
4177 | + if (!empty($upcontext['previous_tables'])) { |
|
4178 | + foreach ($upcontext['previous_tables'] as $table) |
|
3980 | 4179 | echo ' |
3981 | 4180 | <br>', $txt['upgrade_completed_table'], ' "', $table, '".'; |
4181 | + } |
|
3982 | 4182 | |
3983 | 4183 | echo ' |
3984 | 4184 | <h3 id="current_tab"> |
@@ -4017,12 +4217,13 @@ discard block |
||
4017 | 4217 | updateStepProgress(iTableNum, ', $upcontext['table_count'], ', ', $upcontext['step_weight'] * ((100 - $upcontext['step_progress']) / 100), ');'; |
4018 | 4218 | |
4019 | 4219 | // If debug flood the screen. |
4020 | - if ($is_debug) |
|
4021 | - echo ' |
|
4220 | + if ($is_debug) { |
|
4221 | + echo ' |
|
4022 | 4222 | setOuterHTML(document.getElementById(\'debuginfo\'), \'<br>Completed Table: "\' + sCompletedTableName + \'".<span id="debuginfo"><\' + \'/span>\'); |
4023 | 4223 | |
4024 | 4224 | if (document.getElementById(\'debug_section\').scrollHeight) |
4025 | 4225 | document.getElementById(\'debug_section\').scrollTop = document.getElementById(\'debug_section\').scrollHeight'; |
4226 | + } |
|
4026 | 4227 | |
4027 | 4228 | echo ' |
4028 | 4229 | // Get the next update... |
@@ -4055,8 +4256,9 @@ discard block |
||
4055 | 4256 | { |
4056 | 4257 | global $upcontext, $support_js, $is_debug, $timeLimitThreshold, $txt; |
4057 | 4258 | |
4058 | - if (empty($is_debug) && !empty($upcontext['upgrade_status']['debug'])) |
|
4059 | - $is_debug = true; |
|
4259 | + if (empty($is_debug) && !empty($upcontext['upgrade_status']['debug'])) { |
|
4260 | + $is_debug = true; |
|
4261 | + } |
|
4060 | 4262 | |
4061 | 4263 | echo ' |
4062 | 4264 | <h3>', $txt['upgrade_db_changes'], '</h3> |
@@ -4071,8 +4273,9 @@ discard block |
||
4071 | 4273 | { |
4072 | 4274 | foreach ($upcontext['actioned_items'] as $num => $item) |
4073 | 4275 | { |
4074 | - if ($num != 0) |
|
4075 | - echo ' Successful!'; |
|
4276 | + if ($num != 0) { |
|
4277 | + echo ' Successful!'; |
|
4278 | + } |
|
4076 | 4279 | echo '<br>' . $item; |
4077 | 4280 | } |
4078 | 4281 | |
@@ -4087,20 +4290,20 @@ discard block |
||
4087 | 4290 | $seconds = intval($active % 60); |
4088 | 4291 | |
4089 | 4292 | echo '', sprintf($txt['upgrade_success_time_db'], $seconds, $minutes, $hours), '<br>'; |
4293 | + } else { |
|
4294 | + echo '', $txt['upgrade_success'], '<br>'; |
|
4090 | 4295 | } |
4091 | - else |
|
4092 | - echo '', $txt['upgrade_success'], '<br>'; |
|
4093 | 4296 | |
4094 | 4297 | echo ' |
4095 | 4298 | <p id="commess">', $txt['upgrade_db_complete'], '</p>'; |
4096 | 4299 | } |
4097 | - } |
|
4098 | - else |
|
4300 | + } else |
|
4099 | 4301 | { |
4100 | 4302 | // Tell them how many files we have in total. |
4101 | - if ($upcontext['file_count'] > 1) |
|
4102 | - echo ' |
|
4303 | + if ($upcontext['file_count'] > 1) { |
|
4304 | + echo ' |
|
4103 | 4305 | <strong id="info1">', $txt['upgrade_script'], ' <span id="file_done">', $upcontext['cur_file_num'], '</span> of ', $upcontext['file_count'], '.</strong>'; |
4306 | + } |
|
4104 | 4307 | |
4105 | 4308 | echo ' |
4106 | 4309 | <h3 id="info2"> |
@@ -4120,10 +4323,10 @@ discard block |
||
4120 | 4323 | |
4121 | 4324 | echo ' |
4122 | 4325 | <p id="upgradeCompleted">', sprintf($txt['upgrade_success_time_db'], $seconds, $minutes, $hours), '</p>'; |
4123 | - } |
|
4124 | - else |
|
4125 | - echo ' |
|
4326 | + } else { |
|
4327 | + echo ' |
|
4126 | 4328 | <p id="upgradeCompleted"></p>'; |
4329 | + } |
|
4127 | 4330 | |
4128 | 4331 | echo ' |
4129 | 4332 | <div id="debug_section"> |
@@ -4159,9 +4362,10 @@ discard block |
||
4159 | 4362 | var getData = ""; |
4160 | 4363 | var debugItems = ', $upcontext['debug_items'], ';'; |
4161 | 4364 | |
4162 | - if ($is_debug) |
|
4163 | - echo ' |
|
4365 | + if ($is_debug) { |
|
4366 | + echo ' |
|
4164 | 4367 | var upgradeStartTime = ' . $upcontext['started'] . ';'; |
4368 | + } |
|
4165 | 4369 | |
4166 | 4370 | echo ' |
4167 | 4371 | function getNextItem() |
@@ -4201,9 +4405,10 @@ discard block |
||
4201 | 4405 | document.getElementById("error_block").style.display = ""; |
4202 | 4406 | setInnerHTML(document.getElementById("error_message"), "Error retrieving information on step: " + (sDebugName == "" ? sLastString : sDebugName));'; |
4203 | 4407 | |
4204 | - if ($is_debug) |
|
4205 | - echo ' |
|
4408 | + if ($is_debug) { |
|
4409 | + echo ' |
|
4206 | 4410 | setOuterHTML(document.getElementById(\'debuginfo\'), \'<span class="red">failed<\' + \'/span><span id="debuginfo"><\' + \'/span>\');'; |
4411 | + } |
|
4207 | 4412 | |
4208 | 4413 | echo ' |
4209 | 4414 | } |
@@ -4224,9 +4429,10 @@ discard block |
||
4224 | 4429 | document.getElementById("error_block").style.display = ""; |
4225 | 4430 | setInnerHTML(document.getElementById("error_message"), "', $txt['upgrade_loop'], '" + sDebugName);'; |
4226 | 4431 | |
4227 | - if ($is_debug) |
|
4228 | - echo ' |
|
4432 | + if ($is_debug) { |
|
4433 | + echo ' |
|
4229 | 4434 | setOuterHTML(document.getElementById(\'debuginfo\'), \'<span class="red">failed<\' + \'/span><span id="debuginfo"><\' + \'/span>\');'; |
4435 | + } |
|
4230 | 4436 | |
4231 | 4437 | echo ' |
4232 | 4438 | } |
@@ -4284,8 +4490,8 @@ discard block |
||
4284 | 4490 | {'; |
4285 | 4491 | |
4286 | 4492 | // Database Changes, tell us how much time we spen to do this. If this gets updated via JS. |
4287 | - if ($is_debug) |
|
4288 | - echo ' |
|
4493 | + if ($is_debug) { |
|
4494 | + echo ' |
|
4289 | 4495 | document.getElementById(\'debug_section\').style.display = "none"; |
4290 | 4496 | |
4291 | 4497 | var upgradeFinishedTime = parseInt(oXMLDoc.getElementsByTagName("curtime")[0].childNodes[0].nodeValue); |
@@ -4300,6 +4506,7 @@ discard block |
||
4300 | 4506 | completedTxt = completedTxt.replace("%1$d", diffSeconds).replace("%2$d", diffMinutes).replace("%3$d", diffHours); |
4301 | 4507 | console.log(completedTxt, upgradeFinishedTime, diffTime, diffHours, diffMinutes, diffSeconds); |
4302 | 4508 | setInnerHTML(document.getElementById("upgradeCompleted"), completedTxt);'; |
4509 | + } |
|
4303 | 4510 | |
4304 | 4511 | echo ' |
4305 | 4512 | |
@@ -4307,9 +4514,10 @@ discard block |
||
4307 | 4514 | document.getElementById(\'contbutt\').disabled = 0; |
4308 | 4515 | document.getElementById(\'database_done\').value = 1;'; |
4309 | 4516 | |
4310 | - if ($upcontext['file_count'] > 1) |
|
4311 | - echo ' |
|
4517 | + if ($upcontext['file_count'] > 1) { |
|
4518 | + echo ' |
|
4312 | 4519 | document.getElementById(\'info1\').style.display = "none";'; |
4520 | + } |
|
4313 | 4521 | |
4314 | 4522 | echo ' |
4315 | 4523 | document.getElementById(\'info2\').style.display = "none"; |
@@ -4322,9 +4530,10 @@ discard block |
||
4322 | 4530 | lastItem = 0; |
4323 | 4531 | prevFile = curFile;'; |
4324 | 4532 | |
4325 | - if ($is_debug) |
|
4326 | - echo ' |
|
4533 | + if ($is_debug) { |
|
4534 | + echo ' |
|
4327 | 4535 | setOuterHTML(document.getElementById(\'debuginfo\'), \'Moving to next script file...done<br><span id="debuginfo"><\' + \'/span>\');'; |
4536 | + } |
|
4328 | 4537 | |
4329 | 4538 | echo ' |
4330 | 4539 | getNextItem(); |
@@ -4332,8 +4541,8 @@ discard block |
||
4332 | 4541 | }'; |
4333 | 4542 | |
4334 | 4543 | // If debug scroll the screen. |
4335 | - if ($is_debug) |
|
4336 | - echo ' |
|
4544 | + if ($is_debug) { |
|
4545 | + echo ' |
|
4337 | 4546 | if (iLastSubStepProgress == -1) |
4338 | 4547 | { |
4339 | 4548 | // Give it consistent dots. |
@@ -4352,6 +4561,7 @@ discard block |
||
4352 | 4561 | |
4353 | 4562 | if (document.getElementById(\'debug_section\').scrollHeight) |
4354 | 4563 | document.getElementById(\'debug_section\').scrollTop = document.getElementById(\'debug_section\').scrollHeight'; |
4564 | + } |
|
4355 | 4565 | |
4356 | 4566 | echo ' |
4357 | 4567 | // Update the page. |
@@ -4412,9 +4622,10 @@ discard block |
||
4412 | 4622 | }'; |
4413 | 4623 | |
4414 | 4624 | // Start things off assuming we've not errored. |
4415 | - if (empty($upcontext['error_message'])) |
|
4416 | - echo ' |
|
4625 | + if (empty($upcontext['error_message'])) { |
|
4626 | + echo ' |
|
4417 | 4627 | getNextItem();'; |
4628 | + } |
|
4418 | 4629 | |
4419 | 4630 | echo ' |
4420 | 4631 | //# sourceURL=dynamicScript-dbch.js |
@@ -4432,18 +4643,21 @@ discard block |
||
4432 | 4643 | <item num="', $upcontext['current_item_num'], '">', $upcontext['current_item_name'], '</item> |
4433 | 4644 | <debug num="', $upcontext['current_debug_item_num'], '" percent="', isset($upcontext['substep_progress']) ? $upcontext['substep_progress'] : '-1', '" complete="', empty($upcontext['completed_step']) ? 0 : 1, '">', $upcontext['current_debug_item_name'], '</debug>'; |
4434 | 4645 | |
4435 | - if (!empty($upcontext['error_message'])) |
|
4436 | - echo ' |
|
4646 | + if (!empty($upcontext['error_message'])) { |
|
4647 | + echo ' |
|
4437 | 4648 | <error>', $upcontext['error_message'], '</error>'; |
4649 | + } |
|
4438 | 4650 | |
4439 | - if (!empty($upcontext['error_string'])) |
|
4440 | - echo ' |
|
4651 | + if (!empty($upcontext['error_string'])) { |
|
4652 | + echo ' |
|
4441 | 4653 | <sql>', $upcontext['error_string'], '</sql>'; |
4654 | + } |
|
4442 | 4655 | |
4443 | - if ($is_debug) |
|
4444 | - echo ' |
|
4656 | + if ($is_debug) { |
|
4657 | + echo ' |
|
4445 | 4658 | <curtime>', time(), '</curtime>'; |
4446 | -} |
|
4659 | + } |
|
4660 | + } |
|
4447 | 4661 | |
4448 | 4662 | // Template for the UTF-8 conversion step. Basically a copy of the backup stuff with slight modifications.... |
4449 | 4663 | function template_convert_utf8() |
@@ -4460,10 +4674,11 @@ discard block |
||
4460 | 4674 | </div>'; |
4461 | 4675 | |
4462 | 4676 | // Done any tables so far? |
4463 | - if (!empty($upcontext['previous_tables'])) |
|
4464 | - foreach ($upcontext['previous_tables'] as $table) |
|
4677 | + if (!empty($upcontext['previous_tables'])) { |
|
4678 | + foreach ($upcontext['previous_tables'] as $table) |
|
4465 | 4679 | echo ' |
4466 | 4680 | <br>', $txt['upgrade_completed_table'], ' "', $table, '".'; |
4681 | + } |
|
4467 | 4682 | |
4468 | 4683 | echo ' |
4469 | 4684 | <h3 id="current_tab"> |
@@ -4471,9 +4686,10 @@ discard block |
||
4471 | 4686 | </h3>'; |
4472 | 4687 | |
4473 | 4688 | // If we dropped their index, let's let them know |
4474 | - if ($upcontext['dropping_index']) |
|
4475 | - echo ' |
|
4689 | + if ($upcontext['dropping_index']) { |
|
4690 | + echo ' |
|
4476 | 4691 | <p id="indexmsg" style="font-weight: bold; font-style: italic; display: ', $upcontext['cur_table_num'] == $upcontext['table_count'] ? 'inline' : 'none', ';">', $txt['upgrade_fulltext'], '</p>'; |
4692 | + } |
|
4477 | 4693 | |
4478 | 4694 | // Completion notification |
4479 | 4695 | echo ' |
@@ -4510,12 +4726,13 @@ discard block |
||
4510 | 4726 | updateStepProgress(iTableNum, ', $upcontext['table_count'], ', ', $upcontext['step_weight'] * ((100 - $upcontext['step_progress']) / 100), ');'; |
4511 | 4727 | |
4512 | 4728 | // If debug flood the screen. |
4513 | - if ($is_debug) |
|
4514 | - echo ' |
|
4729 | + if ($is_debug) { |
|
4730 | + echo ' |
|
4515 | 4731 | setOuterHTML(document.getElementById(\'debuginfo\'), \'<br>Completed Table: "\' + sCompletedTableName + \'".<span id="debuginfo"><\' + \'/span>\'); |
4516 | 4732 | |
4517 | 4733 | if (document.getElementById(\'debug_section\').scrollHeight) |
4518 | 4734 | document.getElementById(\'debug_section\').scrollTop = document.getElementById(\'debug_section\').scrollHeight'; |
4735 | + } |
|
4519 | 4736 | |
4520 | 4737 | echo ' |
4521 | 4738 | // Get the next update... |
@@ -4561,10 +4778,11 @@ discard block |
||
4561 | 4778 | </div>'; |
4562 | 4779 | |
4563 | 4780 | // Dont any tables so far? |
4564 | - if (!empty($upcontext['previous_tables'])) |
|
4565 | - foreach ($upcontext['previous_tables'] as $table) |
|
4781 | + if (!empty($upcontext['previous_tables'])) { |
|
4782 | + foreach ($upcontext['previous_tables'] as $table) |
|
4566 | 4783 | echo ' |
4567 | 4784 | <br>', $txt['upgrade_completed_table'], ' "', $table, '".'; |
4785 | + } |
|
4568 | 4786 | |
4569 | 4787 | echo ' |
4570 | 4788 | <h3 id="current_tab"> |
@@ -4573,9 +4791,10 @@ discard block |
||
4573 | 4791 | <p id="commess" style="display: ', $upcontext['cur_table_num'] == $upcontext['table_count'] ? 'inline' : 'none', ';">', $txt['upgrade_json_completed'], '</p>'; |
4574 | 4792 | |
4575 | 4793 | // Try to make sure substep was reset. |
4576 | - if ($upcontext['cur_table_num'] == $upcontext['table_count']) |
|
4577 | - echo ' |
|
4794 | + if ($upcontext['cur_table_num'] == $upcontext['table_count']) { |
|
4795 | + echo ' |
|
4578 | 4796 | <input type="hidden" name="substep" id="substep" value="0">'; |
4797 | + } |
|
4579 | 4798 | |
4580 | 4799 | // Continue please! |
4581 | 4800 | $upcontext['continue'] = $support_js ? 2 : 1; |
@@ -4608,12 +4827,13 @@ discard block |
||
4608 | 4827 | updateStepProgress(iTableNum, ', $upcontext['table_count'], ', ', $upcontext['step_weight'] * ((100 - $upcontext['step_progress']) / 100), ');'; |
4609 | 4828 | |
4610 | 4829 | // If debug flood the screen. |
4611 | - if ($is_debug) |
|
4612 | - echo ' |
|
4830 | + if ($is_debug) { |
|
4831 | + echo ' |
|
4613 | 4832 | setOuterHTML(document.getElementById(\'debuginfo\'), \'<br>', $txt['upgrade_completed_table'], ' "\' + sCompletedTableName + \'".<span id="debuginfo"><\' + \'/span>\'); |
4614 | 4833 | |
4615 | 4834 | if (document.getElementById(\'debug_section\').scrollHeight) |
4616 | 4835 | document.getElementById(\'debug_section\').scrollTop = document.getElementById(\'debug_section\').scrollHeight'; |
4836 | + } |
|
4617 | 4837 | |
4618 | 4838 | echo ' |
4619 | 4839 | // Get the next update... |
@@ -4649,8 +4869,8 @@ discard block |
||
4649 | 4869 | <h3>', $txt['upgrade_done'], ' <a href="', $boardurl, '/index.php">', $txt['upgrade_done2'], '</a>. ', $txt['upgrade_done3'], '</h3> |
4650 | 4870 | <form action="', $boardurl, '/index.php">'; |
4651 | 4871 | |
4652 | - if (!empty($upcontext['can_delete_script'])) |
|
4653 | - echo ' |
|
4872 | + if (!empty($upcontext['can_delete_script'])) { |
|
4873 | + echo ' |
|
4654 | 4874 | <label> |
4655 | 4875 | <input type="checkbox" id="delete_self" onclick="doTheDelete(this);"> ', $txt['upgrade_delete_now'], ' |
4656 | 4876 | </label> |
@@ -4664,6 +4884,7 @@ discard block |
||
4664 | 4884 | } |
4665 | 4885 | </script> |
4666 | 4886 | <img src="', $settings['default_theme_url'], '/images/blank.png" alt="" id="delete_upgrader"><br>'; |
4887 | + } |
|
4667 | 4888 | |
4668 | 4889 | // Show Upgrade time in debug mode when we completed the upgrade process totatly |
4669 | 4890 | if ($is_debug) |
@@ -4673,12 +4894,13 @@ discard block |
||
4673 | 4894 | $minutes = intval(($active / 60) % 60); |
4674 | 4895 | $seconds = intval($active % 60); |
4675 | 4896 | |
4676 | - if ($hours > 0) |
|
4677 | - echo '', sprintf($txt['upgrade_completed_time_hms'], $seconds, $minutes, $hours), ''; |
|
4678 | - elseif ($minutes > 0) |
|
4679 | - echo '', sprintf($txt['upgrade_completed_time_ms'], $seconds, $minutes), ''; |
|
4680 | - elseif ($seconds > 0) |
|
4681 | - echo '', sprintf($txt['upgrade_completed_time_s'], $seconds), ''; |
|
4897 | + if ($hours > 0) { |
|
4898 | + echo '', sprintf($txt['upgrade_completed_time_hms'], $seconds, $minutes, $hours), ''; |
|
4899 | + } elseif ($minutes > 0) { |
|
4900 | + echo '', sprintf($txt['upgrade_completed_time_ms'], $seconds, $minutes), ''; |
|
4901 | + } elseif ($seconds > 0) { |
|
4902 | + echo '', sprintf($txt['upgrade_completed_time_s'], $seconds), ''; |
|
4903 | + } |
|
4682 | 4904 | } |
4683 | 4905 | |
4684 | 4906 | echo ' |
@@ -4708,8 +4930,9 @@ discard block |
||
4708 | 4930 | |
4709 | 4931 | $current_substep = $_GET['substep']; |
4710 | 4932 | |
4711 | - if (empty($_GET['a'])) |
|
4712 | - $_GET['a'] = 0; |
|
4933 | + if (empty($_GET['a'])) { |
|
4934 | + $_GET['a'] = 0; |
|
4935 | + } |
|
4713 | 4936 | $step_progress['name'] = 'Converting ips'; |
4714 | 4937 | $step_progress['current'] = $_GET['a']; |
4715 | 4938 | |
@@ -4752,16 +4975,19 @@ discard block |
||
4752 | 4975 | 'empty' => '', |
4753 | 4976 | 'limit' => $limit, |
4754 | 4977 | )); |
4755 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
4756 | - $arIp[] = $row[$oldCol]; |
|
4978 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
4979 | + $arIp[] = $row[$oldCol]; |
|
4980 | + } |
|
4757 | 4981 | $smcFunc['db_free_result']($request); |
4758 | 4982 | |
4759 | 4983 | // Special case, null ip could keep us in a loop. |
4760 | - if (is_null($arIp[0])) |
|
4761 | - unset($arIp[0]); |
|
4984 | + if (is_null($arIp[0])) { |
|
4985 | + unset($arIp[0]); |
|
4986 | + } |
|
4762 | 4987 | |
4763 | - if (empty($arIp)) |
|
4764 | - $is_done = true; |
|
4988 | + if (empty($arIp)) { |
|
4989 | + $is_done = true; |
|
4990 | + } |
|
4765 | 4991 | |
4766 | 4992 | $updates = array(); |
4767 | 4993 | $cases = array(); |
@@ -4770,16 +4996,18 @@ discard block |
||
4770 | 4996 | { |
4771 | 4997 | $arIp[$i] = trim($arIp[$i]); |
4772 | 4998 | |
4773 | - if (empty($arIp[$i])) |
|
4774 | - continue; |
|
4999 | + if (empty($arIp[$i])) { |
|
5000 | + continue; |
|
5001 | + } |
|
4775 | 5002 | |
4776 | 5003 | $updates['ip' . $i] = $arIp[$i]; |
4777 | 5004 | $cases[$arIp[$i]] = 'WHEN ' . $oldCol . ' = {string:ip' . $i . '} THEN {inet:ip' . $i . '}'; |
4778 | 5005 | |
4779 | 5006 | if ($setSize > 0 && $i % $setSize === 0) |
4780 | 5007 | { |
4781 | - if (count($updates) == 1) |
|
4782 | - continue; |
|
5008 | + if (count($updates) == 1) { |
|
5009 | + continue; |
|
5010 | + } |
|
4783 | 5011 | |
4784 | 5012 | $updates['whereSet'] = array_values($updates); |
4785 | 5013 | $smcFunc['db_query']('', ' |
@@ -4813,8 +5041,7 @@ discard block |
||
4813 | 5041 | 'ip' => $ip |
4814 | 5042 | )); |
4815 | 5043 | } |
4816 | - } |
|
4817 | - else |
|
5044 | + } else |
|
4818 | 5045 | { |
4819 | 5046 | $updates['whereSet'] = array_values($updates); |
4820 | 5047 | $smcFunc['db_query']('', ' |
@@ -4828,9 +5055,9 @@ discard block |
||
4828 | 5055 | $updates |
4829 | 5056 | ); |
4830 | 5057 | } |
5058 | + } else { |
|
5059 | + $is_done = true; |
|
4831 | 5060 | } |
4832 | - else |
|
4833 | - $is_done = true; |
|
4834 | 5061 | |
4835 | 5062 | $_GET['a'] += $limit; |
4836 | 5063 | $step_progress['current'] = $_GET['a']; |
@@ -4856,10 +5083,11 @@ discard block |
||
4856 | 5083 | |
4857 | 5084 | $columns = $smcFunc['db_list_columns']($targetTable, true); |
4858 | 5085 | |
4859 | - if (isset($columns[$column])) |
|
4860 | - return $columns[$column]; |
|
4861 | - else |
|
4862 | - return null; |
|
4863 | -} |
|
5086 | + if (isset($columns[$column])) { |
|
5087 | + return $columns[$column]; |
|
5088 | + } else { |
|
5089 | + return null; |
|
5090 | + } |
|
5091 | + } |
|
4864 | 5092 | |
4865 | 5093 | ?> |
4866 | 5094 | \ No newline at end of file |
@@ -96,8 +96,9 @@ discard block |
||
96 | 96 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
97 | 97 | { |
98 | 98 | $groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups']))); |
99 | - if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) |
|
100 | - continue; |
|
99 | + if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) { |
|
100 | + continue; |
|
101 | + } |
|
101 | 102 | |
102 | 103 | $members[] = $row['id_member']; |
103 | 104 | $watched[$row['id_member']] = $row; |
@@ -105,8 +106,9 @@ discard block |
||
105 | 106 | |
106 | 107 | $smcFunc['db_free_result']($request); |
107 | 108 | |
108 | - if (empty($members)) |
|
109 | - return true; |
|
109 | + if (empty($members)) { |
|
110 | + return true; |
|
111 | + } |
|
110 | 112 | |
111 | 113 | $members = array_unique($members); |
112 | 114 | $prefs = getNotifyPrefs($members, '', true); |
@@ -122,8 +124,9 @@ discard block |
||
122 | 124 | self::handleQuoteNotifications($msgOptions, $posterOptions, $quotedMembers, $prefs, $done_members, $alert_rows); |
123 | 125 | |
124 | 126 | // Save ourselves a bit of work in the big loop below |
125 | - foreach ($done_members as $done_member) |
|
126 | - unset($watched[$done_member]); |
|
127 | + foreach ($done_members as $done_member) { |
|
128 | + unset($watched[$done_member]); |
|
129 | + } |
|
127 | 130 | |
128 | 131 | // Handle rest of the notifications for watched topics and boards |
129 | 132 | foreach ($watched as $member => $data) |
@@ -132,20 +135,23 @@ discard block |
||
132 | 135 | $notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : self::NOTIFY_TYPE_REPLY_AND_MODIFY; |
133 | 136 | |
134 | 137 | // Don't send a notification if the watching member ignored the member who made the action. |
135 | - if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
|
136 | - continue; |
|
137 | - if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started']) |
|
138 | - continue; |
|
139 | - elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
|
140 | - continue; |
|
141 | - elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES) |
|
142 | - continue; |
|
143 | - elseif ($notify_types == self::NOTIFY_TYPE_NOTHING) |
|
144 | - continue; |
|
138 | + if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) { |
|
139 | + continue; |
|
140 | + } |
|
141 | + if (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_REPLY_AND_TOPIC_START_FOLLOWING && $member != $data['id_member_started']) { |
|
142 | + continue; |
|
143 | + } elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) { |
|
144 | + continue; |
|
145 | + } elseif (!in_array($type, array('reply', 'topic')) && $notify_types == self::NOTIFY_TYPE_ONLY_REPLIES) { |
|
146 | + continue; |
|
147 | + } elseif ($notify_types == self::NOTIFY_TYPE_NOTHING) { |
|
148 | + continue; |
|
149 | + } |
|
145 | 150 | |
146 | 151 | if (empty($frequency) || $frequency > self::FREQUENCY_FIRST_UNREAD_MSG || $data['sent'] |
147 | - || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) |
|
148 | - continue; |
|
152 | + || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) { |
|
153 | + continue; |
|
154 | + } |
|
149 | 155 | |
150 | 156 | // Watched topic? |
151 | 157 | if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member])) |
@@ -155,10 +161,12 @@ discard block |
||
155 | 161 | |
156 | 162 | if ($type == 'reply') |
157 | 163 | { |
158 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
159 | - $message_type .= '_body'; |
|
160 | - if (!empty($frequency)) |
|
161 | - $message_type .= '_once'; |
|
164 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
165 | + $message_type .= '_body'; |
|
166 | + } |
|
167 | + if (!empty($frequency)) { |
|
168 | + $message_type .= '_once'; |
|
169 | + } |
|
162 | 170 | } |
163 | 171 | |
164 | 172 | $content_type = 'topic'; |
@@ -171,12 +179,14 @@ discard block |
||
171 | 179 | $content_type = 'board'; |
172 | 180 | |
173 | 181 | $message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards'; |
174 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
175 | - $message_type .= '_body'; |
|
182 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
183 | + $message_type .= '_body'; |
|
184 | + } |
|
176 | 185 | } |
177 | 186 | // If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip |
178 | - else |
|
179 | - continue; |
|
187 | + else { |
|
188 | + continue; |
|
189 | + } |
|
180 | 190 | |
181 | 191 | // Bitwise check: Receiving a email notification? |
182 | 192 | if ($pref & self::RECEIVE_NOTIFY_EMAIL) |
@@ -193,8 +203,9 @@ discard block |
||
193 | 203 | $mail_result = sendmail($data['email_address'], $emaildata['subject'], $emaildata['body'], null, 'm' . $topicOptions['id'], $emaildata['is_html']); |
194 | 204 | |
195 | 205 | // We failed, don't trigger a alert as we don't have a way to attempt to resend just the email currently. |
196 | - if ($mail_result === false) |
|
197 | - continue; |
|
206 | + if ($mail_result === false) { |
|
207 | + continue; |
|
208 | + } |
|
198 | 209 | } |
199 | 210 | |
200 | 211 | // Bitwise check: Receiving a alert? |
@@ -245,14 +256,15 @@ discard block |
||
245 | 256 | ); |
246 | 257 | |
247 | 258 | // Insert the alerts if any |
248 | - if (!empty($alert_rows)) |
|
249 | - $smcFunc['db_insert']('', |
|
259 | + if (!empty($alert_rows)) { |
|
260 | + $smcFunc['db_insert']('', |
|
250 | 261 | '{db_prefix}user_alerts', |
251 | 262 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
252 | 263 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
253 | 264 | $alert_rows, |
254 | 265 | array() |
255 | 266 | ); |
267 | + } |
|
256 | 268 | |
257 | 269 | return true; |
258 | 270 | } |
@@ -263,8 +275,9 @@ discard block |
||
263 | 275 | |
264 | 276 | foreach ($quotedMembers as $id => $member) |
265 | 277 | { |
266 | - if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) |
|
267 | - continue; |
|
278 | + if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) { |
|
279 | + continue; |
|
280 | + } |
|
268 | 281 | |
269 | 282 | $done_members[] = $id; |
270 | 283 | |
@@ -318,32 +331,35 @@ discard block |
||
318 | 331 | { |
319 | 332 | if (preg_match('/\[quote(.*)?\]/i', $block, $matches)) |
320 | 333 | { |
321 | - if ($quote_level == 0) |
|
322 | - $message .= '[quote' . $matches[1] . ']'; |
|
334 | + if ($quote_level == 0) { |
|
335 | + $message .= '[quote' . $matches[1] . ']'; |
|
336 | + } |
|
323 | 337 | $quote_level++; |
324 | - } |
|
325 | - elseif (preg_match('/\[\/quote\]/i', $block)) |
|
338 | + } elseif (preg_match('/\[\/quote\]/i', $block)) |
|
326 | 339 | { |
327 | - if ($quote_level <= 1) |
|
328 | - $message .= '[/quote]'; |
|
340 | + if ($quote_level <= 1) { |
|
341 | + $message .= '[/quote]'; |
|
342 | + } |
|
329 | 343 | if ($quote_level >= 1) |
330 | 344 | { |
331 | 345 | $quote_level--; |
332 | 346 | $message .= "\n"; |
333 | 347 | } |
348 | + } elseif ($quote_level <= 1) { |
|
349 | + $message .= $block; |
|
334 | 350 | } |
335 | - elseif ($quote_level <= 1) |
|
336 | - $message .= $block; |
|
337 | 351 | } |
338 | 352 | |
339 | 353 | preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches); |
340 | 354 | |
341 | 355 | $id_msgs = $matches[1]; |
342 | - foreach ($id_msgs as $k => $id_msg) |
|
343 | - $id_msgs[$k] = (int) $id_msg; |
|
356 | + foreach ($id_msgs as $k => $id_msg) { |
|
357 | + $id_msgs[$k] = (int) $id_msg; |
|
358 | + } |
|
344 | 359 | |
345 | - if (empty($id_msgs)) |
|
346 | - return array(); |
|
360 | + if (empty($id_msgs)) { |
|
361 | + return array(); |
|
362 | + } |
|
347 | 363 | |
348 | 364 | // Get the messages |
349 | 365 | $request = $smcFunc['db_query']('', ' |
@@ -361,8 +377,9 @@ discard block |
||
361 | 377 | $members = array(); |
362 | 378 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
363 | 379 | { |
364 | - if ($posterOptions['id'] == $row['id_member']) |
|
365 | - continue; |
|
380 | + if ($posterOptions['id'] == $row['id_member']) { |
|
381 | + continue; |
|
382 | + } |
|
366 | 383 | |
367 | 384 | $members[$row['id_member']] = $row; |
368 | 385 | } |
@@ -376,10 +393,11 @@ discard block |
||
376 | 393 | |
377 | 394 | foreach ($members as $id => $member) |
378 | 395 | { |
379 | - if (!empty($prefs[$id]['msg_mention'])) |
|
380 | - $done_members[] = $id; |
|
381 | - else |
|
382 | - continue; |
|
396 | + if (!empty($prefs[$id]['msg_mention'])) { |
|
397 | + $done_members[] = $id; |
|
398 | + } else { |
|
399 | + continue; |
|
400 | + } |
|
383 | 401 | |
384 | 402 | // Alerts' emails are always instant |
385 | 403 | if ($prefs[$id]['msg_mention'] & self::RECEIVE_NOTIFY_EMAIL) |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | * @version 2.1 Beta 4 |
16 | 16 | */ |
17 | 17 | |
18 | -if (!defined('SMF')) |
|
18 | +if (!defined('SMF')) { |
|
19 | 19 | die('No direct access...'); |
20 | +} |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -246,8 +247,9 @@ discard block |
||
246 | 247 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
247 | 248 | { |
248 | 249 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
249 | - if (!empty($row['private'])) |
|
250 | - $row['subject'] = $txt['personal_message']; |
|
250 | + if (!empty($row['private'])) { |
|
251 | + $row['subject'] = $txt['personal_message']; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | $mails[] = $row; |
253 | 255 | } |
@@ -301,8 +303,9 @@ discard block |
||
301 | 303 | $element = substr($key, strrpos($key, '_') + 1); |
302 | 304 | $processedBirthdayEmails[$index][$element] = $value; |
303 | 305 | } |
304 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
305 | - $emails[$index] = $index; |
|
306 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
307 | + $emails[$index] = $index; |
|
308 | + } |
|
306 | 309 | |
307 | 310 | $config_vars = array( |
308 | 311 | // Mail queue stuff, this rocks ;) |
@@ -323,8 +326,9 @@ discard block |
||
323 | 326 | |
324 | 327 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
325 | 328 | |
326 | - if ($return_config) |
|
327 | - return $config_vars; |
|
329 | + if ($return_config) { |
|
330 | + return $config_vars; |
|
331 | + } |
|
328 | 332 | |
329 | 333 | // Saving? |
330 | 334 | if (isset($_GET['save'])) |
@@ -399,9 +403,9 @@ discard block |
||
399 | 403 | ); |
400 | 404 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
401 | 405 | $smcFunc['db_free_result']($request); |
406 | + } else { |
|
407 | + $_GET['te'] = (int) $_GET['te']; |
|
402 | 408 | } |
403 | - else |
|
404 | - $_GET['te'] = (int) $_GET['te']; |
|
405 | 409 | |
406 | 410 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
407 | 411 | |
@@ -425,12 +429,14 @@ discard block |
||
425 | 429 | |
426 | 430 | // Try get more time... |
427 | 431 | @set_time_limit(600); |
428 | - if (function_exists('apache_reset_timeout')) |
|
429 | - @apache_reset_timeout(); |
|
432 | + if (function_exists('apache_reset_timeout')) { |
|
433 | + @apache_reset_timeout(); |
|
434 | + } |
|
430 | 435 | |
431 | 436 | // Have we already used our maximum time? |
432 | - if ((time() - $time_start) < 5) |
|
433 | - return; |
|
437 | + if ((time() - $time_start) < 5) { |
|
438 | + return; |
|
439 | + } |
|
434 | 440 | |
435 | 441 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
436 | 442 | $context['page_title'] = $txt['not_done_title']; |
@@ -480,9 +486,10 @@ discard block |
||
480 | 486 | } |
481 | 487 | |
482 | 488 | // The result. |
483 | - if (isset($_GET['result'])) |
|
484 | - $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
485 | -} |
|
489 | + if (isset($_GET['result'])) { |
|
490 | + $context['result'] = ($_GET['result'] == 'success' ? 'success' : 'failure'); |
|
491 | + } |
|
492 | + } |
|
486 | 493 | |
487 | 494 | /** |
488 | 495 | * Little utility function to calculate how long ago a time was. |
@@ -494,8 +501,9 @@ discard block |
||
494 | 501 | { |
495 | 502 | global $txt; |
496 | 503 | |
497 | - if ($time_diff < 0) |
|
498 | - $time_diff = 0; |
|
504 | + if ($time_diff < 0) { |
|
505 | + $time_diff = 0; |
|
506 | + } |
|
499 | 507 | |
500 | 508 | // Just do a bit of an if fest... |
501 | 509 | if ($time_diff > 86400) |
@@ -516,8 +524,9 @@ discard block |
||
516 | 524 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
517 | 525 | } |
518 | 526 | // Otherwise must be second |
519 | - else |
|
520 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
521 | -} |
|
527 | + else { |
|
528 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
529 | + } |
|
530 | + } |
|
522 | 531 | |
523 | 532 | ?> |
524 | 533 | \ No newline at end of file |