@@ -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">'; |
@@ -357,11 +361,12 @@ discard block |
||
| 357 | 361 | if (empty($setting) || !is_array($setting)) |
| 358 | 362 | { |
| 359 | 363 | // Insert a separator (unless this is the first item in the list) |
| 360 | - if ($i !== $first_option_key) |
|
| 361 | - echo ' |
|
| 364 | + if ($i !== $first_option_key) { |
|
| 365 | + echo ' |
|
| 362 | 366 | </dl> |
| 363 | 367 | <hr> |
| 364 | 368 | <dl class="settings">'; |
| 369 | + } |
|
| 365 | 370 | |
| 366 | 371 | // Should we give a name to this section? |
| 367 | 372 | if (is_string($setting) && !empty($setting)) |
@@ -369,9 +374,9 @@ discard block |
||
| 369 | 374 | $titled_section = true; |
| 370 | 375 | echo ' |
| 371 | 376 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
| 377 | + } else { |
|
| 378 | + $titled_section = false; |
|
| 372 | 379 | } |
| 373 | - else |
|
| 374 | - $titled_section = false; |
|
| 375 | 380 | |
| 376 | 381 | continue; |
| 377 | 382 | } |
@@ -380,19 +385,21 @@ discard block |
||
| 380 | 385 | <dt ', $context['theme_options_reset'] ? 'style="width:50%"' : '', '>'; |
| 381 | 386 | |
| 382 | 387 | // Show the change option box ? |
| 383 | - if ($context['theme_options_reset']) |
|
| 384 | - echo ' |
|
| 388 | + if ($context['theme_options_reset']) { |
|
| 389 | + echo ' |
|
| 385 | 390 | <span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
| 386 | 391 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
| 387 | 392 | <option value="1">', $txt['themeadmin_reset_options_change'], '</option> |
| 388 | 393 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
| 389 | 394 | </select> </span>'; |
| 395 | + } |
|
| 390 | 396 | |
| 391 | 397 | echo ' |
| 392 | 398 | <label for="options_', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
| 393 | - if (isset($setting['description'])) |
|
| 394 | - echo ' |
|
| 399 | + if (isset($setting['description'])) { |
|
| 400 | + echo ' |
|
| 395 | 401 | <br><span class="smalltext">', $setting['description'], '</span>'; |
| 402 | + } |
|
| 396 | 403 | echo ' |
| 397 | 404 | </dt>'; |
| 398 | 405 | |
@@ -434,13 +441,11 @@ discard block |
||
| 434 | 441 | |
| 435 | 442 | echo ' |
| 436 | 443 | <input type="number"', $min . $max . $step; |
| 437 | - } |
|
| 438 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 444 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 439 | 445 | { |
| 440 | 446 | echo' |
| 441 | 447 | <input type="url"'; |
| 442 | - } |
|
| 443 | - else |
|
| 448 | + } else |
|
| 444 | 449 | { |
| 445 | 450 | echo ' |
| 446 | 451 | <input type="text"'; |
@@ -484,8 +489,8 @@ discard block |
||
| 484 | 489 | <br>'; |
| 485 | 490 | |
| 486 | 491 | // @todo Why can't I edit the default theme popup. |
| 487 | - if ($context['theme_settings']['theme_id'] != 1) |
|
| 488 | - echo ' |
|
| 492 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
| 493 | + echo ' |
|
| 489 | 494 | <div class="cat_bar"> |
| 490 | 495 | <h3 class="catbg config_hd"> |
| 491 | 496 | ', $txt['theme_edit'], ' |
@@ -501,6 +506,7 @@ discard block |
||
| 501 | 506 | </li> |
| 502 | 507 | </ul> |
| 503 | 508 | </div>'; |
| 509 | + } |
|
| 504 | 510 | |
| 505 | 511 | echo ' |
| 506 | 512 | <div class="cat_bar"> |
@@ -554,9 +560,10 @@ discard block |
||
| 554 | 560 | <dd> |
| 555 | 561 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
| 556 | 562 | |
| 557 | - foreach ($context['theme_variants'] as $key => $variant) |
|
| 558 | - echo ' |
|
| 563 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
| 564 | + echo ' |
|
| 559 | 565 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
| 566 | + } |
|
| 560 | 567 | |
| 561 | 568 | echo ' |
| 562 | 569 | </select> |
@@ -592,11 +599,12 @@ discard block |
||
| 592 | 599 | if (empty($setting) || !is_array($setting)) |
| 593 | 600 | { |
| 594 | 601 | // We don't need a separator before the first list element |
| 595 | - if ($i !== $first_setting_key) |
|
| 596 | - echo ' |
|
| 602 | + if ($i !== $first_setting_key) { |
|
| 603 | + echo ' |
|
| 597 | 604 | </dl> |
| 598 | 605 | <hr> |
| 599 | 606 | <dl class="settings">'; |
| 607 | + } |
|
| 600 | 608 | |
| 601 | 609 | // Add a fake heading? |
| 602 | 610 | if (is_string($setting) && !empty($setting)) |
@@ -604,9 +612,9 @@ discard block |
||
| 604 | 612 | $titled_section = true; |
| 605 | 613 | echo ' |
| 606 | 614 | <dt><strong>' . $setting . '</strong></dt><dd></dd>'; |
| 615 | + } else { |
|
| 616 | + $titled_section = false; |
|
| 607 | 617 | } |
| 608 | - else |
|
| 609 | - $titled_section = false; |
|
| 610 | 618 | |
| 611 | 619 | continue; |
| 612 | 620 | } |
@@ -615,9 +623,10 @@ discard block |
||
| 615 | 623 | <dt> |
| 616 | 624 | <label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>:'; |
| 617 | 625 | |
| 618 | - if (isset($setting['description'])) |
|
| 619 | - echo '<br> |
|
| 626 | + if (isset($setting['description'])) { |
|
| 627 | + echo '<br> |
|
| 620 | 628 | <span class="smalltext">', $setting['description'], '</span>'; |
| 629 | + } |
|
| 621 | 630 | |
| 622 | 631 | echo ' |
| 623 | 632 | </dt>'; |
@@ -638,9 +647,10 @@ discard block |
||
| 638 | 647 | <dd> |
| 639 | 648 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
| 640 | 649 | |
| 641 | - foreach ($setting['options'] as $value => $label) |
|
| 642 | - echo ' |
|
| 650 | + foreach ($setting['options'] as $value => $label) { |
|
| 651 | + echo ' |
|
| 643 | 652 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
| 653 | + } |
|
| 644 | 654 | |
| 645 | 655 | echo ' |
| 646 | 656 | </select> |
@@ -669,13 +679,11 @@ discard block |
||
| 669 | 679 | |
| 670 | 680 | echo ' |
| 671 | 681 | <input type="number"', $min . $max . $step; |
| 672 | - } |
|
| 673 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 682 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 674 | 683 | { |
| 675 | 684 | echo' |
| 676 | 685 | <input type="url"'; |
| 677 | - } |
|
| 678 | - else |
|
| 686 | + } else |
|
| 679 | 687 | { |
| 680 | 688 | echo ' |
| 681 | 689 | <input type="text"'; |
@@ -828,21 +836,23 @@ discard block |
||
| 828 | 836 | <div class="windowbg">'; |
| 829 | 837 | |
| 830 | 838 | // Oops! there was an error :( |
| 831 | - if (!empty($context['error_message'])) |
|
| 832 | - echo ' |
|
| 839 | + if (!empty($context['error_message'])) { |
|
| 840 | + echo ' |
|
| 833 | 841 | <p> |
| 834 | 842 | ', $context['error_message'], ' |
| 835 | 843 | </p>'; |
| 844 | + } |
|
| 836 | 845 | |
| 837 | 846 | // Not much to show except a link back... |
| 838 | - else |
|
| 839 | - echo ' |
|
| 847 | + else { |
|
| 848 | + echo ' |
|
| 840 | 849 | <p> |
| 841 | 850 | <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'], ' |
| 842 | 851 | </p> |
| 843 | 852 | <p> |
| 844 | 853 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
| 845 | 854 | </p>'; |
| 855 | + } |
|
| 846 | 856 | |
| 847 | 857 | echo ' |
| 848 | 858 | </div> |
@@ -909,10 +919,11 @@ discard block |
||
| 909 | 919 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
| 910 | 920 | <span class="floatright">'; |
| 911 | 921 | |
| 912 | - if ($template['can_copy']) |
|
| 913 | - 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>'; |
|
| 914 | - else |
|
| 915 | - echo $txt['themeadmin_edit_no_copy']; |
|
| 922 | + if ($template['can_copy']) { |
|
| 923 | + 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>'; |
|
| 924 | + } else { |
|
| 925 | + echo $txt['themeadmin_edit_no_copy']; |
|
| 926 | + } |
|
| 916 | 927 | |
| 917 | 928 | echo ' |
| 918 | 929 | </span> |
@@ -935,11 +946,12 @@ discard block |
||
| 935 | 946 | echo ' |
| 936 | 947 | <div id="admincenter">'; |
| 937 | 948 | |
| 938 | - if (!empty($context['browse_title'])) |
|
| 939 | - echo ' |
|
| 949 | + if (!empty($context['browse_title'])) { |
|
| 950 | + echo ' |
|
| 940 | 951 | <div class="cat_bar"> |
| 941 | 952 | <h3 class="catbg">', $context['browse_title'], '</h3> |
| 942 | 953 | </div>'; |
| 954 | + } |
|
| 943 | 955 | |
| 944 | 956 | echo ' |
| 945 | 957 | <table class="table_grid tborder"> |
@@ -959,14 +971,13 @@ discard block |
||
| 959 | 971 | <tr class="windowbg"> |
| 960 | 972 | <td>'; |
| 961 | 973 | |
| 962 | - if ($file['is_editable']) |
|
| 963 | - echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 964 | - |
|
| 965 | - elseif ($file['is_directory']) |
|
| 966 | - echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 967 | - |
|
| 968 | - else |
|
| 969 | - echo $file['filename']; |
|
| 974 | + if ($file['is_editable']) { |
|
| 975 | + echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 976 | + } elseif ($file['is_directory']) { |
|
| 977 | + echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 978 | + } else { |
|
| 979 | + echo $file['filename']; |
|
| 980 | + } |
|
| 970 | 981 | |
| 971 | 982 | echo ' |
| 972 | 983 | </td> |
@@ -988,11 +999,12 @@ discard block |
||
| 988 | 999 | { |
| 989 | 1000 | global $context, $settings, $scripturl, $txt; |
| 990 | 1001 | |
| 991 | - if ($context['session_error']) |
|
| 992 | - echo ' |
|
| 1002 | + if ($context['session_error']) { |
|
| 1003 | + echo ' |
|
| 993 | 1004 | <div class="errorbox"> |
| 994 | 1005 | ', $txt['error_session_timeout'], ' |
| 995 | 1006 | </div>'; |
| 1007 | + } |
|
| 996 | 1008 | |
| 997 | 1009 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
| 998 | 1010 | echo ' |
@@ -1055,17 +1067,18 @@ discard block |
||
| 1055 | 1067 | try |
| 1056 | 1068 | { |
| 1057 | 1069 | '; |
| 1058 | - if (isBrowser('is_ie')) |
|
| 1059 | - echo ' |
|
| 1070 | + if (isBrowser('is_ie')) { |
|
| 1071 | + echo ' |
|
| 1060 | 1072 | var sheets = frames["css_preview_box"].document.styleSheets; |
| 1061 | 1073 | for (var j = 0; j < sheets.length; j++) |
| 1062 | 1074 | { |
| 1063 | 1075 | if (sheets[j].id == "css_preview_box") |
| 1064 | 1076 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
| 1065 | 1077 | }'; |
| 1066 | - else |
|
| 1067 | - echo ' |
|
| 1078 | + } else { |
|
| 1079 | + echo ' |
|
| 1068 | 1080 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
| 1081 | + } |
|
| 1069 | 1082 | echo ' |
| 1070 | 1083 | } |
| 1071 | 1084 | catch (e) |
@@ -1117,9 +1130,10 @@ discard block |
||
| 1117 | 1130 | </div> |
| 1118 | 1131 | <div class="windowbg">'; |
| 1119 | 1132 | |
| 1120 | - if (!$context['allow_save']) |
|
| 1121 | - echo ' |
|
| 1133 | + if (!$context['allow_save']) { |
|
| 1134 | + echo ' |
|
| 1122 | 1135 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1136 | + } |
|
| 1123 | 1137 | |
| 1124 | 1138 | echo ' |
| 1125 | 1139 | <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> |
@@ -1132,9 +1146,10 @@ discard block |
||
| 1132 | 1146 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1133 | 1147 | |
| 1134 | 1148 | // Hopefully it exists. |
| 1135 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1136 | - echo ' |
|
| 1149 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1150 | + echo ' |
|
| 1137 | 1151 | <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'], '">'; |
| 1152 | + } |
|
| 1138 | 1153 | |
| 1139 | 1154 | echo ' |
| 1140 | 1155 | </form> |
@@ -1148,18 +1163,20 @@ discard block |
||
| 1148 | 1163 | { |
| 1149 | 1164 | global $context, $scripturl, $txt; |
| 1150 | 1165 | |
| 1151 | - if ($context['session_error']) |
|
| 1152 | - echo ' |
|
| 1166 | + if ($context['session_error']) { |
|
| 1167 | + echo ' |
|
| 1153 | 1168 | <div class="errorbox"> |
| 1154 | 1169 | ', $txt['error_session_timeout'], ' |
| 1155 | 1170 | </div>'; |
| 1171 | + } |
|
| 1156 | 1172 | |
| 1157 | - if (isset($context['parse_error'])) |
|
| 1158 | - echo ' |
|
| 1173 | + if (isset($context['parse_error'])) { |
|
| 1174 | + echo ' |
|
| 1159 | 1175 | <div class="errorbox"> |
| 1160 | 1176 | ', $txt['themeadmin_edit_error'], ' |
| 1161 | 1177 | <div><pre>', $context['parse_error'], '</pre></div> |
| 1162 | 1178 | </div>'; |
| 1179 | + } |
|
| 1163 | 1180 | |
| 1164 | 1181 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1165 | 1182 | echo ' |
@@ -1170,16 +1187,18 @@ discard block |
||
| 1170 | 1187 | </div> |
| 1171 | 1188 | <div class="windowbg">'; |
| 1172 | 1189 | |
| 1173 | - if (!$context['allow_save']) |
|
| 1174 | - echo ' |
|
| 1190 | + if (!$context['allow_save']) { |
|
| 1191 | + echo ' |
|
| 1175 | 1192 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1193 | + } |
|
| 1176 | 1194 | |
| 1177 | - foreach ($context['file_parts'] as $part) |
|
| 1178 | - echo ' |
|
| 1195 | + foreach ($context['file_parts'] as $part) { |
|
| 1196 | + echo ' |
|
| 1179 | 1197 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
| 1180 | 1198 | <div class="centertext"> |
| 1181 | 1199 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
| 1182 | 1200 | </div>'; |
| 1201 | + } |
|
| 1183 | 1202 | |
| 1184 | 1203 | echo ' |
| 1185 | 1204 | <div class="padding righttext"> |
@@ -1188,9 +1207,10 @@ discard block |
||
| 1188 | 1207 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1189 | 1208 | |
| 1190 | 1209 | // Hopefully it exists. |
| 1191 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1192 | - echo ' |
|
| 1210 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1211 | + echo ' |
|
| 1193 | 1212 | <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'], '">'; |
| 1213 | + } |
|
| 1194 | 1214 | |
| 1195 | 1215 | echo ' |
| 1196 | 1216 | </div> |
@@ -1206,18 +1226,20 @@ discard block |
||
| 1206 | 1226 | { |
| 1207 | 1227 | global $context, $scripturl, $txt; |
| 1208 | 1228 | |
| 1209 | - if ($context['session_error']) |
|
| 1210 | - echo ' |
|
| 1229 | + if ($context['session_error']) { |
|
| 1230 | + echo ' |
|
| 1211 | 1231 | <div class="errorbox"> |
| 1212 | 1232 | ', $txt['error_session_timeout'], ' |
| 1213 | 1233 | </div>'; |
| 1234 | + } |
|
| 1214 | 1235 | |
| 1215 | 1236 | //Is this file writeable? |
| 1216 | - if (!$context['allow_save']) |
|
| 1217 | - echo ' |
|
| 1237 | + if (!$context['allow_save']) { |
|
| 1238 | + echo ' |
|
| 1218 | 1239 | <div class="errorbox"> |
| 1219 | 1240 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
| 1220 | 1241 | </div>'; |
| 1242 | + } |
|
| 1221 | 1243 | |
| 1222 | 1244 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1223 | 1245 | echo ' |
@@ -1233,9 +1255,10 @@ discard block |
||
| 1233 | 1255 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1234 | 1256 | |
| 1235 | 1257 | // Hopefully it exists. |
| 1236 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1237 | - echo ' |
|
| 1258 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1259 | + echo ' |
|
| 1238 | 1260 | <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'], '">'; |
| 1261 | + } |
|
| 1239 | 1262 | |
| 1240 | 1263 | echo ' |
| 1241 | 1264 | </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) |