@@ -1096,7 +1096,7 @@ |
||
1096 | 1096 | /** |
1097 | 1097 | * CHMOD control form |
1098 | 1098 | * |
1099 | - * @return bool False if nothing to do. |
|
1099 | + * @return false|null False if nothing to do. |
|
1100 | 1100 | */ |
1101 | 1101 | function template_control_chmod() |
1102 | 1102 | { |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | { |
913 | 913 | // 1. Some mod [ Download ]. |
914 | 914 | echo ' |
915 | - <strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>': $package['name'], '</strong> |
|
915 | + <strong><span id="ps_img_', $i, '_pkg_', $id, '" class="toggle_up" alt="*" style="display: none;"></span> ', $package['can_install'] || !empty($package['can_emulate_install']) ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>' : $package['name'], '</strong> |
|
916 | 916 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
917 | 917 | |
918 | 918 | // Show the mod type? |
@@ -1284,10 +1284,10 @@ discard block |
||
1284 | 1284 | <head> |
1285 | 1285 | <meta charset="', $context['character_set'], '"> |
1286 | 1286 | <title>', $txt['operation_title'], '</title> |
1287 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
1288 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'] ,'"> |
|
1289 | - <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'] ,'"></script> |
|
1290 | - <script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'] ,'"></script> |
|
1287 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
1288 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/admin.css', $modSettings['browser_cache'], '"> |
|
1289 | + <script src="', $settings['default_theme_url'], '/scripts/script.js', $modSettings['browser_cache'], '"></script> |
|
1290 | + <script src="', $settings['default_theme_url'], '/scripts/theme.js', $modSettings['browser_cache'], '"></script> |
|
1291 | 1291 | </head> |
1292 | 1292 | <body> |
1293 | 1293 | <div class="padding windowbg"> |
@@ -31,12 +31,13 @@ discard block |
||
31 | 31 | </div> |
32 | 32 | <div class="information">'; |
33 | 33 | |
34 | - if ($context['is_installed']) |
|
35 | - echo ' |
|
34 | + if ($context['is_installed']) { |
|
35 | + echo ' |
|
36 | 36 | <strong>', $txt['package_installed_warning1'], '</strong><br> |
37 | 37 | <br> |
38 | 38 | ', $txt['package_installed_warning2'], '<br> |
39 | 39 | <br>'; |
40 | + } |
|
40 | 41 | |
41 | 42 | echo $txt['package_installed_warning3'], ' |
42 | 43 | </div><br>'; |
@@ -63,8 +64,9 @@ discard block |
||
63 | 64 | ', $context['package_readme'], ' |
64 | 65 | <span class="floatright">', $txt['package_available_readme_language'], ' |
65 | 66 | <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\'));">'; |
66 | - foreach ($context['readmes'] as $a => $b) |
|
67 | - echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>'; |
|
67 | + foreach ($context['readmes'] as $a => $b) { |
|
68 | + echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>'; |
|
69 | + } |
|
68 | 70 | echo ' |
69 | 71 | </select> |
70 | 72 | </span> |
@@ -83,8 +85,9 @@ discard block |
||
83 | 85 | ', $context['package_license'], ' |
84 | 86 | <span class="floatright">', $txt['package_available_license_language'], ' |
85 | 87 | <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\'));">'; |
86 | - foreach ($context['licenses'] as $a => $b) |
|
87 | - echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>'; |
|
88 | + foreach ($context['licenses'] as $a => $b) { |
|
89 | + echo '<option value="', $b, '"', $a === 'selected' ? ' selected' : '', '>', $b == 'default' ? $txt['package_license_default'] : ucfirst($b), '</option>'; |
|
90 | + } |
|
88 | 91 | echo ' |
89 | 92 | </select> |
90 | 93 | </span> |
@@ -110,9 +113,10 @@ discard block |
||
110 | 113 | ', $txt['package_db_uninstall_actions'], ': |
111 | 114 | <ul>'; |
112 | 115 | |
113 | - foreach ($context['database_changes'] as $change) |
|
114 | - echo ' |
|
116 | + foreach ($context['database_changes'] as $change) { |
|
117 | + echo ' |
|
115 | 118 | <li>', $change, '</li>'; |
119 | + } |
|
116 | 120 | echo ' |
117 | 121 | </ul> |
118 | 122 | </div> |
@@ -122,14 +126,14 @@ discard block |
||
122 | 126 | echo ' |
123 | 127 | <div class="information">'; |
124 | 128 | |
125 | - if (empty($context['actions']) && empty($context['database_changes'])) |
|
126 | - echo ' |
|
129 | + if (empty($context['actions']) && empty($context['database_changes'])) { |
|
130 | + echo ' |
|
127 | 131 | <br> |
128 | 132 | <div class="errorbox"> |
129 | 133 | ', $txt['corrupt_compatible'], ' |
130 | 134 | </div> |
131 | 135 | </div>'; |
132 | - else |
|
136 | + } else |
|
133 | 137 | { |
134 | 138 | echo ' |
135 | 139 | ', $txt['perform_actions'], ' |
@@ -229,9 +233,10 @@ discard block |
||
229 | 233 | <tr class="title_bar"> |
230 | 234 | <td></td> |
231 | 235 | <td>'; |
232 | - if (!empty($context['themes_locked'])) |
|
233 | - echo ' |
|
236 | + if (!empty($context['themes_locked'])) { |
|
237 | + echo ' |
|
234 | 238 | <input type="hidden" name="custom_theme[]" value="', $id, '">'; |
239 | + } |
|
235 | 240 | echo ' |
236 | 241 | <input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" class="input_check" 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' : '', '> |
237 | 242 | </td> |
@@ -372,14 +377,15 @@ discard block |
||
372 | 377 | </script>'; |
373 | 378 | |
374 | 379 | // And a bit more for database changes. |
375 | - if (!empty($context['database_changes'])) |
|
376 | - echo ' |
|
380 | + if (!empty($context['database_changes'])) { |
|
381 | + echo ' |
|
377 | 382 | <script> |
378 | 383 | var database_changes_area = document.getElementById(\'db_changes_div\'); |
379 | 384 | var db_vis = false; |
380 | 385 | database_changes_area.style.display = "none"; |
381 | 386 | </script>'; |
382 | -} |
|
387 | + } |
|
388 | + } |
|
383 | 389 | |
384 | 390 | /** |
385 | 391 | * Extract package contents |
@@ -411,12 +417,12 @@ discard block |
||
411 | 417 | <h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3> |
412 | 418 | </div> |
413 | 419 | <div class="information">', $txt['package_installed_extract'], '</div>'; |
414 | - } |
|
415 | - else |
|
416 | - echo ' |
|
420 | + } else { |
|
421 | + echo ' |
|
417 | 422 | <div class="cat_bar"> |
418 | 423 | <h3 class="catbg">', $txt['package_installed_redirecting'], '</h3> |
419 | 424 | </div>'; |
425 | + } |
|
420 | 426 | |
421 | 427 | echo ' |
422 | 428 | <div class="windowbg">'; |
@@ -427,25 +433,25 @@ discard block |
||
427 | 433 | echo ' |
428 | 434 | ', $context['redirect_text'], '<br><br> |
429 | 435 | <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>'; |
430 | - } |
|
431 | - elseif ($context['uninstalling']) |
|
432 | - echo ' |
|
436 | + } elseif ($context['uninstalling']) { |
|
437 | + echo ' |
|
433 | 438 | ', $txt['package_uninstall_done']; |
434 | - elseif ($context['install_finished']) |
|
439 | + } elseif ($context['install_finished']) |
|
435 | 440 | { |
436 | - if ($context['extract_type'] == 'avatar') |
|
437 | - echo ' |
|
441 | + if ($context['extract_type'] == 'avatar') { |
|
442 | + echo ' |
|
438 | 443 | ', $txt['avatars_extracted']; |
439 | - elseif ($context['extract_type'] == 'language') |
|
440 | - echo ' |
|
444 | + } elseif ($context['extract_type'] == 'language') { |
|
445 | + echo ' |
|
441 | 446 | ', $txt['language_extracted']; |
442 | - else |
|
443 | - echo ' |
|
447 | + } else { |
|
448 | + echo ' |
|
444 | 449 | ', $txt['package_installed_done']; |
445 | - } |
|
446 | - else |
|
447 | - echo ' |
|
450 | + } |
|
451 | + } else { |
|
452 | + echo ' |
|
448 | 453 | ', $txt['corrupt_compatible']; |
454 | + } |
|
449 | 455 | |
450 | 456 | echo ' |
451 | 457 | </div>'; |
@@ -479,9 +485,10 @@ discard block |
||
479 | 485 | <div class="windowbg"> |
480 | 486 | <ol>'; |
481 | 487 | |
482 | - foreach ($context['files'] as $fileinfo) |
|
483 | - echo ' |
|
488 | + foreach ($context['files'] as $fileinfo) { |
|
489 | + echo ' |
|
484 | 490 | <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>'; |
491 | + } |
|
485 | 492 | |
486 | 493 | echo ' |
487 | 494 | </ol> |
@@ -545,9 +552,10 @@ discard block |
||
545 | 552 | </script> |
546 | 553 | <div id="yourVersion" style="display:none">', $context['forum_version'], '</div>'; |
547 | 554 | |
548 | - if (empty($modSettings['disable_smf_js'])) |
|
549 | - echo ' |
|
555 | + if (empty($modSettings['disable_smf_js'])) { |
|
556 | + echo ' |
|
550 | 557 | <script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
558 | + } |
|
551 | 559 | |
552 | 560 | // This sets the announcements and current versions themselves ;). |
553 | 561 | echo ' |
@@ -586,12 +594,13 @@ discard block |
||
586 | 594 | } |
587 | 595 | } |
588 | 596 | |
589 | - if (!$mods_available) |
|
590 | - echo ' |
|
597 | + if (!$mods_available) { |
|
598 | + echo ' |
|
591 | 599 | <div class="noticebox">', $txt['no_packages'], '</div>'; |
592 | - else |
|
593 | - echo ' |
|
600 | + } else { |
|
601 | + echo ' |
|
594 | 602 | <br>'; |
603 | + } |
|
595 | 604 | |
596 | 605 | // the advanced (emulation) box, collapsed by default |
597 | 606 | echo ' |
@@ -680,11 +689,12 @@ discard block |
||
680 | 689 | { |
681 | 690 | global $context, $txt, $scripturl; |
682 | 691 | |
683 | - if (!empty($context['package_ftp']['error'])) |
|
684 | - echo ' |
|
692 | + if (!empty($context['package_ftp']['error'])) { |
|
693 | + echo ' |
|
685 | 694 | <div class="errorbox"> |
686 | 695 | <pre>', $context['package_ftp']['error'], '</pre> |
687 | 696 | </div>'; |
697 | + } |
|
688 | 698 | |
689 | 699 | echo ' |
690 | 700 | <div id="admin_form_wrapper"> |
@@ -765,13 +775,14 @@ discard block |
||
765 | 775 | <fieldset> |
766 | 776 | <legend>' . $txt['package_servers'] . '</legend> |
767 | 777 | <ul class="package_servers">'; |
768 | - foreach ($context['servers'] as $server) |
|
769 | - echo ' |
|
778 | + foreach ($context['servers'] as $server) { |
|
779 | + echo ' |
|
770 | 780 | <li class="flow_auto"> |
771 | 781 | <span class="floatleft">' . $server['name'] . '</span> |
772 | 782 | <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> |
773 | 783 | <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span> |
774 | 784 | </li>'; |
785 | + } |
|
775 | 786 | echo ' |
776 | 787 | </ul> |
777 | 788 | </fieldset> |
@@ -858,11 +869,12 @@ discard block |
||
858 | 869 | <div class="windowbg2">'; |
859 | 870 | |
860 | 871 | // No packages, as yet. |
861 | - if (empty($context['package_list'])) |
|
862 | - echo ' |
|
872 | + if (empty($context['package_list'])) { |
|
873 | + echo ' |
|
863 | 874 | <ul> |
864 | 875 | <li>', $txt['no_packages'], '</li> |
865 | 876 | </ul>'; |
877 | + } |
|
866 | 878 | // List out the packages... |
867 | 879 | else |
868 | 880 | { |
@@ -874,11 +886,12 @@ discard block |
||
874 | 886 | <li> |
875 | 887 | <strong><span id="ps_img_', $i, '" class="toggle_up" alt="*" style="display: none;"></span> ', $packageSection['title'], '</strong>'; |
876 | 888 | |
877 | - if (!empty($packageSection['text'])) |
|
878 | - echo ' |
|
889 | + if (!empty($packageSection['text'])) { |
|
890 | + echo ' |
|
879 | 891 | <div class="sub_bar"> |
880 | 892 | <h3 class="subbg">', $packageSection['text'], '</h3> |
881 | 893 | </div>'; |
894 | + } |
|
882 | 895 | |
883 | 896 | echo ' |
884 | 897 | <', $context['list_type'], ' id="package_section_', $i, '" class="packages">'; |
@@ -888,13 +901,15 @@ discard block |
||
888 | 901 | echo ' |
889 | 902 | <li>'; |
890 | 903 | // Textual message. Could be empty just for a blank line... |
891 | - if ($package['is_text']) |
|
892 | - echo ' |
|
904 | + if ($package['is_text']) { |
|
905 | + echo ' |
|
893 | 906 | ', empty($package['name']) ? ' ' : $package['name']; |
907 | + } |
|
894 | 908 | // This is supposed to be a rule.. |
895 | - elseif ($package['is_line']) |
|
896 | - echo ' |
|
909 | + elseif ($package['is_line']) { |
|
910 | + echo ' |
|
897 | 911 | <hr>'; |
912 | + } |
|
898 | 913 | // A remote link. |
899 | 914 | elseif ($package['is_remote']) |
900 | 915 | { |
@@ -916,21 +931,25 @@ discard block |
||
916 | 931 | <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">'; |
917 | 932 | |
918 | 933 | // Show the mod type? |
919 | - if ($package['type'] != '') |
|
920 | - echo ' |
|
934 | + if ($package['type'] != '') { |
|
935 | + echo ' |
|
921 | 936 | <li class="package_section">', $txt['package_type'], ': ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '</li>'; |
937 | + } |
|
922 | 938 | // Show the version number? |
923 | - if ($package['version'] != '') |
|
924 | - echo ' |
|
939 | + if ($package['version'] != '') { |
|
940 | + echo ' |
|
925 | 941 | <li class="package_section">', $txt['mod_version'], ': ', $package['version'], '</li>'; |
942 | + } |
|
926 | 943 | // How 'bout the author? |
927 | - if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) |
|
928 | - echo ' |
|
944 | + if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link'])) { |
|
945 | + echo ' |
|
929 | 946 | <li class="package_section">', $txt['mod_author'], ': ', $package['author']['link'], '</li>'; |
947 | + } |
|
930 | 948 | // The homepage.... |
931 | - if ($package['author']['website']['link'] != '') |
|
932 | - echo ' |
|
949 | + if ($package['author']['website']['link'] != '') { |
|
950 | + echo ' |
|
933 | 951 | <li class="package_section">', $txt['author_website'], ': ', $package['author']['website']['link'], '</li>'; |
952 | + } |
|
934 | 953 | |
935 | 954 | // Desciption: bleh bleh! |
936 | 955 | // Location of file: http://someplace/. |
@@ -983,8 +1002,8 @@ discard block |
||
983 | 1002 | |
984 | 1003 | foreach ($ps['items'] as $id => $package) |
985 | 1004 | { |
986 | - if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) |
|
987 | - echo ' |
|
1005 | + if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote']) { |
|
1006 | + echo ' |
|
988 | 1007 | var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({ |
989 | 1008 | bToggleEnabled: true, |
990 | 1009 | bCurrentlyCollapsed: true, |
@@ -999,6 +1018,7 @@ discard block |
||
999 | 1018 | } |
1000 | 1019 | ] |
1001 | 1020 | });'; |
1021 | + } |
|
1002 | 1022 | } |
1003 | 1023 | } |
1004 | 1024 | echo ' |
@@ -1039,9 +1059,10 @@ discard block |
||
1039 | 1059 | { |
1040 | 1060 | global $context, $txt, $scripturl; |
1041 | 1061 | |
1042 | - if (!empty($context['saved_successful'])) |
|
1043 | - echo ' |
|
1062 | + if (!empty($context['saved_successful'])) { |
|
1063 | + echo ' |
|
1044 | 1064 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
1065 | + } |
|
1045 | 1066 | |
1046 | 1067 | echo ' |
1047 | 1068 | <div id="admincenter"> |
@@ -1103,8 +1124,9 @@ discard block |
||
1103 | 1124 | global $context, $txt; |
1104 | 1125 | |
1105 | 1126 | // Nothing to do? Brilliant! |
1106 | - if (empty($context['package_ftp'])) |
|
1107 | - return false; |
|
1127 | + if (empty($context['package_ftp'])) { |
|
1128 | + return false; |
|
1129 | + } |
|
1108 | 1130 | |
1109 | 1131 | if (empty($context['package_ftp']['form_elements_only'])) |
1110 | 1132 | { |
@@ -1113,19 +1135,21 @@ discard block |
||
1113 | 1135 | <div id="need_writable_list" class="smalltext"> |
1114 | 1136 | ', $txt['package_ftp_why_file_list'], ' |
1115 | 1137 | <ul style="display: inline;">'; |
1116 | - if (!empty($context['notwritable_files'])) |
|
1117 | - foreach ($context['notwritable_files'] as $file) |
|
1138 | + if (!empty($context['notwritable_files'])) { |
|
1139 | + foreach ($context['notwritable_files'] as $file) |
|
1118 | 1140 | echo ' |
1119 | 1141 | <li>', $file, '</li>'; |
1142 | + } |
|
1120 | 1143 | |
1121 | 1144 | echo ' |
1122 | 1145 | </ul>'; |
1123 | 1146 | |
1124 | - if (!$context['server']['is_windows']) |
|
1125 | - echo ' |
|
1147 | + if (!$context['server']['is_windows']) { |
|
1148 | + echo ' |
|
1126 | 1149 | <hr> |
1127 | 1150 | ', $txt['package_chmod_linux'], '<br /> |
1128 | 1151 | <tt># chmod a+w ', implode(' ', $context['notwritable_files']), '</tt>'; |
1152 | + } |
|
1129 | 1153 | |
1130 | 1154 | echo ' |
1131 | 1155 | </div>'; |
@@ -1136,9 +1160,10 @@ discard block |
||
1136 | 1160 | <tt id="ftp_error_message">', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '</tt> |
1137 | 1161 | </div></div>'; |
1138 | 1162 | |
1139 | - if (!empty($context['package_ftp']['destination'])) |
|
1140 | - echo ' |
|
1163 | + if (!empty($context['package_ftp']['destination'])) { |
|
1164 | + echo ' |
|
1141 | 1165 | <form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">'; |
1166 | + } |
|
1142 | 1167 | |
1143 | 1168 | echo ' |
1144 | 1169 | <fieldset> |
@@ -1171,25 +1196,28 @@ discard block |
||
1171 | 1196 | </dl> |
1172 | 1197 | </fieldset>'; |
1173 | 1198 | |
1174 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
1175 | - echo ' |
|
1199 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
1200 | + echo ' |
|
1176 | 1201 | |
1177 | 1202 | <div class="righttext" style="margin: 1ex;"> |
1178 | 1203 | <span id="test_ftp_placeholder_full"></span> |
1179 | 1204 | <input type="submit" value="', $txt['package_proceed'], '" class="button_submit"> |
1180 | 1205 | </div>'; |
1206 | + } |
|
1181 | 1207 | |
1182 | - if (!empty($context['package_ftp']['destination'])) |
|
1183 | - echo ' |
|
1208 | + if (!empty($context['package_ftp']['destination'])) { |
|
1209 | + echo ' |
|
1184 | 1210 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1185 | 1211 | </form>'; |
1212 | + } |
|
1186 | 1213 | |
1187 | 1214 | // Hide the details of the list. |
1188 | - if (empty($context['package_ftp']['form_elements_only'])) |
|
1189 | - echo ' |
|
1215 | + if (empty($context['package_ftp']['form_elements_only'])) { |
|
1216 | + echo ' |
|
1190 | 1217 | <script> |
1191 | 1218 | document.getElementById(\'need_writable_list\').style.display = \'none\'; |
1192 | 1219 | </script>'; |
1220 | + } |
|
1193 | 1221 | |
1194 | 1222 | // Quick generate the test button. |
1195 | 1223 | echo ' |
@@ -1545,9 +1573,10 @@ discard block |
||
1545 | 1573 | <tr class="windowbg"> |
1546 | 1574 | <td width="30%"><strong>'; |
1547 | 1575 | |
1548 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
1549 | - echo ' |
|
1576 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
1577 | + echo ' |
|
1550 | 1578 | <span class="generic_icons folder"></span>'; |
1579 | + } |
|
1551 | 1580 | |
1552 | 1581 | echo ' |
1553 | 1582 | ', $name, ' |
@@ -1564,8 +1593,9 @@ discard block |
||
1564 | 1593 | </tr> |
1565 | 1594 | '; |
1566 | 1595 | |
1567 | - if (!empty($dir['contents'])) |
|
1568 | - template_permission_show_contents($name, $dir['contents'], 1); |
|
1596 | + if (!empty($dir['contents'])) { |
|
1597 | + template_permission_show_contents($name, $dir['contents'], 1); |
|
1598 | + } |
|
1569 | 1599 | } |
1570 | 1600 | |
1571 | 1601 | echo ' |
@@ -1601,13 +1631,14 @@ discard block |
||
1601 | 1631 | </fieldset>'; |
1602 | 1632 | |
1603 | 1633 | // Likely to need FTP? |
1604 | - if (empty($context['ftp_connected'])) |
|
1605 | - echo ' |
|
1634 | + if (empty($context['ftp_connected'])) { |
|
1635 | + echo ' |
|
1606 | 1636 | <p> |
1607 | 1637 | ', $txt['package_file_perms_ftp_details'], ': |
1608 | 1638 | </p> |
1609 | 1639 | ', template_control_chmod(), ' |
1610 | 1640 | <div class="noticebox">', $txt['package_file_perms_ftp_retain'], '</div>'; |
1641 | + } |
|
1611 | 1642 | |
1612 | 1643 | echo ' |
1613 | 1644 | <span id="test_ftp_placeholder_full"></span> |
@@ -1616,9 +1647,10 @@ discard block |
||
1616 | 1647 | </div>'; |
1617 | 1648 | |
1618 | 1649 | // Any looks fors we've already done? |
1619 | - foreach ($context['look_for'] as $path) |
|
1620 | - echo ' |
|
1650 | + foreach ($context['look_for'] as $path) { |
|
1651 | + echo ' |
|
1621 | 1652 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
1653 | + } |
|
1622 | 1654 | echo ' |
1623 | 1655 | </form><br>'; |
1624 | 1656 | } |
@@ -1657,9 +1689,10 @@ discard block |
||
1657 | 1689 | <td class="smalltext" width="30%">' . str_repeat(' ', $level * 5), ' |
1658 | 1690 | ', (!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, "'\\") . '\');">' : ''; |
1659 | 1691 | |
1660 | - if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) |
|
1661 | - echo ' |
|
1692 | + if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive')) { |
|
1693 | + echo ' |
|
1662 | 1694 | <span class="generic_icons folder"></span>'; |
1695 | + } |
|
1663 | 1696 | |
1664 | 1697 | echo ' |
1665 | 1698 | ', $name, ' |
@@ -1685,14 +1718,15 @@ discard block |
||
1685 | 1718 | } |
1686 | 1719 | |
1687 | 1720 | // We have more files to show? |
1688 | - if ($has_more) |
|
1689 | - echo ' |
|
1721 | + if ($has_more) { |
|
1722 | + echo ' |
|
1690 | 1723 | <tr class="windowbg" id="content_', $js_ident, '_more"> |
1691 | 1724 | <td class="smalltext" width="40%">' . str_repeat(' ', $level * 5), ' |
1692 | 1725 | « <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> » |
1693 | 1726 | </td> |
1694 | 1727 | <td colspan="6"></td> |
1695 | 1728 | </tr>'; |
1729 | + } |
|
1696 | 1730 | |
1697 | 1731 | if ($drawn_div) |
1698 | 1732 | { |
@@ -1700,15 +1734,17 @@ discard block |
||
1700 | 1734 | $isFound = false; |
1701 | 1735 | foreach ($context['look_for'] as $tree) |
1702 | 1736 | { |
1703 | - if (substr($tree, 0, strlen($ident)) == $ident) |
|
1704 | - $isFound = true; |
|
1737 | + if (substr($tree, 0, strlen($ident)) == $ident) { |
|
1738 | + $isFound = true; |
|
1739 | + } |
|
1705 | 1740 | } |
1706 | 1741 | |
1707 | - if ($level > 1 && !$isFound) |
|
1708 | - echo ' |
|
1742 | + if ($level > 1 && !$isFound) { |
|
1743 | + echo ' |
|
1709 | 1744 | <script> |
1710 | 1745 | expandFolder(\'', $js_ident, '\', \'\'); |
1711 | 1746 | </script>'; |
1747 | + } |
|
1712 | 1748 | } |
1713 | 1749 | } |
1714 | 1750 | |
@@ -1728,11 +1764,12 @@ discard block |
||
1728 | 1764 | <h3 class="catbg">', $txt['package_file_perms_applying'], '</h3> |
1729 | 1765 | </div>'; |
1730 | 1766 | |
1731 | - if (!empty($context['skip_ftp'])) |
|
1732 | - echo ' |
|
1767 | + if (!empty($context['skip_ftp'])) { |
|
1768 | + echo ' |
|
1733 | 1769 | <div class="errorbox"> |
1734 | 1770 | ', $txt['package_file_perms_skipping_ftp'], ' |
1735 | 1771 | </div>'; |
1772 | + } |
|
1736 | 1773 | |
1737 | 1774 | // How many have we done? |
1738 | 1775 | $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']); |
@@ -1770,28 +1807,31 @@ discard block |
||
1770 | 1807 | <br>'; |
1771 | 1808 | |
1772 | 1809 | // Put out the right hidden data. |
1773 | - if ($context['method'] == 'individual') |
|
1774 | - echo ' |
|
1810 | + if ($context['method'] == 'individual') { |
|
1811 | + echo ' |
|
1775 | 1812 | <input type="hidden" name="custom_value" value="', $context['custom_value'], '"> |
1776 | 1813 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
1777 | 1814 | <input type="hidden" name="toProcess" value="', base64_encode(json_encode($context['to_process'])), '">'; |
1778 | - else |
|
1779 | - echo ' |
|
1815 | + } else { |
|
1816 | + echo ' |
|
1780 | 1817 | <input type="hidden" name="predefined" value="', $context['predefined_type'], '"> |
1781 | 1818 | <input type="hidden" name="fileOffset" value="', $context['file_offset'], '"> |
1782 | 1819 | <input type="hidden" name="totalItems" value="', $context['total_items'], '"> |
1783 | 1820 | <input type="hidden" name="dirList" value="', base64_encode(json_encode($context['directory_list'])), '"> |
1784 | 1821 | <input type="hidden" name="specialFiles" value="', base64_encode(json_encode($context['special_files'])), '">'; |
1822 | + } |
|
1785 | 1823 | |
1786 | 1824 | // Are we not using FTP for whatever reason. |
1787 | - if (!empty($context['skip_ftp'])) |
|
1788 | - echo ' |
|
1825 | + if (!empty($context['skip_ftp'])) { |
|
1826 | + echo ' |
|
1789 | 1827 | <input type="hidden" name="skip_ftp" value="1">'; |
1828 | + } |
|
1790 | 1829 | |
1791 | 1830 | // Retain state. |
1792 | - foreach ($context['back_look_data'] as $path) |
|
1793 | - echo ' |
|
1831 | + foreach ($context['back_look_data'] as $path) { |
|
1832 | + echo ' |
|
1794 | 1833 | <input type="hidden" name="back_look[]" value="', $path, '">'; |
1834 | + } |
|
1795 | 1835 | |
1796 | 1836 | echo ' |
1797 | 1837 | <input type="hidden" name="method" value="', $context['method'], '"> |
@@ -66,26 +66,31 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function checkRequest() |
68 | 68 | { |
69 | - if (!$this->enabled) |
|
70 | - return false; |
|
69 | + if (!$this->enabled) { |
|
70 | + return false; |
|
71 | + } |
|
71 | 72 | |
72 | 73 | // Try to create the image cache directory if it doesn't exist |
73 | - if (!file_exists($this->cache)) |
|
74 | - if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
74 | + if (!file_exists($this->cache)) { |
|
75 | + if (!mkdir($this->cache) || !copy(dirname($this->cache) . '/index.php', $this->cache . '/index.php')) |
|
75 | 76 | return false; |
77 | + } |
|
76 | 78 | |
77 | - if (empty($_GET['hash']) || empty($_GET['request'])) |
|
78 | - return false; |
|
79 | + if (empty($_GET['hash']) || empty($_GET['request'])) { |
|
80 | + return false; |
|
81 | + } |
|
79 | 82 | |
80 | 83 | $hash = $_GET['hash']; |
81 | 84 | $request = $_GET['request']; |
82 | 85 | |
83 | - if (md5($request . $this->secret) != $hash) |
|
84 | - return false; |
|
86 | + if (md5($request . $this->secret) != $hash) { |
|
87 | + return false; |
|
88 | + } |
|
85 | 89 | |
86 | 90 | // Attempt to cache the request if it doesn't exist |
87 | - if (!$this->isCached($request)) |
|
88 | - return $this->cacheImage($request); |
|
91 | + if (!$this->isCached($request)) { |
|
92 | + return $this->cacheImage($request); |
|
93 | + } |
|
89 | 94 | |
90 | 95 | return true; |
91 | 96 | } |
@@ -106,15 +111,17 @@ discard block |
||
106 | 111 | if (!$cached || time() - $cached['time'] > (5 * 86400)) |
107 | 112 | { |
108 | 113 | @unlink($cached_file); |
109 | - if ($this->checkRequest()) |
|
110 | - $this->serve(); |
|
114 | + if ($this->checkRequest()) { |
|
115 | + $this->serve(); |
|
116 | + } |
|
111 | 117 | exit; |
112 | 118 | } |
113 | 119 | |
114 | 120 | // Make sure we're serving an image |
115 | 121 | $contentParts = explode('/', !empty($cached['content_type']) ? $cached['content_type'] : ''); |
116 | - if ($contentParts[0] != 'image') |
|
117 | - exit; |
|
122 | + if ($contentParts[0] != 'image') { |
|
123 | + exit; |
|
124 | + } |
|
118 | 125 | |
119 | 126 | header('Content-type: ' . $cached['content_type']); |
120 | 127 | header('Content-length: ' . $cached['size']); |
@@ -160,19 +167,22 @@ discard block |
||
160 | 167 | $request = $curl->get_url_data($request); |
161 | 168 | $response = $request->result(); |
162 | 169 | |
163 | - if (empty($response)) |
|
164 | - return false; |
|
170 | + if (empty($response)) { |
|
171 | + return false; |
|
172 | + } |
|
165 | 173 | |
166 | 174 | $headers = $response['headers']; |
167 | 175 | |
168 | 176 | // Make sure the url is returning an image |
169 | 177 | $contentParts = explode('/', !empty($headers['content-type']) ? $headers['content-type'] : ''); |
170 | - if ($contentParts[0] != 'image') |
|
171 | - return false; |
|
178 | + if ($contentParts[0] != 'image') { |
|
179 | + return false; |
|
180 | + } |
|
172 | 181 | |
173 | 182 | // Validate the filesize |
174 | - if ($response['size'] > ($this->maxSize * 1024)) |
|
175 | - return false; |
|
183 | + if ($response['size'] > ($this->maxSize * 1024)) { |
|
184 | + return false; |
|
185 | + } |
|
176 | 186 | |
177 | 187 | return file_put_contents($dest, json_encode(array( |
178 | 188 | 'content_type' => $headers['content-type'], |
@@ -184,7 +194,8 @@ discard block |
||
184 | 194 | } |
185 | 195 | |
186 | 196 | $proxy = new ProxyServer(); |
187 | -if ($proxy->checkRequest()) |
|
197 | +if ($proxy->checkRequest()) { |
|
188 | 198 | $proxy->serve(); |
199 | +} |
|
189 | 200 | |
190 | 201 | exit; |
@@ -583,8 +583,7 @@ discard block |
||
583 | 583 | { |
584 | 584 | $header = '<?php require("' . ($user_info['is_admin'] ? addslashes(realpath($boarddir . '/SSI.php')) : 'SSI.php') . '"); ?>' . "\n" . $header; |
585 | 585 | return $header . template_homepage_sample1_html() . $footer; |
586 | - } |
|
587 | - else |
|
586 | + } else |
|
588 | 587 | { |
589 | 588 | echo $header; |
590 | 589 | template_homepage_sample1_php(); |
@@ -599,9 +598,10 @@ discard block |
||
599 | 598 | |
600 | 599 | $topics = ssi_recentTopics(8, null, null, 'array'); |
601 | 600 | |
602 | - foreach ($topics as $topic) |
|
603 | - echo ' |
|
601 | + foreach ($topics as $topic) { |
|
602 | + echo ' |
|
604 | 603 | <li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>'; |
604 | + } |
|
605 | 605 | |
606 | 606 | unset($topics); |
607 | 607 |
@@ -182,7 +182,7 @@ |
||
182 | 182 | * Path to the tasks directory. |
183 | 183 | * @var string |
184 | 184 | */ |
185 | -$tasksdir = $sourcedir .'/tasks'; |
|
185 | +$tasksdir = $sourcedir . '/tasks'; |
|
186 | 186 | |
187 | 187 | ########## Error-Catching ########## |
188 | 188 | # Note: You shouldn't touch these settings. |
@@ -186,8 +186,9 @@ discard block |
||
186 | 186 | |
187 | 187 | ########## Error-Catching ########## |
188 | 188 | # Note: You shouldn't touch these settings. |
189 | -if (file_exists(dirname(__FILE__) . '/db_last_error.php')) |
|
189 | +if (file_exists(dirname(__FILE__) . '/db_last_error.php')) { |
|
190 | 190 | include(dirname(__FILE__) . '/db_last_error.php'); |
191 | +} |
|
191 | 192 | |
192 | 193 | if (!isset($db_last_error)) |
193 | 194 | { |
@@ -202,11 +203,14 @@ discard block |
||
202 | 203 | } |
203 | 204 | |
204 | 205 | # Make sure the paths are correct... at least try to fix them. |
205 | -if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) |
|
206 | +if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt')) { |
|
206 | 207 | $boarddir = dirname(__FILE__); |
207 | -if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) |
|
208 | +} |
|
209 | +if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources')) { |
|
208 | 210 | $sourcedir = $boarddir . '/Sources'; |
209 | -if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) |
|
211 | +} |
|
212 | +if (!file_exists($cachedir) && file_exists($boarddir . '/cache')) { |
|
210 | 213 | $cachedir = $boarddir . '/cache'; |
214 | +} |
|
211 | 215 | |
212 | 216 | ?> |
213 | 217 | \ No newline at end of file |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'utf8_default' => true, |
63 | 63 | 'utf8_required' => true, |
64 | 64 | 'alter_support' => true, |
65 | - 'validate_prefix' => function(&$value){ |
|
65 | + 'validate_prefix' => function(&$value) { |
|
66 | 66 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
67 | 67 | return true; |
68 | 68 | }, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'utf8_support' => true, |
80 | 80 | 'utf8_version' => '8.0', |
81 | 81 | 'utf8_version_check' => '$request = pg_query(\'SELECT version()\'); list ($version) = pg_fetch_row($request); list($pgl, $version) = explode(" ", $version); return $version;', |
82 | - 'validate_prefix' => function(&$value){ |
|
82 | + 'validate_prefix' => function(&$value) { |
|
83 | 83 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
84 | 84 | |
85 | 85 | // Is it reserved? |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | if (isset($_POST['db_user'])) |
742 | 742 | { |
743 | 743 | $incontext['db']['user'] = $_POST['db_user']; |
744 | - $incontext['db']['name'] = $_POST['db_name']; |
|
744 | + $incontext['db']['name'] = $_POST['db_name']; |
|
745 | 745 | $incontext['db']['server'] = $_POST['db_server']; |
746 | 746 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
747 | 747 | |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
1145 | 1145 | { |
1146 | 1146 | // Use the appropriate function based on the DB type |
1147 | - if ($db_type == 'mysql' || $db_type =='mysqli') |
|
1147 | + if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
1148 | 1148 | $db_errorno = $db_type . '_errno'; |
1149 | 1149 | |
1150 | 1150 | // Error 1050: Table already exists! |
@@ -1333,8 +1333,7 @@ discard block |
||
1333 | 1333 | require_once($sourcedir . '/Subs.php'); |
1334 | 1334 | |
1335 | 1335 | // We need this to properly hash the password for Admin |
1336 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
1337 | - function($string){ |
|
1336 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1338 | 1337 | global $sourcedir; |
1339 | 1338 | if (function_exists('mb_strtolower')) |
1340 | 1339 | return mb_strtolower($string, 'UTF-8'); |
@@ -1598,8 +1597,7 @@ discard block |
||
1598 | 1597 | updateStats('topic'); |
1599 | 1598 | |
1600 | 1599 | // This function is needed to do the updateStats('subject') call. |
1601 | - $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
|
1602 | - function($string){ |
|
1600 | + $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) { |
|
1603 | 1601 | global $sourcedir; |
1604 | 1602 | if (function_exists('mb_strtolower')) |
1605 | 1603 | return mb_strtolower($string, 'UTF-8'); |
@@ -1627,7 +1625,7 @@ discard block |
||
1627 | 1625 | // Sanity check that they loaded earlier! |
1628 | 1626 | if (isset($modSettings['recycle_board'])) |
1629 | 1627 | { |
1630 | - $forum_version = $current_smf_version; // The variable is usually defined in index.php so lets just use our variable to do it for us. |
|
1628 | + $forum_version = $current_smf_version; // The variable is usually defined in index.php so lets just use our variable to do it for us. |
|
1631 | 1629 | scheduled_fetchSMfiles(); // Now go get those files! |
1632 | 1630 | |
1633 | 1631 | // We've just installed! |
@@ -1801,7 +1799,7 @@ discard block |
||
1801 | 1799 | <title>', $txt['smf_installer'], '</title> |
1802 | 1800 | <link rel="stylesheet" href="Themes/default/css/index.css?alp21"> |
1803 | 1801 | <link rel="stylesheet" href="Themes/default/css/install.css?alp21"> |
1804 | - ', $txt['lang_rtl'] == true ? '<link rel="stylesheet" href="Themes/default/css/rtl.css?alp21">' : '' , ' |
|
1802 | + ', $txt['lang_rtl'] == true ? '<link rel="stylesheet" href="Themes/default/css/rtl.css?alp21">' : '', ' |
|
1805 | 1803 | |
1806 | 1804 | <script src="Themes/default/scripts/jquery-2.1.4.min.js"></script> |
1807 | 1805 | <script src="Themes/default/scripts/script.js"></script> |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | // ><html dir="ltr"><head><title>Error!</title></head><body>Sorry, this installer requires PHP!<div style="display: none;"> |
21 | 21 | |
22 | 22 | // Let's pull in useful classes |
23 | -if (!defined('SMF')) |
|
23 | +if (!defined('SMF')) { |
|
24 | 24 | define('SMF', 1); |
25 | +} |
|
25 | 26 | |
26 | 27 | require_once('Sources/Class-Package.php'); |
27 | 28 | |
@@ -83,12 +84,14 @@ discard block |
||
83 | 84 | $value = preg_replace('~[^A-Za-z0-9_\$]~', '', $value); |
84 | 85 | |
85 | 86 | // Is it reserved? |
86 | - if ($value == 'pg_') |
|
87 | - return $txt['error_db_prefix_reserved']; |
|
87 | + if ($value == 'pg_') { |
|
88 | + return $txt['error_db_prefix_reserved']; |
|
89 | + } |
|
88 | 90 | |
89 | 91 | // Is the prefix numeric? |
90 | - if (preg_match('~^\d~', $value)) |
|
91 | - return $txt['error_db_prefix_numeric']; |
|
92 | + if (preg_match('~^\d~', $value)) { |
|
93 | + return $txt['error_db_prefix_numeric']; |
|
94 | + } |
|
92 | 95 | |
93 | 96 | return true; |
94 | 97 | }, |
@@ -135,10 +138,11 @@ discard block |
||
135 | 138 | $incontext['skip'] = false; |
136 | 139 | |
137 | 140 | // Call the step and if it returns false that means pause! |
138 | - if (function_exists($step[2]) && $step[2]() === false) |
|
139 | - break; |
|
140 | - elseif (function_exists($step[2])) |
|
141 | - $incontext['current_step']++; |
|
141 | + if (function_exists($step[2]) && $step[2]() === false) { |
|
142 | + break; |
|
143 | + } elseif (function_exists($step[2])) { |
|
144 | + $incontext['current_step']++; |
|
145 | + } |
|
142 | 146 | |
143 | 147 | // No warnings pass on. |
144 | 148 | $incontext['warning'] = ''; |
@@ -154,12 +158,14 @@ discard block |
||
154 | 158 | global $databases, $incontext; |
155 | 159 | |
156 | 160 | // Just so people using older versions of PHP aren't left in the cold. |
157 | - if (!isset($_SERVER['PHP_SELF'])) |
|
158 | - $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
161 | + if (!isset($_SERVER['PHP_SELF'])) { |
|
162 | + $_SERVER['PHP_SELF'] = isset($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']) ? $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'] : 'install.php'; |
|
163 | + } |
|
159 | 164 | |
160 | 165 | // Turn off magic quotes runtime and enable error reporting. |
161 | - if (function_exists('set_magic_quotes_runtime')) |
|
162 | - @set_magic_quotes_runtime(0); |
|
166 | + if (function_exists('set_magic_quotes_runtime')) { |
|
167 | + @set_magic_quotes_runtime(0); |
|
168 | + } |
|
163 | 169 | error_reporting(E_ALL); |
164 | 170 | |
165 | 171 | // Fun. Low PHP version... |
@@ -173,21 +179,23 @@ discard block |
||
173 | 179 | { |
174 | 180 | ob_start(); |
175 | 181 | |
176 | - if (ini_get('session.save_handler') == 'user') |
|
177 | - @ini_set('session.save_handler', 'files'); |
|
178 | - if (function_exists('session_start')) |
|
179 | - @session_start(); |
|
180 | - } |
|
181 | - else |
|
182 | + if (ini_get('session.save_handler') == 'user') { |
|
183 | + @ini_set('session.save_handler', 'files'); |
|
184 | + } |
|
185 | + if (function_exists('session_start')) { |
|
186 | + @session_start(); |
|
187 | + } |
|
188 | + } else |
|
182 | 189 | { |
183 | 190 | ob_start('ob_gzhandler'); |
184 | 191 | |
185 | - if (ini_get('session.save_handler') == 'user') |
|
186 | - @ini_set('session.save_handler', 'files'); |
|
192 | + if (ini_get('session.save_handler') == 'user') { |
|
193 | + @ini_set('session.save_handler', 'files'); |
|
194 | + } |
|
187 | 195 | session_start(); |
188 | 196 | |
189 | - if (!headers_sent()) |
|
190 | - echo '<!DOCTYPE html> |
|
197 | + if (!headers_sent()) { |
|
198 | + echo '<!DOCTYPE html> |
|
191 | 199 | <html> |
192 | 200 | <head> |
193 | 201 | <title>', htmlspecialchars($_GET['pass_string']), '</title> |
@@ -196,6 +204,7 @@ discard block |
||
196 | 204 | <strong>', htmlspecialchars($_GET['pass_string']), '</strong> |
197 | 205 | </body> |
198 | 206 | </html>'; |
207 | + } |
|
199 | 208 | exit; |
200 | 209 | } |
201 | 210 | |
@@ -204,16 +213,18 @@ discard block |
||
204 | 213 | { |
205 | 214 | $incontext['remote_files_available'] = false; |
206 | 215 | $test = @fsockopen('www.simplemachines.org', 80, $errno, $errstr, 1); |
207 | - if ($test) |
|
208 | - $incontext['remote_files_available'] = true; |
|
216 | + if ($test) { |
|
217 | + $incontext['remote_files_available'] = true; |
|
218 | + } |
|
209 | 219 | @fclose($test); |
210 | 220 | } |
211 | 221 | |
212 | 222 | // Add slashes, as long as they aren't already being added. |
213 | - if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) |
|
214 | - foreach ($_POST as $k => $v) |
|
223 | + if (!function_exists('get_magic_quotes_gpc') || @get_magic_quotes_gpc() == 0) { |
|
224 | + foreach ($_POST as $k => $v) |
|
215 | 225 | if (strpos($k, 'password') === false && strpos($k, 'db_passwd') === false) |
216 | 226 | $_POST[$k] = addslashes($v); |
227 | + } |
|
217 | 228 | |
218 | 229 | // This is really quite simple; if ?delete is on the URL, delete the installer... |
219 | 230 | if (isset($_GET['delete'])) |
@@ -234,8 +245,7 @@ discard block |
||
234 | 245 | $ftp->close(); |
235 | 246 | |
236 | 247 | unset($_SESSION['installer_temp_ftp']); |
237 | - } |
|
238 | - else |
|
248 | + } else |
|
239 | 249 | { |
240 | 250 | @unlink(__FILE__); |
241 | 251 | |
@@ -276,8 +286,9 @@ discard block |
||
276 | 286 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
277 | 287 | while ($entry = $dir->read()) |
278 | 288 | { |
279 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
280 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
289 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
290 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
291 | + } |
|
281 | 292 | } |
282 | 293 | $dir->close(); |
283 | 294 | } |
@@ -312,10 +323,11 @@ discard block |
||
312 | 323 | } |
313 | 324 | |
314 | 325 | // Override the language file? |
315 | - if (isset($_GET['lang_file'])) |
|
316 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
317 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
318 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
326 | + if (isset($_GET['lang_file'])) { |
|
327 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
328 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
329 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
330 | + } |
|
319 | 331 | |
320 | 332 | // Make sure it exists, if it doesn't reset it. |
321 | 333 | 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'])) |
@@ -324,8 +336,9 @@ discard block |
||
324 | 336 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
325 | 337 | |
326 | 338 | // If we have english and some other language, use the other language. We Americans hate english :P. |
327 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
328 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
339 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
340 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
341 | + } |
|
329 | 342 | } |
330 | 343 | |
331 | 344 | // And now include the actual language file itself. |
@@ -338,15 +351,18 @@ discard block |
||
338 | 351 | global $db_prefix, $db_connection, $sourcedir; |
339 | 352 | global $smcFunc, $modSettings, $db_type, $db_name, $db_user, $db_persist; |
340 | 353 | |
341 | - if (empty($sourcedir)) |
|
342 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
354 | + if (empty($sourcedir)) { |
|
355 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
356 | + } |
|
343 | 357 | |
344 | 358 | // Need this to check whether we need the database password. |
345 | 359 | require(dirname(__FILE__) . '/Settings.php'); |
346 | - if (!defined('SMF')) |
|
347 | - define('SMF', 1); |
|
348 | - if (empty($smcFunc)) |
|
349 | - $smcFunc = array(); |
|
360 | + if (!defined('SMF')) { |
|
361 | + define('SMF', 1); |
|
362 | + } |
|
363 | + if (empty($smcFunc)) { |
|
364 | + $smcFunc = array(); |
|
365 | + } |
|
350 | 366 | |
351 | 367 | $modSettings['disableQueryCheck'] = true; |
352 | 368 | |
@@ -354,8 +370,9 @@ discard block |
||
354 | 370 | if (!$db_connection) |
355 | 371 | { |
356 | 372 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
357 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
358 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
373 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
374 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
375 | + } |
|
359 | 376 | |
360 | 377 | $db_options = array('persist' => $db_persist); |
361 | 378 | $port = ''; |
@@ -366,19 +383,20 @@ discard block |
||
366 | 383 | if ($db_type == 'mysql' || $db_type == 'mysqli') |
367 | 384 | { |
368 | 385 | $port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port']; |
369 | - } |
|
370 | - elseif ($db_type == 'postgresql') |
|
386 | + } elseif ($db_type == 'postgresql') |
|
371 | 387 | { |
372 | 388 | // PostgreSQL doesn't have a default port setting in php.ini, so just check against the default |
373 | 389 | $port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port']; |
374 | 390 | } |
375 | 391 | } |
376 | 392 | |
377 | - if (!empty($port)) |
|
378 | - $db_options['port'] = $port; |
|
393 | + if (!empty($port)) { |
|
394 | + $db_options['port'] = $port; |
|
395 | + } |
|
379 | 396 | |
380 | - if (!$db_connection) |
|
381 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
397 | + if (!$db_connection) { |
|
398 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
399 | + } |
|
382 | 400 | } |
383 | 401 | } |
384 | 402 | |
@@ -406,8 +424,9 @@ discard block |
||
406 | 424 | // @todo REMOVE THIS!! |
407 | 425 | else |
408 | 426 | { |
409 | - if (function_exists('doStep' . $_GET['step'])) |
|
410 | - call_user_func('doStep' . $_GET['step']); |
|
427 | + if (function_exists('doStep' . $_GET['step'])) { |
|
428 | + call_user_func('doStep' . $_GET['step']); |
|
429 | + } |
|
411 | 430 | } |
412 | 431 | // Show the footer. |
413 | 432 | template_install_below(); |
@@ -425,8 +444,9 @@ discard block |
||
425 | 444 | $incontext['sub_template'] = 'welcome_message'; |
426 | 445 | |
427 | 446 | // Done the submission? |
428 | - if (isset($_POST['contbutt'])) |
|
429 | - return true; |
|
447 | + if (isset($_POST['contbutt'])) { |
|
448 | + return true; |
|
449 | + } |
|
430 | 450 | |
431 | 451 | // See if we think they have already installed it? |
432 | 452 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -434,14 +454,17 @@ discard block |
||
434 | 454 | $probably_installed = 0; |
435 | 455 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
436 | 456 | { |
437 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
438 | - $probably_installed++; |
|
439 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
440 | - $probably_installed++; |
|
457 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
458 | + $probably_installed++; |
|
459 | + } |
|
460 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
461 | + $probably_installed++; |
|
462 | + } |
|
441 | 463 | } |
442 | 464 | |
443 | - if ($probably_installed == 2) |
|
444 | - $incontext['warning'] = $txt['error_already_installed']; |
|
465 | + if ($probably_installed == 2) { |
|
466 | + $incontext['warning'] = $txt['error_already_installed']; |
|
467 | + } |
|
445 | 468 | } |
446 | 469 | |
447 | 470 | // Is some database support even compiled in? |
@@ -456,8 +479,7 @@ discard block |
||
456 | 479 | $databases[$key]['supported'] = false; |
457 | 480 | $notFoundSQLFile = true; |
458 | 481 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
459 | - } |
|
460 | - else |
|
482 | + } else |
|
461 | 483 | { |
462 | 484 | $db_type = $key; |
463 | 485 | $incontext['supported_databases'][] = $db; |
@@ -466,29 +488,36 @@ discard block |
||
466 | 488 | } |
467 | 489 | |
468 | 490 | // Check the PHP version. |
469 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) |
|
470 | - $error = 'error_php_too_low'; |
|
491 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) { |
|
492 | + $error = 'error_php_too_low'; |
|
493 | + } |
|
471 | 494 | // Make sure we have a supported database |
472 | - elseif (empty($incontext['supported_databases'])) |
|
473 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
495 | + elseif (empty($incontext['supported_databases'])) { |
|
496 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
497 | + } |
|
474 | 498 | // How about session support? Some crazy sysadmin remove it? |
475 | - elseif (!function_exists('session_start')) |
|
476 | - $error = 'error_session_missing'; |
|
499 | + elseif (!function_exists('session_start')) { |
|
500 | + $error = 'error_session_missing'; |
|
501 | + } |
|
477 | 502 | // Make sure they uploaded all the files. |
478 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
479 | - $error = 'error_missing_files'; |
|
503 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
504 | + $error = 'error_missing_files'; |
|
505 | + } |
|
480 | 506 | // Very simple check on the session.save_path for Windows. |
481 | 507 | // @todo Move this down later if they don't use database-driven sessions? |
482 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
483 | - $error = 'error_session_save_path'; |
|
508 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
509 | + $error = 'error_session_save_path'; |
|
510 | + } |
|
484 | 511 | |
485 | 512 | // Since each of the three messages would look the same, anyway... |
486 | - if (isset($error)) |
|
487 | - $incontext['error'] = $txt[$error]; |
|
513 | + if (isset($error)) { |
|
514 | + $incontext['error'] = $txt[$error]; |
|
515 | + } |
|
488 | 516 | |
489 | 517 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
490 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
491 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
518 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
519 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
520 | + } |
|
492 | 521 | |
493 | 522 | return false; |
494 | 523 | } |
@@ -511,15 +540,18 @@ discard block |
||
511 | 540 | 'agreement.txt', |
512 | 541 | 'Settings.php' |
513 | 542 | ); |
514 | - if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) |
|
515 | - $writable_files[] = 'Settings_bak.php'; |
|
543 | + if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) { |
|
544 | + $writable_files[] = 'Settings_bak.php'; |
|
545 | + } |
|
516 | 546 | |
517 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
518 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
547 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
548 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
549 | + } |
|
519 | 550 | |
520 | 551 | // With mod_security installed, we could attempt to fix it with .htaccess. |
521 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
522 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
552 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
553 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
554 | + } |
|
523 | 555 | |
524 | 556 | $failed_files = array(); |
525 | 557 | |
@@ -535,12 +567,14 @@ discard block |
||
535 | 567 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
536 | 568 | |
537 | 569 | // Well, 755 hopefully worked... if not, try 777. |
538 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
539 | - $failed_files[] = $file; |
|
570 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
571 | + $failed_files[] = $file; |
|
572 | + } |
|
540 | 573 | } |
541 | 574 | } |
542 | - foreach ($extra_files as $file) |
|
543 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
575 | + foreach ($extra_files as $file) { |
|
576 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
577 | + } |
|
544 | 578 | } |
545 | 579 | // Windows is trickier. Let's try opening for r+... |
546 | 580 | else |
@@ -550,30 +584,35 @@ discard block |
||
550 | 584 | foreach ($writable_files as $file) |
551 | 585 | { |
552 | 586 | // Folders can't be opened for write... but the index.php in them can ;) |
553 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
554 | - $file .= '/index.php'; |
|
587 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
588 | + $file .= '/index.php'; |
|
589 | + } |
|
555 | 590 | |
556 | 591 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
557 | 592 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
558 | 593 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
559 | 594 | |
560 | 595 | // Hmm, okay, try just for write in that case... |
561 | - if (!is_resource($fp)) |
|
562 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
596 | + if (!is_resource($fp)) { |
|
597 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
598 | + } |
|
563 | 599 | |
564 | - if (!is_resource($fp)) |
|
565 | - $failed_files[] = $file; |
|
600 | + if (!is_resource($fp)) { |
|
601 | + $failed_files[] = $file; |
|
602 | + } |
|
566 | 603 | |
567 | 604 | @fclose($fp); |
568 | 605 | } |
569 | - foreach ($extra_files as $file) |
|
570 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
606 | + foreach ($extra_files as $file) { |
|
607 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
608 | + } |
|
571 | 609 | } |
572 | 610 | |
573 | 611 | $failure = count($failed_files) >= 1; |
574 | 612 | |
575 | - if (!isset($_SERVER)) |
|
576 | - return !$failure; |
|
613 | + if (!isset($_SERVER)) { |
|
614 | + return !$failure; |
|
615 | + } |
|
577 | 616 | |
578 | 617 | // Put the list into context. |
579 | 618 | $incontext['failed_files'] = $failed_files; |
@@ -621,19 +660,23 @@ discard block |
||
621 | 660 | |
622 | 661 | if (!isset($ftp) || $ftp->error !== false) |
623 | 662 | { |
624 | - if (!isset($ftp)) |
|
625 | - $ftp = new ftp_connection(null); |
|
663 | + if (!isset($ftp)) { |
|
664 | + $ftp = new ftp_connection(null); |
|
665 | + } |
|
626 | 666 | // Save the error so we can mess with listing... |
627 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
628 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
667 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
668 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
669 | + } |
|
629 | 670 | |
630 | 671 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
631 | 672 | |
632 | - if (empty($_POST['ftp_path']) && $found_path) |
|
633 | - $_POST['ftp_path'] = $detect_path; |
|
673 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
674 | + $_POST['ftp_path'] = $detect_path; |
|
675 | + } |
|
634 | 676 | |
635 | - if (!isset($_POST['ftp_username'])) |
|
636 | - $_POST['ftp_username'] = $username; |
|
677 | + if (!isset($_POST['ftp_username'])) { |
|
678 | + $_POST['ftp_username'] = $username; |
|
679 | + } |
|
637 | 680 | |
638 | 681 | // Set the username etc, into context. |
639 | 682 | $incontext['ftp'] = array( |
@@ -645,8 +688,7 @@ discard block |
||
645 | 688 | ); |
646 | 689 | |
647 | 690 | return false; |
648 | - } |
|
649 | - else |
|
691 | + } else |
|
650 | 692 | { |
651 | 693 | $_SESSION['installer_temp_ftp'] = array( |
652 | 694 | 'server' => $_POST['ftp_server'], |
@@ -660,10 +702,12 @@ discard block |
||
660 | 702 | |
661 | 703 | foreach ($failed_files as $file) |
662 | 704 | { |
663 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
664 | - $ftp->chmod($file, 0755); |
|
665 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
666 | - $ftp->chmod($file, 0777); |
|
705 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
706 | + $ftp->chmod($file, 0755); |
|
707 | + } |
|
708 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
709 | + $ftp->chmod($file, 0777); |
|
710 | + } |
|
667 | 711 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
668 | 712 | { |
669 | 713 | $failed_files_updated[] = $file; |
@@ -718,15 +762,17 @@ discard block |
||
718 | 762 | |
719 | 763 | if (!$foundOne) |
720 | 764 | { |
721 | - if (isset($db['default_host'])) |
|
722 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
765 | + if (isset($db['default_host'])) { |
|
766 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
767 | + } |
|
723 | 768 | if (isset($db['default_user'])) |
724 | 769 | { |
725 | 770 | $incontext['db']['user'] = ini_get($db['default_user']); |
726 | 771 | $incontext['db']['name'] = ini_get($db['default_user']); |
727 | 772 | } |
728 | - if (isset($db['default_password'])) |
|
729 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
773 | + if (isset($db['default_password'])) { |
|
774 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
775 | + } |
|
730 | 776 | |
731 | 777 | // For simplicity and less confusion, leave the port blank by default |
732 | 778 | $incontext['db']['port'] = ''; |
@@ -745,10 +791,10 @@ discard block |
||
745 | 791 | $incontext['db']['server'] = $_POST['db_server']; |
746 | 792 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
747 | 793 | |
748 | - if (!empty($_POST['db_port'])) |
|
749 | - $incontext['db']['port'] = $_POST['db_port']; |
|
750 | - } |
|
751 | - else |
|
794 | + if (!empty($_POST['db_port'])) { |
|
795 | + $incontext['db']['port'] = $_POST['db_port']; |
|
796 | + } |
|
797 | + } else |
|
752 | 798 | { |
753 | 799 | $incontext['db']['prefix'] = 'smf_'; |
754 | 800 | } |
@@ -784,10 +830,11 @@ discard block |
||
784 | 830 | if (!empty($_POST['db_port'])) |
785 | 831 | { |
786 | 832 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
787 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
788 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
789 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
790 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
833 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
834 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
835 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
836 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
837 | + } |
|
791 | 838 | } |
792 | 839 | |
793 | 840 | // God I hope it saved! |
@@ -800,8 +847,9 @@ discard block |
||
800 | 847 | // Make sure it works. |
801 | 848 | require(dirname(__FILE__) . '/Settings.php'); |
802 | 849 | |
803 | - if (empty($sourcedir)) |
|
804 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
850 | + if (empty($sourcedir)) { |
|
851 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
852 | + } |
|
805 | 853 | |
806 | 854 | // Better find the database file! |
807 | 855 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -811,18 +859,21 @@ discard block |
||
811 | 859 | } |
812 | 860 | |
813 | 861 | // Now include it for database functions! |
814 | - if (!defined('SMF')) |
|
815 | - define('SMF', 1); |
|
862 | + if (!defined('SMF')) { |
|
863 | + define('SMF', 1); |
|
864 | + } |
|
816 | 865 | |
817 | 866 | $modSettings['disableQueryCheck'] = true; |
818 | - if (empty($smcFunc)) |
|
819 | - $smcFunc = array(); |
|
867 | + if (empty($smcFunc)) { |
|
868 | + $smcFunc = array(); |
|
869 | + } |
|
820 | 870 | |
821 | 871 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
822 | 872 | |
823 | 873 | // What - running PHP4? The shame! |
824 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
825 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
874 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
875 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
876 | + } |
|
826 | 877 | |
827 | 878 | // Attempt a connection. |
828 | 879 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
@@ -910,12 +961,14 @@ discard block |
||
910 | 961 | $incontext['page_title'] = $txt['install_settings']; |
911 | 962 | |
912 | 963 | // Let's see if we got the database type correct. |
913 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
914 | - $db_type = $_POST['db_type']; |
|
964 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
965 | + $db_type = $_POST['db_type']; |
|
966 | + } |
|
915 | 967 | |
916 | 968 | // Else we'd better be able to get the connection. |
917 | - else |
|
918 | - load_database(); |
|
969 | + else { |
|
970 | + load_database(); |
|
971 | + } |
|
919 | 972 | |
920 | 973 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
921 | 974 | |
@@ -935,12 +988,14 @@ discard block |
||
935 | 988 | // Submitting? |
936 | 989 | if (isset($_POST['boardurl'])) |
937 | 990 | { |
938 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
939 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
940 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
941 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
942 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
943 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
991 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
992 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
993 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
994 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
995 | + } |
|
996 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
997 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
998 | + } |
|
944 | 999 | |
945 | 1000 | // Save these variables. |
946 | 1001 | $vars = array( |
@@ -971,10 +1026,10 @@ discard block |
||
971 | 1026 | { |
972 | 1027 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
973 | 1028 | return false; |
974 | - } |
|
975 | - else |
|
976 | - // Set the character set here. |
|
1029 | + } else { |
|
1030 | + // Set the character set here. |
|
977 | 1031 | updateSettingsFile(array('db_character_set' => 'utf8')); |
1032 | + } |
|
978 | 1033 | } |
979 | 1034 | |
980 | 1035 | // Good, skip on. |
@@ -994,8 +1049,9 @@ discard block |
||
994 | 1049 | $incontext['continue'] = 1; |
995 | 1050 | |
996 | 1051 | // Already done? |
997 | - if (isset($_POST['pop_done'])) |
|
998 | - return true; |
|
1052 | + if (isset($_POST['pop_done'])) { |
|
1053 | + return true; |
|
1054 | + } |
|
999 | 1055 | |
1000 | 1056 | // Reload settings. |
1001 | 1057 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1013,8 +1069,9 @@ discard block |
||
1013 | 1069 | $modSettings = array(); |
1014 | 1070 | if ($result !== false) |
1015 | 1071 | { |
1016 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
1017 | - $modSettings[$row['variable']] = $row['value']; |
|
1072 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
1073 | + $modSettings[$row['variable']] = $row['value']; |
|
1074 | + } |
|
1018 | 1075 | $smcFunc['db_free_result']($result); |
1019 | 1076 | |
1020 | 1077 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1027,20 +1084,22 @@ discard block |
||
1027 | 1084 | $modSettings['disableQueryCheck'] = true; |
1028 | 1085 | |
1029 | 1086 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
1030 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
1031 | - $smcFunc['db_query']('', ' |
|
1087 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
1088 | + $smcFunc['db_query']('', ' |
|
1032 | 1089 | SET NAMES {string:utf8}', |
1033 | 1090 | array( |
1034 | 1091 | 'db_error_skip' => true, |
1035 | 1092 | 'utf8' => 'utf8', |
1036 | 1093 | ) |
1037 | 1094 | ); |
1095 | + } |
|
1038 | 1096 | |
1039 | 1097 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
1040 | - if (substr(__DIR__, -1) == '\\') |
|
1041 | - $attachdir = __DIR__ . 'attachments'; |
|
1042 | - else |
|
1043 | - $attachdir = __DIR__ . '/attachments'; |
|
1098 | + if (substr(__DIR__, -1) == '\\') { |
|
1099 | + $attachdir = __DIR__ . 'attachments'; |
|
1100 | + } else { |
|
1101 | + $attachdir = __DIR__ . '/attachments'; |
|
1102 | + } |
|
1044 | 1103 | |
1045 | 1104 | $replaces = array( |
1046 | 1105 | '{$db_prefix}' => $db_prefix, |
@@ -1057,8 +1116,9 @@ discard block |
||
1057 | 1116 | |
1058 | 1117 | foreach ($txt as $key => $value) |
1059 | 1118 | { |
1060 | - if (substr($key, 0, 8) == 'default_') |
|
1061 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1119 | + if (substr($key, 0, 8) == 'default_') { |
|
1120 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
1121 | + } |
|
1062 | 1122 | } |
1063 | 1123 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
1064 | 1124 | |
@@ -1073,8 +1133,9 @@ discard block |
||
1073 | 1133 | |
1074 | 1134 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
1075 | 1135 | { |
1076 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
1077 | - $engines[] = $row['Engine']; |
|
1136 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
1137 | + $engines[] = $row['Engine']; |
|
1138 | + } |
|
1078 | 1139 | } |
1079 | 1140 | |
1080 | 1141 | // Done with this now |
@@ -1098,8 +1159,7 @@ discard block |
||
1098 | 1159 | $replaces['START TRANSACTION;'] = ''; |
1099 | 1160 | $replaces['COMMIT;'] = ''; |
1100 | 1161 | } |
1101 | - } |
|
1102 | - else |
|
1162 | + } else |
|
1103 | 1163 | { |
1104 | 1164 | $has_innodb = false; |
1105 | 1165 | } |
@@ -1121,21 +1181,24 @@ discard block |
||
1121 | 1181 | foreach ($sql_lines as $count => $line) |
1122 | 1182 | { |
1123 | 1183 | // No comments allowed! |
1124 | - if (substr(trim($line), 0, 1) != '#') |
|
1125 | - $current_statement .= "\n" . rtrim($line); |
|
1184 | + if (substr(trim($line), 0, 1) != '#') { |
|
1185 | + $current_statement .= "\n" . rtrim($line); |
|
1186 | + } |
|
1126 | 1187 | |
1127 | 1188 | // Is this the end of the query string? |
1128 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
1129 | - continue; |
|
1189 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
1190 | + continue; |
|
1191 | + } |
|
1130 | 1192 | |
1131 | 1193 | // Does this table already exist? If so, don't insert more data into it! |
1132 | 1194 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
1133 | 1195 | { |
1134 | 1196 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1135 | - if (!empty($matches[0])) |
|
1136 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1137 | - else |
|
1138 | - $incontext['sql_results']['insert_dups']++; |
|
1197 | + if (!empty($matches[0])) { |
|
1198 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
1199 | + } else { |
|
1200 | + $incontext['sql_results']['insert_dups']++; |
|
1201 | + } |
|
1139 | 1202 | |
1140 | 1203 | $current_statement = ''; |
1141 | 1204 | continue; |
@@ -1144,8 +1207,9 @@ discard block |
||
1144 | 1207 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
1145 | 1208 | { |
1146 | 1209 | // Use the appropriate function based on the DB type |
1147 | - if ($db_type == 'mysql' || $db_type =='mysqli') |
|
1148 | - $db_errorno = $db_type . '_errno'; |
|
1210 | + if ($db_type == 'mysql' || $db_type =='mysqli') { |
|
1211 | + $db_errorno = $db_type . '_errno'; |
|
1212 | + } |
|
1149 | 1213 | |
1150 | 1214 | // Error 1050: Table already exists! |
1151 | 1215 | // @todo Needs to be made better! |
@@ -1160,18 +1224,18 @@ discard block |
||
1160 | 1224 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
1161 | 1225 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
1162 | 1226 | } |
1163 | - } |
|
1164 | - else |
|
1227 | + } else |
|
1165 | 1228 | { |
1166 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1167 | - $incontext['sql_results']['tables']++; |
|
1168 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1229 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
1230 | + $incontext['sql_results']['tables']++; |
|
1231 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
1169 | 1232 | { |
1170 | 1233 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
1171 | - if (!empty($matches[0])) |
|
1172 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1173 | - else |
|
1174 | - $incontext['sql_results']['inserts']++; |
|
1234 | + if (!empty($matches[0])) { |
|
1235 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
1236 | + } else { |
|
1237 | + $incontext['sql_results']['inserts']++; |
|
1238 | + } |
|
1175 | 1239 | } |
1176 | 1240 | } |
1177 | 1241 | |
@@ -1184,15 +1248,17 @@ discard block |
||
1184 | 1248 | // Sort out the context for the SQL. |
1185 | 1249 | foreach ($incontext['sql_results'] as $key => $number) |
1186 | 1250 | { |
1187 | - if ($number == 0) |
|
1188 | - unset($incontext['sql_results'][$key]); |
|
1189 | - else |
|
1190 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1251 | + if ($number == 0) { |
|
1252 | + unset($incontext['sql_results'][$key]); |
|
1253 | + } else { |
|
1254 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
1255 | + } |
|
1191 | 1256 | } |
1192 | 1257 | |
1193 | 1258 | // Make sure UTF will be used globally. |
1194 | - if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) |
|
1195 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1259 | + if ((!empty($databases[$db_type]['utf8_support']) && !empty($databases[$db_type]['utf8_required'])) || (empty($databases[$db_type]['utf8_required']) && !empty($databases[$db_type]['utf8_support']) && isset($_POST['utf8']))) { |
|
1260 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
1261 | + } |
|
1196 | 1262 | |
1197 | 1263 | // Maybe we can auto-detect better cookie settings? |
1198 | 1264 | preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches); |
@@ -1203,16 +1269,20 @@ discard block |
||
1203 | 1269 | $globalCookies = false; |
1204 | 1270 | |
1205 | 1271 | // Okay... let's see. Using a subdomain other than www.? (not a perfect check.) |
1206 | - if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) |
|
1207 | - $globalCookies = true; |
|
1272 | + if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) { |
|
1273 | + $globalCookies = true; |
|
1274 | + } |
|
1208 | 1275 | // If there's a / in the middle of the path, or it starts with ~... we want local. |
1209 | - if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) |
|
1210 | - $localCookies = true; |
|
1276 | + if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) { |
|
1277 | + $localCookies = true; |
|
1278 | + } |
|
1211 | 1279 | |
1212 | - if ($globalCookies) |
|
1213 | - $newSettings[] = array('globalCookies', '1'); |
|
1214 | - if ($localCookies) |
|
1215 | - $newSettings[] = array('localCookies', '1'); |
|
1280 | + if ($globalCookies) { |
|
1281 | + $newSettings[] = array('globalCookies', '1'); |
|
1282 | + } |
|
1283 | + if ($localCookies) { |
|
1284 | + $newSettings[] = array('localCookies', '1'); |
|
1285 | + } |
|
1216 | 1286 | } |
1217 | 1287 | |
1218 | 1288 | // Are we allowing stat collection? |
@@ -1228,30 +1298,34 @@ discard block |
||
1228 | 1298 | fwrite($fp, $out); |
1229 | 1299 | |
1230 | 1300 | $return_data = ''; |
1231 | - while (!feof($fp)) |
|
1232 | - $return_data .= fgets($fp, 128); |
|
1301 | + while (!feof($fp)) { |
|
1302 | + $return_data .= fgets($fp, 128); |
|
1303 | + } |
|
1233 | 1304 | |
1234 | 1305 | fclose($fp); |
1235 | 1306 | |
1236 | 1307 | // Get the unique site ID. |
1237 | 1308 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
1238 | 1309 | |
1239 | - if (!empty($ID[1])) |
|
1240 | - $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
1310 | + if (!empty($ID[1])) { |
|
1311 | + $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
1312 | + } |
|
1241 | 1313 | } |
1242 | 1314 | } |
1243 | 1315 | |
1244 | 1316 | // Are we enabling SSL? |
1245 | - if (!empty($_POST['force_ssl'])) |
|
1246 | - $newSettings[] = array('force_ssl', 2); |
|
1317 | + if (!empty($_POST['force_ssl'])) { |
|
1318 | + $newSettings[] = array('force_ssl', 2); |
|
1319 | + } |
|
1247 | 1320 | |
1248 | 1321 | // As of PHP 5.1, setting a timezone is required. |
1249 | 1322 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
1250 | 1323 | { |
1251 | 1324 | $server_offset = mktime(0, 0, 0, 1, 1, 1970); |
1252 | 1325 | $timezone_id = 'Etc/GMT' . ($server_offset > 0 ? '+' : '') . ($server_offset / 3600); |
1253 | - if (date_default_timezone_set($timezone_id)) |
|
1254 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
1326 | + if (date_default_timezone_set($timezone_id)) { |
|
1327 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
1328 | + } |
|
1255 | 1329 | } |
1256 | 1330 | |
1257 | 1331 | if (!empty($newSettings)) |
@@ -1282,16 +1356,18 @@ discard block |
||
1282 | 1356 | } |
1283 | 1357 | |
1284 | 1358 | // MySQL specific stuff |
1285 | - if (substr($db_type, 0, 5) != 'mysql') |
|
1286 | - return false; |
|
1359 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
1360 | + return false; |
|
1361 | + } |
|
1287 | 1362 | |
1288 | 1363 | // Find database user privileges. |
1289 | 1364 | $privs = array(); |
1290 | 1365 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
1291 | 1366 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
1292 | 1367 | { |
1293 | - if ($row['Privilege'] == 'Alter') |
|
1294 | - $privs[] = $row['Privilege']; |
|
1368 | + if ($row['Privilege'] == 'Alter') { |
|
1369 | + $privs[] = $row['Privilege']; |
|
1370 | + } |
|
1295 | 1371 | } |
1296 | 1372 | $smcFunc['db_free_result']($get_privs); |
1297 | 1373 | |
@@ -1321,8 +1397,9 @@ discard block |
||
1321 | 1397 | $incontext['continue'] = 1; |
1322 | 1398 | |
1323 | 1399 | // Skipping? |
1324 | - if (!empty($_POST['skip'])) |
|
1325 | - return true; |
|
1400 | + if (!empty($_POST['skip'])) { |
|
1401 | + return true; |
|
1402 | + } |
|
1326 | 1403 | |
1327 | 1404 | // Need this to check whether we need the database password. |
1328 | 1405 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1336,18 +1413,22 @@ discard block |
||
1336 | 1413 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
1337 | 1414 | function($string){ |
1338 | 1415 | global $sourcedir; |
1339 | - if (function_exists('mb_strtolower')) |
|
1340 | - return mb_strtolower($string, 'UTF-8'); |
|
1416 | + if (function_exists('mb_strtolower')) { |
|
1417 | + return mb_strtolower($string, 'UTF-8'); |
|
1418 | + } |
|
1341 | 1419 | require_once($sourcedir . '/Subs-Charset.php'); |
1342 | 1420 | return utf8_strtolower($string); |
1343 | 1421 | }; |
1344 | 1422 | |
1345 | - if (!isset($_POST['username'])) |
|
1346 | - $_POST['username'] = ''; |
|
1347 | - if (!isset($_POST['email'])) |
|
1348 | - $_POST['email'] = ''; |
|
1349 | - if (!isset($_POST['server_email'])) |
|
1350 | - $_POST['server_email'] = ''; |
|
1423 | + if (!isset($_POST['username'])) { |
|
1424 | + $_POST['username'] = ''; |
|
1425 | + } |
|
1426 | + if (!isset($_POST['email'])) { |
|
1427 | + $_POST['email'] = ''; |
|
1428 | + } |
|
1429 | + if (!isset($_POST['server_email'])) { |
|
1430 | + $_POST['server_email'] = ''; |
|
1431 | + } |
|
1351 | 1432 | |
1352 | 1433 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
1353 | 1434 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1366,8 +1447,9 @@ discard block |
||
1366 | 1447 | 'admin_group' => 1, |
1367 | 1448 | ) |
1368 | 1449 | ); |
1369 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
1370 | - $incontext['skip'] = 1; |
|
1450 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
1451 | + $incontext['skip'] = 1; |
|
1452 | + } |
|
1371 | 1453 | $smcFunc['db_free_result']($request); |
1372 | 1454 | |
1373 | 1455 | // Trying to create an account? |
@@ -1398,8 +1480,9 @@ discard block |
||
1398 | 1480 | } |
1399 | 1481 | |
1400 | 1482 | // Update the webmaster's email? |
1401 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
1402 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1483 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
1484 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
1485 | + } |
|
1403 | 1486 | |
1404 | 1487 | // Work out whether we're going to have dodgy characters and remove them. |
1405 | 1488 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1422,32 +1505,27 @@ discard block |
||
1422 | 1505 | $smcFunc['db_free_result']($result); |
1423 | 1506 | |
1424 | 1507 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
1425 | - } |
|
1426 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1508 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
1427 | 1509 | { |
1428 | 1510 | // Try the previous step again. |
1429 | 1511 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
1430 | 1512 | return false; |
1431 | - } |
|
1432 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1513 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
1433 | 1514 | { |
1434 | 1515 | // Try the previous step again. |
1435 | 1516 | $incontext['error'] = $txt['error_invalid_characters_username']; |
1436 | 1517 | return false; |
1437 | - } |
|
1438 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1518 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
1439 | 1519 | { |
1440 | 1520 | // One step back, this time fill out a proper admin email address. |
1441 | 1521 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
1442 | 1522 | return false; |
1443 | - } |
|
1444 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1523 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
1445 | 1524 | { |
1446 | 1525 | // One step back, this time fill out a proper admin email address. |
1447 | 1526 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
1448 | 1527 | return false; |
1449 | - } |
|
1450 | - elseif ($_POST['username'] != '') |
|
1528 | + } elseif ($_POST['username'] != '') |
|
1451 | 1529 | { |
1452 | 1530 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
1453 | 1531 | |
@@ -1522,17 +1600,19 @@ discard block |
||
1522 | 1600 | require_once($sourcedir . '/Subs-Auth.php'); |
1523 | 1601 | |
1524 | 1602 | // Bring a warning over. |
1525 | - if (!empty($incontext['account_existed'])) |
|
1526 | - $incontext['warning'] = $incontext['account_existed']; |
|
1603 | + if (!empty($incontext['account_existed'])) { |
|
1604 | + $incontext['warning'] = $incontext['account_existed']; |
|
1605 | + } |
|
1527 | 1606 | |
1528 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
1529 | - $smcFunc['db_query']('', ' |
|
1607 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
1608 | + $smcFunc['db_query']('', ' |
|
1530 | 1609 | SET NAMES {string:db_character_set}', |
1531 | 1610 | array( |
1532 | 1611 | 'db_character_set' => $db_character_set, |
1533 | 1612 | 'db_error_skip' => true, |
1534 | 1613 | ) |
1535 | 1614 | ); |
1615 | + } |
|
1536 | 1616 | |
1537 | 1617 | // As track stats is by default enabled let's add some activity. |
1538 | 1618 | $smcFunc['db_insert']('ignore', |
@@ -1553,14 +1633,16 @@ discard block |
||
1553 | 1633 | // Only proceed if we can load the data. |
1554 | 1634 | if ($request) |
1555 | 1635 | { |
1556 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
1557 | - $modSettings[$row[0]] = $row[1]; |
|
1636 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
1637 | + $modSettings[$row[0]] = $row[1]; |
|
1638 | + } |
|
1558 | 1639 | $smcFunc['db_free_result']($request); |
1559 | 1640 | } |
1560 | 1641 | |
1561 | 1642 | // Automatically log them in ;) |
1562 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
1563 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1643 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
1644 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
1645 | + } |
|
1564 | 1646 | |
1565 | 1647 | $result = $smcFunc['db_query']('', ' |
1566 | 1648 | SELECT value |
@@ -1571,13 +1653,14 @@ discard block |
||
1571 | 1653 | 'db_error_skip' => true, |
1572 | 1654 | ) |
1573 | 1655 | ); |
1574 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
1575 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1656 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
1657 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
1658 | + } |
|
1576 | 1659 | $smcFunc['db_free_result']($result); |
1577 | 1660 | |
1578 | - if (empty($db_sessions)) |
|
1579 | - $_SESSION['admin_time'] = time(); |
|
1580 | - else |
|
1661 | + if (empty($db_sessions)) { |
|
1662 | + $_SESSION['admin_time'] = time(); |
|
1663 | + } else |
|
1581 | 1664 | { |
1582 | 1665 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
1583 | 1666 | |
@@ -1601,8 +1684,9 @@ discard block |
||
1601 | 1684 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
1602 | 1685 | function($string){ |
1603 | 1686 | global $sourcedir; |
1604 | - if (function_exists('mb_strtolower')) |
|
1605 | - return mb_strtolower($string, 'UTF-8'); |
|
1687 | + if (function_exists('mb_strtolower')) { |
|
1688 | + return mb_strtolower($string, 'UTF-8'); |
|
1689 | + } |
|
1606 | 1690 | require_once($sourcedir . '/Subs-Charset.php'); |
1607 | 1691 | return utf8_strtolower($string); |
1608 | 1692 | }; |
@@ -1618,8 +1702,9 @@ discard block |
||
1618 | 1702 | ) |
1619 | 1703 | ); |
1620 | 1704 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
1621 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
1622 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1705 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
1706 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
1707 | + } |
|
1623 | 1708 | $smcFunc['db_free_result']($request); |
1624 | 1709 | |
1625 | 1710 | // Now is the perfect time to fetch the SM files. |
@@ -1638,8 +1723,9 @@ discard block |
||
1638 | 1723 | |
1639 | 1724 | // Check if we need some stupid MySQL fix. |
1640 | 1725 | $server_version = $smcFunc['db_server_info'](); |
1641 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
1642 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1726 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
1727 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
1728 | + } |
|
1643 | 1729 | |
1644 | 1730 | // Some final context for the template. |
1645 | 1731 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1659,8 +1745,9 @@ discard block |
||
1659 | 1745 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
1660 | 1746 | |
1661 | 1747 | // @todo Do we just want to read the file in clean, and split it this way always? |
1662 | - if (count($settingsArray) == 1) |
|
1663 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1748 | + if (count($settingsArray) == 1) { |
|
1749 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
1750 | + } |
|
1664 | 1751 | |
1665 | 1752 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
1666 | 1753 | { |
@@ -1675,19 +1762,22 @@ discard block |
||
1675 | 1762 | continue; |
1676 | 1763 | } |
1677 | 1764 | |
1678 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
1679 | - $settingsArray[$i] = ''; |
|
1765 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
1766 | + $settingsArray[$i] = ''; |
|
1767 | + } |
|
1680 | 1768 | |
1681 | 1769 | // Don't trim or bother with it if it's not a variable. |
1682 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
1683 | - continue; |
|
1770 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
1771 | + continue; |
|
1772 | + } |
|
1684 | 1773 | |
1685 | 1774 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
1686 | 1775 | |
1687 | - foreach ($vars as $var => $val) |
|
1688 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1776 | + foreach ($vars as $var => $val) { |
|
1777 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
1689 | 1778 | { |
1690 | 1779 | $comment = strstr($settingsArray[$i], '#'); |
1780 | + } |
|
1691 | 1781 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
1692 | 1782 | unset($vars[$var]); |
1693 | 1783 | } |
@@ -1697,36 +1787,41 @@ discard block |
||
1697 | 1787 | if (!empty($vars)) |
1698 | 1788 | { |
1699 | 1789 | $settingsArray[$i++] = ''; |
1700 | - foreach ($vars as $var => $val) |
|
1701 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1790 | + foreach ($vars as $var => $val) { |
|
1791 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
1792 | + } |
|
1702 | 1793 | } |
1703 | 1794 | |
1704 | 1795 | // Blank out the file - done to fix a oddity with some servers. |
1705 | 1796 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
1706 | - if (!$fp) |
|
1707 | - return false; |
|
1797 | + if (!$fp) { |
|
1798 | + return false; |
|
1799 | + } |
|
1708 | 1800 | fclose($fp); |
1709 | 1801 | |
1710 | 1802 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
1711 | 1803 | |
1712 | 1804 | // Gotta have one of these ;) |
1713 | - if (trim($settingsArray[0]) != '<?php') |
|
1714 | - fwrite($fp, "<?php\n"); |
|
1805 | + if (trim($settingsArray[0]) != '<?php') { |
|
1806 | + fwrite($fp, "<?php\n"); |
|
1807 | + } |
|
1715 | 1808 | |
1716 | 1809 | $lines = count($settingsArray); |
1717 | 1810 | for ($i = 0; $i < $lines - 1; $i++) |
1718 | 1811 | { |
1719 | 1812 | // Don't just write a bunch of blank lines. |
1720 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
1721 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1813 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
1814 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
1815 | + } |
|
1722 | 1816 | } |
1723 | 1817 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
1724 | 1818 | fclose($fp); |
1725 | 1819 | |
1726 | 1820 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
1727 | 1821 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
1728 | - if (function_exists('opcache_invalidate')) |
|
1729 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1822 | + if (function_exists('opcache_invalidate')) { |
|
1823 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
1824 | + } |
|
1730 | 1825 | |
1731 | 1826 | return true; |
1732 | 1827 | } |
@@ -1751,9 +1846,9 @@ discard block |
||
1751 | 1846 | SecFilterScanPOST Off |
1752 | 1847 | </IfModule>'; |
1753 | 1848 | |
1754 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
1755 | - return true; |
|
1756 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1849 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
1850 | + return true; |
|
1851 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
1757 | 1852 | { |
1758 | 1853 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
1759 | 1854 | |
@@ -1765,29 +1860,28 @@ discard block |
||
1765 | 1860 | fwrite($ht_handle, $htaccess_addition); |
1766 | 1861 | fclose($ht_handle); |
1767 | 1862 | return true; |
1863 | + } else { |
|
1864 | + return false; |
|
1768 | 1865 | } |
1769 | - else |
|
1770 | - return false; |
|
1866 | + } else { |
|
1867 | + return true; |
|
1771 | 1868 | } |
1772 | - else |
|
1773 | - return true; |
|
1774 | - } |
|
1775 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
1776 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1777 | - elseif (is_writable(dirname(__FILE__))) |
|
1869 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
1870 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
1871 | + } elseif (is_writable(dirname(__FILE__))) |
|
1778 | 1872 | { |
1779 | 1873 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
1780 | 1874 | { |
1781 | 1875 | fwrite($ht_handle, $htaccess_addition); |
1782 | 1876 | fclose($ht_handle); |
1783 | 1877 | return true; |
1878 | + } else { |
|
1879 | + return false; |
|
1784 | 1880 | } |
1785 | - else |
|
1881 | + } else { |
|
1786 | 1882 | return false; |
1787 | 1883 | } |
1788 | - else |
|
1789 | - return false; |
|
1790 | -} |
|
1884 | + } |
|
1791 | 1885 | |
1792 | 1886 | function template_install_above() |
1793 | 1887 | { |
@@ -1825,9 +1919,10 @@ discard block |
||
1825 | 1919 | <label for="installer_language">', $txt['installer_language'], ':</label> |
1826 | 1920 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
1827 | 1921 | |
1828 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
1829 | - echo ' |
|
1922 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
1923 | + echo ' |
|
1830 | 1924 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
1925 | + } |
|
1831 | 1926 | |
1832 | 1927 | echo ' |
1833 | 1928 | </select> |
@@ -1847,9 +1942,10 @@ discard block |
||
1847 | 1942 | <h2>', $txt['upgrade_progress'], '</h2> |
1848 | 1943 | <ul>'; |
1849 | 1944 | |
1850 | - foreach ($incontext['steps'] as $num => $step) |
|
1851 | - echo ' |
|
1945 | + foreach ($incontext['steps'] as $num => $step) { |
|
1946 | + echo ' |
|
1852 | 1947 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
1948 | + } |
|
1853 | 1949 | |
1854 | 1950 | echo ' |
1855 | 1951 | </ul> |
@@ -1874,20 +1970,23 @@ discard block |
||
1874 | 1970 | echo ' |
1875 | 1971 | <div>'; |
1876 | 1972 | |
1877 | - if (!empty($incontext['continue'])) |
|
1878 | - echo ' |
|
1973 | + if (!empty($incontext['continue'])) { |
|
1974 | + echo ' |
|
1879 | 1975 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
1880 | - if (!empty($incontext['skip'])) |
|
1881 | - echo ' |
|
1976 | + } |
|
1977 | + if (!empty($incontext['skip'])) { |
|
1978 | + echo ' |
|
1882 | 1979 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
1980 | + } |
|
1883 | 1981 | echo ' |
1884 | 1982 | </div>'; |
1885 | 1983 | } |
1886 | 1984 | |
1887 | 1985 | // Show the closing form tag and other data only if not in the last step |
1888 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
1889 | - echo ' |
|
1986 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
1987 | + echo ' |
|
1890 | 1988 | </form>'; |
1989 | + } |
|
1891 | 1990 | |
1892 | 1991 | echo ' |
1893 | 1992 | </div> |
@@ -1922,13 +2021,15 @@ discard block |
||
1922 | 2021 | </div>'; |
1923 | 2022 | |
1924 | 2023 | // Show the warnings, or not. |
1925 | - if (template_warning_divs()) |
|
1926 | - echo ' |
|
2024 | + if (template_warning_divs()) { |
|
2025 | + echo ' |
|
1927 | 2026 | <h3>', $txt['install_all_lovely'], '</h3>'; |
2027 | + } |
|
1928 | 2028 | |
1929 | 2029 | // Say we want the continue button! |
1930 | - if (empty($incontext['error'])) |
|
1931 | - $incontext['continue'] = 1; |
|
2030 | + if (empty($incontext['error'])) { |
|
2031 | + $incontext['continue'] = 1; |
|
2032 | + } |
|
1932 | 2033 | |
1933 | 2034 | // For the latest version stuff. |
1934 | 2035 | echo ' |
@@ -1962,8 +2063,8 @@ discard block |
||
1962 | 2063 | global $txt, $incontext; |
1963 | 2064 | |
1964 | 2065 | // Errors are very serious.. |
1965 | - if (!empty($incontext['error'])) |
|
1966 | - echo ' |
|
2066 | + if (!empty($incontext['error'])) { |
|
2067 | + echo ' |
|
1967 | 2068 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
1968 | 2069 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
1969 | 2070 | <strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br> |
@@ -1971,9 +2072,10 @@ discard block |
||
1971 | 2072 | ', $incontext['error'], ' |
1972 | 2073 | </div> |
1973 | 2074 | </div>'; |
2075 | + } |
|
1974 | 2076 | // A warning message? |
1975 | - elseif (!empty($incontext['warning'])) |
|
1976 | - echo ' |
|
2077 | + elseif (!empty($incontext['warning'])) { |
|
2078 | + echo ' |
|
1977 | 2079 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
1978 | 2080 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
1979 | 2081 | <strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br> |
@@ -1981,6 +2083,7 @@ discard block |
||
1981 | 2083 | ', $incontext['warning'], ' |
1982 | 2084 | </div> |
1983 | 2085 | </div>'; |
2086 | + } |
|
1984 | 2087 | |
1985 | 2088 | return empty($incontext['error']) && empty($incontext['warning']); |
1986 | 2089 | } |
@@ -1996,27 +2099,30 @@ discard block |
||
1996 | 2099 | <li>', $incontext['failed_files']), '</li> |
1997 | 2100 | </ul>'; |
1998 | 2101 | |
1999 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
2000 | - echo ' |
|
2102 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
2103 | + echo ' |
|
2001 | 2104 | <hr> |
2002 | 2105 | <p>', $txt['chmod_linux_info'], '</p> |
2003 | 2106 | <tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>'; |
2107 | + } |
|
2004 | 2108 | |
2005 | 2109 | // This is serious! |
2006 | - if (!template_warning_divs()) |
|
2007 | - return; |
|
2110 | + if (!template_warning_divs()) { |
|
2111 | + return; |
|
2112 | + } |
|
2008 | 2113 | |
2009 | 2114 | echo ' |
2010 | 2115 | <hr> |
2011 | 2116 | <p>', $txt['ftp_setup_info'], '</p>'; |
2012 | 2117 | |
2013 | - if (!empty($incontext['ftp_errors'])) |
|
2014 | - echo ' |
|
2118 | + if (!empty($incontext['ftp_errors'])) { |
|
2119 | + echo ' |
|
2015 | 2120 | <div class="error_message"> |
2016 | 2121 | ', $txt['error_ftp_no_connect'], '<br><br> |
2017 | 2122 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
2018 | 2123 | </div> |
2019 | 2124 | <br>'; |
2125 | + } |
|
2020 | 2126 | |
2021 | 2127 | echo ' |
2022 | 2128 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2076,17 +2182,17 @@ discard block |
||
2076 | 2182 | <td> |
2077 | 2183 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
2078 | 2184 | |
2079 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
2080 | - echo ' |
|
2185 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
2186 | + echo ' |
|
2081 | 2187 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
2188 | + } |
|
2082 | 2189 | |
2083 | 2190 | echo ' |
2084 | 2191 | </select> |
2085 | 2192 | <div class="smalltext block">', $txt['db_settings_type_info'], '</div> |
2086 | 2193 | </td> |
2087 | 2194 | </tr>'; |
2088 | - } |
|
2089 | - else |
|
2195 | + } else |
|
2090 | 2196 | { |
2091 | 2197 | echo ' |
2092 | 2198 | <tr style="display: none;"> |
@@ -2278,9 +2384,10 @@ discard block |
||
2278 | 2384 | <div style="color: red;">', $txt['error_db_queries'], '</div> |
2279 | 2385 | <ul>'; |
2280 | 2386 | |
2281 | - foreach ($incontext['failures'] as $line => $fail) |
|
2282 | - echo ' |
|
2387 | + foreach ($incontext['failures'] as $line => $fail) { |
|
2388 | + echo ' |
|
2283 | 2389 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
2390 | + } |
|
2284 | 2391 | |
2285 | 2392 | echo ' |
2286 | 2393 | </ul>'; |
@@ -2341,15 +2448,16 @@ discard block |
||
2341 | 2448 | </tr> |
2342 | 2449 | </table>'; |
2343 | 2450 | |
2344 | - if ($incontext['require_db_confirm']) |
|
2345 | - echo ' |
|
2451 | + if ($incontext['require_db_confirm']) { |
|
2452 | + echo ' |
|
2346 | 2453 | <h2>', $txt['user_settings_database'], '</h2> |
2347 | 2454 | <p>', $txt['user_settings_database_info'], '</p> |
2348 | 2455 | |
2349 | 2456 | <div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;"> |
2350 | 2457 | <input type="password" name="password3" size="30" class="input_password" /> |
2351 | 2458 | </div>'; |
2352 | -} |
|
2459 | + } |
|
2460 | + } |
|
2353 | 2461 | |
2354 | 2462 | // Tell them it's done, and to delete. |
2355 | 2463 | function template_delete_install() |
@@ -2362,14 +2470,15 @@ discard block |
||
2362 | 2470 | template_warning_divs(); |
2363 | 2471 | |
2364 | 2472 | // Install directory still writable? |
2365 | - if ($incontext['dir_still_writable']) |
|
2366 | - echo ' |
|
2473 | + if ($incontext['dir_still_writable']) { |
|
2474 | + echo ' |
|
2367 | 2475 | <em>', $txt['still_writable'], '</em><br> |
2368 | 2476 | <br>'; |
2477 | + } |
|
2369 | 2478 | |
2370 | 2479 | // Don't show the box if it's like 99% sure it won't work :P. |
2371 | - if ($incontext['probably_delete_install']) |
|
2372 | - echo ' |
|
2480 | + if ($incontext['probably_delete_install']) { |
|
2481 | + echo ' |
|
2373 | 2482 | <div style="margin: 1ex; font-weight: bold;"> |
2374 | 2483 | <label for="delete_self"><input type="checkbox" id="delete_self" onclick="doTheDelete();" class="input_check" /> ', $txt['delete_installer'], !isset($_SESSION['installer_temp_ftp']) ? ' ' . $txt['delete_installer_maybe'] : '', '</label> |
2375 | 2484 | </div> |
@@ -2385,6 +2494,7 @@ discard block |
||
2385 | 2494 | } |
2386 | 2495 | </script> |
2387 | 2496 | <br>'; |
2497 | + } |
|
2388 | 2498 | |
2389 | 2499 | echo ' |
2390 | 2500 | ', sprintf($txt['go_to_your_forum'], $boardurl . '/index.php'), '<br> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | // Get everything started up... |
27 | 27 | define('SMF', 1); |
28 | -if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0) |
|
28 | +if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(), '5.3.0') < 0) |
|
29 | 29 | @set_magic_quotes_runtime(0); |
30 | 30 | error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
31 | 31 | $time_start = microtime(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent()) |
91 | 91 | { |
92 | 92 | // If zlib is being used, turn off output compression. |
93 | - if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
93 | + if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
94 | 94 | $modSettings['enableCompressedOutput'] = '0'; |
95 | 95 | else |
96 | 96 | { |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | // Get everything started up... |
27 | 27 | define('SMF', 1); |
28 | -if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0) |
|
28 | +if (function_exists('set_magic_quotes_runtime') && strnatcmp(phpversion(),'5.3.0') < 0) { |
|
29 | 29 | @set_magic_quotes_runtime(0); |
30 | +} |
|
30 | 31 | error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL); |
31 | 32 | $time_start = microtime(); |
32 | 33 | |
@@ -34,16 +35,18 @@ discard block |
||
34 | 35 | ob_start(); |
35 | 36 | |
36 | 37 | // Do some cleaning, just in case. |
37 | -foreach (array('db_character_set', 'cachedir') as $variable) |
|
38 | +foreach (array('db_character_set', 'cachedir') as $variable) { |
|
38 | 39 | if (isset($GLOBALS[$variable])) |
39 | 40 | unset($GLOBALS[$variable], $GLOBALS[$variable]); |
41 | +} |
|
40 | 42 | |
41 | 43 | // Load the settings... |
42 | 44 | require_once(dirname(__FILE__) . '/Settings.php'); |
43 | 45 | |
44 | 46 | // Make absolutely sure the cache directory is defined. |
45 | -if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) |
|
47 | +if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) { |
|
46 | 48 | $cachedir = $boarddir . '/cache'; |
49 | +} |
|
47 | 50 | |
48 | 51 | // Without those we can't go anywhere |
49 | 52 | require_once($sourcedir . '/QueryString.php'); |
@@ -53,8 +56,9 @@ discard block |
||
53 | 56 | require_once($sourcedir . '/Load.php'); |
54 | 57 | |
55 | 58 | // If $maintenance is set specifically to 2, then we're upgrading or something. |
56 | -if (!empty($maintenance) && $maintenance == 2) |
|
59 | +if (!empty($maintenance) && $maintenance == 2) { |
|
57 | 60 | display_maintenance_message(); |
61 | +} |
|
58 | 62 | |
59 | 63 | // Create a variable to store some SMF specific functions in. |
60 | 64 | $smcFunc = array(); |
@@ -69,8 +73,9 @@ discard block |
||
69 | 73 | cleanRequest(); |
70 | 74 | |
71 | 75 | // Seed the random generator. |
72 | -if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) |
|
76 | +if (empty($modSettings['rand_seed']) || mt_rand(1, 250) == 69) { |
|
73 | 77 | smf_seed_generator(); |
78 | +} |
|
74 | 79 | |
75 | 80 | // Before we get carried away, are we doing a scheduled task? If so save CPU cycles by jumping out! |
76 | 81 | if (isset($_GET['scheduled'])) |
@@ -90,9 +95,9 @@ discard block |
||
90 | 95 | if (!empty($modSettings['enableCompressedOutput']) && !headers_sent()) |
91 | 96 | { |
92 | 97 | // If zlib is being used, turn off output compression. |
93 | - if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') |
|
94 | - $modSettings['enableCompressedOutput'] = '0'; |
|
95 | - else |
|
98 | + if (ini_get('zlib.output_compression') >= 1 || ini_get('output_handler') == 'ob_gzhandler') { |
|
99 | + $modSettings['enableCompressedOutput'] = '0'; |
|
100 | + } else |
|
96 | 101 | { |
97 | 102 | ob_end_clean(); |
98 | 103 | ob_start('ob_gzhandler'); |
@@ -141,18 +146,21 @@ discard block |
||
141 | 146 | loadPermissions(); |
142 | 147 | |
143 | 148 | // Attachments don't require the entire theme to be loaded. |
144 | - if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') |
|
145 | - detectBrowser(); |
|
149 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach') { |
|
150 | + detectBrowser(); |
|
151 | + } |
|
146 | 152 | // Load the current theme. (note that ?theme=1 will also work, may be used for guest theming.) |
147 | - else |
|
148 | - loadTheme(); |
|
153 | + else { |
|
154 | + loadTheme(); |
|
155 | + } |
|
149 | 156 | |
150 | 157 | // Check if the user should be disallowed access. |
151 | 158 | is_not_banned(); |
152 | 159 | |
153 | 160 | // If we are in a topic and don't have permission to approve it then duck out now. |
154 | - if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) |
|
155 | - fatal_lang_error('not_a_topic', false); |
|
161 | + if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) { |
|
162 | + fatal_lang_error('not_a_topic', false); |
|
163 | + } |
|
156 | 164 | |
157 | 165 | $no_stat_actions = array('clock', 'dlattach', 'findmember', 'jsoption', 'likes', 'loadeditorlocale', 'modifycat', 'requestmembers', 'smstats', 'suggest', 'about:unknown', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'); |
158 | 166 | call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions)); |
@@ -163,8 +171,9 @@ discard block |
||
163 | 171 | writeLog(); |
164 | 172 | |
165 | 173 | // Track forum statistics and hits...? |
166 | - if (!empty($modSettings['hitStats'])) |
|
167 | - trackStats(array('hits' => '+')); |
|
174 | + if (!empty($modSettings['hitStats'])) { |
|
175 | + trackStats(array('hits' => '+')); |
|
176 | + } |
|
168 | 177 | } |
169 | 178 | unset($no_stat_actions); |
170 | 179 | |
@@ -178,13 +187,14 @@ discard block |
||
178 | 187 | return ($_REQUEST['action'] == 'login2' ? 'Login2' : ($_REQUEST['action'] == 'logintfa' ? 'LoginTFA' : 'Logout')); |
179 | 188 | } |
180 | 189 | // Don't even try it, sonny. |
181 | - else |
|
182 | - return 'InMaintenance'; |
|
190 | + else { |
|
191 | + return 'InMaintenance'; |
|
192 | + } |
|
183 | 193 | } |
184 | 194 | // If guest access is off, a guest can only do one of the very few following actions. |
185 | - elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) |
|
186 | - return 'KickGuest'; |
|
187 | - elseif (empty($_REQUEST['action'])) |
|
195 | + elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) { |
|
196 | + return 'KickGuest'; |
|
197 | + } elseif (empty($_REQUEST['action'])) |
|
188 | 198 | { |
189 | 199 | // Action and board are both empty... BoardIndex! Unless someone else wants to do something different. |
190 | 200 | if (empty($board) && empty($topic)) |
@@ -200,8 +210,9 @@ discard block |
||
200 | 210 | |
201 | 211 | $call = call_helper($defaultAction, true); |
202 | 212 | |
203 | - if (!empty($call)) |
|
204 | - return $call; |
|
213 | + if (!empty($call)) { |
|
214 | + return $call; |
|
215 | + } |
|
205 | 216 | } |
206 | 217 | |
207 | 218 | // No default action huh? then go to our good old BoardIndex. |
@@ -331,8 +342,9 @@ discard block |
||
331 | 342 | |
332 | 343 | $call = call_helper($fallbackAction, true); |
333 | 344 | |
334 | - if (!empty($call)) |
|
335 | - return $call; |
|
345 | + if (!empty($call)) { |
|
346 | + return $call; |
|
347 | + } |
|
336 | 348 | } |
337 | 349 | |
338 | 350 | // No fallback action, huh? |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | echo ' |
65 | 65 | <div class="cat_bar"> |
66 | 66 | <h3 class="catbg"> |
67 | - <a href="', $scripturl, '?action=helpadmin;help=error_log" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'],'"></span></a> ', $txt['errlog'], ' |
|
67 | + <a href="', $scripturl, '?action=helpadmin;help=error_log" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ', $txt['errlog'], ' |
|
68 | 68 | </h3> |
69 | 69 | </div> |
70 | 70 | <div class="pagesection"> |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | ', $context['page_index'], ' |
73 | 73 | </div> |
74 | 74 | <div class="floatright"> |
75 | - <input type="submit" name="removeSelection" value="', $txt['remove_selection'] ,'" data-confirm="', $txt['remove_selection_confirm'] ,'" class="button_submit you_sure"> |
|
76 | - <input type="submit" name="delall" value="', ($context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all']) ,'" data-confirm="', ($context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove']) ,'" class="button_submit you_sure"> |
|
75 | + <input type="submit" name="removeSelection" value="', $txt['remove_selection'], '" data-confirm="', $txt['remove_selection_confirm'], '" class="button_submit you_sure"> |
|
76 | + <input type="submit" name="delall" value="', ($context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all']), '" data-confirm="', ($context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove']), '" class="button_submit you_sure"> |
|
77 | 77 | </div> |
78 | 78 | </div> |
79 | 79 | <table class="table_grid" id="error_log"> |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | ', $context['page_index'], ' |
185 | 185 | </div> |
186 | 186 | <div class="floatright"> |
187 | - <input type="submit" name="removeSelection" value="', $txt['remove_selection'] ,'" data-confirm="', $txt['remove_selection_confirm'] ,'" class="button_submit you_sure"> |
|
188 | - <input type="submit" name="delall" value="', ($context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all']) ,'" data-confirm="', ($context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove']) ,'" class="button_submit you_sure"> |
|
187 | + <input type="submit" name="removeSelection" value="', $txt['remove_selection'], '" data-confirm="', $txt['remove_selection_confirm'], '" class="button_submit you_sure"> |
|
188 | + <input type="submit" name="delall" value="', ($context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all']), '" data-confirm="', ($context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove']), '" class="button_submit you_sure"> |
|
189 | 189 | </div> |
190 | 190 | </div> |
191 | 191 | <br>'; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | <head> |
216 | 216 | <meta charset="', $context['character_set'], '"> |
217 | 217 | <title>', $context['file_data']['file'], '</title> |
218 | - <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'] ,'"> |
|
218 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $modSettings['browser_cache'], '"> |
|
219 | 219 | </head> |
220 | 220 | <body> |
221 | 221 | <table class="errorfile_table">'; |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | $is_target = $line_num == $context['file_data']['target']; |
226 | 226 | echo ' |
227 | 227 | <tr> |
228 | - <td class="righttext', $is_target ? ' current">==>' : '">', $line_num , ':</td> |
|
229 | - <td style="white-space: nowrap;', $is_target ? ' border: 1px solid black;border-width: 1px 1px 1px 0;':'','">', $line, '</td> |
|
228 | + <td class="righttext', $is_target ? ' current">==>' : '">', $line_num, ':</td> |
|
229 | + <td style="white-space: nowrap;', $is_target ? ' border: 1px solid black;border-width: 1px 1px 1px 0;' : '', '">', $line, '</td> |
|
230 | 230 | </tr>'; |
231 | 231 | } |
232 | 232 | echo ' |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | { |
24 | 24 | global $context, $txt; |
25 | 25 | |
26 | - if (!empty($context['simple_action'])) |
|
27 | - echo ' |
|
26 | + if (!empty($context['simple_action'])) { |
|
27 | + echo ' |
|
28 | 28 | <strong> |
29 | 29 | ', $context['error_title'], ' |
30 | 30 | </strong><br> |
31 | 31 | <div ', $context['error_code'], 'class="padding">', $context['error_message'], '</div>'; |
32 | - else |
|
32 | + } else |
|
33 | 33 | { |
34 | 34 | echo ' |
35 | 35 | <div id="fatal_error"> |
@@ -82,21 +82,23 @@ discard block |
||
82 | 82 | ', $txt['apply_filter_of_type'], ':'; |
83 | 83 | |
84 | 84 | $error_types = array(); |
85 | - foreach ($context['error_types'] as $type => $details) |
|
86 | - $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>'; |
|
85 | + foreach ($context['error_types'] as $type => $details) { |
|
86 | + $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt=""> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>'; |
|
87 | + } |
|
87 | 88 | |
88 | 89 | echo ' |
89 | 90 | ', implode(' | ', $error_types), ' |
90 | 91 | </td> |
91 | 92 | </tr>'; |
92 | 93 | |
93 | - if ($context['has_filter']) |
|
94 | - echo ' |
|
94 | + if ($context['has_filter']) { |
|
95 | + echo ' |
|
95 | 96 | <tr> |
96 | 97 | <td colspan="3" class="windowbg"> |
97 | 98 | <strong> ', $txt['applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], ' [<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['clear_filter'], '</a>] |
98 | 99 | </td> |
99 | 100 | </tr>'; |
101 | + } |
|
100 | 102 | |
101 | 103 | echo ' |
102 | 104 | <tr> |
@@ -107,11 +109,12 @@ discard block |
||
107 | 109 | </tr>'; |
108 | 110 | |
109 | 111 | // No errors, then show a message |
110 | - if (count($context['errors']) == 0) |
|
111 | - echo ' |
|
112 | + if (count($context['errors']) == 0) { |
|
113 | + echo ' |
|
112 | 114 | <tr class="windowbg"> |
113 | 115 | <td class="centertext" colspan="2">', $txt['errlog_no_entries'], '</td> |
114 | 116 | </tr>'; |
117 | + } |
|
115 | 118 | |
116 | 119 | // we have some errors, must be some mods installed :P |
117 | 120 | foreach ($context['errors'] as $error) |
@@ -126,20 +129,22 @@ discard block |
||
126 | 129 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['reverse_direction'], '"><span class="generic_icons sort_' . $context['sort_direction'] . '"></span></a> |
127 | 130 | ', $error['time'], '<br>'; |
128 | 131 | |
129 | - if (!empty($error['member']['ip'])) |
|
130 | - echo ' |
|
132 | + if (!empty($error['member']['ip'])) { |
|
133 | + echo ' |
|
131 | 134 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $error['member']['ip'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '"><span class="generic_icons filter centericon"></span></a> |
132 | 135 | <strong><a href="', $scripturl, '?action=trackip;searchip=', $error['member']['ip'], '">', $error['member']['ip'], '</a></strong> <br>'; |
136 | + } |
|
133 | 137 | |
134 | 138 | echo ' |
135 | 139 | </div> |
136 | 140 | |
137 | 141 | <div style="float: left; width: 50%; line-height: 1.8em; padding: 0 4px;">'; |
138 | 142 | |
139 | - if ($error['member']['session'] != '') |
|
140 | - echo ' |
|
143 | + if ($error['member']['session'] != '') { |
|
144 | + echo ' |
|
141 | 145 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $error['member']['session'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '"><span class="generic_icons filter centericon"></span></a> |
142 | 146 | ', $error['member']['session'], '<br>'; |
147 | + } |
|
143 | 148 | |
144 | 149 | echo ' |
145 | 150 | <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=error_type;value=', $error['error_type']['type'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '"><span class="generic_icons filter centericon"></span></a> |
@@ -153,8 +158,8 @@ discard block |
||
153 | 158 | <a style="display: table-cell;" href="', $error['url']['html'], '">', $error['url']['html'], '</a> |
154 | 159 | </div>'; |
155 | 160 | |
156 | - if (!empty($error['file'])) |
|
157 | - echo ' |
|
161 | + if (!empty($error['file'])) { |
|
162 | + echo ' |
|
158 | 163 | <div style="float: left; width: 100%; padding: 4px 0; line-height: 1.6em; border-top: 1px solid #e3e3e3;"> |
159 | 164 | <a style="display: table-cell; padding: 4px; width: 20px; vertical-align: top;" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=file;value=', $error['file']['search'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '"><span class="generic_icons filter"></span></a> |
160 | 165 | <div> |
@@ -162,6 +167,7 @@ discard block |
||
162 | 167 | ', $txt['line'], ': ', $error['file']['line'], ' |
163 | 168 | </div> |
164 | 169 | </div>'; |
170 | + } |
|
165 | 171 | |
166 | 172 | echo ' |
167 | 173 | </td> |
@@ -190,9 +196,10 @@ discard block |
||
190 | 196 | </div> |
191 | 197 | <br>'; |
192 | 198 | |
193 | - if ($context['sort_direction'] == 'down') |
|
194 | - echo ' |
|
199 | + if ($context['sort_direction'] == 'down') { |
|
200 | + echo ' |
|
195 | 201 | <input type="hidden" name="desc" value="1">'; |
202 | + } |
|
196 | 203 | |
197 | 204 | echo ' |
198 | 205 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | echo ' |
40 | 40 | <div id="display_head" class="information"> |
41 | 41 | <h2 class="display_title"><span id="top_subject">', $context['subject'], '</span>', ($context['is_locked']) ? ' <span class="generic_icons lock"></span>' : '', ($context['is_sticky']) ? ' <span class="generic_icons sticky"></span>' : '', '</h2> |
42 | - <p>',$txt['started_by'],' ', $context['topic_poster_name'],', ', $context['topic_started_time'],'</p>'; |
|
42 | + <p>',$txt['started_by'], ' ', $context['topic_poster_name'], ', ', $context['topic_started_time'], '</p>'; |
|
43 | 43 | |
44 | 44 | // Next - Prev |
45 | 45 | echo ' |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | <div id="poll"> |
75 | 75 | <div class="cat_bar"> |
76 | 76 | <h3 class="catbg"> |
77 | - <span class="generic_icons poll"></span>', $context['poll']['is_locked'] ? '<span class="generic_icons lock"></span>' : '' ,' ', $context['poll']['question'], ' |
|
77 | + <span class="generic_icons poll"></span>', $context['poll']['is_locked'] ? '<span class="generic_icons lock"></span>' : '', ' ', $context['poll']['question'], ' |
|
78 | 78 | </h3> |
79 | 79 | </div> |
80 | 80 | <div class="windowbg noup"> |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | // Mobile action - moderation buttons (top) |
189 | 189 | echo ' |
190 | 190 | <div class="mobile_buttons floatright"> |
191 | - <a class="button mobile_act">', $txt['mobile_action'],'</a> |
|
192 | - ', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">'. $txt['mobile_moderation'].'</a>' : '',' |
|
191 | + <a class="button mobile_act">', $txt['mobile_action'], '</a> |
|
192 | + ', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">' . $txt['mobile_moderation'] . '</a>' : '', ' |
|
193 | 193 | </div>'; |
194 | 194 | |
195 | 195 | // Show the topic information - icon, subject, etc. |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | // Mobile action - moderation buttons (bottom) |
214 | 214 | echo ' |
215 | 215 | <div class="mobile_buttons floatright"> |
216 | - <a class="button mobile_act">', $txt['mobile_action'],'</a> |
|
217 | - ', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">'. $txt['mobile_moderation'].'</a>' : '',' |
|
216 | + <a class="button mobile_act">', $txt['mobile_action'], '</a> |
|
217 | + ', ($context['can_moderate_forum'] || $context['user']['is_mod']) ? '<a class="button mobile_mod">' . $txt['mobile_moderation'] . '</a>' : '', ' |
|
218 | 218 | </div>'; |
219 | 219 | |
220 | 220 | // Show the page index... "Pages: [1]". |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | echo ' |
249 | 249 | <div id="mobile_action" class="popup_container"> |
250 | 250 | <div class="popup_window description"> |
251 | - <div class="popup_heading">', $txt['mobile_action'],' |
|
251 | + <div class="popup_heading">', $txt['mobile_action'], ' |
|
252 | 252 | <a href="javascript:void(0);" class="generic_icons hide_popup"></a></div> |
253 | 253 | ', template_button_strip($context['normal_buttons']), ' |
254 | 254 | </div> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | echo ' |
260 | 260 | <div id="mobile_moderation" class="popup_container"> |
261 | 261 | <div class="popup_window description"> |
262 | - <div class="popup_heading">', $txt['mobile_moderation'],' |
|
262 | + <div class="popup_heading">', $txt['mobile_moderation'], ' |
|
263 | 263 | <a href="javascript:void(0);" class="generic_icons hide_popup"></a></div> |
264 | 264 | <div id="moderationbuttons_mobile"> |
265 | 265 | ', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip_mobile')), ' |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ', |
348 | 348 | sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ', |
349 | 349 | sTemplateTopSubject: ', JavaScriptEscape('%subject%'), ', |
350 | - sTemplateReasonEdit: ', JavaScriptEscape($txt['reason_for_edit'] .': <input type="text" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text quickModifyMargin">'), ', |
|
350 | + sTemplateReasonEdit: ', JavaScriptEscape($txt['reason_for_edit'] . ': <input type="text" name="modify_reason" value="%modify_reason%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text quickModifyMargin">'), ', |
|
351 | 351 | sTemplateReasonNormal: ', JavaScriptEscape('%modify_text'), ', |
352 | 352 | sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), ($context['can_reply']) ? ', |
353 | 353 | sFormRemoveAccessKeys: \'postmodify\'' : '', ' |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // Show the message anchor and a "new" anchor if this message is new. |
422 | 422 | echo ' |
423 | - <div class="', $message['css_class'] ,'">', $message['id'] != $context['first_message'] ? ' |
|
423 | + <div class="', $message['css_class'], '">', $message['id'] != $context['first_message'] ? ' |
|
424 | 424 | <a id="msg' . $message['id'] . '"></a>' . ($message['first_new'] ? '<a id="new"></a>' : '') : '', ' |
425 | 425 | <div class="post_wrapper">'; |
426 | 426 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | foreach ($message['custom_fields']['above_member'] as $custom) |
439 | 439 | echo ' |
440 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
440 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
441 | 441 | |
442 | 442 | echo ' |
443 | 443 | </ul> |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | if (!empty($message['custom_fields']['below_avatar'])) |
474 | 474 | foreach ($message['custom_fields']['below_avatar'] as $custom) |
475 | 475 | echo ' |
476 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
476 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
477 | 477 | |
478 | 478 | // Show the post group icons, but not for guests. |
479 | 479 | if (!$message['member']['is_guest']) |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | foreach ($message['custom_fields']['icons'] as $custom) |
520 | 520 | echo ' |
521 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
521 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
522 | 522 | |
523 | 523 | echo ' |
524 | 524 | </ol> |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (!empty($message['custom_fields']['standard'])) |
557 | 557 | foreach ($message['custom_fields']['standard'] as $custom) |
558 | 558 | echo ' |
559 | - <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
559 | + <li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>'; |
|
560 | 560 | |
561 | 561 | } |
562 | 562 | // Otherwise, show the guest's email. |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | if (!empty($message['custom_fields']['bottom_poster'])) |
595 | 595 | foreach ($message['custom_fields']['bottom_poster'] as $custom) |
596 | 596 | echo ' |
597 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
597 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
598 | 598 | |
599 | 599 | // Poster info ends. |
600 | 600 | echo ' |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $base .= (isset($txt[$base . $count])) ? $count : 'n'; |
782 | 782 | |
783 | 783 | echo ' |
784 | - <li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $message['id'] .';'. $context['session_var'] .'='. $context['session_id'], comma_format($count)), '</li>'; |
|
784 | + <li class="like_count smalltext">', sprintf($txt[$base], $scripturl . '?action=likes;sa=view;ltype=msg;like=' . $message['id'] . ';' . $context['session_var'] . '=' . $context['session_id'], comma_format($count)), '</li>'; |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | echo ' |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | if ($context['can_quote']) |
799 | 799 | echo ' |
800 | 800 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
801 | - <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>'; |
|
801 | + <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li>'; |
|
802 | 802 | |
803 | 803 | // Can the user modify the contents of this post? Show the modify inline image. |
804 | 804 | if ($message['can_modify']) |
@@ -820,10 +820,10 @@ discard block |
||
820 | 820 | // How about... even... remove it entirely?! |
821 | 821 | if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
822 | 822 | echo ' |
823 | - <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>'; |
|
823 | + <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'], '</a></li>'; |
|
824 | 824 | elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
825 | 825 | echo ' |
826 | - <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'] ,'" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
|
826 | + <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
|
827 | 827 | |
828 | 828 | // What about splitting it off the rest of the topic? |
829 | 829 | if ($context['can_split'] && !empty($context['real_num_replies'])) |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | |
882 | 882 | foreach ($message['custom_fields']['above_signature'] as $custom) |
883 | 883 | echo ' |
884 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
884 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
885 | 885 | |
886 | 886 | echo ' |
887 | 887 | </ul> |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | |
904 | 904 | foreach ($message['custom_fields']['below_signature'] as $custom) |
905 | 905 | echo ' |
906 | - <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
|
906 | + <li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>'; |
|
907 | 907 | |
908 | 908 | echo ' |
909 | 909 | </ul> |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | echo ' |
1005 | 1005 | <br class="clear_right"> |
1006 | 1006 | <span id="post_confirm_buttons"> |
1007 | - ', template_control_richedit_buttons($context['post_box_name']) ,' |
|
1007 | + ', template_control_richedit_buttons($context['post_box_name']), ' |
|
1008 | 1008 | </span>'; |
1009 | 1009 | echo ' |
1010 | 1010 | </form> |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | sJumpAnchor: "quickreply", |
1048 | 1048 | bIsFull: true |
1049 | 1049 | }); |
1050 | - var oEditorID = "', $context['post_box_name'] ,'"; |
|
1050 | + var oEditorID = "', $context['post_box_name'], '"; |
|
1051 | 1051 | var oEditorObject = oEditorHandle_', $context['post_box_name'], '; |
1052 | 1052 | var oJumpAnchor = "quickreply"; |
1053 | 1053 | </script>'; |
@@ -51,11 +51,13 @@ discard block |
||
51 | 51 | <p>'; |
52 | 52 | |
53 | 53 | // Show just numbers...? |
54 | - if ($settings['display_who_viewing'] == 1) |
|
55 | - echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
54 | + if ($settings['display_who_viewing'] == 1) { |
|
55 | + echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members']; |
|
56 | + } |
|
56 | 57 | // Or show the actual people viewing the topic? |
57 | - else |
|
58 | - echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
58 | + else { |
|
59 | + echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) || $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')'); |
|
60 | + } |
|
59 | 61 | |
60 | 62 | // Now show how many guests are here too. |
61 | 63 | echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], ' |
@@ -93,10 +95,11 @@ discard block |
||
93 | 95 | <dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt> |
94 | 96 | <dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">'; |
95 | 97 | |
96 | - if ($context['allow_results_view']) |
|
97 | - echo ' |
|
98 | + if ($context['allow_results_view']) { |
|
99 | + echo ' |
|
98 | 100 | ', $option['bar_ndt'], ' |
99 | 101 | <span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>'; |
102 | + } |
|
100 | 103 | |
101 | 104 | echo ' |
102 | 105 | </dd>'; |
@@ -105,9 +108,10 @@ discard block |
||
105 | 108 | echo ' |
106 | 109 | </dl>'; |
107 | 110 | |
108 | - if ($context['allow_results_view']) |
|
109 | - echo ' |
|
111 | + if ($context['allow_results_view']) { |
|
112 | + echo ' |
|
110 | 113 | <p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>'; |
114 | + } |
|
111 | 115 | } |
112 | 116 | // They are allowed to vote! Go to it! |
113 | 117 | else |
@@ -116,17 +120,19 @@ discard block |
||
116 | 120 | <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">'; |
117 | 121 | |
118 | 122 | // Show a warning if they are allowed more than one option. |
119 | - if ($context['poll']['allowed_warning']) |
|
120 | - echo ' |
|
123 | + if ($context['poll']['allowed_warning']) { |
|
124 | + echo ' |
|
121 | 125 | <p class="smallpadding">', $context['poll']['allowed_warning'], '</p>'; |
126 | + } |
|
122 | 127 | |
123 | 128 | echo ' |
124 | 129 | <ul class="options">'; |
125 | 130 | |
126 | 131 | // Show each option with its button - a radio likely. |
127 | - foreach ($context['poll']['options'] as $option) |
|
128 | - echo ' |
|
132 | + foreach ($context['poll']['options'] as $option) { |
|
133 | + echo ' |
|
129 | 134 | <li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>'; |
135 | + } |
|
130 | 136 | |
131 | 137 | echo ' |
132 | 138 | </ul> |
@@ -138,9 +144,10 @@ discard block |
||
138 | 144 | } |
139 | 145 | |
140 | 146 | // Is the clock ticking? |
141 | - if (!empty($context['poll']['expire_time'])) |
|
142 | - echo ' |
|
147 | + if (!empty($context['poll']['expire_time'])) { |
|
148 | + echo ' |
|
143 | 149 | <p><strong>', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ':</strong> ', $context['poll']['expire_time'], '</p>'; |
150 | + } |
|
144 | 151 | |
145 | 152 | echo ' |
146 | 153 | </div> |
@@ -164,11 +171,12 @@ discard block |
||
164 | 171 | <div class="information"> |
165 | 172 | <ul>'; |
166 | 173 | |
167 | - foreach ($context['linked_calendar_events'] as $event) |
|
168 | - echo ' |
|
174 | + foreach ($context['linked_calendar_events'] as $event) { |
|
175 | + echo ' |
|
169 | 176 | <li> |
170 | 177 | ', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify"></span></a> ' : ''), '<strong>', $event['title'], '</strong>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), ' |
171 | 178 | </li>'; |
179 | + } |
|
172 | 180 | |
173 | 181 | echo ' |
174 | 182 | </ul> |
@@ -203,8 +211,9 @@ discard block |
||
203 | 211 | $context['removableMessageIDs'] = array(); |
204 | 212 | |
205 | 213 | // Get all the messages... |
206 | - while ($message = $context['get_message']()) |
|
207 | - template_single_post($message); |
|
214 | + while ($message = $context['get_message']()) { |
|
215 | + template_single_post($message); |
|
216 | + } |
|
208 | 217 | |
209 | 218 | echo ' |
210 | 219 | </form> |
@@ -241,8 +250,9 @@ discard block |
||
241 | 250 | <div id="display_jump_to"> </div>'; |
242 | 251 | |
243 | 252 | // Show quickreply |
244 | - if ($context['can_reply']) |
|
245 | - template_quickreply(); |
|
253 | + if ($context['can_reply']) { |
|
254 | + template_quickreply(); |
|
255 | + } |
|
246 | 256 | |
247 | 257 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
248 | 258 | echo ' |
@@ -255,8 +265,8 @@ discard block |
||
255 | 265 | </div>'; |
256 | 266 | |
257 | 267 | // Show the moderation button & pop only if user can moderate |
258 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
259 | - echo ' |
|
268 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
269 | + echo ' |
|
260 | 270 | <div id="mobile_moderation" class="popup_container"> |
261 | 271 | <div class="popup_window description"> |
262 | 272 | <div class="popup_heading">', $txt['mobile_moderation'],' |
@@ -266,6 +276,7 @@ discard block |
||
266 | 276 | </div> |
267 | 277 | </div> |
268 | 278 | </div>'; |
279 | + } |
|
269 | 280 | |
270 | 281 | echo ' |
271 | 282 | <script>'; |
@@ -389,9 +400,10 @@ discard block |
||
389 | 400 | }); |
390 | 401 | }'; |
391 | 402 | |
392 | - if (!empty($context['ignoredMsgs'])) |
|
393 | - echo ' |
|
403 | + if (!empty($context['ignoredMsgs'])) { |
|
404 | + echo ' |
|
394 | 405 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
406 | + } |
|
395 | 407 | |
396 | 408 | echo ' |
397 | 409 | </script>'; |
@@ -408,8 +420,9 @@ discard block |
||
408 | 420 | |
409 | 421 | $ignoring = false; |
410 | 422 | |
411 | - if ($message['can_remove']) |
|
412 | - $context['removableMessageIDs'][] = $message['id']; |
|
423 | + if ($message['can_remove']) { |
|
424 | + $context['removableMessageIDs'][] = $message['id']; |
|
425 | + } |
|
413 | 426 | |
414 | 427 | // Are we ignoring this message? |
415 | 428 | if (!empty($message['is_ignored'])) |
@@ -435,9 +448,10 @@ discard block |
||
435 | 448 | <div class="custom_fields_above_member"> |
436 | 449 | <ul class="nolist">'; |
437 | 450 | |
438 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
439 | - echo ' |
|
451 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
452 | + echo ' |
|
440 | 453 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
454 | + } |
|
441 | 455 | |
442 | 456 | echo ' |
443 | 457 | </ul> |
@@ -448,9 +462,10 @@ discard block |
||
448 | 462 | <h4>'; |
449 | 463 | |
450 | 464 | // Show online and offline buttons? |
451 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
452 | - echo ' |
|
465 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
466 | + echo ' |
|
453 | 467 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
468 | + } |
|
454 | 469 | |
455 | 470 | |
456 | 471 | // Show a link to the member's profile. |
@@ -463,51 +478,59 @@ discard block |
||
463 | 478 | |
464 | 479 | |
465 | 480 | // Show the user's avatar. |
466 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
467 | - echo ' |
|
481 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
482 | + echo ' |
|
468 | 483 | <li class="avatar"> |
469 | 484 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
470 | 485 | </li>'; |
486 | + } |
|
471 | 487 | |
472 | 488 | // Are there any custom fields below the avatar? |
473 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
474 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
489 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
490 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
475 | 491 | echo ' |
476 | 492 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
493 | + } |
|
477 | 494 | |
478 | 495 | // Show the post group icons, but not for guests. |
479 | - if (!$message['member']['is_guest']) |
|
480 | - echo ' |
|
496 | + if (!$message['member']['is_guest']) { |
|
497 | + echo ' |
|
481 | 498 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
499 | + } |
|
482 | 500 | |
483 | 501 | // Show the member's primary group (like 'Administrator') if they have one. |
484 | - if (!empty($message['member']['group'])) |
|
485 | - echo ' |
|
502 | + if (!empty($message['member']['group'])) { |
|
503 | + echo ' |
|
486 | 504 | <li class="membergroup">', $message['member']['group'], '</li>'; |
505 | + } |
|
487 | 506 | |
488 | 507 | // Show the member's custom title, if they have one. |
489 | - if (!empty($message['member']['title'])) |
|
490 | - echo ' |
|
508 | + if (!empty($message['member']['title'])) { |
|
509 | + echo ' |
|
491 | 510 | <li class="title">', $message['member']['title'], '</li>'; |
511 | + } |
|
492 | 512 | |
493 | 513 | // Don't show these things for guests. |
494 | 514 | if (!$message['member']['is_guest']) |
495 | 515 | { |
496 | 516 | |
497 | 517 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
498 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
499 | - echo ' |
|
518 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
519 | + echo ' |
|
500 | 520 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
521 | + } |
|
501 | 522 | |
502 | 523 | // Show how many posts they have made. |
503 | - if (!isset($context['disabled_fields']['posts'])) |
|
504 | - echo ' |
|
524 | + if (!isset($context['disabled_fields']['posts'])) { |
|
525 | + echo ' |
|
505 | 526 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
527 | + } |
|
506 | 528 | |
507 | 529 | // Show their personal text? |
508 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
509 | - echo ' |
|
530 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
531 | + echo ' |
|
510 | 532 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
533 | + } |
|
511 | 534 | |
512 | 535 | // Any custom fields to show as icons? |
513 | 536 | if (!empty($message['custom_fields']['icons'])) |
@@ -516,9 +539,10 @@ discard block |
||
516 | 539 | <li class="im_icons"> |
517 | 540 | <ol>'; |
518 | 541 | |
519 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
520 | - echo ' |
|
542 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
543 | + echo ' |
|
521 | 544 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
545 | + } |
|
522 | 546 | |
523 | 547 | echo ' |
524 | 548 | </ol> |
@@ -533,19 +557,22 @@ discard block |
||
533 | 557 | <ol class="profile_icons">'; |
534 | 558 | |
535 | 559 | // Don't show an icon if they haven't specified a website. |
536 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
537 | - echo ' |
|
560 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
561 | + echo ' |
|
538 | 562 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
563 | + } |
|
539 | 564 | |
540 | 565 | // Since we know this person isn't a guest, you *can* message them. |
541 | - if ($context['can_send_pm']) |
|
542 | - echo ' |
|
566 | + if ($context['can_send_pm']) { |
|
567 | + echo ' |
|
543 | 568 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
569 | + } |
|
544 | 570 | |
545 | 571 | // Show the email if necessary |
546 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
547 | - echo ' |
|
572 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
573 | + echo ' |
|
548 | 574 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
575 | + } |
|
549 | 576 | |
550 | 577 | echo ' |
551 | 578 | </ol> |
@@ -553,48 +580,56 @@ discard block |
||
553 | 580 | } |
554 | 581 | |
555 | 582 | // Any custom fields for standard placement? |
556 | - if (!empty($message['custom_fields']['standard'])) |
|
557 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
583 | + if (!empty($message['custom_fields']['standard'])) { |
|
584 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
558 | 585 | echo ' |
559 | 586 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
587 | + } |
|
560 | 588 | |
561 | 589 | } |
562 | 590 | // Otherwise, show the guest's email. |
563 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
564 | - echo ' |
|
591 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
592 | + echo ' |
|
565 | 593 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
594 | + } |
|
566 | 595 | |
567 | 596 | // Show the IP to this user for this post - because you can moderate? |
568 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
569 | - echo ' |
|
597 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
598 | + echo ' |
|
570 | 599 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
600 | + } |
|
571 | 601 | |
572 | 602 | // Or, should we show it because this is you? |
573 | - elseif ($message['can_see_ip']) |
|
574 | - echo ' |
|
603 | + elseif ($message['can_see_ip']) { |
|
604 | + echo ' |
|
575 | 605 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
606 | + } |
|
576 | 607 | |
577 | 608 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
578 | - elseif (!$context['user']['is_guest']) |
|
579 | - echo ' |
|
609 | + elseif (!$context['user']['is_guest']) { |
|
610 | + echo ' |
|
580 | 611 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
612 | + } |
|
581 | 613 | |
582 | 614 | // Otherwise, you see NOTHING! |
583 | - else |
|
584 | - echo ' |
|
615 | + else { |
|
616 | + echo ' |
|
585 | 617 | <li class="poster_ip">', $txt['logged'], '</li>'; |
618 | + } |
|
586 | 619 | |
587 | 620 | // Are we showing the warning status? |
588 | 621 | // Don't show these things for guests. |
589 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
590 | - echo ' |
|
622 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
623 | + echo ' |
|
591 | 624 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
625 | + } |
|
592 | 626 | |
593 | 627 | // Are there any custom fields to show at the bottom of the poster info? |
594 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
595 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
628 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
629 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
596 | 630 | echo ' |
597 | 631 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
632 | + } |
|
598 | 633 | |
599 | 634 | // Poster info ends. |
600 | 635 | echo ' |
@@ -623,9 +658,10 @@ discard block |
||
623 | 658 | echo ' |
624 | 659 | <span class="smalltext modified" id="modified_', $message['id'], '">'; |
625 | 660 | |
626 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
627 | - echo |
|
661 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
662 | + echo |
|
628 | 663 | $message['modified']['last_edit_text']; |
664 | + } |
|
629 | 665 | |
630 | 666 | echo ' |
631 | 667 | </span>'; |
@@ -636,22 +672,24 @@ discard block |
||
636 | 672 | </div>'; |
637 | 673 | |
638 | 674 | // Ignoring this user? Hide the post. |
639 | - if ($ignoring) |
|
640 | - echo ' |
|
675 | + if ($ignoring) { |
|
676 | + echo ' |
|
641 | 677 | <div id="msg_', $message['id'], '_ignored_prompt"> |
642 | 678 | ', $txt['ignoring_user'], ' |
643 | 679 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
644 | 680 | </div>'; |
681 | + } |
|
645 | 682 | |
646 | 683 | // Show the post itself, finally! |
647 | 684 | echo ' |
648 | 685 | <div class="post">'; |
649 | 686 | |
650 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
651 | - echo ' |
|
687 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
688 | + echo ' |
|
652 | 689 | <div class="approve_post"> |
653 | 690 | ', $txt['post_awaiting_approval'], ' |
654 | 691 | </div>'; |
692 | + } |
|
655 | 693 | echo ' |
656 | 694 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
657 | 695 | </div>'; |
@@ -668,9 +706,9 @@ discard block |
||
668 | 706 | foreach ($message['attachment'] as $attachment) |
669 | 707 | { |
670 | 708 | // Do we want this attachment to not be showed here? |
671 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
672 | - continue; |
|
673 | - elseif (!$div_output) |
|
709 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
710 | + continue; |
|
711 | + } elseif (!$div_output) |
|
674 | 712 | { |
675 | 713 | $div_output = true; |
676 | 714 | |
@@ -686,9 +724,10 @@ discard block |
||
686 | 724 | <fieldset> |
687 | 725 | <legend>', $txt['attach_awaiting_approve']; |
688 | 726 | |
689 | - if ($context['can_approve']) |
|
690 | - echo ' |
|
727 | + if ($context['can_approve']) { |
|
728 | + echo ' |
|
691 | 729 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
730 | + } |
|
692 | 731 | |
693 | 732 | echo ' |
694 | 733 | </legend>'; |
@@ -702,12 +741,13 @@ discard block |
||
702 | 741 | echo ' |
703 | 742 | <div class="attachments_top">'; |
704 | 743 | |
705 | - if ($attachment['thumbnail']['has_thumb']) |
|
706 | - echo ' |
|
744 | + if ($attachment['thumbnail']['has_thumb']) { |
|
745 | + echo ' |
|
707 | 746 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
708 | - else |
|
709 | - echo ' |
|
747 | + } else { |
|
748 | + echo ' |
|
710 | 749 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
750 | + } |
|
711 | 751 | |
712 | 752 | echo ' |
713 | 753 | </div>'; |
@@ -717,9 +757,10 @@ discard block |
||
717 | 757 | <div class="attachments_bot"> |
718 | 758 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
719 | 759 | |
720 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
721 | - echo ' |
|
760 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
761 | + echo ' |
|
722 | 762 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
763 | + } |
|
723 | 764 | echo ' |
724 | 765 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
725 | 766 | </div>'; |
@@ -728,33 +769,38 @@ discard block |
||
728 | 769 | </div>'; |
729 | 770 | |
730 | 771 | // Next attachment line ? |
731 | - if (++$i % $attachments_per_line === 0) |
|
732 | - echo ' |
|
772 | + if (++$i % $attachments_per_line === 0) { |
|
773 | + echo ' |
|
733 | 774 | <br>'; |
775 | + } |
|
734 | 776 | } |
735 | 777 | |
736 | 778 | // If we had unapproved attachments clean up. |
737 | - if ($last_approved_state == 0) |
|
738 | - echo ' |
|
779 | + if ($last_approved_state == 0) { |
|
780 | + echo ' |
|
739 | 781 | </fieldset>'; |
782 | + } |
|
740 | 783 | |
741 | 784 | // Only do this if we output a div above - otherwise it'll break things |
742 | - if ($div_output) |
|
743 | - echo ' |
|
785 | + if ($div_output) { |
|
786 | + echo ' |
|
744 | 787 | </div>'; |
788 | + } |
|
745 | 789 | } |
746 | 790 | |
747 | 791 | // And stuff below the attachments. |
748 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
749 | - echo ' |
|
792 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
793 | + echo ' |
|
750 | 794 | <div class="under_message">'; |
795 | + } |
|
751 | 796 | |
752 | 797 | // Maybe they want to report this post to the moderator(s)? |
753 | - if ($context['can_report_moderator']) |
|
754 | - echo ' |
|
798 | + if ($context['can_report_moderator']) { |
|
799 | + echo ' |
|
755 | 800 | <ul class="floatright smalltext"> |
756 | 801 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
757 | 802 | </ul>'; |
803 | + } |
|
758 | 804 | |
759 | 805 | // What about likes? |
760 | 806 | if (!empty($modSettings['enable_likes'])) |
@@ -795,78 +841,91 @@ discard block |
||
795 | 841 | <ul class="quickbuttons">'; |
796 | 842 | |
797 | 843 | // Can they quote? if so they can select and quote as well! |
798 | - if ($context['can_quote']) |
|
799 | - echo ' |
|
844 | + if ($context['can_quote']) { |
|
845 | + echo ' |
|
800 | 846 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
801 | 847 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>'; |
848 | + } |
|
802 | 849 | |
803 | 850 | // Can the user modify the contents of this post? Show the modify inline image. |
804 | - if ($message['can_modify']) |
|
805 | - echo ' |
|
851 | + if ($message['can_modify']) { |
|
852 | + echo ' |
|
806 | 853 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
854 | + } |
|
807 | 855 | |
808 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
809 | - echo ' |
|
856 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
857 | + echo ' |
|
810 | 858 | <li class="post_options">', $txt['post_options']; |
859 | + } |
|
811 | 860 | |
812 | 861 | echo ' |
813 | 862 | <ul>'; |
814 | 863 | |
815 | 864 | // Can the user modify the contents of this post? |
816 | - if ($message['can_modify']) |
|
817 | - echo ' |
|
865 | + if ($message['can_modify']) { |
|
866 | + echo ' |
|
818 | 867 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
868 | + } |
|
819 | 869 | |
820 | 870 | // How about... even... remove it entirely?! |
821 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
822 | - echo ' |
|
871 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
872 | + echo ' |
|
823 | 873 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>'; |
824 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
825 | - echo ' |
|
874 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
875 | + echo ' |
|
826 | 876 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'] ,'" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
877 | + } |
|
827 | 878 | |
828 | 879 | // What about splitting it off the rest of the topic? |
829 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
830 | - echo ' |
|
880 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
881 | + echo ' |
|
831 | 882 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
883 | + } |
|
832 | 884 | |
833 | 885 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
834 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
835 | - echo ' |
|
886 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
887 | + echo ' |
|
836 | 888 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
889 | + } |
|
837 | 890 | |
838 | 891 | // Can we restore topics? |
839 | - if ($context['can_restore_msg']) |
|
840 | - echo ' |
|
892 | + if ($context['can_restore_msg']) { |
|
893 | + echo ' |
|
841 | 894 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
895 | + } |
|
842 | 896 | |
843 | 897 | // Maybe we can approve it, maybe we should? |
844 | - if ($message['can_approve']) |
|
845 | - echo ' |
|
898 | + if ($message['can_approve']) { |
|
899 | + echo ' |
|
846 | 900 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
901 | + } |
|
847 | 902 | |
848 | 903 | // Maybe we can unapprove it? |
849 | - if ($message['can_unapprove']) |
|
850 | - echo ' |
|
904 | + if ($message['can_unapprove']) { |
|
905 | + echo ' |
|
851 | 906 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
907 | + } |
|
852 | 908 | |
853 | 909 | echo ' |
854 | 910 | </ul> |
855 | 911 | </li>'; |
856 | 912 | |
857 | 913 | // Show a checkbox for quick moderation? |
858 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
859 | - echo ' |
|
914 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
915 | + echo ' |
|
860 | 916 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
917 | + } |
|
861 | 918 | |
862 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
863 | - echo ' |
|
919 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
920 | + echo ' |
|
864 | 921 | </ul>'; |
922 | + } |
|
865 | 923 | } |
866 | 924 | |
867 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
868 | - echo ' |
|
925 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
926 | + echo ' |
|
869 | 927 | </div>'; |
928 | + } |
|
870 | 929 | |
871 | 930 | echo ' |
872 | 931 | </div> |
@@ -879,9 +938,10 @@ discard block |
||
879 | 938 | <div class="custom_fields_above_signature"> |
880 | 939 | <ul class="nolist">'; |
881 | 940 | |
882 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
883 | - echo ' |
|
941 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
942 | + echo ' |
|
884 | 943 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
944 | + } |
|
885 | 945 | |
886 | 946 | echo ' |
887 | 947 | </ul> |
@@ -889,9 +949,10 @@ discard block |
||
889 | 949 | } |
890 | 950 | |
891 | 951 | // Show the member's signature? |
892 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
893 | - echo ' |
|
952 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
953 | + echo ' |
|
894 | 954 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
955 | + } |
|
895 | 956 | |
896 | 957 | |
897 | 958 | // Are there any custom profile fields for below the signature? |
@@ -901,9 +962,10 @@ discard block |
||
901 | 962 | <div class="custom_fields_below_signature"> |
902 | 963 | <ul class="nolist">'; |
903 | 964 | |
904 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
905 | - echo ' |
|
965 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
966 | + echo ' |
|
906 | 967 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
968 | + } |
|
907 | 969 | |
908 | 970 | echo ' |
909 | 971 | </ul> |
@@ -951,8 +1013,8 @@ discard block |
||
951 | 1013 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
952 | 1014 | |
953 | 1015 | // Guests just need more. |
954 | - if ($context['user']['is_guest']) |
|
955 | - echo ' |
|
1016 | + if ($context['user']['is_guest']) { |
|
1017 | + echo ' |
|
956 | 1018 | <dl id="post_header"> |
957 | 1019 | <dt> |
958 | 1020 | ', $txt['name'], ': |
@@ -967,6 +1029,7 @@ discard block |
||
967 | 1029 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required> |
968 | 1030 | </dd> |
969 | 1031 | </dl>'; |
1032 | + } |
|
970 | 1033 | |
971 | 1034 | echo ' |
972 | 1035 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1014,8 +1077,8 @@ discard block |
||
1014 | 1077 | <br class="clear">'; |
1015 | 1078 | |
1016 | 1079 | // draft autosave available and the user has it enabled? |
1017 | - if (!empty($context['drafts_autosave'])) |
|
1018 | - echo ' |
|
1080 | + if (!empty($context['drafts_autosave'])) { |
|
1081 | + echo ' |
|
1019 | 1082 | <script> |
1020 | 1083 | var oDraftAutoSave = new smf_DraftAutoSave({ |
1021 | 1084 | sSelf: \'oDraftAutoSave\', |
@@ -1027,10 +1090,12 @@ discard block |
||
1027 | 1090 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
1028 | 1091 | }); |
1029 | 1092 | </script>'; |
1093 | + } |
|
1030 | 1094 | |
1031 | - if ($context['show_spellchecking']) |
|
1032 | - echo ' |
|
1095 | + if ($context['show_spellchecking']) { |
|
1096 | + echo ' |
|
1033 | 1097 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>'; |
1098 | + } |
|
1034 | 1099 | |
1035 | 1100 | echo ' |
1036 | 1101 | <script> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | echo ' |
70 | 70 | <tr class="windowbg"> |
71 | 71 | <td> |
72 | - ', !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>'; |
|
72 | + ', !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 | 73 | |
74 | 74 | if (!empty($group['children'])) |
75 | 75 | echo ' |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>'; |
90 | 90 | |
91 | 91 | echo ' |
92 | - <td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']). '</a>' : '', '</td> |
|
92 | + <td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td> |
|
93 | 93 | <td class="centercol">', $group['allow_modify'] && $context['can_modify'] ? '<input type="checkbox" name="group[]" value="' . $group['id'] . '" class="input_check">' : '', '</td> |
94 | 94 | </tr>'; |
95 | 95 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | <legend>', $txt['permissions_with_selection'], '</legend> |
115 | 115 | <dl class="settings"> |
116 | 116 | <dt> |
117 | - <a class="help" href="', $scripturl, '?action=helpadmin;help=permissions_quickgroups" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'],'"></span></a>', $txt['permissions_apply_pre_defined'], ': |
|
117 | + <a class="help" href="', $scripturl, '?action=helpadmin;help=permissions_quickgroups" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a>', $txt['permissions_apply_pre_defined'], ': |
|
118 | 118 | </dt> |
119 | 119 | <dd> |
120 | 120 | <select name="predefined"> |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | echo ' |
594 | 594 | <tr class="windowbg"> |
595 | 595 | <td> |
596 | - ', $permission['show_help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=permissionhelp_' . $permission['id'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="'. $txt['help'].'"></span></a>' : '', ' |
|
596 | + ', $permission['show_help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=permissionhelp_' . $permission['id'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : '', ' |
|
597 | 597 | </td> |
598 | 598 | <td class="lefttext full_width">', $permission['name'], '</td><td>'; |
599 | 599 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | if (empty($modSettings['permission_enable_deny'])) |
732 | 732 | echo ' |
733 | 733 | <li> |
734 | - <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \''. $context['current_permission']. '[\');"> |
|
734 | + <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \''. $context['current_permission'] . '[\');"> |
|
735 | 735 | <span>', $txt['check_all'], '</span> |
736 | 736 | </li> |
737 | 737 | </ul>'; |
@@ -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,22 +74,24 @@ 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;"' : '', '>', $group['num_permissions']['allowed'], '</td> |
89 | 93 | <td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>', $group['num_permissions']['denied'], '</td>'; |
94 | + } |
|
90 | 95 | |
91 | 96 | echo ' |
92 | 97 | <td>', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']). '</a>' : '', '</td> |
@@ -133,9 +138,10 @@ discard block |
||
133 | 138 | <option value="empty">(', $txt['permissions_select_membergroup'], ')</option>'; |
134 | 139 | foreach ($context['groups'] as $group) |
135 | 140 | { |
136 | - if ($group['id'] != 1) |
|
137 | - echo ' |
|
141 | + if ($group['id'] != 1) { |
|
142 | + echo ' |
|
138 | 143 | <option value="', $group['id'], '">', $group['name'], '</option>'; |
144 | + } |
|
139 | 145 | } |
140 | 146 | |
141 | 147 | echo ' |
@@ -145,9 +151,10 @@ discard block |
||
145 | 151 | <select name="add_remove"> |
146 | 152 | <option value="add">', $txt['permissions_add'], '...</option> |
147 | 153 | <option value="clear">', $txt['permissions_remove'], '...</option>'; |
148 | - if (!empty($modSettings['permission_enable_deny'])) |
|
149 | - echo ' |
|
154 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
155 | + echo ' |
|
150 | 156 | <option value="deny">', $txt['permissions_deny'], '...</option>'; |
157 | + } |
|
151 | 158 | echo ' |
152 | 159 | </select> |
153 | 160 | </dt> |
@@ -156,30 +163,34 @@ discard block |
||
156 | 163 | <option value="">(', $txt['permissions_select_permission'], ')</option>'; |
157 | 164 | foreach ($context['permissions'] as $permissionType) |
158 | 165 | { |
159 | - if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) |
|
160 | - continue; |
|
166 | + if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) { |
|
167 | + continue; |
|
168 | + } |
|
161 | 169 | |
162 | 170 | foreach ($permissionType['columns'] as $column) |
163 | 171 | { |
164 | 172 | foreach ($column as $permissionGroup) |
165 | 173 | { |
166 | - if ($permissionGroup['hidden']) |
|
167 | - continue; |
|
174 | + if ($permissionGroup['hidden']) { |
|
175 | + continue; |
|
176 | + } |
|
168 | 177 | |
169 | 178 | echo ' |
170 | 179 | <option value="" disabled>[', $permissionGroup['name'], ']</option>'; |
171 | 180 | foreach ($permissionGroup['permissions'] as $perm) |
172 | 181 | { |
173 | - if ($perm['hidden']) |
|
174 | - continue; |
|
182 | + if ($perm['hidden']) { |
|
183 | + continue; |
|
184 | + } |
|
175 | 185 | |
176 | - if ($perm['has_own_any']) |
|
177 | - echo ' |
|
186 | + if ($perm['has_own_any']) { |
|
187 | + echo ' |
|
178 | 188 | <option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option> |
179 | 189 | <option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>'; |
180 | - else |
|
181 | - echo ' |
|
190 | + } else { |
|
191 | + echo ' |
|
182 | 192 | <option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>'; |
193 | + } |
|
183 | 194 | } |
184 | 195 | } |
185 | 196 | } |
@@ -246,17 +257,18 @@ discard block |
||
246 | 257 | } |
247 | 258 | </script>'; |
248 | 259 | |
249 | - if (!empty($context['profile'])) |
|
250 | - echo ' |
|
260 | + if (!empty($context['profile'])) { |
|
261 | + echo ' |
|
251 | 262 | <input type="hidden" name="pid" value="', $context['profile']['id'], '">'; |
263 | + } |
|
252 | 264 | |
253 | 265 | echo ' |
254 | 266 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
255 | 267 | <input type="hidden" name="', $context['admin-mpq_token_var'], '" value="', $context['admin-mpq_token'], '">'; |
256 | - } |
|
257 | - else |
|
258 | - echo ' |
|
268 | + } else { |
|
269 | + echo ' |
|
259 | 270 | </table>'; |
271 | + } |
|
260 | 272 | |
261 | 273 | echo ' |
262 | 274 | </form> |
@@ -296,9 +308,10 @@ discard block |
||
296 | 308 | <h3 class="subbg">', $category['name'], '</h3> |
297 | 309 | </div>'; |
298 | 310 | |
299 | - if (!empty($category['boards'])) |
|
300 | - echo ' |
|
311 | + if (!empty($category['boards'])) { |
|
312 | + echo ' |
|
301 | 313 | <ul class="perm_boards flow_hidden">'; |
314 | + } |
|
302 | 315 | |
303 | 316 | foreach ($category['boards'] as $board) |
304 | 317 | { |
@@ -315,33 +328,36 @@ discard block |
||
315 | 328 | echo ' |
316 | 329 | <select name="boardprofile[', $board['id'], ']">'; |
317 | 330 | |
318 | - foreach ($context['profiles'] as $id => $profile) |
|
319 | - echo ' |
|
331 | + foreach ($context['profiles'] as $id => $profile) { |
|
332 | + echo ' |
|
320 | 333 | <option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
334 | + } |
|
321 | 335 | |
322 | 336 | echo ' |
323 | 337 | </select>'; |
324 | - } |
|
325 | - else |
|
326 | - echo ' |
|
338 | + } else { |
|
339 | + echo ' |
|
327 | 340 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>'; |
341 | + } |
|
328 | 342 | |
329 | 343 | echo ' |
330 | 344 | </span> |
331 | 345 | </li>'; |
332 | 346 | } |
333 | 347 | |
334 | - if (!empty($category['boards'])) |
|
335 | - echo ' |
|
348 | + if (!empty($category['boards'])) { |
|
349 | + echo ' |
|
336 | 350 | </ul>'; |
351 | + } |
|
337 | 352 | } |
338 | 353 | |
339 | - if ($context['edit_all']) |
|
340 | - echo ' |
|
354 | + if ($context['edit_all']) { |
|
355 | + echo ' |
|
341 | 356 | <input type="submit" name="save_changes" value="', $txt['save'], '" class="button_submit">'; |
342 | - else |
|
343 | - echo ' |
|
357 | + } else { |
|
358 | + echo ' |
|
344 | 359 | <a class="button_link" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>'; |
360 | + } |
|
345 | 361 | |
346 | 362 | echo ' |
347 | 363 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -381,12 +397,13 @@ discard block |
||
381 | 397 | <tr class="windowbg"> |
382 | 398 | <td>'; |
383 | 399 | |
384 | - if (!empty($context['show_rename_boxes']) && $profile['can_edit']) |
|
385 | - echo ' |
|
400 | + if (!empty($context['show_rename_boxes']) && $profile['can_edit']) { |
|
401 | + echo ' |
|
386 | 402 | <input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '" class="input_text">'; |
387 | - else |
|
388 | - echo ' |
|
403 | + } else { |
|
404 | + echo ' |
|
389 | 405 | <a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>'; |
406 | + } |
|
390 | 407 | |
391 | 408 | echo ' |
392 | 409 | </td> |
@@ -406,9 +423,10 @@ discard block |
||
406 | 423 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
407 | 424 | <input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">'; |
408 | 425 | |
409 | - if ($context['can_edit_something']) |
|
410 | - echo ' |
|
426 | + if ($context['can_edit_something']) { |
|
427 | + echo ' |
|
411 | 428 | <input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button_submit">'; |
429 | + } |
|
412 | 430 | |
413 | 431 | echo ' |
414 | 432 | <input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button_submit" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '/> |
@@ -433,9 +451,10 @@ discard block |
||
433 | 451 | <dd> |
434 | 452 | <select name="copy_from">'; |
435 | 453 | |
436 | - foreach ($context['profiles'] as $id => $profile) |
|
437 | - echo ' |
|
454 | + foreach ($context['profiles'] as $id => $profile) { |
|
455 | + echo ' |
|
438 | 456 | <option value="', $id, '">', $profile['name'], '</option>'; |
457 | + } |
|
439 | 458 | |
440 | 459 | echo ' |
441 | 460 | </select> |
@@ -463,8 +482,7 @@ discard block |
||
463 | 482 | <div class="errorbox"> |
464 | 483 | ', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), ' |
465 | 484 | </div>'; |
466 | - } |
|
467 | - else |
|
485 | + } else |
|
468 | 486 | { |
469 | 487 | echo ' |
470 | 488 | <script> |
@@ -484,21 +502,23 @@ discard block |
||
484 | 502 | <div id="admincenter"> |
485 | 503 | <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();">'; |
486 | 504 | |
487 | - if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) |
|
488 | - echo ' |
|
505 | + if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1) { |
|
506 | + echo ' |
|
489 | 507 | <div class="information"> |
490 | 508 | ', $txt['permissions_option_desc'], ' |
491 | 509 | </div>'; |
510 | + } |
|
492 | 511 | |
493 | 512 | echo ' |
494 | 513 | <div class="cat_bar"> |
495 | 514 | <h3 class="catbg">'; |
496 | - if ($context['permission_type'] == 'board') |
|
497 | - echo ' |
|
515 | + if ($context['permission_type'] == 'board') { |
|
516 | + echo ' |
|
498 | 517 | ', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"'; |
499 | - else |
|
500 | - echo ' |
|
518 | + } else { |
|
519 | + echo ' |
|
501 | 520 | ', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"'; |
521 | + } |
|
502 | 522 | echo ' |
503 | 523 | </h3> |
504 | 524 | </div>'; |
@@ -521,15 +541,17 @@ discard block |
||
521 | 541 | template_modify_group_display('board'); |
522 | 542 | } |
523 | 543 | |
524 | - if ($context['profile']['can_modify']) |
|
525 | - echo ' |
|
544 | + if ($context['profile']['can_modify']) { |
|
545 | + echo ' |
|
526 | 546 | <div class="padding"> |
527 | 547 | <input type="submit" value="', $txt['permissions_commit'], '" class="button_submit"> |
528 | 548 | </div>'; |
549 | + } |
|
529 | 550 | |
530 | - foreach ($context['hidden_perms'] as $hidden_perm) |
|
531 | - echo ' |
|
551 | + foreach ($context['hidden_perms'] as $hidden_perm) { |
|
552 | + echo ' |
|
532 | 553 | <input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">'; |
554 | + } |
|
533 | 555 | |
534 | 556 | echo ' |
535 | 557 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -557,17 +579,19 @@ discard block |
||
557 | 579 | |
558 | 580 | foreach ($column as $permissionGroup) |
559 | 581 | { |
560 | - if (empty($permissionGroup['permissions'])) |
|
561 | - continue; |
|
582 | + if (empty($permissionGroup['permissions'])) { |
|
583 | + continue; |
|
584 | + } |
|
562 | 585 | |
563 | 586 | // Are we likely to have something in this group to display or is it all hidden? |
564 | 587 | $has_display_content = false; |
565 | 588 | if (!$permissionGroup['hidden']) |
566 | 589 | { |
567 | 590 | // Before we go any further check we are going to have some data to print otherwise we just have a silly heading. |
568 | - foreach ($permissionGroup['permissions'] as $permission) |
|
569 | - if (!$permission['hidden']) |
|
591 | + foreach ($permissionGroup['permissions'] as $permission) { |
|
592 | + if (!$permission['hidden']) |
|
570 | 593 | $has_display_content = true; |
594 | + } |
|
571 | 595 | |
572 | 596 | if ($has_display_content) |
573 | 597 | { |
@@ -576,10 +600,11 @@ discard block |
||
576 | 600 | <th></th> |
577 | 601 | <th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>'; |
578 | 602 | |
579 | - if ($context['group']['id'] != -1) |
|
580 | - echo ' |
|
603 | + if ($context['group']['id'] != -1) { |
|
604 | + echo ' |
|
581 | 605 | <th>', $txt['permissions_option_own'], '</th> |
582 | 606 | <th>', $txt['permissions_option_any'], '</th>'; |
607 | + } |
|
583 | 608 | |
584 | 609 | echo ' |
585 | 610 | </tr>'; |
@@ -602,17 +627,18 @@ discard block |
||
602 | 627 | // Guests can't do their own thing. |
603 | 628 | if ($context['group']['id'] != -1) |
604 | 629 | { |
605 | - if (empty($modSettings['permission_enable_deny'])) |
|
606 | - echo ' |
|
630 | + if (empty($modSettings['permission_enable_deny'])) { |
|
631 | + echo ' |
|
607 | 632 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" class="input_check" ', $disable_field, '/>'; |
608 | - else |
|
633 | + } else |
|
609 | 634 | { |
610 | 635 | echo ' |
611 | 636 | <select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>'; |
612 | 637 | |
613 | - foreach (array('on', 'off', 'deny') as $c) |
|
614 | - echo ' |
|
638 | + foreach (array('on', 'off', 'deny') as $c) { |
|
639 | + echo ' |
|
615 | 640 | <option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
641 | + } |
|
616 | 642 | echo ' |
617 | 643 | </select>'; |
618 | 644 | } |
@@ -622,39 +648,41 @@ discard block |
||
622 | 648 | <td>'; |
623 | 649 | } |
624 | 650 | |
625 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
626 | - echo ' |
|
651 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
652 | + echo ' |
|
627 | 653 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>'; |
628 | - else |
|
654 | + } else |
|
629 | 655 | { |
630 | 656 | echo ' |
631 | 657 | <select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>'; |
632 | 658 | |
633 | - foreach (array('on', 'off', 'deny') as $c) |
|
634 | - echo ' |
|
659 | + foreach (array('on', 'off', 'deny') as $c) { |
|
660 | + echo ' |
|
635 | 661 | <option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
662 | + } |
|
636 | 663 | echo ' |
637 | 664 | </select>'; |
638 | 665 | } |
639 | - } |
|
640 | - else |
|
666 | + } else |
|
641 | 667 | { |
642 | - if ($context['group']['id'] != -1) |
|
643 | - echo ' |
|
668 | + if ($context['group']['id'] != -1) { |
|
669 | + echo ' |
|
644 | 670 | </td> |
645 | 671 | <td>'; |
672 | + } |
|
646 | 673 | |
647 | - if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) |
|
648 | - echo ' |
|
674 | + if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1) { |
|
675 | + echo ' |
|
649 | 676 | <input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" class="input_check" ', $disable_field, '/>'; |
650 | - else |
|
677 | + } else |
|
651 | 678 | { |
652 | 679 | echo ' |
653 | 680 | <select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>'; |
654 | 681 | |
655 | - foreach (array('on', 'off', 'deny') as $c) |
|
656 | - echo ' |
|
682 | + foreach (array('on', 'off', 'deny') as $c) { |
|
683 | + echo ' |
|
657 | 684 | <option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>'; |
685 | + } |
|
658 | 686 | echo ' |
659 | 687 | </select>'; |
660 | 688 | } |
@@ -684,11 +712,11 @@ discard block |
||
684 | 712 | echo ' |
685 | 713 | <fieldset id="', $context['current_permission'], '"> |
686 | 714 | <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 | - if (empty($modSettings['permission_enable_deny'])) |
|
688 | - echo ' |
|
715 | + if (empty($modSettings['permission_enable_deny'])) { |
|
716 | + echo ' |
|
689 | 717 | <ul>'; |
690 | - else |
|
691 | - echo ' |
|
718 | + } else { |
|
719 | + echo ' |
|
692 | 720 | <div class="information">', $txt['permissions_option_desc'], '</div> |
693 | 721 | <dl class="settings"> |
694 | 722 | <dt> |
@@ -698,46 +726,51 @@ discard block |
||
698 | 726 | </dt> |
699 | 727 | <dd> |
700 | 728 | </dd>'; |
729 | + } |
|
701 | 730 | foreach ($context['member_groups'] as $group) |
702 | 731 | { |
703 | - if (!empty($modSettings['permission_enable_deny'])) |
|
704 | - echo ' |
|
732 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
733 | + echo ' |
|
705 | 734 | <dt>'; |
706 | - else |
|
707 | - echo ' |
|
735 | + } else { |
|
736 | + echo ' |
|
708 | 737 | <li>'; |
738 | + } |
|
709 | 739 | |
710 | - if (empty($modSettings['permission_enable_deny'])) |
|
711 | - echo ' |
|
740 | + if (empty($modSettings['permission_enable_deny'])) { |
|
741 | + echo ' |
|
712 | 742 | <input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', ' class="input_check">'; |
713 | - else |
|
714 | - echo ' |
|
743 | + } else { |
|
744 | + echo ' |
|
715 | 745 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', ' class="input_radio"></span> |
716 | 746 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', ' class="input_radio"></span> |
717 | 747 | <span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', ' class="input_radio"></span>'; |
748 | + } |
|
718 | 749 | |
719 | - if (!empty($modSettings['permission_enable_deny'])) |
|
720 | - echo ' |
|
750 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
751 | + echo ' |
|
721 | 752 | </dt> |
722 | 753 | <dd> |
723 | 754 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
724 | 755 | </dd>'; |
725 | - else |
|
726 | - echo ' |
|
756 | + } else { |
|
757 | + echo ' |
|
727 | 758 | <span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span> |
728 | 759 | </li>'; |
760 | + } |
|
729 | 761 | } |
730 | 762 | |
731 | - if (empty($modSettings['permission_enable_deny'])) |
|
732 | - echo ' |
|
763 | + if (empty($modSettings['permission_enable_deny'])) { |
|
764 | + echo ' |
|
733 | 765 | <li> |
734 | 766 | <input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \''. $context['current_permission']. '[\');"> |
735 | 767 | <span>', $txt['check_all'], '</span> |
736 | 768 | </li> |
737 | 769 | </ul>'; |
738 | - else |
|
739 | - echo ' |
|
770 | + } else { |
|
771 | + echo ' |
|
740 | 772 | </dl>'; |
773 | + } |
|
741 | 774 | |
742 | 775 | echo ' |
743 | 776 | </fieldset> |
@@ -777,9 +810,10 @@ discard block |
||
777 | 810 | if (!empty($modSettings['postmod_active'])) |
778 | 811 | { |
779 | 812 | // Got advanced permissions - if so warn! |
780 | - if (!empty($modSettings['permission_enable_deny'])) |
|
781 | - echo ' |
|
813 | + if (!empty($modSettings['permission_enable_deny'])) { |
|
814 | + echo ' |
|
782 | 815 | <div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>'; |
816 | + } |
|
783 | 817 | |
784 | 818 | echo ' |
785 | 819 | <div class="padding"> |
@@ -794,10 +828,11 @@ discard block |
||
794 | 828 | ', $txt['permissions_post_moderation_select'], ': |
795 | 829 | <select name="pid" onchange="document.forms.postmodForm.submit();">'; |
796 | 830 | |
797 | - foreach ($context['profiles'] as $profile) |
|
798 | - if ($profile['can_modify']) |
|
831 | + foreach ($context['profiles'] as $profile) { |
|
832 | + if ($profile['can_modify']) |
|
799 | 833 | echo ' |
800 | 834 | <option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>'; |
835 | + } |
|
801 | 836 | |
802 | 837 | echo ' |
803 | 838 | </select> |
@@ -818,11 +853,12 @@ discard block |
||
818 | 853 | ', $txt['permissions_post_moderation_replies_any'], ' |
819 | 854 | </th>'; |
820 | 855 | |
821 | - if ($modSettings['attachmentEnable'] == 1) |
|
822 | - echo ' |
|
856 | + if ($modSettings['attachmentEnable'] == 1) { |
|
857 | + echo ' |
|
823 | 858 | <th class="centercol" colspan="3"> |
824 | 859 | ', $txt['permissions_post_moderation_attachments'], ' |
825 | 860 | </th>'; |
861 | + } |
|
826 | 862 | |
827 | 863 | echo ' |
828 | 864 | </tr> |
@@ -840,11 +876,12 @@ discard block |
||
840 | 876 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
841 | 877 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
842 | 878 | |
843 | - if ($modSettings['attachmentEnable'] == 1) |
|
844 | - echo ' |
|
879 | + if ($modSettings['attachmentEnable'] == 1) { |
|
880 | + echo ' |
|
845 | 881 | <th><span class="generic_icons post_moderation_allow"></span></th> |
846 | 882 | <th><span class="generic_icons post_moderation_moderate"></span></th> |
847 | 883 | <th><span class="generic_icons post_moderation_deny"></span></th>'; |
884 | + } |
|
848 | 885 | |
849 | 886 | echo ' |
850 | 887 | </tr> |
@@ -857,9 +894,10 @@ discard block |
||
857 | 894 | <tr class="windowbg"> |
858 | 895 | <td class="half_table"> |
859 | 896 | <span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>'; |
860 | - if (!empty($group['children'])) |
|
861 | - echo ' |
|
897 | + if (!empty($group['children'])) { |
|
898 | + echo ' |
|
862 | 899 | <br><span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>'; |
900 | + } |
|
863 | 901 | |
864 | 902 | echo ' |
865 | 903 | </td> |
@@ -872,8 +910,7 @@ discard block |
||
872 | 910 | { |
873 | 911 | echo ' |
874 | 912 | <td colspan="3"></td>'; |
875 | - } |
|
876 | - else |
|
913 | + } else |
|
877 | 914 | { |
878 | 915 | echo ' |
879 | 916 | <td class="centercol"><input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', ' class="input_radio"></td> |