@@ -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 | |
@@ -256,10 +266,11 @@ discard block |
||
| 256 | 266 | { |
| 257 | 267 | // Get PHP's default timezone, if set |
| 258 | 268 | $ini_tz = ini_get('date.timezone'); |
| 259 | - if (!empty($ini_tz)) |
|
| 260 | - $timezone_id = $ini_tz; |
|
| 261 | - else |
|
| 262 | - $timezone_id = ''; |
|
| 269 | + if (!empty($ini_tz)) { |
|
| 270 | + $timezone_id = $ini_tz; |
|
| 271 | + } else { |
|
| 272 | + $timezone_id = ''; |
|
| 273 | + } |
|
| 263 | 274 | |
| 264 | 275 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 265 | 276 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -289,8 +300,9 @@ discard block |
||
| 289 | 300 | $dir = dir(dirname(__FILE__) . '/Themes/default/languages'); |
| 290 | 301 | while ($entry = $dir->read()) |
| 291 | 302 | { |
| 292 | - if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') |
|
| 293 | - $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
| 303 | + if (substr($entry, 0, 8) == 'Install.' && substr($entry, -4) == '.php') { |
|
| 304 | + $incontext['detected_languages'][$entry] = ucfirst(substr($entry, 8, strlen($entry) - 12)); |
|
| 305 | + } |
|
| 294 | 306 | } |
| 295 | 307 | $dir->close(); |
| 296 | 308 | } |
@@ -325,10 +337,11 @@ discard block |
||
| 325 | 337 | } |
| 326 | 338 | |
| 327 | 339 | // Override the language file? |
| 328 | - if (isset($_GET['lang_file'])) |
|
| 329 | - $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
| 330 | - elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) |
|
| 331 | - $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
| 340 | + if (isset($_GET['lang_file'])) { |
|
| 341 | + $_SESSION['installer_temp_lang'] = $_GET['lang_file']; |
|
| 342 | + } elseif (isset($GLOBALS['HTTP_GET_VARS']['lang_file'])) { |
|
| 343 | + $_SESSION['installer_temp_lang'] = $GLOBALS['HTTP_GET_VARS']['lang_file']; |
|
| 344 | + } |
|
| 332 | 345 | |
| 333 | 346 | // Make sure it exists, if it doesn't reset it. |
| 334 | 347 | if (!isset($_SESSION['installer_temp_lang']) || preg_match('~[^\\w_\\-.]~', $_SESSION['installer_temp_lang']) === 1 || !file_exists(dirname(__FILE__) . '/Themes/default/languages/' . $_SESSION['installer_temp_lang'])) |
@@ -337,8 +350,9 @@ discard block |
||
| 337 | 350 | list ($_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
| 338 | 351 | |
| 339 | 352 | // If we have english and some other language, use the other language. We Americans hate english :P. |
| 340 | - if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) |
|
| 341 | - list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 353 | + if ($_SESSION['installer_temp_lang'] == 'Install.english.php' && count($incontext['detected_languages']) > 1) { |
|
| 354 | + list (, $_SESSION['installer_temp_lang']) = array_keys($incontext['detected_languages']); |
|
| 355 | + } |
|
| 342 | 356 | } |
| 343 | 357 | |
| 344 | 358 | // And now include the actual language file itself. |
@@ -351,15 +365,18 @@ discard block |
||
| 351 | 365 | global $db_prefix, $db_connection, $sourcedir; |
| 352 | 366 | global $smcFunc, $modSettings, $db_type, $db_name, $db_user, $db_persist; |
| 353 | 367 | |
| 354 | - if (empty($sourcedir)) |
|
| 355 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 368 | + if (empty($sourcedir)) { |
|
| 369 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 370 | + } |
|
| 356 | 371 | |
| 357 | 372 | // Need this to check whether we need the database password. |
| 358 | 373 | require(dirname(__FILE__) . '/Settings.php'); |
| 359 | - if (!defined('SMF')) |
|
| 360 | - define('SMF', 1); |
|
| 361 | - if (empty($smcFunc)) |
|
| 362 | - $smcFunc = array(); |
|
| 374 | + if (!defined('SMF')) { |
|
| 375 | + define('SMF', 1); |
|
| 376 | + } |
|
| 377 | + if (empty($smcFunc)) { |
|
| 378 | + $smcFunc = array(); |
|
| 379 | + } |
|
| 363 | 380 | |
| 364 | 381 | $modSettings['disableQueryCheck'] = true; |
| 365 | 382 | |
@@ -367,8 +384,9 @@ discard block |
||
| 367 | 384 | if (!$db_connection) |
| 368 | 385 | { |
| 369 | 386 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 370 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 371 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 387 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 388 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 389 | + } |
|
| 372 | 390 | |
| 373 | 391 | $db_options = array('persist' => $db_persist); |
| 374 | 392 | $port = ''; |
@@ -379,19 +397,20 @@ discard block |
||
| 379 | 397 | if ($db_type == 'mysql' || $db_type == 'mysqli') |
| 380 | 398 | { |
| 381 | 399 | $port = ((int) $_POST['db_port'] == ini_get($db_type . 'default_port')) ? '' : (int) $_POST['db_port']; |
| 382 | - } |
|
| 383 | - elseif ($db_type == 'postgresql') |
|
| 400 | + } elseif ($db_type == 'postgresql') |
|
| 384 | 401 | { |
| 385 | 402 | // PostgreSQL doesn't have a default port setting in php.ini, so just check against the default |
| 386 | 403 | $port = ((int) $_POST['db_port'] == 5432) ? '' : (int) $_POST['db_port']; |
| 387 | 404 | } |
| 388 | 405 | } |
| 389 | 406 | |
| 390 | - if (!empty($port)) |
|
| 391 | - $db_options['port'] = $port; |
|
| 407 | + if (!empty($port)) { |
|
| 408 | + $db_options['port'] = $port; |
|
| 409 | + } |
|
| 392 | 410 | |
| 393 | - if (!$db_connection) |
|
| 394 | - $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
| 411 | + if (!$db_connection) { |
|
| 412 | + $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options); |
|
| 413 | + } |
|
| 395 | 414 | } |
| 396 | 415 | } |
| 397 | 416 | |
@@ -419,8 +438,9 @@ discard block |
||
| 419 | 438 | // @todo REMOVE THIS!! |
| 420 | 439 | else |
| 421 | 440 | { |
| 422 | - if (function_exists('doStep' . $_GET['step'])) |
|
| 423 | - call_user_func('doStep' . $_GET['step']); |
|
| 441 | + if (function_exists('doStep' . $_GET['step'])) { |
|
| 442 | + call_user_func('doStep' . $_GET['step']); |
|
| 443 | + } |
|
| 424 | 444 | } |
| 425 | 445 | // Show the footer. |
| 426 | 446 | template_install_below(); |
@@ -438,8 +458,9 @@ discard block |
||
| 438 | 458 | $incontext['sub_template'] = 'welcome_message'; |
| 439 | 459 | |
| 440 | 460 | // Done the submission? |
| 441 | - if (isset($_POST['contbutt'])) |
|
| 442 | - return true; |
|
| 461 | + if (isset($_POST['contbutt'])) { |
|
| 462 | + return true; |
|
| 463 | + } |
|
| 443 | 464 | |
| 444 | 465 | // See if we think they have already installed it? |
| 445 | 466 | if (is_readable(dirname(__FILE__) . '/Settings.php')) |
@@ -447,14 +468,17 @@ discard block |
||
| 447 | 468 | $probably_installed = 0; |
| 448 | 469 | foreach (file(dirname(__FILE__) . '/Settings.php') as $line) |
| 449 | 470 | { |
| 450 | - if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) |
|
| 451 | - $probably_installed++; |
|
| 452 | - if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) |
|
| 453 | - $probably_installed++; |
|
| 471 | + if (preg_match('~^\$db_passwd\s=\s\'([^\']+)\';$~', $line)) { |
|
| 472 | + $probably_installed++; |
|
| 473 | + } |
|
| 474 | + if (preg_match('~^\$boardurl\s=\s\'([^\']+)\';~', $line) && !preg_match('~^\$boardurl\s=\s\'http://127\.0\.0\.1/smf\';~', $line)) { |
|
| 475 | + $probably_installed++; |
|
| 476 | + } |
|
| 454 | 477 | } |
| 455 | 478 | |
| 456 | - if ($probably_installed == 2) |
|
| 457 | - $incontext['warning'] = $txt['error_already_installed']; |
|
| 479 | + if ($probably_installed == 2) { |
|
| 480 | + $incontext['warning'] = $txt['error_already_installed']; |
|
| 481 | + } |
|
| 458 | 482 | } |
| 459 | 483 | |
| 460 | 484 | // Is some database support even compiled in? |
@@ -469,8 +493,7 @@ discard block |
||
| 469 | 493 | $databases[$key]['supported'] = false; |
| 470 | 494 | $notFoundSQLFile = true; |
| 471 | 495 | $txt['error_db_script_missing'] = sprintf($txt['error_db_script_missing'], 'install_' . $GLOBALS['db_script_version'] . '_' . $type . '.sql'); |
| 472 | - } |
|
| 473 | - else |
|
| 496 | + } else |
|
| 474 | 497 | { |
| 475 | 498 | $db_type = $key; |
| 476 | 499 | $incontext['supported_databases'][] = $db; |
@@ -479,29 +502,36 @@ discard block |
||
| 479 | 502 | } |
| 480 | 503 | |
| 481 | 504 | // Check the PHP version. |
| 482 | - if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) |
|
| 483 | - $error = 'error_php_too_low'; |
|
| 505 | + if ((!function_exists('version_compare') || version_compare($GLOBALS['required_php_version'], PHP_VERSION, '>'))) { |
|
| 506 | + $error = 'error_php_too_low'; |
|
| 507 | + } |
|
| 484 | 508 | // Make sure we have a supported database |
| 485 | - elseif (empty($incontext['supported_databases'])) |
|
| 486 | - $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 509 | + elseif (empty($incontext['supported_databases'])) { |
|
| 510 | + $error = empty($notFoundSQLFile) ? 'error_db_missing' : 'error_db_script_missing'; |
|
| 511 | + } |
|
| 487 | 512 | // How about session support? Some crazy sysadmin remove it? |
| 488 | - elseif (!function_exists('session_start')) |
|
| 489 | - $error = 'error_session_missing'; |
|
| 513 | + elseif (!function_exists('session_start')) { |
|
| 514 | + $error = 'error_session_missing'; |
|
| 515 | + } |
|
| 490 | 516 | // Make sure they uploaded all the files. |
| 491 | - elseif (!file_exists(dirname(__FILE__) . '/index.php')) |
|
| 492 | - $error = 'error_missing_files'; |
|
| 517 | + elseif (!file_exists(dirname(__FILE__) . '/index.php')) { |
|
| 518 | + $error = 'error_missing_files'; |
|
| 519 | + } |
|
| 493 | 520 | // Very simple check on the session.save_path for Windows. |
| 494 | 521 | // @todo Move this down later if they don't use database-driven sessions? |
| 495 | - elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') |
|
| 496 | - $error = 'error_session_save_path'; |
|
| 522 | + elseif (@ini_get('session.save_path') == '/tmp' && substr(__FILE__, 1, 2) == ':\\') { |
|
| 523 | + $error = 'error_session_save_path'; |
|
| 524 | + } |
|
| 497 | 525 | |
| 498 | 526 | // Since each of the three messages would look the same, anyway... |
| 499 | - if (isset($error)) |
|
| 500 | - $incontext['error'] = $txt[$error]; |
|
| 527 | + if (isset($error)) { |
|
| 528 | + $incontext['error'] = $txt[$error]; |
|
| 529 | + } |
|
| 501 | 530 | |
| 502 | 531 | // Mod_security blocks everything that smells funny. Let SMF handle security. |
| 503 | - if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) |
|
| 504 | - $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 532 | + if (!fixModSecurity() && !isset($_GET['overmodsecurity'])) { |
|
| 533 | + $incontext['error'] = $txt['error_mod_security'] . '<br><br><a href="' . $installurl . '?overmodsecurity=true">' . $txt['error_message_click'] . '</a> ' . $txt['error_message_bad_try_again']; |
|
| 534 | + } |
|
| 505 | 535 | |
| 506 | 536 | return false; |
| 507 | 537 | } |
@@ -524,15 +554,18 @@ discard block |
||
| 524 | 554 | 'agreement.txt', |
| 525 | 555 | 'Settings.php' |
| 526 | 556 | ); |
| 527 | - if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) |
|
| 528 | - $writable_files[] = 'Settings_bak.php'; |
|
| 557 | + if (file_exists(dirname(__FILE__) . '/Settings_bak.php')) { |
|
| 558 | + $writable_files[] = 'Settings_bak.php'; |
|
| 559 | + } |
|
| 529 | 560 | |
| 530 | - foreach ($incontext['detected_languages'] as $lang => $temp) |
|
| 531 | - $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 561 | + foreach ($incontext['detected_languages'] as $lang => $temp) { |
|
| 562 | + $extra_files[] = 'Themes/default/languages/' . $lang; |
|
| 563 | + } |
|
| 532 | 564 | |
| 533 | 565 | // With mod_security installed, we could attempt to fix it with .htaccess. |
| 534 | - if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) |
|
| 535 | - $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 566 | + if (function_exists('apache_get_modules') && in_array('mod_security', apache_get_modules())) { |
|
| 567 | + $writable_files[] = file_exists(dirname(__FILE__) . '/.htaccess') ? '.htaccess' : '.'; |
|
| 568 | + } |
|
| 536 | 569 | |
| 537 | 570 | $failed_files = array(); |
| 538 | 571 | |
@@ -548,12 +581,14 @@ discard block |
||
| 548 | 581 | @chmod(dirname(__FILE__) . '/' . $file, 0755); |
| 549 | 582 | |
| 550 | 583 | // Well, 755 hopefully worked... if not, try 777. |
| 551 | - if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) |
|
| 552 | - $failed_files[] = $file; |
|
| 584 | + if (!is_writable(dirname(__FILE__) . '/' . $file) && !@chmod(dirname(__FILE__) . '/' . $file, 0777)) { |
|
| 585 | + $failed_files[] = $file; |
|
| 586 | + } |
|
| 553 | 587 | } |
| 554 | 588 | } |
| 555 | - foreach ($extra_files as $file) |
|
| 556 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 589 | + foreach ($extra_files as $file) { |
|
| 590 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 591 | + } |
|
| 557 | 592 | } |
| 558 | 593 | // Windows is trickier. Let's try opening for r+... |
| 559 | 594 | else |
@@ -563,30 +598,35 @@ discard block |
||
| 563 | 598 | foreach ($writable_files as $file) |
| 564 | 599 | { |
| 565 | 600 | // Folders can't be opened for write... but the index.php in them can ;) |
| 566 | - if (is_dir(dirname(__FILE__) . '/' . $file)) |
|
| 567 | - $file .= '/index.php'; |
|
| 601 | + if (is_dir(dirname(__FILE__) . '/' . $file)) { |
|
| 602 | + $file .= '/index.php'; |
|
| 603 | + } |
|
| 568 | 604 | |
| 569 | 605 | // Funny enough, chmod actually does do something on windows - it removes the read only attribute. |
| 570 | 606 | @chmod(dirname(__FILE__) . '/' . $file, 0777); |
| 571 | 607 | $fp = @fopen(dirname(__FILE__) . '/' . $file, 'r+'); |
| 572 | 608 | |
| 573 | 609 | // Hmm, okay, try just for write in that case... |
| 574 | - if (!is_resource($fp)) |
|
| 575 | - $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 610 | + if (!is_resource($fp)) { |
|
| 611 | + $fp = @fopen(dirname(__FILE__) . '/' . $file, 'w'); |
|
| 612 | + } |
|
| 576 | 613 | |
| 577 | - if (!is_resource($fp)) |
|
| 578 | - $failed_files[] = $file; |
|
| 614 | + if (!is_resource($fp)) { |
|
| 615 | + $failed_files[] = $file; |
|
| 616 | + } |
|
| 579 | 617 | |
| 580 | 618 | @fclose($fp); |
| 581 | 619 | } |
| 582 | - foreach ($extra_files as $file) |
|
| 583 | - @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 620 | + foreach ($extra_files as $file) { |
|
| 621 | + @chmod(dirname(__FILE__) . (empty($file) ? '' : '/' . $file), 0777); |
|
| 622 | + } |
|
| 584 | 623 | } |
| 585 | 624 | |
| 586 | 625 | $failure = count($failed_files) >= 1; |
| 587 | 626 | |
| 588 | - if (!isset($_SERVER)) |
|
| 589 | - return !$failure; |
|
| 627 | + if (!isset($_SERVER)) { |
|
| 628 | + return !$failure; |
|
| 629 | + } |
|
| 590 | 630 | |
| 591 | 631 | // Put the list into context. |
| 592 | 632 | $incontext['failed_files'] = $failed_files; |
@@ -634,19 +674,23 @@ discard block |
||
| 634 | 674 | |
| 635 | 675 | if (!isset($ftp) || $ftp->error !== false) |
| 636 | 676 | { |
| 637 | - if (!isset($ftp)) |
|
| 638 | - $ftp = new ftp_connection(null); |
|
| 677 | + if (!isset($ftp)) { |
|
| 678 | + $ftp = new ftp_connection(null); |
|
| 679 | + } |
|
| 639 | 680 | // Save the error so we can mess with listing... |
| 640 | - elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) |
|
| 641 | - $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 681 | + elseif ($ftp->error !== false && empty($incontext['ftp_errors']) && !empty($ftp->last_message)) { |
|
| 682 | + $incontext['ftp_errors'][] = $ftp->last_message; |
|
| 683 | + } |
|
| 642 | 684 | |
| 643 | 685 | list ($username, $detect_path, $found_path) = $ftp->detect_path(dirname(__FILE__)); |
| 644 | 686 | |
| 645 | - if (empty($_POST['ftp_path']) && $found_path) |
|
| 646 | - $_POST['ftp_path'] = $detect_path; |
|
| 687 | + if (empty($_POST['ftp_path']) && $found_path) { |
|
| 688 | + $_POST['ftp_path'] = $detect_path; |
|
| 689 | + } |
|
| 647 | 690 | |
| 648 | - if (!isset($_POST['ftp_username'])) |
|
| 649 | - $_POST['ftp_username'] = $username; |
|
| 691 | + if (!isset($_POST['ftp_username'])) { |
|
| 692 | + $_POST['ftp_username'] = $username; |
|
| 693 | + } |
|
| 650 | 694 | |
| 651 | 695 | // Set the username etc, into context. |
| 652 | 696 | $incontext['ftp'] = array( |
@@ -658,8 +702,7 @@ discard block |
||
| 658 | 702 | ); |
| 659 | 703 | |
| 660 | 704 | return false; |
| 661 | - } |
|
| 662 | - else |
|
| 705 | + } else |
|
| 663 | 706 | { |
| 664 | 707 | $_SESSION['installer_temp_ftp'] = array( |
| 665 | 708 | 'server' => $_POST['ftp_server'], |
@@ -673,10 +716,12 @@ discard block |
||
| 673 | 716 | |
| 674 | 717 | foreach ($failed_files as $file) |
| 675 | 718 | { |
| 676 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 677 | - $ftp->chmod($file, 0755); |
|
| 678 | - if (!is_writable(dirname(__FILE__) . '/' . $file)) |
|
| 679 | - $ftp->chmod($file, 0777); |
|
| 719 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 720 | + $ftp->chmod($file, 0755); |
|
| 721 | + } |
|
| 722 | + if (!is_writable(dirname(__FILE__) . '/' . $file)) { |
|
| 723 | + $ftp->chmod($file, 0777); |
|
| 724 | + } |
|
| 680 | 725 | if (!is_writable(dirname(__FILE__) . '/' . $file)) |
| 681 | 726 | { |
| 682 | 727 | $failed_files_updated[] = $file; |
@@ -731,15 +776,17 @@ discard block |
||
| 731 | 776 | |
| 732 | 777 | if (!$foundOne) |
| 733 | 778 | { |
| 734 | - if (isset($db['default_host'])) |
|
| 735 | - $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 779 | + if (isset($db['default_host'])) { |
|
| 780 | + $incontext['db']['server'] = ini_get($db['default_host']) or $incontext['db']['server'] = 'localhost'; |
|
| 781 | + } |
|
| 736 | 782 | if (isset($db['default_user'])) |
| 737 | 783 | { |
| 738 | 784 | $incontext['db']['user'] = ini_get($db['default_user']); |
| 739 | 785 | $incontext['db']['name'] = ini_get($db['default_user']); |
| 740 | 786 | } |
| 741 | - if (isset($db['default_password'])) |
|
| 742 | - $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 787 | + if (isset($db['default_password'])) { |
|
| 788 | + $incontext['db']['pass'] = ini_get($db['default_password']); |
|
| 789 | + } |
|
| 743 | 790 | |
| 744 | 791 | // For simplicity and less confusion, leave the port blank by default |
| 745 | 792 | $incontext['db']['port'] = ''; |
@@ -758,10 +805,10 @@ discard block |
||
| 758 | 805 | $incontext['db']['server'] = $_POST['db_server']; |
| 759 | 806 | $incontext['db']['prefix'] = $_POST['db_prefix']; |
| 760 | 807 | |
| 761 | - if (!empty($_POST['db_port'])) |
|
| 762 | - $incontext['db']['port'] = $_POST['db_port']; |
|
| 763 | - } |
|
| 764 | - else |
|
| 808 | + if (!empty($_POST['db_port'])) { |
|
| 809 | + $incontext['db']['port'] = $_POST['db_port']; |
|
| 810 | + } |
|
| 811 | + } else |
|
| 765 | 812 | { |
| 766 | 813 | $incontext['db']['prefix'] = 'smf_'; |
| 767 | 814 | } |
@@ -797,10 +844,11 @@ discard block |
||
| 797 | 844 | if (!empty($_POST['db_port'])) |
| 798 | 845 | { |
| 799 | 846 | // For MySQL, we can get the "default port" from PHP. PostgreSQL has no such option though. |
| 800 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) |
|
| 801 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 802 | - elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) |
|
| 803 | - $vars['db_port'] = (int) $_POST['db_port']; |
|
| 847 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && $_POST['db_port'] != ini_get($db_type . '.default_port')) { |
|
| 848 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 849 | + } elseif ($db_type == 'postgresql' && $_POST['db_port'] != 5432) { |
|
| 850 | + $vars['db_port'] = (int) $_POST['db_port']; |
|
| 851 | + } |
|
| 804 | 852 | } |
| 805 | 853 | |
| 806 | 854 | // God I hope it saved! |
@@ -813,8 +861,9 @@ discard block |
||
| 813 | 861 | // Make sure it works. |
| 814 | 862 | require(dirname(__FILE__) . '/Settings.php'); |
| 815 | 863 | |
| 816 | - if (empty($sourcedir)) |
|
| 817 | - $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 864 | + if (empty($sourcedir)) { |
|
| 865 | + $sourcedir = dirname(__FILE__) . '/Sources'; |
|
| 866 | + } |
|
| 818 | 867 | |
| 819 | 868 | // Better find the database file! |
| 820 | 869 | if (!file_exists($sourcedir . '/Subs-Db-' . $db_type . '.php')) |
@@ -824,18 +873,21 @@ discard block |
||
| 824 | 873 | } |
| 825 | 874 | |
| 826 | 875 | // Now include it for database functions! |
| 827 | - if (!defined('SMF')) |
|
| 828 | - define('SMF', 1); |
|
| 876 | + if (!defined('SMF')) { |
|
| 877 | + define('SMF', 1); |
|
| 878 | + } |
|
| 829 | 879 | |
| 830 | 880 | $modSettings['disableQueryCheck'] = true; |
| 831 | - if (empty($smcFunc)) |
|
| 832 | - $smcFunc = array(); |
|
| 881 | + if (empty($smcFunc)) { |
|
| 882 | + $smcFunc = array(); |
|
| 883 | + } |
|
| 833 | 884 | |
| 834 | 885 | require_once($sourcedir . '/Subs-Db-' . $db_type . '.php'); |
| 835 | 886 | |
| 836 | 887 | // What - running PHP4? The shame! |
| 837 | - if (version_compare(PHP_VERSION, '5', '<')) |
|
| 838 | - require_once($sourcedir . '/Subs-Compat.php'); |
|
| 888 | + if (version_compare(PHP_VERSION, '5', '<')) { |
|
| 889 | + require_once($sourcedir . '/Subs-Compat.php'); |
|
| 890 | + } |
|
| 839 | 891 | |
| 840 | 892 | // Attempt a connection. |
| 841 | 893 | $needsDB = !empty($databases[$db_type]['always_has_db']); |
@@ -923,12 +975,14 @@ discard block |
||
| 923 | 975 | $incontext['page_title'] = $txt['install_settings']; |
| 924 | 976 | |
| 925 | 977 | // Let's see if we got the database type correct. |
| 926 | - if (isset($_POST['db_type'], $databases[$_POST['db_type']])) |
|
| 927 | - $db_type = $_POST['db_type']; |
|
| 978 | + if (isset($_POST['db_type'], $databases[$_POST['db_type']])) { |
|
| 979 | + $db_type = $_POST['db_type']; |
|
| 980 | + } |
|
| 928 | 981 | |
| 929 | 982 | // Else we'd better be able to get the connection. |
| 930 | - else |
|
| 931 | - load_database(); |
|
| 983 | + else { |
|
| 984 | + load_database(); |
|
| 985 | + } |
|
| 932 | 986 | |
| 933 | 987 | $db_type = isset($_POST['db_type']) ? $_POST['db_type'] : $db_type; |
| 934 | 988 | |
@@ -948,12 +1002,14 @@ discard block |
||
| 948 | 1002 | // Submitting? |
| 949 | 1003 | if (isset($_POST['boardurl'])) |
| 950 | 1004 | { |
| 951 | - if (substr($_POST['boardurl'], -10) == '/index.php') |
|
| 952 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 953 | - elseif (substr($_POST['boardurl'], -1) == '/') |
|
| 954 | - $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 955 | - if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') |
|
| 956 | - $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1005 | + if (substr($_POST['boardurl'], -10) == '/index.php') { |
|
| 1006 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10); |
|
| 1007 | + } elseif (substr($_POST['boardurl'], -1) == '/') { |
|
| 1008 | + $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1); |
|
| 1009 | + } |
|
| 1010 | + if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') { |
|
| 1011 | + $_POST['boardurl'] = 'http://' . $_POST['boardurl']; |
|
| 1012 | + } |
|
| 957 | 1013 | |
| 958 | 1014 | // Save these variables. |
| 959 | 1015 | $vars = array( |
@@ -984,10 +1040,10 @@ discard block |
||
| 984 | 1040 | { |
| 985 | 1041 | $incontext['error'] = sprintf($txt['error_utf8_version'], $databases[$db_type]['utf8_version']); |
| 986 | 1042 | return false; |
| 987 | - } |
|
| 988 | - else |
|
| 989 | - // Set the character set here. |
|
| 1043 | + } else { |
|
| 1044 | + // Set the character set here. |
|
| 990 | 1045 | updateSettingsFile(array('db_character_set' => 'utf8')); |
| 1046 | + } |
|
| 991 | 1047 | } |
| 992 | 1048 | |
| 993 | 1049 | // Good, skip on. |
@@ -1007,8 +1063,9 @@ discard block |
||
| 1007 | 1063 | $incontext['continue'] = 1; |
| 1008 | 1064 | |
| 1009 | 1065 | // Already done? |
| 1010 | - if (isset($_POST['pop_done'])) |
|
| 1011 | - return true; |
|
| 1066 | + if (isset($_POST['pop_done'])) { |
|
| 1067 | + return true; |
|
| 1068 | + } |
|
| 1012 | 1069 | |
| 1013 | 1070 | // Reload settings. |
| 1014 | 1071 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1026,8 +1083,9 @@ discard block |
||
| 1026 | 1083 | $modSettings = array(); |
| 1027 | 1084 | if ($result !== false) |
| 1028 | 1085 | { |
| 1029 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1030 | - $modSettings[$row['variable']] = $row['value']; |
|
| 1086 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1087 | + $modSettings[$row['variable']] = $row['value']; |
|
| 1088 | + } |
|
| 1031 | 1089 | $smcFunc['db_free_result']($result); |
| 1032 | 1090 | |
| 1033 | 1091 | // Do they match? If so, this is just a refresh so charge on! |
@@ -1040,20 +1098,22 @@ discard block |
||
| 1040 | 1098 | $modSettings['disableQueryCheck'] = true; |
| 1041 | 1099 | |
| 1042 | 1100 | // If doing UTF8, select it. PostgreSQL requires passing it as a string... |
| 1043 | - if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) |
|
| 1044 | - $smcFunc['db_query']('', ' |
|
| 1101 | + if (!empty($db_character_set) && $db_character_set == 'utf8' && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1102 | + $smcFunc['db_query']('', ' |
|
| 1045 | 1103 | SET NAMES {string:utf8}', |
| 1046 | 1104 | array( |
| 1047 | 1105 | 'db_error_skip' => true, |
| 1048 | 1106 | 'utf8' => 'utf8', |
| 1049 | 1107 | ) |
| 1050 | 1108 | ); |
| 1109 | + } |
|
| 1051 | 1110 | |
| 1052 | 1111 | // Windows likes to leave the trailing slash, which yields to C:\path\to\SMF\/attachments... |
| 1053 | - if (substr(__DIR__, -1) == '\\') |
|
| 1054 | - $attachdir = __DIR__ . 'attachments'; |
|
| 1055 | - else |
|
| 1056 | - $attachdir = __DIR__ . '/attachments'; |
|
| 1112 | + if (substr(__DIR__, -1) == '\\') { |
|
| 1113 | + $attachdir = __DIR__ . 'attachments'; |
|
| 1114 | + } else { |
|
| 1115 | + $attachdir = __DIR__ . '/attachments'; |
|
| 1116 | + } |
|
| 1057 | 1117 | |
| 1058 | 1118 | $replaces = array( |
| 1059 | 1119 | '{$db_prefix}' => $db_prefix, |
@@ -1070,8 +1130,9 @@ discard block |
||
| 1070 | 1130 | |
| 1071 | 1131 | foreach ($txt as $key => $value) |
| 1072 | 1132 | { |
| 1073 | - if (substr($key, 0, 8) == 'default_') |
|
| 1074 | - $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1133 | + if (substr($key, 0, 8) == 'default_') { |
|
| 1134 | + $replaces['{$' . $key . '}'] = $smcFunc['db_escape_string']($value); |
|
| 1135 | + } |
|
| 1075 | 1136 | } |
| 1076 | 1137 | $replaces['{$default_reserved_names}'] = strtr($replaces['{$default_reserved_names}'], array('\\\\n' => '\\n')); |
| 1077 | 1138 | |
@@ -1086,8 +1147,9 @@ discard block |
||
| 1086 | 1147 | |
| 1087 | 1148 | while ($row = $smcFunc['db_fetch_assoc']($get_engines)) |
| 1088 | 1149 | { |
| 1089 | - if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') |
|
| 1090 | - $engines[] = $row['Engine']; |
|
| 1150 | + if ($row['Support'] == 'YES' || $row['Support'] == 'DEFAULT') { |
|
| 1151 | + $engines[] = $row['Engine']; |
|
| 1152 | + } |
|
| 1091 | 1153 | } |
| 1092 | 1154 | |
| 1093 | 1155 | // Done with this now |
@@ -1111,8 +1173,7 @@ discard block |
||
| 1111 | 1173 | $replaces['START TRANSACTION;'] = ''; |
| 1112 | 1174 | $replaces['COMMIT;'] = ''; |
| 1113 | 1175 | } |
| 1114 | - } |
|
| 1115 | - else |
|
| 1176 | + } else |
|
| 1116 | 1177 | { |
| 1117 | 1178 | $has_innodb = false; |
| 1118 | 1179 | } |
@@ -1134,21 +1195,24 @@ discard block |
||
| 1134 | 1195 | foreach ($sql_lines as $count => $line) |
| 1135 | 1196 | { |
| 1136 | 1197 | // No comments allowed! |
| 1137 | - if (substr(trim($line), 0, 1) != '#') |
|
| 1138 | - $current_statement .= "\n" . rtrim($line); |
|
| 1198 | + if (substr(trim($line), 0, 1) != '#') { |
|
| 1199 | + $current_statement .= "\n" . rtrim($line); |
|
| 1200 | + } |
|
| 1139 | 1201 | |
| 1140 | 1202 | // Is this the end of the query string? |
| 1141 | - if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) |
|
| 1142 | - continue; |
|
| 1203 | + if (empty($current_statement) || (preg_match('~;[\s]*$~s', $line) == 0 && $count != count($sql_lines))) { |
|
| 1204 | + continue; |
|
| 1205 | + } |
|
| 1143 | 1206 | |
| 1144 | 1207 | // Does this table already exist? If so, don't insert more data into it! |
| 1145 | 1208 | if (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) != 0 && in_array($match[1], $exists)) |
| 1146 | 1209 | { |
| 1147 | 1210 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1148 | - if (!empty($matches[0])) |
|
| 1149 | - $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1150 | - else |
|
| 1151 | - $incontext['sql_results']['insert_dups']++; |
|
| 1211 | + if (!empty($matches[0])) { |
|
| 1212 | + $incontext['sql_results']['insert_dups'] += count($matches[0]); |
|
| 1213 | + } else { |
|
| 1214 | + $incontext['sql_results']['insert_dups']++; |
|
| 1215 | + } |
|
| 1152 | 1216 | |
| 1153 | 1217 | $current_statement = ''; |
| 1154 | 1218 | continue; |
@@ -1157,8 +1221,9 @@ discard block |
||
| 1157 | 1221 | if ($smcFunc['db_query']('', $current_statement, array('security_override' => true, 'db_error_skip' => true), $db_connection) === false) |
| 1158 | 1222 | { |
| 1159 | 1223 | // Use the appropriate function based on the DB type |
| 1160 | - if ($db_type == 'mysql' || $db_type =='mysqli') |
|
| 1161 | - $db_errorno = $db_type . '_errno'; |
|
| 1224 | + if ($db_type == 'mysql' || $db_type =='mysqli') { |
|
| 1225 | + $db_errorno = $db_type . '_errno'; |
|
| 1226 | + } |
|
| 1162 | 1227 | |
| 1163 | 1228 | // Error 1050: Table already exists! |
| 1164 | 1229 | // @todo Needs to be made better! |
@@ -1173,18 +1238,18 @@ discard block |
||
| 1173 | 1238 | // MySQLi requires a connection object. It's optional with MySQL and Postgres |
| 1174 | 1239 | $incontext['failures'][$count] = $smcFunc['db_error']($db_connection); |
| 1175 | 1240 | } |
| 1176 | - } |
|
| 1177 | - else |
|
| 1241 | + } else |
|
| 1178 | 1242 | { |
| 1179 | - if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1180 | - $incontext['sql_results']['tables']++; |
|
| 1181 | - elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1243 | + if (preg_match('~^\s*CREATE TABLE ([^\s\n\r]+?)~', $current_statement, $match) == 1) { |
|
| 1244 | + $incontext['sql_results']['tables']++; |
|
| 1245 | + } elseif (preg_match('~^\s*INSERT INTO ([^\s\n\r]+?)~', $current_statement, $match) == 1) |
|
| 1182 | 1246 | { |
| 1183 | 1247 | preg_match_all('~\)[,;]~', $current_statement, $matches); |
| 1184 | - if (!empty($matches[0])) |
|
| 1185 | - $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1186 | - else |
|
| 1187 | - $incontext['sql_results']['inserts']++; |
|
| 1248 | + if (!empty($matches[0])) { |
|
| 1249 | + $incontext['sql_results']['inserts'] += count($matches[0]); |
|
| 1250 | + } else { |
|
| 1251 | + $incontext['sql_results']['inserts']++; |
|
| 1252 | + } |
|
| 1188 | 1253 | } |
| 1189 | 1254 | } |
| 1190 | 1255 | |
@@ -1197,15 +1262,17 @@ discard block |
||
| 1197 | 1262 | // Sort out the context for the SQL. |
| 1198 | 1263 | foreach ($incontext['sql_results'] as $key => $number) |
| 1199 | 1264 | { |
| 1200 | - if ($number == 0) |
|
| 1201 | - unset($incontext['sql_results'][$key]); |
|
| 1202 | - else |
|
| 1203 | - $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1265 | + if ($number == 0) { |
|
| 1266 | + unset($incontext['sql_results'][$key]); |
|
| 1267 | + } else { |
|
| 1268 | + $incontext['sql_results'][$key] = sprintf($txt['db_populate_' . $key], $number); |
|
| 1269 | + } |
|
| 1204 | 1270 | } |
| 1205 | 1271 | |
| 1206 | 1272 | // Make sure UTF will be used globally. |
| 1207 | - 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']))) |
|
| 1208 | - $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1273 | + 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']))) { |
|
| 1274 | + $newSettings[] = array('global_character_set', 'UTF-8'); |
|
| 1275 | + } |
|
| 1209 | 1276 | |
| 1210 | 1277 | // Maybe we can auto-detect better cookie settings? |
| 1211 | 1278 | preg_match('~^http[s]?://([^\.]+?)([^/]*?)(/.*)?$~', $boardurl, $matches); |
@@ -1216,16 +1283,20 @@ discard block |
||
| 1216 | 1283 | $globalCookies = false; |
| 1217 | 1284 | |
| 1218 | 1285 | // Okay... let's see. Using a subdomain other than www.? (not a perfect check.) |
| 1219 | - if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) |
|
| 1220 | - $globalCookies = true; |
|
| 1286 | + if ($matches[2] != '' && (strpos(substr($matches[2], 1), '.') === false || in_array($matches[1], array('forum', 'board', 'community', 'forums', 'support', 'chat', 'help', 'talk', 'boards', 'www')))) { |
|
| 1287 | + $globalCookies = true; |
|
| 1288 | + } |
|
| 1221 | 1289 | // If there's a / in the middle of the path, or it starts with ~... we want local. |
| 1222 | - if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) |
|
| 1223 | - $localCookies = true; |
|
| 1290 | + if (isset($matches[3]) && strlen($matches[3]) > 3 && (substr($matches[3], 0, 2) == '/~' || strpos(substr($matches[3], 1), '/') !== false)) { |
|
| 1291 | + $localCookies = true; |
|
| 1292 | + } |
|
| 1224 | 1293 | |
| 1225 | - if ($globalCookies) |
|
| 1226 | - $newSettings[] = array('globalCookies', '1'); |
|
| 1227 | - if ($localCookies) |
|
| 1228 | - $newSettings[] = array('localCookies', '1'); |
|
| 1294 | + if ($globalCookies) { |
|
| 1295 | + $newSettings[] = array('globalCookies', '1'); |
|
| 1296 | + } |
|
| 1297 | + if ($localCookies) { |
|
| 1298 | + $newSettings[] = array('localCookies', '1'); |
|
| 1299 | + } |
|
| 1229 | 1300 | } |
| 1230 | 1301 | |
| 1231 | 1302 | // Are we allowing stat collection? |
@@ -1241,32 +1312,36 @@ discard block |
||
| 1241 | 1312 | fwrite($fp, $out); |
| 1242 | 1313 | |
| 1243 | 1314 | $return_data = ''; |
| 1244 | - while (!feof($fp)) |
|
| 1245 | - $return_data .= fgets($fp, 128); |
|
| 1315 | + while (!feof($fp)) { |
|
| 1316 | + $return_data .= fgets($fp, 128); |
|
| 1317 | + } |
|
| 1246 | 1318 | |
| 1247 | 1319 | fclose($fp); |
| 1248 | 1320 | |
| 1249 | 1321 | // Get the unique site ID. |
| 1250 | 1322 | preg_match('~SITE-ID:\s(\w{10})~', $return_data, $ID); |
| 1251 | 1323 | |
| 1252 | - if (!empty($ID[1])) |
|
| 1253 | - $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
| 1324 | + if (!empty($ID[1])) { |
|
| 1325 | + $newSettings[] = array('allow_sm_stats', $ID[1]); |
|
| 1326 | + } |
|
| 1254 | 1327 | } |
| 1255 | 1328 | } |
| 1256 | 1329 | |
| 1257 | 1330 | // Are we enabling SSL? |
| 1258 | - if (!empty($_POST['force_ssl'])) |
|
| 1259 | - $newSettings[] = array('force_ssl', 2); |
|
| 1331 | + if (!empty($_POST['force_ssl'])) { |
|
| 1332 | + $newSettings[] = array('force_ssl', 2); |
|
| 1333 | + } |
|
| 1260 | 1334 | |
| 1261 | 1335 | // Setting a timezone is required. |
| 1262 | 1336 | if (!isset($modSettings['default_timezone']) && function_exists('date_default_timezone_set')) |
| 1263 | 1337 | { |
| 1264 | 1338 | // Get PHP's default timezone, if set |
| 1265 | 1339 | $ini_tz = ini_get('date.timezone'); |
| 1266 | - if (!empty($ini_tz)) |
|
| 1267 | - $timezone_id = $ini_tz; |
|
| 1268 | - else |
|
| 1269 | - $timezone_id = ''; |
|
| 1340 | + if (!empty($ini_tz)) { |
|
| 1341 | + $timezone_id = $ini_tz; |
|
| 1342 | + } else { |
|
| 1343 | + $timezone_id = ''; |
|
| 1344 | + } |
|
| 1270 | 1345 | |
| 1271 | 1346 | // If date.timezone is unset, invalid, or just plain weird, make a best guess |
| 1272 | 1347 | if (!in_array($timezone_id, timezone_identifiers_list())) |
@@ -1275,8 +1350,9 @@ discard block |
||
| 1275 | 1350 | $timezone_id = timezone_name_from_abbr('', $server_offset, 0); |
| 1276 | 1351 | } |
| 1277 | 1352 | |
| 1278 | - if (date_default_timezone_set($timezone_id)) |
|
| 1279 | - $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1353 | + if (date_default_timezone_set($timezone_id)) { |
|
| 1354 | + $newSettings[] = array('default_timezone', $timezone_id); |
|
| 1355 | + } |
|
| 1280 | 1356 | } |
| 1281 | 1357 | |
| 1282 | 1358 | if (!empty($newSettings)) |
@@ -1307,16 +1383,18 @@ discard block |
||
| 1307 | 1383 | } |
| 1308 | 1384 | |
| 1309 | 1385 | // MySQL specific stuff |
| 1310 | - if (substr($db_type, 0, 5) != 'mysql') |
|
| 1311 | - return false; |
|
| 1386 | + if (substr($db_type, 0, 5) != 'mysql') { |
|
| 1387 | + return false; |
|
| 1388 | + } |
|
| 1312 | 1389 | |
| 1313 | 1390 | // Find database user privileges. |
| 1314 | 1391 | $privs = array(); |
| 1315 | 1392 | $get_privs = $smcFunc['db_query']('', 'SHOW PRIVILEGES', array()); |
| 1316 | 1393 | while ($row = $smcFunc['db_fetch_assoc']($get_privs)) |
| 1317 | 1394 | { |
| 1318 | - if ($row['Privilege'] == 'Alter') |
|
| 1319 | - $privs[] = $row['Privilege']; |
|
| 1395 | + if ($row['Privilege'] == 'Alter') { |
|
| 1396 | + $privs[] = $row['Privilege']; |
|
| 1397 | + } |
|
| 1320 | 1398 | } |
| 1321 | 1399 | $smcFunc['db_free_result']($get_privs); |
| 1322 | 1400 | |
@@ -1346,8 +1424,9 @@ discard block |
||
| 1346 | 1424 | $incontext['continue'] = 1; |
| 1347 | 1425 | |
| 1348 | 1426 | // Skipping? |
| 1349 | - if (!empty($_POST['skip'])) |
|
| 1350 | - return true; |
|
| 1427 | + if (!empty($_POST['skip'])) { |
|
| 1428 | + return true; |
|
| 1429 | + } |
|
| 1351 | 1430 | |
| 1352 | 1431 | // Need this to check whether we need the database password. |
| 1353 | 1432 | require(dirname(__FILE__) . '/Settings.php'); |
@@ -1361,18 +1440,22 @@ discard block |
||
| 1361 | 1440 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
| 1362 | 1441 | function($string){ |
| 1363 | 1442 | global $sourcedir; |
| 1364 | - if (function_exists('mb_strtolower')) |
|
| 1365 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1443 | + if (function_exists('mb_strtolower')) { |
|
| 1444 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1445 | + } |
|
| 1366 | 1446 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1367 | 1447 | return utf8_strtolower($string); |
| 1368 | 1448 | }; |
| 1369 | 1449 | |
| 1370 | - if (!isset($_POST['username'])) |
|
| 1371 | - $_POST['username'] = ''; |
|
| 1372 | - if (!isset($_POST['email'])) |
|
| 1373 | - $_POST['email'] = ''; |
|
| 1374 | - if (!isset($_POST['server_email'])) |
|
| 1375 | - $_POST['server_email'] = ''; |
|
| 1450 | + if (!isset($_POST['username'])) { |
|
| 1451 | + $_POST['username'] = ''; |
|
| 1452 | + } |
|
| 1453 | + if (!isset($_POST['email'])) { |
|
| 1454 | + $_POST['email'] = ''; |
|
| 1455 | + } |
|
| 1456 | + if (!isset($_POST['server_email'])) { |
|
| 1457 | + $_POST['server_email'] = ''; |
|
| 1458 | + } |
|
| 1376 | 1459 | |
| 1377 | 1460 | $incontext['username'] = htmlspecialchars(stripslashes($_POST['username'])); |
| 1378 | 1461 | $incontext['email'] = htmlspecialchars(stripslashes($_POST['email'])); |
@@ -1391,8 +1474,9 @@ discard block |
||
| 1391 | 1474 | 'admin_group' => 1, |
| 1392 | 1475 | ) |
| 1393 | 1476 | ); |
| 1394 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1395 | - $incontext['skip'] = 1; |
|
| 1477 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1478 | + $incontext['skip'] = 1; |
|
| 1479 | + } |
|
| 1396 | 1480 | $smcFunc['db_free_result']($request); |
| 1397 | 1481 | |
| 1398 | 1482 | // Trying to create an account? |
@@ -1423,8 +1507,9 @@ discard block |
||
| 1423 | 1507 | } |
| 1424 | 1508 | |
| 1425 | 1509 | // Update the webmaster's email? |
| 1426 | - if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) |
|
| 1427 | - updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1510 | + if (!empty($_POST['server_email']) && (empty($webmaster_email) || $webmaster_email == '[email protected]')) { |
|
| 1511 | + updateSettingsFile(array('webmaster_email' => $_POST['server_email'])); |
|
| 1512 | + } |
|
| 1428 | 1513 | |
| 1429 | 1514 | // Work out whether we're going to have dodgy characters and remove them. |
| 1430 | 1515 | $invalid_characters = preg_match('~[<>&"\'=\\\]~', $_POST['username']) != 0; |
@@ -1447,32 +1532,27 @@ discard block |
||
| 1447 | 1532 | $smcFunc['db_free_result']($result); |
| 1448 | 1533 | |
| 1449 | 1534 | $incontext['account_existed'] = $txt['error_user_settings_taken']; |
| 1450 | - } |
|
| 1451 | - elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1535 | + } elseif ($_POST['username'] == '' || strlen($_POST['username']) > 25) |
|
| 1452 | 1536 | { |
| 1453 | 1537 | // Try the previous step again. |
| 1454 | 1538 | $incontext['error'] = $_POST['username'] == '' ? $txt['error_username_left_empty'] : $txt['error_username_too_long']; |
| 1455 | 1539 | return false; |
| 1456 | - } |
|
| 1457 | - elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1540 | + } elseif ($invalid_characters || $_POST['username'] == '_' || $_POST['username'] == '|' || strpos($_POST['username'], '[code') !== false || strpos($_POST['username'], '[/code') !== false) |
|
| 1458 | 1541 | { |
| 1459 | 1542 | // Try the previous step again. |
| 1460 | 1543 | $incontext['error'] = $txt['error_invalid_characters_username']; |
| 1461 | 1544 | return false; |
| 1462 | - } |
|
| 1463 | - elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1545 | + } elseif (empty($_POST['email']) || !filter_var(stripslashes($_POST['email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['email'])) > 255) |
|
| 1464 | 1546 | { |
| 1465 | 1547 | // One step back, this time fill out a proper admin email address. |
| 1466 | 1548 | $incontext['error'] = sprintf($txt['error_valid_admin_email_needed'], $_POST['username']); |
| 1467 | 1549 | return false; |
| 1468 | - } |
|
| 1469 | - elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1550 | + } elseif (empty($_POST['server_email']) || !filter_var(stripslashes($_POST['server_email']), FILTER_VALIDATE_EMAIL) || strlen(stripslashes($_POST['server_email'])) > 255) |
|
| 1470 | 1551 | { |
| 1471 | 1552 | // One step back, this time fill out a proper admin email address. |
| 1472 | 1553 | $incontext['error'] = $txt['error_valid_server_email_needed']; |
| 1473 | 1554 | return false; |
| 1474 | - } |
|
| 1475 | - elseif ($_POST['username'] != '') |
|
| 1555 | + } elseif ($_POST['username'] != '') |
|
| 1476 | 1556 | { |
| 1477 | 1557 | $incontext['member_salt'] = substr(md5(mt_rand()), 0, 4); |
| 1478 | 1558 | |
@@ -1547,17 +1627,19 @@ discard block |
||
| 1547 | 1627 | require_once($sourcedir . '/Subs-Auth.php'); |
| 1548 | 1628 | |
| 1549 | 1629 | // Bring a warning over. |
| 1550 | - if (!empty($incontext['account_existed'])) |
|
| 1551 | - $incontext['warning'] = $incontext['account_existed']; |
|
| 1630 | + if (!empty($incontext['account_existed'])) { |
|
| 1631 | + $incontext['warning'] = $incontext['account_existed']; |
|
| 1632 | + } |
|
| 1552 | 1633 | |
| 1553 | - if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) |
|
| 1554 | - $smcFunc['db_query']('', ' |
|
| 1634 | + if (!empty($db_character_set) && !empty($databases[$db_type]['utf8_support'])) { |
|
| 1635 | + $smcFunc['db_query']('', ' |
|
| 1555 | 1636 | SET NAMES {string:db_character_set}', |
| 1556 | 1637 | array( |
| 1557 | 1638 | 'db_character_set' => $db_character_set, |
| 1558 | 1639 | 'db_error_skip' => true, |
| 1559 | 1640 | ) |
| 1560 | 1641 | ); |
| 1642 | + } |
|
| 1561 | 1643 | |
| 1562 | 1644 | // As track stats is by default enabled let's add some activity. |
| 1563 | 1645 | $smcFunc['db_insert']('ignore', |
@@ -1578,14 +1660,16 @@ discard block |
||
| 1578 | 1660 | // Only proceed if we can load the data. |
| 1579 | 1661 | if ($request) |
| 1580 | 1662 | { |
| 1581 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 1582 | - $modSettings[$row[0]] = $row[1]; |
|
| 1663 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 1664 | + $modSettings[$row[0]] = $row[1]; |
|
| 1665 | + } |
|
| 1583 | 1666 | $smcFunc['db_free_result']($request); |
| 1584 | 1667 | } |
| 1585 | 1668 | |
| 1586 | 1669 | // Automatically log them in ;) |
| 1587 | - if (isset($incontext['member_id']) && isset($incontext['member_salt'])) |
|
| 1588 | - setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1670 | + if (isset($incontext['member_id']) && isset($incontext['member_salt'])) { |
|
| 1671 | + setLoginCookie(3153600 * 60, $incontext['member_id'], hash_salt($_POST['password1'], $incontext['member_salt'])); |
|
| 1672 | + } |
|
| 1589 | 1673 | |
| 1590 | 1674 | $result = $smcFunc['db_query']('', ' |
| 1591 | 1675 | SELECT value |
@@ -1596,13 +1680,14 @@ discard block |
||
| 1596 | 1680 | 'db_error_skip' => true, |
| 1597 | 1681 | ) |
| 1598 | 1682 | ); |
| 1599 | - if ($smcFunc['db_num_rows']($result) != 0) |
|
| 1600 | - list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1683 | + if ($smcFunc['db_num_rows']($result) != 0) { |
|
| 1684 | + list ($db_sessions) = $smcFunc['db_fetch_row']($result); |
|
| 1685 | + } |
|
| 1601 | 1686 | $smcFunc['db_free_result']($result); |
| 1602 | 1687 | |
| 1603 | - if (empty($db_sessions)) |
|
| 1604 | - $_SESSION['admin_time'] = time(); |
|
| 1605 | - else |
|
| 1688 | + if (empty($db_sessions)) { |
|
| 1689 | + $_SESSION['admin_time'] = time(); |
|
| 1690 | + } else |
|
| 1606 | 1691 | { |
| 1607 | 1692 | $_SERVER['HTTP_USER_AGENT'] = substr($_SERVER['HTTP_USER_AGENT'], 0, 211); |
| 1608 | 1693 | |
@@ -1626,8 +1711,9 @@ discard block |
||
| 1626 | 1711 | $smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : |
| 1627 | 1712 | function($string){ |
| 1628 | 1713 | global $sourcedir; |
| 1629 | - if (function_exists('mb_strtolower')) |
|
| 1630 | - return mb_strtolower($string, 'UTF-8'); |
|
| 1714 | + if (function_exists('mb_strtolower')) { |
|
| 1715 | + return mb_strtolower($string, 'UTF-8'); |
|
| 1716 | + } |
|
| 1631 | 1717 | require_once($sourcedir . '/Subs-Charset.php'); |
| 1632 | 1718 | return utf8_strtolower($string); |
| 1633 | 1719 | }; |
@@ -1643,8 +1729,9 @@ discard block |
||
| 1643 | 1729 | ) |
| 1644 | 1730 | ); |
| 1645 | 1731 | $context['utf8'] = $db_character_set === 'utf8' || $txt['lang_character_set'] === 'UTF-8'; |
| 1646 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 1647 | - updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1732 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 1733 | + updateStats('subject', 1, htmlspecialchars($txt['default_topic_subject'])); |
|
| 1734 | + } |
|
| 1648 | 1735 | $smcFunc['db_free_result']($request); |
| 1649 | 1736 | |
| 1650 | 1737 | // Now is the perfect time to fetch the SM files. |
@@ -1663,8 +1750,9 @@ discard block |
||
| 1663 | 1750 | |
| 1664 | 1751 | // Check if we need some stupid MySQL fix. |
| 1665 | 1752 | $server_version = $smcFunc['db_server_info'](); |
| 1666 | - if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) |
|
| 1667 | - updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1753 | + if (($db_type == 'mysql' || $db_type == 'mysqli') && in_array(substr($server_version, 0, 6), array('5.0.50', '5.0.51'))) { |
|
| 1754 | + updateSettings(array('db_mysql_group_by_fix' => '1')); |
|
| 1755 | + } |
|
| 1668 | 1756 | |
| 1669 | 1757 | // Some final context for the template. |
| 1670 | 1758 | $incontext['dir_still_writable'] = is_writable(dirname(__FILE__)) && substr(__FILE__, 1, 2) != ':\\'; |
@@ -1684,8 +1772,9 @@ discard block |
||
| 1684 | 1772 | $settingsArray = file(dirname(__FILE__) . '/Settings.php'); |
| 1685 | 1773 | |
| 1686 | 1774 | // @todo Do we just want to read the file in clean, and split it this way always? |
| 1687 | - if (count($settingsArray) == 1) |
|
| 1688 | - $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1775 | + if (count($settingsArray) == 1) { |
|
| 1776 | + $settingsArray = preg_split('~[\r\n]~', $settingsArray[0]); |
|
| 1777 | + } |
|
| 1689 | 1778 | |
| 1690 | 1779 | for ($i = 0, $n = count($settingsArray); $i < $n; $i++) |
| 1691 | 1780 | { |
@@ -1700,19 +1789,22 @@ discard block |
||
| 1700 | 1789 | continue; |
| 1701 | 1790 | } |
| 1702 | 1791 | |
| 1703 | - if (trim($settingsArray[$i]) == '?' . '>') |
|
| 1704 | - $settingsArray[$i] = ''; |
|
| 1792 | + if (trim($settingsArray[$i]) == '?' . '>') { |
|
| 1793 | + $settingsArray[$i] = ''; |
|
| 1794 | + } |
|
| 1705 | 1795 | |
| 1706 | 1796 | // Don't trim or bother with it if it's not a variable. |
| 1707 | - if (substr($settingsArray[$i], 0, 1) != '$') |
|
| 1708 | - continue; |
|
| 1797 | + if (substr($settingsArray[$i], 0, 1) != '$') { |
|
| 1798 | + continue; |
|
| 1799 | + } |
|
| 1709 | 1800 | |
| 1710 | 1801 | $settingsArray[$i] = rtrim($settingsArray[$i]) . "\n"; |
| 1711 | 1802 | |
| 1712 | - foreach ($vars as $var => $val) |
|
| 1713 | - if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1803 | + foreach ($vars as $var => $val) { |
|
| 1804 | + if (strncasecmp($settingsArray[$i], '$' . $var, 1 + strlen($var)) == 0) |
|
| 1714 | 1805 | { |
| 1715 | 1806 | $comment = strstr($settingsArray[$i], '#'); |
| 1807 | + } |
|
| 1716 | 1808 | $settingsArray[$i] = '$' . $var . ' = \'' . $val . '\';' . ($comment != '' ? "\t\t" . $comment : "\n"); |
| 1717 | 1809 | unset($vars[$var]); |
| 1718 | 1810 | } |
@@ -1722,36 +1814,41 @@ discard block |
||
| 1722 | 1814 | if (!empty($vars)) |
| 1723 | 1815 | { |
| 1724 | 1816 | $settingsArray[$i++] = ''; |
| 1725 | - foreach ($vars as $var => $val) |
|
| 1726 | - $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1817 | + foreach ($vars as $var => $val) { |
|
| 1818 | + $settingsArray[$i++] = '$' . $var . ' = \'' . $val . '\';' . "\n"; |
|
| 1819 | + } |
|
| 1727 | 1820 | } |
| 1728 | 1821 | |
| 1729 | 1822 | // Blank out the file - done to fix a oddity with some servers. |
| 1730 | 1823 | $fp = @fopen(dirname(__FILE__) . '/Settings.php', 'w'); |
| 1731 | - if (!$fp) |
|
| 1732 | - return false; |
|
| 1824 | + if (!$fp) { |
|
| 1825 | + return false; |
|
| 1826 | + } |
|
| 1733 | 1827 | fclose($fp); |
| 1734 | 1828 | |
| 1735 | 1829 | $fp = fopen(dirname(__FILE__) . '/Settings.php', 'r+'); |
| 1736 | 1830 | |
| 1737 | 1831 | // Gotta have one of these ;) |
| 1738 | - if (trim($settingsArray[0]) != '<?php') |
|
| 1739 | - fwrite($fp, "<?php\n"); |
|
| 1832 | + if (trim($settingsArray[0]) != '<?php') { |
|
| 1833 | + fwrite($fp, "<?php\n"); |
|
| 1834 | + } |
|
| 1740 | 1835 | |
| 1741 | 1836 | $lines = count($settingsArray); |
| 1742 | 1837 | for ($i = 0; $i < $lines - 1; $i++) |
| 1743 | 1838 | { |
| 1744 | 1839 | // Don't just write a bunch of blank lines. |
| 1745 | - if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') |
|
| 1746 | - fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1840 | + if ($settingsArray[$i] != '' || @$settingsArray[$i - 1] != '') { |
|
| 1841 | + fwrite($fp, strtr($settingsArray[$i], "\r", '')); |
|
| 1842 | + } |
|
| 1747 | 1843 | } |
| 1748 | 1844 | fwrite($fp, $settingsArray[$i] . '?' . '>'); |
| 1749 | 1845 | fclose($fp); |
| 1750 | 1846 | |
| 1751 | 1847 | // Even though on normal installations the filemtime should prevent this being used by the installer incorrectly |
| 1752 | 1848 | // it seems that there are times it might not. So let's MAKE it dump the cache. |
| 1753 | - if (function_exists('opcache_invalidate')) |
|
| 1754 | - opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1849 | + if (function_exists('opcache_invalidate')) { |
|
| 1850 | + opcache_invalidate(dirname(__FILE__) . '/Settings.php', true); |
|
| 1851 | + } |
|
| 1755 | 1852 | |
| 1756 | 1853 | return true; |
| 1757 | 1854 | } |
@@ -1776,9 +1873,9 @@ discard block |
||
| 1776 | 1873 | SecFilterScanPOST Off |
| 1777 | 1874 | </IfModule>'; |
| 1778 | 1875 | |
| 1779 | - if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) |
|
| 1780 | - return true; |
|
| 1781 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1876 | + if (!function_exists('apache_get_modules') || !in_array('mod_security', apache_get_modules())) { |
|
| 1877 | + return true; |
|
| 1878 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess') && is_writable(dirname(__FILE__) . '/.htaccess')) |
|
| 1782 | 1879 | { |
| 1783 | 1880 | $current_htaccess = implode('', file(dirname(__FILE__) . '/.htaccess')); |
| 1784 | 1881 | |
@@ -1790,29 +1887,28 @@ discard block |
||
| 1790 | 1887 | fwrite($ht_handle, $htaccess_addition); |
| 1791 | 1888 | fclose($ht_handle); |
| 1792 | 1889 | return true; |
| 1890 | + } else { |
|
| 1891 | + return false; |
|
| 1793 | 1892 | } |
| 1794 | - else |
|
| 1795 | - return false; |
|
| 1893 | + } else { |
|
| 1894 | + return true; |
|
| 1796 | 1895 | } |
| 1797 | - else |
|
| 1798 | - return true; |
|
| 1799 | - } |
|
| 1800 | - elseif (file_exists(dirname(__FILE__) . '/.htaccess')) |
|
| 1801 | - return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1802 | - elseif (is_writable(dirname(__FILE__))) |
|
| 1896 | + } elseif (file_exists(dirname(__FILE__) . '/.htaccess')) { |
|
| 1897 | + return strpos(implode('', file(dirname(__FILE__) . '/.htaccess')), '<IfModule mod_security.c>') !== false; |
|
| 1898 | + } elseif (is_writable(dirname(__FILE__))) |
|
| 1803 | 1899 | { |
| 1804 | 1900 | if ($ht_handle = fopen(dirname(__FILE__) . '/.htaccess', 'w')) |
| 1805 | 1901 | { |
| 1806 | 1902 | fwrite($ht_handle, $htaccess_addition); |
| 1807 | 1903 | fclose($ht_handle); |
| 1808 | 1904 | return true; |
| 1905 | + } else { |
|
| 1906 | + return false; |
|
| 1809 | 1907 | } |
| 1810 | - else |
|
| 1908 | + } else { |
|
| 1811 | 1909 | return false; |
| 1812 | 1910 | } |
| 1813 | - else |
|
| 1814 | - return false; |
|
| 1815 | -} |
|
| 1911 | + } |
|
| 1816 | 1912 | |
| 1817 | 1913 | function template_install_above() |
| 1818 | 1914 | { |
@@ -1850,9 +1946,10 @@ discard block |
||
| 1850 | 1946 | <label for="installer_language">', $txt['installer_language'], ':</label> |
| 1851 | 1947 | <select id="installer_language" name="lang_file" onchange="location.href = \'', $installurl, '?lang_file=\' + this.options[this.selectedIndex].value;">'; |
| 1852 | 1948 | |
| 1853 | - foreach ($incontext['detected_languages'] as $lang => $name) |
|
| 1854 | - echo ' |
|
| 1949 | + foreach ($incontext['detected_languages'] as $lang => $name) { |
|
| 1950 | + echo ' |
|
| 1855 | 1951 | <option', isset($_SESSION['installer_temp_lang']) && $_SESSION['installer_temp_lang'] == $lang ? ' selected' : '', ' value="', $lang, '">', $name, '</option>'; |
| 1952 | + } |
|
| 1856 | 1953 | |
| 1857 | 1954 | echo ' |
| 1858 | 1955 | </select> |
@@ -1872,9 +1969,10 @@ discard block |
||
| 1872 | 1969 | <h2>', $txt['upgrade_progress'], '</h2> |
| 1873 | 1970 | <ul>'; |
| 1874 | 1971 | |
| 1875 | - foreach ($incontext['steps'] as $num => $step) |
|
| 1876 | - echo ' |
|
| 1972 | + foreach ($incontext['steps'] as $num => $step) { |
|
| 1973 | + echo ' |
|
| 1877 | 1974 | <li class="', $num < $incontext['current_step'] ? 'stepdone' : ($num == $incontext['current_step'] ? 'stepcurrent' : 'stepwaiting'), '">', $txt['upgrade_step'], ' ', $step[0], ': ', $step[1], '</li>'; |
| 1975 | + } |
|
| 1878 | 1976 | |
| 1879 | 1977 | echo ' |
| 1880 | 1978 | </ul> |
@@ -1899,20 +1997,23 @@ discard block |
||
| 1899 | 1997 | echo ' |
| 1900 | 1998 | <div>'; |
| 1901 | 1999 | |
| 1902 | - if (!empty($incontext['continue'])) |
|
| 1903 | - echo ' |
|
| 2000 | + if (!empty($incontext['continue'])) { |
|
| 2001 | + echo ' |
|
| 1904 | 2002 | <input type="submit" id="contbutt" name="contbutt" value="', $txt['upgrade_continue'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
| 1905 | - if (!empty($incontext['skip'])) |
|
| 1906 | - echo ' |
|
| 2003 | + } |
|
| 2004 | + if (!empty($incontext['skip'])) { |
|
| 2005 | + echo ' |
|
| 1907 | 2006 | <input type="submit" id="skip" name="skip" value="', $txt['upgrade_skip'], '" onclick="return submitThisOnce(this);" class="button_submit" />'; |
| 2007 | + } |
|
| 1908 | 2008 | echo ' |
| 1909 | 2009 | </div>'; |
| 1910 | 2010 | } |
| 1911 | 2011 | |
| 1912 | 2012 | // Show the closing form tag and other data only if not in the last step |
| 1913 | - if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) |
|
| 1914 | - echo ' |
|
| 2013 | + if (count($incontext['steps']) - 1 !== (int) $incontext['current_step']) { |
|
| 2014 | + echo ' |
|
| 1915 | 2015 | </form>'; |
| 2016 | + } |
|
| 1916 | 2017 | |
| 1917 | 2018 | echo ' |
| 1918 | 2019 | </div> |
@@ -1947,13 +2048,15 @@ discard block |
||
| 1947 | 2048 | </div>'; |
| 1948 | 2049 | |
| 1949 | 2050 | // Show the warnings, or not. |
| 1950 | - if (template_warning_divs()) |
|
| 1951 | - echo ' |
|
| 2051 | + if (template_warning_divs()) { |
|
| 2052 | + echo ' |
|
| 1952 | 2053 | <h3>', $txt['install_all_lovely'], '</h3>'; |
| 2054 | + } |
|
| 1953 | 2055 | |
| 1954 | 2056 | // Say we want the continue button! |
| 1955 | - if (empty($incontext['error'])) |
|
| 1956 | - $incontext['continue'] = 1; |
|
| 2057 | + if (empty($incontext['error'])) { |
|
| 2058 | + $incontext['continue'] = 1; |
|
| 2059 | + } |
|
| 1957 | 2060 | |
| 1958 | 2061 | // For the latest version stuff. |
| 1959 | 2062 | echo ' |
@@ -1987,8 +2090,8 @@ discard block |
||
| 1987 | 2090 | global $txt, $incontext; |
| 1988 | 2091 | |
| 1989 | 2092 | // Errors are very serious.. |
| 1990 | - if (!empty($incontext['error'])) |
|
| 1991 | - echo ' |
|
| 2093 | + if (!empty($incontext['error'])) { |
|
| 2094 | + echo ' |
|
| 1992 | 2095 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
| 1993 | 2096 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
| 1994 | 2097 | <strong style="text-decoration: underline;">', $txt['upgrade_critical_error'], '</strong><br> |
@@ -1996,9 +2099,10 @@ discard block |
||
| 1996 | 2099 | ', $incontext['error'], ' |
| 1997 | 2100 | </div> |
| 1998 | 2101 | </div>'; |
| 2102 | + } |
|
| 1999 | 2103 | // A warning message? |
| 2000 | - elseif (!empty($incontext['warning'])) |
|
| 2001 | - echo ' |
|
| 2104 | + elseif (!empty($incontext['warning'])) { |
|
| 2105 | + echo ' |
|
| 2002 | 2106 | <div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;"> |
| 2003 | 2107 | <div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div> |
| 2004 | 2108 | <strong style="text-decoration: underline;">', $txt['upgrade_warning'], '</strong><br> |
@@ -2006,6 +2110,7 @@ discard block |
||
| 2006 | 2110 | ', $incontext['warning'], ' |
| 2007 | 2111 | </div> |
| 2008 | 2112 | </div>'; |
| 2113 | + } |
|
| 2009 | 2114 | |
| 2010 | 2115 | return empty($incontext['error']) && empty($incontext['warning']); |
| 2011 | 2116 | } |
@@ -2021,27 +2126,30 @@ discard block |
||
| 2021 | 2126 | <li>', $incontext['failed_files']), '</li> |
| 2022 | 2127 | </ul>'; |
| 2023 | 2128 | |
| 2024 | - if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') |
|
| 2025 | - echo ' |
|
| 2129 | + if (isset($incontext['systemos'], $incontext['detected_path']) && $incontext['systemos'] == 'linux') { |
|
| 2130 | + echo ' |
|
| 2026 | 2131 | <hr> |
| 2027 | 2132 | <p>', $txt['chmod_linux_info'], '</p> |
| 2028 | 2133 | <tt># chmod a+w ', implode(' ' . $incontext['detected_path'] . '/', $incontext['failed_files']), '</tt>'; |
| 2134 | + } |
|
| 2029 | 2135 | |
| 2030 | 2136 | // This is serious! |
| 2031 | - if (!template_warning_divs()) |
|
| 2032 | - return; |
|
| 2137 | + if (!template_warning_divs()) { |
|
| 2138 | + return; |
|
| 2139 | + } |
|
| 2033 | 2140 | |
| 2034 | 2141 | echo ' |
| 2035 | 2142 | <hr> |
| 2036 | 2143 | <p>', $txt['ftp_setup_info'], '</p>'; |
| 2037 | 2144 | |
| 2038 | - if (!empty($incontext['ftp_errors'])) |
|
| 2039 | - echo ' |
|
| 2145 | + if (!empty($incontext['ftp_errors'])) { |
|
| 2146 | + echo ' |
|
| 2040 | 2147 | <div class="error_message"> |
| 2041 | 2148 | ', $txt['error_ftp_no_connect'], '<br><br> |
| 2042 | 2149 | <code>', implode('<br>', $incontext['ftp_errors']), '</code> |
| 2043 | 2150 | </div> |
| 2044 | 2151 | <br>'; |
| 2152 | + } |
|
| 2045 | 2153 | |
| 2046 | 2154 | echo ' |
| 2047 | 2155 | <form action="', $incontext['form_url'], '" method="post"> |
@@ -2101,17 +2209,17 @@ discard block |
||
| 2101 | 2209 | <td> |
| 2102 | 2210 | <select name="db_type" id="db_type_input" onchange="toggleDBInput();">'; |
| 2103 | 2211 | |
| 2104 | - foreach ($incontext['supported_databases'] as $key => $db) |
|
| 2105 | - echo ' |
|
| 2212 | + foreach ($incontext['supported_databases'] as $key => $db) { |
|
| 2213 | + echo ' |
|
| 2106 | 2214 | <option value="', $key, '"', isset($_POST['db_type']) && $_POST['db_type'] == $key ? ' selected' : '', '>', $db['name'], '</option>'; |
| 2215 | + } |
|
| 2107 | 2216 | |
| 2108 | 2217 | echo ' |
| 2109 | 2218 | </select> |
| 2110 | 2219 | <div class="smalltext block">', $txt['db_settings_type_info'], '</div> |
| 2111 | 2220 | </td> |
| 2112 | 2221 | </tr>'; |
| 2113 | - } |
|
| 2114 | - else |
|
| 2222 | + } else |
|
| 2115 | 2223 | { |
| 2116 | 2224 | echo ' |
| 2117 | 2225 | <tr style="display: none;"> |
@@ -2303,9 +2411,10 @@ discard block |
||
| 2303 | 2411 | <div style="color: red;">', $txt['error_db_queries'], '</div> |
| 2304 | 2412 | <ul>'; |
| 2305 | 2413 | |
| 2306 | - foreach ($incontext['failures'] as $line => $fail) |
|
| 2307 | - echo ' |
|
| 2414 | + foreach ($incontext['failures'] as $line => $fail) { |
|
| 2415 | + echo ' |
|
| 2308 | 2416 | <li><strong>', $txt['error_db_queries_line'], $line + 1, ':</strong> ', nl2br(htmlspecialchars($fail)), '</li>'; |
| 2417 | + } |
|
| 2309 | 2418 | |
| 2310 | 2419 | echo ' |
| 2311 | 2420 | </ul>'; |
@@ -2366,15 +2475,16 @@ discard block |
||
| 2366 | 2475 | </tr> |
| 2367 | 2476 | </table>'; |
| 2368 | 2477 | |
| 2369 | - if ($incontext['require_db_confirm']) |
|
| 2370 | - echo ' |
|
| 2478 | + if ($incontext['require_db_confirm']) { |
|
| 2479 | + echo ' |
|
| 2371 | 2480 | <h2>', $txt['user_settings_database'], '</h2> |
| 2372 | 2481 | <p>', $txt['user_settings_database_info'], '</p> |
| 2373 | 2482 | |
| 2374 | 2483 | <div style="margin-bottom: 2ex; padding-', $txt['lang_rtl'] == false ? 'left' : 'right', ': 50px;"> |
| 2375 | 2484 | <input type="password" name="password3" size="30" class="input_password" /> |
| 2376 | 2485 | </div>'; |
| 2377 | -} |
|
| 2486 | + } |
|
| 2487 | + } |
|
| 2378 | 2488 | |
| 2379 | 2489 | // Tell them it's done, and to delete. |
| 2380 | 2490 | function template_delete_install() |
@@ -2387,14 +2497,15 @@ discard block |
||
| 2387 | 2497 | template_warning_divs(); |
| 2388 | 2498 | |
| 2389 | 2499 | // Install directory still writable? |
| 2390 | - if ($incontext['dir_still_writable']) |
|
| 2391 | - echo ' |
|
| 2500 | + if ($incontext['dir_still_writable']) { |
|
| 2501 | + echo ' |
|
| 2392 | 2502 | <em>', $txt['still_writable'], '</em><br> |
| 2393 | 2503 | <br>'; |
| 2504 | + } |
|
| 2394 | 2505 | |
| 2395 | 2506 | // Don't show the box if it's like 99% sure it won't work :P. |
| 2396 | - if ($incontext['probably_delete_install']) |
|
| 2397 | - echo ' |
|
| 2507 | + if ($incontext['probably_delete_install']) { |
|
| 2508 | + echo ' |
|
| 2398 | 2509 | <div style="margin: 1ex; font-weight: bold;"> |
| 2399 | 2510 | <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> |
| 2400 | 2511 | </div> |
@@ -2410,6 +2521,7 @@ discard block |
||
| 2410 | 2521 | } |
| 2411 | 2522 | </script> |
| 2412 | 2523 | <br>'; |
| 2524 | + } |
|
| 2413 | 2525 | |
| 2414 | 2526 | echo ' |
| 2415 | 2527 | ', 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> |
@@ -170,11 +177,13 @@ discard block |
||
| 170 | 177 | <li> |
| 171 | 178 | <b class="event_title"><a href="', $scripturl, '?action=calendar;event=', $event['id'], '">', $event['title'], '</a></b>'; |
| 172 | 179 | |
| 173 | - if ($event['can_edit']) |
|
| 174 | - echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 180 | + if ($event['can_edit']) { |
|
| 181 | + echo ' <a href="' . $event['modify_href'] . '"><span class="generic_icons calendar_modify" title="', $txt['calendar_edit'], '"></span></a>'; |
|
| 182 | + } |
|
| 175 | 183 | |
| 176 | - if ($event['can_export']) |
|
| 177 | - echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 184 | + if ($event['can_export']) { |
|
| 185 | + echo ' <a href="' . $event['export_href'] . '"><span class="generic_icons calendar_export" title="', $txt['calendar_export'], '"></span></a>'; |
|
| 186 | + } |
|
| 178 | 187 | |
| 179 | 188 | echo ' |
| 180 | 189 | <br>'; |
@@ -182,14 +191,14 @@ discard block |
||
| 182 | 191 | if (!empty($event['allday'])) |
| 183 | 192 | { |
| 184 | 193 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), '</time>', ($event['start_date'] != $event['end_date']) ? ' – <time datetime="' . $event['end_iso_gmdate'] . '">' . trim($event['end_date_local']) . '</time>' : ''; |
| 185 | - } |
|
| 186 | - else |
|
| 194 | + } else |
|
| 187 | 195 | { |
| 188 | 196 | // Display event info relative to user's local timezone |
| 189 | 197 | echo '<time datetime="' . $event['start_iso_gmdate'] . '">', trim($event['start_date_local']), ', ', trim($event['start_time_local']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 190 | 198 | |
| 191 | - if ($event['start_date_local'] != $event['end_date_local']) |
|
| 192 | - echo trim($event['end_date_local']) . ', '; |
|
| 199 | + if ($event['start_date_local'] != $event['end_date_local']) { |
|
| 200 | + echo trim($event['end_date_local']) . ', '; |
|
| 201 | + } |
|
| 193 | 202 | |
| 194 | 203 | echo trim($event['end_time_local']); |
| 195 | 204 | |
@@ -198,23 +207,27 @@ discard block |
||
| 198 | 207 | { |
| 199 | 208 | echo '</time> (<time datetime="' . $event['start_iso_gmdate'] . '">'; |
| 200 | 209 | |
| 201 | - if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) |
|
| 202 | - echo trim($event['start_date_orig']), ', '; |
|
| 210 | + if ($event['start_date_orig'] != $event['start_date_local'] || $event['end_date_orig'] != $event['end_date_local'] || $event['start_date_orig'] != $event['end_date_orig']) { |
|
| 211 | + echo trim($event['start_date_orig']), ', '; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | echo trim($event['start_time_orig']), '</time> – <time datetime="' . $event['end_iso_gmdate'] . '">'; |
| 205 | 215 | |
| 206 | - if ($event['start_date_orig'] != $event['end_date_orig']) |
|
| 207 | - echo trim($event['end_date_orig']) . ', '; |
|
| 216 | + if ($event['start_date_orig'] != $event['end_date_orig']) { |
|
| 217 | + echo trim($event['end_date_orig']) . ', '; |
|
| 218 | + } |
|
| 208 | 219 | |
| 209 | 220 | echo trim($event['end_time_orig']), ' ', $event['tz_abbrev'], '</time>)'; |
| 210 | 221 | } |
| 211 | 222 | // Event is scheduled in the user's own timezone? Let 'em know, just to avoid confusion |
| 212 | - else |
|
| 213 | - echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 223 | + else { |
|
| 224 | + echo ' ', $event['tz_abbrev'], '</time>'; |
|
| 225 | + } |
|
| 214 | 226 | } |
| 215 | 227 | |
| 216 | - if (!empty($event['location'])) |
|
| 217 | - echo '<br>', $event['location']; |
|
| 228 | + if (!empty($event['location'])) { |
|
| 229 | + echo '<br>', $event['location']; |
|
| 230 | + } |
|
| 218 | 231 | |
| 219 | 232 | echo ' |
| 220 | 233 | </li>'; |
@@ -252,8 +265,9 @@ discard block |
||
| 252 | 265 | $context['removableMessageIDs'] = array(); |
| 253 | 266 | |
| 254 | 267 | // Get all the messages... |
| 255 | - while ($message = $context['get_message']()) |
|
| 256 | - template_single_post($message); |
|
| 268 | + while ($message = $context['get_message']()) { |
|
| 269 | + template_single_post($message); |
|
| 270 | + } |
|
| 257 | 271 | |
| 258 | 272 | echo ' |
| 259 | 273 | </form> |
@@ -290,8 +304,9 @@ discard block |
||
| 290 | 304 | <div id="display_jump_to"> </div>'; |
| 291 | 305 | |
| 292 | 306 | // Show quickreply |
| 293 | - if ($context['can_reply']) |
|
| 294 | - template_quickreply(); |
|
| 307 | + if ($context['can_reply']) { |
|
| 308 | + template_quickreply(); |
|
| 309 | + } |
|
| 295 | 310 | |
| 296 | 311 | // User action pop on mobile screen (or actually small screen), this uses responsive css does not check mobile device. |
| 297 | 312 | echo ' |
@@ -304,8 +319,8 @@ discard block |
||
| 304 | 319 | </div>'; |
| 305 | 320 | |
| 306 | 321 | // Show the moderation button & pop only if user can moderate |
| 307 | - if ($context['can_moderate_forum'] || $context['user']['is_mod']) |
|
| 308 | - echo ' |
|
| 322 | + if ($context['can_moderate_forum'] || $context['user']['is_mod']) { |
|
| 323 | + echo ' |
|
| 309 | 324 | <div id="mobile_moderation" class="popup_container"> |
| 310 | 325 | <div class="popup_window description"> |
| 311 | 326 | <div class="popup_heading">', $txt['mobile_moderation'],' |
@@ -315,6 +330,7 @@ discard block |
||
| 315 | 330 | </div> |
| 316 | 331 | </div> |
| 317 | 332 | </div>'; |
| 333 | + } |
|
| 318 | 334 | |
| 319 | 335 | echo ' |
| 320 | 336 | <script>'; |
@@ -438,9 +454,10 @@ discard block |
||
| 438 | 454 | }); |
| 439 | 455 | }'; |
| 440 | 456 | |
| 441 | - if (!empty($context['ignoredMsgs'])) |
|
| 442 | - echo ' |
|
| 457 | + if (!empty($context['ignoredMsgs'])) { |
|
| 458 | + echo ' |
|
| 443 | 459 | ignore_toggles([', implode(', ', $context['ignoredMsgs']), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');'; |
| 460 | + } |
|
| 444 | 461 | |
| 445 | 462 | echo ' |
| 446 | 463 | </script>'; |
@@ -457,8 +474,9 @@ discard block |
||
| 457 | 474 | |
| 458 | 475 | $ignoring = false; |
| 459 | 476 | |
| 460 | - if ($message['can_remove']) |
|
| 461 | - $context['removableMessageIDs'][] = $message['id']; |
|
| 477 | + if ($message['can_remove']) { |
|
| 478 | + $context['removableMessageIDs'][] = $message['id']; |
|
| 479 | + } |
|
| 462 | 480 | |
| 463 | 481 | // Are we ignoring this message? |
| 464 | 482 | if (!empty($message['is_ignored'])) |
@@ -484,9 +502,10 @@ discard block |
||
| 484 | 502 | <div class="custom_fields_above_member"> |
| 485 | 503 | <ul class="nolist">'; |
| 486 | 504 | |
| 487 | - foreach ($message['custom_fields']['above_member'] as $custom) |
|
| 488 | - echo ' |
|
| 505 | + foreach ($message['custom_fields']['above_member'] as $custom) { |
|
| 506 | + echo ' |
|
| 489 | 507 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 508 | + } |
|
| 490 | 509 | |
| 491 | 510 | echo ' |
| 492 | 511 | </ul> |
@@ -497,9 +516,10 @@ discard block |
||
| 497 | 516 | <h4>'; |
| 498 | 517 | |
| 499 | 518 | // Show online and offline buttons? |
| 500 | - if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
|
| 501 | - echo ' |
|
| 519 | + if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) { |
|
| 520 | + echo ' |
|
| 502 | 521 | ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>', $context['can_send_pm'] ? '</a>' : ''; |
| 522 | + } |
|
| 503 | 523 | |
| 504 | 524 | |
| 505 | 525 | // Show a link to the member's profile. |
@@ -512,51 +532,59 @@ discard block |
||
| 512 | 532 | |
| 513 | 533 | |
| 514 | 534 | // Show the user's avatar. |
| 515 | - if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
| 516 | - echo ' |
|
| 535 | + if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) { |
|
| 536 | + echo ' |
|
| 517 | 537 | <li class="avatar"> |
| 518 | 538 | <a href="', $message['member']['href'], '">', $message['member']['avatar']['image'], '</a> |
| 519 | 539 | </li>'; |
| 540 | + } |
|
| 520 | 541 | |
| 521 | 542 | // Are there any custom fields below the avatar? |
| 522 | - if (!empty($message['custom_fields']['below_avatar'])) |
|
| 523 | - foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 543 | + if (!empty($message['custom_fields']['below_avatar'])) { |
|
| 544 | + foreach ($message['custom_fields']['below_avatar'] as $custom) |
|
| 524 | 545 | echo ' |
| 525 | 546 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 547 | + } |
|
| 526 | 548 | |
| 527 | 549 | // Show the post group icons, but not for guests. |
| 528 | - if (!$message['member']['is_guest']) |
|
| 529 | - echo ' |
|
| 550 | + if (!$message['member']['is_guest']) { |
|
| 551 | + echo ' |
|
| 530 | 552 | <li class="icons">', $message['member']['group_icons'], '</li>'; |
| 553 | + } |
|
| 531 | 554 | |
| 532 | 555 | // Show the member's primary group (like 'Administrator') if they have one. |
| 533 | - if (!empty($message['member']['group'])) |
|
| 534 | - echo ' |
|
| 556 | + if (!empty($message['member']['group'])) { |
|
| 557 | + echo ' |
|
| 535 | 558 | <li class="membergroup">', $message['member']['group'], '</li>'; |
| 559 | + } |
|
| 536 | 560 | |
| 537 | 561 | // Show the member's custom title, if they have one. |
| 538 | - if (!empty($message['member']['title'])) |
|
| 539 | - echo ' |
|
| 562 | + if (!empty($message['member']['title'])) { |
|
| 563 | + echo ' |
|
| 540 | 564 | <li class="title">', $message['member']['title'], '</li>'; |
| 565 | + } |
|
| 541 | 566 | |
| 542 | 567 | // Don't show these things for guests. |
| 543 | 568 | if (!$message['member']['is_guest']) |
| 544 | 569 | { |
| 545 | 570 | |
| 546 | 571 | // Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
| 547 | - if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) |
|
| 548 | - echo ' |
|
| 572 | + if ((empty($modSettings['hide_post_group']) || empty($message['member']['group'])) && !empty($message['member']['post_group'])) { |
|
| 573 | + echo ' |
|
| 549 | 574 | <li class="postgroup">', $message['member']['post_group'], '</li>'; |
| 575 | + } |
|
| 550 | 576 | |
| 551 | 577 | // Show how many posts they have made. |
| 552 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 553 | - echo ' |
|
| 578 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 579 | + echo ' |
|
| 554 | 580 | <li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
| 581 | + } |
|
| 555 | 582 | |
| 556 | 583 | // Show their personal text? |
| 557 | - if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) |
|
| 558 | - echo ' |
|
| 584 | + if (!empty($modSettings['show_blurb']) && !empty($message['member']['blurb'])) { |
|
| 585 | + echo ' |
|
| 559 | 586 | <li class="blurb">', $message['member']['blurb'], '</li>'; |
| 587 | + } |
|
| 560 | 588 | |
| 561 | 589 | // Any custom fields to show as icons? |
| 562 | 590 | if (!empty($message['custom_fields']['icons'])) |
@@ -565,9 +593,10 @@ discard block |
||
| 565 | 593 | <li class="im_icons"> |
| 566 | 594 | <ol>'; |
| 567 | 595 | |
| 568 | - foreach ($message['custom_fields']['icons'] as $custom) |
|
| 569 | - echo ' |
|
| 596 | + foreach ($message['custom_fields']['icons'] as $custom) { |
|
| 597 | + echo ' |
|
| 570 | 598 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 599 | + } |
|
| 571 | 600 | |
| 572 | 601 | echo ' |
| 573 | 602 | </ol> |
@@ -582,19 +611,22 @@ discard block |
||
| 582 | 611 | <ol class="profile_icons">'; |
| 583 | 612 | |
| 584 | 613 | // Don't show an icon if they haven't specified a website. |
| 585 | - if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) |
|
| 586 | - echo ' |
|
| 614 | + if (!empty($message['member']['website']['url']) && !isset($context['disabled_fields']['website'])) { |
|
| 615 | + echo ' |
|
| 587 | 616 | <li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 617 | + } |
|
| 588 | 618 | |
| 589 | 619 | // Since we know this person isn't a guest, you *can* message them. |
| 590 | - if ($context['can_send_pm']) |
|
| 591 | - echo ' |
|
| 620 | + if ($context['can_send_pm']) { |
|
| 621 | + echo ' |
|
| 592 | 622 | <li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
| 623 | + } |
|
| 593 | 624 | |
| 594 | 625 | // Show the email if necessary |
| 595 | - if (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 596 | - echo ' |
|
| 626 | + if (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 627 | + echo ' |
|
| 597 | 628 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 629 | + } |
|
| 598 | 630 | |
| 599 | 631 | echo ' |
| 600 | 632 | </ol> |
@@ -602,48 +634,56 @@ discard block |
||
| 602 | 634 | } |
| 603 | 635 | |
| 604 | 636 | // Any custom fields for standard placement? |
| 605 | - if (!empty($message['custom_fields']['standard'])) |
|
| 606 | - foreach ($message['custom_fields']['standard'] as $custom) |
|
| 637 | + if (!empty($message['custom_fields']['standard'])) { |
|
| 638 | + foreach ($message['custom_fields']['standard'] as $custom) |
|
| 607 | 639 | echo ' |
| 608 | 640 | <li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
| 641 | + } |
|
| 609 | 642 | |
| 610 | 643 | } |
| 611 | 644 | // Otherwise, show the guest's email. |
| 612 | - elseif (!empty($message['member']['email']) && $message['member']['show_email']) |
|
| 613 | - echo ' |
|
| 645 | + elseif (!empty($message['member']['email']) && $message['member']['show_email']) { |
|
| 646 | + echo ' |
|
| 614 | 647 | <li class="email"><a href="mailto:' . $message['member']['email'] . '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
| 648 | + } |
|
| 615 | 649 | |
| 616 | 650 | // Show the IP to this user for this post - because you can moderate? |
| 617 | - if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
|
| 618 | - echo ' |
|
| 651 | + if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) { |
|
| 652 | + echo ' |
|
| 619 | 653 | <li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
| 654 | + } |
|
| 620 | 655 | |
| 621 | 656 | // Or, should we show it because this is you? |
| 622 | - elseif ($message['can_see_ip']) |
|
| 623 | - echo ' |
|
| 657 | + elseif ($message['can_see_ip']) { |
|
| 658 | + echo ' |
|
| 624 | 659 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
| 660 | + } |
|
| 625 | 661 | |
| 626 | 662 | // Okay, are you at least logged in? Then we can show something about why IPs are logged... |
| 627 | - elseif (!$context['user']['is_guest']) |
|
| 628 | - echo ' |
|
| 663 | + elseif (!$context['user']['is_guest']) { |
|
| 664 | + echo ' |
|
| 629 | 665 | <li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
| 666 | + } |
|
| 630 | 667 | |
| 631 | 668 | // Otherwise, you see NOTHING! |
| 632 | - else |
|
| 633 | - echo ' |
|
| 669 | + else { |
|
| 670 | + echo ' |
|
| 634 | 671 | <li class="poster_ip">', $txt['logged'], '</li>'; |
| 672 | + } |
|
| 635 | 673 | |
| 636 | 674 | // Are we showing the warning status? |
| 637 | 675 | // Don't show these things for guests. |
| 638 | - if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) |
|
| 639 | - echo ' |
|
| 676 | + if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) { |
|
| 677 | + echo ' |
|
| 640 | 678 | <li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span> ', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
| 679 | + } |
|
| 641 | 680 | |
| 642 | 681 | // Are there any custom fields to show at the bottom of the poster info? |
| 643 | - if (!empty($message['custom_fields']['bottom_poster'])) |
|
| 644 | - foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 682 | + if (!empty($message['custom_fields']['bottom_poster'])) { |
|
| 683 | + foreach ($message['custom_fields']['bottom_poster'] as $custom) |
|
| 645 | 684 | echo ' |
| 646 | 685 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 686 | + } |
|
| 647 | 687 | |
| 648 | 688 | // Poster info ends. |
| 649 | 689 | echo ' |
@@ -672,9 +712,10 @@ discard block |
||
| 672 | 712 | echo ' |
| 673 | 713 | <span class="smalltext modified" id="modified_', $message['id'], '">'; |
| 674 | 714 | |
| 675 | - if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) |
|
| 676 | - echo |
|
| 715 | + if (!empty($modSettings['show_modify']) && !empty($message['modified']['name'])) { |
|
| 716 | + echo |
|
| 677 | 717 | $message['modified']['last_edit_text']; |
| 718 | + } |
|
| 678 | 719 | |
| 679 | 720 | echo ' |
| 680 | 721 | </span>'; |
@@ -685,22 +726,24 @@ discard block |
||
| 685 | 726 | </div>'; |
| 686 | 727 | |
| 687 | 728 | // Ignoring this user? Hide the post. |
| 688 | - if ($ignoring) |
|
| 689 | - echo ' |
|
| 729 | + if ($ignoring) { |
|
| 730 | + echo ' |
|
| 690 | 731 | <div id="msg_', $message['id'], '_ignored_prompt"> |
| 691 | 732 | ', $txt['ignoring_user'], ' |
| 692 | 733 | <a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
| 693 | 734 | </div>'; |
| 735 | + } |
|
| 694 | 736 | |
| 695 | 737 | // Show the post itself, finally! |
| 696 | 738 | echo ' |
| 697 | 739 | <div class="post">'; |
| 698 | 740 | |
| 699 | - if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) |
|
| 700 | - echo ' |
|
| 741 | + if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) { |
|
| 742 | + echo ' |
|
| 701 | 743 | <div class="approve_post"> |
| 702 | 744 | ', $txt['post_awaiting_approval'], ' |
| 703 | 745 | </div>'; |
| 746 | + } |
|
| 704 | 747 | echo ' |
| 705 | 748 | <div class="inner" data-msgid="', $message['id'], '" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div> |
| 706 | 749 | </div>'; |
@@ -717,9 +760,9 @@ discard block |
||
| 717 | 760 | foreach ($message['attachment'] as $attachment) |
| 718 | 761 | { |
| 719 | 762 | // Do we want this attachment to not be showed here? |
| 720 | - if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) |
|
| 721 | - continue; |
|
| 722 | - elseif (!$div_output) |
|
| 763 | + if (!empty($modSettings['dont_show_attach_under_post']) && !empty($context['show_attach_under_post'][$attachment['id']])) { |
|
| 764 | + continue; |
|
| 765 | + } elseif (!$div_output) |
|
| 723 | 766 | { |
| 724 | 767 | $div_output = true; |
| 725 | 768 | |
@@ -735,9 +778,10 @@ discard block |
||
| 735 | 778 | <fieldset> |
| 736 | 779 | <legend>', $txt['attach_awaiting_approve']; |
| 737 | 780 | |
| 738 | - if ($context['can_approve']) |
|
| 739 | - echo ' |
|
| 781 | + if ($context['can_approve']) { |
|
| 782 | + echo ' |
|
| 740 | 783 | [<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]'; |
| 784 | + } |
|
| 741 | 785 | |
| 742 | 786 | echo ' |
| 743 | 787 | </legend>'; |
@@ -751,12 +795,13 @@ discard block |
||
| 751 | 795 | echo ' |
| 752 | 796 | <div class="attachments_top">'; |
| 753 | 797 | |
| 754 | - if ($attachment['thumbnail']['has_thumb']) |
|
| 755 | - echo ' |
|
| 798 | + if ($attachment['thumbnail']['has_thumb']) { |
|
| 799 | + echo ' |
|
| 756 | 800 | <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" class="atc_img"></a>'; |
| 757 | - else |
|
| 758 | - echo ' |
|
| 801 | + } else { |
|
| 802 | + echo ' |
|
| 759 | 803 | <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" class="atc_img">'; |
| 804 | + } |
|
| 760 | 805 | |
| 761 | 806 | echo ' |
| 762 | 807 | </div>'; |
@@ -766,9 +811,10 @@ discard block |
||
| 766 | 811 | <div class="attachments_bot"> |
| 767 | 812 | <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*"> ' . $attachment['name'] . '</a> '; |
| 768 | 813 | |
| 769 | - if (!$attachment['is_approved'] && $context['can_approve']) |
|
| 770 | - echo ' |
|
| 814 | + if (!$attachment['is_approved'] && $context['can_approve']) { |
|
| 815 | + echo ' |
|
| 771 | 816 | [<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>] | [<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] '; |
| 817 | + } |
|
| 772 | 818 | echo ' |
| 773 | 819 | <br>', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br>' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br>' . sprintf($txt['attach_downloaded'], $attachment['downloads'])), ' |
| 774 | 820 | </div>'; |
@@ -777,33 +823,38 @@ discard block |
||
| 777 | 823 | </div>'; |
| 778 | 824 | |
| 779 | 825 | // Next attachment line ? |
| 780 | - if (++$i % $attachments_per_line === 0) |
|
| 781 | - echo ' |
|
| 826 | + if (++$i % $attachments_per_line === 0) { |
|
| 827 | + echo ' |
|
| 782 | 828 | <br>'; |
| 829 | + } |
|
| 783 | 830 | } |
| 784 | 831 | |
| 785 | 832 | // If we had unapproved attachments clean up. |
| 786 | - if ($last_approved_state == 0) |
|
| 787 | - echo ' |
|
| 833 | + if ($last_approved_state == 0) { |
|
| 834 | + echo ' |
|
| 788 | 835 | </fieldset>'; |
| 836 | + } |
|
| 789 | 837 | |
| 790 | 838 | // Only do this if we output a div above - otherwise it'll break things |
| 791 | - if ($div_output) |
|
| 792 | - echo ' |
|
| 839 | + if ($div_output) { |
|
| 840 | + echo ' |
|
| 793 | 841 | </div>'; |
| 842 | + } |
|
| 794 | 843 | } |
| 795 | 844 | |
| 796 | 845 | // And stuff below the attachments. |
| 797 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 798 | - echo ' |
|
| 846 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 847 | + echo ' |
|
| 799 | 848 | <div class="under_message">'; |
| 849 | + } |
|
| 800 | 850 | |
| 801 | 851 | // Maybe they want to report this post to the moderator(s)? |
| 802 | - if ($context['can_report_moderator']) |
|
| 803 | - echo ' |
|
| 852 | + if ($context['can_report_moderator']) { |
|
| 853 | + echo ' |
|
| 804 | 854 | <ul class="floatright smalltext"> |
| 805 | 855 | <li class="report_link"><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li> |
| 806 | 856 | </ul>'; |
| 857 | + } |
|
| 807 | 858 | |
| 808 | 859 | // What about likes? |
| 809 | 860 | if (!empty($modSettings['enable_likes'])) |
@@ -844,78 +895,91 @@ discard block |
||
| 844 | 895 | <ul class="quickbuttons">'; |
| 845 | 896 | |
| 846 | 897 | // Can they quote? if so they can select and quote as well! |
| 847 | - if ($context['can_quote']) |
|
| 848 | - echo ' |
|
| 898 | + if ($context['can_quote']) { |
|
| 899 | + echo ' |
|
| 849 | 900 | <li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li> |
| 850 | 901 | <li style="display:none;" id="quoteSelected_', $message['id'], '"><a href="javascript:void(0)"><span class="generic_icons quote_selected"></span>', $txt['quote_selected_action'] ,'</a></li>'; |
| 902 | + } |
|
| 851 | 903 | |
| 852 | 904 | // Can the user modify the contents of this post? Show the modify inline image. |
| 853 | - if ($message['can_modify']) |
|
| 854 | - echo ' |
|
| 905 | + if ($message['can_modify']) { |
|
| 906 | + echo ' |
|
| 855 | 907 | <li class="quick_edit"><a title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\', \'', !empty($modSettings['toggle_subject']), '\')"><span class="generic_icons quick_edit_button"></span>', $txt['quick_edit'], '</a></li>'; |
| 908 | + } |
|
| 856 | 909 | |
| 857 | - if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 858 | - echo ' |
|
| 910 | + if ($message['can_approve'] || $message['can_unapprove'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 911 | + echo ' |
|
| 859 | 912 | <li class="post_options">', $txt['post_options']; |
| 913 | + } |
|
| 860 | 914 | |
| 861 | 915 | echo ' |
| 862 | 916 | <ul>'; |
| 863 | 917 | |
| 864 | 918 | // Can the user modify the contents of this post? |
| 865 | - if ($message['can_modify']) |
|
| 866 | - echo ' |
|
| 919 | + if ($message['can_modify']) { |
|
| 920 | + echo ' |
|
| 867 | 921 | <li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '"><span class="generic_icons modify_button"></span>', $txt['modify'], '</a></li>'; |
| 922 | + } |
|
| 868 | 923 | |
| 869 | 924 | // How about... even... remove it entirely?! |
| 870 | - if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) |
|
| 871 | - echo ' |
|
| 925 | + if ($context['can_delete'] && ($context['topic_first_message'] == $message['id'])) { |
|
| 926 | + echo ' |
|
| 872 | 927 | <li><a href="', $scripturl, '?action=removetopic2;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['are_sure_remove_topic'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove_topic'],'</a></li>'; |
| 873 | - elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) |
|
| 874 | - echo ' |
|
| 928 | + } elseif ($message['can_remove'] && ($context['topic_first_message'] != $message['id'])) { |
|
| 929 | + echo ' |
|
| 875 | 930 | <li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message_question'] ,'" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 931 | + } |
|
| 876 | 932 | |
| 877 | 933 | // What about splitting it off the rest of the topic? |
| 878 | - if ($context['can_split'] && !empty($context['real_num_replies'])) |
|
| 879 | - echo ' |
|
| 934 | + if ($context['can_split'] && !empty($context['real_num_replies'])) { |
|
| 935 | + echo ' |
|
| 880 | 936 | <li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '"><span class="generic_icons split_button"></span>', $txt['split'], '</a></li>'; |
| 937 | + } |
|
| 881 | 938 | |
| 882 | 939 | // Can we issue a warning because of this post? Remember, we can't give guests warnings. |
| 883 | - if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) |
|
| 884 | - echo ' |
|
| 940 | + if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) { |
|
| 941 | + echo ' |
|
| 885 | 942 | <li><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="generic_icons warn_button"></span>', $txt['issue_warning'], '</a></li>'; |
| 943 | + } |
|
| 886 | 944 | |
| 887 | 945 | // Can we restore topics? |
| 888 | - if ($context['can_restore_msg']) |
|
| 889 | - echo ' |
|
| 946 | + if ($context['can_restore_msg']) { |
|
| 947 | + echo ' |
|
| 890 | 948 | <li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons restore_button"></span>', $txt['restore_message'], '</a></li>'; |
| 949 | + } |
|
| 891 | 950 | |
| 892 | 951 | // Maybe we can approve it, maybe we should? |
| 893 | - if ($message['can_approve']) |
|
| 894 | - echo ' |
|
| 952 | + if ($message['can_approve']) { |
|
| 953 | + echo ' |
|
| 895 | 954 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons approve_button"></span>', $txt['approve'], '</a></li>'; |
| 955 | + } |
|
| 896 | 956 | |
| 897 | 957 | // Maybe we can unapprove it? |
| 898 | - if ($message['can_unapprove']) |
|
| 899 | - echo ' |
|
| 958 | + if ($message['can_unapprove']) { |
|
| 959 | + echo ' |
|
| 900 | 960 | <li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons unapprove_button"></span>', $txt['unapprove'], '</a></li>'; |
| 961 | + } |
|
| 901 | 962 | |
| 902 | 963 | echo ' |
| 903 | 964 | </ul> |
| 904 | 965 | </li>'; |
| 905 | 966 | |
| 906 | 967 | // Show a checkbox for quick moderation? |
| 907 | - if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) |
|
| 908 | - echo ' |
|
| 968 | + if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) { |
|
| 969 | + echo ' |
|
| 909 | 970 | <li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>'; |
| 971 | + } |
|
| 910 | 972 | |
| 911 | - if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) |
|
| 912 | - echo ' |
|
| 973 | + if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) { |
|
| 974 | + echo ' |
|
| 913 | 975 | </ul>'; |
| 976 | + } |
|
| 914 | 977 | } |
| 915 | 978 | |
| 916 | - if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) |
|
| 917 | - echo ' |
|
| 979 | + if ($context['can_report_moderator'] || !empty($context['can_see_likes']) || !empty($context['can_like']) || $message['can_approve'] || $message['can_unapprove'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg'] || $context['can_quote']) { |
|
| 980 | + echo ' |
|
| 918 | 981 | </div>'; |
| 982 | + } |
|
| 919 | 983 | |
| 920 | 984 | echo ' |
| 921 | 985 | </div> |
@@ -928,9 +992,10 @@ discard block |
||
| 928 | 992 | <div class="custom_fields_above_signature"> |
| 929 | 993 | <ul class="nolist">'; |
| 930 | 994 | |
| 931 | - foreach ($message['custom_fields']['above_signature'] as $custom) |
|
| 932 | - echo ' |
|
| 995 | + foreach ($message['custom_fields']['above_signature'] as $custom) { |
|
| 996 | + echo ' |
|
| 933 | 997 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 998 | + } |
|
| 934 | 999 | |
| 935 | 1000 | echo ' |
| 936 | 1001 | </ul> |
@@ -938,9 +1003,10 @@ discard block |
||
| 938 | 1003 | } |
| 939 | 1004 | |
| 940 | 1005 | // Show the member's signature? |
| 941 | - if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
|
| 942 | - echo ' |
|
| 1006 | + if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) { |
|
| 1007 | + echo ' |
|
| 943 | 1008 | <div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>'; |
| 1009 | + } |
|
| 944 | 1010 | |
| 945 | 1011 | |
| 946 | 1012 | // Are there any custom profile fields for below the signature? |
@@ -950,9 +1016,10 @@ discard block |
||
| 950 | 1016 | <div class="custom_fields_below_signature"> |
| 951 | 1017 | <ul class="nolist">'; |
| 952 | 1018 | |
| 953 | - foreach ($message['custom_fields']['below_signature'] as $custom) |
|
| 954 | - echo ' |
|
| 1019 | + foreach ($message['custom_fields']['below_signature'] as $custom) { |
|
| 1020 | + echo ' |
|
| 955 | 1021 | <li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
| 1022 | + } |
|
| 956 | 1023 | |
| 957 | 1024 | echo ' |
| 958 | 1025 | </ul> |
@@ -1000,8 +1067,8 @@ discard block |
||
| 1000 | 1067 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '">'; |
| 1001 | 1068 | |
| 1002 | 1069 | // Guests just need more. |
| 1003 | - if ($context['user']['is_guest']) |
|
| 1004 | - echo ' |
|
| 1070 | + if ($context['user']['is_guest']) { |
|
| 1071 | + echo ' |
|
| 1005 | 1072 | <dl id="post_header"> |
| 1006 | 1073 | <dt> |
| 1007 | 1074 | ', $txt['name'], ': |
@@ -1016,6 +1083,7 @@ discard block |
||
| 1016 | 1083 | <input type="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required> |
| 1017 | 1084 | </dd> |
| 1018 | 1085 | </dl>'; |
| 1086 | + } |
|
| 1019 | 1087 | |
| 1020 | 1088 | echo ' |
| 1021 | 1089 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), ' |
@@ -1063,8 +1131,8 @@ discard block |
||
| 1063 | 1131 | <br class="clear">'; |
| 1064 | 1132 | |
| 1065 | 1133 | // draft autosave available and the user has it enabled? |
| 1066 | - if (!empty($context['drafts_autosave'])) |
|
| 1067 | - echo ' |
|
| 1134 | + if (!empty($context['drafts_autosave'])) { |
|
| 1135 | + echo ' |
|
| 1068 | 1136 | <script> |
| 1069 | 1137 | var oDraftAutoSave = new smf_DraftAutoSave({ |
| 1070 | 1138 | sSelf: \'oDraftAutoSave\', |
@@ -1076,10 +1144,12 @@ discard block |
||
| 1076 | 1144 | iFreq: ', (empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000), ' |
| 1077 | 1145 | }); |
| 1078 | 1146 | </script>'; |
| 1147 | + } |
|
| 1079 | 1148 | |
| 1080 | - if ($context['show_spellchecking']) |
|
| 1081 | - echo ' |
|
| 1149 | + if ($context['show_spellchecking']) { |
|
| 1150 | + echo ' |
|
| 1082 | 1151 | <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value=""></form>'; |
| 1152 | + } |
|
| 1083 | 1153 | |
| 1084 | 1154 | echo ' |
| 1085 | 1155 | <script> |
@@ -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> |