@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -645,12 +645,12 @@ |
||
| 645 | 645 | </dd>'; |
| 646 | 646 | } |
| 647 | 647 | // A Textarea? |
| 648 | - elseif ($setting['type'] == 'textarea') |
|
| 648 | + elseif ($setting['type'] == 'textarea') |
|
| 649 | 649 | { |
| 650 | 650 | echo ' |
| 651 | 651 | <dd> |
| 652 | 652 | <textarea rows="4" style="width: 95%;" cols="40" name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">', $setting['value'], '</textarea>'; |
| 653 | - echo ' |
|
| 653 | + echo ' |
|
| 654 | 654 | </dd>'; |
| 655 | 655 | } |
| 656 | 656 | // A regular input box, then? |
@@ -54,9 +54,10 @@ discard block |
||
| 54 | 54 | <dd> |
| 55 | 55 | <div id="known_themes_list">'; |
| 56 | 56 | |
| 57 | - foreach ($context['themes'] as $theme) |
|
| 58 | - echo ' |
|
| 57 | + foreach ($context['themes'] as $theme) { |
|
| 58 | + echo ' |
|
| 59 | 59 | <label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', ' class="input_check"> ', $theme['name'], '</label><br>'; |
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | echo ' |
| 62 | 63 | </div> |
@@ -73,9 +74,10 @@ discard block |
||
| 73 | 74 | <select name="options[theme_guests]" id="theme_guests">'; |
| 74 | 75 | |
| 75 | 76 | // Put an option for each theme in the select box. |
| 76 | - foreach ($context['themes'] as $theme) |
|
| 77 | - echo ' |
|
| 77 | + foreach ($context['themes'] as $theme) { |
|
| 78 | + echo ' |
|
| 78 | 79 | <option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | echo ' |
| 81 | 83 | </select> |
@@ -90,9 +92,10 @@ discard block |
||
| 90 | 92 | <option value="0">', $txt['theme_forum_default'], '</option>'; |
| 91 | 93 | |
| 92 | 94 | // Same thing, this time for changing the theme of everyone. |
| 93 | - foreach ($context['themes'] as $theme) |
|
| 94 | - echo ' |
|
| 95 | + foreach ($context['themes'] as $theme) { |
|
| 96 | + echo ' |
|
| 95 | 97 | <option value="', $theme['id'], '">', $theme['name'], '</option>'; |
| 98 | + } |
|
| 96 | 99 | |
| 97 | 100 | echo ' |
| 98 | 101 | </select> |
@@ -189,11 +192,12 @@ discard block |
||
| 189 | 192 | global $context, $scripturl, $txt; |
| 190 | 193 | |
| 191 | 194 | // Show a nice confirmation message. |
| 192 | - if (isset($_GET['done'])) |
|
| 193 | - echo ' |
|
| 195 | + if (isset($_GET['done'])) { |
|
| 196 | + echo ' |
|
| 194 | 197 | <div class="infobox"> |
| 195 | 198 | ', $txt['theme_confirmed_' . $_GET['done']], ' |
| 196 | 199 | </div>'; |
| 200 | + } |
|
| 197 | 201 | |
| 198 | 202 | echo ' |
| 199 | 203 | <div id="admincenter">'; |
@@ -356,11 +360,12 @@ discard block |
||
| 356 | 360 | if (empty($setting) || !is_array($setting)) |
| 357 | 361 | { |
| 358 | 362 | // Insert a separator (unless this is the first item in the list) |
| 359 | - if ($i !== $first_option_key) |
|
| 360 | - echo ' |
|
| 363 | + if ($i !== $first_option_key) { |
|
| 364 | + echo ' |
|
| 361 | 365 | </dl> |
| 362 | 366 | <hr> |
| 363 | 367 | <dl class="settings">'; |
| 368 | + } |
|
| 364 | 369 | |
| 365 | 370 | // Should we give a name to this section? |
| 366 | 371 | if (is_string($setting) && !empty($setting)) |
@@ -368,9 +373,9 @@ discard block |
||
| 368 | 373 | $titled_section = true; |
| 369 | 374 | echo ' |
| 370 | 375 | <dt><b>' . $setting . '</b></dt><dd></dd>'; |
| 376 | + } else { |
|
| 377 | + $titled_section = false; |
|
| 371 | 378 | } |
| 372 | - else |
|
| 373 | - $titled_section = false; |
|
| 374 | 379 | |
| 375 | 380 | continue; |
| 376 | 381 | } |
@@ -379,19 +384,21 @@ discard block |
||
| 379 | 384 | <dt ', $context['theme_options_reset'] ? 'style="width:50%"' : '', '>'; |
| 380 | 385 | |
| 381 | 386 | // Show the change option box ? |
| 382 | - if ($context['theme_options_reset']) |
|
| 383 | - echo ' |
|
| 387 | + if ($context['theme_options_reset']) { |
|
| 388 | + echo ' |
|
| 384 | 389 | <span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
| 385 | 390 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
| 386 | 391 | <option value="1">', $txt['themeadmin_reset_options_change'], '</option> |
| 387 | 392 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
| 388 | 393 | </select> </span>'; |
| 394 | + } |
|
| 389 | 395 | |
| 390 | 396 | echo ' |
| 391 | 397 | <label for="options_', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>'; |
| 392 | - if (isset($setting['description'])) |
|
| 393 | - echo ' |
|
| 398 | + if (isset($setting['description'])) { |
|
| 399 | + echo ' |
|
| 394 | 400 | <br><span class="smalltext">', $setting['description'], '</span>'; |
| 401 | + } |
|
| 395 | 402 | echo ' |
| 396 | 403 | </dt>'; |
| 397 | 404 | |
@@ -433,13 +440,11 @@ discard block |
||
| 433 | 440 | |
| 434 | 441 | echo ' |
| 435 | 442 | <input type="number"', $min . $max . $step; |
| 436 | - } |
|
| 437 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 443 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 438 | 444 | { |
| 439 | 445 | echo' |
| 440 | 446 | <input type="url"'; |
| 441 | - } |
|
| 442 | - else |
|
| 447 | + } else |
|
| 443 | 448 | { |
| 444 | 449 | echo ' |
| 445 | 450 | <input type="text"'; |
@@ -483,8 +488,8 @@ discard block |
||
| 483 | 488 | <br>'; |
| 484 | 489 | |
| 485 | 490 | // @todo Why can't I edit the default theme popup. |
| 486 | - if ($context['theme_settings']['theme_id'] != 1) |
|
| 487 | - echo ' |
|
| 491 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
| 492 | + echo ' |
|
| 488 | 493 | <div class="cat_bar"> |
| 489 | 494 | <h3 class="catbg config_hd"> |
| 490 | 495 | ', $txt['theme_edit'], ' |
@@ -500,6 +505,7 @@ discard block |
||
| 500 | 505 | </li> |
| 501 | 506 | </ul> |
| 502 | 507 | </div>'; |
| 508 | + } |
|
| 503 | 509 | |
| 504 | 510 | echo ' |
| 505 | 511 | <div class="cat_bar"> |
@@ -553,9 +559,10 @@ discard block |
||
| 553 | 559 | <dd> |
| 554 | 560 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
| 555 | 561 | |
| 556 | - foreach ($context['theme_variants'] as $key => $variant) |
|
| 557 | - echo ' |
|
| 562 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
| 563 | + echo ' |
|
| 558 | 564 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
| 565 | + } |
|
| 559 | 566 | |
| 560 | 567 | echo ' |
| 561 | 568 | </select> |
@@ -590,11 +597,12 @@ discard block |
||
| 590 | 597 | if (empty($setting) || !is_array($setting)) |
| 591 | 598 | { |
| 592 | 599 | // We don't need a separator before the first list element |
| 593 | - if ($i !== $first_setting_key) |
|
| 594 | - echo ' |
|
| 600 | + if ($i !== $first_setting_key) { |
|
| 601 | + echo ' |
|
| 595 | 602 | </dl> |
| 596 | 603 | <hr> |
| 597 | 604 | <dl class="settings">'; |
| 605 | + } |
|
| 598 | 606 | |
| 599 | 607 | // Add a fake heading? |
| 600 | 608 | if (is_string($setting) && !empty($setting)) |
@@ -602,9 +610,9 @@ discard block |
||
| 602 | 610 | $titled_section = true; |
| 603 | 611 | echo ' |
| 604 | 612 | <dt><b>' . $setting . '</b></dt><dd></dd>'; |
| 613 | + } else { |
|
| 614 | + $titled_section = false; |
|
| 605 | 615 | } |
| 606 | - else |
|
| 607 | - $titled_section = false; |
|
| 608 | 616 | |
| 609 | 617 | continue; |
| 610 | 618 | } |
@@ -613,9 +621,10 @@ discard block |
||
| 613 | 621 | <dt> |
| 614 | 622 | <label for="', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>:'; |
| 615 | 623 | |
| 616 | - if (isset($setting['description'])) |
|
| 617 | - echo '<br> |
|
| 624 | + if (isset($setting['description'])) { |
|
| 625 | + echo '<br> |
|
| 618 | 626 | <span class="smalltext">', $setting['description'], '</span>'; |
| 627 | + } |
|
| 619 | 628 | |
| 620 | 629 | echo ' |
| 621 | 630 | </dt>'; |
@@ -636,9 +645,10 @@ discard block |
||
| 636 | 645 | <dd> |
| 637 | 646 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
| 638 | 647 | |
| 639 | - foreach ($setting['options'] as $value => $label) |
|
| 640 | - echo ' |
|
| 648 | + foreach ($setting['options'] as $value => $label) { |
|
| 649 | + echo ' |
|
| 641 | 650 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
| 651 | + } |
|
| 642 | 652 | |
| 643 | 653 | echo ' |
| 644 | 654 | </select> |
@@ -667,13 +677,11 @@ discard block |
||
| 667 | 677 | |
| 668 | 678 | echo ' |
| 669 | 679 | <input type="number"', $min . $max . $step; |
| 670 | - } |
|
| 671 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 680 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 672 | 681 | { |
| 673 | 682 | echo' |
| 674 | 683 | <input type="url"'; |
| 675 | - } |
|
| 676 | - else |
|
| 684 | + } else |
|
| 677 | 685 | { |
| 678 | 686 | echo ' |
| 679 | 687 | <input type="text"'; |
@@ -826,21 +834,23 @@ discard block |
||
| 826 | 834 | <div class="windowbg">'; |
| 827 | 835 | |
| 828 | 836 | // Oops! there was an error :( |
| 829 | - if (!empty($context['error_message'])) |
|
| 830 | - echo ' |
|
| 837 | + if (!empty($context['error_message'])) { |
|
| 838 | + echo ' |
|
| 831 | 839 | <p> |
| 832 | 840 | ', $context['error_message'], ' |
| 833 | 841 | </p>'; |
| 842 | + } |
|
| 834 | 843 | |
| 835 | 844 | // Not much to show except a link back... |
| 836 | - else |
|
| 837 | - echo ' |
|
| 845 | + else { |
|
| 846 | + echo ' |
|
| 838 | 847 | <p> |
| 839 | 848 | <a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], ' |
| 840 | 849 | </p> |
| 841 | 850 | <p> |
| 842 | 851 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
| 843 | 852 | </p>'; |
| 853 | + } |
|
| 844 | 854 | |
| 845 | 855 | echo ' |
| 846 | 856 | </div> |
@@ -907,10 +917,11 @@ discard block |
||
| 907 | 917 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
| 908 | 918 | <span class="floatright">'; |
| 909 | 919 | |
| 910 | - if ($template['can_copy']) |
|
| 911 | - echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 912 | - else |
|
| 913 | - echo $txt['themeadmin_edit_no_copy']; |
|
| 920 | + if ($template['can_copy']) { |
|
| 921 | + echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 922 | + } else { |
|
| 923 | + echo $txt['themeadmin_edit_no_copy']; |
|
| 924 | + } |
|
| 914 | 925 | |
| 915 | 926 | echo ' |
| 916 | 927 | </span> |
@@ -933,11 +944,12 @@ discard block |
||
| 933 | 944 | echo ' |
| 934 | 945 | <div id="admincenter">'; |
| 935 | 946 | |
| 936 | - if (!empty($context['browse_title'])) |
|
| 937 | - echo ' |
|
| 947 | + if (!empty($context['browse_title'])) { |
|
| 948 | + echo ' |
|
| 938 | 949 | <div class="cat_bar"> |
| 939 | 950 | <h3 class="catbg">', $context['browse_title'], '</h3> |
| 940 | 951 | </div>'; |
| 952 | + } |
|
| 941 | 953 | |
| 942 | 954 | echo ' |
| 943 | 955 | <table class="table_grid tborder"> |
@@ -957,14 +969,13 @@ discard block |
||
| 957 | 969 | <tr class="windowbg"> |
| 958 | 970 | <td>'; |
| 959 | 971 | |
| 960 | - if ($file['is_editable']) |
|
| 961 | - echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 962 | - |
|
| 963 | - elseif ($file['is_directory']) |
|
| 964 | - echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 965 | - |
|
| 966 | - else |
|
| 967 | - echo $file['filename']; |
|
| 972 | + if ($file['is_editable']) { |
|
| 973 | + echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 974 | + } elseif ($file['is_directory']) { |
|
| 975 | + echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 976 | + } else { |
|
| 977 | + echo $file['filename']; |
|
| 978 | + } |
|
| 968 | 979 | |
| 969 | 980 | echo ' |
| 970 | 981 | </td> |
@@ -986,11 +997,12 @@ discard block |
||
| 986 | 997 | { |
| 987 | 998 | global $context, $settings, $scripturl, $txt; |
| 988 | 999 | |
| 989 | - if ($context['session_error']) |
|
| 990 | - echo ' |
|
| 1000 | + if ($context['session_error']) { |
|
| 1001 | + echo ' |
|
| 991 | 1002 | <div class="errorbox"> |
| 992 | 1003 | ', $txt['error_session_timeout'], ' |
| 993 | 1004 | </div>'; |
| 1005 | + } |
|
| 994 | 1006 | |
| 995 | 1007 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
| 996 | 1008 | echo ' |
@@ -1053,17 +1065,18 @@ discard block |
||
| 1053 | 1065 | try |
| 1054 | 1066 | { |
| 1055 | 1067 | '; |
| 1056 | - if (isBrowser('is_ie')) |
|
| 1057 | - echo ' |
|
| 1068 | + if (isBrowser('is_ie')) { |
|
| 1069 | + echo ' |
|
| 1058 | 1070 | var sheets = frames["css_preview_box"].document.styleSheets; |
| 1059 | 1071 | for (var j = 0; j < sheets.length; j++) |
| 1060 | 1072 | { |
| 1061 | 1073 | if (sheets[j].id == "css_preview_box") |
| 1062 | 1074 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
| 1063 | 1075 | }'; |
| 1064 | - else |
|
| 1065 | - echo ' |
|
| 1076 | + } else { |
|
| 1077 | + echo ' |
|
| 1066 | 1078 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
| 1079 | + } |
|
| 1067 | 1080 | echo ' |
| 1068 | 1081 | } |
| 1069 | 1082 | catch (e) |
@@ -1115,9 +1128,10 @@ discard block |
||
| 1115 | 1128 | </div> |
| 1116 | 1129 | <div class="windowbg">'; |
| 1117 | 1130 | |
| 1118 | - if (!$context['allow_save']) |
|
| 1119 | - echo ' |
|
| 1131 | + if (!$context['allow_save']) { |
|
| 1132 | + echo ' |
|
| 1120 | 1133 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1134 | + } |
|
| 1121 | 1135 | |
| 1122 | 1136 | echo ' |
| 1123 | 1137 | <textarea name="entire_file" cols="80" rows="20" style="width: 96%; font-family: monospace; margin-top: 1ex; white-space: pre;" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea><br> |
@@ -1130,9 +1144,10 @@ discard block |
||
| 1130 | 1144 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1131 | 1145 | |
| 1132 | 1146 | // Hopefully it exists. |
| 1133 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1134 | - echo ' |
|
| 1147 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1148 | + echo ' |
|
| 1135 | 1149 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1150 | + } |
|
| 1136 | 1151 | |
| 1137 | 1152 | echo ' |
| 1138 | 1153 | </form> |
@@ -1146,18 +1161,20 @@ discard block |
||
| 1146 | 1161 | { |
| 1147 | 1162 | global $context, $scripturl, $txt; |
| 1148 | 1163 | |
| 1149 | - if ($context['session_error']) |
|
| 1150 | - echo ' |
|
| 1164 | + if ($context['session_error']) { |
|
| 1165 | + echo ' |
|
| 1151 | 1166 | <div class="errorbox"> |
| 1152 | 1167 | ', $txt['error_session_timeout'], ' |
| 1153 | 1168 | </div>'; |
| 1169 | + } |
|
| 1154 | 1170 | |
| 1155 | - if (isset($context['parse_error'])) |
|
| 1156 | - echo ' |
|
| 1171 | + if (isset($context['parse_error'])) { |
|
| 1172 | + echo ' |
|
| 1157 | 1173 | <div class="errorbox"> |
| 1158 | 1174 | ', $txt['themeadmin_edit_error'], ' |
| 1159 | 1175 | <div><pre>', $context['parse_error'], '</pre></div> |
| 1160 | 1176 | </div>'; |
| 1177 | + } |
|
| 1161 | 1178 | |
| 1162 | 1179 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1163 | 1180 | echo ' |
@@ -1168,16 +1185,18 @@ discard block |
||
| 1168 | 1185 | </div> |
| 1169 | 1186 | <div class="windowbg">'; |
| 1170 | 1187 | |
| 1171 | - if (!$context['allow_save']) |
|
| 1172 | - echo ' |
|
| 1188 | + if (!$context['allow_save']) { |
|
| 1189 | + echo ' |
|
| 1173 | 1190 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1191 | + } |
|
| 1174 | 1192 | |
| 1175 | - foreach ($context['file_parts'] as $part) |
|
| 1176 | - echo ' |
|
| 1193 | + foreach ($context['file_parts'] as $part) { |
|
| 1194 | + echo ' |
|
| 1177 | 1195 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
| 1178 | 1196 | <div class="centertext"> |
| 1179 | 1197 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
| 1180 | 1198 | </div>'; |
| 1199 | + } |
|
| 1181 | 1200 | |
| 1182 | 1201 | echo ' |
| 1183 | 1202 | <div class="padding righttext"> |
@@ -1186,9 +1205,10 @@ discard block |
||
| 1186 | 1205 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1187 | 1206 | |
| 1188 | 1207 | // Hopefully it exists. |
| 1189 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1190 | - echo ' |
|
| 1208 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1209 | + echo ' |
|
| 1191 | 1210 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1211 | + } |
|
| 1192 | 1212 | |
| 1193 | 1213 | echo ' |
| 1194 | 1214 | </div> |
@@ -1204,18 +1224,20 @@ discard block |
||
| 1204 | 1224 | { |
| 1205 | 1225 | global $context, $scripturl, $txt; |
| 1206 | 1226 | |
| 1207 | - if ($context['session_error']) |
|
| 1208 | - echo ' |
|
| 1227 | + if ($context['session_error']) { |
|
| 1228 | + echo ' |
|
| 1209 | 1229 | <div class="errorbox"> |
| 1210 | 1230 | ', $txt['error_session_timeout'], ' |
| 1211 | 1231 | </div>'; |
| 1232 | + } |
|
| 1212 | 1233 | |
| 1213 | 1234 | //Is this file writeable? |
| 1214 | - if (!$context['allow_save']) |
|
| 1215 | - echo ' |
|
| 1235 | + if (!$context['allow_save']) { |
|
| 1236 | + echo ' |
|
| 1216 | 1237 | <div class="errorbox"> |
| 1217 | 1238 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
| 1218 | 1239 | </div>'; |
| 1240 | + } |
|
| 1219 | 1241 | |
| 1220 | 1242 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1221 | 1243 | echo ' |
@@ -1231,9 +1253,10 @@ discard block |
||
| 1231 | 1253 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1232 | 1254 | |
| 1233 | 1255 | // Hopefully it exists. |
| 1234 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1235 | - echo ' |
|
| 1256 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1257 | + echo ' |
|
| 1236 | 1258 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1259 | + } |
|
| 1237 | 1260 | |
| 1238 | 1261 | echo ' |
| 1239 | 1262 | </div> |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | class CreatePost_Notify_Background extends SMF_BackgroundTask |
| 19 | 19 | { |
| 20 | 20 | /** |
| 21 | - * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 21 | + * This handles notifications when a new post is created - new topic, reply, quotes and mentions. |
|
| 22 | 22 | * @return bool Always returns true |
| 23 | 23 | */ |
| 24 | 24 | public function execute() |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | 108 | if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
| 109 | - continue; |
|
| 109 | + continue; |
|
| 110 | 110 | if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
| 111 | 111 | continue; |
| 112 | 112 | elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
@@ -73,8 +73,9 @@ discard block |
||
| 73 | 73 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 74 | 74 | { |
| 75 | 75 | $groups = array_merge(array($row['id_group'], $row['id_post_group']), (empty($row['additional_groups']) ? array() : explode(',', $row['additional_groups']))); |
| 76 | - if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) |
|
| 77 | - continue; |
|
| 76 | + if (!in_array(1, $groups) && count(array_intersect($groups, explode(',', $row['member_groups']))) == 0) { |
|
| 77 | + continue; |
|
| 78 | + } |
|
| 78 | 79 | |
| 79 | 80 | $members[] = $row['id_member']; |
| 80 | 81 | $watched[$row['id_member']] = $row; |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $smcFunc['db_free_result']($request); |
| 84 | 85 | |
| 85 | - if (empty($members)) |
|
| 86 | - return true; |
|
| 86 | + if (empty($members)) { |
|
| 87 | + return true; |
|
| 88 | + } |
|
| 87 | 89 | |
| 88 | 90 | $members = array_unique($members); |
| 89 | 91 | $prefs = getNotifyPrefs($members, '', true); |
@@ -105,20 +107,23 @@ discard block |
||
| 105 | 107 | $notify_types = !empty($prefs[$member]['msg_notify_type']) ? $prefs[$member]['msg_notify_type'] : 1; |
| 106 | 108 | |
| 107 | 109 | // Don't send a notification if the watching member ignored the member who made the action. |
| 108 | - if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) |
|
| 109 | - continue; |
|
| 110 | - if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) |
|
| 111 | - continue; |
|
| 112 | - elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) |
|
| 113 | - continue; |
|
| 114 | - elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) |
|
| 115 | - continue; |
|
| 116 | - elseif ($notify_types == 4) |
|
| 117 | - continue; |
|
| 110 | + if (!empty($data['pm_ignore_list']) && in_array($data['id_member_updated'], explode(',', $data['pm_ignore_list']))) { |
|
| 111 | + continue; |
|
| 112 | + } |
|
| 113 | + if (!in_array($type, array('reply', 'topic')) && $notify_types == 2 && $member != $data['id_member_started']) { |
|
| 114 | + continue; |
|
| 115 | + } elseif (in_array($type, array('reply', 'topic')) && $member == $posterOptions['id']) { |
|
| 116 | + continue; |
|
| 117 | + } elseif (!in_array($type, array('reply', 'topic')) && $notify_types == 3) { |
|
| 118 | + continue; |
|
| 119 | + } elseif ($notify_types == 4) { |
|
| 120 | + continue; |
|
| 121 | + } |
|
| 118 | 122 | |
| 119 | 123 | if ($frequency > 2 || (!empty($frequency) && $data['sent']) || in_array($member, $done_members) |
| 120 | - || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) |
|
| 121 | - continue; |
|
| 124 | + || (!empty($this->_details['members_only']) && !in_array($member, $this->_details['members_only']))) { |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 122 | 127 | |
| 123 | 128 | // Watched topic? |
| 124 | 129 | if (!empty($data['id_topic']) && $type != 'topic' && !empty($prefs[$member])) |
@@ -128,10 +133,12 @@ discard block |
||
| 128 | 133 | |
| 129 | 134 | if ($type == 'reply') |
| 130 | 135 | { |
| 131 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 132 | - $message_type .= '_body'; |
|
| 133 | - if (!empty($frequency)) |
|
| 134 | - $message_type .= '_once'; |
|
| 136 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 137 | + $message_type .= '_body'; |
|
| 138 | + } |
|
| 139 | + if (!empty($frequency)) { |
|
| 140 | + $message_type .= '_once'; |
|
| 141 | + } |
|
| 135 | 142 | } |
| 136 | 143 | |
| 137 | 144 | $content_type = 'topic'; |
@@ -144,12 +151,14 @@ discard block |
||
| 144 | 151 | $content_type = 'board'; |
| 145 | 152 | |
| 146 | 153 | $message_type = !empty($frequency) ? 'notify_boards_once' : 'notify_boards'; |
| 147 | - if (!empty($prefs[$member]['msg_receive_body'])) |
|
| 148 | - $message_type .= '_body'; |
|
| 154 | + if (!empty($prefs[$member]['msg_receive_body'])) { |
|
| 155 | + $message_type .= '_body'; |
|
| 156 | + } |
|
| 149 | 157 | } |
| 150 | 158 | // If neither of the above, this might be a redundent row due to the OR clause in our SQL query, skip |
| 151 | - else |
|
| 152 | - continue; |
|
| 159 | + else { |
|
| 160 | + continue; |
|
| 161 | + } |
|
| 153 | 162 | |
| 154 | 163 | if ($pref & 0x02) |
| 155 | 164 | { |
@@ -212,14 +221,15 @@ discard block |
||
| 212 | 221 | ); |
| 213 | 222 | |
| 214 | 223 | // Insert the alerts if any |
| 215 | - if (!empty($alert_rows)) |
|
| 216 | - $smcFunc['db_insert']('', |
|
| 224 | + if (!empty($alert_rows)) { |
|
| 225 | + $smcFunc['db_insert']('', |
|
| 217 | 226 | '{db_prefix}user_alerts', |
| 218 | 227 | array('alert_time' => 'int', 'id_member' => 'int', 'id_member_started' => 'int', 'member_name' => 'string', |
| 219 | 228 | 'content_type' => 'string', 'content_id' => 'int', 'content_action' => 'string', 'is_read' => 'int', 'extra' => 'string'), |
| 220 | 229 | $alert_rows, |
| 221 | 230 | array() |
| 222 | 231 | ); |
| 232 | + } |
|
| 223 | 233 | |
| 224 | 234 | return true; |
| 225 | 235 | } |
@@ -230,8 +240,9 @@ discard block |
||
| 230 | 240 | |
| 231 | 241 | foreach ($quotedMembers as $id => $member) |
| 232 | 242 | { |
| 233 | - if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) |
|
| 234 | - continue; |
|
| 243 | + if (!isset($prefs[$id]) || $id == $posterOptions['id'] || empty($prefs[$id]['msg_quote'])) { |
|
| 244 | + continue; |
|
| 245 | + } |
|
| 235 | 246 | |
| 236 | 247 | $done_members[] = $id; |
| 237 | 248 | |
@@ -283,32 +294,35 @@ discard block |
||
| 283 | 294 | { |
| 284 | 295 | if (preg_match('/\[quote(.*)?\]/i', $block, $matches)) |
| 285 | 296 | { |
| 286 | - if ($quote_level == 0) |
|
| 287 | - $message .= '[quote' . $matches[1] . ']'; |
|
| 297 | + if ($quote_level == 0) { |
|
| 298 | + $message .= '[quote' . $matches[1] . ']'; |
|
| 299 | + } |
|
| 288 | 300 | $quote_level++; |
| 289 | - } |
|
| 290 | - elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 301 | + } elseif (preg_match('/\[\/quote\]/i', $block)) |
|
| 291 | 302 | { |
| 292 | - if ($quote_level <= 1) |
|
| 293 | - $message .= '[/quote]'; |
|
| 303 | + if ($quote_level <= 1) { |
|
| 304 | + $message .= '[/quote]'; |
|
| 305 | + } |
|
| 294 | 306 | if ($quote_level >= 1) |
| 295 | 307 | { |
| 296 | 308 | $quote_level--; |
| 297 | 309 | $message .= "\n"; |
| 298 | 310 | } |
| 311 | + } elseif ($quote_level <= 1) { |
|
| 312 | + $message .= $block; |
|
| 299 | 313 | } |
| 300 | - elseif ($quote_level <= 1) |
|
| 301 | - $message .= $block; |
|
| 302 | 314 | } |
| 303 | 315 | |
| 304 | 316 | preg_match_all('/\[quote.*?link=msg=([0-9]+).*?\]/i', $message, $matches); |
| 305 | 317 | |
| 306 | 318 | $id_msgs = $matches[1]; |
| 307 | - foreach ($id_msgs as $k => $id_msg) |
|
| 308 | - $id_msgs[$k] = (int) $id_msg; |
|
| 319 | + foreach ($id_msgs as $k => $id_msg) { |
|
| 320 | + $id_msgs[$k] = (int) $id_msg; |
|
| 321 | + } |
|
| 309 | 322 | |
| 310 | - if (empty($id_msgs)) |
|
| 311 | - return array(); |
|
| 323 | + if (empty($id_msgs)) { |
|
| 324 | + return array(); |
|
| 325 | + } |
|
| 312 | 326 | |
| 313 | 327 | // Get the messages |
| 314 | 328 | $request = $smcFunc['db_query']('', ' |
@@ -326,8 +340,9 @@ discard block |
||
| 326 | 340 | $members = array(); |
| 327 | 341 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 328 | 342 | { |
| 329 | - if ($posterOptions['id'] == $row['id_member']) |
|
| 330 | - continue; |
|
| 343 | + if ($posterOptions['id'] == $row['id_member']) { |
|
| 344 | + continue; |
|
| 345 | + } |
|
| 331 | 346 | |
| 332 | 347 | $members[$row['id_member']] = $row; |
| 333 | 348 | } |
@@ -341,10 +356,11 @@ discard block |
||
| 341 | 356 | |
| 342 | 357 | foreach ($members as $id => $member) |
| 343 | 358 | { |
| 344 | - if (!empty($prefs[$id]['msg_mention'])) |
|
| 345 | - $done_members[] = $id; |
|
| 346 | - else |
|
| 347 | - continue; |
|
| 359 | + if (!empty($prefs[$id]['msg_mention'])) { |
|
| 360 | + $done_members[] = $id; |
|
| 361 | + } else { |
|
| 362 | + continue; |
|
| 363 | + } |
|
| 348 | 364 | |
| 349 | 365 | // Alerts' emails are always instant |
| 350 | 366 | if ($prefs[$id]['msg_mention'] & 0x02) |